diff --git a/_images/2dcollections3d_demo.png b/_images/2dcollections3d_demo.png deleted file mode 100644 index 556b3289f4a..00000000000 Binary files a/_images/2dcollections3d_demo.png and /dev/null differ diff --git a/_images/2dcollections3d_demo1.png b/_images/2dcollections3d_demo1.png deleted file mode 100644 index 556b3289f4a..00000000000 Binary files a/_images/2dcollections3d_demo1.png and /dev/null differ diff --git a/_images/accented_text.png b/_images/accented_text.png deleted file mode 100644 index 7e1cf1b65da..00000000000 Binary files a/_images/accented_text.png and /dev/null differ diff --git a/_images/advanced_hillshading_00.png b/_images/advanced_hillshading_00.png deleted file mode 100644 index 8f05f783c27..00000000000 Binary files a/_images/advanced_hillshading_00.png and /dev/null differ diff --git a/_images/advanced_hillshading_01.png b/_images/advanced_hillshading_01.png deleted file mode 100644 index 0f1a55a2b9d..00000000000 Binary files a/_images/advanced_hillshading_01.png and /dev/null differ diff --git a/_images/advanced_hillshading_02.png b/_images/advanced_hillshading_02.png deleted file mode 100644 index 50c192ef740..00000000000 Binary files a/_images/advanced_hillshading_02.png and /dev/null differ diff --git a/_images/agg_buffer.png b/_images/agg_buffer.png deleted file mode 100644 index ed310997139..00000000000 Binary files a/_images/agg_buffer.png and /dev/null differ diff --git a/_images/agg_buffer_to_array_00.png b/_images/agg_buffer_to_array_00.png deleted file mode 100644 index 8b5bf2e0d1b..00000000000 Binary files a/_images/agg_buffer_to_array_00.png and /dev/null differ diff --git a/_images/agg_buffer_to_array_01.png b/_images/agg_buffer_to_array_01.png deleted file mode 100644 index b3df5233d78..00000000000 Binary files a/_images/agg_buffer_to_array_01.png and /dev/null differ diff --git a/_images/align_ylabels.png b/_images/align_ylabels.png deleted file mode 100644 index f29437dd200..00000000000 Binary files a/_images/align_ylabels.png and /dev/null differ diff --git a/_images/alignment_test.png b/_images/alignment_test.png deleted file mode 100644 index 93e76a1ce8b..00000000000 Binary files a/_images/alignment_test.png and /dev/null differ diff --git a/_images/anatomy1.png b/_images/anatomy1.png deleted file mode 100644 index d3054395b06..00000000000 Binary files a/_images/anatomy1.png and /dev/null differ diff --git a/_images/anchored_artists.png b/_images/anchored_artists.png deleted file mode 100644 index 851c16ae8ca..00000000000 Binary files a/_images/anchored_artists.png and /dev/null differ diff --git a/_images/anchored_box01.png b/_images/anchored_box01.png deleted file mode 100644 index 199bf9de10c..00000000000 Binary files a/_images/anchored_box01.png and /dev/null differ diff --git a/_images/anchored_box02.png b/_images/anchored_box02.png deleted file mode 100644 index 8fbc9105ef8..00000000000 Binary files a/_images/anchored_box02.png and /dev/null differ diff --git a/_images/anchored_box03.png b/_images/anchored_box03.png deleted file mode 100644 index f48ba93cd77..00000000000 Binary files a/_images/anchored_box03.png and /dev/null differ diff --git a/_images/anchored_box04.png b/_images/anchored_box04.png deleted file mode 100644 index 36ff1cad4fe..00000000000 Binary files a/_images/anchored_box04.png and /dev/null differ diff --git a/_images/animation_demo.png b/_images/animation_demo.png deleted file mode 100644 index b6a6bbdc8b5..00000000000 Binary files a/_images/animation_demo.png and /dev/null differ diff --git a/_images/annotate_explain.png b/_images/annotate_explain.png deleted file mode 100644 index 4c5191e227e..00000000000 Binary files a/_images/annotate_explain.png and /dev/null differ diff --git a/_images/annotate_simple01.png b/_images/annotate_simple01.png deleted file mode 100644 index 70ecc28c64b..00000000000 Binary files a/_images/annotate_simple01.png and /dev/null differ diff --git a/_images/annotate_simple02.png b/_images/annotate_simple02.png deleted file mode 100644 index 497efbbfd21..00000000000 Binary files a/_images/annotate_simple02.png and /dev/null differ diff --git a/_images/annotate_simple03.png b/_images/annotate_simple03.png deleted file mode 100644 index 39e697abd39..00000000000 Binary files a/_images/annotate_simple03.png and /dev/null differ diff --git a/_images/annotate_simple04.png b/_images/annotate_simple04.png deleted file mode 100644 index 3fbd0dd9bc5..00000000000 Binary files a/_images/annotate_simple04.png and /dev/null differ diff --git a/_images/annotate_simple_coord01.png b/_images/annotate_simple_coord01.png deleted file mode 100644 index 6c4b91afbfc..00000000000 Binary files a/_images/annotate_simple_coord01.png and /dev/null differ diff --git a/_images/annotate_simple_coord02.png b/_images/annotate_simple_coord02.png deleted file mode 100644 index 958901ee774..00000000000 Binary files a/_images/annotate_simple_coord02.png and /dev/null differ diff --git a/_images/annotate_simple_coord03.png b/_images/annotate_simple_coord03.png deleted file mode 100644 index eba450874c2..00000000000 Binary files a/_images/annotate_simple_coord03.png and /dev/null differ diff --git a/_images/annotate_text_arrow.png b/_images/annotate_text_arrow.png deleted file mode 100644 index 09d2fda32a6..00000000000 Binary files a/_images/annotate_text_arrow.png and /dev/null differ diff --git a/_images/annotate_transform.png b/_images/annotate_transform.png deleted file mode 100644 index 2c6c8e05f4f..00000000000 Binary files a/_images/annotate_transform.png and /dev/null differ diff --git a/_images/annotate_with_units.png b/_images/annotate_with_units.png deleted file mode 100644 index cdc676e0c77..00000000000 Binary files a/_images/annotate_with_units.png and /dev/null differ diff --git a/_images/annotation_basic.png b/_images/annotation_basic.png deleted file mode 100644 index 18c5e2b254d..00000000000 Binary files a/_images/annotation_basic.png and /dev/null differ diff --git a/_images/annotation_demo2_00.png b/_images/annotation_demo2_00.png deleted file mode 100644 index c4bb5a01784..00000000000 Binary files a/_images/annotation_demo2_00.png and /dev/null differ diff --git a/_images/annotation_demo2_01.png b/_images/annotation_demo2_01.png deleted file mode 100644 index 0f7bcd31cb7..00000000000 Binary files a/_images/annotation_demo2_01.png and /dev/null differ diff --git a/_images/annotation_demo3.png b/_images/annotation_demo3.png deleted file mode 100644 index 64a588fb366..00000000000 Binary files a/_images/annotation_demo3.png and /dev/null differ diff --git a/_images/annotation_demo_00.png b/_images/annotation_demo_00.png deleted file mode 100644 index 7d7d905f932..00000000000 Binary files a/_images/annotation_demo_00.png and /dev/null differ diff --git a/_images/annotation_demo_01.png b/_images/annotation_demo_01.png deleted file mode 100644 index afe2eeb7e1d..00000000000 Binary files a/_images/annotation_demo_01.png and /dev/null differ diff --git a/_images/annotation_demo_02.png b/_images/annotation_demo_02.png deleted file mode 100644 index 3b6e5bd8244..00000000000 Binary files a/_images/annotation_demo_02.png and /dev/null differ diff --git a/_images/annotation_polar.png b/_images/annotation_polar.png deleted file mode 100644 index dc70de10be6..00000000000 Binary files a/_images/annotation_polar.png and /dev/null differ diff --git a/_images/anscombe.png b/_images/anscombe.png deleted file mode 100644 index 69e0c88ab64..00000000000 Binary files a/_images/anscombe.png and /dev/null differ diff --git a/_images/arctest.png b/_images/arctest.png deleted file mode 100644 index 9e1cb035a2f..00000000000 Binary files a/_images/arctest.png and /dev/null differ diff --git a/_images/arrow_demo.png b/_images/arrow_demo.png deleted file mode 100644 index c124b7799c6..00000000000 Binary files a/_images/arrow_demo.png and /dev/null differ diff --git a/_images/arrow_demo1.png b/_images/arrow_demo1.png deleted file mode 100644 index c124b7799c6..00000000000 Binary files a/_images/arrow_demo1.png and /dev/null differ diff --git a/_images/arrow_demo2.png b/_images/arrow_demo2.png deleted file mode 100644 index c124b7799c6..00000000000 Binary files a/_images/arrow_demo2.png and /dev/null differ diff --git a/_images/arrow_simple_demo.png b/_images/arrow_simple_demo.png deleted file mode 100644 index 3abe4f341f7..00000000000 Binary files a/_images/arrow_simple_demo.png and /dev/null differ diff --git a/_images/artist_reference.png b/_images/artist_reference.png deleted file mode 100644 index 9822e5c5c99..00000000000 Binary files a/_images/artist_reference.png and /dev/null differ diff --git a/_images/artist_tests.png b/_images/artist_tests.png deleted file mode 100644 index 3ce2f52d4b4..00000000000 Binary files a/_images/artist_tests.png and /dev/null differ diff --git a/_images/aspect_loglog.png b/_images/aspect_loglog.png deleted file mode 100644 index 6e8041bdba0..00000000000 Binary files a/_images/aspect_loglog.png and /dev/null differ diff --git a/_images/auto_subplots_adjust.png b/_images/auto_subplots_adjust.png deleted file mode 100644 index d0574d2ac6b..00000000000 Binary files a/_images/auto_subplots_adjust.png and /dev/null differ diff --git a/_images/autowrap_demo.png b/_images/autowrap_demo.png deleted file mode 100644 index 2a31993d174..00000000000 Binary files a/_images/autowrap_demo.png and /dev/null differ diff --git a/_images/axes_demo.png b/_images/axes_demo.png deleted file mode 100644 index 1bf7252195e..00000000000 Binary files a/_images/axes_demo.png and /dev/null differ diff --git a/_images/axes_props.png b/_images/axes_props.png deleted file mode 100644 index cb396147b70..00000000000 Binary files a/_images/axes_props.png and /dev/null differ diff --git a/_images/axes_zoom_effect.png b/_images/axes_zoom_effect.png deleted file mode 100644 index dcc7443268e..00000000000 Binary files a/_images/axes_zoom_effect.png and /dev/null differ diff --git a/_images/axes_zoom_effect1.png b/_images/axes_zoom_effect1.png deleted file mode 100644 index dcc7443268e..00000000000 Binary files a/_images/axes_zoom_effect1.png and /dev/null differ diff --git a/_images/axhspan_demo.png b/_images/axhspan_demo.png deleted file mode 100644 index 972c3222fba..00000000000 Binary files a/_images/axhspan_demo.png and /dev/null differ diff --git a/_images/axhspan_demo1.png b/_images/axhspan_demo1.png deleted file mode 100644 index 972c3222fba..00000000000 Binary files a/_images/axhspan_demo1.png and /dev/null differ diff --git a/_images/axhspan_demo2.png b/_images/axhspan_demo2.png deleted file mode 100644 index 972c3222fba..00000000000 Binary files a/_images/axhspan_demo2.png and /dev/null differ diff --git a/_images/axis_direction_demo_step01.png b/_images/axis_direction_demo_step01.png deleted file mode 100644 index 3a2a28b3c3c..00000000000 Binary files a/_images/axis_direction_demo_step01.png and /dev/null differ diff --git a/_images/axis_direction_demo_step02.png b/_images/axis_direction_demo_step02.png deleted file mode 100644 index da51f77f9be..00000000000 Binary files a/_images/axis_direction_demo_step02.png and /dev/null differ diff --git a/_images/axis_direction_demo_step03.png b/_images/axis_direction_demo_step03.png deleted file mode 100644 index 2c27c2d24dc..00000000000 Binary files a/_images/axis_direction_demo_step03.png and /dev/null differ diff --git a/_images/axis_direction_demo_step04.png b/_images/axis_direction_demo_step04.png deleted file mode 100644 index e89ce93d901..00000000000 Binary files a/_images/axis_direction_demo_step04.png and /dev/null differ diff --git a/_images/axis_equal_demo.png b/_images/axis_equal_demo.png deleted file mode 100644 index 236cfc81dd5..00000000000 Binary files a/_images/axis_equal_demo.png and /dev/null differ diff --git a/_images/bachelors_degrees_by_gender.png b/_images/bachelors_degrees_by_gender.png deleted file mode 100644 index f9420278f2e..00000000000 Binary files a/_images/bachelors_degrees_by_gender.png and /dev/null differ diff --git a/_images/bar_demo2.png b/_images/bar_demo2.png deleted file mode 100644 index 2d0bb411a16..00000000000 Binary files a/_images/bar_demo2.png and /dev/null differ diff --git a/_images/bar_stacked.png b/_images/bar_stacked.png deleted file mode 100644 index f441b434871..00000000000 Binary files a/_images/bar_stacked.png and /dev/null differ diff --git a/_images/bar_stacked1.png b/_images/bar_stacked1.png deleted file mode 100644 index f441b434871..00000000000 Binary files a/_images/bar_stacked1.png and /dev/null differ diff --git a/_images/bar_stacked2.png b/_images/bar_stacked2.png deleted file mode 100644 index f441b434871..00000000000 Binary files a/_images/bar_stacked2.png and /dev/null differ diff --git a/_images/bar_unit_demo.png b/_images/bar_unit_demo.png deleted file mode 100644 index 5ac478ffd38..00000000000 Binary files a/_images/bar_unit_demo.png and /dev/null differ diff --git a/_images/barb_demo_00.png b/_images/barb_demo_00.png deleted file mode 100644 index 1fc7fc7767f..00000000000 Binary files a/_images/barb_demo_00.png and /dev/null differ diff --git a/_images/barb_demo_001.png b/_images/barb_demo_001.png deleted file mode 100644 index 1fc7fc7767f..00000000000 Binary files a/_images/barb_demo_001.png and /dev/null differ diff --git a/_images/barb_demo_002.png b/_images/barb_demo_002.png deleted file mode 100644 index 1fc7fc7767f..00000000000 Binary files a/_images/barb_demo_002.png and /dev/null differ diff --git a/_images/barb_demo_01.png b/_images/barb_demo_01.png deleted file mode 100644 index 499d9aed4ba..00000000000 Binary files a/_images/barb_demo_01.png and /dev/null differ diff --git a/_images/barb_demo_011.png b/_images/barb_demo_011.png deleted file mode 100644 index 499d9aed4ba..00000000000 Binary files a/_images/barb_demo_011.png and /dev/null differ diff --git a/_images/barb_demo_012.png b/_images/barb_demo_012.png deleted file mode 100644 index 499d9aed4ba..00000000000 Binary files a/_images/barb_demo_012.png and /dev/null differ diff --git a/_images/barchart_demo.png b/_images/barchart_demo.png deleted file mode 100644 index ec1bb95d6eb..00000000000 Binary files a/_images/barchart_demo.png and /dev/null differ diff --git a/_images/barchart_demo1.png b/_images/barchart_demo1.png deleted file mode 100644 index 7452e8793d9..00000000000 Binary files a/_images/barchart_demo1.png and /dev/null differ diff --git a/_images/barchart_demo2.png b/_images/barchart_demo2.png deleted file mode 100644 index c44e573df28..00000000000 Binary files a/_images/barchart_demo2.png and /dev/null differ diff --git a/_images/barchart_demo3.png b/_images/barchart_demo3.png deleted file mode 100644 index ec1bb95d6eb..00000000000 Binary files a/_images/barchart_demo3.png and /dev/null differ diff --git a/_images/barcode_demo.png b/_images/barcode_demo.png deleted file mode 100644 index b61ca7c3072..00000000000 Binary files a/_images/barcode_demo.png and /dev/null differ diff --git a/_images/barh_demo.png b/_images/barh_demo.png deleted file mode 100644 index 9a1bfdee746..00000000000 Binary files a/_images/barh_demo.png and /dev/null differ diff --git a/_images/bars3d_demo.png b/_images/bars3d_demo.png deleted file mode 100644 index a3217a22299..00000000000 Binary files a/_images/bars3d_demo.png and /dev/null differ diff --git a/_images/bars3d_demo1.png b/_images/bars3d_demo1.png deleted file mode 100644 index a3217a22299..00000000000 Binary files a/_images/bars3d_demo1.png and /dev/null differ diff --git a/_images/bbox_intersect.png b/_images/bbox_intersect.png deleted file mode 100644 index bb9b7dc5e9d..00000000000 Binary files a/_images/bbox_intersect.png and /dev/null differ diff --git a/_images/boxplot_color_demo.png b/_images/boxplot_color_demo.png deleted file mode 100644 index 7b5568fbc62..00000000000 Binary files a/_images/boxplot_color_demo.png and /dev/null differ diff --git a/_images/boxplot_demo2.png b/_images/boxplot_demo2.png deleted file mode 100644 index cd7f31cc400..00000000000 Binary files a/_images/boxplot_demo2.png and /dev/null differ diff --git a/_images/boxplot_demo3.png b/_images/boxplot_demo3.png deleted file mode 100644 index c08534722cc..00000000000 Binary files a/_images/boxplot_demo3.png and /dev/null differ diff --git a/_images/boxplot_demo31.png b/_images/boxplot_demo31.png deleted file mode 100644 index c08534722cc..00000000000 Binary files a/_images/boxplot_demo31.png and /dev/null differ diff --git a/_images/boxplot_demo_00.png b/_images/boxplot_demo_00.png deleted file mode 100644 index a1b649e4f50..00000000000 Binary files a/_images/boxplot_demo_00.png and /dev/null differ diff --git a/_images/boxplot_demo_00_00.png b/_images/boxplot_demo_00_00.png deleted file mode 100644 index 7d7b66eb9bb..00000000000 Binary files a/_images/boxplot_demo_00_00.png and /dev/null differ diff --git a/_images/boxplot_demo_00_001.png b/_images/boxplot_demo_00_001.png deleted file mode 100644 index 7d7b66eb9bb..00000000000 Binary files a/_images/boxplot_demo_00_001.png and /dev/null differ diff --git a/_images/boxplot_demo_00_002.png b/_images/boxplot_demo_00_002.png deleted file mode 100644 index 7d7b66eb9bb..00000000000 Binary files a/_images/boxplot_demo_00_002.png and /dev/null differ diff --git a/_images/boxplot_demo_01.png b/_images/boxplot_demo_01.png deleted file mode 100644 index da6f5a8031a..00000000000 Binary files a/_images/boxplot_demo_01.png and /dev/null differ diff --git a/_images/boxplot_demo_01_00.png b/_images/boxplot_demo_01_00.png deleted file mode 100644 index 6d53f972110..00000000000 Binary files a/_images/boxplot_demo_01_00.png and /dev/null differ diff --git a/_images/boxplot_demo_01_001.png b/_images/boxplot_demo_01_001.png deleted file mode 100644 index 6d53f972110..00000000000 Binary files a/_images/boxplot_demo_01_001.png and /dev/null differ diff --git a/_images/boxplot_demo_01_002.png b/_images/boxplot_demo_01_002.png deleted file mode 100644 index 6d53f972110..00000000000 Binary files a/_images/boxplot_demo_01_002.png and /dev/null differ diff --git a/_images/boxplot_demo_02.png b/_images/boxplot_demo_02.png deleted file mode 100644 index e56e4f5bed9..00000000000 Binary files a/_images/boxplot_demo_02.png and /dev/null differ diff --git a/_images/boxplot_demo_03.png b/_images/boxplot_demo_03.png deleted file mode 100644 index 0be74035047..00000000000 Binary files a/_images/boxplot_demo_03.png and /dev/null differ diff --git a/_images/boxplot_demo_04.png b/_images/boxplot_demo_04.png deleted file mode 100644 index 55220b7334d..00000000000 Binary files a/_images/boxplot_demo_04.png and /dev/null differ diff --git a/_images/boxplot_demo_05.png b/_images/boxplot_demo_05.png deleted file mode 100644 index 56660dada52..00000000000 Binary files a/_images/boxplot_demo_05.png and /dev/null differ diff --git a/_images/boxplot_demo_06.png b/_images/boxplot_demo_06.png deleted file mode 100644 index 58c57564321..00000000000 Binary files a/_images/boxplot_demo_06.png and /dev/null differ diff --git a/_images/boxplot_vs_violin_demo.png b/_images/boxplot_vs_violin_demo.png deleted file mode 100644 index 495489bd78b..00000000000 Binary files a/_images/boxplot_vs_violin_demo.png and /dev/null differ diff --git a/_images/broken_axis.png b/_images/broken_axis.png deleted file mode 100644 index 06baf095834..00000000000 Binary files a/_images/broken_axis.png and /dev/null differ diff --git a/_images/broken_barh.png b/_images/broken_barh.png deleted file mode 100644 index 62170ee03a2..00000000000 Binary files a/_images/broken_barh.png and /dev/null differ diff --git a/_images/broken_barh1.png b/_images/broken_barh1.png deleted file mode 100644 index 62170ee03a2..00000000000 Binary files a/_images/broken_barh1.png and /dev/null differ diff --git a/_images/broken_barh2.png b/_images/broken_barh2.png deleted file mode 100644 index 62170ee03a2..00000000000 Binary files a/_images/broken_barh2.png and /dev/null differ diff --git a/_images/bxp_demo_00_00.png b/_images/bxp_demo_00_00.png deleted file mode 100644 index 9b07e4ba31b..00000000000 Binary files a/_images/bxp_demo_00_00.png and /dev/null differ diff --git a/_images/bxp_demo_00_001.png b/_images/bxp_demo_00_001.png deleted file mode 100644 index 9b07e4ba31b..00000000000 Binary files a/_images/bxp_demo_00_001.png and /dev/null differ diff --git a/_images/bxp_demo_01_00.png b/_images/bxp_demo_01_00.png deleted file mode 100644 index 3e9d019ed4b..00000000000 Binary files a/_images/bxp_demo_01_00.png and /dev/null differ diff --git a/_images/bxp_demo_01_001.png b/_images/bxp_demo_01_001.png deleted file mode 100644 index 3e9d019ed4b..00000000000 Binary files a/_images/bxp_demo_01_001.png and /dev/null differ diff --git a/_images/centered_ticklabels.png b/_images/centered_ticklabels.png deleted file mode 100644 index 6938d8c6ca8..00000000000 Binary files a/_images/centered_ticklabels.png and /dev/null differ diff --git a/_images/cohere_demo.png b/_images/cohere_demo.png deleted file mode 100644 index fc5f15cdbb9..00000000000 Binary files a/_images/cohere_demo.png and /dev/null differ diff --git a/_images/cohere_demo1.png b/_images/cohere_demo1.png deleted file mode 100644 index fc5f15cdbb9..00000000000 Binary files a/_images/cohere_demo1.png and /dev/null differ diff --git a/_images/cohere_demo2.png b/_images/cohere_demo2.png deleted file mode 100644 index fc5f15cdbb9..00000000000 Binary files a/_images/cohere_demo2.png and /dev/null differ diff --git a/_images/collections_demo.png b/_images/collections_demo.png deleted file mode 100644 index 16642feb82b..00000000000 Binary files a/_images/collections_demo.png and /dev/null differ diff --git a/_images/color_by_yvalue.png b/_images/color_by_yvalue.png deleted file mode 100644 index 9f570070d5c..00000000000 Binary files a/_images/color_by_yvalue.png and /dev/null differ diff --git a/_images/color_cycle_default.png b/_images/color_cycle_default.png deleted file mode 100644 index e9621044adf..00000000000 Binary files a/_images/color_cycle_default.png and /dev/null differ diff --git a/_images/color_cycle_demo.png b/_images/color_cycle_demo.png deleted file mode 100644 index d8030cea036..00000000000 Binary files a/_images/color_cycle_demo.png and /dev/null differ diff --git a/_images/color_cycle_demo1.png b/_images/color_cycle_demo1.png deleted file mode 100644 index d8030cea036..00000000000 Binary files a/_images/color_cycle_demo1.png and /dev/null differ diff --git a/_images/color_demo.png b/_images/color_demo.png deleted file mode 100644 index 8d66794f59a..00000000000 Binary files a/_images/color_demo.png and /dev/null differ diff --git a/_images/colorbar_basics.png b/_images/colorbar_basics.png deleted file mode 100644 index 5ef231da58e..00000000000 Binary files a/_images/colorbar_basics.png and /dev/null differ diff --git a/_images/colorbar_only.png b/_images/colorbar_only.png deleted file mode 100644 index 6cc20cd1a9e..00000000000 Binary files a/_images/colorbar_only.png and /dev/null differ diff --git a/_images/colorbar_tick_labelling_demo_00.png b/_images/colorbar_tick_labelling_demo_00.png deleted file mode 100644 index 9e0e5ca7892..00000000000 Binary files a/_images/colorbar_tick_labelling_demo_00.png and /dev/null differ diff --git a/_images/colorbar_tick_labelling_demo_01.png b/_images/colorbar_tick_labelling_demo_01.png deleted file mode 100644 index e5490675901..00000000000 Binary files a/_images/colorbar_tick_labelling_demo_01.png and /dev/null differ diff --git a/_images/colormap_normalizations_bounds.png b/_images/colormap_normalizations_bounds.png deleted file mode 100644 index 7fc5d78c02b..00000000000 Binary files a/_images/colormap_normalizations_bounds.png and /dev/null differ diff --git a/_images/colormap_normalizations_custom.png b/_images/colormap_normalizations_custom.png deleted file mode 100644 index fb55ca580dc..00000000000 Binary files a/_images/colormap_normalizations_custom.png and /dev/null differ diff --git a/_images/colormap_normalizations_lognorm.png b/_images/colormap_normalizations_lognorm.png deleted file mode 100644 index 0ab10a105e2..00000000000 Binary files a/_images/colormap_normalizations_lognorm.png and /dev/null differ diff --git a/_images/colormap_normalizations_power.png b/_images/colormap_normalizations_power.png deleted file mode 100644 index 03d84bad71d..00000000000 Binary files a/_images/colormap_normalizations_power.png and /dev/null differ diff --git a/_images/colormap_normalizations_symlognorm.png b/_images/colormap_normalizations_symlognorm.png deleted file mode 100644 index 812f4b7be9a..00000000000 Binary files a/_images/colormap_normalizations_symlognorm.png and /dev/null differ diff --git a/_images/colormaps_reference_00.png b/_images/colormaps_reference_00.png deleted file mode 100644 index ef698994560..00000000000 Binary files a/_images/colormaps_reference_00.png and /dev/null differ diff --git a/_images/colormaps_reference_01.png b/_images/colormaps_reference_01.png deleted file mode 100644 index d5fb54a34da..00000000000 Binary files a/_images/colormaps_reference_01.png and /dev/null differ diff --git a/_images/colormaps_reference_02.png b/_images/colormaps_reference_02.png deleted file mode 100644 index 54e76b9b48b..00000000000 Binary files a/_images/colormaps_reference_02.png and /dev/null differ diff --git a/_images/colormaps_reference_03.png b/_images/colormaps_reference_03.png deleted file mode 100644 index a7c6d1fd819..00000000000 Binary files a/_images/colormaps_reference_03.png and /dev/null differ diff --git a/_images/colormaps_reference_04.png b/_images/colormaps_reference_04.png deleted file mode 100644 index 1b1b4b84f1e..00000000000 Binary files a/_images/colormaps_reference_04.png and /dev/null differ diff --git a/_images/colormaps_reference_05.png b/_images/colormaps_reference_05.png deleted file mode 100644 index 8ca7eaf1484..00000000000 Binary files a/_images/colormaps_reference_05.png and /dev/null differ diff --git a/_images/colors-1_00.png b/_images/colors-1_00.png deleted file mode 100644 index 3c7c773d035..00000000000 Binary files a/_images/colors-1_00.png and /dev/null differ diff --git a/_images/colors-1_01.png b/_images/colors-1_01.png deleted file mode 100644 index c7cb3cb1654..00000000000 Binary files a/_images/colors-1_01.png and /dev/null differ diff --git a/_images/colors-2.png b/_images/colors-2.png deleted file mode 100644 index 208ab714262..00000000000 Binary files a/_images/colors-2.png and /dev/null differ diff --git a/_images/compound_path.png b/_images/compound_path.png deleted file mode 100644 index fd499004146..00000000000 Binary files a/_images/compound_path.png and /dev/null differ diff --git a/_images/compound_path_demo.png b/_images/compound_path_demo.png deleted file mode 100644 index d0e53b7ee99..00000000000 Binary files a/_images/compound_path_demo.png and /dev/null differ diff --git a/_images/connect_simple01.png b/_images/connect_simple01.png deleted file mode 100644 index 4ab97e74ae2..00000000000 Binary files a/_images/connect_simple01.png and /dev/null differ diff --git a/_images/connectionstyle_demo.png b/_images/connectionstyle_demo.png deleted file mode 100644 index 71d1bf4f4e6..00000000000 Binary files a/_images/connectionstyle_demo.png and /dev/null differ diff --git a/_images/contour3d_demo.png b/_images/contour3d_demo.png deleted file mode 100644 index 269c68d9e95..00000000000 Binary files a/_images/contour3d_demo.png and /dev/null differ diff --git a/_images/contour3d_demo1.png b/_images/contour3d_demo1.png deleted file mode 100644 index 269c68d9e95..00000000000 Binary files a/_images/contour3d_demo1.png and /dev/null differ diff --git a/_images/contour3d_demo2.png b/_images/contour3d_demo2.png deleted file mode 100644 index 867b4dee279..00000000000 Binary files a/_images/contour3d_demo2.png and /dev/null differ diff --git a/_images/contour3d_demo21.png b/_images/contour3d_demo21.png deleted file mode 100644 index 867b4dee279..00000000000 Binary files a/_images/contour3d_demo21.png and /dev/null differ diff --git a/_images/contour3d_demo3.png b/_images/contour3d_demo3.png deleted file mode 100644 index 6650c6f592f..00000000000 Binary files a/_images/contour3d_demo3.png and /dev/null differ diff --git a/_images/contour3d_demo31.png b/_images/contour3d_demo31.png deleted file mode 100644 index 6650c6f592f..00000000000 Binary files a/_images/contour3d_demo31.png and /dev/null differ diff --git a/_images/contour_corner_mask.png b/_images/contour_corner_mask.png deleted file mode 100644 index b0e3f741cdd..00000000000 Binary files a/_images/contour_corner_mask.png and /dev/null differ diff --git a/_images/contour_corner_mask1.png b/_images/contour_corner_mask1.png deleted file mode 100644 index b0e3f741cdd..00000000000 Binary files a/_images/contour_corner_mask1.png and /dev/null differ diff --git a/_images/contour_corner_mask2.png b/_images/contour_corner_mask2.png deleted file mode 100644 index b0e3f741cdd..00000000000 Binary files a/_images/contour_corner_mask2.png and /dev/null differ diff --git a/_images/contour_corner_mask3.png b/_images/contour_corner_mask3.png deleted file mode 100644 index b0e3f741cdd..00000000000 Binary files a/_images/contour_corner_mask3.png and /dev/null differ diff --git a/_images/contour_demo_00.png b/_images/contour_demo_00.png deleted file mode 100644 index b2fe02f6530..00000000000 Binary files a/_images/contour_demo_00.png and /dev/null differ diff --git a/_images/contour_demo_001.png b/_images/contour_demo_001.png deleted file mode 100644 index b2fe02f6530..00000000000 Binary files a/_images/contour_demo_001.png and /dev/null differ diff --git a/_images/contour_demo_002.png b/_images/contour_demo_002.png deleted file mode 100644 index b2fe02f6530..00000000000 Binary files a/_images/contour_demo_002.png and /dev/null differ diff --git a/_images/contour_demo_01.png b/_images/contour_demo_01.png deleted file mode 100644 index 515048e6798..00000000000 Binary files a/_images/contour_demo_01.png and /dev/null differ diff --git a/_images/contour_demo_011.png b/_images/contour_demo_011.png deleted file mode 100644 index 515048e6798..00000000000 Binary files a/_images/contour_demo_011.png and /dev/null differ diff --git a/_images/contour_demo_012.png b/_images/contour_demo_012.png deleted file mode 100644 index 515048e6798..00000000000 Binary files a/_images/contour_demo_012.png and /dev/null differ diff --git a/_images/contour_demo_02.png b/_images/contour_demo_02.png deleted file mode 100644 index c8927e86083..00000000000 Binary files a/_images/contour_demo_02.png and /dev/null differ diff --git a/_images/contour_demo_021.png b/_images/contour_demo_021.png deleted file mode 100644 index c8927e86083..00000000000 Binary files a/_images/contour_demo_021.png and /dev/null differ diff --git a/_images/contour_demo_022.png b/_images/contour_demo_022.png deleted file mode 100644 index c8927e86083..00000000000 Binary files a/_images/contour_demo_022.png and /dev/null differ diff --git a/_images/contour_demo_03.png b/_images/contour_demo_03.png deleted file mode 100644 index d2baf253b55..00000000000 Binary files a/_images/contour_demo_03.png and /dev/null differ diff --git a/_images/contour_demo_031.png b/_images/contour_demo_031.png deleted file mode 100644 index d2baf253b55..00000000000 Binary files a/_images/contour_demo_031.png and /dev/null differ diff --git a/_images/contour_demo_032.png b/_images/contour_demo_032.png deleted file mode 100644 index d2baf253b55..00000000000 Binary files a/_images/contour_demo_032.png and /dev/null differ diff --git a/_images/contour_demo_04.png b/_images/contour_demo_04.png deleted file mode 100644 index 3081c247b18..00000000000 Binary files a/_images/contour_demo_04.png and /dev/null differ diff --git a/_images/contour_demo_041.png b/_images/contour_demo_041.png deleted file mode 100644 index 3081c247b18..00000000000 Binary files a/_images/contour_demo_041.png and /dev/null differ diff --git a/_images/contour_demo_042.png b/_images/contour_demo_042.png deleted file mode 100644 index 3081c247b18..00000000000 Binary files a/_images/contour_demo_042.png and /dev/null differ diff --git a/_images/contour_demo_05.png b/_images/contour_demo_05.png deleted file mode 100644 index 34714321b81..00000000000 Binary files a/_images/contour_demo_05.png and /dev/null differ diff --git a/_images/contour_demo_051.png b/_images/contour_demo_051.png deleted file mode 100644 index 34714321b81..00000000000 Binary files a/_images/contour_demo_051.png and /dev/null differ diff --git a/_images/contour_demo_052.png b/_images/contour_demo_052.png deleted file mode 100644 index 34714321b81..00000000000 Binary files a/_images/contour_demo_052.png and /dev/null differ diff --git a/_images/contour_image.png b/_images/contour_image.png deleted file mode 100644 index 82d34d1298e..00000000000 Binary files a/_images/contour_image.png and /dev/null differ diff --git a/_images/contour_label_demo_00.png b/_images/contour_label_demo_00.png deleted file mode 100644 index 537605f1780..00000000000 Binary files a/_images/contour_label_demo_00.png and /dev/null differ diff --git a/_images/contour_label_demo_01.png b/_images/contour_label_demo_01.png deleted file mode 100644 index e7f124ef520..00000000000 Binary files a/_images/contour_label_demo_01.png and /dev/null differ diff --git a/_images/contour_label_demo_02.png b/_images/contour_label_demo_02.png deleted file mode 100644 index 9fdadd6988a..00000000000 Binary files a/_images/contour_label_demo_02.png and /dev/null differ diff --git a/_images/contour_manual_00.png b/_images/contour_manual_00.png deleted file mode 100644 index d30b3ad34d9..00000000000 Binary files a/_images/contour_manual_00.png and /dev/null differ diff --git a/_images/contour_manual_01.png b/_images/contour_manual_01.png deleted file mode 100644 index 79bcf384302..00000000000 Binary files a/_images/contour_manual_01.png and /dev/null differ diff --git a/_images/contourf3d_demo.png b/_images/contourf3d_demo.png deleted file mode 100644 index dd91b3c374f..00000000000 Binary files a/_images/contourf3d_demo.png and /dev/null differ diff --git a/_images/contourf3d_demo1.png b/_images/contourf3d_demo1.png deleted file mode 100644 index dd91b3c374f..00000000000 Binary files a/_images/contourf3d_demo1.png and /dev/null differ diff --git a/_images/contourf3d_demo2.png b/_images/contourf3d_demo2.png deleted file mode 100644 index b3f353d3d71..00000000000 Binary files a/_images/contourf3d_demo2.png and /dev/null differ diff --git a/_images/contourf3d_demo21.png b/_images/contourf3d_demo21.png deleted file mode 100644 index b3f353d3d71..00000000000 Binary files a/_images/contourf3d_demo21.png and /dev/null differ diff --git a/_images/contourf3d_demo22.png b/_images/contourf3d_demo22.png deleted file mode 100644 index b3f353d3d71..00000000000 Binary files a/_images/contourf3d_demo22.png and /dev/null differ diff --git a/_images/contourf3d_demo23.png b/_images/contourf3d_demo23.png deleted file mode 100644 index b3f353d3d71..00000000000 Binary files a/_images/contourf3d_demo23.png and /dev/null differ diff --git a/_images/contourf_demo_00.png b/_images/contourf_demo_00.png deleted file mode 100644 index 56078bc8bf2..00000000000 Binary files a/_images/contourf_demo_00.png and /dev/null differ diff --git a/_images/contourf_demo_001.png b/_images/contourf_demo_001.png deleted file mode 100644 index 56078bc8bf2..00000000000 Binary files a/_images/contourf_demo_001.png and /dev/null differ diff --git a/_images/contourf_demo_002.png b/_images/contourf_demo_002.png deleted file mode 100644 index 56078bc8bf2..00000000000 Binary files a/_images/contourf_demo_002.png and /dev/null differ diff --git a/_images/contourf_demo_01.png b/_images/contourf_demo_01.png deleted file mode 100644 index f2c0d6b21e8..00000000000 Binary files a/_images/contourf_demo_01.png and /dev/null differ diff --git a/_images/contourf_demo_011.png b/_images/contourf_demo_011.png deleted file mode 100644 index f2c0d6b21e8..00000000000 Binary files a/_images/contourf_demo_011.png and /dev/null differ diff --git a/_images/contourf_demo_012.png b/_images/contourf_demo_012.png deleted file mode 100644 index f2c0d6b21e8..00000000000 Binary files a/_images/contourf_demo_012.png and /dev/null differ diff --git a/_images/contourf_demo_02.png b/_images/contourf_demo_02.png deleted file mode 100644 index b4d9cdb3ff9..00000000000 Binary files a/_images/contourf_demo_02.png and /dev/null differ diff --git a/_images/contourf_demo_021.png b/_images/contourf_demo_021.png deleted file mode 100644 index b4d9cdb3ff9..00000000000 Binary files a/_images/contourf_demo_021.png and /dev/null differ diff --git a/_images/contourf_demo_022.png b/_images/contourf_demo_022.png deleted file mode 100644 index b4d9cdb3ff9..00000000000 Binary files a/_images/contourf_demo_022.png and /dev/null differ diff --git a/_images/contourf_hatching_00.png b/_images/contourf_hatching_00.png deleted file mode 100644 index 180eb4b99f0..00000000000 Binary files a/_images/contourf_hatching_00.png and /dev/null differ diff --git a/_images/contourf_hatching_001.png b/_images/contourf_hatching_001.png deleted file mode 100644 index 180eb4b99f0..00000000000 Binary files a/_images/contourf_hatching_001.png and /dev/null differ diff --git a/_images/contourf_hatching_01.png b/_images/contourf_hatching_01.png deleted file mode 100644 index 51e327c62b7..00000000000 Binary files a/_images/contourf_hatching_01.png and /dev/null differ diff --git a/_images/contourf_hatching_011.png b/_images/contourf_hatching_011.png deleted file mode 100644 index 51e327c62b7..00000000000 Binary files a/_images/contourf_hatching_011.png and /dev/null differ diff --git a/_images/contourf_log.png b/_images/contourf_log.png deleted file mode 100644 index c7476b2ce09..00000000000 Binary files a/_images/contourf_log.png and /dev/null differ diff --git a/_images/coords_demo.png b/_images/coords_demo.png deleted file mode 100644 index d482dfca8c1..00000000000 Binary files a/_images/coords_demo.png and /dev/null differ diff --git a/_images/coords_report.png b/_images/coords_report.png deleted file mode 100644 index f2cf305fa8f..00000000000 Binary files a/_images/coords_report.png and /dev/null differ diff --git a/_images/csd_demo.png b/_images/csd_demo.png deleted file mode 100644 index fbe7b6d0222..00000000000 Binary files a/_images/csd_demo.png and /dev/null differ diff --git a/_images/csd_demo1.png b/_images/csd_demo1.png deleted file mode 100644 index fbe7b6d0222..00000000000 Binary files a/_images/csd_demo1.png and /dev/null differ diff --git a/_images/csd_demo2.png b/_images/csd_demo2.png deleted file mode 100644 index fbe7b6d0222..00000000000 Binary files a/_images/csd_demo2.png and /dev/null differ diff --git a/_images/cursor.png b/_images/cursor.png deleted file mode 100644 index 353287d9e2f..00000000000 Binary files a/_images/cursor.png and /dev/null differ diff --git a/_images/custom_boxstyle01.png b/_images/custom_boxstyle01.png deleted file mode 100644 index 188e75769c0..00000000000 Binary files a/_images/custom_boxstyle01.png and /dev/null differ diff --git a/_images/custom_boxstyle02.png b/_images/custom_boxstyle02.png deleted file mode 100644 index 0eea83560fb..00000000000 Binary files a/_images/custom_boxstyle02.png and /dev/null differ diff --git a/_images/custom_cmap_00.png b/_images/custom_cmap_00.png deleted file mode 100644 index e36cfc822fe..00000000000 Binary files a/_images/custom_cmap_00.png and /dev/null differ diff --git a/_images/custom_cmap_01.png b/_images/custom_cmap_01.png deleted file mode 100644 index 1d5565d067b..00000000000 Binary files a/_images/custom_cmap_01.png and /dev/null differ diff --git a/_images/custom_figure_class.png b/_images/custom_figure_class.png deleted file mode 100644 index 5efa114b0fe..00000000000 Binary files a/_images/custom_figure_class.png and /dev/null differ diff --git a/_images/custom_projection_example.png b/_images/custom_projection_example.png deleted file mode 100644 index a93a30c79aa..00000000000 Binary files a/_images/custom_projection_example.png and /dev/null differ diff --git a/_images/custom_scale_example.png b/_images/custom_scale_example.png deleted file mode 100644 index 89db5193221..00000000000 Binary files a/_images/custom_scale_example.png and /dev/null differ diff --git a/_images/custom_shaded_3d_surface.png b/_images/custom_shaded_3d_surface.png deleted file mode 100644 index 093546b02f5..00000000000 Binary files a/_images/custom_shaded_3d_surface.png and /dev/null differ diff --git a/_images/custom_ticker1.png b/_images/custom_ticker1.png deleted file mode 100644 index 409b024d089..00000000000 Binary files a/_images/custom_ticker1.png and /dev/null differ diff --git a/_images/customize_rc.png b/_images/customize_rc.png deleted file mode 100644 index 354f1415c50..00000000000 Binary files a/_images/customize_rc.png and /dev/null differ diff --git a/_images/customized_violin_demo.png b/_images/customized_violin_demo.png deleted file mode 100644 index a6f3c35ff6f..00000000000 Binary files a/_images/customized_violin_demo.png and /dev/null differ diff --git a/_images/dashpointlabel.png b/_images/dashpointlabel.png deleted file mode 100644 index affdaea397d..00000000000 Binary files a/_images/dashpointlabel.png and /dev/null differ diff --git a/_images/date_demo.png b/_images/date_demo.png deleted file mode 100644 index 15f3889c9aa..00000000000 Binary files a/_images/date_demo.png and /dev/null differ diff --git a/_images/date_demo1.png b/_images/date_demo1.png deleted file mode 100644 index 15f3889c9aa..00000000000 Binary files a/_images/date_demo1.png and /dev/null differ diff --git a/_images/date_demo_convert.png b/_images/date_demo_convert.png deleted file mode 100644 index 57ed92c412e..00000000000 Binary files a/_images/date_demo_convert.png and /dev/null differ diff --git a/_images/date_demo_rrule.png b/_images/date_demo_rrule.png deleted file mode 100644 index b2a949f3b56..00000000000 Binary files a/_images/date_demo_rrule.png and /dev/null differ diff --git a/_images/date_index_formatter.png b/_images/date_index_formatter.png deleted file mode 100644 index 604ecebbdee..00000000000 Binary files a/_images/date_index_formatter.png and /dev/null differ diff --git a/_images/date_index_formatter1.png b/_images/date_index_formatter1.png deleted file mode 100644 index 8b7e2239212..00000000000 Binary files a/_images/date_index_formatter1.png and /dev/null differ diff --git a/_images/demo_affine_image.png b/_images/demo_affine_image.png deleted file mode 100644 index d24b5a9b534..00000000000 Binary files a/_images/demo_affine_image.png and /dev/null differ diff --git a/_images/demo_agg_filter.png b/_images/demo_agg_filter.png deleted file mode 100644 index 04540dc331d..00000000000 Binary files a/_images/demo_agg_filter.png and /dev/null differ diff --git a/_images/demo_annotation_box.png b/_images/demo_annotation_box.png deleted file mode 100644 index f19040591fb..00000000000 Binary files a/_images/demo_annotation_box.png and /dev/null differ diff --git a/_images/demo_axes_divider_01_00.png b/_images/demo_axes_divider_01_00.png deleted file mode 100644 index 37c318bf00d..00000000000 Binary files a/_images/demo_axes_divider_01_00.png and /dev/null differ diff --git a/_images/demo_axes_grid2.png b/_images/demo_axes_grid2.png deleted file mode 100644 index 88cd5d225a5..00000000000 Binary files a/_images/demo_axes_grid2.png and /dev/null differ diff --git a/_images/demo_axes_grid21.png b/_images/demo_axes_grid21.png deleted file mode 100644 index 88cd5d225a5..00000000000 Binary files a/_images/demo_axes_grid21.png and /dev/null differ diff --git a/_images/demo_axes_grid3.png b/_images/demo_axes_grid3.png deleted file mode 100644 index 9399197bd42..00000000000 Binary files a/_images/demo_axes_grid3.png and /dev/null differ diff --git a/_images/demo_axes_grid4.png b/_images/demo_axes_grid4.png deleted file mode 100644 index 9af9fdfe638..00000000000 Binary files a/_images/demo_axes_grid4.png and /dev/null differ diff --git a/_images/demo_axes_hbox_divider.png b/_images/demo_axes_hbox_divider.png deleted file mode 100644 index 51108534a27..00000000000 Binary files a/_images/demo_axes_hbox_divider.png and /dev/null differ diff --git a/_images/demo_axes_rgb_00.png b/_images/demo_axes_rgb_00.png deleted file mode 100644 index 83008a136ce..00000000000 Binary files a/_images/demo_axes_rgb_00.png and /dev/null differ diff --git a/_images/demo_axes_rgb_01.png b/_images/demo_axes_rgb_01.png deleted file mode 100644 index 07cf4642e94..00000000000 Binary files a/_images/demo_axes_rgb_01.png and /dev/null differ diff --git a/_images/demo_axis_direction.png b/_images/demo_axis_direction.png deleted file mode 100644 index d0e96ce8347..00000000000 Binary files a/_images/demo_axis_direction.png and /dev/null differ diff --git a/_images/demo_axisline_style.png b/_images/demo_axisline_style.png deleted file mode 100644 index d704ca5b182..00000000000 Binary files a/_images/demo_axisline_style.png and /dev/null differ diff --git a/_images/demo_bboximage.png b/_images/demo_bboximage.png deleted file mode 100644 index decb9f1e0b4..00000000000 Binary files a/_images/demo_bboximage.png and /dev/null differ diff --git a/_images/demo_colorbar_with_inset_locator.png b/_images/demo_colorbar_with_inset_locator.png deleted file mode 100644 index e8540767524..00000000000 Binary files a/_images/demo_colorbar_with_inset_locator.png and /dev/null differ diff --git a/_images/demo_curvelinear_grid.png b/_images/demo_curvelinear_grid.png deleted file mode 100644 index 16bafea95e7..00000000000 Binary files a/_images/demo_curvelinear_grid.png and /dev/null differ diff --git a/_images/demo_curvelinear_grid1.png b/_images/demo_curvelinear_grid1.png deleted file mode 100644 index 16bafea95e7..00000000000 Binary files a/_images/demo_curvelinear_grid1.png and /dev/null differ diff --git a/_images/demo_curvelinear_grid2.png b/_images/demo_curvelinear_grid2.png deleted file mode 100644 index 0a9af0d4943..00000000000 Binary files a/_images/demo_curvelinear_grid2.png and /dev/null differ diff --git a/_images/demo_edge_colorbar.png b/_images/demo_edge_colorbar.png deleted file mode 100644 index 547a3e8db7b..00000000000 Binary files a/_images/demo_edge_colorbar.png and /dev/null differ diff --git a/_images/demo_floating_axes.png b/_images/demo_floating_axes.png deleted file mode 100644 index 548f34fedbb..00000000000 Binary files a/_images/demo_floating_axes.png and /dev/null differ diff --git a/_images/demo_floating_axes1.png b/_images/demo_floating_axes1.png deleted file mode 100644 index d60a886d4e4..00000000000 Binary files a/_images/demo_floating_axes1.png and /dev/null differ diff --git a/_images/demo_floating_axis.png b/_images/demo_floating_axis.png deleted file mode 100644 index a7e2088c5c9..00000000000 Binary files a/_images/demo_floating_axis.png and /dev/null differ diff --git a/_images/demo_floating_axis1.png b/_images/demo_floating_axis1.png deleted file mode 100644 index a7e2088c5c9..00000000000 Binary files a/_images/demo_floating_axis1.png and /dev/null differ diff --git a/_images/demo_gridspec01.png b/_images/demo_gridspec01.png deleted file mode 100644 index ba5bba258f6..00000000000 Binary files a/_images/demo_gridspec01.png and /dev/null differ diff --git a/_images/demo_gridspec011.png b/_images/demo_gridspec011.png deleted file mode 100644 index ba5bba258f6..00000000000 Binary files a/_images/demo_gridspec011.png and /dev/null differ diff --git a/_images/demo_gridspec02.png b/_images/demo_gridspec02.png deleted file mode 100644 index a1a27f8c83c..00000000000 Binary files a/_images/demo_gridspec02.png and /dev/null differ diff --git a/_images/demo_gridspec03.png b/_images/demo_gridspec03.png deleted file mode 100644 index 3165b66afd1..00000000000 Binary files a/_images/demo_gridspec03.png and /dev/null differ diff --git a/_images/demo_gridspec04.png b/_images/demo_gridspec04.png deleted file mode 100644 index ddd12ef69a5..00000000000 Binary files a/_images/demo_gridspec04.png and /dev/null differ diff --git a/_images/demo_gridspec05.png b/_images/demo_gridspec05.png deleted file mode 100644 index 23278afb579..00000000000 Binary files a/_images/demo_gridspec05.png and /dev/null differ diff --git a/_images/demo_gridspec06.png b/_images/demo_gridspec06.png deleted file mode 100644 index 06cceb9d192..00000000000 Binary files a/_images/demo_gridspec06.png and /dev/null differ diff --git a/_images/demo_imagegrid_aspect.png b/_images/demo_imagegrid_aspect.png deleted file mode 100644 index 4e23c61032b..00000000000 Binary files a/_images/demo_imagegrid_aspect.png and /dev/null differ diff --git a/_images/demo_parasite_axes2.png b/_images/demo_parasite_axes2.png deleted file mode 100644 index bac1bdf5e67..00000000000 Binary files a/_images/demo_parasite_axes2.png and /dev/null differ diff --git a/_images/demo_parasite_axes21.png b/_images/demo_parasite_axes21.png deleted file mode 100644 index bac1bdf5e67..00000000000 Binary files a/_images/demo_parasite_axes21.png and /dev/null differ diff --git a/_images/demo_ribbon_box.png b/_images/demo_ribbon_box.png deleted file mode 100644 index 676551e6b31..00000000000 Binary files a/_images/demo_ribbon_box.png and /dev/null differ diff --git a/_images/demo_text_path.png b/_images/demo_text_path.png deleted file mode 100644 index 9b5140d0c60..00000000000 Binary files a/_images/demo_text_path.png and /dev/null differ diff --git a/_images/demo_text_rotation_mode.png b/_images/demo_text_rotation_mode.png deleted file mode 100644 index 8215b09fd4c..00000000000 Binary files a/_images/demo_text_rotation_mode.png and /dev/null differ diff --git a/_images/demo_ticklabel_alignment.png b/_images/demo_ticklabel_alignment.png deleted file mode 100644 index 42cee2ee1b6..00000000000 Binary files a/_images/demo_ticklabel_alignment.png and /dev/null differ diff --git a/_images/demo_tight_layout_00_00.png b/_images/demo_tight_layout_00_00.png deleted file mode 100644 index 7fa0ec15d22..00000000000 Binary files a/_images/demo_tight_layout_00_00.png and /dev/null differ diff --git a/_images/demo_tight_layout_00_01.png b/_images/demo_tight_layout_00_01.png deleted file mode 100644 index ea8fcfa48c7..00000000000 Binary files a/_images/demo_tight_layout_00_01.png and /dev/null differ diff --git a/_images/demo_tight_layout_00_02.png b/_images/demo_tight_layout_00_02.png deleted file mode 100644 index 505daac1747..00000000000 Binary files a/_images/demo_tight_layout_00_02.png and /dev/null differ diff --git a/_images/demo_tight_layout_00_03.png b/_images/demo_tight_layout_00_03.png deleted file mode 100644 index 3f6225bce95..00000000000 Binary files a/_images/demo_tight_layout_00_03.png and /dev/null differ diff --git a/_images/demo_tight_layout_00_04.png b/_images/demo_tight_layout_00_04.png deleted file mode 100644 index fc611f71731..00000000000 Binary files a/_images/demo_tight_layout_00_04.png and /dev/null differ diff --git a/_images/demo_tight_layout_00_05.png b/_images/demo_tight_layout_00_05.png deleted file mode 100644 index 1a1655589b1..00000000000 Binary files a/_images/demo_tight_layout_00_05.png and /dev/null differ diff --git a/_images/demo_tight_layout_00_06.png b/_images/demo_tight_layout_00_06.png deleted file mode 100644 index 3522593b50a..00000000000 Binary files a/_images/demo_tight_layout_00_06.png and /dev/null differ diff --git a/_images/demo_tight_layout_01_00.png b/_images/demo_tight_layout_01_00.png deleted file mode 100644 index f77ef21c7ef..00000000000 Binary files a/_images/demo_tight_layout_01_00.png and /dev/null differ diff --git a/_images/dollar_ticks.png b/_images/dollar_ticks.png deleted file mode 100644 index 6bae9fea040..00000000000 Binary files a/_images/dollar_ticks.png and /dev/null differ diff --git a/_images/dolphin.png b/_images/dolphin.png deleted file mode 100644 index 5d466841232..00000000000 Binary files a/_images/dolphin.png and /dev/null differ diff --git a/_images/donut_demo.png b/_images/donut_demo.png deleted file mode 100644 index 6cd3686ee64..00000000000 Binary files a/_images/donut_demo.png and /dev/null differ diff --git a/_images/ellipse_collection.png b/_images/ellipse_collection.png deleted file mode 100644 index 1e19085b83a..00000000000 Binary files a/_images/ellipse_collection.png and /dev/null differ diff --git a/_images/ellipse_demo.png b/_images/ellipse_demo.png deleted file mode 100644 index 5a76a86c26c..00000000000 Binary files a/_images/ellipse_demo.png and /dev/null differ diff --git a/_images/ellipse_demo1.png b/_images/ellipse_demo1.png deleted file mode 100644 index 5a76a86c26c..00000000000 Binary files a/_images/ellipse_demo1.png and /dev/null differ diff --git a/_images/ellipse_rotated.png b/_images/ellipse_rotated.png deleted file mode 100644 index c849fc88b45..00000000000 Binary files a/_images/ellipse_rotated.png and /dev/null differ diff --git a/_images/ellipse_with_units_00.png b/_images/ellipse_with_units_00.png deleted file mode 100644 index 07ba2fd65d9..00000000000 Binary files a/_images/ellipse_with_units_00.png and /dev/null differ diff --git a/_images/ellipse_with_units_01.png b/_images/ellipse_with_units_01.png deleted file mode 100644 index 05d3b514270..00000000000 Binary files a/_images/ellipse_with_units_01.png and /dev/null differ diff --git a/_images/engineering_formatter.png b/_images/engineering_formatter.png deleted file mode 100644 index 3e38f6e6801..00000000000 Binary files a/_images/engineering_formatter.png and /dev/null differ diff --git a/_images/equal_aspect_ratio.png b/_images/equal_aspect_ratio.png deleted file mode 100644 index 8c63140264f..00000000000 Binary files a/_images/equal_aspect_ratio.png and /dev/null differ diff --git a/_images/errorbar_demo.png b/_images/errorbar_demo.png deleted file mode 100644 index 7522f385cde..00000000000 Binary files a/_images/errorbar_demo.png and /dev/null differ diff --git a/_images/errorbar_demo1.png b/_images/errorbar_demo1.png deleted file mode 100644 index 7522f385cde..00000000000 Binary files a/_images/errorbar_demo1.png and /dev/null differ diff --git a/_images/errorbar_demo2.png b/_images/errorbar_demo2.png deleted file mode 100644 index 7522f385cde..00000000000 Binary files a/_images/errorbar_demo2.png and /dev/null differ diff --git a/_images/errorbar_demo_features.png b/_images/errorbar_demo_features.png deleted file mode 100644 index 743840b6ac2..00000000000 Binary files a/_images/errorbar_demo_features.png and /dev/null differ diff --git a/_images/errorbar_limits.png b/_images/errorbar_limits.png deleted file mode 100644 index 523d9e374a0..00000000000 Binary files a/_images/errorbar_limits.png and /dev/null differ diff --git a/_images/errorbar_limits_00.png b/_images/errorbar_limits_00.png deleted file mode 100644 index 64c85a19918..00000000000 Binary files a/_images/errorbar_limits_00.png and /dev/null differ diff --git a/_images/errorbar_limits_01.png b/_images/errorbar_limits_01.png deleted file mode 100644 index 032c81bd291..00000000000 Binary files a/_images/errorbar_limits_01.png and /dev/null differ diff --git a/_images/errorbar_subsample.png b/_images/errorbar_subsample.png deleted file mode 100644 index affdd35bb77..00000000000 Binary files a/_images/errorbar_subsample.png and /dev/null differ diff --git a/_images/errorbars_and_boxes.png b/_images/errorbars_and_boxes.png deleted file mode 100644 index 90ab98f842b..00000000000 Binary files a/_images/errorbars_and_boxes.png and /dev/null differ diff --git a/_images/evans_test.png b/_images/evans_test.png deleted file mode 100644 index 947f7a6914d..00000000000 Binary files a/_images/evans_test.png and /dev/null differ diff --git a/_images/eventcollection_demo1.png b/_images/eventcollection_demo1.png deleted file mode 100644 index 378c2c5d60d..00000000000 Binary files a/_images/eventcollection_demo1.png and /dev/null differ diff --git a/_images/eventplot_demo1.png b/_images/eventplot_demo1.png deleted file mode 100644 index dd89f0e7aef..00000000000 Binary files a/_images/eventplot_demo1.png and /dev/null differ diff --git a/_images/eventplot_demo2.png b/_images/eventplot_demo2.png deleted file mode 100644 index dd89f0e7aef..00000000000 Binary files a/_images/eventplot_demo2.png and /dev/null differ diff --git a/_images/eventplot_demo3.png b/_images/eventplot_demo3.png deleted file mode 100644 index dd89f0e7aef..00000000000 Binary files a/_images/eventplot_demo3.png and /dev/null differ diff --git a/_images/fahrenheit_celsius_scales.png b/_images/fahrenheit_celsius_scales.png deleted file mode 100644 index d2fc1885a81..00000000000 Binary files a/_images/fahrenheit_celsius_scales.png and /dev/null differ diff --git a/_images/fancyarrow_demo.png b/_images/fancyarrow_demo.png deleted file mode 100644 index ff2a6c86837..00000000000 Binary files a/_images/fancyarrow_demo.png and /dev/null differ diff --git a/_images/fancyarrow_demo1.png b/_images/fancyarrow_demo1.png deleted file mode 100644 index ff2a6c86837..00000000000 Binary files a/_images/fancyarrow_demo1.png and /dev/null differ diff --git a/_images/fancyarrow_demo2.png b/_images/fancyarrow_demo2.png deleted file mode 100644 index ff2a6c86837..00000000000 Binary files a/_images/fancyarrow_demo2.png and /dev/null differ diff --git a/_images/fancybox_demo2.png b/_images/fancybox_demo2.png deleted file mode 100644 index acdf541378b..00000000000 Binary files a/_images/fancybox_demo2.png and /dev/null differ diff --git a/_images/fancybox_demo21.png b/_images/fancybox_demo21.png deleted file mode 100644 index acdf541378b..00000000000 Binary files a/_images/fancybox_demo21.png and /dev/null differ diff --git a/_images/fancybox_demo22.png b/_images/fancybox_demo22.png deleted file mode 100644 index acdf541378b..00000000000 Binary files a/_images/fancybox_demo22.png and /dev/null differ diff --git a/_images/fancybox_demo_01_00.png b/_images/fancybox_demo_01_00.png deleted file mode 100644 index be3619e6f68..00000000000 Binary files a/_images/fancybox_demo_01_00.png and /dev/null differ diff --git a/_images/fancytextbox_demo.png b/_images/fancytextbox_demo.png deleted file mode 100644 index 50f307dc89f..00000000000 Binary files a/_images/fancytextbox_demo.png and /dev/null differ diff --git a/_images/fig_axes_customize_simple.png b/_images/fig_axes_customize_simple.png deleted file mode 100644 index ca54b608f6f..00000000000 Binary files a/_images/fig_axes_customize_simple.png and /dev/null differ diff --git a/_images/fig_axes_labels_simple.png b/_images/fig_axes_labels_simple.png deleted file mode 100644 index cb5356f0760..00000000000 Binary files a/_images/fig_axes_labels_simple.png and /dev/null differ diff --git a/_images/fig_x.png b/_images/fig_x.png deleted file mode 100644 index 0f587d4d0b4..00000000000 Binary files a/_images/fig_x.png and /dev/null differ diff --git a/_images/figimage_demo.png b/_images/figimage_demo.png deleted file mode 100644 index 806dadd8225..00000000000 Binary files a/_images/figimage_demo.png and /dev/null differ diff --git a/_images/figimage_demo1.png b/_images/figimage_demo1.png deleted file mode 100644 index 806dadd8225..00000000000 Binary files a/_images/figimage_demo1.png and /dev/null differ diff --git a/_images/figlegend_demo.png b/_images/figlegend_demo.png deleted file mode 100644 index ca9ebf8584b..00000000000 Binary files a/_images/figlegend_demo.png and /dev/null differ diff --git a/_images/figlegend_demo1.png b/_images/figlegend_demo1.png deleted file mode 100644 index ca9ebf8584b..00000000000 Binary files a/_images/figlegend_demo1.png and /dev/null differ diff --git a/_images/figure_title.png b/_images/figure_title.png deleted file mode 100644 index 1c22ff36749..00000000000 Binary files a/_images/figure_title.png and /dev/null differ diff --git a/_images/fill_between_demo_00.png b/_images/fill_between_demo_00.png deleted file mode 100644 index 4033b51f171..00000000000 Binary files a/_images/fill_between_demo_00.png and /dev/null differ diff --git a/_images/fill_between_demo_001.png b/_images/fill_between_demo_001.png deleted file mode 100644 index 4033b51f171..00000000000 Binary files a/_images/fill_between_demo_001.png and /dev/null differ diff --git a/_images/fill_between_demo_002.png b/_images/fill_between_demo_002.png deleted file mode 100644 index 4033b51f171..00000000000 Binary files a/_images/fill_between_demo_002.png and /dev/null differ diff --git a/_images/fill_between_demo_01.png b/_images/fill_between_demo_01.png deleted file mode 100644 index 2878b65f9c1..00000000000 Binary files a/_images/fill_between_demo_01.png and /dev/null differ diff --git a/_images/fill_between_demo_011.png b/_images/fill_between_demo_011.png deleted file mode 100644 index 2878b65f9c1..00000000000 Binary files a/_images/fill_between_demo_011.png and /dev/null differ diff --git a/_images/fill_between_demo_012.png b/_images/fill_between_demo_012.png deleted file mode 100644 index 2878b65f9c1..00000000000 Binary files a/_images/fill_between_demo_012.png and /dev/null differ diff --git a/_images/fill_between_demo_02.png b/_images/fill_between_demo_02.png deleted file mode 100644 index 139ccabace0..00000000000 Binary files a/_images/fill_between_demo_02.png and /dev/null differ diff --git a/_images/fill_between_demo_021.png b/_images/fill_between_demo_021.png deleted file mode 100644 index 139ccabace0..00000000000 Binary files a/_images/fill_between_demo_021.png and /dev/null differ diff --git a/_images/fill_between_demo_022.png b/_images/fill_between_demo_022.png deleted file mode 100644 index 139ccabace0..00000000000 Binary files a/_images/fill_between_demo_022.png and /dev/null differ diff --git a/_images/fill_betweenx_demo_00.png b/_images/fill_betweenx_demo_00.png deleted file mode 100644 index 4e520c19614..00000000000 Binary files a/_images/fill_betweenx_demo_00.png and /dev/null differ diff --git a/_images/fill_betweenx_demo_001.png b/_images/fill_betweenx_demo_001.png deleted file mode 100644 index 4e520c19614..00000000000 Binary files a/_images/fill_betweenx_demo_001.png and /dev/null differ diff --git a/_images/fill_betweenx_demo_002.png b/_images/fill_betweenx_demo_002.png deleted file mode 100644 index 4e520c19614..00000000000 Binary files a/_images/fill_betweenx_demo_002.png and /dev/null differ diff --git a/_images/fill_betweenx_demo_01.png b/_images/fill_betweenx_demo_01.png deleted file mode 100644 index 44e3ac163f0..00000000000 Binary files a/_images/fill_betweenx_demo_01.png and /dev/null differ diff --git a/_images/fill_betweenx_demo_011.png b/_images/fill_betweenx_demo_011.png deleted file mode 100644 index 44e3ac163f0..00000000000 Binary files a/_images/fill_betweenx_demo_011.png and /dev/null differ diff --git a/_images/fill_betweenx_demo_012.png b/_images/fill_betweenx_demo_012.png deleted file mode 100644 index 44e3ac163f0..00000000000 Binary files a/_images/fill_betweenx_demo_012.png and /dev/null differ diff --git a/_images/fill_demo.png b/_images/fill_demo.png deleted file mode 100644 index b0a2e97f9c5..00000000000 Binary files a/_images/fill_demo.png and /dev/null differ diff --git a/_images/fill_demo1.png b/_images/fill_demo1.png deleted file mode 100644 index b0a2e97f9c5..00000000000 Binary files a/_images/fill_demo1.png and /dev/null differ diff --git a/_images/fill_demo2.png b/_images/fill_demo2.png deleted file mode 100644 index b0a2e97f9c5..00000000000 Binary files a/_images/fill_demo2.png and /dev/null differ diff --git a/_images/fill_demo3.png b/_images/fill_demo3.png deleted file mode 100644 index b0a2e97f9c5..00000000000 Binary files a/_images/fill_demo3.png and /dev/null differ diff --git a/_images/fill_demo_features.png b/_images/fill_demo_features.png deleted file mode 100644 index d0f444e5b3f..00000000000 Binary files a/_images/fill_demo_features.png and /dev/null differ diff --git a/_images/fill_spiral.png b/_images/fill_spiral.png deleted file mode 100644 index 1b6025297cb..00000000000 Binary files a/_images/fill_spiral.png and /dev/null differ diff --git a/_images/filled_step_00.png b/_images/filled_step_00.png deleted file mode 100644 index 1db676e2359..00000000000 Binary files a/_images/filled_step_00.png and /dev/null differ diff --git a/_images/filled_step_001.png b/_images/filled_step_001.png deleted file mode 100644 index 1db676e2359..00000000000 Binary files a/_images/filled_step_001.png and /dev/null differ diff --git a/_images/filled_step_01.png b/_images/filled_step_01.png deleted file mode 100644 index c63b05f9950..00000000000 Binary files a/_images/filled_step_01.png and /dev/null differ diff --git a/_images/filled_step_011.png b/_images/filled_step_011.png deleted file mode 100644 index c63b05f9950..00000000000 Binary files a/_images/filled_step_011.png and /dev/null differ diff --git a/_images/findobj_demo.png b/_images/findobj_demo.png deleted file mode 100644 index cf57e80e311..00000000000 Binary files a/_images/findobj_demo.png and /dev/null differ diff --git a/_images/firefox.png b/_images/firefox.png deleted file mode 100644 index f2da0ee390a..00000000000 Binary files a/_images/firefox.png and /dev/null differ diff --git a/_images/fonts_demo.png b/_images/fonts_demo.png deleted file mode 100644 index 9eadd3dd455..00000000000 Binary files a/_images/fonts_demo.png and /dev/null differ diff --git a/_images/fonts_demo_kw.png b/_images/fonts_demo_kw.png deleted file mode 100644 index 45129e1aad0..00000000000 Binary files a/_images/fonts_demo_kw.png and /dev/null differ diff --git a/_images/ganged_plots.png b/_images/ganged_plots.png deleted file mode 100644 index 1d62e6eca78..00000000000 Binary files a/_images/ganged_plots.png and /dev/null differ diff --git a/_images/geo_demo_00.png b/_images/geo_demo_00.png deleted file mode 100644 index 6eb2d293d4d..00000000000 Binary files a/_images/geo_demo_00.png and /dev/null differ diff --git a/_images/geo_demo_01.png b/_images/geo_demo_01.png deleted file mode 100644 index 71a5d626484..00000000000 Binary files a/_images/geo_demo_01.png and /dev/null differ diff --git a/_images/geo_demo_02.png b/_images/geo_demo_02.png deleted file mode 100644 index 1d0e6520769..00000000000 Binary files a/_images/geo_demo_02.png and /dev/null differ diff --git a/_images/geo_demo_03.png b/_images/geo_demo_03.png deleted file mode 100644 index 74e198df1c9..00000000000 Binary files a/_images/geo_demo_03.png and /dev/null differ diff --git a/_images/gradient_bar.png b/_images/gradient_bar.png deleted file mode 100644 index 5d3af52e53e..00000000000 Binary files a/_images/gradient_bar.png and /dev/null differ diff --git a/_images/grayscale_01_00.png b/_images/grayscale_01_00.png deleted file mode 100644 index adeac59cb06..00000000000 Binary files a/_images/grayscale_01_00.png and /dev/null differ diff --git a/_images/grayscale_01_01.png b/_images/grayscale_01_01.png deleted file mode 100644 index 737419a81c0..00000000000 Binary files a/_images/grayscale_01_01.png and /dev/null differ diff --git a/_images/grayscale_01_02.png b/_images/grayscale_01_02.png deleted file mode 100644 index 23cf5f8c50d..00000000000 Binary files a/_images/grayscale_01_02.png and /dev/null differ diff --git a/_images/grayscale_01_03.png b/_images/grayscale_01_03.png deleted file mode 100644 index 77114d74ec5..00000000000 Binary files a/_images/grayscale_01_03.png and /dev/null differ diff --git a/_images/grayscale_01_04.png b/_images/grayscale_01_04.png deleted file mode 100644 index b213dd305d6..00000000000 Binary files a/_images/grayscale_01_04.png and /dev/null differ diff --git a/_images/grayscale_01_05.png b/_images/grayscale_01_05.png deleted file mode 100644 index 25920dff603..00000000000 Binary files a/_images/grayscale_01_05.png and /dev/null differ diff --git a/_images/griddata_demo.png b/_images/griddata_demo.png deleted file mode 100644 index 3c9213addf3..00000000000 Binary files a/_images/griddata_demo.png and /dev/null differ diff --git a/_images/hatch_demo.png b/_images/hatch_demo.png deleted file mode 100644 index 7afcc6cf194..00000000000 Binary files a/_images/hatch_demo.png and /dev/null differ diff --git a/_images/hexbin_demo.png b/_images/hexbin_demo.png deleted file mode 100644 index 955a92826c7..00000000000 Binary files a/_images/hexbin_demo.png and /dev/null differ diff --git a/_images/hexbin_demo1.png b/_images/hexbin_demo1.png deleted file mode 100644 index 955a92826c7..00000000000 Binary files a/_images/hexbin_demo1.png and /dev/null differ diff --git a/_images/hexbin_demo2.png b/_images/hexbin_demo2.png deleted file mode 100644 index a7d6dd91c19..00000000000 Binary files a/_images/hexbin_demo2.png and /dev/null differ diff --git a/_images/hexbin_demo3.png b/_images/hexbin_demo3.png deleted file mode 100644 index 955a92826c7..00000000000 Binary files a/_images/hexbin_demo3.png and /dev/null differ diff --git a/_images/hinton_demo.png b/_images/hinton_demo.png deleted file mode 100644 index 658b0c83f10..00000000000 Binary files a/_images/hinton_demo.png and /dev/null differ diff --git a/_images/hist2d_demo.png b/_images/hist2d_demo.png deleted file mode 100644 index 16e9ee3aa7f..00000000000 Binary files a/_images/hist2d_demo.png and /dev/null differ diff --git a/_images/hist2d_demo1.png b/_images/hist2d_demo1.png deleted file mode 100644 index 16e9ee3aa7f..00000000000 Binary files a/_images/hist2d_demo1.png and /dev/null differ diff --git a/_images/hist2d_demo2.png b/_images/hist2d_demo2.png deleted file mode 100644 index 16e9ee3aa7f..00000000000 Binary files a/_images/hist2d_demo2.png and /dev/null differ diff --git a/_images/hist2d_log_demo.png b/_images/hist2d_log_demo.png deleted file mode 100644 index 952e3a54ff3..00000000000 Binary files a/_images/hist2d_log_demo.png and /dev/null differ diff --git a/_images/hist3d_demo.png b/_images/hist3d_demo.png deleted file mode 100644 index 0efad6eb2c5..00000000000 Binary files a/_images/hist3d_demo.png and /dev/null differ diff --git a/_images/hist_colormapped.png b/_images/hist_colormapped.png deleted file mode 100644 index 6913562d53a..00000000000 Binary files a/_images/hist_colormapped.png and /dev/null differ diff --git a/_images/histogram_demo_cumulative.png b/_images/histogram_demo_cumulative.png deleted file mode 100644 index ad97f03a896..00000000000 Binary files a/_images/histogram_demo_cumulative.png and /dev/null differ diff --git a/_images/histogram_demo_features.png b/_images/histogram_demo_features.png deleted file mode 100644 index 2994394d196..00000000000 Binary files a/_images/histogram_demo_features.png and /dev/null differ diff --git a/_images/histogram_demo_features1.png b/_images/histogram_demo_features1.png deleted file mode 100644 index 2994394d196..00000000000 Binary files a/_images/histogram_demo_features1.png and /dev/null differ diff --git a/_images/histogram_demo_features2.png b/_images/histogram_demo_features2.png deleted file mode 100644 index 2994394d196..00000000000 Binary files a/_images/histogram_demo_features2.png and /dev/null differ diff --git a/_images/histogram_demo_features3.png b/_images/histogram_demo_features3.png deleted file mode 100644 index 2994394d196..00000000000 Binary files a/_images/histogram_demo_features3.png and /dev/null differ diff --git a/_images/histogram_demo_histtypes.png b/_images/histogram_demo_histtypes.png deleted file mode 100644 index ebe03ff0d0f..00000000000 Binary files a/_images/histogram_demo_histtypes.png and /dev/null differ diff --git a/_images/histogram_demo_multihist.png b/_images/histogram_demo_multihist.png deleted file mode 100644 index 28bc7a49db3..00000000000 Binary files a/_images/histogram_demo_multihist.png and /dev/null differ diff --git a/_images/histogram_path_demo.png b/_images/histogram_path_demo.png deleted file mode 100644 index c4c90a59791..00000000000 Binary files a/_images/histogram_path_demo.png and /dev/null differ diff --git a/_images/histogram_path_demo1.png b/_images/histogram_path_demo1.png deleted file mode 100644 index c4c90a59791..00000000000 Binary files a/_images/histogram_path_demo1.png and /dev/null differ diff --git a/_images/histogram_percent_demo.png b/_images/histogram_percent_demo.png deleted file mode 100644 index 52924b35125..00000000000 Binary files a/_images/histogram_percent_demo.png and /dev/null differ diff --git a/_images/image_clip_path.png b/_images/image_clip_path.png deleted file mode 100644 index 5f1b586cd45..00000000000 Binary files a/_images/image_clip_path.png and /dev/null differ diff --git a/_images/image_demo.png b/_images/image_demo.png deleted file mode 100644 index d88bc4abedd..00000000000 Binary files a/_images/image_demo.png and /dev/null differ diff --git a/_images/image_demo1.png b/_images/image_demo1.png deleted file mode 100644 index d88bc4abedd..00000000000 Binary files a/_images/image_demo1.png and /dev/null differ diff --git a/_images/image_demo2.png b/_images/image_demo2.png deleted file mode 100644 index afcbf028387..00000000000 Binary files a/_images/image_demo2.png and /dev/null differ diff --git a/_images/image_demo3.png b/_images/image_demo3.png deleted file mode 100644 index 6453ed018b3..00000000000 Binary files a/_images/image_demo3.png and /dev/null differ diff --git a/_images/image_demo4.png b/_images/image_demo4.png deleted file mode 100644 index d88bc4abedd..00000000000 Binary files a/_images/image_demo4.png and /dev/null differ diff --git a/_images/image_demo_clip_path.png b/_images/image_demo_clip_path.png deleted file mode 100644 index b0f2311f0f5..00000000000 Binary files a/_images/image_demo_clip_path.png and /dev/null differ diff --git a/_images/image_interp_00.png b/_images/image_interp_00.png deleted file mode 100644 index d560d804c03..00000000000 Binary files a/_images/image_interp_00.png and /dev/null differ diff --git a/_images/image_interp_01.png b/_images/image_interp_01.png deleted file mode 100644 index 1059fd58e8c..00000000000 Binary files a/_images/image_interp_01.png and /dev/null differ diff --git a/_images/image_interp_02.png b/_images/image_interp_02.png deleted file mode 100644 index 4fe44c90465..00000000000 Binary files a/_images/image_interp_02.png and /dev/null differ diff --git a/_images/image_masked.png b/_images/image_masked.png deleted file mode 100644 index ae9c1439b05..00000000000 Binary files a/_images/image_masked.png and /dev/null differ diff --git a/_images/image_nonuniform.png b/_images/image_nonuniform.png deleted file mode 100644 index 1589066f0f9..00000000000 Binary files a/_images/image_nonuniform.png and /dev/null differ diff --git a/_images/image_origin.png b/_images/image_origin.png deleted file mode 100644 index bf71d39a6cc..00000000000 Binary files a/_images/image_origin.png and /dev/null differ diff --git a/_images/image_slices_viewer.png b/_images/image_slices_viewer.png deleted file mode 100644 index 029bea5bc7d..00000000000 Binary files a/_images/image_slices_viewer.png and /dev/null differ diff --git a/_images/image_tutorial-1.png b/_images/image_tutorial-1.png deleted file mode 100644 index 52fef3ef4fc..00000000000 Binary files a/_images/image_tutorial-1.png and /dev/null differ diff --git a/_images/image_tutorial-10.png b/_images/image_tutorial-10.png deleted file mode 100644 index 35e6c945ad8..00000000000 Binary files a/_images/image_tutorial-10.png and /dev/null differ diff --git a/_images/image_tutorial-2.png b/_images/image_tutorial-2.png deleted file mode 100644 index e181457def0..00000000000 Binary files a/_images/image_tutorial-2.png and /dev/null differ diff --git a/_images/image_tutorial-3.png b/_images/image_tutorial-3.png deleted file mode 100644 index cfb3ff0dc67..00000000000 Binary files a/_images/image_tutorial-3.png and /dev/null differ diff --git a/_images/image_tutorial-4.png b/_images/image_tutorial-4.png deleted file mode 100644 index 58122ae5a2f..00000000000 Binary files a/_images/image_tutorial-4.png and /dev/null differ diff --git a/_images/image_tutorial-5.png b/_images/image_tutorial-5.png deleted file mode 100644 index e14800bfdc3..00000000000 Binary files a/_images/image_tutorial-5.png and /dev/null differ diff --git a/_images/image_tutorial-6.png b/_images/image_tutorial-6.png deleted file mode 100644 index 7c51023d560..00000000000 Binary files a/_images/image_tutorial-6.png and /dev/null differ diff --git a/_images/image_tutorial-7.png b/_images/image_tutorial-7.png deleted file mode 100644 index cc43e02c4a2..00000000000 Binary files a/_images/image_tutorial-7.png and /dev/null differ diff --git a/_images/image_tutorial-8.png b/_images/image_tutorial-8.png deleted file mode 100644 index 032885ef501..00000000000 Binary files a/_images/image_tutorial-8.png and /dev/null differ diff --git a/_images/image_tutorial-9.png b/_images/image_tutorial-9.png deleted file mode 100644 index 032885ef501..00000000000 Binary files a/_images/image_tutorial-9.png and /dev/null differ diff --git a/_images/image_zcoord.png b/_images/image_zcoord.png deleted file mode 100644 index c1d4d1075c3..00000000000 Binary files a/_images/image_zcoord.png and /dev/null differ diff --git a/_images/inheritance-3d3782cdd2b1de4db70e97701ced4ca1e7396315.png b/_images/inheritance-3d3782cdd2b1de4db70e97701ced4ca1e7396315.png deleted file mode 100644 index ae2d67a368b..00000000000 Binary files a/_images/inheritance-3d3782cdd2b1de4db70e97701ced4ca1e7396315.png and /dev/null differ diff --git a/_images/inheritance-3d3782cdd2b1de4db70e97701ced4ca1e7396315.png.map b/_images/inheritance-3d3782cdd2b1de4db70e97701ced4ca1e7396315.png.map deleted file mode 100644 index c577d7ed7e8..00000000000 --- a/_images/inheritance-3d3782cdd2b1de4db70e97701ced4ca1e7396315.png.map +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/_images/inheritance-bc3b85d7b4e6f17188dcb3276538ad7632f1bfb9.png b/_images/inheritance-bc3b85d7b4e6f17188dcb3276538ad7632f1bfb9.png deleted file mode 100644 index 3e003bb8e89..00000000000 Binary files a/_images/inheritance-bc3b85d7b4e6f17188dcb3276538ad7632f1bfb9.png and /dev/null differ diff --git a/_images/inheritance-bc3b85d7b4e6f17188dcb3276538ad7632f1bfb9.png.map b/_images/inheritance-bc3b85d7b4e6f17188dcb3276538ad7632f1bfb9.png.map deleted file mode 100644 index 8fd1dc2d36b..00000000000 --- a/_images/inheritance-bc3b85d7b4e6f17188dcb3276538ad7632f1bfb9.png.map +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/_images/inheritance-d00a2c53c24b19d03d6390c8f65b04968e230aa6.png b/_images/inheritance-d00a2c53c24b19d03d6390c8f65b04968e230aa6.png deleted file mode 100644 index 290003f0f9d..00000000000 Binary files a/_images/inheritance-d00a2c53c24b19d03d6390c8f65b04968e230aa6.png and /dev/null differ diff --git a/_images/inheritance-d00a2c53c24b19d03d6390c8f65b04968e230aa6.png.map b/_images/inheritance-d00a2c53c24b19d03d6390c8f65b04968e230aa6.png.map deleted file mode 100644 index 134fdb88bcb..00000000000 --- a/_images/inheritance-d00a2c53c24b19d03d6390c8f65b04968e230aa6.png.map +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/_images/inheritance-f965f673138e3d2c62a727b9afd9500b385009eb.png b/_images/inheritance-f965f673138e3d2c62a727b9afd9500b385009eb.png deleted file mode 100644 index bd5b217ef19..00000000000 Binary files a/_images/inheritance-f965f673138e3d2c62a727b9afd9500b385009eb.png and /dev/null differ diff --git a/_images/inheritance-f965f673138e3d2c62a727b9afd9500b385009eb.png.map b/_images/inheritance-f965f673138e3d2c62a727b9afd9500b385009eb.png.map deleted file mode 100644 index c115fd608d0..00000000000 --- a/_images/inheritance-f965f673138e3d2c62a727b9afd9500b385009eb.png.map +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/_images/inset_locator_demo.png b/_images/inset_locator_demo.png deleted file mode 100644 index 67fb211e808..00000000000 Binary files a/_images/inset_locator_demo.png and /dev/null differ diff --git a/_images/inset_locator_demo1.png b/_images/inset_locator_demo1.png deleted file mode 100644 index 67fb211e808..00000000000 Binary files a/_images/inset_locator_demo1.png and /dev/null differ diff --git a/_images/inset_locator_demo2.png b/_images/inset_locator_demo2.png deleted file mode 100644 index 5b03524b8ec..00000000000 Binary files a/_images/inset_locator_demo2.png and /dev/null differ diff --git a/_images/inset_locator_demo21.png b/_images/inset_locator_demo21.png deleted file mode 100644 index 5b03524b8ec..00000000000 Binary files a/_images/inset_locator_demo21.png and /dev/null differ diff --git a/_images/integral_demo.png b/_images/integral_demo.png deleted file mode 100644 index 90f34b7a15d..00000000000 Binary files a/_images/integral_demo.png and /dev/null differ diff --git a/_images/interp_demo.png b/_images/interp_demo.png deleted file mode 100644 index 6d4f39136ff..00000000000 Binary files a/_images/interp_demo.png and /dev/null differ diff --git a/_images/interpolation_methods.png b/_images/interpolation_methods.png deleted file mode 100644 index 738eb298b26..00000000000 Binary files a/_images/interpolation_methods.png and /dev/null differ diff --git a/_images/invert_axes.png b/_images/invert_axes.png deleted file mode 100644 index c78d87ab634..00000000000 Binary files a/_images/invert_axes.png and /dev/null differ diff --git a/_images/joinstyle.png b/_images/joinstyle.png deleted file mode 100644 index e0399143caf..00000000000 Binary files a/_images/joinstyle.png and /dev/null differ diff --git a/_images/layer_images.png b/_images/layer_images.png deleted file mode 100644 index 56c2fb56934..00000000000 Binary files a/_images/layer_images.png and /dev/null differ diff --git a/_images/leftventricle_bulleye.png b/_images/leftventricle_bulleye.png deleted file mode 100644 index f68b966dccd..00000000000 Binary files a/_images/leftventricle_bulleye.png and /dev/null differ diff --git a/_images/legend_demo.png b/_images/legend_demo.png deleted file mode 100644 index 7a0a99787ad..00000000000 Binary files a/_images/legend_demo.png and /dev/null differ diff --git a/_images/legend_demo1.png b/_images/legend_demo1.png deleted file mode 100644 index 7a0a99787ad..00000000000 Binary files a/_images/legend_demo1.png and /dev/null differ diff --git a/_images/legend_demo2.png b/_images/legend_demo2.png deleted file mode 100644 index ddabf7f2a17..00000000000 Binary files a/_images/legend_demo2.png and /dev/null differ diff --git a/_images/legend_demo3.png b/_images/legend_demo3.png deleted file mode 100644 index e5ddea28ba4..00000000000 Binary files a/_images/legend_demo3.png and /dev/null differ diff --git a/_images/legend_demo4.png b/_images/legend_demo4.png deleted file mode 100644 index 103fe6a2f04..00000000000 Binary files a/_images/legend_demo4.png and /dev/null differ diff --git a/_images/legend_demo41.png b/_images/legend_demo41.png deleted file mode 100644 index 103fe6a2f04..00000000000 Binary files a/_images/legend_demo41.png and /dev/null differ diff --git a/_images/legend_demo5.png b/_images/legend_demo5.png deleted file mode 100644 index 36ec6970a77..00000000000 Binary files a/_images/legend_demo5.png and /dev/null differ diff --git a/_images/legend_demo6.png b/_images/legend_demo6.png deleted file mode 100644 index 7a0a99787ad..00000000000 Binary files a/_images/legend_demo6.png and /dev/null differ diff --git a/_images/legend_demo7.png b/_images/legend_demo7.png deleted file mode 100644 index 7a0a99787ad..00000000000 Binary files a/_images/legend_demo7.png and /dev/null differ diff --git a/_images/legend_guide-1.png b/_images/legend_guide-1.png deleted file mode 100644 index b09baddc089..00000000000 Binary files a/_images/legend_guide-1.png and /dev/null differ diff --git a/_images/legend_guide-2.png b/_images/legend_guide-2.png deleted file mode 100644 index 8e528297a58..00000000000 Binary files a/_images/legend_guide-2.png and /dev/null differ diff --git a/_images/legend_guide-3.png b/_images/legend_guide-3.png deleted file mode 100644 index ad606877c75..00000000000 Binary files a/_images/legend_guide-3.png and /dev/null differ diff --git a/_images/legend_guide-4.png b/_images/legend_guide-4.png deleted file mode 100644 index 6a294d17696..00000000000 Binary files a/_images/legend_guide-4.png and /dev/null differ diff --git a/_images/legend_guide-5.png b/_images/legend_guide-5.png deleted file mode 100644 index 14654a6d407..00000000000 Binary files a/_images/legend_guide-5.png and /dev/null differ diff --git a/_images/legend_guide-6.png b/_images/legend_guide-6.png deleted file mode 100644 index 65afcf993df..00000000000 Binary files a/_images/legend_guide-6.png and /dev/null differ diff --git a/_images/lightness_00.png b/_images/lightness_00.png deleted file mode 100644 index 65288c7fb13..00000000000 Binary files a/_images/lightness_00.png and /dev/null differ diff --git a/_images/lightness_01.png b/_images/lightness_01.png deleted file mode 100644 index 392ff428f58..00000000000 Binary files a/_images/lightness_01.png and /dev/null differ diff --git a/_images/lightness_02.png b/_images/lightness_02.png deleted file mode 100644 index 55b81ac73c9..00000000000 Binary files a/_images/lightness_02.png and /dev/null differ diff --git a/_images/lightness_03.png b/_images/lightness_03.png deleted file mode 100644 index 807722c645a..00000000000 Binary files a/_images/lightness_03.png and /dev/null differ diff --git a/_images/lightness_04.png b/_images/lightness_04.png deleted file mode 100644 index 2b5126bfa93..00000000000 Binary files a/_images/lightness_04.png and /dev/null differ diff --git a/_images/lightness_05.png b/_images/lightness_05.png deleted file mode 100644 index ba64258f5f8..00000000000 Binary files a/_images/lightness_05.png and /dev/null differ diff --git a/_images/line_collection.png b/_images/line_collection.png deleted file mode 100644 index 27d3a886869..00000000000 Binary files a/_images/line_collection.png and /dev/null differ diff --git a/_images/line_collection2.png b/_images/line_collection2.png deleted file mode 100644 index 485ab123cec..00000000000 Binary files a/_images/line_collection2.png and /dev/null differ diff --git a/_images/line_demo_dash_control.png b/_images/line_demo_dash_control.png deleted file mode 100644 index 7023ed6c667..00000000000 Binary files a/_images/line_demo_dash_control.png and /dev/null differ diff --git a/_images/line_styles_reference.png b/_images/line_styles_reference.png deleted file mode 100644 index e116eeb2f37..00000000000 Binary files a/_images/line_styles_reference.png and /dev/null differ diff --git a/_images/line_with_text.png b/_images/line_with_text.png deleted file mode 100644 index a9749be4922..00000000000 Binary files a/_images/line_with_text.png and /dev/null differ diff --git a/_images/lines3d_demo.png b/_images/lines3d_demo.png deleted file mode 100644 index 39ad58c079b..00000000000 Binary files a/_images/lines3d_demo.png and /dev/null differ diff --git a/_images/lines3d_demo1.png b/_images/lines3d_demo1.png deleted file mode 100644 index 39ad58c079b..00000000000 Binary files a/_images/lines3d_demo1.png and /dev/null differ diff --git a/_images/linestyles.png b/_images/linestyles.png deleted file mode 100644 index 6d041adf4a3..00000000000 Binary files a/_images/linestyles.png and /dev/null differ diff --git a/_images/load_converter.png b/_images/load_converter.png deleted file mode 100644 index 34e180f9c2c..00000000000 Binary files a/_images/load_converter.png and /dev/null differ diff --git a/_images/loadrec.png b/_images/loadrec.png deleted file mode 100644 index 86e9ff15bd9..00000000000 Binary files a/_images/loadrec.png and /dev/null differ diff --git a/_images/log_bar.png b/_images/log_bar.png deleted file mode 100644 index e0502a3a968..00000000000 Binary files a/_images/log_bar.png and /dev/null differ diff --git a/_images/log_demo.png b/_images/log_demo.png deleted file mode 100644 index c7c22d0d312..00000000000 Binary files a/_images/log_demo.png and /dev/null differ diff --git a/_images/log_demo1.png b/_images/log_demo1.png deleted file mode 100644 index c7c22d0d312..00000000000 Binary files a/_images/log_demo1.png and /dev/null differ diff --git a/_images/log_demo2.png b/_images/log_demo2.png deleted file mode 100644 index c7c22d0d312..00000000000 Binary files a/_images/log_demo2.png and /dev/null differ diff --git a/_images/log_demo3.png b/_images/log_demo3.png deleted file mode 100644 index c7c22d0d312..00000000000 Binary files a/_images/log_demo3.png and /dev/null differ diff --git a/_images/log_test.png b/_images/log_test.png deleted file mode 100644 index 04f14d804fc..00000000000 Binary files a/_images/log_test.png and /dev/null differ diff --git a/_images/logo.png b/_images/logo.png deleted file mode 100644 index 12032fdfb29..00000000000 Binary files a/_images/logo.png and /dev/null differ diff --git a/_images/logo2.png b/_images/logo2.png deleted file mode 100644 index eceefd8b34e..00000000000 Binary files a/_images/logo2.png and /dev/null differ diff --git a/_images/lorenz_attractor.png b/_images/lorenz_attractor.png deleted file mode 100644 index 74ca8749a8a..00000000000 Binary files a/_images/lorenz_attractor.png and /dev/null differ diff --git a/_images/major_minor_demo1.png b/_images/major_minor_demo1.png deleted file mode 100644 index 8ae969208f3..00000000000 Binary files a/_images/major_minor_demo1.png and /dev/null differ diff --git a/_images/major_minor_demo2.png b/_images/major_minor_demo2.png deleted file mode 100644 index 088bf3628f8..00000000000 Binary files a/_images/major_minor_demo2.png and /dev/null differ diff --git a/_images/make_room_for_ylabel_using_axesgrid_00.png b/_images/make_room_for_ylabel_using_axesgrid_00.png deleted file mode 100644 index 2d3c1841fcb..00000000000 Binary files a/_images/make_room_for_ylabel_using_axesgrid_00.png and /dev/null differ diff --git a/_images/make_room_for_ylabel_using_axesgrid_01.png b/_images/make_room_for_ylabel_using_axesgrid_01.png deleted file mode 100644 index 8bd27b5dd9e..00000000000 Binary files a/_images/make_room_for_ylabel_using_axesgrid_01.png and /dev/null differ diff --git a/_images/make_room_for_ylabel_using_axesgrid_02.png b/_images/make_room_for_ylabel_using_axesgrid_02.png deleted file mode 100644 index 10fa702d081..00000000000 Binary files a/_images/make_room_for_ylabel_using_axesgrid_02.png and /dev/null differ diff --git a/_images/mandelbrot.png b/_images/mandelbrot.png deleted file mode 100644 index 9b0b4d32f36..00000000000 Binary files a/_images/mandelbrot.png and /dev/null differ diff --git a/_images/manual_axis.png b/_images/manual_axis.png deleted file mode 100644 index 11501e5ed4c..00000000000 Binary files a/_images/manual_axis.png and /dev/null differ diff --git a/_images/marker_fillstyle_reference.png b/_images/marker_fillstyle_reference.png deleted file mode 100644 index 9f6a0993f9f..00000000000 Binary files a/_images/marker_fillstyle_reference.png and /dev/null differ diff --git a/_images/marker_path.png b/_images/marker_path.png deleted file mode 100644 index 01d7a215aa6..00000000000 Binary files a/_images/marker_path.png and /dev/null differ diff --git a/_images/marker_reference_00.png b/_images/marker_reference_00.png deleted file mode 100644 index b723029b48b..00000000000 Binary files a/_images/marker_reference_00.png and /dev/null differ diff --git a/_images/marker_reference_01.png b/_images/marker_reference_01.png deleted file mode 100644 index 890221d06c8..00000000000 Binary files a/_images/marker_reference_01.png and /dev/null differ diff --git a/_images/markevery_demo_00.png b/_images/markevery_demo_00.png deleted file mode 100644 index 356ff6e905b..00000000000 Binary files a/_images/markevery_demo_00.png and /dev/null differ diff --git a/_images/markevery_demo_01.png b/_images/markevery_demo_01.png deleted file mode 100644 index 4adefefb50a..00000000000 Binary files a/_images/markevery_demo_01.png and /dev/null differ diff --git a/_images/markevery_demo_02.png b/_images/markevery_demo_02.png deleted file mode 100644 index 352d50a89c3..00000000000 Binary files a/_images/markevery_demo_02.png and /dev/null differ diff --git a/_images/markevery_demo_03.png b/_images/markevery_demo_03.png deleted file mode 100644 index 44fa02de85a..00000000000 Binary files a/_images/markevery_demo_03.png and /dev/null differ diff --git a/_images/masked_demo.png b/_images/masked_demo.png deleted file mode 100644 index 9bed299e36d..00000000000 Binary files a/_images/masked_demo.png and /dev/null differ diff --git a/_images/mathtext_asarray.png b/_images/mathtext_asarray.png deleted file mode 100644 index 7f2f2f5a0d8..00000000000 Binary files a/_images/mathtext_asarray.png and /dev/null differ diff --git a/_images/mathtext_demo.png b/_images/mathtext_demo.png deleted file mode 100644 index f303d3d518b..00000000000 Binary files a/_images/mathtext_demo.png and /dev/null differ diff --git a/_images/mathtext_examples_01_00.png b/_images/mathtext_examples_01_00.png deleted file mode 100644 index 64fd09ab1f3..00000000000 Binary files a/_images/mathtext_examples_01_00.png and /dev/null differ diff --git a/_images/mathtext_examples_01_001.png b/_images/mathtext_examples_01_001.png deleted file mode 100644 index 64fd09ab1f3..00000000000 Binary files a/_images/mathtext_examples_01_001.png and /dev/null differ diff --git a/_images/matshow.png b/_images/matshow.png deleted file mode 100644 index ea5389dd07c..00000000000 Binary files a/_images/matshow.png and /dev/null differ diff --git a/_images/matshow1.png b/_images/matshow1.png deleted file mode 100644 index ea5389dd07c..00000000000 Binary files a/_images/matshow1.png and /dev/null differ diff --git a/_images/mixed_subplots_demo.png b/_images/mixed_subplots_demo.png deleted file mode 100644 index b9f30dbbec8..00000000000 Binary files a/_images/mixed_subplots_demo.png and /dev/null differ diff --git a/_images/mixed_subplots_demo1.png b/_images/mixed_subplots_demo1.png deleted file mode 100644 index b9f30dbbec8..00000000000 Binary files a/_images/mixed_subplots_demo1.png and /dev/null differ diff --git a/_images/mri_demo.png b/_images/mri_demo.png deleted file mode 100644 index f38d302f483..00000000000 Binary files a/_images/mri_demo.png and /dev/null differ diff --git a/_images/mri_with_eeg.png b/_images/mri_with_eeg.png deleted file mode 100644 index a8682b0cfc1..00000000000 Binary files a/_images/mri_with_eeg.png and /dev/null differ diff --git a/_images/multi_image.png b/_images/multi_image.png deleted file mode 100644 index 593a534fbb5..00000000000 Binary files a/_images/multi_image.png and /dev/null differ diff --git a/_images/multicolored_line_00.png b/_images/multicolored_line_00.png deleted file mode 100644 index 9b23844e1cb..00000000000 Binary files a/_images/multicolored_line_00.png and /dev/null differ diff --git a/_images/multicolored_line_01.png b/_images/multicolored_line_01.png deleted file mode 100644 index 2b9a549bce3..00000000000 Binary files a/_images/multicolored_line_01.png and /dev/null differ diff --git a/_images/multiline.png b/_images/multiline.png deleted file mode 100644 index 0ab3d1faf39..00000000000 Binary files a/_images/multiline.png and /dev/null differ diff --git a/_images/multiple_figs_demo_00.png b/_images/multiple_figs_demo_00.png deleted file mode 100644 index ff2c58cc938..00000000000 Binary files a/_images/multiple_figs_demo_00.png and /dev/null differ diff --git a/_images/multiple_figs_demo_01.png b/_images/multiple_figs_demo_01.png deleted file mode 100644 index aae4b2641e9..00000000000 Binary files a/_images/multiple_figs_demo_01.png and /dev/null differ diff --git a/_images/multiple_histograms_side_by_side.png b/_images/multiple_histograms_side_by_side.png deleted file mode 100644 index e5f0f6e4f46..00000000000 Binary files a/_images/multiple_histograms_side_by_side.png and /dev/null differ diff --git a/_images/multiple_yaxis_with_spines.png b/_images/multiple_yaxis_with_spines.png deleted file mode 100644 index 78852a5554f..00000000000 Binary files a/_images/multiple_yaxis_with_spines.png and /dev/null differ diff --git a/_images/named_colors.png b/_images/named_colors.png deleted file mode 100644 index 9dfe14a46df..00000000000 Binary files a/_images/named_colors.png and /dev/null differ diff --git a/_images/nan_test.png b/_images/nan_test.png deleted file mode 100644 index 2f4d0a314c7..00000000000 Binary files a/_images/nan_test.png and /dev/null differ diff --git a/_images/newscalarformatter_demo_00.png b/_images/newscalarformatter_demo_00.png deleted file mode 100644 index cdf26d3511e..00000000000 Binary files a/_images/newscalarformatter_demo_00.png and /dev/null differ diff --git a/_images/newscalarformatter_demo_01.png b/_images/newscalarformatter_demo_01.png deleted file mode 100644 index 0a697c59e87..00000000000 Binary files a/_images/newscalarformatter_demo_01.png and /dev/null differ diff --git a/_images/newscalarformatter_demo_02.png b/_images/newscalarformatter_demo_02.png deleted file mode 100644 index 171966c5eb7..00000000000 Binary files a/_images/newscalarformatter_demo_02.png and /dev/null differ diff --git a/_images/newscalarformatter_demo_03.png b/_images/newscalarformatter_demo_03.png deleted file mode 100644 index 9c593de55ed..00000000000 Binary files a/_images/newscalarformatter_demo_03.png and /dev/null differ diff --git a/_images/offset_demo.png b/_images/offset_demo.png deleted file mode 100644 index 91d63ba6b67..00000000000 Binary files a/_images/offset_demo.png and /dev/null differ diff --git a/_images/offset_demo1.png b/_images/offset_demo1.png deleted file mode 100644 index 91d63ba6b67..00000000000 Binary files a/_images/offset_demo1.png and /dev/null differ diff --git a/_images/parasite_simple.png b/_images/parasite_simple.png deleted file mode 100644 index 36086c4ffd6..00000000000 Binary files a/_images/parasite_simple.png and /dev/null differ diff --git a/_images/parasite_simple2.png b/_images/parasite_simple2.png deleted file mode 100644 index 6c4a20ead69..00000000000 Binary files a/_images/parasite_simple2.png and /dev/null differ diff --git a/_images/parasite_simple21.png b/_images/parasite_simple21.png deleted file mode 100644 index 6c4a20ead69..00000000000 Binary files a/_images/parasite_simple21.png and /dev/null differ diff --git a/_images/patch_collection.png b/_images/patch_collection.png deleted file mode 100644 index d8a7e8bf8ad..00000000000 Binary files a/_images/patch_collection.png and /dev/null differ diff --git a/_images/path_patch_demo.png b/_images/path_patch_demo.png deleted file mode 100644 index 49a853d7f85..00000000000 Binary files a/_images/path_patch_demo.png and /dev/null differ diff --git a/_images/path_patch_demo1.png b/_images/path_patch_demo1.png deleted file mode 100644 index 49a853d7f85..00000000000 Binary files a/_images/path_patch_demo1.png and /dev/null differ diff --git a/_images/path_tutorial-1.png b/_images/path_tutorial-1.png deleted file mode 100644 index e12b8c62c9c..00000000000 Binary files a/_images/path_tutorial-1.png and /dev/null differ diff --git a/_images/path_tutorial-2.png b/_images/path_tutorial-2.png deleted file mode 100644 index 07d339e8946..00000000000 Binary files a/_images/path_tutorial-2.png and /dev/null differ diff --git a/_images/patheffect_demo.png b/_images/patheffect_demo.png deleted file mode 100644 index 6237dc7f521..00000000000 Binary files a/_images/patheffect_demo.png and /dev/null differ diff --git a/_images/patheffect_demo1.png b/_images/patheffect_demo1.png deleted file mode 100644 index 6237dc7f521..00000000000 Binary files a/_images/patheffect_demo1.png and /dev/null differ diff --git a/_images/patheffects_guide-1.png b/_images/patheffects_guide-1.png deleted file mode 100644 index e767bb52ee4..00000000000 Binary files a/_images/patheffects_guide-1.png and /dev/null differ diff --git a/_images/patheffects_guide-2.png b/_images/patheffects_guide-2.png deleted file mode 100644 index f8dfb540869..00000000000 Binary files a/_images/patheffects_guide-2.png and /dev/null differ diff --git a/_images/patheffects_guide-3.png b/_images/patheffects_guide-3.png deleted file mode 100644 index 38ffcf45fdc..00000000000 Binary files a/_images/patheffects_guide-3.png and /dev/null differ diff --git a/_images/patheffects_guide-4.png b/_images/patheffects_guide-4.png deleted file mode 100644 index fe3b3047a40..00000000000 Binary files a/_images/patheffects_guide-4.png and /dev/null differ diff --git a/_images/pathpatch3d_demo.png b/_images/pathpatch3d_demo.png deleted file mode 100644 index 65ebd62d439..00000000000 Binary files a/_images/pathpatch3d_demo.png and /dev/null differ diff --git a/_images/pcolor_demo.png b/_images/pcolor_demo.png deleted file mode 100644 index b074cb383a0..00000000000 Binary files a/_images/pcolor_demo.png and /dev/null differ diff --git a/_images/pcolor_log.png b/_images/pcolor_log.png deleted file mode 100644 index 1b2e3917d63..00000000000 Binary files a/_images/pcolor_log.png and /dev/null differ diff --git a/_images/pcolor_small.png b/_images/pcolor_small.png deleted file mode 100644 index 5999cf016d8..00000000000 Binary files a/_images/pcolor_small.png and /dev/null differ diff --git a/_images/pcolormesh_levels.png b/_images/pcolormesh_levels.png deleted file mode 100644 index c93428e05f8..00000000000 Binary files a/_images/pcolormesh_levels.png and /dev/null differ diff --git a/_images/pgf_fonts.png b/_images/pgf_fonts.png deleted file mode 100644 index d4ef689f9b3..00000000000 Binary files a/_images/pgf_fonts.png and /dev/null differ diff --git a/_images/pgf_texsystem.png b/_images/pgf_texsystem.png deleted file mode 100644 index 6075e7b764d..00000000000 Binary files a/_images/pgf_texsystem.png and /dev/null differ diff --git a/_images/pie_demo2.png b/_images/pie_demo2.png deleted file mode 100644 index 64b194edfd5..00000000000 Binary files a/_images/pie_demo2.png and /dev/null differ diff --git a/_images/pie_demo_features.png b/_images/pie_demo_features.png deleted file mode 100644 index 7f2127476e6..00000000000 Binary files a/_images/pie_demo_features.png and /dev/null differ diff --git a/_images/pie_demo_features1.png b/_images/pie_demo_features1.png deleted file mode 100644 index 7f2127476e6..00000000000 Binary files a/_images/pie_demo_features1.png and /dev/null differ diff --git a/_images/pie_demo_features2.png b/_images/pie_demo_features2.png deleted file mode 100644 index 7f2127476e6..00000000000 Binary files a/_images/pie_demo_features2.png and /dev/null differ diff --git a/_images/pie_demo_features3.png b/_images/pie_demo_features3.png deleted file mode 100644 index 7f2127476e6..00000000000 Binary files a/_images/pie_demo_features3.png and /dev/null differ diff --git a/_images/plot_bmh.png b/_images/plot_bmh.png deleted file mode 100644 index 185180616c8..00000000000 Binary files a/_images/plot_bmh.png and /dev/null differ diff --git a/_images/plot_dark_background.png b/_images/plot_dark_background.png deleted file mode 100644 index 8b811ae072c..00000000000 Binary files a/_images/plot_dark_background.png and /dev/null differ diff --git a/_images/plot_fivethirtyeight.png b/_images/plot_fivethirtyeight.png deleted file mode 100644 index 95c85d96efe..00000000000 Binary files a/_images/plot_fivethirtyeight.png and /dev/null differ diff --git a/_images/plot_ggplot.png b/_images/plot_ggplot.png deleted file mode 100644 index c2e0cb4509d..00000000000 Binary files a/_images/plot_ggplot.png and /dev/null differ diff --git a/_images/plot_grayscale.png b/_images/plot_grayscale.png deleted file mode 100644 index b46c0747006..00000000000 Binary files a/_images/plot_grayscale.png and /dev/null differ diff --git a/_images/plotfile_demo_00.png b/_images/plotfile_demo_00.png deleted file mode 100644 index bd7a59045f2..00000000000 Binary files a/_images/plotfile_demo_00.png and /dev/null differ diff --git a/_images/plotfile_demo_01.png b/_images/plotfile_demo_01.png deleted file mode 100644 index bd7a59045f2..00000000000 Binary files a/_images/plotfile_demo_01.png and /dev/null differ diff --git a/_images/plotfile_demo_02.png b/_images/plotfile_demo_02.png deleted file mode 100644 index 7f5ce34d854..00000000000 Binary files a/_images/plotfile_demo_02.png and /dev/null differ diff --git a/_images/plotfile_demo_03.png b/_images/plotfile_demo_03.png deleted file mode 100644 index 7f5ce34d854..00000000000 Binary files a/_images/plotfile_demo_03.png and /dev/null differ diff --git a/_images/plotfile_demo_04.png b/_images/plotfile_demo_04.png deleted file mode 100644 index daa778669af..00000000000 Binary files a/_images/plotfile_demo_04.png and /dev/null differ diff --git a/_images/plotfile_demo_05.png b/_images/plotfile_demo_05.png deleted file mode 100644 index 3a47357216b..00000000000 Binary files a/_images/plotfile_demo_05.png and /dev/null differ diff --git a/_images/plotfile_demo_06.png b/_images/plotfile_demo_06.png deleted file mode 100644 index 743d26a2814..00000000000 Binary files a/_images/plotfile_demo_06.png and /dev/null differ diff --git a/_images/plotfile_demo_07.png b/_images/plotfile_demo_07.png deleted file mode 100644 index 26add26857f..00000000000 Binary files a/_images/plotfile_demo_07.png and /dev/null differ diff --git a/_images/polar_bar_demo.png b/_images/polar_bar_demo.png deleted file mode 100644 index 0559ebdbe39..00000000000 Binary files a/_images/polar_bar_demo.png and /dev/null differ diff --git a/_images/polar_demo.png b/_images/polar_demo.png deleted file mode 100644 index 3870db5ba60..00000000000 Binary files a/_images/polar_demo.png and /dev/null differ diff --git a/_images/polar_demo1.png b/_images/polar_demo1.png deleted file mode 100644 index 3870db5ba60..00000000000 Binary files a/_images/polar_demo1.png and /dev/null differ diff --git a/_images/polar_legend.png b/_images/polar_legend.png deleted file mode 100644 index ab1b69d053a..00000000000 Binary files a/_images/polar_legend.png and /dev/null differ diff --git a/_images/polar_scatter_demo.png b/_images/polar_scatter_demo.png deleted file mode 100644 index 56596c82690..00000000000 Binary files a/_images/polar_scatter_demo.png and /dev/null differ diff --git a/_images/polys3d_demo.png b/_images/polys3d_demo.png deleted file mode 100644 index 5a181c87231..00000000000 Binary files a/_images/polys3d_demo.png and /dev/null differ diff --git a/_images/polys3d_demo1.png b/_images/polys3d_demo1.png deleted file mode 100644 index 5a181c87231..00000000000 Binary files a/_images/polys3d_demo1.png and /dev/null differ diff --git a/_images/power_norm_demo.png b/_images/power_norm_demo.png deleted file mode 100644 index 67af51a170c..00000000000 Binary files a/_images/power_norm_demo.png and /dev/null differ diff --git a/_images/psd_demo2.png b/_images/psd_demo2.png deleted file mode 100644 index 91182663ccb..00000000000 Binary files a/_images/psd_demo2.png and /dev/null differ diff --git a/_images/psd_demo3.png b/_images/psd_demo3.png deleted file mode 100644 index 18e11b52357..00000000000 Binary files a/_images/psd_demo3.png and /dev/null differ diff --git a/_images/psd_demo_00_00.png b/_images/psd_demo_00_00.png deleted file mode 100644 index 6db14e94b85..00000000000 Binary files a/_images/psd_demo_00_00.png and /dev/null differ diff --git a/_images/psd_demo_00_001.png b/_images/psd_demo_00_001.png deleted file mode 100644 index 6db14e94b85..00000000000 Binary files a/_images/psd_demo_00_001.png and /dev/null differ diff --git a/_images/psd_demo_00_002.png b/_images/psd_demo_00_002.png deleted file mode 100644 index 6db14e94b85..00000000000 Binary files a/_images/psd_demo_00_002.png and /dev/null differ diff --git a/_images/psd_demo_complex.png b/_images/psd_demo_complex.png deleted file mode 100644 index 4c1ef8d069d..00000000000 Binary files a/_images/psd_demo_complex.png and /dev/null differ diff --git a/_images/pyplot_annotate.png b/_images/pyplot_annotate.png deleted file mode 100644 index 18c5e2b254d..00000000000 Binary files a/_images/pyplot_annotate.png and /dev/null differ diff --git a/_images/pyplot_formatstr.png b/_images/pyplot_formatstr.png deleted file mode 100644 index 400a20a4e18..00000000000 Binary files a/_images/pyplot_formatstr.png and /dev/null differ diff --git a/_images/pyplot_mathtext.png b/_images/pyplot_mathtext.png deleted file mode 100644 index 8f7530d5edc..00000000000 Binary files a/_images/pyplot_mathtext.png and /dev/null differ diff --git a/_images/pyplot_scales.png b/_images/pyplot_scales.png deleted file mode 100644 index 2ae2cb2ffa9..00000000000 Binary files a/_images/pyplot_scales.png and /dev/null differ diff --git a/_images/pyplot_simple.png b/_images/pyplot_simple.png deleted file mode 100644 index 6d321d4651d..00000000000 Binary files a/_images/pyplot_simple.png and /dev/null differ diff --git a/_images/pyplot_text.png b/_images/pyplot_text.png deleted file mode 100644 index 6969581bda3..00000000000 Binary files a/_images/pyplot_text.png and /dev/null differ diff --git a/_images/pyplot_three.png b/_images/pyplot_three.png deleted file mode 100644 index 5be322070da..00000000000 Binary files a/_images/pyplot_three.png and /dev/null differ diff --git a/_images/pyplot_two_subplots.png b/_images/pyplot_two_subplots.png deleted file mode 100644 index 2adfd01c84e..00000000000 Binary files a/_images/pyplot_two_subplots.png and /dev/null differ diff --git a/_images/pythonic_matplotlib.png b/_images/pythonic_matplotlib.png deleted file mode 100644 index 10404aa1b93..00000000000 Binary files a/_images/pythonic_matplotlib.png and /dev/null differ diff --git a/_images/quad_bezier.png b/_images/quad_bezier.png deleted file mode 100644 index 460b59e861e..00000000000 Binary files a/_images/quad_bezier.png and /dev/null differ diff --git a/_images/quadmesh_demo.png b/_images/quadmesh_demo.png deleted file mode 100644 index 38864c910a8..00000000000 Binary files a/_images/quadmesh_demo.png and /dev/null differ diff --git a/_images/quiver3d_demo.png b/_images/quiver3d_demo.png deleted file mode 100644 index f3a6e2a5383..00000000000 Binary files a/_images/quiver3d_demo.png and /dev/null differ diff --git a/_images/quiver3d_demo1.png b/_images/quiver3d_demo1.png deleted file mode 100644 index f3a6e2a5383..00000000000 Binary files a/_images/quiver3d_demo1.png and /dev/null differ diff --git a/_images/quiver3d_demo2.png b/_images/quiver3d_demo2.png deleted file mode 100644 index f3a6e2a5383..00000000000 Binary files a/_images/quiver3d_demo2.png and /dev/null differ diff --git a/_images/quiver_demo_00.png b/_images/quiver_demo_00.png deleted file mode 100644 index a46fe68bb4b..00000000000 Binary files a/_images/quiver_demo_00.png and /dev/null differ diff --git a/_images/quiver_demo_01.png b/_images/quiver_demo_01.png deleted file mode 100644 index 5bb95b4b339..00000000000 Binary files a/_images/quiver_demo_01.png and /dev/null differ diff --git a/_images/quiver_demo_02.png b/_images/quiver_demo_02.png deleted file mode 100644 index 198ae8b015a..00000000000 Binary files a/_images/quiver_demo_02.png and /dev/null differ diff --git a/_images/quiver_simple_demo.png b/_images/quiver_simple_demo.png deleted file mode 100644 index 665b0624521..00000000000 Binary files a/_images/quiver_simple_demo.png and /dev/null differ diff --git a/_images/quiver_simple_demo1.png b/_images/quiver_simple_demo1.png deleted file mode 100644 index 665b0624521..00000000000 Binary files a/_images/quiver_simple_demo1.png and /dev/null differ diff --git a/_images/quiver_simple_demo2.png b/_images/quiver_simple_demo2.png deleted file mode 100644 index 665b0624521..00000000000 Binary files a/_images/quiver_simple_demo2.png and /dev/null differ diff --git a/_images/radar_chart.png b/_images/radar_chart.png deleted file mode 100644 index 2e5392c44d7..00000000000 Binary files a/_images/radar_chart.png and /dev/null differ diff --git a/_images/radian_demo.png b/_images/radian_demo.png deleted file mode 100644 index 6d97b076180..00000000000 Binary files a/_images/radian_demo.png and /dev/null differ diff --git a/_images/rainbow_text.png b/_images/rainbow_text.png deleted file mode 100644 index 05e76999910..00000000000 Binary files a/_images/rainbow_text.png and /dev/null differ diff --git a/_images/rasterization_demo.png b/_images/rasterization_demo.png deleted file mode 100644 index 7e4dc1f146f..00000000000 Binary files a/_images/rasterization_demo.png and /dev/null differ diff --git a/_images/recipes-2.png b/_images/recipes-2.png deleted file mode 100644 index 9318cd9c5c5..00000000000 Binary files a/_images/recipes-2.png and /dev/null differ diff --git a/_images/recipes-3.png b/_images/recipes-3.png deleted file mode 100644 index 805a82e1491..00000000000 Binary files a/_images/recipes-3.png and /dev/null differ diff --git a/_images/recipes-4.png b/_images/recipes-4.png deleted file mode 100644 index adff4b72541..00000000000 Binary files a/_images/recipes-4.png and /dev/null differ diff --git a/_images/recipes-5.png b/_images/recipes-5.png deleted file mode 100644 index 54dfdc5f6ed..00000000000 Binary files a/_images/recipes-5.png and /dev/null differ diff --git a/_images/recipes-6.png b/_images/recipes-6.png deleted file mode 100644 index 5697416ae4e..00000000000 Binary files a/_images/recipes-6.png and /dev/null differ diff --git a/_images/recipes-7.png b/_images/recipes-7.png deleted file mode 100644 index ff83ff02290..00000000000 Binary files a/_images/recipes-7.png and /dev/null differ diff --git a/_images/recipes-8.png b/_images/recipes-8.png deleted file mode 100644 index 61099a6a67f..00000000000 Binary files a/_images/recipes-8.png and /dev/null differ diff --git a/_images/rotate_axes3d_demo.png b/_images/rotate_axes3d_demo.png deleted file mode 100644 index eb6f793269f..00000000000 Binary files a/_images/rotate_axes3d_demo.png and /dev/null differ diff --git a/_images/sample_data_demo.png b/_images/sample_data_demo.png deleted file mode 100644 index c13a4be6ac5..00000000000 Binary files a/_images/sample_data_demo.png and /dev/null differ diff --git a/_images/sankey_demo_basics_00.png b/_images/sankey_demo_basics_00.png deleted file mode 100644 index d3c519d7fa5..00000000000 Binary files a/_images/sankey_demo_basics_00.png and /dev/null differ diff --git a/_images/sankey_demo_basics_001.png b/_images/sankey_demo_basics_001.png deleted file mode 100644 index d3c519d7fa5..00000000000 Binary files a/_images/sankey_demo_basics_001.png and /dev/null differ diff --git a/_images/sankey_demo_basics_01.png b/_images/sankey_demo_basics_01.png deleted file mode 100644 index 396a0b36d86..00000000000 Binary files a/_images/sankey_demo_basics_01.png and /dev/null differ diff --git a/_images/sankey_demo_basics_011.png b/_images/sankey_demo_basics_011.png deleted file mode 100644 index 396a0b36d86..00000000000 Binary files a/_images/sankey_demo_basics_011.png and /dev/null differ diff --git a/_images/sankey_demo_basics_02.png b/_images/sankey_demo_basics_02.png deleted file mode 100644 index 114b7b855f2..00000000000 Binary files a/_images/sankey_demo_basics_02.png and /dev/null differ diff --git a/_images/sankey_demo_basics_021.png b/_images/sankey_demo_basics_021.png deleted file mode 100644 index 114b7b855f2..00000000000 Binary files a/_images/sankey_demo_basics_021.png and /dev/null differ diff --git a/_images/sankey_demo_links.png b/_images/sankey_demo_links.png deleted file mode 100644 index b85bac224ff..00000000000 Binary files a/_images/sankey_demo_links.png and /dev/null differ diff --git a/_images/sankey_demo_old.png b/_images/sankey_demo_old.png deleted file mode 100644 index d8a9b812610..00000000000 Binary files a/_images/sankey_demo_old.png and /dev/null differ diff --git a/_images/sankey_demo_rankine.png b/_images/sankey_demo_rankine.png deleted file mode 100644 index caa316a19d8..00000000000 Binary files a/_images/sankey_demo_rankine.png and /dev/null differ diff --git a/_images/sankey_demo_rankine1.png b/_images/sankey_demo_rankine1.png deleted file mode 100644 index caa316a19d8..00000000000 Binary files a/_images/sankey_demo_rankine1.png and /dev/null differ diff --git a/_images/scales.png b/_images/scales.png deleted file mode 100644 index e089720ce95..00000000000 Binary files a/_images/scales.png and /dev/null differ diff --git a/_images/scatter3d_demo.png b/_images/scatter3d_demo.png deleted file mode 100644 index af08326f1ca..00000000000 Binary files a/_images/scatter3d_demo.png and /dev/null differ diff --git a/_images/scatter3d_demo1.png b/_images/scatter3d_demo1.png deleted file mode 100644 index af08326f1ca..00000000000 Binary files a/_images/scatter3d_demo1.png and /dev/null differ diff --git a/_images/scatter_custom_symbol.png b/_images/scatter_custom_symbol.png deleted file mode 100644 index fd0df0894d6..00000000000 Binary files a/_images/scatter_custom_symbol.png and /dev/null differ diff --git a/_images/scatter_demo.png b/_images/scatter_demo.png deleted file mode 100644 index 0d2c23c016e..00000000000 Binary files a/_images/scatter_demo.png and /dev/null differ diff --git a/_images/scatter_demo1.png b/_images/scatter_demo1.png deleted file mode 100644 index 0d2c23c016e..00000000000 Binary files a/_images/scatter_demo1.png and /dev/null differ diff --git a/_images/scatter_demo2.png b/_images/scatter_demo2.png deleted file mode 100644 index 5dadc81a6e8..00000000000 Binary files a/_images/scatter_demo2.png and /dev/null differ diff --git a/_images/scatter_demo21.png b/_images/scatter_demo21.png deleted file mode 100644 index 5dadc81a6e8..00000000000 Binary files a/_images/scatter_demo21.png and /dev/null differ diff --git a/_images/scatter_demo3.png b/_images/scatter_demo3.png deleted file mode 100644 index 0d2c23c016e..00000000000 Binary files a/_images/scatter_demo3.png and /dev/null differ diff --git a/_images/scatter_hist.png b/_images/scatter_hist.png deleted file mode 100644 index 9ab4fdfcab9..00000000000 Binary files a/_images/scatter_hist.png and /dev/null differ diff --git a/_images/scatter_hist1.png b/_images/scatter_hist1.png deleted file mode 100644 index 94bb830544b..00000000000 Binary files a/_images/scatter_hist1.png and /dev/null differ diff --git a/_images/scatter_hist2.png b/_images/scatter_hist2.png deleted file mode 100644 index d3e09863f0c..00000000000 Binary files a/_images/scatter_hist2.png and /dev/null differ diff --git a/_images/scatter_masked.png b/_images/scatter_masked.png deleted file mode 100644 index e59faa37015..00000000000 Binary files a/_images/scatter_masked.png and /dev/null differ diff --git a/_images/scatter_piecharts.png b/_images/scatter_piecharts.png deleted file mode 100644 index 38ea81ffe09..00000000000 Binary files a/_images/scatter_piecharts.png and /dev/null differ diff --git a/_images/scatter_profile.png b/_images/scatter_profile.png deleted file mode 100644 index 8a17e7fdfa0..00000000000 Binary files a/_images/scatter_profile.png and /dev/null differ diff --git a/_images/scatter_star_poly.png b/_images/scatter_star_poly.png deleted file mode 100644 index 2f6c377b4ad..00000000000 Binary files a/_images/scatter_star_poly.png and /dev/null differ diff --git a/_images/scatter_symbol.png b/_images/scatter_symbol.png deleted file mode 100644 index bad859a2e52..00000000000 Binary files a/_images/scatter_symbol.png and /dev/null differ diff --git a/_images/scatter_with_legend.png b/_images/scatter_with_legend.png deleted file mode 100644 index e9431804e8c..00000000000 Binary files a/_images/scatter_with_legend.png and /dev/null differ diff --git a/_images/set_and_get.png b/_images/set_and_get.png deleted file mode 100644 index d8750891ee8..00000000000 Binary files a/_images/set_and_get.png and /dev/null differ diff --git a/_images/shading_example_01_00.png b/_images/shading_example_01_00.png deleted file mode 100644 index 58d6f69606d..00000000000 Binary files a/_images/shading_example_01_00.png and /dev/null differ diff --git a/_images/shading_example_01_01.png b/_images/shading_example_01_01.png deleted file mode 100644 index 5085875083a..00000000000 Binary files a/_images/shading_example_01_01.png and /dev/null differ diff --git a/_images/shared_axis_across_figures_00.png b/_images/shared_axis_across_figures_00.png deleted file mode 100644 index 2728bb4df36..00000000000 Binary files a/_images/shared_axis_across_figures_00.png and /dev/null differ diff --git a/_images/shared_axis_across_figures_01.png b/_images/shared_axis_across_figures_01.png deleted file mode 100644 index fae7acf0431..00000000000 Binary files a/_images/shared_axis_across_figures_01.png and /dev/null differ diff --git a/_images/shared_axis_demo.png b/_images/shared_axis_demo.png deleted file mode 100644 index 69566adf526..00000000000 Binary files a/_images/shared_axis_demo.png and /dev/null differ diff --git a/_images/simple_anchored_artists.png b/_images/simple_anchored_artists.png deleted file mode 100644 index 302c01065de..00000000000 Binary files a/_images/simple_anchored_artists.png and /dev/null differ diff --git a/_images/simple_anchored_artists1.png b/_images/simple_anchored_artists1.png deleted file mode 100644 index 302c01065de..00000000000 Binary files a/_images/simple_anchored_artists1.png and /dev/null differ diff --git a/_images/simple_axes_divider2.png b/_images/simple_axes_divider2.png deleted file mode 100644 index b4d1924c76d..00000000000 Binary files a/_images/simple_axes_divider2.png and /dev/null differ diff --git a/_images/simple_axes_divider3.png b/_images/simple_axes_divider3.png deleted file mode 100644 index 4d2ab884e87..00000000000 Binary files a/_images/simple_axes_divider3.png and /dev/null differ diff --git a/_images/simple_axesgrid.png b/_images/simple_axesgrid.png deleted file mode 100644 index 29f77476284..00000000000 Binary files a/_images/simple_axesgrid.png and /dev/null differ diff --git a/_images/simple_axesgrid1.png b/_images/simple_axesgrid1.png deleted file mode 100644 index 29f77476284..00000000000 Binary files a/_images/simple_axesgrid1.png and /dev/null differ diff --git a/_images/simple_axesgrid2.png b/_images/simple_axesgrid2.png deleted file mode 100644 index a1dbac3bed3..00000000000 Binary files a/_images/simple_axesgrid2.png and /dev/null differ diff --git a/_images/simple_axesgrid21.png b/_images/simple_axesgrid21.png deleted file mode 100644 index a1dbac3bed3..00000000000 Binary files a/_images/simple_axesgrid21.png and /dev/null differ diff --git a/_images/simple_axis_direction01.png b/_images/simple_axis_direction01.png deleted file mode 100644 index e30e2608cc6..00000000000 Binary files a/_images/simple_axis_direction01.png and /dev/null differ diff --git a/_images/simple_axis_direction03.png b/_images/simple_axis_direction03.png deleted file mode 100644 index 576bbbb4b19..00000000000 Binary files a/_images/simple_axis_direction03.png and /dev/null differ diff --git a/_images/simple_axis_pad.png b/_images/simple_axis_pad.png deleted file mode 100644 index 49e530322ec..00000000000 Binary files a/_images/simple_axis_pad.png and /dev/null differ diff --git a/_images/simple_axisartist1.png b/_images/simple_axisartist1.png deleted file mode 100644 index cbbfde192a6..00000000000 Binary files a/_images/simple_axisartist1.png and /dev/null differ diff --git a/_images/simple_axisline3.png b/_images/simple_axisline3.png deleted file mode 100644 index edf75bf991c..00000000000 Binary files a/_images/simple_axisline3.png and /dev/null differ diff --git a/_images/simple_axisline4.png b/_images/simple_axisline4.png deleted file mode 100644 index f7f0132c7c9..00000000000 Binary files a/_images/simple_axisline4.png and /dev/null differ diff --git a/_images/simple_axisline41.png b/_images/simple_axisline41.png deleted file mode 100644 index f7f0132c7c9..00000000000 Binary files a/_images/simple_axisline41.png and /dev/null differ diff --git a/_images/simple_colorbar.png b/_images/simple_colorbar.png deleted file mode 100644 index ddb2edf19b8..00000000000 Binary files a/_images/simple_colorbar.png and /dev/null differ diff --git a/_images/simple_legend01.png b/_images/simple_legend01.png deleted file mode 100644 index 752013c8742..00000000000 Binary files a/_images/simple_legend01.png and /dev/null differ diff --git a/_images/simple_legend02.png b/_images/simple_legend02.png deleted file mode 100644 index 99e2468b1f6..00000000000 Binary files a/_images/simple_legend02.png and /dev/null differ diff --git a/_images/simple_plot.png b/_images/simple_plot.png deleted file mode 100644 index 47fcde7096c..00000000000 Binary files a/_images/simple_plot.png and /dev/null differ diff --git a/_images/simple_plot1.png b/_images/simple_plot1.png deleted file mode 100644 index 47fcde7096c..00000000000 Binary files a/_images/simple_plot1.png and /dev/null differ diff --git a/_images/simple_rgb.png b/_images/simple_rgb.png deleted file mode 100644 index 1fc91553e27..00000000000 Binary files a/_images/simple_rgb.png and /dev/null differ diff --git a/_images/skewt.png b/_images/skewt.png deleted file mode 100644 index b7d73961ee2..00000000000 Binary files a/_images/skewt.png and /dev/null differ diff --git a/_images/skewt1.png b/_images/skewt1.png deleted file mode 100644 index b7d73961ee2..00000000000 Binary files a/_images/skewt1.png and /dev/null differ diff --git a/_images/slider_demo.png b/_images/slider_demo.png deleted file mode 100644 index 3627ef76250..00000000000 Binary files a/_images/slider_demo.png and /dev/null differ diff --git a/_images/span_regions.png b/_images/span_regions.png deleted file mode 100644 index b976a23de5b..00000000000 Binary files a/_images/span_regions.png and /dev/null differ diff --git a/_images/specgram_demo.png b/_images/specgram_demo.png deleted file mode 100644 index 27fc09a5c63..00000000000 Binary files a/_images/specgram_demo.png and /dev/null differ diff --git a/_images/specgram_demo1.png b/_images/specgram_demo1.png deleted file mode 100644 index 27fc09a5c63..00000000000 Binary files a/_images/specgram_demo1.png and /dev/null differ diff --git a/_images/specgram_demo2.png b/_images/specgram_demo2.png deleted file mode 100644 index 27fc09a5c63..00000000000 Binary files a/_images/specgram_demo2.png and /dev/null differ diff --git a/_images/spectrum_demo.png b/_images/spectrum_demo.png deleted file mode 100644 index 75a8b7b9f93..00000000000 Binary files a/_images/spectrum_demo.png and /dev/null differ diff --git a/_images/spectrum_demo1.png b/_images/spectrum_demo1.png deleted file mode 100644 index 75a8b7b9f93..00000000000 Binary files a/_images/spectrum_demo1.png and /dev/null differ diff --git a/_images/spectrum_demo2.png b/_images/spectrum_demo2.png deleted file mode 100644 index 75a8b7b9f93..00000000000 Binary files a/_images/spectrum_demo2.png and /dev/null differ diff --git a/_images/spine_placement_demo_00.png b/_images/spine_placement_demo_00.png deleted file mode 100644 index d166178b498..00000000000 Binary files a/_images/spine_placement_demo_00.png and /dev/null differ diff --git a/_images/spine_placement_demo_01.png b/_images/spine_placement_demo_01.png deleted file mode 100644 index 76a97bd3c6e..00000000000 Binary files a/_images/spine_placement_demo_01.png and /dev/null differ diff --git a/_images/spines_demo.png b/_images/spines_demo.png deleted file mode 100644 index f8911f6e3ef..00000000000 Binary files a/_images/spines_demo.png and /dev/null differ diff --git a/_images/spines_demo_bounds.png b/_images/spines_demo_bounds.png deleted file mode 100644 index 5d351d04294..00000000000 Binary files a/_images/spines_demo_bounds.png and /dev/null differ diff --git a/_images/spines_demo_dropped.png b/_images/spines_demo_dropped.png deleted file mode 100644 index e69e268f2df..00000000000 Binary files a/_images/spines_demo_dropped.png and /dev/null differ diff --git a/_images/spy_demos.png b/_images/spy_demos.png deleted file mode 100644 index 631a809602d..00000000000 Binary files a/_images/spy_demos.png and /dev/null differ diff --git a/_images/stackplot_demo2.png b/_images/stackplot_demo2.png deleted file mode 100644 index b40f67cf0d6..00000000000 Binary files a/_images/stackplot_demo2.png and /dev/null differ diff --git a/_images/stackplot_demo21.png b/_images/stackplot_demo21.png deleted file mode 100644 index b40f67cf0d6..00000000000 Binary files a/_images/stackplot_demo21.png and /dev/null differ diff --git a/_images/stackplot_demo_00_00.png b/_images/stackplot_demo_00_00.png deleted file mode 100644 index ea8bf13e15e..00000000000 Binary files a/_images/stackplot_demo_00_00.png and /dev/null differ diff --git a/_images/stackplot_demo_01_00.png b/_images/stackplot_demo_01_00.png deleted file mode 100644 index 383af71ca59..00000000000 Binary files a/_images/stackplot_demo_01_00.png and /dev/null differ diff --git a/_images/stem_plot.png b/_images/stem_plot.png deleted file mode 100644 index 96e9be721b6..00000000000 Binary files a/_images/stem_plot.png and /dev/null differ diff --git a/_images/stem_plot1.png b/_images/stem_plot1.png deleted file mode 100644 index 96e9be721b6..00000000000 Binary files a/_images/stem_plot1.png and /dev/null differ diff --git a/_images/stem_plot2.png b/_images/stem_plot2.png deleted file mode 100644 index 96e9be721b6..00000000000 Binary files a/_images/stem_plot2.png and /dev/null differ diff --git a/_images/step_demo.png b/_images/step_demo.png deleted file mode 100644 index 8e7481d117d..00000000000 Binary files a/_images/step_demo.png and /dev/null differ diff --git a/_images/stix_fonts_demo_01_00.png b/_images/stix_fonts_demo_01_00.png deleted file mode 100644 index 8f57818c5e9..00000000000 Binary files a/_images/stix_fonts_demo_01_00.png and /dev/null differ diff --git a/_images/streamplot_demo_features_00.png b/_images/streamplot_demo_features_00.png deleted file mode 100644 index 8e6b5360e3d..00000000000 Binary files a/_images/streamplot_demo_features_00.png and /dev/null differ diff --git a/_images/streamplot_demo_features_001.png b/_images/streamplot_demo_features_001.png deleted file mode 100644 index 8e6b5360e3d..00000000000 Binary files a/_images/streamplot_demo_features_001.png and /dev/null differ diff --git a/_images/streamplot_demo_features_002.png b/_images/streamplot_demo_features_002.png deleted file mode 100644 index 8e6b5360e3d..00000000000 Binary files a/_images/streamplot_demo_features_002.png and /dev/null differ diff --git a/_images/streamplot_demo_features_01.png b/_images/streamplot_demo_features_01.png deleted file mode 100644 index d502def9640..00000000000 Binary files a/_images/streamplot_demo_features_01.png and /dev/null differ diff --git a/_images/streamplot_demo_features_011.png b/_images/streamplot_demo_features_011.png deleted file mode 100644 index d502def9640..00000000000 Binary files a/_images/streamplot_demo_features_011.png and /dev/null differ diff --git a/_images/streamplot_demo_features_012.png b/_images/streamplot_demo_features_012.png deleted file mode 100644 index d502def9640..00000000000 Binary files a/_images/streamplot_demo_features_012.png and /dev/null differ diff --git a/_images/streamplot_demo_masking.png b/_images/streamplot_demo_masking.png deleted file mode 100644 index 76d5f3e8ef8..00000000000 Binary files a/_images/streamplot_demo_masking.png and /dev/null differ diff --git a/_images/streamplot_demo_start_points.png b/_images/streamplot_demo_start_points.png deleted file mode 100644 index e413502a76e..00000000000 Binary files a/_images/streamplot_demo_start_points.png and /dev/null differ diff --git a/_images/style_sheets_reference_00.png b/_images/style_sheets_reference_00.png deleted file mode 100644 index 8ae967568c9..00000000000 Binary files a/_images/style_sheets_reference_00.png and /dev/null differ diff --git a/_images/style_sheets_reference_01.png b/_images/style_sheets_reference_01.png deleted file mode 100644 index 3081c89cff8..00000000000 Binary files a/_images/style_sheets_reference_01.png and /dev/null differ diff --git a/_images/style_sheets_reference_02.png b/_images/style_sheets_reference_02.png deleted file mode 100644 index 1110399ccb8..00000000000 Binary files a/_images/style_sheets_reference_02.png and /dev/null differ diff --git a/_images/style_sheets_reference_03.png b/_images/style_sheets_reference_03.png deleted file mode 100644 index 4bfaea5dfff..00000000000 Binary files a/_images/style_sheets_reference_03.png and /dev/null differ diff --git a/_images/style_sheets_reference_04.png b/_images/style_sheets_reference_04.png deleted file mode 100644 index 23a535895e6..00000000000 Binary files a/_images/style_sheets_reference_04.png and /dev/null differ diff --git a/_images/style_sheets_reference_05.png b/_images/style_sheets_reference_05.png deleted file mode 100644 index 01bfedc0209..00000000000 Binary files a/_images/style_sheets_reference_05.png and /dev/null differ diff --git a/_images/style_sheets_reference_06.png b/_images/style_sheets_reference_06.png deleted file mode 100644 index b00545674e9..00000000000 Binary files a/_images/style_sheets_reference_06.png and /dev/null differ diff --git a/_images/style_sheets_reference_07.png b/_images/style_sheets_reference_07.png deleted file mode 100644 index 7fd34b8a499..00000000000 Binary files a/_images/style_sheets_reference_07.png and /dev/null differ diff --git a/_images/style_sheets_reference_08.png b/_images/style_sheets_reference_08.png deleted file mode 100644 index 04301a4db74..00000000000 Binary files a/_images/style_sheets_reference_08.png and /dev/null differ diff --git a/_images/style_sheets_reference_09.png b/_images/style_sheets_reference_09.png deleted file mode 100644 index 15337888dc8..00000000000 Binary files a/_images/style_sheets_reference_09.png and /dev/null differ diff --git a/_images/style_sheets_reference_10.png b/_images/style_sheets_reference_10.png deleted file mode 100644 index 802d0d54219..00000000000 Binary files a/_images/style_sheets_reference_10.png and /dev/null differ diff --git a/_images/style_sheets_reference_11.png b/_images/style_sheets_reference_11.png deleted file mode 100644 index 4f78a40c4b2..00000000000 Binary files a/_images/style_sheets_reference_11.png and /dev/null differ diff --git a/_images/style_sheets_reference_12.png b/_images/style_sheets_reference_12.png deleted file mode 100644 index 06eefb35733..00000000000 Binary files a/_images/style_sheets_reference_12.png and /dev/null differ diff --git a/_images/style_sheets_reference_13.png b/_images/style_sheets_reference_13.png deleted file mode 100644 index 9a805f19e1b..00000000000 Binary files a/_images/style_sheets_reference_13.png and /dev/null differ diff --git a/_images/style_sheets_reference_14.png b/_images/style_sheets_reference_14.png deleted file mode 100644 index 4b81b5c8b71..00000000000 Binary files a/_images/style_sheets_reference_14.png and /dev/null differ diff --git a/_images/style_sheets_reference_15.png b/_images/style_sheets_reference_15.png deleted file mode 100644 index e17e2018d41..00000000000 Binary files a/_images/style_sheets_reference_15.png and /dev/null differ diff --git a/_images/style_sheets_reference_16.png b/_images/style_sheets_reference_16.png deleted file mode 100644 index 983f79236c6..00000000000 Binary files a/_images/style_sheets_reference_16.png and /dev/null differ diff --git a/_images/style_sheets_reference_17.png b/_images/style_sheets_reference_17.png deleted file mode 100644 index b6e807a7eca..00000000000 Binary files a/_images/style_sheets_reference_17.png and /dev/null differ diff --git a/_images/style_sheets_reference_18.png b/_images/style_sheets_reference_18.png deleted file mode 100644 index b49c63a2f88..00000000000 Binary files a/_images/style_sheets_reference_18.png and /dev/null differ diff --git a/_images/style_sheets_reference_19.png b/_images/style_sheets_reference_19.png deleted file mode 100644 index 063b53944ed..00000000000 Binary files a/_images/style_sheets_reference_19.png and /dev/null differ diff --git a/_images/style_sheets_reference_20.png b/_images/style_sheets_reference_20.png deleted file mode 100644 index d8c7bccaa5b..00000000000 Binary files a/_images/style_sheets_reference_20.png and /dev/null differ diff --git a/_images/style_sheets_reference_21.png b/_images/style_sheets_reference_21.png deleted file mode 100644 index 6a560e51a3b..00000000000 Binary files a/_images/style_sheets_reference_21.png and /dev/null differ diff --git a/_images/style_sheets_reference_22.png b/_images/style_sheets_reference_22.png deleted file mode 100644 index fb8d26249d5..00000000000 Binary files a/_images/style_sheets_reference_22.png and /dev/null differ diff --git a/_images/style_sheets_reference_23.png b/_images/style_sheets_reference_23.png deleted file mode 100644 index eca5ac9457e..00000000000 Binary files a/_images/style_sheets_reference_23.png and /dev/null differ diff --git a/_images/subplot3d_demo.png b/_images/subplot3d_demo.png deleted file mode 100644 index b8430a49fda..00000000000 Binary files a/_images/subplot3d_demo.png and /dev/null differ diff --git a/_images/subplot3d_demo1.png b/_images/subplot3d_demo1.png deleted file mode 100644 index b8430a49fda..00000000000 Binary files a/_images/subplot3d_demo1.png and /dev/null differ diff --git a/_images/subplot_demo.png b/_images/subplot_demo.png deleted file mode 100644 index 3618aa86464..00000000000 Binary files a/_images/subplot_demo.png and /dev/null differ diff --git a/_images/subplot_demo1.png b/_images/subplot_demo1.png deleted file mode 100644 index 3618aa86464..00000000000 Binary files a/_images/subplot_demo1.png and /dev/null differ diff --git a/_images/subplot_demo2.png b/_images/subplot_demo2.png deleted file mode 100644 index f1de42d73f5..00000000000 Binary files a/_images/subplot_demo2.png and /dev/null differ diff --git a/_images/subplot_demo3.png b/_images/subplot_demo3.png deleted file mode 100644 index 3618aa86464..00000000000 Binary files a/_images/subplot_demo3.png and /dev/null differ diff --git a/_images/subplot_toolbar_00.png b/_images/subplot_toolbar_00.png deleted file mode 100644 index b1b2761e586..00000000000 Binary files a/_images/subplot_toolbar_00.png and /dev/null differ diff --git a/_images/subplot_toolbar_01.png b/_images/subplot_toolbar_01.png deleted file mode 100644 index 8799637cd3d..00000000000 Binary files a/_images/subplot_toolbar_01.png and /dev/null differ diff --git a/_images/subplots_adjust.png b/_images/subplots_adjust.png deleted file mode 100644 index 822bd8eaf1c..00000000000 Binary files a/_images/subplots_adjust.png and /dev/null differ diff --git a/_images/subplots_demo_00.png b/_images/subplots_demo_00.png deleted file mode 100644 index c23cd2f1e38..00000000000 Binary files a/_images/subplots_demo_00.png and /dev/null differ diff --git a/_images/subplots_demo_01.png b/_images/subplots_demo_01.png deleted file mode 100644 index e9068564c3f..00000000000 Binary files a/_images/subplots_demo_01.png and /dev/null differ diff --git a/_images/subplots_demo_02.png b/_images/subplots_demo_02.png deleted file mode 100644 index c8fa6b32f21..00000000000 Binary files a/_images/subplots_demo_02.png and /dev/null differ diff --git a/_images/subplots_demo_03.png b/_images/subplots_demo_03.png deleted file mode 100644 index 9166643cc8f..00000000000 Binary files a/_images/subplots_demo_03.png and /dev/null differ diff --git a/_images/subplots_demo_04.png b/_images/subplots_demo_04.png deleted file mode 100644 index 7e7add5aa53..00000000000 Binary files a/_images/subplots_demo_04.png and /dev/null differ diff --git a/_images/subplots_demo_05.png b/_images/subplots_demo_05.png deleted file mode 100644 index bab22e8439b..00000000000 Binary files a/_images/subplots_demo_05.png and /dev/null differ diff --git a/_images/subplots_demo_06.png b/_images/subplots_demo_06.png deleted file mode 100644 index 37301eca65d..00000000000 Binary files a/_images/subplots_demo_06.png and /dev/null differ diff --git a/_images/surface3d_demo.png b/_images/surface3d_demo.png deleted file mode 100644 index 086d98f337c..00000000000 Binary files a/_images/surface3d_demo.png and /dev/null differ diff --git a/_images/surface3d_demo1.png b/_images/surface3d_demo1.png deleted file mode 100644 index 086d98f337c..00000000000 Binary files a/_images/surface3d_demo1.png and /dev/null differ diff --git a/_images/surface3d_demo2.png b/_images/surface3d_demo2.png deleted file mode 100644 index b2d9144da2d..00000000000 Binary files a/_images/surface3d_demo2.png and /dev/null differ diff --git a/_images/surface3d_demo21.png b/_images/surface3d_demo21.png deleted file mode 100644 index b2d9144da2d..00000000000 Binary files a/_images/surface3d_demo21.png and /dev/null differ diff --git a/_images/surface3d_demo3.png b/_images/surface3d_demo3.png deleted file mode 100644 index 979243d14ab..00000000000 Binary files a/_images/surface3d_demo3.png and /dev/null differ diff --git a/_images/surface3d_demo31.png b/_images/surface3d_demo31.png deleted file mode 100644 index 979243d14ab..00000000000 Binary files a/_images/surface3d_demo31.png and /dev/null differ diff --git a/_images/surface3d_demo4.png b/_images/surface3d_demo4.png deleted file mode 100644 index 086d98f337c..00000000000 Binary files a/_images/surface3d_demo4.png and /dev/null differ diff --git a/_images/surface3d_radial_demo.png b/_images/surface3d_radial_demo.png deleted file mode 100644 index 183ce8c95d5..00000000000 Binary files a/_images/surface3d_radial_demo.png and /dev/null differ diff --git a/_images/svg_filter_line.png b/_images/svg_filter_line.png deleted file mode 100644 index 499e5ce0fbc..00000000000 Binary files a/_images/svg_filter_line.png and /dev/null differ diff --git a/_images/svg_filter_pie.png b/_images/svg_filter_pie.png deleted file mode 100644 index 94abd978a33..00000000000 Binary files a/_images/svg_filter_pie.png and /dev/null differ diff --git a/_images/symlog_demo.png b/_images/symlog_demo.png deleted file mode 100644 index 34cf1b74142..00000000000 Binary files a/_images/symlog_demo.png and /dev/null differ diff --git a/_images/system_monitor.png b/_images/system_monitor.png deleted file mode 100644 index 777d50c05cb..00000000000 Binary files a/_images/system_monitor.png and /dev/null differ diff --git a/_images/table_demo.png b/_images/table_demo.png deleted file mode 100644 index feb87b5f502..00000000000 Binary files a/_images/table_demo.png and /dev/null differ diff --git a/_images/table_demo1.png b/_images/table_demo1.png deleted file mode 100644 index feb87b5f502..00000000000 Binary files a/_images/table_demo1.png and /dev/null differ diff --git a/_images/tex_demo.png b/_images/tex_demo.png deleted file mode 100644 index 96258ffb906..00000000000 Binary files a/_images/tex_demo.png and /dev/null differ diff --git a/_images/tex_demo1.png b/_images/tex_demo1.png deleted file mode 100644 index 394cf654623..00000000000 Binary files a/_images/tex_demo1.png and /dev/null differ diff --git a/_images/tex_unicode_demo.png b/_images/tex_unicode_demo.png deleted file mode 100644 index ef573d802e5..00000000000 Binary files a/_images/tex_unicode_demo.png and /dev/null differ diff --git a/_images/tex_unicode_demo1.png b/_images/tex_unicode_demo1.png deleted file mode 100644 index ef573d802e5..00000000000 Binary files a/_images/tex_unicode_demo1.png and /dev/null differ diff --git a/_images/text3d_demo.png b/_images/text3d_demo.png deleted file mode 100644 index 003e1c09cfc..00000000000 Binary files a/_images/text3d_demo.png and /dev/null differ diff --git a/_images/text3d_demo1.png b/_images/text3d_demo1.png deleted file mode 100644 index 003e1c09cfc..00000000000 Binary files a/_images/text3d_demo1.png and /dev/null differ diff --git a/_images/text_commands.png b/_images/text_commands.png deleted file mode 100644 index bc22160e685..00000000000 Binary files a/_images/text_commands.png and /dev/null differ diff --git a/_images/text_demo_fontdict.png b/_images/text_demo_fontdict.png deleted file mode 100644 index 0936b9485b7..00000000000 Binary files a/_images/text_demo_fontdict.png and /dev/null differ diff --git a/_images/text_handles.png b/_images/text_handles.png deleted file mode 100644 index b6e49f834b0..00000000000 Binary files a/_images/text_handles.png and /dev/null differ diff --git a/_images/text_layout.png b/_images/text_layout.png deleted file mode 100644 index d6d10e52323..00000000000 Binary files a/_images/text_layout.png and /dev/null differ diff --git a/_images/text_rotation.png b/_images/text_rotation.png deleted file mode 100644 index 26834a119f0..00000000000 Binary files a/_images/text_rotation.png and /dev/null differ diff --git a/_images/text_rotation_relative_to_line.png b/_images/text_rotation_relative_to_line.png deleted file mode 100644 index a33946b1278..00000000000 Binary files a/_images/text_rotation_relative_to_line.png and /dev/null differ diff --git a/_images/tick-formatters.png b/_images/tick-formatters.png deleted file mode 100644 index e3cea4f95bb..00000000000 Binary files a/_images/tick-formatters.png and /dev/null differ diff --git a/_images/tick-locators.png b/_images/tick-locators.png deleted file mode 100644 index 85918a380c8..00000000000 Binary files a/_images/tick-locators.png and /dev/null differ diff --git a/_images/tick_labels_from_values.png b/_images/tick_labels_from_values.png deleted file mode 100644 index aadce0d198f..00000000000 Binary files a/_images/tick_labels_from_values.png and /dev/null differ diff --git a/_images/ticklabels_demo_rotation.png b/_images/ticklabels_demo_rotation.png deleted file mode 100644 index 8bcf202f88f..00000000000 Binary files a/_images/ticklabels_demo_rotation.png and /dev/null differ diff --git a/_images/tight_bbox_test.png b/_images/tight_bbox_test.png deleted file mode 100644 index b1b2e5b4740..00000000000 Binary files a/_images/tight_bbox_test.png and /dev/null differ diff --git a/_images/tight_layout_guide-1.png b/_images/tight_layout_guide-1.png deleted file mode 100644 index 2f7029474dc..00000000000 Binary files a/_images/tight_layout_guide-1.png and /dev/null differ diff --git a/_images/tight_layout_guide-10.png b/_images/tight_layout_guide-10.png deleted file mode 100644 index ea3a90633f0..00000000000 Binary files a/_images/tight_layout_guide-10.png and /dev/null differ diff --git a/_images/tight_layout_guide-11.png b/_images/tight_layout_guide-11.png deleted file mode 100644 index 7186e59216a..00000000000 Binary files a/_images/tight_layout_guide-11.png and /dev/null differ diff --git a/_images/tight_layout_guide-12.png b/_images/tight_layout_guide-12.png deleted file mode 100644 index 7a12aa51fd2..00000000000 Binary files a/_images/tight_layout_guide-12.png and /dev/null differ diff --git a/_images/tight_layout_guide-13.png b/_images/tight_layout_guide-13.png deleted file mode 100644 index 1dd762b0c96..00000000000 Binary files a/_images/tight_layout_guide-13.png and /dev/null differ diff --git a/_images/tight_layout_guide-14.png b/_images/tight_layout_guide-14.png deleted file mode 100644 index def846642d9..00000000000 Binary files a/_images/tight_layout_guide-14.png and /dev/null differ diff --git a/_images/tight_layout_guide-15.png b/_images/tight_layout_guide-15.png deleted file mode 100644 index 9b5041e5a80..00000000000 Binary files a/_images/tight_layout_guide-15.png and /dev/null differ diff --git a/_images/tight_layout_guide-2.png b/_images/tight_layout_guide-2.png deleted file mode 100644 index a4ffa74293f..00000000000 Binary files a/_images/tight_layout_guide-2.png and /dev/null differ diff --git a/_images/tight_layout_guide-3.png b/_images/tight_layout_guide-3.png deleted file mode 100644 index 3df63d7f680..00000000000 Binary files a/_images/tight_layout_guide-3.png and /dev/null differ diff --git a/_images/tight_layout_guide-4.png b/_images/tight_layout_guide-4.png deleted file mode 100644 index eabb6e07593..00000000000 Binary files a/_images/tight_layout_guide-4.png and /dev/null differ diff --git a/_images/tight_layout_guide-5.png b/_images/tight_layout_guide-5.png deleted file mode 100644 index 3b338623eb9..00000000000 Binary files a/_images/tight_layout_guide-5.png and /dev/null differ diff --git a/_images/tight_layout_guide-6.png b/_images/tight_layout_guide-6.png deleted file mode 100644 index 821e1937aec..00000000000 Binary files a/_images/tight_layout_guide-6.png and /dev/null differ diff --git a/_images/tight_layout_guide-7.png b/_images/tight_layout_guide-7.png deleted file mode 100644 index 92ee03edd8e..00000000000 Binary files a/_images/tight_layout_guide-7.png and /dev/null differ diff --git a/_images/tight_layout_guide-8.png b/_images/tight_layout_guide-8.png deleted file mode 100644 index 72568c6a9f0..00000000000 Binary files a/_images/tight_layout_guide-8.png and /dev/null differ diff --git a/_images/tight_layout_guide-9.png b/_images/tight_layout_guide-9.png deleted file mode 100644 index 4edb1d8fee1..00000000000 Binary files a/_images/tight_layout_guide-9.png and /dev/null differ diff --git a/_images/titles_demo.png b/_images/titles_demo.png deleted file mode 100644 index 5d8febb9e3b..00000000000 Binary files a/_images/titles_demo.png and /dev/null differ diff --git a/_images/toggle_images.png b/_images/toggle_images.png deleted file mode 100644 index 8d571d5b37f..00000000000 Binary files a/_images/toggle_images.png and /dev/null differ diff --git a/_images/topographic_hillshading.png b/_images/topographic_hillshading.png deleted file mode 100644 index 6f608b94292..00000000000 Binary files a/_images/topographic_hillshading.png and /dev/null differ diff --git a/_images/transforms_tutorial-1.png b/_images/transforms_tutorial-1.png deleted file mode 100644 index 6b8963e7afa..00000000000 Binary files a/_images/transforms_tutorial-1.png and /dev/null differ diff --git a/_images/transforms_tutorial-2.png b/_images/transforms_tutorial-2.png deleted file mode 100644 index 2277bbb54be..00000000000 Binary files a/_images/transforms_tutorial-2.png and /dev/null differ diff --git a/_images/transforms_tutorial-3.png b/_images/transforms_tutorial-3.png deleted file mode 100644 index 0066a89eb67..00000000000 Binary files a/_images/transforms_tutorial-3.png and /dev/null differ diff --git a/_images/transforms_tutorial-4.png b/_images/transforms_tutorial-4.png deleted file mode 100644 index f52ec0e20f5..00000000000 Binary files a/_images/transforms_tutorial-4.png and /dev/null differ diff --git a/_images/transforms_tutorial-5.png b/_images/transforms_tutorial-5.png deleted file mode 100644 index a334b9e4b98..00000000000 Binary files a/_images/transforms_tutorial-5.png and /dev/null differ diff --git a/_images/transoffset.png b/_images/transoffset.png deleted file mode 100644 index 9d9cb40def3..00000000000 Binary files a/_images/transoffset.png and /dev/null differ diff --git a/_images/tricontour3d_demo.png b/_images/tricontour3d_demo.png deleted file mode 100644 index 52f456ee0e2..00000000000 Binary files a/_images/tricontour3d_demo.png and /dev/null differ diff --git a/_images/tricontour3d_demo1.png b/_images/tricontour3d_demo1.png deleted file mode 100644 index 52f456ee0e2..00000000000 Binary files a/_images/tricontour3d_demo1.png and /dev/null differ diff --git a/_images/tricontour_demo_00.png b/_images/tricontour_demo_00.png deleted file mode 100644 index 985502f3043..00000000000 Binary files a/_images/tricontour_demo_00.png and /dev/null differ diff --git a/_images/tricontour_demo_001.png b/_images/tricontour_demo_001.png deleted file mode 100644 index 985502f3043..00000000000 Binary files a/_images/tricontour_demo_001.png and /dev/null differ diff --git a/_images/tricontour_demo_002.png b/_images/tricontour_demo_002.png deleted file mode 100644 index 985502f3043..00000000000 Binary files a/_images/tricontour_demo_002.png and /dev/null differ diff --git a/_images/tricontour_demo_01.png b/_images/tricontour_demo_01.png deleted file mode 100644 index 2e945a5646f..00000000000 Binary files a/_images/tricontour_demo_01.png and /dev/null differ diff --git a/_images/tricontour_demo_011.png b/_images/tricontour_demo_011.png deleted file mode 100644 index 2e945a5646f..00000000000 Binary files a/_images/tricontour_demo_011.png and /dev/null differ diff --git a/_images/tricontour_demo_012.png b/_images/tricontour_demo_012.png deleted file mode 100644 index 2e945a5646f..00000000000 Binary files a/_images/tricontour_demo_012.png and /dev/null differ diff --git a/_images/tricontour_smooth_delaunay.png b/_images/tricontour_smooth_delaunay.png deleted file mode 100644 index a2466c273f1..00000000000 Binary files a/_images/tricontour_smooth_delaunay.png and /dev/null differ diff --git a/_images/tricontour_smooth_delaunay1.png b/_images/tricontour_smooth_delaunay1.png deleted file mode 100644 index a2466c273f1..00000000000 Binary files a/_images/tricontour_smooth_delaunay1.png and /dev/null differ diff --git a/_images/tricontour_smooth_user.png b/_images/tricontour_smooth_user.png deleted file mode 100644 index 108936cce80..00000000000 Binary files a/_images/tricontour_smooth_user.png and /dev/null differ diff --git a/_images/tricontour_smooth_user1.png b/_images/tricontour_smooth_user1.png deleted file mode 100644 index 108936cce80..00000000000 Binary files a/_images/tricontour_smooth_user1.png and /dev/null differ diff --git a/_images/tricontour_smooth_user2.png b/_images/tricontour_smooth_user2.png deleted file mode 100644 index 108936cce80..00000000000 Binary files a/_images/tricontour_smooth_user2.png and /dev/null differ diff --git a/_images/tricontour_vs_griddata.png b/_images/tricontour_vs_griddata.png deleted file mode 100644 index a4ad36a69eb..00000000000 Binary files a/_images/tricontour_vs_griddata.png and /dev/null differ diff --git a/_images/tricontourf3d_demo.png b/_images/tricontourf3d_demo.png deleted file mode 100644 index 0ce5378982d..00000000000 Binary files a/_images/tricontourf3d_demo.png and /dev/null differ diff --git a/_images/trigradient_demo.png b/_images/trigradient_demo.png deleted file mode 100644 index 95ac973bdde..00000000000 Binary files a/_images/trigradient_demo.png and /dev/null differ diff --git a/_images/trigradient_demo1.png b/_images/trigradient_demo1.png deleted file mode 100644 index 95ac973bdde..00000000000 Binary files a/_images/trigradient_demo1.png and /dev/null differ diff --git a/_images/triinterp_demo.png b/_images/triinterp_demo.png deleted file mode 100644 index 6337412fe13..00000000000 Binary files a/_images/triinterp_demo.png and /dev/null differ diff --git a/_images/tripcolor_demo_00.png b/_images/tripcolor_demo_00.png deleted file mode 100644 index 6d065220058..00000000000 Binary files a/_images/tripcolor_demo_00.png and /dev/null differ diff --git a/_images/tripcolor_demo_001.png b/_images/tripcolor_demo_001.png deleted file mode 100644 index 6d065220058..00000000000 Binary files a/_images/tripcolor_demo_001.png and /dev/null differ diff --git a/_images/tripcolor_demo_002.png b/_images/tripcolor_demo_002.png deleted file mode 100644 index 6d065220058..00000000000 Binary files a/_images/tripcolor_demo_002.png and /dev/null differ diff --git a/_images/tripcolor_demo_003.png b/_images/tripcolor_demo_003.png deleted file mode 100644 index 6d065220058..00000000000 Binary files a/_images/tripcolor_demo_003.png and /dev/null differ diff --git a/_images/tripcolor_demo_01.png b/_images/tripcolor_demo_01.png deleted file mode 100644 index b9ea23f9441..00000000000 Binary files a/_images/tripcolor_demo_01.png and /dev/null differ diff --git a/_images/tripcolor_demo_011.png b/_images/tripcolor_demo_011.png deleted file mode 100644 index b9ea23f9441..00000000000 Binary files a/_images/tripcolor_demo_011.png and /dev/null differ diff --git a/_images/tripcolor_demo_012.png b/_images/tripcolor_demo_012.png deleted file mode 100644 index b9ea23f9441..00000000000 Binary files a/_images/tripcolor_demo_012.png and /dev/null differ diff --git a/_images/tripcolor_demo_013.png b/_images/tripcolor_demo_013.png deleted file mode 100644 index b9ea23f9441..00000000000 Binary files a/_images/tripcolor_demo_013.png and /dev/null differ diff --git a/_images/tripcolor_demo_02.png b/_images/tripcolor_demo_02.png deleted file mode 100644 index 13e5e5d8d9d..00000000000 Binary files a/_images/tripcolor_demo_02.png and /dev/null differ diff --git a/_images/tripcolor_demo_021.png b/_images/tripcolor_demo_021.png deleted file mode 100644 index 13e5e5d8d9d..00000000000 Binary files a/_images/tripcolor_demo_021.png and /dev/null differ diff --git a/_images/tripcolor_demo_022.png b/_images/tripcolor_demo_022.png deleted file mode 100644 index 13e5e5d8d9d..00000000000 Binary files a/_images/tripcolor_demo_022.png and /dev/null differ diff --git a/_images/tripcolor_demo_023.png b/_images/tripcolor_demo_023.png deleted file mode 100644 index 13e5e5d8d9d..00000000000 Binary files a/_images/tripcolor_demo_023.png and /dev/null differ diff --git a/_images/triplot_demo_00.png b/_images/triplot_demo_00.png deleted file mode 100644 index 41da287e9a5..00000000000 Binary files a/_images/triplot_demo_00.png and /dev/null differ diff --git a/_images/triplot_demo_001.png b/_images/triplot_demo_001.png deleted file mode 100644 index 41da287e9a5..00000000000 Binary files a/_images/triplot_demo_001.png and /dev/null differ diff --git a/_images/triplot_demo_002.png b/_images/triplot_demo_002.png deleted file mode 100644 index 41da287e9a5..00000000000 Binary files a/_images/triplot_demo_002.png and /dev/null differ diff --git a/_images/triplot_demo_003.png b/_images/triplot_demo_003.png deleted file mode 100644 index 41da287e9a5..00000000000 Binary files a/_images/triplot_demo_003.png and /dev/null differ diff --git a/_images/triplot_demo_01.png b/_images/triplot_demo_01.png deleted file mode 100644 index 26837648962..00000000000 Binary files a/_images/triplot_demo_01.png and /dev/null differ diff --git a/_images/triplot_demo_011.png b/_images/triplot_demo_011.png deleted file mode 100644 index 26837648962..00000000000 Binary files a/_images/triplot_demo_011.png and /dev/null differ diff --git a/_images/triplot_demo_012.png b/_images/triplot_demo_012.png deleted file mode 100644 index 26837648962..00000000000 Binary files a/_images/triplot_demo_012.png and /dev/null differ diff --git a/_images/triplot_demo_013.png b/_images/triplot_demo_013.png deleted file mode 100644 index 26837648962..00000000000 Binary files a/_images/triplot_demo_013.png and /dev/null differ diff --git a/_images/trisurf3d_demo.png b/_images/trisurf3d_demo.png deleted file mode 100644 index de2902d8226..00000000000 Binary files a/_images/trisurf3d_demo.png and /dev/null differ diff --git a/_images/trisurf3d_demo1.png b/_images/trisurf3d_demo1.png deleted file mode 100644 index de2902d8226..00000000000 Binary files a/_images/trisurf3d_demo1.png and /dev/null differ diff --git a/_images/trisurf3d_demo2.png b/_images/trisurf3d_demo2.png deleted file mode 100644 index 28a7dac87e8..00000000000 Binary files a/_images/trisurf3d_demo2.png and /dev/null differ diff --git a/_images/trisurf3d_demo21.png b/_images/trisurf3d_demo21.png deleted file mode 100644 index 28a7dac87e8..00000000000 Binary files a/_images/trisurf3d_demo21.png and /dev/null differ diff --git a/_images/trisurf3d_demo3.png b/_images/trisurf3d_demo3.png deleted file mode 100644 index de2902d8226..00000000000 Binary files a/_images/trisurf3d_demo3.png and /dev/null differ diff --git a/_images/two_scales.png b/_images/two_scales.png deleted file mode 100644 index 3850fc3b8bb..00000000000 Binary files a/_images/two_scales.png and /dev/null differ diff --git a/_images/unicode_demo.png b/_images/unicode_demo.png deleted file mode 100644 index cbfba78ca70..00000000000 Binary files a/_images/unicode_demo.png and /dev/null differ diff --git a/_images/unicode_minus.png b/_images/unicode_minus.png deleted file mode 100644 index deb8dda00cf..00000000000 Binary files a/_images/unicode_minus.png and /dev/null differ diff --git a/_images/units_sample.png b/_images/units_sample.png deleted file mode 100644 index 37c197b0b06..00000000000 Binary files a/_images/units_sample.png and /dev/null differ diff --git a/_images/units_scatter.png b/_images/units_scatter.png deleted file mode 100644 index 710abf90353..00000000000 Binary files a/_images/units_scatter.png and /dev/null differ diff --git a/_images/usetex_baseline_test.png b/_images/usetex_baseline_test.png deleted file mode 100644 index 422addd4d42..00000000000 Binary files a/_images/usetex_baseline_test.png and /dev/null differ diff --git a/_images/usetex_demo.png b/_images/usetex_demo.png deleted file mode 100644 index abb6a0903f6..00000000000 Binary files a/_images/usetex_demo.png and /dev/null differ diff --git a/_images/usetex_fonteffects.png b/_images/usetex_fonteffects.png deleted file mode 100644 index 5d3f77d29c1..00000000000 Binary files a/_images/usetex_fonteffects.png and /dev/null differ diff --git a/_images/violinplot_demo.png b/_images/violinplot_demo.png deleted file mode 100644 index 09c66271cfb..00000000000 Binary files a/_images/violinplot_demo.png and /dev/null differ diff --git a/_images/vline_hline_demo.png b/_images/vline_hline_demo.png deleted file mode 100644 index a8afaa3e6d5..00000000000 Binary files a/_images/vline_hline_demo.png and /dev/null differ diff --git a/_images/vline_hline_demo1.png b/_images/vline_hline_demo1.png deleted file mode 100644 index a8afaa3e6d5..00000000000 Binary files a/_images/vline_hline_demo1.png and /dev/null differ diff --git a/_images/vline_hline_demo2.png b/_images/vline_hline_demo2.png deleted file mode 100644 index a8afaa3e6d5..00000000000 Binary files a/_images/vline_hline_demo2.png and /dev/null differ diff --git a/_images/watermark_image.png b/_images/watermark_image.png deleted file mode 100644 index 779d8119acf..00000000000 Binary files a/_images/watermark_image.png and /dev/null differ diff --git a/_images/watermark_text.png b/_images/watermark_text.png deleted file mode 100644 index 83d1357a78c..00000000000 Binary files a/_images/watermark_text.png and /dev/null differ diff --git a/_images/whats_new_1_subplot3d.png b/_images/whats_new_1_subplot3d.png deleted file mode 100644 index d93723d008f..00000000000 Binary files a/_images/whats_new_1_subplot3d.png and /dev/null differ diff --git a/_images/whats_new_98_4_fancy.png b/_images/whats_new_98_4_fancy.png deleted file mode 100644 index db6fb74a9f5..00000000000 Binary files a/_images/whats_new_98_4_fancy.png and /dev/null differ diff --git a/_images/whats_new_98_4_fill_between.png b/_images/whats_new_98_4_fill_between.png deleted file mode 100644 index fa857eb44c2..00000000000 Binary files a/_images/whats_new_98_4_fill_between.png and /dev/null differ diff --git a/_images/whats_new_98_4_legend.png b/_images/whats_new_98_4_legend.png deleted file mode 100644 index 6ff43692865..00000000000 Binary files a/_images/whats_new_98_4_legend.png and /dev/null differ diff --git a/_images/whats_new_99_axes_grid.png b/_images/whats_new_99_axes_grid.png deleted file mode 100644 index daacf457393..00000000000 Binary files a/_images/whats_new_99_axes_grid.png and /dev/null differ diff --git a/_images/whats_new_99_mplot3d.png b/_images/whats_new_99_mplot3d.png deleted file mode 100644 index 242973dfd5e..00000000000 Binary files a/_images/whats_new_99_mplot3d.png and /dev/null differ diff --git a/_images/whats_new_99_spines.png b/_images/whats_new_99_spines.png deleted file mode 100644 index 76876c518fc..00000000000 Binary files a/_images/whats_new_99_spines.png and /dev/null differ diff --git a/_images/wire3d_animation_demo.png b/_images/wire3d_animation_demo.png deleted file mode 100644 index a449c813462..00000000000 Binary files a/_images/wire3d_animation_demo.png and /dev/null differ diff --git a/_images/wire3d_demo.png b/_images/wire3d_demo.png deleted file mode 100644 index 51ea9300a3f..00000000000 Binary files a/_images/wire3d_demo.png and /dev/null differ diff --git a/_images/wire3d_demo1.png b/_images/wire3d_demo1.png deleted file mode 100644 index 51ea9300a3f..00000000000 Binary files a/_images/wire3d_demo1.png and /dev/null differ diff --git a/_images/wire3d_zero_stride.png b/_images/wire3d_zero_stride.png deleted file mode 100644 index 6afce47a0b4..00000000000 Binary files a/_images/wire3d_zero_stride.png and /dev/null differ diff --git a/_images/xcorr_demo.png b/_images/xcorr_demo.png deleted file mode 100644 index 805d0685a57..00000000000 Binary files a/_images/xcorr_demo.png and /dev/null differ diff --git a/_images/xcorr_demo1.png b/_images/xcorr_demo1.png deleted file mode 100644 index 805d0685a57..00000000000 Binary files a/_images/xcorr_demo1.png and /dev/null differ diff --git a/_images/xcorr_demo2.png b/_images/xcorr_demo2.png deleted file mode 100644 index 805d0685a57..00000000000 Binary files a/_images/xcorr_demo2.png and /dev/null differ diff --git a/_images/xkcd_00.png b/_images/xkcd_00.png deleted file mode 100644 index aa8b56fc6df..00000000000 Binary files a/_images/xkcd_00.png and /dev/null differ diff --git a/_images/xkcd_001.png b/_images/xkcd_001.png deleted file mode 100644 index aa8b56fc6df..00000000000 Binary files a/_images/xkcd_001.png and /dev/null differ diff --git a/_images/xkcd_002.png b/_images/xkcd_002.png deleted file mode 100644 index aa8b56fc6df..00000000000 Binary files a/_images/xkcd_002.png and /dev/null differ diff --git a/_images/xkcd_01.png b/_images/xkcd_01.png deleted file mode 100644 index eb188f85b1d..00000000000 Binary files a/_images/xkcd_01.png and /dev/null differ diff --git a/_images/xkcd_011.png b/_images/xkcd_011.png deleted file mode 100644 index eb188f85b1d..00000000000 Binary files a/_images/xkcd_011.png and /dev/null differ diff --git a/_images/xkcd_012.png b/_images/xkcd_012.png deleted file mode 100644 index eb188f85b1d..00000000000 Binary files a/_images/xkcd_012.png and /dev/null differ diff --git a/_images/zorder_demo_00.png b/_images/zorder_demo_00.png deleted file mode 100644 index 523911e8069..00000000000 Binary files a/_images/zorder_demo_00.png and /dev/null differ diff --git a/_images/zorder_demo_01.png b/_images/zorder_demo_01.png deleted file mode 100644 index e6b426097ee..00000000000 Binary files a/_images/zorder_demo_01.png and /dev/null differ diff --git a/_sources/api/_as_gen/matplotlib.animation.Animation.save.rst.txt b/_sources/api/_as_gen/matplotlib.animation.Animation.save.rst.txt deleted file mode 100644 index 206fafc1851..00000000000 --- a/_sources/api/_as_gen/matplotlib.animation.Animation.save.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -matplotlib\.animation\.Animation\.save -====================================== - -.. currentmodule:: matplotlib.animation - -.. automethod:: Animation.save \ No newline at end of file diff --git a/_sources/api/_as_gen/matplotlib.animation.Animation.to_html5_video.rst.txt b/_sources/api/_as_gen/matplotlib.animation.Animation.to_html5_video.rst.txt deleted file mode 100644 index 38f4aa7911e..00000000000 --- a/_sources/api/_as_gen/matplotlib.animation.Animation.to_html5_video.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -matplotlib\.animation\.Animation\.to\_html5\_video -================================================== - -.. currentmodule:: matplotlib.animation - -.. automethod:: Animation.to_html5_video \ No newline at end of file diff --git a/_sources/api/_as_gen/matplotlib.animation.FileMovieWriter.setup.rst.txt b/_sources/api/_as_gen/matplotlib.animation.FileMovieWriter.setup.rst.txt deleted file mode 100644 index 67a70a5d465..00000000000 --- a/_sources/api/_as_gen/matplotlib.animation.FileMovieWriter.setup.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -matplotlib\.animation\.FileMovieWriter\.setup -============================================= - -.. currentmodule:: matplotlib.animation - -.. automethod:: FileMovieWriter.setup \ No newline at end of file diff --git a/_sources/api/_as_gen/matplotlib.animation.MovieWriter.finish.rst.txt b/_sources/api/_as_gen/matplotlib.animation.MovieWriter.finish.rst.txt deleted file mode 100644 index 49d0ddf6a3e..00000000000 --- a/_sources/api/_as_gen/matplotlib.animation.MovieWriter.finish.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -matplotlib\.animation\.MovieWriter\.finish -========================================== - -.. currentmodule:: matplotlib.animation - -.. automethod:: MovieWriter.finish \ No newline at end of file diff --git a/_sources/api/_as_gen/matplotlib.animation.MovieWriter.grab_frame.rst.txt b/_sources/api/_as_gen/matplotlib.animation.MovieWriter.grab_frame.rst.txt deleted file mode 100644 index 593f2e4872e..00000000000 --- a/_sources/api/_as_gen/matplotlib.animation.MovieWriter.grab_frame.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -matplotlib\.animation\.MovieWriter\.grab\_frame -=============================================== - -.. currentmodule:: matplotlib.animation - -.. automethod:: MovieWriter.grab_frame \ No newline at end of file diff --git a/_sources/api/_as_gen/matplotlib.animation.MovieWriter.saving.rst.txt b/_sources/api/_as_gen/matplotlib.animation.MovieWriter.saving.rst.txt deleted file mode 100644 index dbbb0cde664..00000000000 --- a/_sources/api/_as_gen/matplotlib.animation.MovieWriter.saving.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -matplotlib\.animation\.MovieWriter\.saving -========================================== - -.. currentmodule:: matplotlib.animation - -.. automethod:: MovieWriter.saving \ No newline at end of file diff --git a/_sources/api/_as_gen/matplotlib.animation.MovieWriter.setup.rst.txt b/_sources/api/_as_gen/matplotlib.animation.MovieWriter.setup.rst.txt deleted file mode 100644 index 0f7899f5fcd..00000000000 --- a/_sources/api/_as_gen/matplotlib.animation.MovieWriter.setup.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -matplotlib\.animation\.MovieWriter\.setup -========================================= - -.. currentmodule:: matplotlib.animation - -.. automethod:: MovieWriter.setup \ No newline at end of file diff --git a/_sources/api/_as_gen/matplotlib.artist.Artist.get_axes.rst.txt b/_sources/api/_as_gen/matplotlib.artist.Artist.get_axes.rst.txt deleted file mode 100644 index acd26c34473..00000000000 --- a/_sources/api/_as_gen/matplotlib.artist.Artist.get_axes.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -matplotlib\.artist\.Artist\.get\_axes -===================================== - -.. currentmodule:: matplotlib.artist - -.. automethod:: Artist.get_axes \ No newline at end of file diff --git a/_sources/api/_as_gen/matplotlib.artist.Artist.set_axes.rst.txt b/_sources/api/_as_gen/matplotlib.artist.Artist.set_axes.rst.txt deleted file mode 100644 index c0c709bfee3..00000000000 --- a/_sources/api/_as_gen/matplotlib.artist.Artist.set_axes.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -matplotlib\.artist\.Artist\.set\_axes -===================================== - -.. currentmodule:: matplotlib.artist - -.. automethod:: Artist.set_axes \ No newline at end of file diff --git a/_sources/api/_as_gen/matplotlib.axes.Axes.get_axes.rst.txt b/_sources/api/_as_gen/matplotlib.axes.Axes.get_axes.rst.txt deleted file mode 100644 index 5839c762a33..00000000000 --- a/_sources/api/_as_gen/matplotlib.axes.Axes.get_axes.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -matplotlib\.axes\.Axes\.get\_axes -================================= - -.. currentmodule:: matplotlib.axes - -.. automethod:: Axes.get_axes \ No newline at end of file diff --git a/_sources/api/_as_gen/matplotlib.axes.Axes.set_axes.rst.txt b/_sources/api/_as_gen/matplotlib.axes.Axes.set_axes.rst.txt deleted file mode 100644 index 52a7d9434c9..00000000000 --- a/_sources/api/_as_gen/matplotlib.axes.Axes.set_axes.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -matplotlib\.axes\.Axes\.set\_axes -================================= - -.. currentmodule:: matplotlib.axes - -.. automethod:: Axes.set_axes \ No newline at end of file diff --git a/_sources/api/_as_gen/matplotlib.axis.Axis.get_axes.rst.txt b/_sources/api/_as_gen/matplotlib.axis.Axis.get_axes.rst.txt deleted file mode 100644 index 96db725ba60..00000000000 --- a/_sources/api/_as_gen/matplotlib.axis.Axis.get_axes.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -matplotlib\.axis\.Axis\.get\_axes -================================= - -.. currentmodule:: matplotlib.axis - -.. automethod:: Axis.get_axes \ No newline at end of file diff --git a/_sources/api/_as_gen/matplotlib.axis.Axis.set_axes.rst.txt b/_sources/api/_as_gen/matplotlib.axis.Axis.set_axes.rst.txt deleted file mode 100644 index b52738e0752..00000000000 --- a/_sources/api/_as_gen/matplotlib.axis.Axis.set_axes.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -matplotlib\.axis\.Axis\.set\_axes -================================= - -.. currentmodule:: matplotlib.axis - -.. automethod:: Axis.set_axes \ No newline at end of file diff --git a/_sources/api/_as_gen/matplotlib.axis.Tick.get_axes.rst.txt b/_sources/api/_as_gen/matplotlib.axis.Tick.get_axes.rst.txt deleted file mode 100644 index 98ee751ba81..00000000000 --- a/_sources/api/_as_gen/matplotlib.axis.Tick.get_axes.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -matplotlib\.axis\.Tick\.get\_axes -================================= - -.. currentmodule:: matplotlib.axis - -.. automethod:: Tick.get_axes \ No newline at end of file diff --git a/_sources/api/_as_gen/matplotlib.axis.Tick.set_axes.rst.txt b/_sources/api/_as_gen/matplotlib.axis.Tick.set_axes.rst.txt deleted file mode 100644 index 24757a14f20..00000000000 --- a/_sources/api/_as_gen/matplotlib.axis.Tick.set_axes.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -matplotlib\.axis\.Tick\.set\_axes -================================= - -.. currentmodule:: matplotlib.axis - -.. automethod:: Tick.set_axes \ No newline at end of file diff --git a/_sources/api/_as_gen/matplotlib.axis.XAxis.get_axes.rst.txt b/_sources/api/_as_gen/matplotlib.axis.XAxis.get_axes.rst.txt deleted file mode 100644 index 87033a8156e..00000000000 --- a/_sources/api/_as_gen/matplotlib.axis.XAxis.get_axes.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -matplotlib\.axis\.XAxis\.get\_axes -================================== - -.. currentmodule:: matplotlib.axis - -.. automethod:: XAxis.get_axes \ No newline at end of file diff --git a/_sources/api/_as_gen/matplotlib.axis.XAxis.set_axes.rst.txt b/_sources/api/_as_gen/matplotlib.axis.XAxis.set_axes.rst.txt deleted file mode 100644 index cbefc472537..00000000000 --- a/_sources/api/_as_gen/matplotlib.axis.XAxis.set_axes.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -matplotlib\.axis\.XAxis\.set\_axes -================================== - -.. currentmodule:: matplotlib.axis - -.. automethod:: XAxis.set_axes \ No newline at end of file diff --git a/_sources/api/_as_gen/matplotlib.axis.XTick.get_axes.rst.txt b/_sources/api/_as_gen/matplotlib.axis.XTick.get_axes.rst.txt deleted file mode 100644 index a0a99ac1ce7..00000000000 --- a/_sources/api/_as_gen/matplotlib.axis.XTick.get_axes.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -matplotlib\.axis\.XTick\.get\_axes -================================== - -.. currentmodule:: matplotlib.axis - -.. automethod:: XTick.get_axes \ No newline at end of file diff --git a/_sources/api/_as_gen/matplotlib.axis.XTick.set_axes.rst.txt b/_sources/api/_as_gen/matplotlib.axis.XTick.set_axes.rst.txt deleted file mode 100644 index 0fa76d9e320..00000000000 --- a/_sources/api/_as_gen/matplotlib.axis.XTick.set_axes.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -matplotlib\.axis\.XTick\.set\_axes -================================== - -.. currentmodule:: matplotlib.axis - -.. automethod:: XTick.set_axes \ No newline at end of file diff --git a/_sources/api/_as_gen/matplotlib.axis.YAxis.get_axes.rst.txt b/_sources/api/_as_gen/matplotlib.axis.YAxis.get_axes.rst.txt deleted file mode 100644 index ff48cb3fdf8..00000000000 --- a/_sources/api/_as_gen/matplotlib.axis.YAxis.get_axes.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -matplotlib\.axis\.YAxis\.get\_axes -================================== - -.. currentmodule:: matplotlib.axis - -.. automethod:: YAxis.get_axes \ No newline at end of file diff --git a/_sources/api/_as_gen/matplotlib.axis.YAxis.set_axes.rst.txt b/_sources/api/_as_gen/matplotlib.axis.YAxis.set_axes.rst.txt deleted file mode 100644 index 652380cd68c..00000000000 --- a/_sources/api/_as_gen/matplotlib.axis.YAxis.set_axes.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -matplotlib\.axis\.YAxis\.set\_axes -================================== - -.. currentmodule:: matplotlib.axis - -.. automethod:: YAxis.set_axes \ No newline at end of file diff --git a/_sources/api/_as_gen/matplotlib.axis.YTick.get_axes.rst.txt b/_sources/api/_as_gen/matplotlib.axis.YTick.get_axes.rst.txt deleted file mode 100644 index 483fa5115a7..00000000000 --- a/_sources/api/_as_gen/matplotlib.axis.YTick.get_axes.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -matplotlib\.axis\.YTick\.get\_axes -================================== - -.. currentmodule:: matplotlib.axis - -.. automethod:: YTick.get_axes \ No newline at end of file diff --git a/_sources/api/_as_gen/matplotlib.axis.YTick.set_axes.rst.txt b/_sources/api/_as_gen/matplotlib.axis.YTick.set_axes.rst.txt deleted file mode 100644 index dcc6a9a7dac..00000000000 --- a/_sources/api/_as_gen/matplotlib.axis.YTick.set_axes.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -matplotlib\.axis\.YTick\.set\_axes -================================== - -.. currentmodule:: matplotlib.axis - -.. automethod:: YTick.set_axes \ No newline at end of file diff --git a/_sources/api/pyplot_api.rst.txt b/_sources/api/pyplot_api.rst.txt deleted file mode 100644 index 94e3baac26f..00000000000 --- a/_sources/api/pyplot_api.rst.txt +++ /dev/null @@ -1,13 +0,0 @@ -****** -pyplot -****** - - -:mod:`matplotlib.pyplot` -======================== - -.. automodule:: matplotlib.pyplot - :members: - :undoc-members: - :show-inheritance: - :exclude-members: plotting, colormaps diff --git a/_sources/examples/animation/animate_decay.rst.txt b/_sources/examples/animation/animate_decay.rst.txt deleted file mode 100644 index c0e387bd6e7..00000000000 --- a/_sources/examples/animation/animate_decay.rst.txt +++ /dev/null @@ -1,65 +0,0 @@ -.. _animation-animate_decay: - -animation example code: animate_decay.py -======================================== - -[`source code `_] - -:: - - """ - ===== - Decay - ===== - - This example showcases a sinusoidal decay animation. - """ - - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.animation as animation - - - def data_gen(t=0): - cnt = 0 - while cnt < 1000: - cnt += 1 - t += 0.1 - yield t, np.sin(2*np.pi*t) * np.exp(-t/10.) - - - def init(): - ax.set_ylim(-1.1, 1.1) - ax.set_xlim(0, 10) - del xdata[:] - del ydata[:] - line.set_data(xdata, ydata) - return line, - - fig, ax = plt.subplots() - line, = ax.plot([], [], lw=2) - ax.grid() - xdata, ydata = [], [] - - - def run(data): - # update the data - t, y = data - xdata.append(t) - ydata.append(y) - xmin, xmax = ax.get_xlim() - - if t >= xmax: - ax.set_xlim(xmin, 2*xmax) - ax.figure.canvas.draw() - line.set_data(xdata, ydata) - - return line, - - ani = animation.FuncAnimation(fig, run, data_gen, blit=False, interval=10, - repeat=False, init_func=init) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/animate_decay.txt b/_sources/examples/animation/animate_decay.txt deleted file mode 100644 index 5e6ce49f25e..00000000000 --- a/_sources/examples/animation/animate_decay.txt +++ /dev/null @@ -1,56 +0,0 @@ -.. _animation-animate_decay: - -animation example code: animate_decay.py -======================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.animation as animation - - - def data_gen(t=0): - cnt = 0 - while cnt < 1000: - cnt += 1 - t += 0.1 - yield t, np.sin(2*np.pi*t) * np.exp(-t/10.) - - - def init(): - ax.set_ylim(-1.1, 1.1) - ax.set_xlim(0, 10) - del xdata[:] - del ydata[:] - line.set_data(xdata, ydata) - return line, - - fig, ax = plt.subplots() - line, = ax.plot([], [], lw=2) - ax.grid() - xdata, ydata = [], [] - - - def run(data): - # update the data - t, y = data - xdata.append(t) - ydata.append(y) - xmin, xmax = ax.get_xlim() - - if t >= xmax: - ax.set_xlim(xmin, 2*xmax) - ax.figure.canvas.draw() - line.set_data(xdata, ydata) - - return line, - - ani = animation.FuncAnimation(fig, run, data_gen, blit=False, interval=10, - repeat=False, init_func=init) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/animate_decay_tk_blit.txt b/_sources/examples/animation/animate_decay_tk_blit.txt deleted file mode 100644 index 4c5a18367b4..00000000000 --- a/_sources/examples/animation/animate_decay_tk_blit.txt +++ /dev/null @@ -1,70 +0,0 @@ -.. _animation-animate_decay_tk_blit: - -animation example code: animate_decay_tk_blit.py -================================================ - -[`source code `_] - -:: - - import time, sys - import numpy as np - import matplotlib.pyplot as plt - - - def data_gen(): - t = data_gen.t - data_gen.t += 0.05 - return np.sin(2*np.pi*t) * np.exp(-t/10.) - data_gen.t = 0 - - fig = plt.figure() - ax = fig.add_subplot(111) - line, = ax.plot([], [], animated=True, lw=2) - ax.set_ylim(-1.1, 1.1) - ax.set_xlim(0, 5) - ax.grid() - xdata, ydata = [], [] - def run(*args): - background = fig.canvas.copy_from_bbox(ax.bbox) - # for profiling - tstart = time.time() - - while 1: - # restore the clean slate background - fig.canvas.restore_region(background) - # update the data - t = data_gen.t - y = data_gen() - xdata.append(t) - ydata.append(y) - xmin, xmax = ax.get_xlim() - if t>=xmax: - ax.set_xlim(xmin, 2*xmax) - fig.canvas.draw() - background = fig.canvas.copy_from_bbox(ax.bbox) - - line.set_data(xdata, ydata) - - # just draw the animated artist - ax.draw_artist(line) - # just redraw the axes rectangle - fig.canvas.blit(ax.bbox) - - if run.cnt==1000: - # print the timing info and quit - print 'FPS:' , 1000/(time.time()-tstart) - sys.exit() - - run.cnt += 1 - run.cnt = 0 - - - - manager = plt.get_current_fig_manager() - manager.window.after(100, run) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/animation_blit_fltk.txt b/_sources/examples/animation/animation_blit_fltk.txt deleted file mode 100644 index 9e2c18b1547..00000000000 --- a/_sources/examples/animation/animation_blit_fltk.txt +++ /dev/null @@ -1,66 +0,0 @@ -.. _animation-animation_blit_fltk: - -animation example code: animation_blit_fltk.py -============================================== - -[`source code `_] - -:: - - import sys - import fltk - import matplotlib - matplotlib.use('FltkAgg') - import pylab as p - import numpy as npy - import time - - - # save the clean slate background -- everything but the animated line - # is drawn and saved in the pixel buffer background - class animator: - def __init__(self,ax): - self.ax=ax - self.canvas=ax.figure.canvas - self.canvas.mpl_connect('draw_event',self.clear) - self.cnt=0 - self.background=None - - # for profiling - self.tstart = time.time() - - def clear(self,event): - self.background = self.canvas.copy_from_bbox(self.ax.bbox) - - def update(self,ptr): - # restore the clean slate background - if self.background is None: - self.background = self.canvas.copy_from_bbox(self.ax.bbox) - self.canvas.restore_region(self.background) - # update the data - line.set_ydata(npy.sin(x+self.cnt/10.0)) - # just draw the animated artist - self.ax.draw_artist(line) - # just redraw the axes rectangle - self.canvas.blit(ax.bbox) - self.cnt+=1 - if self.cnt==1000: - # print the timing info and quit - print 'FPS:' , 1000/(time.time()-self.tstart) - sys.exit() - return True - - ax = p.subplot(111) - p.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs - p.grid() # to ensure proper background restore - # create the initial line - x = npy.arange(0,2*npy.pi,0.01) - line, = p.plot(x, npy.sin(x), animated=True) - p.draw() - anim=animator(ax) - - fltk.Fl.add_idle(anim.update) - fltk.Fl.run() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/animation_blit_gtk.txt b/_sources/examples/animation/animation_blit_gtk.txt deleted file mode 100644 index 1f21a8f7084..00000000000 --- a/_sources/examples/animation/animation_blit_gtk.txt +++ /dev/null @@ -1,85 +0,0 @@ -.. _animation-animation_blit_gtk: - -animation example code: animation_blit_gtk.py -============================================= - -[`source code `_] - -:: - - #!/usr/bin/env python - - # For detailed comments on animation and the techniques used here, see - # the wiki entry - # http://www.scipy.org/wikis/topical_software/MatplotlibAnimation - import time - - import gtk, gobject - - import matplotlib - matplotlib.use('GTKAgg') - - import numpy as np - import matplotlib.pyplot as plt - - - fig = plt.figure() - ax = fig.add_subplot(111) - canvas = fig.canvas - - fig.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs - ax.grid() # to ensure proper background restore - - # create the initial line - x = np.arange(0,2*np.pi,0.01) - line, = ax.plot(x, np.sin(x), animated=True, lw=2) - canvas.draw() - - # for profiling - tstart = time.time() - - def on_draw(event): - background = canvas.copy_from_bbox(ax.bbox) - if on_draw.background is None: - gobject.idle_add(update_line) - - on_draw.background = background - - on_draw.background = None - - fig.canvas.mpl_connect('draw_event', on_draw) - - def update_line(*args): - if on_draw.background is None: - return True - - print 'frame', update_line.cnt - - # restore the clean slate background - canvas.restore_region(on_draw.background) - # update the data - line.set_ydata(np.sin(x+update_line.cnt/10.0)) - - # just draw the animated artist - ax.draw_artist(line) - - # just redraw the axes rectangle - canvas.blit(ax.bbox) - - if update_line.cnt==1000: - # print the timing info and quit - print 'FPS:' , 1000/(time.time()-tstart) - gtk.mainquit() - raise SystemExit - - update_line.cnt += 1 - return True - - update_line.cnt = 0 - - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/animation_blit_gtk2.txt b/_sources/examples/animation/animation_blit_gtk2.txt deleted file mode 100644 index 64c2dcf78fc..00000000000 --- a/_sources/examples/animation/animation_blit_gtk2.txt +++ /dev/null @@ -1,179 +0,0 @@ -.. _animation-animation_blit_gtk2: - -animation example code: animation_blit_gtk2.py -============================================== - -[`source code `_] - -:: - - #!/usr/bin/env python - - """ - This example utlizes restore_region with optional bbox and xy - arguments. The plot is continuously shifted to the left. Instead of - drawing everything again, the plot is saved (copy_from_bbox) and - restored with offset by the amount of the shift. And only newly - exposed area is drawn. This technique may reduce drawing time for some cases. - """ - - import time - - import gtk, gobject - - import matplotlib - matplotlib.use('GTKAgg') - - import numpy as np - import matplotlib.pyplot as plt - - class UpdateLine(object): - def get_bg_bbox(self): - - return self.ax.bbox.padded(-3) - - def __init__(self, canvas, ax): - self.cnt = 0 - self.canvas = canvas - self.ax = ax - - self.prev_time = time.time() - self.start_time = self.prev_time - self.prev_pixel_offset = 0. - - - self.x0 = 0 - self.phases = np.random.random_sample((20,)) * np.pi * 2 - self.line, = ax.plot([], [], "-", animated=True, lw=2) - - self.point, = ax.plot([], [], "ro", animated=True, lw=2) - - self.ax.set_ylim(-1.1, 1.1) - - self.background1 = None - - cmap = plt.cm.jet - from itertools import cycle - self.color_cycle = cycle(cmap(np.arange(cmap.N))) - - - def save_bg(self): - self.background1 = self.canvas.copy_from_bbox(self.ax.get_figure().bbox) - - self.background2 = self.canvas.copy_from_bbox(self.get_bg_bbox()) - - - def get_dx_data(self, dx_pixel): - tp = self.ax.transData.inverted().transform_point - x0, y0 = tp((0, 0)) - x1, y1 = tp((dx_pixel, 0)) - return (x1-x0) - - - def restore_background_shifted(self, dx_pixel): - """ - restore bacground shifted by dx in data coordinate. This only - works if the data coordinate system is linear. - """ - - # restore the clean slate background - self.canvas.restore_region(self.background1) - - # restore subregion (x1+dx, y1, x2, y2) of the second bg - # in a offset position (x1-dx, y1) - x1, y1, x2, y2 = self.background2.get_extents() - self.canvas.restore_region(self.background2, - bbox=(x1+dx_pixel, y1, x2, y2), - xy=(x1-dx_pixel, y1)) - - return dx_pixel - - def on_draw(self, *args): - self.save_bg() - return False - - def update_line(self, *args): - - if self.background1 is None: - return True - - cur_time = time.time() - pixel_offset = int((cur_time - self.start_time)*100.) - dx_pixel = pixel_offset - self.prev_pixel_offset - self.prev_pixel_offset = pixel_offset - dx_data = self.get_dx_data(dx_pixel) #cur_time - self.prev_time) - - x0 = self.x0 - self.x0 += dx_data - self.prev_time = cur_time - - self.ax.set_xlim(self.x0-2, self.x0+0.1) - - - # restore background which will plot lines from previous plots - self.restore_background_shifted(dx_pixel) #x0, self.x0) - # This restores lines between [x0-2, x0] - - - - self.line.set_color(self.color_cycle.next()) - - # now plot line segment within [x0, x0+dx_data], - # Note that we're only plotting a line between [x0, x0+dx_data]. - xx = np.array([x0, self.x0]) - self.line.set_xdata(xx) - - # the for loop below could be improved by using collection. - [(self.line.set_ydata(np.sin(xx+p)), - self.ax.draw_artist(self.line)) \ - for p in self.phases] - - self.background2 = canvas.copy_from_bbox(self.get_bg_bbox()) - - self.point.set_xdata([self.x0]) - - [(self.point.set_ydata(np.sin([self.x0+p])), - self.ax.draw_artist(self.point)) \ - for p in self.phases] - - - self.ax.draw_artist(self.ax.xaxis) - self.ax.draw_artist(self.ax.yaxis) - - self.canvas.blit(self.ax.get_figure().bbox) - - - dt = (time.time()-tstart) - if dt>15: - # print the timing info and quit - print 'FPS:' , self.cnt/dt - gtk.main_quit() - raise SystemExit - - self.cnt += 1 - return True - - - plt.rcParams["text.usetex"] = False - fig = plt.figure() - - ax = fig.add_subplot(111) - ax.xaxis.set_animated(True) - ax.yaxis.set_animated(True) - canvas = fig.canvas - - fig.subplots_adjust(left=0.2, bottom=0.2) - canvas.draw() - - # for profiling - tstart = time.time() - - ul = UpdateLine(canvas, ax) - gobject.idle_add(ul.update_line) - - canvas.mpl_connect('draw_event', ul.on_draw) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/animation_blit_qt.txt b/_sources/examples/animation/animation_blit_qt.txt deleted file mode 100644 index 046c0f8b9f5..00000000000 --- a/_sources/examples/animation/animation_blit_qt.txt +++ /dev/null @@ -1,76 +0,0 @@ -.. _animation-animation_blit_qt: - -animation example code: animation_blit_qt.py -============================================ - -[`source code `_] - -:: - - # For detailed comments on animation and the techniqes used here, see - # the wiki entry http://www.scipy.org/Cookbook/Matplotlib/Animations - - import os, sys - import matplotlib - matplotlib.use('QtAgg') # qt3 example - - from qt import * - # Note: color-intensive applications may require a different color allocation - # strategy. - QApplication.setColorSpec(QApplication.NormalColor) - - TRUE = 1 - FALSE = 0 - ITERS = 1000 - - import pylab as p - import numpy as npy - import time - - class BlitQT(QObject): - def __init__(self): - QObject.__init__(self, None, "app") - - self.ax = p.subplot(111) - self.canvas = self.ax.figure.canvas - self.cnt = 0 - - # create the initial line - self.x = npy.arange(0,2*npy.pi,0.01) - self.line, = p.plot(self.x, npy.sin(self.x), animated=True, lw=2) - - self.background = None - - def timerEvent(self, evt): - if self.background is None: - self.background = self.canvas.copy_from_bbox(self.ax.bbox) - - # restore the clean slate background - self.canvas.restore_region(self.background) - # update the data - self.line.set_ydata(npy.sin(self.x+self.cnt/10.0)) - # just draw the animated artist - self.ax.draw_artist(self.line) - # just redraw the axes rectangle - self.canvas.blit(self.ax.bbox) - - if self.cnt==ITERS: - # print the timing info and quit - print 'FPS:' , ITERS/(time.time()-self.tstart) - sys.exit() - - else: - self.cnt += 1 - - p.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs - p.grid() # to ensure proper background restore - - app = BlitQT() - # for profiling - app.tstart = time.time() - app.startTimer(0) - - p.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/animation_blit_qt4.txt b/_sources/examples/animation/animation_blit_qt4.txt deleted file mode 100644 index bcef10f8b6d..00000000000 --- a/_sources/examples/animation/animation_blit_qt4.txt +++ /dev/null @@ -1,87 +0,0 @@ -.. _animation-animation_blit_qt4: - -animation example code: animation_blit_qt4.py -============================================= - -[`source code `_] - -:: - - # For detailed comments on animation and the techniqes used here, see - # the wiki entry http://www.scipy.org/Cookbook/Matplotlib/Animations - - import os - import sys - - #import matplotlib - #matplotlib.use('Qt4Agg') - from matplotlib.figure import Figure - from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas - - from PyQt4 import QtCore, QtGui - - ITERS = 1000 - - import numpy as np - import time - - class BlitQT(FigureCanvas): - - def __init__(self): - FigureCanvas.__init__(self, Figure()) - - self.ax = self.figure.add_subplot(111) - self.ax.grid() - self.draw() - - self.old_size = self.ax.bbox.width, self.ax.bbox.height - self.ax_background = self.copy_from_bbox(self.ax.bbox) - self.cnt = 0 - - self.x = np.arange(0,2*np.pi,0.01) - self.sin_line, = self.ax.plot(self.x, np.sin(self.x), animated=True) - self.cos_line, = self.ax.plot(self.x, np.cos(self.x), animated=True) - self.draw() - - self.tstart = time.time() - self.startTimer(10) - - def timerEvent(self, evt): - current_size = self.ax.bbox.width, self.ax.bbox.height - if self.old_size != current_size: - self.old_size = current_size - self.ax.clear() - self.ax.grid() - self.draw() - self.ax_background = self.copy_from_bbox(self.ax.bbox) - - self.restore_region(self.ax_background) - - # update the data - self.sin_line.set_ydata(np.sin(self.x+self.cnt/10.0)) - self.cos_line.set_ydata(np.cos(self.x+self.cnt/10.0)) - # just draw the animated artist - self.ax.draw_artist(self.sin_line) - self.ax.draw_artist(self.cos_line) - # just redraw the axes rectangle - self.blit(self.ax.bbox) - - if self.cnt == 0: - # TODO: this shouldn't be necessary, but if it is excluded the - # canvas outside the axes is not initially painted. - self.draw() - if self.cnt==ITERS: - # print the timing info and quit - print 'FPS:' , ITERS/(time.time()-self.tstart) - sys.exit() - else: - self.cnt += 1 - - app = QtGui.QApplication(sys.argv) - widget = BlitQT() - widget.show() - - sys.exit(app.exec_()) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/animation_blit_tk.txt b/_sources/examples/animation/animation_blit_tk.txt deleted file mode 100644 index df320c53348..00000000000 --- a/_sources/examples/animation/animation_blit_tk.txt +++ /dev/null @@ -1,64 +0,0 @@ -.. _animation-animation_blit_tk: - -animation example code: animation_blit_tk.py -============================================ - -[`source code `_] - -:: - - # For detailed comments on animation and the techniqes used here, see - # the wiki entry http://www.scipy.org/Cookbook/Matplotlib/Animations - - import matplotlib - matplotlib.use('TkAgg') - - import sys - import pylab as p - import numpy as npy - import time - - ax = p.subplot(111) - canvas = ax.figure.canvas - - - # create the initial line - x = npy.arange(0,2*npy.pi,0.01) - line, = p.plot(x, npy.sin(x), animated=True, lw=2) - - def run(*args): - background = canvas.copy_from_bbox(ax.bbox) - # for profiling - tstart = time.time() - - while 1: - # restore the clean slate background - canvas.restore_region(background) - # update the data - line.set_ydata(npy.sin(x+run.cnt/10.0)) - # just draw the animated artist - ax.draw_artist(line) - # just redraw the axes rectangle - canvas.blit(ax.bbox) - - if run.cnt==1000: - # print the timing info and quit - print 'FPS:' , 1000/(time.time()-tstart) - sys.exit() - - run.cnt += 1 - run.cnt = 0 - - - p.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs - p.grid() # to ensure proper background restore - manager = p.get_current_fig_manager() - manager.window.after(100, run) - - p.show() - - - - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/animation_blit_wx.txt b/_sources/examples/animation/animation_blit_wx.txt deleted file mode 100644 index 6fab4513d7b..00000000000 --- a/_sources/examples/animation/animation_blit_wx.txt +++ /dev/null @@ -1,88 +0,0 @@ -.. _animation-animation_blit_wx: - -animation example code: animation_blit_wx.py -============================================ - -[`source code `_] - -:: - - # For detailed comments on animation and the techniqes used here, see - # the wiki entry - # http://www.scipy.org/wikis/topical_software/MatplotlibAnimation - - # The number of blits() to make before exiting - NBLITS = 1000 - - import matplotlib - matplotlib.use('WXAgg') - matplotlib.rcParams['toolbar'] = 'None' - - import wx - import sys - import pylab as p - import numpy as npy - import time - - - # allow the user to disable the WXAgg accelerator from the command line - if '--no-accel' in sys.argv: - import matplotlib.backends.backend_wxagg - matplotlib.backends.backend_wxagg._use_accelerator(False) - - - ax = p.subplot(111) - canvas = ax.figure.canvas - - - p.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs - p.grid() # to ensure proper background restore - - # create the initial line - x = npy.arange(0,2*npy.pi,0.01) - line, = p.plot(x, npy.sin(x), animated=True, lw=2) - - # for profiling - tstart = time.time() - blit_time = 0.0 - - def update_line(*args): - global blit_time - - if update_line.background is None: - update_line.background = canvas.copy_from_bbox(ax.bbox) - - # restore the clean slate background - canvas.restore_region(update_line.background) - # update the data - line.set_ydata(npy.sin(x+update_line.cnt/10.0)) - # just draw the animated artist - ax.draw_artist(line) - # just redraw the axes rectangle - - t = time.time() - canvas.blit(ax.bbox) - blit_time += time.time() - t - - if update_line.cnt == NBLITS: - # print the timing info and quit - frame_time = time.time() - tstart - print '%d frames: %.2f seconds' % (NBLITS, frame_time) - print '%d blits: %.2f seconds' % (NBLITS, blit_time) - print - print 'FPS: %.2f' % (NBLITS/frame_time) - print 'BPS: %.2f' % (NBLITS/blit_time) - sys.exit() - - update_line.cnt += 1 - wx.WakeUpIdle() - - - - update_line.cnt = 0 - update_line.background = None - wx.EVT_IDLE(wx.GetApp(), update_line) - p.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/basic_example.rst.txt b/_sources/examples/animation/basic_example.rst.txt deleted file mode 100644 index 515dc2b8a59..00000000000 --- a/_sources/examples/animation/basic_example.rst.txt +++ /dev/null @@ -1,58 +0,0 @@ -.. _animation-basic_example: - -animation example code: basic_example.py -======================================== - -[`source code `_] - -:: - - """ - ========================= - Simple animation examples - ========================= - - This example contains two animations. The first is a random walk plot. The - second is an image animation. - """ - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.animation as animation - - - def update_line(num, data, line): - line.set_data(data[..., :num]) - return line, - - fig1 = plt.figure() - - data = np.random.rand(2, 25) - l, = plt.plot([], [], 'r-') - plt.xlim(0, 1) - plt.ylim(0, 1) - plt.xlabel('x') - plt.title('test') - line_ani = animation.FuncAnimation(fig1, update_line, 25, fargs=(data, l), - interval=50, blit=True) - - # To save the animation, use the command: line_ani.save('lines.mp4') - - fig2 = plt.figure() - - x = np.arange(-9, 10) - y = np.arange(-9, 10).reshape(-1, 1) - base = np.hypot(x, y) - ims = [] - for add in np.arange(15): - ims.append((plt.pcolor(x, y, base + add, norm=plt.Normalize(0, 30)),)) - - im_ani = animation.ArtistAnimation(fig2, ims, interval=50, repeat_delay=3000, - blit=True) - # To save this second animation with some metadata, use the following command: - # im_ani.save('im.mp4', metadata={'artist':'Guido'}) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/basic_example.txt b/_sources/examples/animation/basic_example.txt deleted file mode 100644 index 122080df994..00000000000 --- a/_sources/examples/animation/basic_example.txt +++ /dev/null @@ -1,47 +0,0 @@ -.. _animation-basic_example: - -animation example code: basic_example.py -======================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.animation as animation - - - def update_line(num, data, line): - line.set_data(data[..., :num]) - return line, - - fig1 = plt.figure() - - data = np.random.rand(2, 25) - l, = plt.plot([], [], 'r-') - plt.xlim(0, 1) - plt.ylim(0, 1) - plt.xlabel('x') - plt.title('test') - line_ani = animation.FuncAnimation(fig1, update_line, 25, fargs=(data, l), - interval=50, blit=True) - #line_ani.save('lines.mp4') - - fig2 = plt.figure() - - x = np.arange(-9, 10) - y = np.arange(-9, 10).reshape(-1, 1) - base = np.hypot(x, y) - ims = [] - for add in np.arange(15): - ims.append((plt.pcolor(x, y, base + add, norm=plt.Normalize(0, 30)),)) - - im_ani = animation.ArtistAnimation(fig2, ims, interval=50, repeat_delay=3000, - blit=True) - #im_ani.save('im.mp4', metadata={'artist':'Guido'}) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/basic_example_writer.rst.txt b/_sources/examples/animation/basic_example_writer.rst.txt deleted file mode 100644 index 9ca1864c025..00000000000 --- a/_sources/examples/animation/basic_example_writer.rst.txt +++ /dev/null @@ -1,63 +0,0 @@ -.. _animation-basic_example_writer: - -animation example code: basic_example_writer.py -=============================================== - -[`source code `_] - -:: - - """ - =================== - Saving an animation - =================== - - This example showcases the same animations as `basic_example.py`, but instead - of displaying the animation to the user, it writes to files using a - MovieWriter instance. - """ - - # -*- noplot -*- - import numpy as np - import matplotlib - matplotlib.use("Agg") - import matplotlib.pyplot as plt - import matplotlib.animation as animation - - - def update_line(num, data, line): - line.set_data(data[..., :num]) - return line, - - # Set up formatting for the movie files - Writer = animation.writers['ffmpeg'] - writer = Writer(fps=15, metadata=dict(artist='Me'), bitrate=1800) - - - fig1 = plt.figure() - - data = np.random.rand(2, 25) - l, = plt.plot([], [], 'r-') - plt.xlim(0, 1) - plt.ylim(0, 1) - plt.xlabel('x') - plt.title('test') - line_ani = animation.FuncAnimation(fig1, update_line, 25, fargs=(data, l), - interval=50, blit=True) - line_ani.save('lines.mp4', writer=writer) - - fig2 = plt.figure() - - x = np.arange(-9, 10) - y = np.arange(-9, 10).reshape(-1, 1) - base = np.hypot(x, y) - ims = [] - for add in np.arange(15): - ims.append((plt.pcolor(x, y, base + add, norm=plt.Normalize(0, 30)),)) - - im_ani = animation.ArtistAnimation(fig2, ims, interval=50, repeat_delay=3000, - blit=True) - im_ani.save('im.mp4', writer=writer) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/basic_example_writer.txt b/_sources/examples/animation/basic_example_writer.txt deleted file mode 100644 index 45734942ddb..00000000000 --- a/_sources/examples/animation/basic_example_writer.txt +++ /dev/null @@ -1,55 +0,0 @@ -.. _animation-basic_example_writer: - -animation example code: basic_example_writer.py -=============================================== - -[`source code `_] - -:: - - # Same as basic_example, but writes files using a single MovieWriter instance - # without putting on screen - # -*- noplot -*- - import numpy as np - import matplotlib - matplotlib.use("Agg") - import matplotlib.pyplot as plt - import matplotlib.animation as animation - - - def update_line(num, data, line): - line.set_data(data[..., :num]) - return line, - - # Set up formatting for the movie files - Writer = animation.writers['ffmpeg'] - writer = Writer(fps=15, metadata=dict(artist='Me'), bitrate=1800) - - - fig1 = plt.figure() - - data = np.random.rand(2, 25) - l, = plt.plot([], [], 'r-') - plt.xlim(0, 1) - plt.ylim(0, 1) - plt.xlabel('x') - plt.title('test') - line_ani = animation.FuncAnimation(fig1, update_line, 25, fargs=(data, l), - interval=50, blit=True) - line_ani.save('lines.mp4', writer=writer) - - fig2 = plt.figure() - - x = np.arange(-9, 10) - y = np.arange(-9, 10).reshape(-1, 1) - base = np.hypot(x, y) - ims = [] - for add in np.arange(15): - ims.append((plt.pcolor(x, y, base + add, norm=plt.Normalize(0, 30)),)) - - im_ani = animation.ArtistAnimation(fig2, ims, interval=50, repeat_delay=3000, - blit=True) - im_ani.save('im.mp4', writer=writer) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/bayes_update.rst.txt b/_sources/examples/animation/bayes_update.rst.txt deleted file mode 100644 index 08a0b398e59..00000000000 --- a/_sources/examples/animation/bayes_update.rst.txt +++ /dev/null @@ -1,70 +0,0 @@ -.. _animation-bayes_update: - -animation example code: bayes_update.py -======================================= - -[`source code `_] - -:: - - """ - ================ - The Bayes update - ================ - - This animation displays the posterior estimate updates as it is refitted when - new data arrives. - The vertical line represents the theoretical value to which the plotted - distribution should converge. - """ - - # update a distribution based on new data. - import numpy as np - import matplotlib.pyplot as plt - import scipy.stats as ss - from matplotlib.animation import FuncAnimation - - - class UpdateDist(object): - def __init__(self, ax, prob=0.5): - self.success = 0 - self.prob = prob - self.line, = ax.plot([], [], 'k-') - self.x = np.linspace(0, 1, 200) - self.ax = ax - - # Set up plot parameters - self.ax.set_xlim(0, 1) - self.ax.set_ylim(0, 15) - self.ax.grid(True) - - # This vertical line represents the theoretical value, to - # which the plotted distribution should converge. - self.ax.axvline(prob, linestyle='--', color='black') - - def init(self): - self.success = 0 - self.line.set_data([], []) - return self.line, - - def __call__(self, i): - # This way the plot can continuously run and we just keep - # watching new realizations of the process - if i == 0: - return self.init() - - # Choose success based on exceed a threshold with a uniform pick - if np.random.rand(1,) < self.prob: - self.success += 1 - y = ss.beta.pdf(self.x, self.success + 1, (i - self.success) + 1) - self.line.set_data(self.x, y) - return self.line, - - fig, ax = plt.subplots() - ud = UpdateDist(ax, prob=0.7) - anim = FuncAnimation(fig, ud, frames=np.arange(100), init_func=ud.init, - interval=100, blit=True) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/bayes_update.txt b/_sources/examples/animation/bayes_update.txt deleted file mode 100644 index 00be7c0b7f2..00000000000 --- a/_sources/examples/animation/bayes_update.txt +++ /dev/null @@ -1,59 +0,0 @@ -.. _animation-bayes_update: - -animation example code: bayes_update.py -======================================= - -[`source code `_] - -:: - - # update a distribution based on new data. - import numpy as np - import matplotlib.pyplot as plt - import scipy.stats as ss - from matplotlib.animation import FuncAnimation - - - class UpdateDist(object): - def __init__(self, ax, prob=0.5): - self.success = 0 - self.prob = prob - self.line, = ax.plot([], [], 'k-') - self.x = np.linspace(0, 1, 200) - self.ax = ax - - # Set up plot parameters - self.ax.set_xlim(0, 1) - self.ax.set_ylim(0, 15) - self.ax.grid(True) - - # This vertical line represents the theoretical value, to - # which the plotted distribution should converge. - self.ax.axvline(prob, linestyle='--', color='black') - - def init(self): - self.success = 0 - self.line.set_data([], []) - return self.line, - - def __call__(self, i): - # This way the plot can continuously run and we just keep - # watching new realizations of the process - if i == 0: - return self.init() - - # Choose success based on exceed a threshold with a uniform pick - if np.random.rand(1,) < self.prob: - self.success += 1 - y = ss.beta.pdf(self.x, self.success + 1, (i - self.success) + 1) - self.line.set_data(self.x, y) - return self.line, - - fig, ax = plt.subplots() - ud = UpdateDist(ax, prob=0.7) - anim = FuncAnimation(fig, ud, frames=np.arange(100), init_func=ud.init, - interval=100, blit=True) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/double_pendulum_animated.rst.txt b/_sources/examples/animation/double_pendulum_animated.rst.txt deleted file mode 100644 index 89b88f0ad79..00000000000 --- a/_sources/examples/animation/double_pendulum_animated.rst.txt +++ /dev/null @@ -1,109 +0,0 @@ -.. _animation-double_pendulum_animated: - -animation example code: double_pendulum_animated.py -=================================================== - -[`source code `_] - -:: - - """ - =========================== - The double pendulum problem - =========================== - - This animation illustrates the double pendulum problem. - """ - - # Double pendulum formula translated from the C code at - # http://www.physics.usyd.edu.au/~wheat/dpend_html/solve_dpend.c - - from numpy import sin, cos - import numpy as np - import matplotlib.pyplot as plt - import scipy.integrate as integrate - import matplotlib.animation as animation - - G = 9.8 # acceleration due to gravity, in m/s^2 - L1 = 1.0 # length of pendulum 1 in m - L2 = 1.0 # length of pendulum 2 in m - M1 = 1.0 # mass of pendulum 1 in kg - M2 = 1.0 # mass of pendulum 2 in kg - - - def derivs(state, t): - - dydx = np.zeros_like(state) - dydx[0] = state[1] - - del_ = state[2] - state[0] - den1 = (M1 + M2)*L1 - M2*L1*cos(del_)*cos(del_) - dydx[1] = (M2*L1*state[1]*state[1]*sin(del_)*cos(del_) + - M2*G*sin(state[2])*cos(del_) + - M2*L2*state[3]*state[3]*sin(del_) - - (M1 + M2)*G*sin(state[0]))/den1 - - dydx[2] = state[3] - - den2 = (L2/L1)*den1 - dydx[3] = (-M2*L2*state[3]*state[3]*sin(del_)*cos(del_) + - (M1 + M2)*G*sin(state[0])*cos(del_) - - (M1 + M2)*L1*state[1]*state[1]*sin(del_) - - (M1 + M2)*G*sin(state[2]))/den2 - - return dydx - - # create a time array from 0..100 sampled at 0.05 second steps - dt = 0.05 - t = np.arange(0.0, 20, dt) - - # th1 and th2 are the initial angles (degrees) - # w10 and w20 are the initial angular velocities (degrees per second) - th1 = 120.0 - w1 = 0.0 - th2 = -10.0 - w2 = 0.0 - - # initial state - state = np.radians([th1, w1, th2, w2]) - - # integrate your ODE using scipy.integrate. - y = integrate.odeint(derivs, state, t) - - x1 = L1*sin(y[:, 0]) - y1 = -L1*cos(y[:, 0]) - - x2 = L2*sin(y[:, 2]) + x1 - y2 = -L2*cos(y[:, 2]) + y1 - - fig = plt.figure() - ax = fig.add_subplot(111, autoscale_on=False, xlim=(-2, 2), ylim=(-2, 2)) - ax.grid() - - line, = ax.plot([], [], 'o-', lw=2) - time_template = 'time = %.1fs' - time_text = ax.text(0.05, 0.9, '', transform=ax.transAxes) - - - def init(): - line.set_data([], []) - time_text.set_text('') - return line, time_text - - - def animate(i): - thisx = [0, x1[i], x2[i]] - thisy = [0, y1[i], y2[i]] - - line.set_data(thisx, thisy) - time_text.set_text(time_template % (i*dt)) - return line, time_text - - ani = animation.FuncAnimation(fig, animate, np.arange(1, len(y)), - interval=25, blit=True, init_func=init) - - # ani.save('double_pendulum.mp4', fps=15) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/double_pendulum_animated.txt b/_sources/examples/animation/double_pendulum_animated.txt deleted file mode 100644 index 8fe10c3cff7..00000000000 --- a/_sources/examples/animation/double_pendulum_animated.txt +++ /dev/null @@ -1,101 +0,0 @@ -.. _animation-double_pendulum_animated: - -animation example code: double_pendulum_animated.py -=================================================== - -[`source code `_] - -:: - - # Double pendulum formula translated from the C code at - # http://www.physics.usyd.edu.au/~wheat/dpend_html/solve_dpend.c - - from numpy import sin, cos - import numpy as np - import matplotlib.pyplot as plt - import scipy.integrate as integrate - import matplotlib.animation as animation - - G = 9.8 # acceleration due to gravity, in m/s^2 - L1 = 1.0 # length of pendulum 1 in m - L2 = 1.0 # length of pendulum 2 in m - M1 = 1.0 # mass of pendulum 1 in kg - M2 = 1.0 # mass of pendulum 2 in kg - - - def derivs(state, t): - - dydx = np.zeros_like(state) - dydx[0] = state[1] - - del_ = state[2] - state[0] - den1 = (M1 + M2)*L1 - M2*L1*cos(del_)*cos(del_) - dydx[1] = (M2*L1*state[1]*state[1]*sin(del_)*cos(del_) + - M2*G*sin(state[2])*cos(del_) + - M2*L2*state[3]*state[3]*sin(del_) - - (M1 + M2)*G*sin(state[0]))/den1 - - dydx[2] = state[3] - - den2 = (L2/L1)*den1 - dydx[3] = (-M2*L2*state[3]*state[3]*sin(del_)*cos(del_) + - (M1 + M2)*G*sin(state[0])*cos(del_) - - (M1 + M2)*L1*state[1]*state[1]*sin(del_) - - (M1 + M2)*G*sin(state[2]))/den2 - - return dydx - - # create a time array from 0..100 sampled at 0.05 second steps - dt = 0.05 - t = np.arange(0.0, 20, dt) - - # th1 and th2 are the initial angles (degrees) - # w10 and w20 are the initial angular velocities (degrees per second) - th1 = 120.0 - w1 = 0.0 - th2 = -10.0 - w2 = 0.0 - - # initial state - state = np.radians([th1, w1, th2, w2]) - - # integrate your ODE using scipy.integrate. - y = integrate.odeint(derivs, state, t) - - x1 = L1*sin(y[:, 0]) - y1 = -L1*cos(y[:, 0]) - - x2 = L2*sin(y[:, 2]) + x1 - y2 = -L2*cos(y[:, 2]) + y1 - - fig = plt.figure() - ax = fig.add_subplot(111, autoscale_on=False, xlim=(-2, 2), ylim=(-2, 2)) - ax.grid() - - line, = ax.plot([], [], 'o-', lw=2) - time_template = 'time = %.1fs' - time_text = ax.text(0.05, 0.9, '', transform=ax.transAxes) - - - def init(): - line.set_data([], []) - time_text.set_text('') - return line, time_text - - - def animate(i): - thisx = [0, x1[i], x2[i]] - thisy = [0, y1[i], y2[i]] - - line.set_data(thisx, thisy) - time_text.set_text(time_template % (i*dt)) - return line, time_text - - ani = animation.FuncAnimation(fig, animate, np.arange(1, len(y)), - interval=25, blit=True, init_func=init) - - #ani.save('double_pendulum.mp4', fps=15) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/draggable_legend.txt b/_sources/examples/animation/draggable_legend.txt deleted file mode 100644 index c291c3e2e57..00000000000 --- a/_sources/examples/animation/draggable_legend.txt +++ /dev/null @@ -1,55 +0,0 @@ -.. _animation-draggable_legend: - -animation example code: draggable_legend.py -=========================================== - -[`source code `_] - -:: - - import matplotlib.pyplot as plt - - - ax = plt.subplot(111) - ax.plot([1,2,3], label="test") - - l = ax.legend() - d1 = l.draggable() - - xy = 1, 2 - txt = ax.annotate("Test", xy, xytext=(-30, 30), - textcoords="offset points", - bbox=dict(boxstyle="round",fc=(0.2, 1, 1)), - arrowprops=dict(arrowstyle="->")) - d2 = txt.draggable() - - - from matplotlib._png import read_png - from matplotlib.cbook import get_sample_data - - from matplotlib.offsetbox import OffsetImage, AnnotationBbox - - fn = get_sample_data("lena.png", asfileobj=False) - arr_lena = read_png(fn) - - imagebox = OffsetImage(arr_lena, zoom=0.2) - - ab = AnnotationBbox(imagebox, xy, - xybox=(120., -80.), - xycoords='data', - boxcoords="offset points", - pad=0.5, - arrowprops=dict(arrowstyle="->", - connectionstyle="angle,angleA=0,angleB=90,rad=3") - ) - - - ax.add_artist(ab) - - d3 = ab.draggable(use_blit=True) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/dynamic_collection.txt b/_sources/examples/animation/dynamic_collection.txt deleted file mode 100644 index bb0ec39c99e..00000000000 --- a/_sources/examples/animation/dynamic_collection.txt +++ /dev/null @@ -1,64 +0,0 @@ -.. _animation-dynamic_collection: - -animation example code: dynamic_collection.py -============================================= - -[`source code `_] - -:: - - import random - from matplotlib.collections import RegularPolyCollection - import matplotlib.cm as cm - from matplotlib.pyplot import figure, show - from numpy.random import rand - - fig = figure() - ax = fig.add_subplot(111, xlim=(0,1), ylim=(0,1), autoscale_on=False) - ax.set_title("Press 'a' to add a point, 'd' to delete one") - # a single point - offsets = [(0.5,0.5)] - facecolors = [cm.jet(0.5)] - - collection = RegularPolyCollection( - #fig.dpi, - 5, # a pentagon - rotation=0, - sizes=(50,), - facecolors = facecolors, - edgecolors = 'black', - linewidths = (1,), - offsets = offsets, - transOffset = ax.transData, - ) - - ax.add_collection(collection) - - def onpress(event): - """ - press 'a' to add a random point from the collection, 'd' to delete one - """ - if event.key=='a': - x,y = rand(2) - color = cm.jet(rand()) - offsets.append((x,y)) - facecolors.append(color) - collection.set_offsets(offsets) - collection.set_facecolors(facecolors) - fig.canvas.draw() - elif event.key=='d': - N = len(offsets) - if N>0: - ind = random.randint(0,N-1) - offsets.pop(ind) - facecolors.pop(ind) - collection.set_offsets(offsets) - collection.set_facecolors(facecolors) - fig.canvas.draw() - - fig.canvas.mpl_connect('key_press_event', onpress) - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/dynamic_image.rst.txt b/_sources/examples/animation/dynamic_image.rst.txt deleted file mode 100644 index a636b6656d3..00000000000 --- a/_sources/examples/animation/dynamic_image.rst.txt +++ /dev/null @@ -1,44 +0,0 @@ -.. _animation-dynamic_image: - -animation example code: dynamic_image.py -======================================== - -[`source code `_] - -:: - - """ - ================= - An animated image - ================= - - This example demonstrates how to animate an image. - """ - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.animation as animation - - fig = plt.figure() - - - def f(x, y): - return np.sin(x) + np.cos(y) - - x = np.linspace(0, 2 * np.pi, 120) - y = np.linspace(0, 2 * np.pi, 100).reshape(-1, 1) - - im = plt.imshow(f(x, y), animated=True) - - - def updatefig(*args): - global x, y - x += np.pi / 15. - y += np.pi / 20. - im.set_array(f(x, y)) - return im, - - ani = animation.FuncAnimation(fig, updatefig, interval=50, blit=True) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/dynamic_image.txt b/_sources/examples/animation/dynamic_image.txt deleted file mode 100644 index 50de7938416..00000000000 --- a/_sources/examples/animation/dynamic_image.txt +++ /dev/null @@ -1,41 +0,0 @@ -.. _animation-dynamic_image: - -animation example code: dynamic_image.py -======================================== - -[`source code `_] - -:: - - #!/usr/bin/env python - """ - An animated image - """ - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.animation as animation - - fig = plt.figure() - - - def f(x, y): - return np.sin(x) + np.cos(y) - - x = np.linspace(0, 2 * np.pi, 120) - y = np.linspace(0, 2 * np.pi, 100).reshape(-1, 1) - - im = plt.imshow(f(x, y), cmap=plt.get_cmap('viridis'), animated=True) - - - def updatefig(*args): - global x, y - x += np.pi / 15. - y += np.pi / 20. - im.set_array(f(x, y)) - return im, - - ani = animation.FuncAnimation(fig, updatefig, interval=50, blit=True) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/dynamic_image2.rst.txt b/_sources/examples/animation/dynamic_image2.rst.txt deleted file mode 100644 index 48a4a055535..00000000000 --- a/_sources/examples/animation/dynamic_image2.rst.txt +++ /dev/null @@ -1,48 +0,0 @@ -.. _animation-dynamic_image2: - -animation example code: dynamic_image2.py -========================================= - -[`source code `_] - -:: - - """ - ======================================== - An animated image using a list of images - ======================================== - - This examples demonstrates how to animate an image from a list of images (or - Artists). - """ - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.animation as animation - - fig = plt.figure() - - - def f(x, y): - return np.sin(x) + np.cos(y) - - x = np.linspace(0, 2 * np.pi, 120) - y = np.linspace(0, 2 * np.pi, 100).reshape(-1, 1) - # ims is a list of lists, each row is a list of artists to draw in the - # current frame; here we are just animating one artist, the image, in - # each frame - ims = [] - for i in range(60): - x += np.pi / 15. - y += np.pi / 20. - im = plt.imshow(f(x, y), animated=True) - ims.append([im]) - - ani = animation.ArtistAnimation(fig, ims, interval=50, blit=True, - repeat_delay=1000) - - # ani.save('dynamic_images.mp4') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/dynamic_image2.txt b/_sources/examples/animation/dynamic_image2.txt deleted file mode 100644 index b424c428aa1..00000000000 --- a/_sources/examples/animation/dynamic_image2.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _animation-dynamic_image2: - -animation example code: dynamic_image2.py -========================================= - -[`source code `_] - -:: - - #!/usr/bin/env python - """ - An animated image - """ - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.animation as animation - - fig = plt.figure() - - - def f(x, y): - return np.sin(x) + np.cos(y) - - x = np.linspace(0, 2 * np.pi, 120) - y = np.linspace(0, 2 * np.pi, 100).reshape(-1, 1) - # ims is a list of lists, each row is a list of artists to draw in the - # current frame; here we are just animating one artist, the image, in - # each frame - ims = [] - for i in range(60): - x += np.pi / 15. - y += np.pi / 20. - im = plt.imshow(f(x, y), cmap='viridis', animated=True) - ims.append([im]) - - ani = animation.ArtistAnimation(fig, ims, interval=50, blit=True, - repeat_delay=1000) - - #ani.save('dynamic_images.mp4') - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/dynamic_image_gtkagg.txt b/_sources/examples/animation/dynamic_image_gtkagg.txt deleted file mode 100644 index 99346f65037..00000000000 --- a/_sources/examples/animation/dynamic_image_gtkagg.txt +++ /dev/null @@ -1,56 +0,0 @@ -.. _animation-dynamic_image_gtkagg: - -animation example code: dynamic_image_gtkagg.py -=============================================== - -[`source code `_] - -:: - - #!/usr/bin/env python - """ - An animated image - """ - import time - - import gobject - import gtk - - import matplotlib - matplotlib.use('GTKAgg') - - from pylab import * - - fig = figure(1) - a = subplot(111) - x = arange(120.0)*2*pi/120.0 - x = resize(x, (100,120)) - y = arange(100.0)*2*pi/100.0 - y = resize(y, (120,100)) - y = transpose(y) - z = sin(x) + cos(y) - im = a.imshow( z, cmap=cm.jet)#, interpolation='nearest') - - manager = get_current_fig_manager() - cnt = 0 - tstart = time.time() - def updatefig(*args): - global x, y, cnt, start - x += pi/15 - y += pi/20 - z = sin(x) + cos(y) - im.set_array(z) - manager.canvas.draw() - cnt += 1 - if cnt==50: - print 'FPS', cnt/(time.time() - tstart) - return False - return True - - cnt = 0 - - gobject.idle_add(updatefig) - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/dynamic_image_wxagg2.txt b/_sources/examples/animation/dynamic_image_wxagg2.txt deleted file mode 100644 index 60f33a265c7..00000000000 --- a/_sources/examples/animation/dynamic_image_wxagg2.txt +++ /dev/null @@ -1,112 +0,0 @@ -.. _animation-dynamic_image_wxagg2: - -animation example code: dynamic_image_wxagg2.py -=============================================== - -[`source code `_] - -:: - - #!/usr/bin/env python - """ - Copyright (C) 2003-2005 Jeremy O'Donoghue and others - - License: This work is licensed under the PSF. A copy should be included - with this source code, and is also available at - http://www.python.org/psf/license.html - - """ - import sys, time, os, gc - - import matplotlib - matplotlib.use('WXAgg') - - from matplotlib import rcParams - import numpy as npy - - import matplotlib.cm as cm - - from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg - from matplotlib.backends.backend_wx import NavigationToolbar2Wx - - from matplotlib.figure import Figure - from wx import * - - - TIMER_ID = NewId() - - class PlotFigure(Frame): - - def __init__(self): - Frame.__init__(self, None, -1, "Test embedded wxFigure") - - self.fig = Figure((5,4), 75) - self.canvas = FigureCanvasWxAgg(self, -1, self.fig) - self.toolbar = NavigationToolbar2Wx(self.canvas) - self.toolbar.Realize() - - # On Windows, default frame size behaviour is incorrect - # you don't need this under Linux - tw, th = self.toolbar.GetSizeTuple() - fw, fh = self.canvas.GetSizeTuple() - self.toolbar.SetSize(Size(fw, th)) - - # Create a figure manager to manage things - - # Now put all into a sizer - sizer = BoxSizer(VERTICAL) - # This way of adding to sizer allows resizing - sizer.Add(self.canvas, 1, LEFT|TOP|GROW) - # Best to allow the toolbar to resize! - sizer.Add(self.toolbar, 0, GROW) - self.SetSizer(sizer) - self.Fit() - EVT_TIMER(self, TIMER_ID, self.onTimer) - - def init_plot_data(self): - # jdh you can add a subplot directly from the fig rather than - # the fig manager - a = self.fig.add_axes([0.075,0.1,0.75,0.85]) - cax = self.fig.add_axes([0.85,0.1,0.075,0.85]) - self.x = npy.empty((120,120)) - self.x.flat = npy.arange(120.0)*2*npy.pi/120.0 - self.y = npy.empty((120,120)) - self.y.flat = npy.arange(120.0)*2*npy.pi/100.0 - self.y = npy.transpose(self.y) - z = npy.sin(self.x) + npy.cos(self.y) - self.im = a.imshow( z, cmap=cm.jet)#, interpolation='nearest') - self.fig.colorbar(self.im,cax=cax,orientation='vertical') - - def GetToolBar(self): - # You will need to override GetToolBar if you are using an - # unmanaged toolbar in your frame - return self.toolbar - - def onTimer(self, evt): - self.x += npy.pi/15 - self.y += npy.pi/20 - z = npy.sin(self.x) + npy.cos(self.y) - self.im.set_array(z) - self.canvas.draw() - #self.canvas.gui_repaint() # jdh wxagg_draw calls this already - - def onEraseBackground(self, evt): - # this is supposed to prevent redraw flicker on some X servers... - pass - - if __name__ == '__main__': - app = PySimpleApp() - frame = PlotFigure() - frame.init_plot_data() - - # Initialise the timer - wxPython requires this to be connected to - # the receiving event handler - t = Timer(frame, TIMER_ID) - t.Start(200) - - frame.Show() - app.MainLoop() - - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/gtk_timeout.txt b/_sources/examples/animation/gtk_timeout.txt deleted file mode 100644 index 5cbc875fe08..00000000000 --- a/_sources/examples/animation/gtk_timeout.txt +++ /dev/null @@ -1,31 +0,0 @@ -.. _animation-gtk_timeout: - -animation example code: gtk_timeout.py -====================================== - -[`source code `_] - -:: - - import gobject - import numpy as np - import matplotlib - matplotlib.use('GTKAgg') - - import matplotlib.pyplot as plt - - fig = plt.figure() - ax = fig.add_subplot(111) - line, = ax.plot(np.random.rand(10)) - ax.set_ylim(0, 1) - - def update(): - line.set_ydata(np.random.rand(10)) - fig.canvas.draw_idle() - return True # return False to terminate the updates - - gobject.timeout_add(100, update) # you can also use idle_add to update when gtk is idle - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/histogram.rst.txt b/_sources/examples/animation/histogram.rst.txt deleted file mode 100644 index d68e24591b0..00000000000 --- a/_sources/examples/animation/histogram.rst.txt +++ /dev/null @@ -1,81 +0,0 @@ -.. _animation-histogram: - -animation example code: histogram.py -==================================== - -[`source code `_] - -:: - - """ - ================== - Animated histogram - ================== - - This example shows how to use a path patch to draw a bunch of - rectangles for an animated histogram. - - """ - import numpy as np - - import matplotlib.pyplot as plt - import matplotlib.patches as patches - import matplotlib.path as path - import matplotlib.animation as animation - - fig, ax = plt.subplots() - - # histogram our data with numpy - data = np.random.randn(1000) - n, bins = np.histogram(data, 100) - - # get the corners of the rectangles for the histogram - left = np.array(bins[:-1]) - right = np.array(bins[1:]) - bottom = np.zeros(len(left)) - top = bottom + n - nrects = len(left) - - # here comes the tricky part -- we have to set up the vertex and path - # codes arrays using moveto, lineto and closepoly - - # for each rect: 1 for the MOVETO, 3 for the LINETO, 1 for the - # CLOSEPOLY; the vert for the closepoly is ignored but we still need - # it to keep the codes aligned with the vertices - nverts = nrects*(1 + 3 + 1) - verts = np.zeros((nverts, 2)) - codes = np.ones(nverts, int) * path.Path.LINETO - codes[0::5] = path.Path.MOVETO - codes[4::5] = path.Path.CLOSEPOLY - verts[0::5, 0] = left - verts[0::5, 1] = bottom - verts[1::5, 0] = left - verts[1::5, 1] = top - verts[2::5, 0] = right - verts[2::5, 1] = top - verts[3::5, 0] = right - verts[3::5, 1] = bottom - - barpath = path.Path(verts, codes) - patch = patches.PathPatch( - barpath, facecolor='green', edgecolor='yellow', alpha=0.5) - ax.add_patch(patch) - - ax.set_xlim(left[0], right[-1]) - ax.set_ylim(bottom.min(), top.max()) - - - def animate(i): - # simulate new data coming in - data = np.random.randn(1000) - n, bins = np.histogram(data, 100) - top = bottom + n - verts[1::5, 1] = top - verts[2::5, 1] = top - return [patch, ] - - ani = animation.FuncAnimation(fig, animate, 100, repeat=False, blit=True) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/histogram.txt b/_sources/examples/animation/histogram.txt deleted file mode 100644 index eca00dbb10f..00000000000 --- a/_sources/examples/animation/histogram.txt +++ /dev/null @@ -1,76 +0,0 @@ -.. _animation-histogram: - -animation example code: histogram.py -==================================== - -[`source code `_] - -:: - - """ - This example shows how to use a path patch to draw a bunch of - rectangles for an animated histogram - """ - import numpy as np - - import matplotlib.pyplot as plt - import matplotlib.patches as patches - import matplotlib.path as path - import matplotlib.animation as animation - - fig, ax = plt.subplots() - - # histogram our data with numpy - data = np.random.randn(1000) - n, bins = np.histogram(data, 100) - - # get the corners of the rectangles for the histogram - left = np.array(bins[:-1]) - right = np.array(bins[1:]) - bottom = np.zeros(len(left)) - top = bottom + n - nrects = len(left) - - # here comes the tricky part -- we have to set up the vertex and path - # codes arrays using moveto, lineto and closepoly - - # for each rect: 1 for the MOVETO, 3 for the LINETO, 1 for the - # CLOSEPOLY; the vert for the closepoly is ignored but we still need - # it to keep the codes aligned with the vertices - nverts = nrects*(1 + 3 + 1) - verts = np.zeros((nverts, 2)) - codes = np.ones(nverts, int) * path.Path.LINETO - codes[0::5] = path.Path.MOVETO - codes[4::5] = path.Path.CLOSEPOLY - verts[0::5, 0] = left - verts[0::5, 1] = bottom - verts[1::5, 0] = left - verts[1::5, 1] = top - verts[2::5, 0] = right - verts[2::5, 1] = top - verts[3::5, 0] = right - verts[3::5, 1] = bottom - - barpath = path.Path(verts, codes) - patch = patches.PathPatch( - barpath, facecolor='green', edgecolor='yellow', alpha=0.5) - ax.add_patch(patch) - - ax.set_xlim(left[0], right[-1]) - ax.set_ylim(bottom.min(), top.max()) - - - def animate(i): - # simulate new data coming in - data = np.random.randn(1000) - n, bins = np.histogram(data, 100) - top = bottom + n - verts[1::5, 1] = top - verts[2::5, 1] = top - return [patch, ] - - ani = animation.FuncAnimation(fig, animate, 100, repeat=False, blit=True) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/histogram_tkagg.txt b/_sources/examples/animation/histogram_tkagg.txt deleted file mode 100644 index c1a740f5da9..00000000000 --- a/_sources/examples/animation/histogram_tkagg.txt +++ /dev/null @@ -1,82 +0,0 @@ -.. _animation-histogram_tkagg: - -animation example code: histogram_tkagg.py -========================================== - -[`source code `_] - -:: - - """ - This example shows how to use a path patch to draw a bunch of - rectangles for an animated histogram - """ - import time - import numpy as np - import matplotlib - matplotlib.use('TkAgg') # do this before importing pylab - - import matplotlib.pyplot as plt - import matplotlib.patches as patches - import matplotlib.path as path - - fig = plt.figure() - ax = fig.add_subplot(111) - - # histogram our data with numpy - data = np.random.randn(1000) - n, bins = np.histogram(data, 100) - - # get the corners of the rectangles for the histogram - left = np.array(bins[:-1]) - right = np.array(bins[1:]) - bottom = np.zeros(len(left)) - top = bottom + n - nrects = len(left) - - # here comes the tricky part -- we have to set up the vertex and path - # codes arrays using moveto, lineto and closepoly - - # for each rect: 1 for the MOVETO, 3 for the LINETO, 1 for the - # CLOSEPOLY; the vert for the closepoly is ignored but we still need - # it to keep the codes aligned with the vertices - nverts = nrects*(1+3+1) - verts = np.zeros((nverts, 2)) - codes = np.ones(nverts, int) * path.Path.LINETO - codes[0::5] = path.Path.MOVETO - codes[4::5] = path.Path.CLOSEPOLY - verts[0::5,0] = left - verts[0::5,1] = bottom - verts[1::5,0] = left - verts[1::5,1] = top - verts[2::5,0] = right - verts[2::5,1] = top - verts[3::5,0] = right - verts[3::5,1] = bottom - - barpath = path.Path(verts, codes) - patch = patches.PathPatch(barpath, facecolor='green', edgecolor='yellow', alpha=0.5) - ax.add_patch(patch) - - ax.set_xlim(left[0], right[-1]) - ax.set_ylim(bottom.min(), top.max()) - - def animate(): - if animate.cnt>=100: - return - - animate.cnt += 1 - # simulate new data coming in - data = np.random.randn(1000) - n, bins = np.histogram(data, 100) - top = bottom + n - verts[1::5,1] = top - verts[2::5,1] = top - fig.canvas.draw() - fig.canvas.manager.window.after(100, animate) - animate.cnt = 0 - fig.canvas.manager.window.after(100, animate) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/index.rst.txt b/_sources/examples/animation/index.rst.txt deleted file mode 100644 index 04d73493aa3..00000000000 --- a/_sources/examples/animation/index.rst.txt +++ /dev/null @@ -1,30 +0,0 @@ -.. _animation-examples-index: - -############################################## -animation Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - animate_decay - basic_example - basic_example_writer - bayes_update - double_pendulum_animated - dynamic_image - dynamic_image2 - histogram - moviewriter - rain - random_data - simple_3danim - simple_anim - strip_chart_demo - subplots - unchained diff --git a/_sources/examples/animation/index.txt b/_sources/examples/animation/index.txt deleted file mode 100644 index 04d73493aa3..00000000000 --- a/_sources/examples/animation/index.txt +++ /dev/null @@ -1,30 +0,0 @@ -.. _animation-examples-index: - -############################################## -animation Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - animate_decay - basic_example - basic_example_writer - bayes_update - double_pendulum_animated - dynamic_image - dynamic_image2 - histogram - moviewriter - rain - random_data - simple_3danim - simple_anim - strip_chart_demo - subplots - unchained diff --git a/_sources/examples/animation/movie_demo.txt b/_sources/examples/animation/movie_demo.txt deleted file mode 100644 index 93aa87e2a15..00000000000 --- a/_sources/examples/animation/movie_demo.txt +++ /dev/null @@ -1,168 +0,0 @@ -.. _animation-movie_demo: - -animation example code: movie_demo.py -===================================== - -[`source code `_] - -:: - - #!/usr/bin/python - # - # Josh Lifton 2004 - # - # Permission is hereby granted to use and abuse this document - # so long as proper attribution is given. - # - # This Python script demonstrates how to use the numarray package - # to generate and handle large arrays of data and how to use the - # matplotlib package to generate plots from the data and then save - # those plots as images. These images are then stitched together - # by Mencoder to create a movie of the plotted data. This script - # is for demonstration purposes only and is not intended to be - # for general use. In particular, you will likely need to modify - # the script to suit your own needs. - # - - import matplotlib - matplotlib.use('Agg') - import matplotlib.pyplot as plt # For plotting graphs. - import numpy as np - import subprocess # For issuing commands to the OS. - import os - import sys # For determining the Python version. - - # - # Print the version information for the machine, OS, - # Python interpreter, and matplotlib. The version of - # Mencoder is printed when it is called. - # - print 'Executing on', os.uname() - print 'Python version', sys.version - print 'matplotlib version', matplotlib.__version__ - - not_found_msg = """ - The mencoder command was not found; - mencoder is used by this script to make an avi file from a set of pngs. - It is typically not installed by default on linux distros because of - legal restrictions, but it is widely available. - """ - - try: - subprocess.check_call(['mencoder']) - except subprocess.CalledProcessError: - print "mencoder command was found" - pass # mencoder is found, but returns non-zero exit as expected - # This is a quick and dirty check; it leaves some spurious output - # for the user to puzzle over. - except OSError: - print not_found_msg - sys.exit("quitting\n") - - - # - # First, let's create some data to work with. In this example - # we'll use a normalized Gaussian waveform whose mean and - # standard deviation both increase linearly with time. Such a - # waveform can be thought of as a propagating system that loses - # coherence over time, as might happen to the probability - # distribution of a clock subjected to independent, identically - # distributed Gaussian noise at each time step. - # - - print 'Initializing data set...' # Let the user know what's happening. - - # Initialize variables needed to create and store the example data set. - numberOfTimeSteps = 100 # Number of frames we want in the movie. - x = np.arange(-10,10,0.01) # Values to be plotted on the x-axis. - mean = -6 # Initial mean of the Gaussian. - stddev = 0.2 # Initial standard deviation. - meaninc = 0.1 # Mean increment. - stddevinc = 0.1 # Standard deviation increment. - - # Create an array of zeros and fill it with the example data. - y = np.zeros((numberOfTimeSteps,len(x)), float) - for i in range(numberOfTimeSteps) : - y[i] = (1/np.sqrt(2*np.pi*stddev))*np.exp(-((x-mean)**2)/(2*stddev)) - mean = mean + meaninc - stddev = stddev + stddevinc - - print 'Done.' # Let the user know what's happening. - - # - # Now that we have an example data set (x,y) to work with, we can - # start graphing it and saving the images. - # - - for i in range(len(y)) : - # - # The next four lines are just like MATLAB. - # - plt.plot(x,y[i],'b.') - plt.axis((x[0],x[-1],-0.25,1)) - plt.xlabel('time (ms)') - plt.ylabel('probability density function') - - # - # Notice the use of LaTeX-like markup. - # - plt.title(r'$\cal{N}(\mu, \sigma^2)$', fontsize=20) - - # - # The file name indicates how the image will be saved and the - # order it will appear in the movie. If you actually wanted each - # graph to be displayed on the screen, you would include commands - # such as show() and draw() here. See the matplotlib - # documentation for details. In this case, we are saving the - # images directly to a file without displaying them. - # - filename = str('%03d' % i) + '.png' - plt.savefig(filename, dpi=100) - - # - # Let the user know what's happening. - # - print 'Wrote file', filename - - # - # Clear the figure to make way for the next image. - # - plt.clf() - - # - # Now that we have graphed images of the dataset, we will stitch them - # together using Mencoder to create a movie. Each image will become - # a single frame in the movie. - # - # We want to use Python to make what would normally be a command line - # call to Mencoder. Specifically, the command line call we want to - # emulate is (without the initial '#'): - # mencoder mf://*.png -mf type=png:w=800:h=600:fps=25 -ovc lavc -lavcopts vcodec=mpeg4 -oac copy -o output.avi - # See the MPlayer and Mencoder documentation for details. - # - - command = ('mencoder', - 'mf://*.png', - '-mf', - 'type=png:w=800:h=600:fps=25', - '-ovc', - 'lavc', - '-lavcopts', - 'vcodec=mpeg4', - '-oac', - 'copy', - '-o', - 'output.avi') - - #os.spawnvp(os.P_WAIT, 'mencoder', command) - - print "\n\nabout to execute:\n%s\n\n" % ' '.join(command) - subprocess.check_call(command) - - print "\n\n The movie was written to 'output.avi'" - - print "\n\n You may want to delete *.png now.\n\n" - - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/moviewriter.rst.txt b/_sources/examples/animation/moviewriter.rst.txt deleted file mode 100644 index 52b0e44257f..00000000000 --- a/_sources/examples/animation/moviewriter.rst.txt +++ /dev/null @@ -1,50 +0,0 @@ -.. _animation-moviewriter: - -animation example code: moviewriter.py -====================================== - -[`source code `_] - -:: - - """ - =========== - MovieWriter - =========== - - This example uses a MovieWriter directly to grab individual frames and write - them to a file. This avoids any event loop integration, but has the advantage - of working with even the Agg backend. This is not recommended for use in an - interactive setting. - - """ - # -*- noplot -*- - - import numpy as np - import matplotlib - matplotlib.use("Agg") - import matplotlib.pyplot as plt - import matplotlib.animation as manimation - - FFMpegWriter = manimation.writers['ffmpeg'] - metadata = dict(title='Movie Test', artist='Matplotlib', - comment='Movie support!') - writer = FFMpegWriter(fps=15, metadata=metadata) - - fig = plt.figure() - l, = plt.plot([], [], 'k-o') - - plt.xlim(-5, 5) - plt.ylim(-5, 5) - - x0, y0 = 0, 0 - - with writer.saving(fig, "writer_test.mp4", 100): - for i in range(100): - x0 += 0.1 * np.random.randn() - y0 += 0.1 * np.random.randn() - l.set_data(x0, y0) - writer.grab_frame() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/moviewriter.txt b/_sources/examples/animation/moviewriter.txt deleted file mode 100644 index 0a03fece516..00000000000 --- a/_sources/examples/animation/moviewriter.txt +++ /dev/null @@ -1,43 +0,0 @@ -.. _animation-moviewriter: - -animation example code: moviewriter.py -====================================== - -[`source code `_] - -:: - - # This example uses a MovieWriter directly to grab individual frames and - # write them to a file. This avoids any event loop integration, but has - # the advantage of working with even the Agg backend. This is not recommended - # for use in an interactive setting. - # -*- noplot -*- - - import numpy as np - import matplotlib - matplotlib.use("Agg") - import matplotlib.pyplot as plt - import matplotlib.animation as manimation - - FFMpegWriter = manimation.writers['ffmpeg'] - metadata = dict(title='Movie Test', artist='Matplotlib', - comment='Movie support!') - writer = FFMpegWriter(fps=15, metadata=metadata) - - fig = plt.figure() - l, = plt.plot([], [], 'k-o') - - plt.xlim(-5, 5) - plt.ylim(-5, 5) - - x0, y0 = 0, 0 - - with writer.saving(fig, "writer_test.mp4", 100): - for i in range(100): - x0 += 0.1 * np.random.randn() - y0 += 0.1 * np.random.randn() - l.set_data(x0, y0) - writer.grab_frame() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/rain.rst.txt b/_sources/examples/animation/rain.rst.txt deleted file mode 100644 index 0315c02c0a6..00000000000 --- a/_sources/examples/animation/rain.rst.txt +++ /dev/null @@ -1,80 +0,0 @@ -.. _animation-rain: - -animation example code: rain.py -=============================== - -[`source code `_] - -:: - - """ - =============== - Rain simulation - =============== - - Simulates rain drops on a surface by animating the scale and opacity - of 50 scatter points. - - Author: Nicolas P. Rougier - """ - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.animation import FuncAnimation - - - # Create new Figure and an Axes which fills it. - fig = plt.figure(figsize=(7, 7)) - ax = fig.add_axes([0, 0, 1, 1], frameon=False) - ax.set_xlim(0, 1), ax.set_xticks([]) - ax.set_ylim(0, 1), ax.set_yticks([]) - - # Create rain data - n_drops = 50 - rain_drops = np.zeros(n_drops, dtype=[('position', float, 2), - ('size', float, 1), - ('growth', float, 1), - ('color', float, 4)]) - - # Initialize the raindrops in random positions and with - # random growth rates. - rain_drops['position'] = np.random.uniform(0, 1, (n_drops, 2)) - rain_drops['growth'] = np.random.uniform(50, 200, n_drops) - - # Construct the scatter which we will update during animation - # as the raindrops develop. - scat = ax.scatter(rain_drops['position'][:, 0], rain_drops['position'][:, 1], - s=rain_drops['size'], lw=0.5, edgecolors=rain_drops['color'], - facecolors='none') - - - def update(frame_number): - # Get an index which we can use to re-spawn the oldest raindrop. - current_index = frame_number % n_drops - - # Make all colors more transparent as time progresses. - rain_drops['color'][:, 3] -= 1.0/len(rain_drops) - rain_drops['color'][:, 3] = np.clip(rain_drops['color'][:, 3], 0, 1) - - # Make all circles bigger. - rain_drops['size'] += rain_drops['growth'] - - # Pick a new position for oldest rain drop, resetting its size, - # color and growth factor. - rain_drops['position'][current_index] = np.random.uniform(0, 1, 2) - rain_drops['size'][current_index] = 5 - rain_drops['color'][current_index] = (0, 0, 0, 1) - rain_drops['growth'][current_index] = np.random.uniform(50, 200) - - # Update the scatter collection, with the new colors, sizes and positions. - scat.set_edgecolors(rain_drops['color']) - scat.set_sizes(rain_drops['size']) - scat.set_offsets(rain_drops['position']) - - - # Construct the animation, using the update function as the animation - # director. - animation = FuncAnimation(fig, update, interval=10) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/rain.txt b/_sources/examples/animation/rain.txt deleted file mode 100644 index 69e08b3cd79..00000000000 --- a/_sources/examples/animation/rain.txt +++ /dev/null @@ -1,78 +0,0 @@ -.. _animation-rain: - -animation example code: rain.py -=============================== - -[`source code `_] - -:: - - """ - Rain simulation - - Simulates rain drops on a surface by animating the scale and opacity - of 50 scatter points. - - Author: Nicolas P. Rougier - """ - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.animation import FuncAnimation - - - # Create new Figure and an Axes which fills it. - fig = plt.figure(figsize=(7, 7)) - ax = fig.add_axes([0, 0, 1, 1], frameon=False) - ax.set_xlim(0, 1), ax.set_xticks([]) - ax.set_ylim(0, 1), ax.set_yticks([]) - - # Create rain data - n_drops = 50 - rain_drops = np.zeros(n_drops, dtype=[('position', float, 2), - ('size', float, 1), - ('growth', float, 1), - ('color', float, 4)]) - - # Initialize the raindrops in random positions and with - # random growth rates. - rain_drops['position'] = np.random.uniform(0, 1, (n_drops, 2)) - rain_drops['growth'] = np.random.uniform(50, 200, n_drops) - - # Construct the scatter which we will update during animation - # as the raindrops develop. - scat = ax.scatter(rain_drops['position'][:, 0], rain_drops['position'][:, 1], - s=rain_drops['size'], lw=0.5, edgecolors=rain_drops['color'], - facecolors='none') - - - def update(frame_number): - # Get an index which we can use to re-spawn the oldest raindrop. - current_index = frame_number % n_drops - - # Make all colors more transparent as time progresses. - rain_drops['color'][:, 3] -= 1.0/len(rain_drops) - rain_drops['color'][:, 3] = np.clip(rain_drops['color'][:, 3], 0, 1) - - # Make all circles bigger. - rain_drops['size'] += rain_drops['growth'] - - # Pick a new position for oldest rain drop, resetting its size, - # color and growth factor. - rain_drops['position'][current_index] = np.random.uniform(0, 1, 2) - rain_drops['size'][current_index] = 5 - rain_drops['color'][current_index] = (0, 0, 0, 1) - rain_drops['growth'][current_index] = np.random.uniform(50, 200) - - # Update the scatter collection, with the new colors, sizes and positions. - scat.set_edgecolors(rain_drops['color']) - scat.set_sizes(rain_drops['size']) - scat.set_offsets(rain_drops['position']) - - - # Construct the animation, using the update function as the animation - # director. - animation = FuncAnimation(fig, update, interval=10) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/random_data.rst.txt b/_sources/examples/animation/random_data.rst.txt deleted file mode 100644 index a61fab6b65d..00000000000 --- a/_sources/examples/animation/random_data.rst.txt +++ /dev/null @@ -1,41 +0,0 @@ -.. _animation-random_data: - -animation example code: random_data.py -====================================== - -[`source code `_] - -:: - - """ - =========== - Random data - =========== - - An animation of random data. - - """ - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.animation as animation - - fig, ax = plt.subplots() - line, = ax.plot(np.random.rand(10)) - ax.set_ylim(0, 1) - - - def update(data): - line.set_ydata(data) - return line, - - - def data_gen(): - while True: - yield np.random.rand(10) - - ani = animation.FuncAnimation(fig, update, data_gen, interval=100) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/random_data.txt b/_sources/examples/animation/random_data.txt deleted file mode 100644 index a76fccc8b79..00000000000 --- a/_sources/examples/animation/random_data.txt +++ /dev/null @@ -1,32 +0,0 @@ -.. _animation-random_data: - -animation example code: random_data.py -====================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.animation as animation - - fig, ax = plt.subplots() - line, = ax.plot(np.random.rand(10)) - ax.set_ylim(0, 1) - - - def update(data): - line.set_ydata(data) - return line, - - - def data_gen(): - while True: - yield np.random.rand(10) - - ani = animation.FuncAnimation(fig, update, data_gen, interval=100) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/simple_3danim.rst.txt b/_sources/examples/animation/simple_3danim.rst.txt deleted file mode 100644 index 3ce754f58d6..00000000000 --- a/_sources/examples/animation/simple_3danim.rst.txt +++ /dev/null @@ -1,80 +0,0 @@ -.. _animation-simple_3danim: - -animation example code: simple_3danim.py -======================================== - -[`source code `_] - -:: - - """ - ============ - 3D animation - ============ - - A simple example of an animated plot... In 3D! - """ - import numpy as np - import matplotlib.pyplot as plt - import mpl_toolkits.mplot3d.axes3d as p3 - import matplotlib.animation as animation - - - def Gen_RandLine(length, dims=2): - """ - Create a line using a random walk algorithm - - length is the number of points for the line. - dims is the number of dimensions the line has. - """ - lineData = np.empty((dims, length)) - lineData[:, 0] = np.random.rand(dims) - for index in range(1, length): - # scaling the random numbers by 0.1 so - # movement is small compared to position. - # subtraction by 0.5 is to change the range to [-0.5, 0.5] - # to allow a line to move backwards. - step = ((np.random.rand(dims) - 0.5) * 0.1) - lineData[:, index] = lineData[:, index - 1] + step - - return lineData - - - def update_lines(num, dataLines, lines): - for line, data in zip(lines, dataLines): - # NOTE: there is no .set_data() for 3 dim data... - line.set_data(data[0:2, :num]) - line.set_3d_properties(data[2, :num]) - return lines - - # Attaching 3D axis to the figure - fig = plt.figure() - ax = p3.Axes3D(fig) - - # Fifty lines of random 3-D lines - data = [Gen_RandLine(25, 3) for index in range(50)] - - # Creating fifty line objects. - # NOTE: Can't pass empty arrays into 3d version of plot() - lines = [ax.plot(dat[0, 0:1], dat[1, 0:1], dat[2, 0:1])[0] for dat in data] - - # Setting the axes properties - ax.set_xlim3d([0.0, 1.0]) - ax.set_xlabel('X') - - ax.set_ylim3d([0.0, 1.0]) - ax.set_ylabel('Y') - - ax.set_zlim3d([0.0, 1.0]) - ax.set_zlabel('Z') - - ax.set_title('3D Test') - - # Creating the Animation object - line_ani = animation.FuncAnimation(fig, update_lines, 25, fargs=(data, lines), - interval=50, blit=False) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/simple_3danim.txt b/_sources/examples/animation/simple_3danim.txt deleted file mode 100644 index 77b6d462592..00000000000 --- a/_sources/examples/animation/simple_3danim.txt +++ /dev/null @@ -1,76 +0,0 @@ -.. _animation-simple_3danim: - -animation example code: simple_3danim.py -======================================== - -[`source code `_] - -:: - - """ - A simple example of an animated plot... In 3D! - """ - import numpy as np - import matplotlib.pyplot as plt - import mpl_toolkits.mplot3d.axes3d as p3 - import matplotlib.animation as animation - - - def Gen_RandLine(length, dims=2): - """ - Create a line using a random walk algorithm - - length is the number of points for the line. - dims is the number of dimensions the line has. - """ - lineData = np.empty((dims, length)) - lineData[:, 0] = np.random.rand(dims) - for index in range(1, length): - # scaling the random numbers by 0.1 so - # movement is small compared to position. - # subtraction by 0.5 is to change the range to [-0.5, 0.5] - # to allow a line to move backwards. - step = ((np.random.rand(dims) - 0.5) * 0.1) - lineData[:, index] = lineData[:, index - 1] + step - - return lineData - - - def update_lines(num, dataLines, lines): - for line, data in zip(lines, dataLines): - # NOTE: there is no .set_data() for 3 dim data... - line.set_data(data[0:2, :num]) - line.set_3d_properties(data[2, :num]) - return lines - - # Attaching 3D axis to the figure - fig = plt.figure() - ax = p3.Axes3D(fig) - - # Fifty lines of random 3-D lines - data = [Gen_RandLine(25, 3) for index in range(50)] - - # Creating fifty line objects. - # NOTE: Can't pass empty arrays into 3d version of plot() - lines = [ax.plot(dat[0, 0:1], dat[1, 0:1], dat[2, 0:1])[0] for dat in data] - - # Setting the axes properties - ax.set_xlim3d([0.0, 1.0]) - ax.set_xlabel('X') - - ax.set_ylim3d([0.0, 1.0]) - ax.set_ylabel('Y') - - ax.set_zlim3d([0.0, 1.0]) - ax.set_zlabel('Z') - - ax.set_title('3D Test') - - # Creating the Animation object - line_ani = animation.FuncAnimation(fig, update_lines, 25, fargs=(data, lines), - interval=50, blit=False) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/simple_anim.rst.txt b/_sources/examples/animation/simple_anim.rst.txt deleted file mode 100644 index 38b39df3ff7..00000000000 --- a/_sources/examples/animation/simple_anim.rst.txt +++ /dev/null @@ -1,38 +0,0 @@ -.. _animation-simple_anim: - -animation example code: simple_anim.py -====================================== - -[`source code `_] - -:: - - """ - A simple example of an animated plot - """ - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.animation as animation - - fig, ax = plt.subplots() - - x = np.arange(0, 2*np.pi, 0.01) - line, = ax.plot(x, np.sin(x)) - - - def animate(i): - line.set_ydata(np.sin(x + i/10.0)) # update the data - return line, - - - # Init only required for blitting to give a clean slate. - def init(): - line.set_ydata(np.ma.array(x, mask=True)) - return line, - - ani = animation.FuncAnimation(fig, animate, np.arange(1, 200), init_func=init, - interval=25, blit=True) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/simple_anim.txt b/_sources/examples/animation/simple_anim.txt deleted file mode 100644 index 38b39df3ff7..00000000000 --- a/_sources/examples/animation/simple_anim.txt +++ /dev/null @@ -1,38 +0,0 @@ -.. _animation-simple_anim: - -animation example code: simple_anim.py -====================================== - -[`source code `_] - -:: - - """ - A simple example of an animated plot - """ - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.animation as animation - - fig, ax = plt.subplots() - - x = np.arange(0, 2*np.pi, 0.01) - line, = ax.plot(x, np.sin(x)) - - - def animate(i): - line.set_ydata(np.sin(x + i/10.0)) # update the data - return line, - - - # Init only required for blitting to give a clean slate. - def init(): - line.set_ydata(np.ma.array(x, mask=True)) - return line, - - ani = animation.FuncAnimation(fig, animate, np.arange(1, 200), init_func=init, - interval=25, blit=True) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/simple_anim_gtk.txt b/_sources/examples/animation/simple_anim_gtk.txt deleted file mode 100644 index e22b4bbbfe1..00000000000 --- a/_sources/examples/animation/simple_anim_gtk.txt +++ /dev/null @@ -1,42 +0,0 @@ -.. _animation-simple_anim_gtk: - -animation example code: simple_anim_gtk.py -========================================== - -[`source code `_] - -:: - - """ - A simple example of an animated plot using a gtk backend - """ - import time - import numpy as np - import matplotlib - matplotlib.use('GTKAgg') # do this before importing pylab - - import matplotlib.pyplot as plt - - fig = plt.figure() - - ax = fig.add_subplot(111) - - def animate(): - tstart = time.time() # for profiling - x = np.arange(0, 2*np.pi, 0.01) # x-array - line, = ax.plot(x, np.sin(x)) - - for i in np.arange(1,200): - line.set_ydata(np.sin(x+i/10.0)) # update the data - fig.canvas.draw() # redraw the canvas - print 'FPS:' , 200/(time.time()-tstart) - raise SystemExit - - import gobject - print 'adding idle' - gobject.idle_add(animate) - print 'showing' - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/simple_anim_tkagg.txt b/_sources/examples/animation/simple_anim_tkagg.txt deleted file mode 100644 index 0b2b3fbf5ed..00000000000 --- a/_sources/examples/animation/simple_anim_tkagg.txt +++ /dev/null @@ -1,38 +0,0 @@ -.. _animation-simple_anim_tkagg: - -animation example code: simple_anim_tkagg.py -============================================ - -[`source code `_] - -:: - - #!/usr/bin/env python - """ - A simple example of an animated plot in tkagg - """ - import time - import numpy as np - import matplotlib - matplotlib.use('TkAgg') # do this before importing pylab - - import matplotlib.pyplot as plt - fig = plt.figure() - ax = fig.add_subplot(111) - - def animate(): - tstart = time.time() # for profiling - x = np.arange(0, 2*np.pi, 0.01) # x-array - line, = ax.plot(x, np.sin(x)) - - for i in np.arange(1,200): - line.set_ydata(np.sin(x+i/10.0)) # update the data - fig.canvas.draw() # redraw the canvas - print 'FPS:' , 200/(time.time()-tstart) - - win = fig.canvas.manager.window - fig.canvas.manager.window.after(100, animate) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/simple_idle_wx.txt b/_sources/examples/animation/simple_idle_wx.txt deleted file mode 100644 index df91e3b7472..00000000000 --- a/_sources/examples/animation/simple_idle_wx.txt +++ /dev/null @@ -1,41 +0,0 @@ -.. _animation-simple_idle_wx: - -animation example code: simple_idle_wx.py -========================================= - -[`source code `_] - -:: - - """ - A simple example of an animated plot using a wx backend - """ - import time - import numpy as np - import matplotlib - matplotlib.use('WXAgg') # do this before importing pylab - - import matplotlib.pyplot as plt - - fig = plt.figure() - - ax = fig.add_subplot(111) - t = np.arange(0, 2*np.pi, 0.1) - line, = ax.plot(t, np.sin(t)) - dt = 0.05 - - def update_line(idleevent): - if update_line.i==200: - return False - print 'animate', update_line.i - line.set_ydata(np.sin(t+update_line.i/10.)) - fig.canvas.draw_idle() # redraw the canvas - update_line.i += 1 - update_line.i = 0 - - import wx - wx.EVT_IDLE(wx.GetApp(), update_line) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/simple_timer_wx.txt b/_sources/examples/animation/simple_timer_wx.txt deleted file mode 100644 index 8af4a23dff9..00000000000 --- a/_sources/examples/animation/simple_timer_wx.txt +++ /dev/null @@ -1,48 +0,0 @@ -.. _animation-simple_timer_wx: - -animation example code: simple_timer_wx.py -========================================== - -[`source code `_] - -:: - - """ - A simple example of an animated plot using a wx backend - """ - import time - import numpy as np - import matplotlib - matplotlib.use('WXAgg') # do this before importing pylab - - import matplotlib.pyplot as plt - - fig = plt.figure() - - ax = fig.add_subplot(111) - t = np.arange(0, 2*np.pi, 0.1) - line, = ax.plot(t, np.sin(t)) - dt = 0.05 - - - def update_line(event): - if update_line.i==200: - return False - print 'update', update_line.i - line.set_ydata(np.sin(t+update_line.i/10.)) - fig.canvas.draw() # redraw the canvas - update_line.i += 1 - update_line.i = 0 - - import wx - id = wx.NewId() - actor = fig.canvas.manager.frame - timer = wx.Timer(actor, id=id) - timer.Start(100) - wx.EVT_TIMER(actor, id, update_line) - #actor.Bind(wx.EVT_TIMER, update_line, id=id) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/strip_chart_demo.rst.txt b/_sources/examples/animation/strip_chart_demo.rst.txt deleted file mode 100644 index cba94107a0a..00000000000 --- a/_sources/examples/animation/strip_chart_demo.rst.txt +++ /dev/null @@ -1,70 +0,0 @@ -.. _animation-strip_chart_demo: - -animation example code: strip_chart_demo.py -=========================================== - -[`source code `_] - -:: - - """ - ============ - Oscilloscope - ============ - - Emulates an oscilloscope. - """ - import numpy as np - from matplotlib.lines import Line2D - import matplotlib.pyplot as plt - import matplotlib.animation as animation - - - class Scope(object): - def __init__(self, ax, maxt=2, dt=0.02): - self.ax = ax - self.dt = dt - self.maxt = maxt - self.tdata = [0] - self.ydata = [0] - self.line = Line2D(self.tdata, self.ydata) - self.ax.add_line(self.line) - self.ax.set_ylim(-.1, 1.1) - self.ax.set_xlim(0, self.maxt) - - def update(self, y): - lastt = self.tdata[-1] - if lastt > self.tdata[0] + self.maxt: # reset the arrays - self.tdata = [self.tdata[-1]] - self.ydata = [self.ydata[-1]] - self.ax.set_xlim(self.tdata[0], self.tdata[0] + self.maxt) - self.ax.figure.canvas.draw() - - t = self.tdata[-1] + self.dt - self.tdata.append(t) - self.ydata.append(y) - self.line.set_data(self.tdata, self.ydata) - return self.line, - - - def emitter(p=0.03): - 'return a random value with probability p, else 0' - while True: - v = np.random.rand(1) - if v > p: - yield 0. - else: - yield np.random.rand(1) - - fig, ax = plt.subplots() - scope = Scope(ax) - - # pass a generator in "emitter" to produce data for the update func - ani = animation.FuncAnimation(fig, scope.update, emitter, interval=10, - blit=True) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/strip_chart_demo.txt b/_sources/examples/animation/strip_chart_demo.txt deleted file mode 100644 index beb793cfd77..00000000000 --- a/_sources/examples/animation/strip_chart_demo.txt +++ /dev/null @@ -1,67 +0,0 @@ -.. _animation-strip_chart_demo: - -animation example code: strip_chart_demo.py -=========================================== - -[`source code `_] - -:: - - """ - Emulate an oscilloscope. Requires the animation API introduced in - matplotlib 1.0 SVN. - """ - import numpy as np - from matplotlib.lines import Line2D - import matplotlib.pyplot as plt - import matplotlib.animation as animation - - - class Scope(object): - def __init__(self, ax, maxt=2, dt=0.02): - self.ax = ax - self.dt = dt - self.maxt = maxt - self.tdata = [0] - self.ydata = [0] - self.line = Line2D(self.tdata, self.ydata) - self.ax.add_line(self.line) - self.ax.set_ylim(-.1, 1.1) - self.ax.set_xlim(0, self.maxt) - - def update(self, y): - lastt = self.tdata[-1] - if lastt > self.tdata[0] + self.maxt: # reset the arrays - self.tdata = [self.tdata[-1]] - self.ydata = [self.ydata[-1]] - self.ax.set_xlim(self.tdata[0], self.tdata[0] + self.maxt) - self.ax.figure.canvas.draw() - - t = self.tdata[-1] + self.dt - self.tdata.append(t) - self.ydata.append(y) - self.line.set_data(self.tdata, self.ydata) - return self.line, - - - def emitter(p=0.03): - 'return a random value with probability p, else 0' - while True: - v = np.random.rand(1) - if v > p: - yield 0. - else: - yield np.random.rand(1) - - fig, ax = plt.subplots() - scope = Scope(ax) - - # pass a generator in "emitter" to produce data for the update func - ani = animation.FuncAnimation(fig, scope.update, emitter, interval=10, - blit=True) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/subplots.rst.txt b/_sources/examples/animation/subplots.rst.txt deleted file mode 100644 index d887264e064..00000000000 --- a/_sources/examples/animation/subplots.rst.txt +++ /dev/null @@ -1,116 +0,0 @@ -.. _animation-subplots: - -animation example code: subplots.py -=================================== - -[`source code `_] - -:: - - """ - ================= - Animated subplots - ================= - - This example uses subclassing, but there is no reason that the proper function - couldn't be set up and then use FuncAnimation. The code is long, but not - really complex. The length is due solely to the fact that there are a total of - 9 lines that need to be changed for the animation as well as 3 subplots that - need initial set up. - - """ - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.lines import Line2D - import matplotlib.animation as animation - - - class SubplotAnimation(animation.TimedAnimation): - def __init__(self): - fig = plt.figure() - ax1 = fig.add_subplot(1, 2, 1) - ax2 = fig.add_subplot(2, 2, 2) - ax3 = fig.add_subplot(2, 2, 4) - - self.t = np.linspace(0, 80, 400) - self.x = np.cos(2 * np.pi * self.t / 10.) - self.y = np.sin(2 * np.pi * self.t / 10.) - self.z = 10 * self.t - - ax1.set_xlabel('x') - ax1.set_ylabel('y') - self.line1 = Line2D([], [], color='black') - self.line1a = Line2D([], [], color='red', linewidth=2) - self.line1e = Line2D( - [], [], color='red', marker='o', markeredgecolor='r') - ax1.add_line(self.line1) - ax1.add_line(self.line1a) - ax1.add_line(self.line1e) - ax1.set_xlim(-1, 1) - ax1.set_ylim(-2, 2) - ax1.set_aspect('equal', 'datalim') - - ax2.set_xlabel('y') - ax2.set_ylabel('z') - self.line2 = Line2D([], [], color='black') - self.line2a = Line2D([], [], color='red', linewidth=2) - self.line2e = Line2D( - [], [], color='red', marker='o', markeredgecolor='r') - ax2.add_line(self.line2) - ax2.add_line(self.line2a) - ax2.add_line(self.line2e) - ax2.set_xlim(-1, 1) - ax2.set_ylim(0, 800) - - ax3.set_xlabel('x') - ax3.set_ylabel('z') - self.line3 = Line2D([], [], color='black') - self.line3a = Line2D([], [], color='red', linewidth=2) - self.line3e = Line2D( - [], [], color='red', marker='o', markeredgecolor='r') - ax3.add_line(self.line3) - ax3.add_line(self.line3a) - ax3.add_line(self.line3e) - ax3.set_xlim(-1, 1) - ax3.set_ylim(0, 800) - - animation.TimedAnimation.__init__(self, fig, interval=50, blit=True) - - def _draw_frame(self, framedata): - i = framedata - head = i - 1 - head_slice = (self.t > self.t[i] - 1.0) & (self.t < self.t[i]) - - self.line1.set_data(self.x[:i], self.y[:i]) - self.line1a.set_data(self.x[head_slice], self.y[head_slice]) - self.line1e.set_data(self.x[head], self.y[head]) - - self.line2.set_data(self.y[:i], self.z[:i]) - self.line2a.set_data(self.y[head_slice], self.z[head_slice]) - self.line2e.set_data(self.y[head], self.z[head]) - - self.line3.set_data(self.x[:i], self.z[:i]) - self.line3a.set_data(self.x[head_slice], self.z[head_slice]) - self.line3e.set_data(self.x[head], self.z[head]) - - self._drawn_artists = [self.line1, self.line1a, self.line1e, - self.line2, self.line2a, self.line2e, - self.line3, self.line3a, self.line3e] - - def new_frame_seq(self): - return iter(range(self.t.size)) - - def _init_draw(self): - lines = [self.line1, self.line1a, self.line1e, - self.line2, self.line2a, self.line2e, - self.line3, self.line3a, self.line3e] - for l in lines: - l.set_data([], []) - - ani = SubplotAnimation() - # ani.save('test_sub.mp4') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/subplots.txt b/_sources/examples/animation/subplots.txt deleted file mode 100644 index c1cebcb967b..00000000000 --- a/_sources/examples/animation/subplots.txt +++ /dev/null @@ -1,109 +0,0 @@ -.. _animation-subplots: - -animation example code: subplots.py -=================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.lines import Line2D - import matplotlib.animation as animation - - - # This example uses subclassing, but there is no reason that the proper - # function couldn't be set up and then use FuncAnimation. The code is long, but - # not really complex. The length is due solely to the fact that there are a - # total of 9 lines that need to be changed for the animation as well as 3 - # subplots that need initial set up. - class SubplotAnimation(animation.TimedAnimation): - def __init__(self): - fig = plt.figure() - ax1 = fig.add_subplot(1, 2, 1) - ax2 = fig.add_subplot(2, 2, 2) - ax3 = fig.add_subplot(2, 2, 4) - - self.t = np.linspace(0, 80, 400) - self.x = np.cos(2 * np.pi * self.t / 10.) - self.y = np.sin(2 * np.pi * self.t / 10.) - self.z = 10 * self.t - - ax1.set_xlabel('x') - ax1.set_ylabel('y') - self.line1 = Line2D([], [], color='black') - self.line1a = Line2D([], [], color='red', linewidth=2) - self.line1e = Line2D( - [], [], color='red', marker='o', markeredgecolor='r') - ax1.add_line(self.line1) - ax1.add_line(self.line1a) - ax1.add_line(self.line1e) - ax1.set_xlim(-1, 1) - ax1.set_ylim(-2, 2) - ax1.set_aspect('equal', 'datalim') - - ax2.set_xlabel('y') - ax2.set_ylabel('z') - self.line2 = Line2D([], [], color='black') - self.line2a = Line2D([], [], color='red', linewidth=2) - self.line2e = Line2D( - [], [], color='red', marker='o', markeredgecolor='r') - ax2.add_line(self.line2) - ax2.add_line(self.line2a) - ax2.add_line(self.line2e) - ax2.set_xlim(-1, 1) - ax2.set_ylim(0, 800) - - ax3.set_xlabel('x') - ax3.set_ylabel('z') - self.line3 = Line2D([], [], color='black') - self.line3a = Line2D([], [], color='red', linewidth=2) - self.line3e = Line2D( - [], [], color='red', marker='o', markeredgecolor='r') - ax3.add_line(self.line3) - ax3.add_line(self.line3a) - ax3.add_line(self.line3e) - ax3.set_xlim(-1, 1) - ax3.set_ylim(0, 800) - - animation.TimedAnimation.__init__(self, fig, interval=50, blit=True) - - def _draw_frame(self, framedata): - i = framedata - head = i - 1 - head_len = 10 - head_slice = (self.t > self.t[i] - 1.0) & (self.t < self.t[i]) - - self.line1.set_data(self.x[:i], self.y[:i]) - self.line1a.set_data(self.x[head_slice], self.y[head_slice]) - self.line1e.set_data(self.x[head], self.y[head]) - - self.line2.set_data(self.y[:i], self.z[:i]) - self.line2a.set_data(self.y[head_slice], self.z[head_slice]) - self.line2e.set_data(self.y[head], self.z[head]) - - self.line3.set_data(self.x[:i], self.z[:i]) - self.line3a.set_data(self.x[head_slice], self.z[head_slice]) - self.line3e.set_data(self.x[head], self.z[head]) - - self._drawn_artists = [self.line1, self.line1a, self.line1e, - self.line2, self.line2a, self.line2e, - self.line3, self.line3a, self.line3e] - - def new_frame_seq(self): - return iter(range(self.t.size)) - - def _init_draw(self): - lines = [self.line1, self.line1a, self.line1e, - self.line2, self.line2a, self.line2e, - self.line3, self.line3a, self.line3e] - for l in lines: - l.set_data([], []) - - ani = SubplotAnimation() - #ani.save('test_sub.mp4') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/unchained.rst.txt b/_sources/examples/animation/unchained.rst.txt deleted file mode 100644 index 598e7474b05..00000000000 --- a/_sources/examples/animation/unchained.rst.txt +++ /dev/null @@ -1,81 +0,0 @@ -.. _animation-unchained: - -animation example code: unchained.py -==================================== - -[`source code `_] - -:: - - """ - ======================== - MATPLOTLIB **UNCHAINED** - ======================== - - Comparative path demonstration of frequency from a fake signal of a pulsar. - (mostly known because of the cover for Joy Division's Unknown Pleasures) - - Author: Nicolas P. Rougier - """ - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.animation as animation - - # Create new Figure with black background - fig = plt.figure(figsize=(8, 8), facecolor='black') - - # Add a subplot with no frame - ax = plt.subplot(111, frameon=False) - - # Generate random data - data = np.random.uniform(0, 1, (64, 75)) - X = np.linspace(-1, 1, data.shape[-1]) - G = 1.5 * np.exp(-4 * X * X) - - # Generate line plots - lines = [] - for i in range(len(data)): - # Small reduction of the X extents to get a cheap perspective effect - xscale = 1 - i / 200. - # Same for linewidth (thicker strokes on bottom) - lw = 1.5 - i / 100.0 - line, = ax.plot(xscale * X, i + G * data[i], color="w", lw=lw) - lines.append(line) - - # Set y limit (or first line is cropped because of thickness) - ax.set_ylim(-1, 70) - - # No ticks - ax.set_xticks([]) - ax.set_yticks([]) - - # 2 part titles to get different font weights - ax.text(0.5, 1.0, "MATPLOTLIB ", transform=ax.transAxes, - ha="right", va="bottom", color="w", - family="sans-serif", fontweight="light", fontsize=16) - ax.text(0.5, 1.0, "UNCHAINED", transform=ax.transAxes, - ha="left", va="bottom", color="w", - family="sans-serif", fontweight="bold", fontsize=16) - - - def update(*args): - # Shift all data to the right - data[:, 1:] = data[:, :-1] - - # Fill-in new values - data[:, 0] = np.random.uniform(0, 1, len(data)) - - # Update data - for i in range(len(data)): - lines[i].set_ydata(i + G * data[i]) - - # Return modified artists - return lines - - # Construct the animation, using the update function as the animation - # director. - anim = animation.FuncAnimation(fig, update, interval=10) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/animation/unchained.txt b/_sources/examples/animation/unchained.txt deleted file mode 100644 index da9b44726d9..00000000000 --- a/_sources/examples/animation/unchained.txt +++ /dev/null @@ -1,77 +0,0 @@ -.. _animation-unchained: - -animation example code: unchained.py -==================================== - -[`source code `_] - -:: - - """ - Comparative path demonstration of frequency from a fake signal of a pulsar. - (mostly known because of the cover for Joy Division's Unknown Pleasures) - - Author: Nicolas P. Rougier - """ - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.animation as animation - - # Create new Figure with black background - fig = plt.figure(figsize=(8, 8), facecolor='black') - - # Add a subplot with no frame - ax = plt.subplot(111, frameon=False) - - # Generate random data - data = np.random.uniform(0, 1, (64, 75)) - X = np.linspace(-1, 1, data.shape[-1]) - G = 1.5 * np.exp(-4 * X * X) - - # Generate line plots - lines = [] - for i in range(len(data)): - # Small reduction of the X extents to get a cheap perspective effect - xscale = 1 - i / 200. - # Same for linewidth (thicker strokes on bottom) - lw = 1.5 - i / 100.0 - line, = ax.plot(xscale * X, i + G * data[i], color="w", lw=lw) - lines.append(line) - - # Set y limit (or first line is cropped because of thickness) - ax.set_ylim(-1, 70) - - # No ticks - ax.set_xticks([]) - ax.set_yticks([]) - - # 2 part titles to get different font weights - ax.text(0.5, 1.0, "MATPLOTLIB ", transform=ax.transAxes, - ha="right", va="bottom", color="w", - family="sans-serif", fontweight="light", fontsize=16) - ax.text(0.5, 1.0, "UNCHAINED", transform=ax.transAxes, - ha="left", va="bottom", color="w", - family="sans-serif", fontweight="bold", fontsize=16) - - - def update(*args): - # Shift all data to the right - data[:, 1:] = data[:, :-1] - - # Fill-in new values - data[:, 0] = np.random.uniform(0, 1, len(data)) - - # Update data - for i in range(len(data)): - lines[i].set_ydata(i + G * data[i]) - - # Return modified artists - return lines - - # Construct the animation, using the update function as the animation - # director. - anim = animation.FuncAnimation(fig, update, interval=10) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/agg_oo.rst.txt b/_sources/examples/api/agg_oo.rst.txt deleted file mode 100644 index 49511bd4fe7..00000000000 --- a/_sources/examples/api/agg_oo.rst.txt +++ /dev/null @@ -1,32 +0,0 @@ -.. _api-agg_oo: - -api example code: agg_oo.py -=========================== - -[`source code `_] - -:: - - # -*- noplot -*- - """ - ============================= - The object-oriented interface - ============================= - - A pure OO (look Ma, no pylab!) example using the agg backend - """ - from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas - from matplotlib.figure import Figure - - fig = Figure() - canvas = FigureCanvas(fig) - ax = fig.add_subplot(111) - ax.plot([1, 2, 3]) - ax.set_title('hi mom') - ax.grid(True) - ax.set_xlabel('time') - ax.set_ylabel('volts') - canvas.print_figure('test') - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/agg_oo.txt b/_sources/examples/api/agg_oo.txt deleted file mode 100644 index 6f18b9e79c2..00000000000 --- a/_sources/examples/api/agg_oo.txt +++ /dev/null @@ -1,29 +0,0 @@ -.. _api-agg_oo: - -api example code: agg_oo.py -=========================== - -[`source code `_] - -:: - - #!/usr/bin/env python - # -*- noplot -*- - """ - A pure OO (look Ma, no pylab!) example using the agg backend - """ - from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas - from matplotlib.figure import Figure - - fig = Figure() - canvas = FigureCanvas(fig) - ax = fig.add_subplot(111) - ax.plot([1, 2, 3]) - ax.set_title('hi mom') - ax.grid(True) - ax.set_xlabel('time') - ax.set_ylabel('volts') - canvas.print_figure('test') - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/artist_demo.txt b/_sources/examples/api/artist_demo.txt deleted file mode 100644 index 3b2492c8e02..00000000000 --- a/_sources/examples/api/artist_demo.txt +++ /dev/null @@ -1,133 +0,0 @@ -.. _api-artist_demo: - -api example code: artist_demo.py -================================ - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/api/artist_demo.py - -:: - - """ - Show examples of matplotlib artists - http://matplotlib.org/api/artist_api.html - - Several examples of standard matplotlib graphics primitives (artists) - are drawn using matplotlib API. Full list of artists and the - documentation is available at - http://matplotlib.org/api/artist_api.html - - Copyright (c) 2010, Bartosz Telenczuk - - License: This work is licensed under the BSD. A copy should be - included with this source code, and is also available at - http://www.opensource.org/licenses/bsd-license.php - """ - - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib - from matplotlib.collections import PatchCollection - import matplotlib.path as mpath - import matplotlib.patches as mpatches - import matplotlib.lines as mlines - - font = "sans-serif" - fig = plt.figure(figsize=(5,5)) - ax = plt.axes([0,0,1,1]) - - # create 3x3 grid to plot the artists - pos = np.mgrid[0.2:0.8:3j, 0.2:0.8:3j].reshape(2, -1) - - patches = [] - - # add a circle - art = mpatches.Circle(pos[:,0], 0.1,ec="none") - patches.append(art) - plt.text(pos[0,0], pos[1,0]-0.15, "Circle", ha="center", - family=font, size=14) - - # add a rectangle - art = mpatches.Rectangle(pos[:,1] - np.array([0.025, 0.05]), 0.05, 0.1, - ec="none") - patches.append(art) - plt.text(pos[0,1], pos[1,1]-0.15, "Rectangle", ha="center", - family=font, size=14) - - # add a wedge - wedge = mpatches.Wedge(pos[:,2], 0.1, 30, 270, ec="none") - patches.append(wedge) - plt.text(pos[0,2], pos[1,2]-0.15, "Wedge", ha="center", - family=font, size=14) - - # add a Polygon - polygon = mpatches.RegularPolygon(pos[:,3], 5, 0.1) - patches.append(polygon) - plt.text(pos[0,3], pos[1,3]-0.15, "Polygon", ha="center", - family=font, size=14) - - #add an ellipse - ellipse = mpatches.Ellipse(pos[:,4], 0.2, 0.1) - patches.append(ellipse) - plt.text(pos[0,4], pos[1,4]-0.15, "Ellipse", ha="center", - family=font, size=14) - - #add an arrow - arrow = mpatches.Arrow(pos[0,5]-0.05, pos[1,5]-0.05, 0.1, 0.1, width=0.1) - patches.append(arrow) - plt.text(pos[0,5], pos[1,5]-0.15, "Arrow", ha="center", - family=font, size=14) - - # add a path patch - Path = mpath.Path - verts = np.array([ - (0.158, -0.257), - (0.035, -0.11), - (-0.175, 0.20), - (0.0375, 0.20), - (0.085, 0.115), - (0.22, 0.32), - (0.3, 0.005), - (0.20, -0.05), - (0.158, -0.257), - ]) - verts = verts-verts.mean(0) - codes = [Path.MOVETO, - Path.CURVE4, Path.CURVE4, Path.CURVE4, Path.LINETO, - Path.CURVE4, Path.CURVE4, Path.CURVE4, Path.CLOSEPOLY] - - path = mpath.Path(verts/2.5+pos[:,6], codes) - patch = mpatches.PathPatch(path) - patches.append(patch) - plt.text(pos[0,6], pos[1,6]-0.15, "PathPatch", ha="center", - family=font, size=14) - - # add a fancy box - fancybox = mpatches.FancyBboxPatch( - pos[:,7]-np.array([0.025, 0.05]), 0.05, 0.1, - boxstyle=mpatches.BoxStyle("Round", pad=0.02)) - patches.append(fancybox) - plt.text(pos[0,7], pos[1,7]-0.15, "FancyBoxPatch", ha="center", - family=font, size=14) - - # add a line - x,y = np.array([[-0.06, 0.0, 0.1], [0.05,-0.05, 0.05]]) - line = mlines.Line2D(x+pos[0,8], y+pos[1,8], lw=5., - alpha=0.4) - plt.text(pos[0,8], pos[1,8]-0.15, "Line2D", ha="center", - family=font, size=14) - - colors = 100*np.random.rand(len(patches)) - collection = PatchCollection(patches, cmap=matplotlib.cm.jet, alpha=0.4) - collection.set_array(np.array(colors)) - ax.add_collection(collection) - ax.add_line(line) - ax.set_xticks([]) - ax.set_yticks([]) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/barchart_demo.rst.txt b/_sources/examples/api/barchart_demo.rst.txt deleted file mode 100644 index 25eb0229d3f..00000000000 --- a/_sources/examples/api/barchart_demo.rst.txt +++ /dev/null @@ -1,61 +0,0 @@ -.. _api-barchart_demo: - -api example code: barchart_demo.py -================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/barchart_demo.py - -:: - - """ - ======== - Barchart - ======== - - A bar plot with errorbars and height labels on individual bars - """ - import numpy as np - import matplotlib.pyplot as plt - - N = 5 - men_means = (20, 35, 30, 35, 27) - men_std = (2, 3, 4, 1, 2) - - ind = np.arange(N) # the x locations for the groups - width = 0.35 # the width of the bars - - fig, ax = plt.subplots() - rects1 = ax.bar(ind, men_means, width, color='r', yerr=men_std) - - women_means = (25, 32, 34, 20, 25) - women_std = (3, 5, 2, 3, 3) - rects2 = ax.bar(ind + width, women_means, width, color='y', yerr=women_std) - - # add some text for labels, title and axes ticks - ax.set_ylabel('Scores') - ax.set_title('Scores by group and gender') - ax.set_xticks(ind + width / 2) - ax.set_xticklabels(('G1', 'G2', 'G3', 'G4', 'G5')) - - ax.legend((rects1[0], rects2[0]), ('Men', 'Women')) - - - def autolabel(rects): - """ - Attach a text label above each bar displaying its height - """ - for rect in rects: - height = rect.get_height() - ax.text(rect.get_x() + rect.get_width()/2., 1.05*height, - '%d' % int(height), - ha='center', va='bottom') - - autolabel(rects1) - autolabel(rects2) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/barchart_demo.txt b/_sources/examples/api/barchart_demo.txt deleted file mode 100644 index ed6b8bb1f0c..00000000000 --- a/_sources/examples/api/barchart_demo.txt +++ /dev/null @@ -1,55 +0,0 @@ -.. _api-barchart_demo: - -api example code: barchart_demo.py -================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/barchart_demo.py - -:: - - - #!/usr/bin/env python - # a bar plot with errorbars - import numpy as np - import matplotlib.pyplot as plt - - N = 5 - menMeans = (20, 35, 30, 35, 27) - menStd = (2, 3, 4, 1, 2) - - ind = np.arange(N) # the x locations for the groups - width = 0.35 # the width of the bars - - fig, ax = plt.subplots() - rects1 = ax.bar(ind, menMeans, width, color='r', yerr=menStd) - - womenMeans = (25, 32, 34, 20, 25) - womenStd = (3, 5, 2, 3, 3) - rects2 = ax.bar(ind + width, womenMeans, width, color='y', yerr=womenStd) - - # add some text for labels, title and axes ticks - ax.set_ylabel('Scores') - ax.set_title('Scores by group and gender') - ax.set_xticks(ind + width) - ax.set_xticklabels(('G1', 'G2', 'G3', 'G4', 'G5')) - - ax.legend((rects1[0], rects2[0]), ('Men', 'Women')) - - - def autolabel(rects): - # attach some text labels - for rect in rects: - height = rect.get_height() - ax.text(rect.get_x() + rect.get_width()/2., 1.05*height, - '%d' % int(height), - ha='center', va='bottom') - - autolabel(rects1) - autolabel(rects2) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/bbox_intersect.rst.txt b/_sources/examples/api/bbox_intersect.rst.txt deleted file mode 100644 index 9b4ae718eea..00000000000 --- a/_sources/examples/api/bbox_intersect.rst.txt +++ /dev/null @@ -1,47 +0,0 @@ -.. _api-bbox_intersect: - -api example code: bbox_intersect.py -=================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/bbox_intersect.py - -:: - - """ - =========================================== - Changing colors of lines intersecting a box - =========================================== - - The lines intersecting the rectangle are colored in red, while the others - are left as blue lines. This example showcases the `intersect_bbox` function. - - """ - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.transforms import Bbox - from matplotlib.path import Path - - left, bottom, width, height = (-1, -1, 2, 2) - rect = plt.Rectangle((left, bottom), width, height, facecolor="#aaaaaa") - - fig, ax = plt.subplots() - ax.add_patch(rect) - - bbox = Bbox.from_bounds(left, bottom, width, height) - - for i in range(12): - vertices = (np.random.random((2, 2)) - 0.5) * 6.0 - path = Path(vertices) - if path.intersects_bbox(bbox): - color = 'r' - else: - color = 'b' - ax.plot(vertices[:, 0], vertices[:, 1], color=color) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/bbox_intersect.txt b/_sources/examples/api/bbox_intersect.txt deleted file mode 100644 index 7d3609ad447..00000000000 --- a/_sources/examples/api/bbox_intersect.txt +++ /dev/null @@ -1,33 +0,0 @@ -.. _api-bbox_intersect: - -api example code: bbox_intersect.py -=================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/bbox_intersect.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.transforms import Bbox - from matplotlib.path import Path - - rect = plt.Rectangle((-1, -1), 2, 2, facecolor="#aaaaaa") - plt.gca().add_patch(rect) - bbox = Bbox.from_bounds(-1, -1, 2, 2) - - for i in range(12): - vertices = (np.random.random((2, 2)) - 0.5) * 6.0 - path = Path(vertices) - if path.intersects_bbox(bbox): - color = 'r' - else: - color = 'b' - plt.plot(vertices[:, 0], vertices[:, 1], color=color) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/clippath_demo.txt b/_sources/examples/api/clippath_demo.txt deleted file mode 100644 index 6995c42d3cb..00000000000 --- a/_sources/examples/api/clippath_demo.txt +++ /dev/null @@ -1,33 +0,0 @@ -.. _api-clippath_demo: - -api example code: clippath_demo.py -================================== - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/api/clippath_demo.py - -:: - - """ - Clipping to arbitrary patches and paths - """ - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.patches as patches - - - fig = plt.figure() - ax = fig.add_subplot(111, frameon=False, xticks=[], yticks=[]) - - im = ax.imshow(np.random.rand(10,10)) - - patch = patches.Circle((300,300), radius=100) - im.set_clip_path(patch) - - plt.show() - - - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/collections_demo.rst.txt b/_sources/examples/api/collections_demo.rst.txt deleted file mode 100644 index 5f97bdfe273..00000000000 --- a/_sources/examples/api/collections_demo.rst.txt +++ /dev/null @@ -1,142 +0,0 @@ -.. _api-collections_demo: - -api example code: collections_demo.py -===================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/collections_demo.py - -:: - - ''' - ========================================================= - Line, Poly and RegularPoly Collection with autoscaling - ========================================================= - - For the first two subplots, we will use spirals. Their - size will be set in plot units, not data units. Their positions - will be set in data units by using the "offsets" and "transOffset" - kwargs of the LineCollection and PolyCollection. - - The third subplot will make regular polygons, with the same - type of scaling and positioning as in the first two. - - The last subplot illustrates the use of "offsets=(xo,yo)", - that is, a single tuple instead of a list of tuples, to generate - successively offset curves, with the offset given in data - units. This behavior is available only for the LineCollection. - - ''' - - import matplotlib.pyplot as plt - from matplotlib import collections, colors, transforms - import numpy as np - - nverts = 50 - npts = 100 - - # Make some spirals - r = np.arange(nverts) - theta = np.linspace(0, 2*np.pi, nverts) - xx = r * np.sin(theta) - yy = r * np.cos(theta) - spiral = list(zip(xx, yy)) - - # Make some offsets - rs = np.random.RandomState([12345678]) - xo = rs.randn(npts) - yo = rs.randn(npts) - xyo = list(zip(xo, yo)) - - # Make a list of colors cycling through the default series. - colors = [colors.to_rgba(c) - for c in plt.rcParams['axes.prop_cycle'].by_key()['color']] - - fig, axes = plt.subplots(2, 2) - fig.subplots_adjust(top=0.92, left=0.07, right=0.97, - hspace=0.3, wspace=0.3) - ((ax1, ax2), (ax3, ax4)) = axes # unpack the axes - - - col = collections.LineCollection([spiral], offsets=xyo, - transOffset=ax1.transData) - trans = fig.dpi_scale_trans + transforms.Affine2D().scale(1.0/72.0) - col.set_transform(trans) # the points to pixels transform - # Note: the first argument to the collection initializer - # must be a list of sequences of x,y tuples; we have only - # one sequence, but we still have to put it in a list. - ax1.add_collection(col, autolim=True) - # autolim=True enables autoscaling. For collections with - # offsets like this, it is neither efficient nor accurate, - # but it is good enough to generate a plot that you can use - # as a starting point. If you know beforehand the range of - # x and y that you want to show, it is better to set them - # explicitly, leave out the autolim kwarg (or set it to False), - # and omit the 'ax1.autoscale_view()' call below. - - # Make a transform for the line segments such that their size is - # given in points: - col.set_color(colors) - - ax1.autoscale_view() # See comment above, after ax1.add_collection. - ax1.set_title('LineCollection using offsets') - - - # The same data as above, but fill the curves. - col = collections.PolyCollection([spiral], offsets=xyo, - transOffset=ax2.transData) - trans = transforms.Affine2D().scale(fig.dpi/72.0) - col.set_transform(trans) # the points to pixels transform - ax2.add_collection(col, autolim=True) - col.set_color(colors) - - - ax2.autoscale_view() - ax2.set_title('PolyCollection using offsets') - - # 7-sided regular polygons - - col = collections.RegularPolyCollection(7, - sizes=np.fabs(xx) * 10.0, offsets=xyo, - transOffset=ax3.transData) - trans = transforms.Affine2D().scale(fig.dpi / 72.0) - col.set_transform(trans) # the points to pixels transform - ax3.add_collection(col, autolim=True) - col.set_color(colors) - ax3.autoscale_view() - ax3.set_title('RegularPolyCollection using offsets') - - - # Simulate a series of ocean current profiles, successively - # offset by 0.1 m/s so that they form what is sometimes called - # a "waterfall" plot or a "stagger" plot. - - nverts = 60 - ncurves = 20 - offs = (0.1, 0.0) - - yy = np.linspace(0, 2*np.pi, nverts) - ym = np.amax(yy) - xx = (0.2 + (ym - yy)/ym)**2 * np.cos(yy - 0.4)*0.5 - segs = [] - for i in range(ncurves): - xxx = xx + 0.02*rs.randn(nverts) - curve = list(zip(xxx, yy*100)) - segs.append(curve) - - col = collections.LineCollection(segs, offsets=offs) - ax4.add_collection(col, autolim=True) - col.set_color(colors) - ax4.autoscale_view() - ax4.set_title('Successive data offsets') - ax4.set_xlabel('Zonal velocity component (m/s)') - ax4.set_ylabel('Depth (m)') - # Reverse the y-axis so depth increases downward - ax4.set_ylim(ax4.get_ylim()[::-1]) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/collections_demo.txt b/_sources/examples/api/collections_demo.txt deleted file mode 100644 index 34bc68ff5be..00000000000 --- a/_sources/examples/api/collections_demo.txt +++ /dev/null @@ -1,140 +0,0 @@ -.. _api-collections_demo: - -api example code: collections_demo.py -===================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/collections_demo.py - -:: - - #!/usr/bin/env python - '''Demonstration of LineCollection, PolyCollection, and - RegularPolyCollection with autoscaling. - - For the first two subplots, we will use spirals. Their - size will be set in plot units, not data units. Their positions - will be set in data units by using the "offsets" and "transOffset" - kwargs of the LineCollection and PolyCollection. - - The third subplot will make regular polygons, with the same - type of scaling and positioning as in the first two. - - The last subplot illustrates the use of "offsets=(xo,yo)", - that is, a single tuple instead of a list of tuples, to generate - successively offset curves, with the offset given in data - units. This behavior is available only for the LineCollection. - - ''' - - import matplotlib.pyplot as plt - from matplotlib import collections, transforms - from matplotlib.colors import colorConverter - import numpy as np - - nverts = 50 - npts = 100 - - # Make some spirals - r = np.arange(nverts) - theta = np.linspace(0, 2*np.pi, nverts) - xx = r * np.sin(theta) - yy = r * np.cos(theta) - spiral = list(zip(xx, yy)) - - # Make some offsets - rs = np.random.RandomState([12345678]) - xo = rs.randn(npts) - yo = rs.randn(npts) - xyo = list(zip(xo, yo)) - - # Make a list of colors cycling through the rgbcmyk series. - colors = [colorConverter.to_rgba(c) - for c in ('r', 'g', 'b', 'c', 'y', 'm', 'k')] - - fig, axes = plt.subplots(2, 2) - ((ax1, ax2), (ax3, ax4)) = axes # unpack the axes - - - col = collections.LineCollection([spiral], offsets=xyo, - transOffset=ax1.transData) - trans = fig.dpi_scale_trans + transforms.Affine2D().scale(1.0/72.0) - col.set_transform(trans) # the points to pixels transform - # Note: the first argument to the collection initializer - # must be a list of sequences of x,y tuples; we have only - # one sequence, but we still have to put it in a list. - ax1.add_collection(col, autolim=True) - # autolim=True enables autoscaling. For collections with - # offsets like this, it is neither efficient nor accurate, - # but it is good enough to generate a plot that you can use - # as a starting point. If you know beforehand the range of - # x and y that you want to show, it is better to set them - # explicitly, leave out the autolim kwarg (or set it to False), - # and omit the 'ax1.autoscale_view()' call below. - - # Make a transform for the line segments such that their size is - # given in points: - col.set_color(colors) - - ax1.autoscale_view() # See comment above, after ax1.add_collection. - ax1.set_title('LineCollection using offsets') - - - # The same data as above, but fill the curves. - col = collections.PolyCollection([spiral], offsets=xyo, - transOffset=ax2.transData) - trans = transforms.Affine2D().scale(fig.dpi/72.0) - col.set_transform(trans) # the points to pixels transform - ax2.add_collection(col, autolim=True) - col.set_color(colors) - - - ax2.autoscale_view() - ax2.set_title('PolyCollection using offsets') - - # 7-sided regular polygons - - col = collections.RegularPolyCollection(7, - sizes=np.fabs(xx) * 10.0, offsets=xyo, - transOffset=ax3.transData) - trans = transforms.Affine2D().scale(fig.dpi / 72.0) - col.set_transform(trans) # the points to pixels transform - ax3.add_collection(col, autolim=True) - col.set_color(colors) - ax3.autoscale_view() - ax3.set_title('RegularPolyCollection using offsets') - - - # Simulate a series of ocean current profiles, successively - # offset by 0.1 m/s so that they form what is sometimes called - # a "waterfall" plot or a "stagger" plot. - - nverts = 60 - ncurves = 20 - offs = (0.1, 0.0) - - yy = np.linspace(0, 2*np.pi, nverts) - ym = np.amax(yy) - xx = (0.2 + (ym - yy)/ym)**2 * np.cos(yy - 0.4)*0.5 - segs = [] - for i in range(ncurves): - xxx = xx + 0.02*rs.randn(nverts) - curve = list(zip(xxx, yy*100)) - segs.append(curve) - - col = collections.LineCollection(segs, offsets=offs) - ax4.add_collection(col, autolim=True) - col.set_color(colors) - ax4.autoscale_view() - ax4.set_title('Successive data offsets') - ax4.set_xlabel('Zonal velocity component (m/s)') - ax4.set_ylabel('Depth (m)') - # Reverse the y-axis so depth increases downward - ax4.set_ylim(ax4.get_ylim()[::-1]) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/color_cycle.txt b/_sources/examples/api/color_cycle.txt deleted file mode 100644 index 26ab1463af1..00000000000 --- a/_sources/examples/api/color_cycle.txt +++ /dev/null @@ -1,42 +0,0 @@ -.. _api-color_cycle: - -api example code: color_cycle.py -================================ - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/api/color_cycle.py - -:: - - """ - Illustrate the API for changing the cycle of colors used - when plotting multiple lines on a single Axes. - """ - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib as mpl - - yy = np.arange(24) - yy.shape = 6,4 - - mpl.rc('lines', linewidth=4) - - fig = plt.figure() - mpl.rcParams['axes.color_cycle'] = ['r', 'g', 'b', 'c'] - ax = fig.add_subplot(2,1,1) - ax.plot(yy) - ax.set_title('Changed default color cycle to rgbc') - - ax = fig.add_subplot(2,1,2) - ax.set_color_cycle(['c', 'm', 'y', 'k']) - ax.plot(yy) - ax.set_title('This axes only, cycle is cmyk') - - plt.show() - - - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/colorbar_basics.rst.txt b/_sources/examples/api/colorbar_basics.rst.txt deleted file mode 100644 index c2b7c70022e..00000000000 --- a/_sources/examples/api/colorbar_basics.rst.txt +++ /dev/null @@ -1,51 +0,0 @@ -.. _api-colorbar_basics: - -api example code: colorbar_basics.py -==================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/colorbar_basics.py - -:: - - """ - ======== - Colorbar - ======== - - This example shows how to use colorbar by specifying the mappable object (here - the imshow returned object) and the axes to attach the colorbar to. - """ - - import numpy as np - import matplotlib.pyplot as plt - - # setup some generic data - N = 37 - x, y = np.mgrid[:N, :N] - Z = (np.cos(x*0.2) + np.sin(y*0.3)) - - # mask out the negative and positve values, respectively - Zpos = np.ma.masked_less(Z, 0) - Zneg = np.ma.masked_greater(Z, 0) - - fig, (ax1, ax2) = plt.subplots(figsize=(8, 3), ncols=2) - - # plot just the positive data and save the - # color "mappable" object returned by ax1.imshow - pos = ax1.imshow(Zpos, cmap='Blues', interpolation='none') - - # add the colorbar using the figure's method, - # telling which mappable we're talking about and - # which axes object it should be near - fig.colorbar(pos, ax=ax1) - - # repeat everything above for the the negative data - neg = ax2.imshow(Zneg, cmap='Reds_r', interpolation='none') - fig.colorbar(neg, ax=ax2) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/colorbar_only.rst.txt b/_sources/examples/api/colorbar_only.rst.txt deleted file mode 100644 index ce7758b0c63..00000000000 --- a/_sources/examples/api/colorbar_only.rst.txt +++ /dev/null @@ -1,92 +0,0 @@ -.. _api-colorbar_only: - -api example code: colorbar_only.py -================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/colorbar_only.py - -:: - - ''' - ==================== - Customized colorbars - ==================== - - This example shows how to build colorbars without an attached mappable. - ''' - - import matplotlib.pyplot as plt - import matplotlib as mpl - - # Make a figure and axes with dimensions as desired. - fig = plt.figure(figsize=(8, 3)) - ax1 = fig.add_axes([0.05, 0.80, 0.9, 0.15]) - ax2 = fig.add_axes([0.05, 0.475, 0.9, 0.15]) - ax3 = fig.add_axes([0.05, 0.15, 0.9, 0.15]) - - # Set the colormap and norm to correspond to the data for which - # the colorbar will be used. - cmap = mpl.cm.cool - norm = mpl.colors.Normalize(vmin=5, vmax=10) - - # ColorbarBase derives from ScalarMappable and puts a colorbar - # in a specified axes, so it has everything needed for a - # standalone colorbar. There are many more kwargs, but the - # following gives a basic continuous colorbar with ticks - # and labels. - cb1 = mpl.colorbar.ColorbarBase(ax1, cmap=cmap, - norm=norm, - orientation='horizontal') - cb1.set_label('Some Units') - - # The second example illustrates the use of a ListedColormap, a - # BoundaryNorm, and extended ends to show the "over" and "under" - # value colors. - cmap = mpl.colors.ListedColormap(['r', 'g', 'b', 'c']) - cmap.set_over('0.25') - cmap.set_under('0.75') - - # If a ListedColormap is used, the length of the bounds array must be - # one greater than the length of the color list. The bounds must be - # monotonically increasing. - bounds = [1, 2, 4, 7, 8] - norm = mpl.colors.BoundaryNorm(bounds, cmap.N) - cb2 = mpl.colorbar.ColorbarBase(ax2, cmap=cmap, - norm=norm, - # to use 'extend', you must - # specify two extra boundaries: - boundaries=[0] + bounds + [13], - extend='both', - ticks=bounds, # optional - spacing='proportional', - orientation='horizontal') - cb2.set_label('Discrete intervals, some other units') - - # The third example illustrates the use of custom length colorbar - # extensions, used on a colorbar with discrete intervals. - cmap = mpl.colors.ListedColormap([[0., .4, 1.], [0., .8, 1.], - [1., .8, 0.], [1., .4, 0.]]) - cmap.set_over((1., 0., 0.)) - cmap.set_under((0., 0., 1.)) - - bounds = [-1., -.5, 0., .5, 1.] - norm = mpl.colors.BoundaryNorm(bounds, cmap.N) - cb3 = mpl.colorbar.ColorbarBase(ax3, cmap=cmap, - norm=norm, - boundaries=[-10] + bounds + [10], - extend='both', - # Make the length of each extension - # the same as the length of the - # interior colors: - extendfrac='auto', - ticks=bounds, - spacing='uniform', - orientation='horizontal') - cb3.set_label('Custom extension lengths, some other units') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/colorbar_only.txt b/_sources/examples/api/colorbar_only.txt deleted file mode 100644 index ed4b78f9e32..00000000000 --- a/_sources/examples/api/colorbar_only.txt +++ /dev/null @@ -1,88 +0,0 @@ -.. _api-colorbar_only: - -api example code: colorbar_only.py -================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/colorbar_only.py - -:: - - ''' - Make a colorbar as a separate figure. - ''' - - from matplotlib import pyplot - import matplotlib as mpl - - # Make a figure and axes with dimensions as desired. - fig = pyplot.figure(figsize=(8, 3)) - ax1 = fig.add_axes([0.05, 0.80, 0.9, 0.15]) - ax2 = fig.add_axes([0.05, 0.475, 0.9, 0.15]) - ax3 = fig.add_axes([0.05, 0.15, 0.9, 0.15]) - - # Set the colormap and norm to correspond to the data for which - # the colorbar will be used. - cmap = mpl.cm.cool - norm = mpl.colors.Normalize(vmin=5, vmax=10) - - # ColorbarBase derives from ScalarMappable and puts a colorbar - # in a specified axes, so it has everything needed for a - # standalone colorbar. There are many more kwargs, but the - # following gives a basic continuous colorbar with ticks - # and labels. - cb1 = mpl.colorbar.ColorbarBase(ax1, cmap=cmap, - norm=norm, - orientation='horizontal') - cb1.set_label('Some Units') - - # The second example illustrates the use of a ListedColormap, a - # BoundaryNorm, and extended ends to show the "over" and "under" - # value colors. - cmap = mpl.colors.ListedColormap(['r', 'g', 'b', 'c']) - cmap.set_over('0.25') - cmap.set_under('0.75') - - # If a ListedColormap is used, the length of the bounds array must be - # one greater than the length of the color list. The bounds must be - # monotonically increasing. - bounds = [1, 2, 4, 7, 8] - norm = mpl.colors.BoundaryNorm(bounds, cmap.N) - cb2 = mpl.colorbar.ColorbarBase(ax2, cmap=cmap, - norm=norm, - # to use 'extend', you must - # specify two extra boundaries: - boundaries=[0] + bounds + [13], - extend='both', - ticks=bounds, # optional - spacing='proportional', - orientation='horizontal') - cb2.set_label('Discrete intervals, some other units') - - # The third example illustrates the use of custom length colorbar - # extensions, used on a colorbar with discrete intervals. - cmap = mpl.colors.ListedColormap([[0., .4, 1.], [0., .8, 1.], - [1., .8, 0.], [1., .4, 0.]]) - cmap.set_over((1., 0., 0.)) - cmap.set_under((0., 0., 1.)) - - bounds = [-1., -.5, 0., .5, 1.] - norm = mpl.colors.BoundaryNorm(bounds, cmap.N) - cb3 = mpl.colorbar.ColorbarBase(ax3, cmap=cmap, - norm=norm, - boundaries=[-10] + bounds + [10], - extend='both', - # Make the length of each extension - # the same as the length of the - # interior colors: - extendfrac='auto', - ticks=bounds, - spacing='uniform', - orientation='horizontal') - cb3.set_label('Custom extension lengths, some other units') - - pyplot.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/compound_path.rst.txt b/_sources/examples/api/compound_path.rst.txt deleted file mode 100644 index ef7f5bf1583..00000000000 --- a/_sources/examples/api/compound_path.rst.txt +++ /dev/null @@ -1,52 +0,0 @@ -.. _api-compound_path: - -api example code: compound_path.py -================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/compound_path.py - -:: - - """ - ============= - Compound path - ============= - - Make a compound path -- in this case two simple polygons, a rectangle - and a triangle. Use CLOSEPOLY and MOVETO for the different parts of - the compound path - """ - import numpy as np - from matplotlib.path import Path - from matplotlib.patches import PathPatch - import matplotlib.pyplot as plt - - - vertices = [] - codes = [] - - codes = [Path.MOVETO] + [Path.LINETO]*3 + [Path.CLOSEPOLY] - vertices = [(1, 1), (1, 2), (2, 2), (2, 1), (0, 0)] - - codes += [Path.MOVETO] + [Path.LINETO]*2 + [Path.CLOSEPOLY] - vertices += [(4, 4), (5, 5), (5, 4), (0, 0)] - - vertices = np.array(vertices, float) - path = Path(vertices, codes) - - pathpatch = PathPatch(path, facecolor='None', edgecolor='green') - - fig, ax = plt.subplots() - ax.add_patch(pathpatch) - ax.set_title('A compound path') - - ax.dataLim.update_from_data_xy(vertices) - ax.autoscale_view() - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/compound_path.txt b/_sources/examples/api/compound_path.txt deleted file mode 100644 index 0a3a6564ce9..00000000000 --- a/_sources/examples/api/compound_path.txt +++ /dev/null @@ -1,48 +0,0 @@ -.. _api-compound_path: - -api example code: compound_path.py -================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/compound_path.py - -:: - - """ - Make a compund path -- in this case two simple polygons, a rectangle - and a triangle. Use CLOSEOPOLY and MOVETO for the different parts of - the compound path - """ - import numpy as np - from matplotlib.path import Path - from matplotlib.patches import PathPatch - import matplotlib.pyplot as plt - - - vertices = [] - codes = [] - - codes = [Path.MOVETO] + [Path.LINETO]*3 + [Path.CLOSEPOLY] - vertices = [(1, 1), (1, 2), (2, 2), (2, 1), (0, 0)] - - codes += [Path.MOVETO] + [Path.LINETO]*2 + [Path.CLOSEPOLY] - vertices += [(4, 4), (5, 5), (5, 4), (0, 0)] - - vertices = np.array(vertices, float) - path = Path(vertices, codes) - - pathpatch = PathPatch(path, facecolor='None', edgecolor='green') - - fig, ax = plt.subplots() - ax.add_patch(pathpatch) - ax.set_title('A compound path') - - ax.dataLim.update_from_data_xy(vertices) - ax.autoscale_view() - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/custom_projection_example.rst.txt b/_sources/examples/api/custom_projection_example.rst.txt deleted file mode 100644 index 363054e5a4d..00000000000 --- a/_sources/examples/api/custom_projection_example.rst.txt +++ /dev/null @@ -1,491 +0,0 @@ -.. _api-custom_projection_example: - -api example code: custom_projection_example.py -============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/custom_projection_example.py - -:: - - """ - ================= - Custom projection - ================= - - This example showcases the Hammer projection by alleviating many features of - matplotlib. - """ - - - from __future__ import unicode_literals - - import matplotlib - from matplotlib.axes import Axes - from matplotlib.patches import Circle - from matplotlib.path import Path - from matplotlib.ticker import NullLocator, Formatter, FixedLocator - from matplotlib.transforms import Affine2D, BboxTransformTo, Transform - from matplotlib.projections import register_projection - import matplotlib.spines as mspines - import matplotlib.axis as maxis - import numpy as np - - rcParams = matplotlib.rcParams - - # This example projection class is rather long, but it is designed to - # illustrate many features, not all of which will be used every time. - # It is also common to factor out a lot of these methods into common - # code used by a number of projections with similar characteristics - # (see geo.py). - - - class GeoAxes(Axes): - """ - An abstract base class for geographic projections - """ - class ThetaFormatter(Formatter): - """ - Used to format the theta tick labels. Converts the native - unit of radians into degrees and adds a degree symbol. - """ - def __init__(self, round_to=1.0): - self._round_to = round_to - - def __call__(self, x, pos=None): - degrees = (x / np.pi) * 180.0 - degrees = np.round(degrees / self._round_to) * self._round_to - if rcParams['text.usetex'] and not rcParams['text.latex.unicode']: - return r"$%0.0f^\circ$" % degrees - else: - return "%0.0f\u00b0" % degrees - - RESOLUTION = 75 - - def _init_axis(self): - self.xaxis = maxis.XAxis(self) - self.yaxis = maxis.YAxis(self) - # Do not register xaxis or yaxis with spines -- as done in - # Axes._init_axis() -- until GeoAxes.xaxis.cla() works. - # self.spines['geo'].register_axis(self.yaxis) - self._update_transScale() - - def cla(self): - Axes.cla(self) - - self.set_longitude_grid(30) - self.set_latitude_grid(15) - self.set_longitude_grid_ends(75) - self.xaxis.set_minor_locator(NullLocator()) - self.yaxis.set_minor_locator(NullLocator()) - self.xaxis.set_ticks_position('none') - self.yaxis.set_ticks_position('none') - self.yaxis.set_tick_params(label1On=True) - # Why do we need to turn on yaxis tick labels, but - # xaxis tick labels are already on? - - self.grid(rcParams['axes.grid']) - - Axes.set_xlim(self, -np.pi, np.pi) - Axes.set_ylim(self, -np.pi / 2.0, np.pi / 2.0) - - def _set_lim_and_transforms(self): - # A (possibly non-linear) projection on the (already scaled) data - - # There are three important coordinate spaces going on here: - # - # 1. Data space: The space of the data itself - # - # 2. Axes space: The unit rectangle (0, 0) to (1, 1) - # covering the entire plot area. - # - # 3. Display space: The coordinates of the resulting image, - # often in pixels or dpi/inch. - - # This function makes heavy use of the Transform classes in - # ``lib/matplotlib/transforms.py.`` For more information, see - # the inline documentation there. - - # The goal of the first two transformations is to get from the - # data space (in this case longitude and latitude) to axes - # space. It is separated into a non-affine and affine part so - # that the non-affine part does not have to be recomputed when - # a simple affine change to the figure has been made (such as - # resizing the window or changing the dpi). - - # 1) The core transformation from data space into - # rectilinear space defined in the HammerTransform class. - self.transProjection = self._get_core_transform(self.RESOLUTION) - - # 2) The above has an output range that is not in the unit - # rectangle, so scale and translate it so it fits correctly - # within the axes. The peculiar calculations of xscale and - # yscale are specific to a Aitoff-Hammer projection, so don't - # worry about them too much. - self.transAffine = self._get_affine_transform() - - # 3) This is the transformation from axes space to display - # space. - self.transAxes = BboxTransformTo(self.bbox) - - # Now put these 3 transforms together -- from data all the way - # to display coordinates. Using the '+' operator, these - # transforms will be applied "in order". The transforms are - # automatically simplified, if possible, by the underlying - # transformation framework. - self.transData = \ - self.transProjection + \ - self.transAffine + \ - self.transAxes - - # The main data transformation is set up. Now deal with - # gridlines and tick labels. - - # Longitude gridlines and ticklabels. The input to these - # transforms are in display space in x and axes space in y. - # Therefore, the input values will be in range (-xmin, 0), - # (xmax, 1). The goal of these transforms is to go from that - # space to display space. The tick labels will be offset 4 - # pixels from the equator. - self._xaxis_pretransform = \ - Affine2D() \ - .scale(1.0, self._longitude_cap * 2.0) \ - .translate(0.0, -self._longitude_cap) - self._xaxis_transform = \ - self._xaxis_pretransform + \ - self.transData - self._xaxis_text1_transform = \ - Affine2D().scale(1.0, 0.0) + \ - self.transData + \ - Affine2D().translate(0.0, 4.0) - self._xaxis_text2_transform = \ - Affine2D().scale(1.0, 0.0) + \ - self.transData + \ - Affine2D().translate(0.0, -4.0) - - # Now set up the transforms for the latitude ticks. The input to - # these transforms are in axes space in x and display space in - # y. Therefore, the input values will be in range (0, -ymin), - # (1, ymax). The goal of these transforms is to go from that - # space to display space. The tick labels will be offset 4 - # pixels from the edge of the axes ellipse. - yaxis_stretch = Affine2D().scale(np.pi*2, 1).translate(-np.pi, 0) - yaxis_space = Affine2D().scale(1.0, 1.1) - self._yaxis_transform = \ - yaxis_stretch + \ - self.transData - yaxis_text_base = \ - yaxis_stretch + \ - self.transProjection + \ - (yaxis_space + - self.transAffine + - self.transAxes) - self._yaxis_text1_transform = \ - yaxis_text_base + \ - Affine2D().translate(-8.0, 0.0) - self._yaxis_text2_transform = \ - yaxis_text_base + \ - Affine2D().translate(8.0, 0.0) - - def _get_affine_transform(self): - transform = self._get_core_transform(1) - xscale, _ = transform.transform_point((np.pi, 0)) - _, yscale = transform.transform_point((0, np.pi / 2.0)) - return Affine2D() \ - .scale(0.5 / xscale, 0.5 / yscale) \ - .translate(0.5, 0.5) - - def get_xaxis_transform(self, which='grid'): - """ - Override this method to provide a transformation for the - x-axis tick labels. - - Returns a tuple of the form (transform, valign, halign) - """ - if which not in ['tick1', 'tick2', 'grid']: - msg = "'which' must be on of [ 'tick1' | 'tick2' | 'grid' ]" - raise ValueError(msg) - return self._xaxis_transform - - def get_xaxis_text1_transform(self, pad): - return self._xaxis_text1_transform, 'bottom', 'center' - - def get_xaxis_text2_transform(self, pad): - """ - Override this method to provide a transformation for the - secondary x-axis tick labels. - - Returns a tuple of the form (transform, valign, halign) - """ - return self._xaxis_text2_transform, 'top', 'center' - - def get_yaxis_transform(self, which='grid'): - """ - Override this method to provide a transformation for the - y-axis grid and ticks. - """ - if which not in ['tick1', 'tick2', 'grid']: - msg = "'which' must be one of [ 'tick1' | 'tick2' | 'grid' ]" - raise ValueError(msg) - return self._yaxis_transform - - def get_yaxis_text1_transform(self, pad): - """ - Override this method to provide a transformation for the - y-axis tick labels. - - Returns a tuple of the form (transform, valign, halign) - """ - return self._yaxis_text1_transform, 'center', 'right' - - def get_yaxis_text2_transform(self, pad): - """ - Override this method to provide a transformation for the - secondary y-axis tick labels. - - Returns a tuple of the form (transform, valign, halign) - """ - return self._yaxis_text2_transform, 'center', 'left' - - def _gen_axes_patch(self): - """ - Override this method to define the shape that is used for the - background of the plot. It should be a subclass of Patch. - - In this case, it is a Circle (that may be warped by the axes - transform into an ellipse). Any data and gridlines will be - clipped to this shape. - """ - return Circle((0.5, 0.5), 0.5) - - def _gen_axes_spines(self): - return {'geo': mspines.Spine.circular_spine(self, (0.5, 0.5), 0.5)} - - def set_yscale(self, *args, **kwargs): - if args[0] != 'linear': - raise NotImplementedError - - # Prevent the user from applying scales to one or both of the - # axes. In this particular case, scaling the axes wouldn't make - # sense, so we don't allow it. - set_xscale = set_yscale - - # Prevent the user from changing the axes limits. In our case, we - # want to display the whole sphere all the time, so we override - # set_xlim and set_ylim to ignore any input. This also applies to - # interactive panning and zooming in the GUI interfaces. - def set_xlim(self, *args, **kwargs): - raise TypeError("It is not possible to change axes limits " - "for geographic projections. Please consider " - "using Basemap or Cartopy.") - - set_ylim = set_xlim - - def format_coord(self, lon, lat): - """ - Override this method to change how the values are displayed in - the status bar. - - In this case, we want them to be displayed in degrees N/S/E/W. - """ - lon = lon * (180.0 / np.pi) - lat = lat * (180.0 / np.pi) - if lat >= 0.0: - ns = 'N' - else: - ns = 'S' - if lon >= 0.0: - ew = 'E' - else: - ew = 'W' - return '%f\u00b0%s, %f\u00b0%s' % (abs(lat), ns, abs(lon), ew) - - def set_longitude_grid(self, degrees): - """ - Set the number of degrees between each longitude grid. - - This is an example method that is specific to this projection - class -- it provides a more convenient interface to set the - ticking than set_xticks would. - """ - number = (360.0 / degrees) + 1 - self.xaxis.set_major_locator( - FixedLocator( - np.linspace(-np.pi, np.pi, number, True)[1:-1])) - self.xaxis.set_major_formatter(self.ThetaFormatter(degrees)) - - def set_latitude_grid(self, degrees): - """ - Set the number of degrees between each longitude grid. - - This is an example method that is specific to this projection - class -- it provides a more convenient interface than - set_yticks would. - """ - number = (180.0 / degrees) + 1 - self.yaxis.set_major_locator( - FixedLocator( - np.linspace(-np.pi / 2.0, np.pi / 2.0, number, True)[1:-1])) - self.yaxis.set_major_formatter(self.ThetaFormatter(degrees)) - - def set_longitude_grid_ends(self, degrees): - """ - Set the latitude(s) at which to stop drawing the longitude grids. - - Often, in geographic projections, you wouldn't want to draw - longitude gridlines near the poles. This allows the user to - specify the degree at which to stop drawing longitude grids. - - This is an example method that is specific to this projection - class -- it provides an interface to something that has no - analogy in the base Axes class. - """ - self._longitude_cap = degrees * (np.pi / 180.0) - self._xaxis_pretransform \ - .clear() \ - .scale(1.0, self._longitude_cap * 2.0) \ - .translate(0.0, -self._longitude_cap) - - def get_data_ratio(self): - """ - Return the aspect ratio of the data itself. - - This method should be overridden by any Axes that have a - fixed data ratio. - """ - return 1.0 - - # Interactive panning and zooming is not supported with this projection, - # so we override all of the following methods to disable it. - def can_zoom(self): - """ - Return *True* if this axes supports the zoom box button functionality. - This axes object does not support interactive zoom box. - """ - return False - - def can_pan(self): - """ - Return *True* if this axes supports the pan/zoom button functionality. - This axes object does not support interactive pan/zoom. - """ - return False - - def start_pan(self, x, y, button): - pass - - def end_pan(self): - pass - - def drag_pan(self, button, key, x, y): - pass - - - class HammerAxes(GeoAxes): - """ - A custom class for the Aitoff-Hammer projection, an equal-area map - projection. - - https://en.wikipedia.org/wiki/Hammer_projection - """ - - # The projection must specify a name. This will be used by the - # user to select the projection, - # i.e. ``subplot(111, projection='custom_hammer')``. - name = 'custom_hammer' - - class HammerTransform(Transform): - """ - The base Hammer transform. - """ - input_dims = 2 - output_dims = 2 - is_separable = False - - def __init__(self, resolution): - """ - Create a new Hammer transform. Resolution is the number of steps - to interpolate between each input line segment to approximate its - path in curved Hammer space. - """ - Transform.__init__(self) - self._resolution = resolution - - def transform_non_affine(self, ll): - longitude = ll[:, 0:1] - latitude = ll[:, 1:2] - - # Pre-compute some values - half_long = longitude / 2.0 - cos_latitude = np.cos(latitude) - sqrt2 = np.sqrt(2.0) - - alpha = np.sqrt(1.0 + cos_latitude * np.cos(half_long)) - x = (2.0 * sqrt2) * (cos_latitude * np.sin(half_long)) / alpha - y = (sqrt2 * np.sin(latitude)) / alpha - return np.concatenate((x, y), 1) - transform_non_affine.__doc__ = Transform.transform_non_affine.__doc__ - - def transform_path_non_affine(self, path): - # vertices = path.vertices - ipath = path.interpolated(self._resolution) - return Path(self.transform(ipath.vertices), ipath.codes) - transform_path_non_affine.__doc__ = \ - Transform.transform_path_non_affine.__doc__ - - def inverted(self): - return HammerAxes.InvertedHammerTransform(self._resolution) - inverted.__doc__ = Transform.inverted.__doc__ - - class InvertedHammerTransform(Transform): - input_dims = 2 - output_dims = 2 - is_separable = False - - def __init__(self, resolution): - Transform.__init__(self) - self._resolution = resolution - - def transform_non_affine(self, xy): - x = xy[:, 0:1] - y = xy[:, 1:2] - - quarter_x = 0.25 * x - half_y = 0.5 * y - z = np.sqrt(1.0 - quarter_x*quarter_x - half_y*half_y) - longitude = 2 * np.arctan((z*x) / (2.0 * (2.0*z*z - 1.0))) - latitude = np.arcsin(y*z) - return np.concatenate((longitude, latitude), 1) - transform_non_affine.__doc__ = Transform.transform_non_affine.__doc__ - - def inverted(self): - return HammerAxes.HammerTransform(self._resolution) - inverted.__doc__ = Transform.inverted.__doc__ - - def __init__(self, *args, **kwargs): - self._longitude_cap = np.pi / 2.0 - GeoAxes.__init__(self, *args, **kwargs) - self.set_aspect(0.5, adjustable='box', anchor='C') - self.cla() - - def _get_core_transform(self, resolution): - return self.HammerTransform(resolution) - - - # Now register the projection with matplotlib so the user can select - # it. - register_projection(HammerAxes) - - - if __name__ == '__main__': - import matplotlib.pyplot as plt - # Now make a simple example using the custom projection. - plt.subplot(111, projection="custom_hammer") - p = plt.plot([-1, 1, 1], [-1, -1, 1], "o-") - plt.grid(True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/custom_projection_example.txt b/_sources/examples/api/custom_projection_example.txt deleted file mode 100644 index 61526e45dcb..00000000000 --- a/_sources/examples/api/custom_projection_example.txt +++ /dev/null @@ -1,496 +0,0 @@ -.. _api-custom_projection_example: - -api example code: custom_projection_example.py -============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/custom_projection_example.py - -:: - - from __future__ import unicode_literals - - import matplotlib - from matplotlib.axes import Axes - from matplotlib.patches import Circle - from matplotlib.path import Path - from matplotlib.ticker import NullLocator, Formatter, FixedLocator - from matplotlib.transforms import Affine2D, BboxTransformTo, Transform - from matplotlib.projections import register_projection - import matplotlib.spines as mspines - import matplotlib.axis as maxis - - import numpy as np - - # This example projection class is rather long, but it is designed to - # illustrate many features, not all of which will be used every time. - # It is also common to factor out a lot of these methods into common - # code used by a number of projections with similar characteristics - # (see geo.py). - - - class HammerAxes(Axes): - """ - A custom class for the Aitoff-Hammer projection, an equal-area map - projection. - - http://en.wikipedia.org/wiki/Hammer_projection - """ - # The projection must specify a name. This will be used be the - # user to select the projection, i.e. ``subplot(111, - # projection='custom_hammer')``. - name = 'custom_hammer' - - def __init__(self, *args, **kwargs): - Axes.__init__(self, *args, **kwargs) - self.set_aspect(0.5, adjustable='box', anchor='C') - self.cla() - - def _init_axis(self): - self.xaxis = maxis.XAxis(self) - self.yaxis = maxis.YAxis(self) - # Do not register xaxis or yaxis with spines -- as done in - # Axes._init_axis() -- until HammerAxes.xaxis.cla() works. - #self.spines['hammer'].register_axis(self.yaxis) - self._update_transScale() - - def cla(self): - """ - Override to set up some reasonable defaults. - """ - # Don't forget to call the base class - Axes.cla(self) - - # Set up a default grid spacing - self.set_longitude_grid(30) - self.set_latitude_grid(15) - self.set_longitude_grid_ends(75) - - # Turn off minor ticking altogether - self.xaxis.set_minor_locator(NullLocator()) - self.yaxis.set_minor_locator(NullLocator()) - - # Do not display ticks -- we only want gridlines and text - self.xaxis.set_ticks_position('none') - self.yaxis.set_ticks_position('none') - - # The limits on this projection are fixed -- they are not to - # be changed by the user. This makes the math in the - # transformation itself easier, and since this is a toy - # example, the easier, the better. - Axes.set_xlim(self, -np.pi, np.pi) - Axes.set_ylim(self, -np.pi / 2.0, np.pi / 2.0) - - def _set_lim_and_transforms(self): - """ - This is called once when the plot is created to set up all the - transforms for the data, text and grids. - """ - # There are three important coordinate spaces going on here: - # - # 1. Data space: The space of the data itself - # - # 2. Axes space: The unit rectangle (0, 0) to (1, 1) - # covering the entire plot area. - # - # 3. Display space: The coordinates of the resulting image, - # often in pixels or dpi/inch. - - # This function makes heavy use of the Transform classes in - # ``lib/matplotlib/transforms.py.`` For more information, see - # the inline documentation there. - - # The goal of the first two transformations is to get from the - # data space (in this case longitude and latitude) to axes - # space. It is separated into a non-affine and affine part so - # that the non-affine part does not have to be recomputed when - # a simple affine change to the figure has been made (such as - # resizing the window or changing the dpi). - - # 1) The core transformation from data space into - # rectilinear space defined in the HammerTransform class. - self.transProjection = self.HammerTransform() - - # 2) The above has an output range that is not in the unit - # rectangle, so scale and translate it so it fits correctly - # within the axes. The peculiar calculations of xscale and - # yscale are specific to a Aitoff-Hammer projection, so don't - # worry about them too much. - xscale = 2.0 * np.sqrt(2.0) * np.sin(0.5 * np.pi) - yscale = np.sqrt(2.0) * np.sin(0.5 * np.pi) - self.transAffine = Affine2D() \ - .scale(0.5 / xscale, 0.5 / yscale) \ - .translate(0.5, 0.5) - - # 3) This is the transformation from axes space to display - # space. - self.transAxes = BboxTransformTo(self.bbox) - - # Now put these 3 transforms together -- from data all the way - # to display coordinates. Using the '+' operator, these - # transforms will be applied "in order". The transforms are - # automatically simplified, if possible, by the underlying - # transformation framework. - self.transData = \ - self.transProjection + \ - self.transAffine + \ - self.transAxes - - # The main data transformation is set up. Now deal with - # gridlines and tick labels. - - # Longitude gridlines and ticklabels. The input to these - # transforms are in display space in x and axes space in y. - # Therefore, the input values will be in range (-xmin, 0), - # (xmax, 1). The goal of these transforms is to go from that - # space to display space. The tick labels will be offset 4 - # pixels from the equator. - self._xaxis_pretransform = \ - Affine2D() \ - .scale(1.0, np.pi) \ - .translate(0.0, -np.pi) - self._xaxis_transform = \ - self._xaxis_pretransform + \ - self.transData - self._xaxis_text1_transform = \ - Affine2D().scale(1.0, 0.0) + \ - self.transData + \ - Affine2D().translate(0.0, 4.0) - self._xaxis_text2_transform = \ - Affine2D().scale(1.0, 0.0) + \ - self.transData + \ - Affine2D().translate(0.0, -4.0) - - # Now set up the transforms for the latitude ticks. The input to - # these transforms are in axes space in x and display space in - # y. Therefore, the input values will be in range (0, -ymin), - # (1, ymax). The goal of these transforms is to go from that - # space to display space. The tick labels will be offset 4 - # pixels from the edge of the axes ellipse. - yaxis_stretch = Affine2D().scale(2*np.pi, 1.0).translate(-np.pi, 0.0) - yaxis_space = Affine2D().scale(1.0, 1.1) - self._yaxis_transform = \ - yaxis_stretch + \ - self.transData - yaxis_text_base = \ - yaxis_stretch + \ - self.transProjection + \ - (yaxis_space + - self.transAffine + - self.transAxes) - self._yaxis_text1_transform = \ - yaxis_text_base + \ - Affine2D().translate(-8.0, 0.0) - self._yaxis_text2_transform = \ - yaxis_text_base + \ - Affine2D().translate(8.0, 0.0) - - def get_xaxis_transform(self, which='grid'): - """ - Override this method to provide a transformation for the - x-axis grid and ticks. - """ - assert which in ['tick1', 'tick2', 'grid'] - return self._xaxis_transform - - def get_xaxis_text1_transform(self, pixelPad): - """ - Override this method to provide a transformation for the - x-axis tick labels. - - Returns a tuple of the form (transform, valign, halign) - """ - return self._xaxis_text1_transform, 'bottom', 'center' - - def get_xaxis_text2_transform(self, pixelPad): - """ - Override this method to provide a transformation for the - secondary x-axis tick labels. - - Returns a tuple of the form (transform, valign, halign) - """ - return self._xaxis_text2_transform, 'top', 'center' - - def get_yaxis_transform(self, which='grid'): - """ - Override this method to provide a transformation for the - y-axis grid and ticks. - """ - assert which in ['tick1', 'tick2', 'grid'] - return self._yaxis_transform - - def get_yaxis_text1_transform(self, pixelPad): - """ - Override this method to provide a transformation for the - y-axis tick labels. - - Returns a tuple of the form (transform, valign, halign) - """ - return self._yaxis_text1_transform, 'center', 'right' - - def get_yaxis_text2_transform(self, pixelPad): - """ - Override this method to provide a transformation for the - secondary y-axis tick labels. - - Returns a tuple of the form (transform, valign, halign) - """ - return self._yaxis_text2_transform, 'center', 'left' - - def _gen_axes_patch(self): - """ - Override this method to define the shape that is used for the - background of the plot. It should be a subclass of Patch. - - In this case, it is a Circle (that may be warped by the axes - transform into an ellipse). Any data and gridlines will be - clipped to this shape. - """ - return Circle((0.5, 0.5), 0.5) - - def _gen_axes_spines(self): - return {'custom_hammer': mspines.Spine.circular_spine(self, - (0.5, 0.5), 0.5)} - - # Prevent the user from applying scales to one or both of the - # axes. In this particular case, scaling the axes wouldn't make - # sense, so we don't allow it. - def set_xscale(self, *args, **kwargs): - if args[0] != 'linear': - raise NotImplementedError - Axes.set_xscale(self, *args, **kwargs) - - def set_yscale(self, *args, **kwargs): - if args[0] != 'linear': - raise NotImplementedError - Axes.set_yscale(self, *args, **kwargs) - - # Prevent the user from changing the axes limits. In our case, we - # want to display the whole sphere all the time, so we override - # set_xlim and set_ylim to ignore any input. This also applies to - # interactive panning and zooming in the GUI interfaces. - def set_xlim(self, *args, **kwargs): - Axes.set_xlim(self, -np.pi, np.pi) - Axes.set_ylim(self, -np.pi / 2.0, np.pi / 2.0) - set_ylim = set_xlim - - def format_coord(self, lon, lat): - """ - Override this method to change how the values are displayed in - the status bar. - - In this case, we want them to be displayed in degrees N/S/E/W. - """ - lon = np.degrees(lon) - lat = np.degrees(lat) - if lat >= 0.0: - ns = 'N' - else: - ns = 'S' - if lon >= 0.0: - ew = 'E' - else: - ew = 'W' - # \u00b0 : degree symbol - return '%f\u00b0%s, %f\u00b0%s' % (abs(lat), ns, abs(lon), ew) - - class DegreeFormatter(Formatter): - """ - This is a custom formatter that converts the native unit of - radians into (truncated) degrees and adds a degree symbol. - """ - - def __init__(self, round_to=1.0): - self._round_to = round_to - - def __call__(self, x, pos=None): - degrees = round(np.degrees(x) / self._round_to) * self._round_to - # \u00b0 : degree symbol - return "%d\u00b0" % degrees - - def set_longitude_grid(self, degrees): - """ - Set the number of degrees between each longitude grid. - - This is an example method that is specific to this projection - class -- it provides a more convenient interface to set the - ticking than set_xticks would. - """ - # Set up a FixedLocator at each of the points, evenly spaced - # by degrees. - number = (360.0 / degrees) + 1 - self.xaxis.set_major_locator( - plt.FixedLocator( - np.linspace(-np.pi, np.pi, number, True)[1:-1])) - # Set the formatter to display the tick labels in degrees, - # rather than radians. - self.xaxis.set_major_formatter(self.DegreeFormatter(degrees)) - - def set_latitude_grid(self, degrees): - """ - Set the number of degrees between each longitude grid. - - This is an example method that is specific to this projection - class -- it provides a more convenient interface than - set_yticks would. - """ - # Set up a FixedLocator at each of the points, evenly spaced - # by degrees. - number = (180.0 / degrees) + 1 - self.yaxis.set_major_locator( - FixedLocator( - np.linspace(-np.pi / 2.0, np.pi / 2.0, number, True)[1:-1])) - # Set the formatter to display the tick labels in degrees, - # rather than radians. - self.yaxis.set_major_formatter(self.DegreeFormatter(degrees)) - - def set_longitude_grid_ends(self, degrees): - """ - Set the latitude(s) at which to stop drawing the longitude grids. - - Often, in geographic projections, you wouldn't want to draw - longitude gridlines near the poles. This allows the user to - specify the degree at which to stop drawing longitude grids. - - This is an example method that is specific to this projection - class -- it provides an interface to something that has no - analogy in the base Axes class. - """ - longitude_cap = np.radians(degrees) - # Change the xaxis gridlines transform so that it draws from - # -degrees to degrees, rather than -pi to pi. - self._xaxis_pretransform \ - .clear() \ - .scale(1.0, longitude_cap * 2.0) \ - .translate(0.0, -longitude_cap) - - def get_data_ratio(self): - """ - Return the aspect ratio of the data itself. - - This method should be overridden by any Axes that have a - fixed data ratio. - """ - return 1.0 - - # Interactive panning and zooming is not supported with this projection, - # so we override all of the following methods to disable it. - def can_zoom(self): - """ - Return True if this axes support the zoom box - """ - return False - - def start_pan(self, x, y, button): - pass - - def end_pan(self): - pass - - def drag_pan(self, button, key, x, y): - pass - - # Now, the transforms themselves. - - class HammerTransform(Transform): - """ - The base Hammer transform. - """ - input_dims = 2 - output_dims = 2 - is_separable = False - - def transform_non_affine(self, ll): - """ - Override the transform_non_affine method to implement the custom - transform. - - The input and output are Nx2 numpy arrays. - """ - longitude = ll[:, 0:1] - latitude = ll[:, 1:2] - - # Pre-compute some values - half_long = longitude / 2.0 - cos_latitude = np.cos(latitude) - sqrt2 = np.sqrt(2.0) - - alpha = 1.0 + cos_latitude * np.cos(half_long) - x = (2.0 * sqrt2) * (cos_latitude * np.sin(half_long)) / alpha - y = (sqrt2 * np.sin(latitude)) / alpha - return np.concatenate((x, y), 1) - - # This is where things get interesting. With this projection, - # straight lines in data space become curves in display space. - # This is done by interpolating new values between the input - # values of the data. Since ``transform`` must not return a - # differently-sized array, any transform that requires - # changing the length of the data array must happen within - # ``transform_path``. - def transform_path_non_affine(self, path): - ipath = path.interpolated(path._interpolation_steps) - return Path(self.transform(ipath.vertices), ipath.codes) - transform_path_non_affine.__doc__ = \ - Transform.transform_path_non_affine.__doc__ - - if matplotlib.__version__ < '1.2': - # Note: For compatibility with matplotlib v1.1 and older, you'll - # need to explicitly implement a ``transform`` method as well. - # Otherwise a ``NotImplementedError`` will be raised. This isn't - # necessary for v1.2 and newer, however. - transform = transform_non_affine - - # Similarly, we need to explicitly override ``transform_path`` if - # compatibility with older matplotlib versions is needed. With v1.2 - # and newer, only overriding the ``transform_path_non_affine`` - # method is sufficient. - transform_path = transform_path_non_affine - transform_path.__doc__ = Transform.transform_path.__doc__ - - def inverted(self): - return HammerAxes.InvertedHammerTransform() - inverted.__doc__ = Transform.inverted.__doc__ - - class InvertedHammerTransform(Transform): - input_dims = 2 - output_dims = 2 - is_separable = False - - def transform_non_affine(self, xy): - x = xy[:, 0:1] - y = xy[:, 1:2] - - quarter_x = 0.25 * x - half_y = 0.5 * y - z = np.sqrt(1.0 - quarter_x*quarter_x - half_y*half_y) - longitude = 2*np.arctan((z*x)/(2.0*(2.0*z*z - 1.0))) - latitude = np.arcsin(y*z) - return np.concatenate((longitude, latitude), 1) - transform_non_affine.__doc__ = Transform.transform_non_affine.__doc__ - - # As before, we need to implement the "transform" method for - # compatibility with matplotlib v1.1 and older. - if matplotlib.__version__ < '1.2': - transform = transform_non_affine - - def inverted(self): - # The inverse of the inverse is the original transform... ;) - return HammerAxes.HammerTransform() - inverted.__doc__ = Transform.inverted.__doc__ - - # Now register the projection with matplotlib so the user can select - # it. - register_projection(HammerAxes) - - if __name__ == '__main__': - import matplotlib.pyplot as plt - # Now make a simple example using the custom projection. - plt.subplot(111, projection="custom_hammer") - p = plt.plot([-1, 1, 1], [-1, -1, 1], "o-") - plt.grid(True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/custom_scale_example.rst.txt b/_sources/examples/api/custom_scale_example.rst.txt deleted file mode 100644 index 384edb73a6c..00000000000 --- a/_sources/examples/api/custom_scale_example.rst.txt +++ /dev/null @@ -1,200 +0,0 @@ -.. _api-custom_scale_example: - -api example code: custom_scale_example.py -========================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/custom_scale_example.py - -:: - - """ - ============ - Custom scale - ============ - - This example showcases how to create a custom scale, by implementing the - scaling use for latitude data in a Mercator Projection. - """ - - - from __future__ import unicode_literals - - import numpy as np - from numpy import ma - from matplotlib import scale as mscale - from matplotlib import transforms as mtransforms - from matplotlib.ticker import Formatter, FixedLocator - from matplotlib import rcParams - - - # BUG: this example fails with any other setting of axisbelow - rcParams['axes.axisbelow'] = False - - - class MercatorLatitudeScale(mscale.ScaleBase): - """ - Scales data in range -pi/2 to pi/2 (-90 to 90 degrees) using - the system used to scale latitudes in a Mercator projection. - - The scale function: - ln(tan(y) + sec(y)) - - The inverse scale function: - atan(sinh(y)) - - Since the Mercator scale tends to infinity at +/- 90 degrees, - there is user-defined threshold, above and below which nothing - will be plotted. This defaults to +/- 85 degrees. - - source: - http://en.wikipedia.org/wiki/Mercator_projection - """ - - # The scale class must have a member ``name`` that defines the - # string used to select the scale. For example, - # ``gca().set_yscale("mercator")`` would be used to select this - # scale. - name = 'mercator' - - def __init__(self, axis, **kwargs): - """ - Any keyword arguments passed to ``set_xscale`` and - ``set_yscale`` will be passed along to the scale's - constructor. - - thresh: The degree above which to crop the data. - """ - mscale.ScaleBase.__init__(self) - thresh = kwargs.pop("thresh", np.radians(85)) - if thresh >= np.pi / 2.0: - raise ValueError("thresh must be less than pi/2") - self.thresh = thresh - - def get_transform(self): - """ - Override this method to return a new instance that does the - actual transformation of the data. - - The MercatorLatitudeTransform class is defined below as a - nested class of this one. - """ - return self.MercatorLatitudeTransform(self.thresh) - - def set_default_locators_and_formatters(self, axis): - """ - Override to set up the locators and formatters to use with the - scale. This is only required if the scale requires custom - locators and formatters. Writing custom locators and - formatters is rather outside the scope of this example, but - there are many helpful examples in ``ticker.py``. - - In our case, the Mercator example uses a fixed locator from - -90 to 90 degrees and a custom formatter class to put convert - the radians to degrees and put a degree symbol after the - value:: - """ - class DegreeFormatter(Formatter): - def __call__(self, x, pos=None): - # \u00b0 : degree symbol - return "%d\u00b0" % (np.degrees(x)) - - axis.set_major_locator(FixedLocator( - np.radians(np.arange(-90, 90, 10)))) - axis.set_major_formatter(DegreeFormatter()) - axis.set_minor_formatter(DegreeFormatter()) - - def limit_range_for_scale(self, vmin, vmax, minpos): - """ - Override to limit the bounds of the axis to the domain of the - transform. In the case of Mercator, the bounds should be - limited to the threshold that was passed in. Unlike the - autoscaling provided by the tick locators, this range limiting - will always be adhered to, whether the axis range is set - manually, determined automatically or changed through panning - and zooming. - """ - return max(vmin, -self.thresh), min(vmax, self.thresh) - - class MercatorLatitudeTransform(mtransforms.Transform): - # There are two value members that must be defined. - # ``input_dims`` and ``output_dims`` specify number of input - # dimensions and output dimensions to the transformation. - # These are used by the transformation framework to do some - # error checking and prevent incompatible transformations from - # being connected together. When defining transforms for a - # scale, which are, by definition, separable and have only one - # dimension, these members should always be set to 1. - input_dims = 1 - output_dims = 1 - is_separable = True - - def __init__(self, thresh): - mtransforms.Transform.__init__(self) - self.thresh = thresh - - def transform_non_affine(self, a): - """ - This transform takes an Nx1 ``numpy`` array and returns a - transformed copy. Since the range of the Mercator scale - is limited by the user-specified threshold, the input - array must be masked to contain only valid values. - ``matplotlib`` will handle masked arrays and remove the - out-of-range data from the plot. Importantly, the - ``transform`` method *must* return an array that is the - same shape as the input array, since these values need to - remain synchronized with values in the other dimension. - """ - masked = ma.masked_where((a < -self.thresh) | (a > self.thresh), a) - if masked.mask.any(): - return ma.log(np.abs(ma.tan(masked) + 1.0 / ma.cos(masked))) - else: - return np.log(np.abs(np.tan(a) + 1.0 / np.cos(a))) - - def inverted(self): - """ - Override this method so matplotlib knows how to get the - inverse transform for this transform. - """ - return MercatorLatitudeScale.InvertedMercatorLatitudeTransform( - self.thresh) - - class InvertedMercatorLatitudeTransform(mtransforms.Transform): - input_dims = 1 - output_dims = 1 - is_separable = True - - def __init__(self, thresh): - mtransforms.Transform.__init__(self) - self.thresh = thresh - - def transform_non_affine(self, a): - return np.arctan(np.sinh(a)) - - def inverted(self): - return MercatorLatitudeScale.MercatorLatitudeTransform(self.thresh) - - # Now that the Scale class has been defined, it must be registered so - # that ``matplotlib`` can find it. - mscale.register_scale(MercatorLatitudeScale) - - - if __name__ == '__main__': - import matplotlib.pyplot as plt - - t = np.arange(-180.0, 180.0, 0.1) - s = np.radians(t)/2. - - plt.plot(t, s, '-', lw=2) - plt.gca().set_yscale('mercator') - - plt.xlabel('Longitude') - plt.ylabel('Latitude') - plt.title('Mercator: Projection of the Oppressor') - plt.grid(True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/custom_scale_example.txt b/_sources/examples/api/custom_scale_example.txt deleted file mode 100644 index 036bdc53b5f..00000000000 --- a/_sources/examples/api/custom_scale_example.txt +++ /dev/null @@ -1,185 +0,0 @@ -.. _api-custom_scale_example: - -api example code: custom_scale_example.py -========================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/custom_scale_example.py - -:: - - from __future__ import unicode_literals - - import numpy as np - from numpy import ma - from matplotlib import scale as mscale - from matplotlib import transforms as mtransforms - from matplotlib.ticker import Formatter, FixedLocator - - - class MercatorLatitudeScale(mscale.ScaleBase): - """ - Scales data in range -pi/2 to pi/2 (-90 to 90 degrees) using - the system used to scale latitudes in a Mercator projection. - - The scale function: - ln(tan(y) + sec(y)) - - The inverse scale function: - atan(sinh(y)) - - Since the Mercator scale tends to infinity at +/- 90 degrees, - there is user-defined threshold, above and below which nothing - will be plotted. This defaults to +/- 85 degrees. - - source: - http://en.wikipedia.org/wiki/Mercator_projection - """ - - # The scale class must have a member ``name`` that defines the - # string used to select the scale. For example, - # ``gca().set_yscale("mercator")`` would be used to select this - # scale. - name = 'mercator' - - def __init__(self, axis, **kwargs): - """ - Any keyword arguments passed to ``set_xscale`` and - ``set_yscale`` will be passed along to the scale's - constructor. - - thresh: The degree above which to crop the data. - """ - mscale.ScaleBase.__init__(self) - thresh = kwargs.pop("thresh", np.radians(85)) - if thresh >= np.pi / 2.0: - raise ValueError("thresh must be less than pi/2") - self.thresh = thresh - - def get_transform(self): - """ - Override this method to return a new instance that does the - actual transformation of the data. - - The MercatorLatitudeTransform class is defined below as a - nested class of this one. - """ - return self.MercatorLatitudeTransform(self.thresh) - - def set_default_locators_and_formatters(self, axis): - """ - Override to set up the locators and formatters to use with the - scale. This is only required if the scale requires custom - locators and formatters. Writing custom locators and - formatters is rather outside the scope of this example, but - there are many helpful examples in ``ticker.py``. - - In our case, the Mercator example uses a fixed locator from - -90 to 90 degrees and a custom formatter class to put convert - the radians to degrees and put a degree symbol after the - value:: - """ - class DegreeFormatter(Formatter): - def __call__(self, x, pos=None): - # \u00b0 : degree symbol - return "%d\u00b0" % (np.degrees(x)) - - axis.set_major_locator(FixedLocator( - np.radians(np.arange(-90, 90, 10)))) - axis.set_major_formatter(DegreeFormatter()) - axis.set_minor_formatter(DegreeFormatter()) - - def limit_range_for_scale(self, vmin, vmax, minpos): - """ - Override to limit the bounds of the axis to the domain of the - transform. In the case of Mercator, the bounds should be - limited to the threshold that was passed in. Unlike the - autoscaling provided by the tick locators, this range limiting - will always be adhered to, whether the axis range is set - manually, determined automatically or changed through panning - and zooming. - """ - return max(vmin, -self.thresh), min(vmax, self.thresh) - - class MercatorLatitudeTransform(mtransforms.Transform): - # There are two value members that must be defined. - # ``input_dims`` and ``output_dims`` specify number of input - # dimensions and output dimensions to the transformation. - # These are used by the transformation framework to do some - # error checking and prevent incompatible transformations from - # being connected together. When defining transforms for a - # scale, which are, by definition, separable and have only one - # dimension, these members should always be set to 1. - input_dims = 1 - output_dims = 1 - is_separable = True - - def __init__(self, thresh): - mtransforms.Transform.__init__(self) - self.thresh = thresh - - def transform_non_affine(self, a): - """ - This transform takes an Nx1 ``numpy`` array and returns a - transformed copy. Since the range of the Mercator scale - is limited by the user-specified threshold, the input - array must be masked to contain only valid values. - ``matplotlib`` will handle masked arrays and remove the - out-of-range data from the plot. Importantly, the - ``transform`` method *must* return an array that is the - same shape as the input array, since these values need to - remain synchronized with values in the other dimension. - """ - masked = ma.masked_where((a < -self.thresh) | (a > self.thresh), a) - if masked.mask.any(): - return ma.log(np.abs(ma.tan(masked) + 1.0 / ma.cos(masked))) - else: - return np.log(np.abs(np.tan(a) + 1.0 / np.cos(a))) - - def inverted(self): - """ - Override this method so matplotlib knows how to get the - inverse transform for this transform. - """ - return MercatorLatitudeScale.InvertedMercatorLatitudeTransform( - self.thresh) - - class InvertedMercatorLatitudeTransform(mtransforms.Transform): - input_dims = 1 - output_dims = 1 - is_separable = True - - def __init__(self, thresh): - mtransforms.Transform.__init__(self) - self.thresh = thresh - - def transform_non_affine(self, a): - return np.arctan(np.sinh(a)) - - def inverted(self): - return MercatorLatitudeScale.MercatorLatitudeTransform(self.thresh) - - # Now that the Scale class has been defined, it must be registered so - # that ``matplotlib`` can find it. - mscale.register_scale(MercatorLatitudeScale) - - - if __name__ == '__main__': - import matplotlib.pyplot as plt - - t = np.arange(-180.0, 180.0, 0.1) - s = np.radians(t)/2. - - plt.plot(t, s, '-', lw=2) - plt.gca().set_yscale('mercator') - - plt.xlabel('Longitude') - plt.ylabel('Latitude') - plt.title('Mercator: Projection of the Oppressor') - plt.grid(True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/date_demo.rst.txt b/_sources/examples/api/date_demo.rst.txt deleted file mode 100644 index 2924c5d635d..00000000000 --- a/_sources/examples/api/date_demo.rst.txt +++ /dev/null @@ -1,80 +0,0 @@ -.. _api-date_demo: - -api example code: date_demo.py -============================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/date_demo.py - -:: - - """ - ================ - Date tick labels - ================ - - Show how to make date plots in matplotlib using date tick locators and - formatters. See major_minor_demo1.py for more information on - controlling major and minor ticks - - All matplotlib date plotting is done by converting date instances into - days since the 0001-01-01 UTC. The conversion, tick locating and - formatting is done behind the scenes so this is most transparent to - you. The dates module provides several converter functions date2num - and num2date - - """ - import datetime - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.dates as mdates - import matplotlib.cbook as cbook - - years = mdates.YearLocator() # every year - months = mdates.MonthLocator() # every month - yearsFmt = mdates.DateFormatter('%Y') - - # load a numpy record array from yahoo csv data with fields date, - # open, close, volume, adj_close from the mpl-data/example directory. - # The record array stores python datetime.date as an object array in - # the date column - datafile = cbook.get_sample_data('goog.npy') - try: - # Python3 cannot load python2 .npy files with datetime(object) arrays - # unless the encoding is set to bytes. However this option was - # not added until numpy 1.10 so this example will only work with - # python 2 or with numpy 1.10 and later. - r = np.load(datafile, encoding='bytes').view(np.recarray) - except TypeError: - r = np.load(datafile).view(np.recarray) - - fig, ax = plt.subplots() - ax.plot(r.date, r.adj_close) - - - # format the ticks - ax.xaxis.set_major_locator(years) - ax.xaxis.set_major_formatter(yearsFmt) - ax.xaxis.set_minor_locator(months) - - datemin = datetime.date(r.date.min().year, 1, 1) - datemax = datetime.date(r.date.max().year + 1, 1, 1) - ax.set_xlim(datemin, datemax) - - - # format the coords message box - def price(x): - return '$%1.2f' % x - ax.format_xdata = mdates.DateFormatter('%Y-%m-%d') - ax.format_ydata = price - ax.grid(True) - - # rotates and right aligns the x labels, and moves the bottom of the - # axes up to make room for them - fig.autofmt_xdate() - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/date_demo.txt b/_sources/examples/api/date_demo.txt deleted file mode 100644 index b08d87e5edc..00000000000 --- a/_sources/examples/api/date_demo.txt +++ /dev/null @@ -1,77 +0,0 @@ -.. _api-date_demo: - -api example code: date_demo.py -============================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/date_demo.py - -:: - - #!/usr/bin/env python - """ - Show how to make date plots in matplotlib using date tick locators and - formatters. See major_minor_demo1.py for more information on - controlling major and minor ticks - - All matplotlib date plotting is done by converting date instances into - days since the 0001-01-01 UTC. The conversion, tick locating and - formatting is done behind the scenes so this is most transparent to - you. The dates module provides several converter functions date2num - and num2date - - """ - import datetime - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.dates as mdates - import matplotlib.cbook as cbook - - years = mdates.YearLocator() # every year - months = mdates.MonthLocator() # every month - yearsFmt = mdates.DateFormatter('%Y') - - # load a numpy record array from yahoo csv data with fields date, - # open, close, volume, adj_close from the mpl-data/example directory. - # The record array stores python datetime.date as an object array in - # the date column - datafile = cbook.get_sample_data('goog.npy') - try: - # Python3 cannot load python2 .npy files with datetime(object) arrays - # unless the encoding is set to bytes. Hovever this option was - # not added until numpy 1.10 so this example will only work with - # python 2 or with numpy 1.10 and later. - r = np.load(datafile, encoding='bytes').view(np.recarray) - except TypeError: - r = np.load(datafile).view(np.recarray) - - fig, ax = plt.subplots() - ax.plot(r.date, r.adj_close) - - - # format the ticks - ax.xaxis.set_major_locator(years) - ax.xaxis.set_major_formatter(yearsFmt) - ax.xaxis.set_minor_locator(months) - - datemin = datetime.date(r.date.min().year, 1, 1) - datemax = datetime.date(r.date.max().year + 1, 1, 1) - ax.set_xlim(datemin, datemax) - - - # format the coords message box - def price(x): - return '$%1.2f' % x - ax.format_xdata = mdates.DateFormatter('%Y-%m-%d') - ax.format_ydata = price - ax.grid(True) - - # rotates and right aligns the x labels, and moves the bottom of the - # axes up to make room for them - fig.autofmt_xdate() - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/date_index_formatter.rst.txt b/_sources/examples/api/date_index_formatter.rst.txt deleted file mode 100644 index 7c9faf1d7cb..00000000000 --- a/_sources/examples/api/date_index_formatter.rst.txt +++ /dev/null @@ -1,61 +0,0 @@ -.. _api-date_index_formatter: - -api example code: date_index_formatter.py -========================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/date_index_formatter.py - -:: - - """ - ===================================== - Custom tick formatter for time series - ===================================== - - When plotting time series, e.g., financial time series, one often wants - to leave out days on which there is no data, i.e. weekends. The example - below shows how to use an 'index formatter' to achieve the desired plot - """ - from __future__ import print_function - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.mlab as mlab - import matplotlib.cbook as cbook - import matplotlib.ticker as ticker - - datafile = cbook.get_sample_data('aapl.csv', asfileobj=False) - print('loading %s' % datafile) - r = mlab.csv2rec(datafile) - - r.sort() - r = r[-30:] # get the last 30 days - - - # first we'll do it the default way, with gaps on weekends - fig, axes = plt.subplots(ncols=2, figsize=(8, 4)) - ax = axes[0] - ax.plot(r.date, r.adj_close, 'o-') - ax.set_title("Default") - fig.autofmt_xdate() - - # next we'll write a custom formatter - N = len(r) - ind = np.arange(N) # the evenly spaced plot indices - - - def format_date(x, pos=None): - thisind = np.clip(int(x + 0.5), 0, N - 1) - return r.date[thisind].strftime('%Y-%m-%d') - - ax = axes[1] - ax.plot(ind, r.adj_close, 'o-') - ax.xaxis.set_major_formatter(ticker.FuncFormatter(format_date)) - ax.set_title("Custom tick formatter") - fig.autofmt_xdate() - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/date_index_formatter.txt b/_sources/examples/api/date_index_formatter.txt deleted file mode 100644 index 01258edfc73..00000000000 --- a/_sources/examples/api/date_index_formatter.txt +++ /dev/null @@ -1,54 +0,0 @@ -.. _api-date_index_formatter: - -api example code: date_index_formatter.py -========================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/date_index_formatter.py - -:: - - """ - When plotting time series, e.g., financial time series, one often wants - to leave out days on which there is no data, eh weekends. The example - below shows how to use an 'index formatter' to achieve the desired plot - """ - from __future__ import print_function - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.mlab as mlab - import matplotlib.cbook as cbook - import matplotlib.ticker as ticker - - datafile = cbook.get_sample_data('aapl.csv', asfileobj=False) - print('loading %s' % datafile) - r = mlab.csv2rec(datafile) - - r.sort() - r = r[-30:] # get the last 30 days - - - # first we'll do it the default way, with gaps on weekends - fig, ax = plt.subplots() - ax.plot(r.date, r.adj_close, 'o-') - fig.autofmt_xdate() - - # next we'll write a custom formatter - N = len(r) - ind = np.arange(N) # the evenly spaced plot indices - - - def format_date(x, pos=None): - thisind = np.clip(int(x + 0.5), 0, N - 1) - return r.date[thisind].strftime('%Y-%m-%d') - - fig, ax = plt.subplots() - ax.plot(ind, r.adj_close, 'o-') - ax.xaxis.set_major_formatter(ticker.FuncFormatter(format_date)) - fig.autofmt_xdate() - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/demo_affine_image.rst.txt b/_sources/examples/api/demo_affine_image.rst.txt deleted file mode 100644 index 7ae11903680..00000000000 --- a/_sources/examples/api/demo_affine_image.rst.txt +++ /dev/null @@ -1,74 +0,0 @@ -.. _api-demo_affine_image: - -api example code: demo_affine_image.py -====================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/demo_affine_image.py - -:: - - """ - ============================ - Affine transform of an image - ============================ - - For the backends that support draw_image with optional affine - transform (e.g., agg, ps backend), the image of the output should - have its boundary match the dashed yellow rectangle. - """ - - import numpy as np - import matplotlib.mlab as mlab - import matplotlib.pyplot as plt - import matplotlib.transforms as mtransforms - - - def get_image(): - delta = 0.25 - x = y = np.arange(-3.0, 3.0, delta) - X, Y = np.meshgrid(x, y) - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - Z = Z2 - Z1 # difference of Gaussians - return Z - - - def do_plot(ax, Z, transform): - im = ax.imshow(Z, interpolation='none', - origin='lower', - extent=[-2, 4, -3, 2], clip_on=True) - - trans_data = transform + ax.transData - im.set_transform(trans_data) - - # display intended extent of the image - x1, x2, y1, y2 = im.get_extent() - ax.plot([x1, x2, x2, x1, x1], [y1, y1, y2, y2, y1], "y--", - transform=trans_data) - ax.set_xlim(-5, 5) - ax.set_ylim(-4, 4) - - - # prepare image and figure - fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2) - Z = get_image() - - # image rotation - do_plot(ax1, Z, mtransforms.Affine2D().rotate_deg(30)) - - # image skew - do_plot(ax2, Z, mtransforms.Affine2D().skew_deg(30, 15)) - - # scale and reflection - do_plot(ax3, Z, mtransforms.Affine2D().scale(-1, .5)) - - # everything and a translation - do_plot(ax4, Z, mtransforms.Affine2D(). - rotate_deg(30).skew_deg(30, 15).scale(-1, .5).translate(.5, -1)) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/demo_affine_image.txt b/_sources/examples/api/demo_affine_image.txt deleted file mode 100644 index da831048110..00000000000 --- a/_sources/examples/api/demo_affine_image.txt +++ /dev/null @@ -1,79 +0,0 @@ -.. _api-demo_affine_image: - -api example code: demo_affine_image.py -====================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/demo_affine_image.py - -:: - - #!/usr/bin/env python - - - """ - For the backends that supports draw_image with optional affine - transform (e.g., agg, ps backend), the image of the output should - have its boundary matches the red rectangles. - """ - - import numpy as np - import matplotlib.cm as cm - import matplotlib.mlab as mlab - import matplotlib.pyplot as plt - import matplotlib.transforms as mtransforms - - - def get_image(): - delta = 0.25 - x = y = np.arange(-3.0, 3.0, delta) - X, Y = np.meshgrid(x, y) - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - Z = Z2 - Z1 # difference of Gaussians - return Z - - - def imshow_affine(ax, z, *kl, **kwargs): - im = ax.imshow(z, *kl, **kwargs) - x1, x2, y1, y2 = im.get_extent() - im._image_skew_coordinate = (x2, y1) - return im - - - if 1: - - # image rotation - - fig, (ax1, ax2) = plt.subplots(1, 2) - Z = get_image() - im1 = imshow_affine(ax1, Z, interpolation='none', cmap=cm.jet, - origin='lower', - extent=[-2, 4, -3, 2], clip_on=True) - - trans_data2 = mtransforms.Affine2D().rotate_deg(30) + ax1.transData - im1.set_transform(trans_data2) - - # display intended extent of the image - x1, x2, y1, y2 = im1.get_extent() - x3, y3 = x2, y1 - - ax1.plot([x1, x2, x2, x1, x1], [y1, y1, y2, y2, y1], "r--", lw=3, - transform=trans_data2) - - ax1.set_xlim(-3, 5) - ax1.set_ylim(-4, 4) - - # image skew - - im2 = ax2.imshow(Z, interpolation='none', cmap=cm.jet, - origin='lower', - extent=[-2, 4, -3, 2], clip_on=True) - im2._image_skew_coordinate = (3, -2) - - plt.show() - #plt.savefig("demo_affine_image") - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/donut_demo.rst.txt b/_sources/examples/api/donut_demo.rst.txt deleted file mode 100644 index 02882754bb9..00000000000 --- a/_sources/examples/api/donut_demo.rst.txt +++ /dev/null @@ -1,76 +0,0 @@ -.. _api-donut_demo: - -api example code: donut_demo.py -=============================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/donut_demo.py - -:: - - """ - ============= - Mmh Donuts!!! - ============= - - This example draws donuts (miam!) using Path and Patches. - """ - - import numpy as np - import matplotlib.path as mpath - import matplotlib.patches as mpatches - import matplotlib.pyplot as plt - - - def wise(v): - if v == 1: - return "CCW" - else: - return "CW" - - - def make_circle(r): - t = np.arange(0, np.pi * 2.0, 0.01) - t = t.reshape((len(t), 1)) - x = r * np.cos(t) - y = r * np.sin(t) - return np.hstack((x, y)) - - Path = mpath.Path - - fig, ax = plt.subplots() - - inside_vertices = make_circle(0.5) - outside_vertices = make_circle(1.0) - codes = np.ones( - len(inside_vertices), dtype=mpath.Path.code_type) * mpath.Path.LINETO - codes[0] = mpath.Path.MOVETO - - for i, (inside, outside) in enumerate(((1, 1), (1, -1), (-1, 1), (-1, -1))): - # Concatenate the inside and outside subpaths together, changing their - # order as needed - vertices = np.concatenate((outside_vertices[::outside], - inside_vertices[::inside])) - # Shift the path - vertices[:, 0] += i * 2.5 - # The codes will be all "LINETO" commands, except for "MOVETO"s at the - # beginning of each subpath - all_codes = np.concatenate((codes, codes)) - # Create the Path object - path = mpath.Path(vertices, all_codes) - # Add plot it - patch = mpatches.PathPatch(path, facecolor='#885500', edgecolor='black') - ax.add_patch(patch) - - ax.annotate("Outside %s,\nInside %s" % (wise(outside), wise(inside)), - (i * 2.5, -1.5), va="top", ha="center") - - ax.set_xlim(-2, 10) - ax.set_ylim(-3, 2) - ax.set_title('Mmm, donuts!') - ax.set_aspect(1.0) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/donut_demo.txt b/_sources/examples/api/donut_demo.txt deleted file mode 100644 index 189630c753b..00000000000 --- a/_sources/examples/api/donut_demo.txt +++ /dev/null @@ -1,68 +0,0 @@ -.. _api-donut_demo: - -api example code: donut_demo.py -=============================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/donut_demo.py - -:: - - import numpy as np - import matplotlib.path as mpath - import matplotlib.patches as mpatches - import matplotlib.pyplot as plt - - - def wise(v): - if v == 1: - return "CCW" - else: - return "CW" - - - def make_circle(r): - t = np.arange(0, np.pi * 2.0, 0.01) - t = t.reshape((len(t), 1)) - x = r * np.cos(t) - y = r * np.sin(t) - return np.hstack((x, y)) - - Path = mpath.Path - - fig, ax = plt.subplots() - - inside_vertices = make_circle(0.5) - outside_vertices = make_circle(1.0) - codes = np.ones( - len(inside_vertices), dtype=mpath.Path.code_type) * mpath.Path.LINETO - codes[0] = mpath.Path.MOVETO - - for i, (inside, outside) in enumerate(((1, 1), (1, -1), (-1, 1), (-1, -1))): - # Concatenate the inside and outside subpaths together, changing their - # order as needed - vertices = np.concatenate((outside_vertices[::outside], - inside_vertices[::inside])) - # Shift the path - vertices[:, 0] += i * 2.5 - # The codes will be all "LINETO" commands, except for "MOVETO"s at the - # beginning of each subpath - all_codes = np.concatenate((codes, codes)) - # Create the Path object - path = mpath.Path(vertices, all_codes) - # Add plot it - patch = mpatches.PathPatch(path, facecolor='#885500', edgecolor='black') - ax.add_patch(patch) - - ax.annotate("Outside %s,\nInside %s" % (wise(outside), wise(inside)), - (i * 2.5, -1.5), va="top", ha="center") - - ax.set_xlim(-2, 10) - ax.set_ylim(-3, 2) - ax.set_title('Mmm, donuts!') - ax.set_aspect(1.0) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/engineering_formatter.rst.txt b/_sources/examples/api/engineering_formatter.rst.txt deleted file mode 100644 index be374089906..00000000000 --- a/_sources/examples/api/engineering_formatter.rst.txt +++ /dev/null @@ -1,39 +0,0 @@ -.. _api-engineering_formatter: - -api example code: engineering_formatter.py -========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/engineering_formatter.py - -:: - - ''' - ========================================= - Labeling ticks using engineering notation - ========================================= - - Demo to show use of the engineering Formatter. - ''' - - import matplotlib.pyplot as plt - import numpy as np - - from matplotlib.ticker import EngFormatter - - prng = np.random.RandomState(123) - - fig, ax = plt.subplots() - ax.set_xscale('log') - formatter = EngFormatter(unit='Hz') - ax.xaxis.set_major_formatter(formatter) - - xs = np.logspace(1, 9, 100) - ys = (0.8 + 0.4 * prng.uniform(size=100)) * np.log10(xs)**2 - ax.plot(xs, ys) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/engineering_formatter.txt b/_sources/examples/api/engineering_formatter.txt deleted file mode 100644 index dd1b700530b..00000000000 --- a/_sources/examples/api/engineering_formatter.txt +++ /dev/null @@ -1,33 +0,0 @@ -.. _api-engineering_formatter: - -api example code: engineering_formatter.py -========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/engineering_formatter.py - -:: - - ''' - Demo to show use of the engineering Formatter. - ''' - - import matplotlib.pyplot as plt - import numpy as np - - from matplotlib.ticker import EngFormatter - - fig, ax = plt.subplots() - ax.set_xscale('log') - formatter = EngFormatter(unit='Hz', places=1) - ax.xaxis.set_major_formatter(formatter) - - xs = np.logspace(1, 9, 100) - ys = (0.8 + 0.4*np.random.uniform(size=100))*np.log10(xs)**2 - ax.plot(xs, ys) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/fahrenheit_celcius_scales.txt b/_sources/examples/api/fahrenheit_celcius_scales.txt deleted file mode 100644 index 4dd8e9d57b0..00000000000 --- a/_sources/examples/api/fahrenheit_celcius_scales.txt +++ /dev/null @@ -1,42 +0,0 @@ -.. _api-fahrenheit_celcius_scales: - -api example code: fahrenheit_celcius_scales.py -============================================== - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/api/fahrenheit_celcius_scales.py - -:: - - """ - Shoiw how to display two scales on the left and right y axis -- Fahrenheit and Celcius - """ - - import matplotlib.pyplot as plt - - fig = plt.figure() - ax1 = fig.add_subplot(111) # the Fahrenheit scale - ax2 = ax1.twinx() # the Celcius scale - - def Tc(Tf): - return (5./9.)*(Tf-32) - - - def update_ax2(ax1): - y1, y2 = ax1.get_ylim() - ax2.set_ylim(Tc(y1), Tc(y2)) - ax2.figure.canvas.draw() - - # automatically update ylim of ax2 when ylim of ax1 changes. - ax1.callbacks.connect("ylim_changed", update_ax2) - ax1.plot([78, 79, 79, 77]) - - ax1.set_title('Two scales: Fahrenheit and Celcius') - ax1.set_ylabel('Fahrenheit') - ax2.set_ylabel('Celcius') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/fahrenheit_celsius_scales.txt b/_sources/examples/api/fahrenheit_celsius_scales.txt deleted file mode 100644 index 4809c4b5a9d..00000000000 --- a/_sources/examples/api/fahrenheit_celsius_scales.txt +++ /dev/null @@ -1,41 +0,0 @@ -.. _api-fahrenheit_celsius_scales: - -api example code: fahrenheit_celsius_scales.py -============================================== - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/api/fahrenheit_celsius_scales.py - -:: - - """ - Show how to display two scales on the left and right y axis -- Fahrenheit and Celsius - """ - - import matplotlib.pyplot as plt - - fig, ax1 = plt.subplots() # ax1 is the Fahrenheit scale - ax2 = ax1.twinx() # ax2 is the Celsius scale - - def Tc(Tf): - return (5./9.)*(Tf-32) - - - def update_ax2(ax1): - y1, y2 = ax1.get_ylim() - ax2.set_ylim(Tc(y1), Tc(y2)) - ax2.figure.canvas.draw() - - # automatically update ylim of ax2 when ylim of ax1 changes. - ax1.callbacks.connect("ylim_changed", update_ax2) - ax1.plot([78, 79, 79, 77]) - - ax1.set_title('Two scales: Fahrenheit and Celsius') - ax1.set_ylabel('Fahrenheit') - ax2.set_ylabel('Celsius') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/filled_step.rst.txt b/_sources/examples/api/filled_step.rst.txt deleted file mode 100644 index ede459969ea..00000000000 --- a/_sources/examples/api/filled_step.rst.txt +++ /dev/null @@ -1,235 +0,0 @@ -.. _api-filled_step: - -api example code: filled_step.py -================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/filled_step.py - -:: - - """ - ========================= - Hatch-filled histograms - ========================= - - This example showcases the hatching capabilities of matplotlib by plotting - various histograms. - """ - - import itertools - from collections import OrderedDict - from functools import partial - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.ticker as mticker - from cycler import cycler - from six.moves import zip - - - def filled_hist(ax, edges, values, bottoms=None, orientation='v', - **kwargs): - """ - Draw a histogram as a stepped patch. - - Extra kwargs are passed through to `fill_between` - - Parameters - ---------- - ax : Axes - The axes to plot to - - edges : array - A length n+1 array giving the left edges of each bin and the - right edge of the last bin. - - values : array - A length n array of bin counts or values - - bottoms : scalar or array, optional - A length n array of the bottom of the bars. If None, zero is used. - - orientation : {'v', 'h'} - Orientation of the histogram. 'v' (default) has - the bars increasing in the positive y-direction. - - Returns - ------- - ret : PolyCollection - Artist added to the Axes - """ - print(orientation) - if orientation not in set('hv'): - raise ValueError("orientation must be in {{'h', 'v'}} " - "not {o}".format(o=orientation)) - - kwargs.setdefault('step', 'post') - edges = np.asarray(edges) - values = np.asarray(values) - if len(edges) - 1 != len(values): - raise ValueError('Must provide one more bin edge than value not: ' - 'len(edges): {lb} len(values): {lv}'.format( - lb=len(edges), lv=len(values))) - - if bottoms is None: - bottoms = np.zeros_like(values) - if np.isscalar(bottoms): - bottoms = np.ones_like(values) * bottoms - - values = np.r_[values, values[-1]] - bottoms = np.r_[bottoms, bottoms[-1]] - if orientation == 'h': - return ax.fill_betweenx(edges, values, bottoms, - **kwargs) - elif orientation == 'v': - return ax.fill_between(edges, values, bottoms, - **kwargs) - else: - raise AssertionError("you should never be here") - - - def stack_hist(ax, stacked_data, sty_cycle, bottoms=None, - hist_func=None, labels=None, - plot_func=None, plot_kwargs=None): - """ - ax : axes.Axes - The axes to add artists too - - stacked_data : array or Mapping - A (N, M) shaped array. The first dimension will be iterated over to - compute histograms row-wise - - sty_cycle : Cycler or operable of dict - Style to apply to each set - - bottoms : array, optional - The initial positions of the bottoms, defaults to 0 - - hist_func : callable, optional - Must have signature `bin_vals, bin_edges = f(data)`. - `bin_edges` expected to be one longer than `bin_vals` - - labels : list of str, optional - The label for each set. - - If not given and stacked data is an array defaults to 'default set {n}' - - If stacked_data is a mapping, and labels is None, default to the keys - (which may come out in a random order). - - If stacked_data is a mapping and labels is given then only - the columns listed by be plotted. - - plot_func : callable, optional - Function to call to draw the histogram must have signature: - - ret = plot_func(ax, edges, top, bottoms=bottoms, - label=label, **kwargs) - - plot_kwargs : dict, optional - Any extra kwargs to pass through to the plotting function. This - will be the same for all calls to the plotting function and will - over-ride the values in cycle. - - Returns - ------- - arts : dict - Dictionary of artists keyed on their labels - """ - # deal with default binning function - if hist_func is None: - hist_func = np.histogram - - # deal with default plotting function - if plot_func is None: - plot_func = filled_hist - - # deal with default - if plot_kwargs is None: - plot_kwargs = {} - print(plot_kwargs) - try: - l_keys = stacked_data.keys() - label_data = True - if labels is None: - labels = l_keys - - except AttributeError: - label_data = False - if labels is None: - labels = itertools.repeat(None) - - if label_data: - loop_iter = enumerate((stacked_data[lab], lab, s) for lab, s in - zip(labels, sty_cycle)) - else: - loop_iter = enumerate(zip(stacked_data, labels, sty_cycle)) - - arts = {} - for j, (data, label, sty) in loop_iter: - if label is None: - label = 'dflt set {n}'.format(n=j) - label = sty.pop('label', label) - vals, edges = hist_func(data) - if bottoms is None: - bottoms = np.zeros_like(vals) - top = bottoms + vals - print(sty) - sty.update(plot_kwargs) - print(sty) - ret = plot_func(ax, edges, top, bottoms=bottoms, - label=label, **sty) - bottoms = top - arts[label] = ret - ax.legend(fontsize=10) - return arts - - - # set up histogram function to fixed bins - edges = np.linspace(-3, 3, 20, endpoint=True) - hist_func = partial(np.histogram, bins=edges) - - # set up style cycles - color_cycle = cycler(facecolor=plt.rcParams['axes.prop_cycle'][:4]) - label_cycle = cycler('label', ['set {n}'.format(n=n) for n in range(4)]) - hatch_cycle = cycler('hatch', ['/', '*', '+', '|']) - - # make some synthetic data - np.random.seed(0) - stack_data = np.random.randn(4, 12250) - dict_data = OrderedDict(zip((c['label'] for c in label_cycle), stack_data)) - - # work with plain arrays - fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(9, 4.5), tight_layout=True) - arts = stack_hist(ax1, stack_data, color_cycle + label_cycle + hatch_cycle, - hist_func=hist_func) - - arts = stack_hist(ax2, stack_data, color_cycle, - hist_func=hist_func, - plot_kwargs=dict(edgecolor='w', orientation='h')) - ax1.set_ylabel('counts') - ax1.set_xlabel('x') - ax2.set_xlabel('counts') - ax2.set_ylabel('x') - - # work with labeled data - - fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(9, 4.5), - tight_layout=True, sharey=True) - - arts = stack_hist(ax1, dict_data, color_cycle + hatch_cycle, - hist_func=hist_func) - - arts = stack_hist(ax2, dict_data, color_cycle + hatch_cycle, - hist_func=hist_func, labels=['set 0', 'set 3']) - ax1.xaxis.set_major_locator(mticker.MaxNLocator(5)) - ax1.set_xlabel('counts') - ax1.set_ylabel('x') - ax2.set_ylabel('x') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/filled_step.txt b/_sources/examples/api/filled_step.txt deleted file mode 100644 index ec732d9a52f..00000000000 --- a/_sources/examples/api/filled_step.txt +++ /dev/null @@ -1,221 +0,0 @@ -.. _api-filled_step: - -api example code: filled_step.py -================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/filled_step.py - -:: - - import itertools - from functools import partial - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.ticker as mticker - from cycler import cycler - from six.moves import zip - - - def filled_hist(ax, edges, values, bottoms=None, orientation='v', - **kwargs): - """ - Draw a histogram as a stepped patch. - - Extra kwargs are passed through to `fill_between` - - Parameters - ---------- - ax : Axes - The axes to plot to - - edges : array - A length n+1 array giving the left edges of each bin and the - right edge of the last bin. - - values : array - A length n array of bin counts or values - - bottoms : scalar or array, optional - A length n array of the bottom of the bars. If None, zero is used. - - orientation : {'v', 'h'} - Orientation of the histogram. 'v' (default) has - the bars increasing in the positive y-direction. - - Returns - ------- - ret : PolyCollection - Artist added to the Axes - """ - print(orientation) - if orientation not in set('hv'): - raise ValueError("orientation must be in {{'h', 'v'}} " - "not {o}".format(o=orientation)) - - kwargs.setdefault('step', 'post') - edges = np.asarray(edges) - values = np.asarray(values) - if len(edges) - 1 != len(values): - raise ValueError('Must provide one more bin edge than value not: ' - 'len(edges): {lb} len(values): {lv}'.format( - lb=len(edges), lv=len(values))) - - if bottoms is None: - bottoms = np.zeros_like(values) - if np.isscalar(bottoms): - bottoms = np.ones_like(values) * bottoms - - values = np.r_[values, values[-1]] - bottoms = np.r_[bottoms, bottoms[-1]] - if orientation == 'h': - return ax.fill_betweenx(edges, values, bottoms, **kwargs) - elif orientation == 'v': - return ax.fill_between(edges, values, bottoms, **kwargs) - else: - raise AssertionError("you should never be here") - - - def stack_hist(ax, stacked_data, sty_cycle, bottoms=None, - hist_func=None, labels=None, - plot_func=None, plot_kwargs=None): - """ - ax : axes.Axes - The axes to add artists too - - stacked_data : array or Mapping - A (N, M) shaped array. The first dimension will be iterated over to - compute histograms row-wise - - sty_cycle : Cycler or operable of dict - Style to apply to each set - - bottoms : array, optional - The initial positions of the bottoms, defaults to 0 - - hist_func : callable, optional - Must have signature `bin_vals, bin_edges = f(data)`. - `bin_edges` expected to be one longer than `bin_vals` - - labels : list of str, optional - The label for each set. - - If not given and stacked data is an array defaults to 'default set {n}' - - If stacked_data is a mapping, and labels is None, default to the keys - (which may come out in a random order). - - If stacked_data is a mapping and labels is given then only - the columns listed by be plotted. - - plot_func : callable, optional - Function to call to draw the histogram must have signature: - - ret = plot_func(ax, edges, top, bottoms=bottoms, - label=label, **kwargs) - - plot_kwargs : dict, optional - Any extra kwargs to pass through to the plotting function. This - will be the same for all calls to the plotting function and will - over-ride the values in cycle. - - Returns - ------- - arts : dict - Dictionary of artists keyed on their labels - """ - # deal with default binning function - if hist_func is None: - hist_func = np.histogram - - # deal with default plotting function - if plot_func is None: - plot_func = filled_hist - - # deal with default - if plot_kwargs is None: - plot_kwargs = {} - print(plot_kwargs) - try: - l_keys = stacked_data.keys() - label_data = True - if labels is None: - labels = l_keys - - except AttributeError: - label_data = False - if labels is None: - labels = itertools.repeat(None) - - if label_data: - loop_iter = enumerate((stacked_data[lab], lab, s) for lab, s in - zip(labels, sty_cycle)) - else: - loop_iter = enumerate(zip(stacked_data, labels, sty_cycle)) - - arts = {} - for j, (data, label, sty) in loop_iter: - if label is None: - label = 'dflt set {n}'.format(n=j) - label = sty.pop('label', label) - vals, edges = hist_func(data) - if bottoms is None: - bottoms = np.zeros_like(vals) - top = bottoms + vals - print(sty) - sty.update(plot_kwargs) - print(sty) - ret = plot_func(ax, edges, top, bottoms=bottoms, - label=label, **sty) - bottoms = top - arts[label] = ret - ax.legend(fontsize=10) - return arts - - - # set up histogram function to fixed bins - edges = np.linspace(-3, 3, 20, endpoint=True) - hist_func = partial(np.histogram, bins=edges) - - # set up style cycles - color_cycle = cycler('facecolor', 'rgbm') - label_cycle = cycler('label', ['set {n}'.format(n=n) for n in range(4)]) - hatch_cycle = cycler('hatch', ['/', '*', '+', '|']) - - # make some synthetic data - stack_data = np.random.randn(4, 12250) - dict_data = {lab: d for lab, d in zip(list(c['label'] for c in label_cycle), - stack_data)} - - # work with plain arrays - fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(9, 4.5), tight_layout=True) - arts = stack_hist(ax1, stack_data, color_cycle + label_cycle + hatch_cycle, - hist_func=hist_func) - - arts = stack_hist(ax2, stack_data, color_cycle, - hist_func=hist_func, - plot_kwargs=dict(edgecolor='w', orientation='h')) - ax1.set_ylabel('counts') - ax1.set_xlabel('x') - ax2.set_xlabel('counts') - ax2.set_ylabel('x') - - # work with labeled data - - fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(9, 4.5), - tight_layout=True, sharey=True) - - arts = stack_hist(ax1, dict_data, color_cycle + hatch_cycle, - hist_func=hist_func) - - arts = stack_hist(ax2, dict_data, color_cycle + hatch_cycle, - hist_func=hist_func, labels=['set 0', 'set 3']) - ax1.xaxis.set_major_locator(mticker.MaxNLocator(5)) - ax1.set_xlabel('counts') - ax1.set_ylabel('x') - ax2.set_ylabel('x') - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/font_family_rc.rst.txt b/_sources/examples/api/font_family_rc.rst.txt deleted file mode 100644 index bb8631430c3..00000000000 --- a/_sources/examples/api/font_family_rc.rst.txt +++ /dev/null @@ -1,46 +0,0 @@ -.. _api-font_family_rc: - -api example code: font_family_rc.py -=================================== - -[`source code `_] - -:: - - """ - =========================== - Configuring the font family - =========================== - - You can explicitly set which font family is picked up for a given font - style (e.g., 'serif', 'sans-serif', or 'monospace'). - - In the example below, we only allow one font family (Tahoma) for the - san-serif font style. You the default family with the font.family rc - param, e.g.,:: - - rcParams['font.family'] = 'sans-serif' - - and for the font.family you set a list of font styles to try to find - in order:: - - rcParams['font.sans-serif'] = ['Tahoma', 'DejaVu Sans', - 'Lucida Grande', 'Verdana'] - - """ - - # -*- noplot -*- - - from matplotlib import rcParams - rcParams['font.family'] = 'sans-serif' - rcParams['font.sans-serif'] = ['Tahoma'] - import matplotlib.pyplot as plt - - fig, ax = plt.subplots() - ax.plot([1, 2, 3], label='test') - - ax.legend() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/font_family_rc.txt b/_sources/examples/api/font_family_rc.txt deleted file mode 100644 index e78912d2801..00000000000 --- a/_sources/examples/api/font_family_rc.txt +++ /dev/null @@ -1,42 +0,0 @@ -.. _api-font_family_rc: - -api example code: font_family_rc.py -=================================== - -[`source code `_] - -:: - - """ - You can explicitly set which font family is picked up for a given font - style (e.g., 'serif', 'sans-serif', or 'monospace'). - - In the example below, we only allow one font family (Tahoma) for the - san-serif font style. You the default family with the font.family rc - param, e.g.,:: - - rcParams['font.family'] = 'sans-serif' - - and for the font.family you set a list of font styles to try to find - in order:: - - rcParams['font.sans-serif'] = ['Tahoma', 'Bitstream Vera Sans', - 'Lucida Grande', 'Verdana'] - - """ - - # -*- noplot -*- - - from matplotlib import rcParams - rcParams['font.family'] = 'sans-serif' - rcParams['font.sans-serif'] = ['Tahoma'] - import matplotlib.pyplot as plt - - fig, ax = plt.subplots() - ax.plot([1, 2, 3], label='test') - - ax.legend() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/font_file.rst.txt b/_sources/examples/api/font_file.rst.txt deleted file mode 100644 index cd4ac7d524a..00000000000 --- a/_sources/examples/api/font_file.rst.txt +++ /dev/null @@ -1,54 +0,0 @@ -.. _api-font_file: - -api example code: font_file.py -============================== - -[`source code `_] - -:: - - # -*- noplot -*- - """ - =================================== - Using a ttf font file in matplotlib - =================================== - - Although it is usually not a good idea to explicitly point to a single - ttf file for a font instance, you can do so using the - font_manager.FontProperties fname argument (for a more flexible - solution, see the font_family_rc.py and fonts_demo.py examples). - """ - import sys - import os - import matplotlib.font_manager as fm - - import matplotlib.pyplot as plt - - fig, ax = plt.subplots() - ax.plot([1, 2, 3]) - - if sys.platform == 'win32': - fpath = 'C:\\Windows\\Fonts\\Tahoma.ttf' - elif sys.platform.startswith('linux'): - basedir = '/usr/share/fonts/truetype' - fonts = ['freefont/FreeSansBoldOblique.ttf', - 'ttf-liberation/LiberationSans-BoldItalic.ttf', - 'msttcorefonts/Comic_Sans_MS.ttf'] - for fpath in fonts: - if os.path.exists(os.path.join(basedir, fpath)): - break - else: - fpath = '/Library/Fonts/Tahoma.ttf' - - if os.path.exists(fpath): - prop = fm.FontProperties(fname=fpath) - fname = os.path.split(fpath)[1] - ax.set_title('this is a special font: %s' % fname, fontproperties=prop) - else: - ax.set_title('Demo fails--cannot find a demo font') - ax.set_xlabel('This is the default font') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/font_file.txt b/_sources/examples/api/font_file.txt deleted file mode 100644 index 2d0ff754713..00000000000 --- a/_sources/examples/api/font_file.txt +++ /dev/null @@ -1,50 +0,0 @@ -.. _api-font_file: - -api example code: font_file.py -============================== - -[`source code `_] - -:: - - # -*- noplot -*- - """ - Although it is usually not a good idea to explicitly point to a single - ttf file for a font instance, you can do so using the - font_manager.FontProperties fname argument (for a more flexible - solution, see the font_fmaily_rc.py and fonts_demo.py examples). - """ - import sys - import os - import matplotlib.font_manager as fm - - import matplotlib.pyplot as plt - - fig, ax = plt.subplots() - ax.plot([1, 2, 3]) - - if sys.platform == 'win32': - fpath = 'C:\\Windows\\Fonts\\Tahoma.ttf' - elif sys.platform.startswith('linux'): - basedir = '/usr/share/fonts/truetype' - fonts = ['freefont/FreeSansBoldOblique.ttf', - 'ttf-liberation/LiberationSans-BoldItalic.ttf', - 'msttcorefonts/Comic_Sans_MS.ttf'] - for fpath in fonts: - if os.path.exists(os.path.join(basedir, fpath)): - break - else: - fpath = '/Library/Fonts/Tahoma.ttf' - - if os.path.exists(fpath): - prop = fm.FontProperties(fname=fpath) - fname = os.path.split(fpath)[1] - ax.set_title('this is a special font: %s' % fname, fontproperties=prop) - else: - ax.set_title('Demo fails--cannot find a demo font') - ax.set_xlabel('This is the default font') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/hinton_demo.txt b/_sources/examples/api/hinton_demo.txt deleted file mode 100644 index 3ad6465be21..00000000000 --- a/_sources/examples/api/hinton_demo.txt +++ /dev/null @@ -1,74 +0,0 @@ -.. _api-hinton_demo: - -api example code: hinton_demo.py -================================ - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/api/hinton_demo.py - -:: - - #Initial idea from David Warde-Farley on the SciPy Cookbook - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.patches import Rectangle - from matplotlib.ticker import NullLocator - #from matplotlib.collections import RegularPolyCollection - #from matplotlib.colors import BoundaryNorm, ListedColormap - - def hinton(W, maxWeight=None, ax=None): - """ - Draws a Hinton diagram for visualizing a weight matrix. - """ - if not ax: - fig = plt.figure() - ax = fig.add_subplot(1, 1, 1) - - if not maxWeight: - maxWeight = 2**np.ceil(np.log(np.abs(W).max())/np.log(2)) - - ax.patch.set_facecolor('gray') - ax.set_aspect('equal', 'box') - ax.xaxis.set_major_locator(NullLocator()) - ax.yaxis.set_major_locator(NullLocator()) - - for (x,y),w in np.ndenumerate(W): - if w > 0: color = 'white' - else: color = 'black' - size = np.sqrt(np.abs(w)) - rect = Rectangle([x - size / 2, y - size / 2], size, size, - facecolor=color, edgecolor=color) - ax.add_patch(rect) - ax.autoscale_view() - - # Reverse the yaxis limits - ax.set_ylim(*ax.get_ylim()[::-1]) - - ## Potential way using polygon collections that just has an issue with - ## easily getting the squares scaled by the data. - - # height,width = W.shape - # x = np.arange(width) - # y = np.arange(height) - # X,Y = np.meshgrid(x, y) - # xy = np.array([X.flatten(),Y.flatten()]).T - # scaled_data = W.flatten() / maxWeight - # cmap = ListedColormap(['black', 'white']) - # norm = BoundaryNorm([-1., 0., 1.], cmap.N) - - # rect_col = RegularPolyCollection(4, rotation=np.pi/4, - # sizes=np.abs(scaled_data) * 72 / ax.figure.get_dpi(), offsets=xy, - # transOffset=ax.transData, norm=norm, cmap=cmap, edgecolor='none') - # ax.add_collection(rect_col) - # rect_col.set_array(scaled_data) - # ax.autoscale_view() - - if __name__ == '__main__': - hinton(np.random.rand(20, 20) - 0.5) - plt.title('Hinton Example') - plt.show() - - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/histogram_demo.txt b/_sources/examples/api/histogram_demo.txt deleted file mode 100644 index dd743205ba9..00000000000 --- a/_sources/examples/api/histogram_demo.txt +++ /dev/null @@ -1,48 +0,0 @@ -.. _api-histogram_demo: - -api example code: histogram_demo.py -=================================== - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/api/histogram_demo.py - -:: - - """ - Make a histogram of normally distributed random numbers and plot the - analytic PDF over it - """ - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.mlab as mlab - - mu, sigma = 100, 15 - x = mu + sigma * np.random.randn(10000) - - fig = plt.figure() - ax = fig.add_subplot(111) - - # the histogram of the data - n, bins, patches = ax.hist(x, 50, normed=1, facecolor='green', alpha=0.75) - - # hist uses np.histogram under the hood to create 'n' and 'bins'. - # np.histogram returns the bin edges, so there will be 50 probability - # density values in n, 51 bin edges in bins and 50 patches. To get - # everything lined up, we'll compute the bin centers - bincenters = 0.5*(bins[1:]+bins[:-1]) - # add a 'best fit' line for the normal PDF - y = mlab.normpdf( bincenters, mu, sigma) - l = ax.plot(bincenters, y, 'r--', linewidth=1) - - ax.set_xlabel('Smarts') - ax.set_ylabel('Probability') - #ax.set_title(r'$\mathrm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$') - ax.set_xlim(40, 160) - ax.set_ylim(0, 0.03) - ax.grid(True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/histogram_path_demo.rst.txt b/_sources/examples/api/histogram_path_demo.rst.txt deleted file mode 100644 index 282043be501..00000000000 --- a/_sources/examples/api/histogram_path_demo.rst.txt +++ /dev/null @@ -1,64 +0,0 @@ -.. _api-histogram_path_demo: - -api example code: histogram_path_demo.py -======================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/histogram_path_demo.py - -:: - - """ - ======================================================== - Building histograms using Rectangles and PolyCollections - ======================================================== - - This example shows how to use a path patch to draw a bunch of - rectangles. The technique of using lots of Rectangle instances, or - the faster method of using PolyCollections, were implemented before we - had proper paths with moveto/lineto, closepoly etc in mpl. Now that - we have them, we can draw collections of regularly shaped objects with - homogeneous properties more efficiently with a PathCollection. This - example makes a histogram -- its more work to set up the vertex arrays - at the outset, but it should be much faster for large numbers of - objects - """ - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.patches as patches - import matplotlib.path as path - - fig, ax = plt.subplots() - - # histogram our data with numpy - data = np.random.randn(1000) - n, bins = np.histogram(data, 50) - - # get the corners of the rectangles for the histogram - left = np.array(bins[:-1]) - right = np.array(bins[1:]) - bottom = np.zeros(len(left)) - top = bottom + n - - - # we need a (numrects x numsides x 2) numpy array for the path helper - # function to build a compound path - XY = np.array([[left, left, right, right], [bottom, top, top, bottom]]).T - - # get the Path object - barpath = path.Path.make_compound_path_from_polys(XY) - - # make a patch out of it - patch = patches.PathPatch(barpath) - ax.add_patch(patch) - - # update the view limits - ax.set_xlim(left[0], right[-1]) - ax.set_ylim(bottom.min(), top.max()) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/histogram_path_demo.txt b/_sources/examples/api/histogram_path_demo.txt deleted file mode 100644 index f81cb8fe9b6..00000000000 --- a/_sources/examples/api/histogram_path_demo.txt +++ /dev/null @@ -1,61 +0,0 @@ -.. _api-histogram_path_demo: - -api example code: histogram_path_demo.py -======================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/histogram_path_demo.py - -:: - - """ - This example shows how to use a path patch to draw a bunch of - rectangles. The technique of using lots of Rectangle instances, or - the faster method of using PolyCollections, were implemented before we - had proper paths with moveto/lineto, closepoly etc in mpl. Now that - we have them, we can draw collections of regularly shaped objects with - homogeous properties more efficiently with a PathCollection. This - example makes a histogram -- its more work to set up the vertex arrays - at the outset, but it should be much faster for large numbers of - objects - """ - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.patches as patches - import matplotlib.path as path - - fig, ax = plt.subplots() - - # histogram our data with numpy - data = np.random.randn(1000) - n, bins = np.histogram(data, 50) - - # get the corners of the rectangles for the histogram - left = np.array(bins[:-1]) - right = np.array(bins[1:]) - bottom = np.zeros(len(left)) - top = bottom + n - - - # we need a (numrects x numsides x 2) numpy array for the path helper - # function to build a compound path - XY = np.array([[left, left, right, right], [bottom, top, top, bottom]]).T - - # get the Path object - barpath = path.Path.make_compound_path_from_polys(XY) - - # make a patch out of it - patch = patches.PathPatch( - barpath, facecolor='blue', edgecolor='gray', alpha=0.8) - ax.add_patch(patch) - - # update the view limits - ax.set_xlim(left[0], right[-1]) - ax.set_ylim(bottom.min(), top.max()) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/image_zcoord.rst.txt b/_sources/examples/api/image_zcoord.rst.txt deleted file mode 100644 index 56cc3870a4d..00000000000 --- a/_sources/examples/api/image_zcoord.rst.txt +++ /dev/null @@ -1,44 +0,0 @@ -.. _api-image_zcoord: - -api example code: image_zcoord.py -================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/image_zcoord.py - -:: - - """ - ================================== - Modifying the coordinate formatter - ================================== - - Show how to modify the coordinate formatter to report the image "z" - value of the nearest pixel given x and y - """ - import numpy as np - import matplotlib.pyplot as plt - - X = 10*np.random.rand(5, 3) - - fig, ax = plt.subplots() - ax.imshow(X, interpolation='nearest') - - numrows, numcols = X.shape - - - def format_coord(x, y): - col = int(x + 0.5) - row = int(y + 0.5) - if col >= 0 and col < numcols and row >= 0 and row < numrows: - z = X[row, col] - return 'x=%1.4f, y=%1.4f, z=%1.4f' % (x, y, z) - else: - return 'x=%1.4f, y=%1.4f' % (x, y) - - ax.format_coord = format_coord - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/image_zcoord.txt b/_sources/examples/api/image_zcoord.txt deleted file mode 100644 index 23a7dc9394c..00000000000 --- a/_sources/examples/api/image_zcoord.txt +++ /dev/null @@ -1,41 +0,0 @@ -.. _api-image_zcoord: - -api example code: image_zcoord.py -================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/image_zcoord.py - -:: - - """ - Show how to modify the coordinate formatter to report the image "z" - value of the nearest pixel given x and y - """ - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.cm as cm - - X = 10*np.random.rand(5, 3) - - fig, ax = plt.subplots() - ax.imshow(X, cmap=cm.jet, interpolation='nearest') - - numrows, numcols = X.shape - - - def format_coord(x, y): - col = int(x + 0.5) - row = int(y + 0.5) - if col >= 0 and col < numcols and row >= 0 and row < numrows: - z = X[row, col] - return 'x=%1.4f, y=%1.4f, z=%1.4f' % (x, y, z) - else: - return 'x=%1.4f, y=%1.4f' % (x, y) - - ax.format_coord = format_coord - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/index.rst.txt b/_sources/examples/api/index.rst.txt deleted file mode 100644 index 01988c4694b..00000000000 --- a/_sources/examples/api/index.rst.txt +++ /dev/null @@ -1,53 +0,0 @@ -.. _api-examples-index: - -############################################## -api Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - agg_oo - barchart_demo - bbox_intersect - collections_demo - colorbar_basics - colorbar_only - compound_path - custom_projection_example - custom_scale_example - date_demo - date_index_formatter - demo_affine_image - donut_demo - engineering_formatter - filled_step - font_family_rc - font_file - histogram_path_demo - image_zcoord - joinstyle - legend_demo - line_with_text - logo2 - mathtext_asarray - patch_collection - power_norm_demo - quad_bezier - radar_chart - sankey_demo_basics - sankey_demo_links - sankey_demo_old - sankey_demo_rankine - scatter_piecharts - skewt - span_regions - two_scales - unicode_minus - watermark_image - watermark_text diff --git a/_sources/examples/api/index.txt b/_sources/examples/api/index.txt deleted file mode 100644 index 19a32ffd783..00000000000 --- a/_sources/examples/api/index.txt +++ /dev/null @@ -1,52 +0,0 @@ -.. _api-examples-index: - -############################################## -api Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - agg_oo - barchart_demo - bbox_intersect - collections_demo - colorbar_only - compound_path - custom_projection_example - custom_scale_example - date_demo - date_index_formatter - demo_affine_image - donut_demo - engineering_formatter - filled_step - font_family_rc - font_file - histogram_path_demo - image_zcoord - joinstyle - legend_demo - line_with_text - logo2 - mathtext_asarray - patch_collection - power_norm_demo - quad_bezier - radar_chart - sankey_demo_basics - sankey_demo_links - sankey_demo_old - sankey_demo_rankine - scatter_piecharts - skewt - span_regions - two_scales - unicode_minus - watermark_image - watermark_text diff --git a/_sources/examples/api/joinstyle.rst.txt b/_sources/examples/api/joinstyle.rst.txt deleted file mode 100644 index 37f70a660e2..00000000000 --- a/_sources/examples/api/joinstyle.rst.txt +++ /dev/null @@ -1,47 +0,0 @@ -.. _api-joinstyle: - -api example code: joinstyle.py -============================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/joinstyle.py - -:: - - """ - =========== - Join styles - =========== - - Illustrate the three different join styles - """ - - import numpy as np - import matplotlib.pyplot as plt - - - def plot_angle(ax, x, y, angle, style): - phi = np.radians(angle) - xx = [x + .5, x, x + .5*np.cos(phi)] - yy = [y, y, y + .5*np.sin(phi)] - ax.plot(xx, yy, lw=8, color='blue', solid_joinstyle=style) - ax.plot(xx[1:], yy[1:], lw=1, color='black') - ax.plot(xx[1::-1], yy[1::-1], lw=1, color='black') - ax.plot(xx[1:2], yy[1:2], 'o', color='red', markersize=3) - ax.text(x, y + .2, '%.0f degrees' % angle) - - fig, ax = plt.subplots() - ax.set_title('Join style') - - for x, style in enumerate((('miter', 'round', 'bevel'))): - ax.text(x, 5, style) - for i in range(5): - plot_angle(ax, x, i, pow(2.0, 3 + i), style) - - ax.set_xlim(-.5, 2.75) - ax.set_ylim(-.5, 5.5) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/joinstyle.txt b/_sources/examples/api/joinstyle.txt deleted file mode 100644 index e9751e74650..00000000000 --- a/_sources/examples/api/joinstyle.txt +++ /dev/null @@ -1,44 +0,0 @@ -.. _api-joinstyle: - -api example code: joinstyle.py -============================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/joinstyle.py - -:: - - #!/usr/bin/env python - """ - Illustrate the three different join styles - """ - - import numpy as np - import matplotlib.pyplot as plt - - - def plot_angle(ax, x, y, angle, style): - phi = np.radians(angle) - xx = [x + .5, x, x + .5*np.cos(phi)] - yy = [y, y, y + .5*np.sin(phi)] - ax.plot(xx, yy, lw=8, color='blue', solid_joinstyle=style) - ax.plot(xx[1:], yy[1:], lw=1, color='black') - ax.plot(xx[1::-1], yy[1::-1], lw=1, color='black') - ax.plot(xx[1:2], yy[1:2], 'o', color='red', markersize=3) - ax.text(x, y + .2, '%.0f degrees' % angle) - - fig, ax = plt.subplots() - ax.set_title('Join style') - - for x, style in enumerate((('miter', 'round', 'bevel'))): - ax.text(x, 5, style) - for i in range(5): - plot_angle(ax, x, i, pow(2.0, 3 + i), style) - - ax.set_xlim(-.5, 2.75) - ax.set_ylim(-.5, 5.5) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/legend_demo.rst.txt b/_sources/examples/api/legend_demo.rst.txt deleted file mode 100644 index f3f9a22e9a4..00000000000 --- a/_sources/examples/api/legend_demo.rst.txt +++ /dev/null @@ -1,43 +0,0 @@ -.. _api-legend_demo: - -api example code: legend_demo.py -================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/legend_demo.py - -:: - - """ - =============================== - Legend using pre-defined labels - =============================== - - Notice how the legend labels are defined with the plots! - """ - - - import numpy as np - import matplotlib.pyplot as plt - - # Make some fake data. - a = b = np.arange(0, 3, .02) - c = np.exp(a) - d = c[::-1] - - # Create plots with pre-defined labels. - fig, ax = plt.subplots() - ax.plot(a, c, 'k--', label='Model length') - ax.plot(a, d, 'k:', label='Data length') - ax.plot(a, c + d, 'k', label='Total message length') - - legend = ax.legend(loc='upper center', shadow=True, fontsize='x-large') - - # Put a nicer background color on the legend. - legend.get_frame().set_facecolor('#00FFCC') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/legend_demo.txt b/_sources/examples/api/legend_demo.txt deleted file mode 100644 index c91bb7847db..00000000000 --- a/_sources/examples/api/legend_demo.txt +++ /dev/null @@ -1,33 +0,0 @@ -.. _api-legend_demo: - -api example code: legend_demo.py -================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/legend_demo.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - - # Make some fake data. - a = b = np.arange(0, 3, .02) - c = np.exp(a) - d = c[::-1] - - # Create plots with pre-defined labels. - plt.plot(a, c, 'k--', label='Model length') - plt.plot(a, d, 'k:', label='Data length') - plt.plot(a, c + d, 'k', label='Total message length') - - legend = plt.legend(loc='upper center', shadow=True, fontsize='x-large') - - # Put a nicer background color on the legend. - legend.get_frame().set_facecolor('#00FFCC') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/line_with_text.rst.txt b/_sources/examples/api/line_with_text.rst.txt deleted file mode 100644 index 20fd49b93ea..00000000000 --- a/_sources/examples/api/line_with_text.rst.txt +++ /dev/null @@ -1,77 +0,0 @@ -.. _api-line_with_text: - -api example code: line_with_text.py -=================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/line_with_text.py - -:: - - """ - ======================= - Artist within an artist - ======================= - - Show how to override basic methods so an artist can contain another - artist. In this case, the line contains a Text instance to label it. - """ - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.lines as lines - import matplotlib.transforms as mtransforms - import matplotlib.text as mtext - - - class MyLine(lines.Line2D): - def __init__(self, *args, **kwargs): - # we'll update the position when the line data is set - self.text = mtext.Text(0, 0, '') - lines.Line2D.__init__(self, *args, **kwargs) - - # we can't access the label attr until *after* the line is - # inited - self.text.set_text(self.get_label()) - - def set_figure(self, figure): - self.text.set_figure(figure) - lines.Line2D.set_figure(self, figure) - - def set_axes(self, axes): - self.text.set_axes(axes) - lines.Line2D.set_axes(self, axes) - - def set_transform(self, transform): - # 2 pixel offset - texttrans = transform + mtransforms.Affine2D().translate(2, 2) - self.text.set_transform(texttrans) - lines.Line2D.set_transform(self, transform) - - def set_data(self, x, y): - if len(x): - self.text.set_position((x[-1], y[-1])) - - lines.Line2D.set_data(self, x, y) - - def draw(self, renderer): - # draw my label at the end of the line with 2 pixel offset - lines.Line2D.draw(self, renderer) - self.text.draw(renderer) - - - fig, ax = plt.subplots() - x, y = np.random.rand(2, 20) - line = MyLine(x, y, mfc='red', ms=12, label='line label') - #line.text.set_text('line label') - line.text.set_color('red') - line.text.set_fontsize(16) - - - ax.add_line(line) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/line_with_text.txt b/_sources/examples/api/line_with_text.txt deleted file mode 100644 index c212e5262fc..00000000000 --- a/_sources/examples/api/line_with_text.txt +++ /dev/null @@ -1,73 +0,0 @@ -.. _api-line_with_text: - -api example code: line_with_text.py -=================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/line_with_text.py - -:: - - """ - Show how to override basic methods so an artist can contain another - artist. In this case, the line contains a Text instance to label it. - """ - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.lines as lines - import matplotlib.transforms as mtransforms - import matplotlib.text as mtext - - - class MyLine(lines.Line2D): - def __init__(self, *args, **kwargs): - # we'll update the position when the line data is set - self.text = mtext.Text(0, 0, '') - lines.Line2D.__init__(self, *args, **kwargs) - - # we can't access the label attr until *after* the line is - # inited - self.text.set_text(self.get_label()) - - def set_figure(self, figure): - self.text.set_figure(figure) - lines.Line2D.set_figure(self, figure) - - def set_axes(self, axes): - self.text.set_axes(axes) - lines.Line2D.set_axes(self, axes) - - def set_transform(self, transform): - # 2 pixel offset - texttrans = transform + mtransforms.Affine2D().translate(2, 2) - self.text.set_transform(texttrans) - lines.Line2D.set_transform(self, transform) - - def set_data(self, x, y): - if len(x): - self.text.set_position((x[-1], y[-1])) - - lines.Line2D.set_data(self, x, y) - - def draw(self, renderer): - # draw my label at the end of the line with 2 pixel offset - lines.Line2D.draw(self, renderer) - self.text.draw(renderer) - - - fig, ax = plt.subplots() - x, y = np.random.rand(2, 20) - line = MyLine(x, y, mfc='red', ms=12, label='line label') - #line.text.set_text('line label') - line.text.set_color('red') - line.text.set_fontsize(16) - - - ax.add_line(line) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/logo2.rst.txt b/_sources/examples/api/logo2.rst.txt deleted file mode 100644 index 766a80c72ae..00000000000 --- a/_sources/examples/api/logo2.rst.txt +++ /dev/null @@ -1,103 +0,0 @@ -.. _api-logo2: - -api example code: logo2.py -========================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/logo2.py - -:: - - """ - ========== - matplotlib - ========== - - Thanks to Tony Yu for the logo design - """ - - import numpy as np - import matplotlib as mpl - import matplotlib.pyplot as plt - import matplotlib.cm as cm - - mpl.rcParams['xtick.labelsize'] = 10 - mpl.rcParams['ytick.labelsize'] = 12 - mpl.rcParams['axes.edgecolor'] = 'gray' - - - axalpha = 0.05 - figcolor = 'white' - dpi = 80 - fig = plt.figure(figsize=(6, 1.1), dpi=dpi) - fig.figurePatch.set_edgecolor(figcolor) - fig.figurePatch.set_facecolor(figcolor) - - - def add_math_background(): - ax = fig.add_axes([0., 0., 1., 1.]) - - text = [] - text.append( - (r"$W^{3\beta}_{\delta_1 \rho_1 \sigma_2} = " - r"U^{3\beta}_{\delta_1 \rho_1} + \frac{1}{8 \pi 2}" - r"\int^{\alpha_2}_{\alpha_2} d \alpha^\prime_2 " - r"\left[\frac{ U^{2\beta}_{\delta_1 \rho_1} - " - r"\alpha^\prime_2U^{1\beta}_{\rho_1 \sigma_2} " - r"}{U^{0\beta}_{\rho_1 \sigma_2}}\right]$", (0.7, 0.2), 20)) - text.append((r"$\frac{d\rho}{d t} + \rho \vec{v}\cdot\nabla\vec{v} " - r"= -\nabla p + \mu\nabla^2 \vec{v} + \rho \vec{g}$", - (0.35, 0.9), 20)) - text.append((r"$\int_{-\infty}^\infty e^{-x^2}dx=\sqrt{\pi}$", - (0.15, 0.3), 25)) - text.append((r"$F_G = G\frac{m_1m_2}{r^2}$", - (0.85, 0.7), 30)) - for eq, (x, y), size in text: - ax.text(x, y, eq, ha='center', va='center', color="#11557c", - alpha=0.25, transform=ax.transAxes, fontsize=size) - ax.set_axis_off() - return ax - - - def add_matplotlib_text(ax): - ax.text(0.95, 0.5, 'matplotlib', color='#11557c', fontsize=65, - ha='right', va='center', alpha=1.0, transform=ax.transAxes) - - - def add_polar_bar(): - ax = fig.add_axes([0.025, 0.075, 0.2, 0.85], projection='polar') - - ax.axesPatch.set_alpha(axalpha) - ax.set_axisbelow(True) - N = 7 - arc = 2. * np.pi - theta = np.arange(0.0, arc, arc/N) - radii = 10 * np.array([0.2, 0.6, 0.8, 0.7, 0.4, 0.5, 0.8]) - width = np.pi / 4 * np.array([0.4, 0.4, 0.6, 0.8, 0.2, 0.5, 0.3]) - bars = ax.bar(theta, radii, width=width, bottom=0.0) - for r, bar in zip(radii, bars): - bar.set_facecolor(cm.jet(r/10.)) - bar.set_alpha(0.6) - - for label in ax.get_xticklabels() + ax.get_yticklabels(): - label.set_visible(False) - - for line in ax.get_ygridlines() + ax.get_xgridlines(): - line.set_lw(0.8) - 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) - - - if __name__ == '__main__': - main_axes = add_math_background() - add_polar_bar() - add_matplotlib_text(main_axes) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/logo2.txt b/_sources/examples/api/logo2.txt deleted file mode 100644 index 30fdd5a691d..00000000000 --- a/_sources/examples/api/logo2.txt +++ /dev/null @@ -1,101 +0,0 @@ -.. _api-logo2: - -api example code: logo2.py -========================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/logo2.py - -:: - - """ - Thanks to Tony Yu for the logo design - """ - - import numpy as np - import matplotlib as mpl - import matplotlib.pyplot as plt - import matplotlib.cm as cm - - mpl.rcParams['xtick.labelsize'] = 10 - mpl.rcParams['ytick.labelsize'] = 12 - mpl.rcParams['axes.edgecolor'] = 'gray' - - - axalpha = 0.05 - #figcolor = '#EFEFEF' - figcolor = 'white' - dpi = 80 - fig = plt.figure(figsize=(6, 1.1), dpi=dpi) - fig.figurePatch.set_edgecolor(figcolor) - fig.figurePatch.set_facecolor(figcolor) - - - def add_math_background(): - ax = fig.add_axes([0., 0., 1., 1.]) - - text = [] - text.append( - (r"$W^{3\beta}_{\delta_1 \rho_1 \sigma_2} = " - r"U^{3\beta}_{\delta_1 \rho_1} + \frac{1}{8 \pi 2}" - r"\int^{\alpha_2}_{\alpha_2} d \alpha^\prime_2 " - r"\left[\frac{ U^{2\beta}_{\delta_1 \rho_1} - " - r"\alpha^\prime_2U^{1\beta}_{\rho_1 \sigma_2} " - r"}{U^{0\beta}_{\rho_1 \sigma_2}}\right]$", (0.7, 0.2), 20)) - text.append((r"$\frac{d\rho}{d t} + \rho \vec{v}\cdot\nabla\vec{v} " - r"= -\nabla p + \mu\nabla^2 \vec{v} + \rho \vec{g}$", - (0.35, 0.9), 20)) - text.append((r"$\int_{-\infty}^\infty e^{-x^2}dx=\sqrt{\pi}$", - (0.15, 0.3), 25)) - #text.append((r"$E = mc^2 = \sqrt{{m_0}^2c^4 + p^2c^2}$", - # (0.7, 0.42), 30)) - text.append((r"$F_G = G\frac{m_1m_2}{r^2}$", - (0.85, 0.7), 30)) - for eq, (x, y), size in text: - ax.text(x, y, eq, ha='center', va='center', color="#11557c", - alpha=0.25, transform=ax.transAxes, fontsize=size) - ax.set_axis_off() - return ax - - - def add_matplotlib_text(ax): - ax.text(0.95, 0.5, 'matplotlib', color='#11557c', fontsize=65, - ha='right', va='center', alpha=1.0, transform=ax.transAxes) - - - def add_polar_bar(): - ax = fig.add_axes([0.025, 0.075, 0.2, 0.85], projection='polar') - - ax.axesPatch.set_alpha(axalpha) - ax.set_axisbelow(True) - N = 7 - arc = 2. * np.pi - theta = np.arange(0.0, arc, arc/N) - radii = 10 * np.array([0.2, 0.6, 0.8, 0.7, 0.4, 0.5, 0.8]) - width = np.pi / 4 * np.array([0.4, 0.4, 0.6, 0.8, 0.2, 0.5, 0.3]) - bars = ax.bar(theta, radii, width=width, bottom=0.0) - for r, bar in zip(radii, bars): - bar.set_facecolor(cm.jet(r/10.)) - bar.set_alpha(0.6) - - for label in ax.get_xticklabels() + ax.get_yticklabels(): - label.set_visible(False) - - for line in ax.get_ygridlines() + ax.get_xgridlines(): - line.set_lw(0.8) - 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) - - if __name__ == '__main__': - main_axes = add_math_background() - add_polar_bar() - add_matplotlib_text(main_axes) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/mathtext_asarray.rst.txt b/_sources/examples/api/mathtext_asarray.rst.txt deleted file mode 100644 index 0476d8bd007..00000000000 --- a/_sources/examples/api/mathtext_asarray.rst.txt +++ /dev/null @@ -1,42 +0,0 @@ -.. _api-mathtext_asarray: - -api example code: mathtext_asarray.py -===================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/mathtext_asarray.py - -:: - - """ - =============================== - A mathtext image as numpy array - =============================== - - This example shows how to make images from LaTeX strings. - """ - - import matplotlib.mathtext as mathtext - import matplotlib.pyplot as plt - import matplotlib - matplotlib.rc('image', origin='upper') - - parser = mathtext.MathTextParser("Bitmap") - parser.to_png('test2.png', - r'$\left[\left\lfloor\frac{5}{\frac{\left(3\right)}{4}} ' - r'y\right)\right]$', color='green', fontsize=14, dpi=100) - - rgba1, depth1 = parser.to_rgba( - r'IQ: $\sigma_i=15$', color='blue', fontsize=20, dpi=200) - rgba2, depth2 = parser.to_rgba( - r'some other string', color='red', fontsize=20, dpi=200) - - fig = plt.figure() - fig.figimage(rgba1.astype(float)/255., 100, 100) - fig.figimage(rgba2.astype(float)/255., 100, 300) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/mathtext_asarray.txt b/_sources/examples/api/mathtext_asarray.txt deleted file mode 100644 index b9a2e9a32f8..00000000000 --- a/_sources/examples/api/mathtext_asarray.txt +++ /dev/null @@ -1,38 +0,0 @@ -.. _api-mathtext_asarray: - -api example code: mathtext_asarray.py -===================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/mathtext_asarray.py - -:: - - """ - Load a mathtext image as numpy array - """ - - import matplotlib.mathtext as mathtext - import matplotlib.pyplot as plt - import matplotlib - matplotlib.rc('image', origin='upper') - - parser = mathtext.MathTextParser("Bitmap") - parser.to_png('test2.png', - r'$\left[\left\lfloor\frac{5}{\frac{\left(3\right)}{4}} ' - r'y\right)\right]$', color='green', fontsize=14, dpi=100) - - rgba1, depth1 = parser.to_rgba( - r'IQ: $\sigma_i=15$', color='blue', fontsize=20, dpi=200) - rgba2, depth2 = parser.to_rgba( - r'some other string', color='red', fontsize=20, dpi=200) - - fig = plt.figure() - fig.figimage(rgba1.astype(float)/255., 100, 100) - fig.figimage(rgba2.astype(float)/255., 100, 300) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/patch_collection.rst.txt b/_sources/examples/api/patch_collection.rst.txt deleted file mode 100644 index 5b5d8b26cf5..00000000000 --- a/_sources/examples/api/patch_collection.rst.txt +++ /dev/null @@ -1,67 +0,0 @@ -.. _api-patch_collection: - -api example code: patch_collection.py -===================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/patch_collection.py - -:: - - """ - ============================ - Circles, Wedges and Polygons - ============================ - """ - - import numpy as np - import matplotlib - from matplotlib.patches import Circle, Wedge, Polygon - from matplotlib.collections import PatchCollection - import matplotlib.pyplot as plt - - - fig, ax = plt.subplots() - - resolution = 50 # the number of vertices - N = 3 - x = np.random.rand(N) - y = np.random.rand(N) - radii = 0.1*np.random.rand(N) - patches = [] - for x1, y1, r in zip(x, y, radii): - circle = Circle((x1, y1), r) - patches.append(circle) - - x = np.random.rand(N) - y = np.random.rand(N) - radii = 0.1*np.random.rand(N) - theta1 = 360.0*np.random.rand(N) - theta2 = 360.0*np.random.rand(N) - for x1, y1, r, t1, t2 in zip(x, y, radii, theta1, theta2): - wedge = Wedge((x1, y1), r, t1, t2) - patches.append(wedge) - - # Some limiting conditions on Wedge - patches += [ - Wedge((.3, .7), .1, 0, 360), # Full circle - Wedge((.7, .8), .2, 0, 360, width=0.05), # Full ring - Wedge((.8, .3), .2, 0, 45), # Full sector - Wedge((.8, .3), .2, 45, 90, width=0.10), # Ring sector - ] - - for i in range(N): - polygon = Polygon(np.random.rand(N, 2), True) - patches.append(polygon) - - colors = 100*np.random.rand(len(patches)) - p = PatchCollection(patches, alpha=0.4) - p.set_array(np.array(colors)) - ax.add_collection(p) - fig.colorbar(p, ax=ax) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/patch_collection.txt b/_sources/examples/api/patch_collection.txt deleted file mode 100644 index bb20e283fa0..00000000000 --- a/_sources/examples/api/patch_collection.txt +++ /dev/null @@ -1,61 +0,0 @@ -.. _api-patch_collection: - -api example code: patch_collection.py -===================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/patch_collection.py - -:: - - import numpy as np - import matplotlib - from matplotlib.patches import Circle, Wedge, Polygon - from matplotlib.collections import PatchCollection - import matplotlib.pyplot as plt - - - fig, ax = plt.subplots() - - resolution = 50 # the number of vertices - N = 3 - x = np.random.rand(N) - y = np.random.rand(N) - radii = 0.1*np.random.rand(N) - patches = [] - for x1, y1, r in zip(x, y, radii): - circle = Circle((x1, y1), r) - patches.append(circle) - - x = np.random.rand(N) - y = np.random.rand(N) - radii = 0.1*np.random.rand(N) - theta1 = 360.0*np.random.rand(N) - theta2 = 360.0*np.random.rand(N) - for x1, y1, r, t1, t2 in zip(x, y, radii, theta1, theta2): - wedge = Wedge((x1, y1), r, t1, t2) - patches.append(wedge) - - # Some limiting conditions on Wedge - patches += [ - Wedge((.3, .7), .1, 0, 360), # Full circle - Wedge((.7, .8), .2, 0, 360, width=0.05), # Full ring - Wedge((.8, .3), .2, 0, 45), # Full sector - Wedge((.8, .3), .2, 45, 90, width=0.10), # Ring sector - ] - - for i in range(N): - polygon = Polygon(np.random.rand(N, 2), True) - patches.append(polygon) - - colors = 100*np.random.rand(len(patches)) - p = PatchCollection(patches, cmap=matplotlib.cm.jet, alpha=0.4) - p.set_array(np.array(colors)) - ax.add_collection(p) - plt.colorbar(p) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/path_patch_demo.txt b/_sources/examples/api/path_patch_demo.txt deleted file mode 100644 index f1d4d801a90..00000000000 --- a/_sources/examples/api/path_patch_demo.txt +++ /dev/null @@ -1,50 +0,0 @@ -.. _api-path_patch_demo: - -api example code: path_patch_demo.py -==================================== - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/api/path_patch_demo.py - -:: - - import numpy as np - import matplotlib.path as mpath - import matplotlib.patches as mpatches - import matplotlib.pyplot as plt - - Path = mpath.Path - - fig = plt.figure() - ax = fig.add_subplot(111) - - pathdata = [ - (Path.MOVETO, (1.58, -2.57)), - (Path.CURVE4, (0.35, -1.1)), - (Path.CURVE4, (-1.75, 2.0)), - (Path.CURVE4, (0.375, 2.0)), - (Path.LINETO, (0.85, 1.15)), - (Path.CURVE4, (2.2, 3.2)), - (Path.CURVE4, (3, 0.05)), - (Path.CURVE4, (2.0, -0.5)), - (Path.CLOSEPOLY, (1.58, -2.57)), - ] - - codes, verts = zip(*pathdata) - path = mpath.Path(verts, codes) - patch = mpatches.PathPatch(path, facecolor='red', edgecolor='yellow', alpha=0.5) - ax.add_patch(patch) - - x, y = zip(*path.vertices) - line, = ax.plot(x, y, 'go-') - ax.grid() - ax.set_xlim(-3,4) - ax.set_ylim(-3,4) - ax.set_title('spline paths') - plt.show() - - - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/power_norm_demo.rst.txt b/_sources/examples/api/power_norm_demo.rst.txt deleted file mode 100644 index 7f584e9a58c..00000000000 --- a/_sources/examples/api/power_norm_demo.rst.txt +++ /dev/null @@ -1,48 +0,0 @@ -.. _api-power_norm_demo: - -api example code: power_norm_demo.py -==================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/power_norm_demo.py - -:: - - """ - ======================== - Exploring normalizations - ======================== - - Let's explore various normalization on a multivariate normal distribution. - - """ - - from matplotlib import pyplot as plt - import matplotlib.colors as mcolors - import numpy as np - from numpy.random import multivariate_normal - - data = np.vstack([ - multivariate_normal([10, 10], [[3, 2], [2, 3]], size=100000), - multivariate_normal([30, 20], [[2, 3], [1, 3]], size=1000) - ]) - - gammas = [0.8, 0.5, 0.3] - - fig, axes = plt.subplots(nrows=2, ncols=2) - - axes[0, 0].set_title('Linear normalization') - axes[0, 0].hist2d(data[:, 0], data[:, 1], bins=100) - - for ax, gamma in zip(axes.flat[1:], gammas): - ax.set_title('Power law $(\gamma=%1.1f)$' % gamma) - ax.hist2d(data[:, 0], data[:, 1], - bins=100, norm=mcolors.PowerNorm(gamma)) - - fig.tight_layout() - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/power_norm_demo.txt b/_sources/examples/api/power_norm_demo.txt deleted file mode 100644 index ea5f7b2c8cd..00000000000 --- a/_sources/examples/api/power_norm_demo.txt +++ /dev/null @@ -1,41 +0,0 @@ -.. _api-power_norm_demo: - -api example code: power_norm_demo.py -==================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/power_norm_demo.py - -:: - - #!/usr/bin/python - - from matplotlib import pyplot as plt - import matplotlib.colors as mcolors - import numpy as np - from numpy.random import multivariate_normal - - data = np.vstack([multivariate_normal([10, 10], [[2, 2], [2, 2]], size=100000), - multivariate_normal([30, 20], [[2, 3], [1, 3]], size=1000) - ]) - - gammas = [0.8, 0.5, 0.3] - xgrid = np.floor((len(gammas) + 1.) / 2) - ygrid = np.ceil((len(gammas) + 1.) / 2) - - plt.subplot(xgrid, ygrid, 1) - plt.title('Linear normalization') - plt.hist2d(data[:, 0], data[:, 1], bins=100) - - for i, gamma in enumerate(gammas): - plt.subplot(xgrid, ygrid, i + 2) - plt.title('Power law normalization\n$(\gamma=%1.1f)$' % gamma) - plt.hist2d(data[:, 0], data[:, 1], - bins=100, norm=mcolors.PowerNorm(gamma)) - - plt.subplots_adjust(hspace=0.39) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/quad_bezier.rst.txt b/_sources/examples/api/quad_bezier.rst.txt deleted file mode 100644 index f5e185dbee2..00000000000 --- a/_sources/examples/api/quad_bezier.rst.txt +++ /dev/null @@ -1,40 +0,0 @@ -.. _api-quad_bezier: - -api example code: quad_bezier.py -================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/quad_bezier.py - -:: - - """ - ============ - Bezier Curve - ============ - - This example showcases the PathPatch object to create a Bezier polycurve path - patch. - """ - - import matplotlib.path as mpath - import matplotlib.patches as mpatches - import matplotlib.pyplot as plt - - Path = mpath.Path - - fig, ax = plt.subplots() - pp1 = mpatches.PathPatch( - Path([(0, 0), (1, 0), (1, 1), (0, 0)], - [Path.MOVETO, Path.CURVE3, Path.CURVE3, Path.CLOSEPOLY]), - fc="none", transform=ax.transData) - - ax.add_patch(pp1) - ax.plot([0.75], [0.25], "ro") - ax.set_title('The red point should be on the path') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/quad_bezier.txt b/_sources/examples/api/quad_bezier.txt deleted file mode 100644 index 7ad96d59d7a..00000000000 --- a/_sources/examples/api/quad_bezier.txt +++ /dev/null @@ -1,31 +0,0 @@ -.. _api-quad_bezier: - -api example code: quad_bezier.py -================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/quad_bezier.py - -:: - - import matplotlib.path as mpath - import matplotlib.patches as mpatches - import matplotlib.pyplot as plt - - Path = mpath.Path - - fig, ax = plt.subplots() - pp1 = mpatches.PathPatch( - Path([(0, 0), (1, 0), (1, 1), (0, 0)], - [Path.MOVETO, Path.CURVE3, Path.CURVE3, Path.CLOSEPOLY]), - fc="none", transform=ax.transData) - - ax.add_patch(pp1) - ax.plot([0.75], [0.25], "ro") - ax.set_title('The red point should be on the path') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/radar_chart.rst.txt b/_sources/examples/api/radar_chart.rst.txt deleted file mode 100644 index c785418b7b2..00000000000 --- a/_sources/examples/api/radar_chart.rst.txt +++ /dev/null @@ -1,215 +0,0 @@ -.. _api-radar_chart: - -api example code: radar_chart.py -================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/radar_chart.py - -:: - - """ - ====================================== - Radar chart (aka spider or star chart) - ====================================== - - This example creates a radar chart, also known as a spider or star chart [1]_. - - Although this example allows a frame of either 'circle' or 'polygon', polygon - frames don't have proper gridlines (the lines are circles instead of polygons). - It's possible to get a polygon grid by setting GRIDLINE_INTERPOLATION_STEPS in - matplotlib.axis to the desired number of vertices, but the orientation of the - polygon is not aligned with the radial axes. - - .. [1] http://en.wikipedia.org/wiki/Radar_chart - """ - import numpy as np - - import matplotlib.pyplot as plt - from matplotlib.path import Path - from matplotlib.spines import Spine - from matplotlib.projections.polar import PolarAxes - from matplotlib.projections import register_projection - - - def radar_factory(num_vars, frame='circle'): - """Create a radar chart with `num_vars` axes. - - This function creates a RadarAxes projection and registers it. - - Parameters - ---------- - num_vars : int - Number of variables for radar chart. - frame : {'circle' | 'polygon'} - Shape of frame surrounding axes. - - """ - # calculate evenly-spaced axis angles - theta = np.linspace(0, 2*np.pi, num_vars, endpoint=False) - # rotate theta such that the first axis is at the top - theta += np.pi/2 - - def draw_poly_patch(self): - verts = unit_poly_verts(theta) - return plt.Polygon(verts, closed=True, edgecolor='k') - - def draw_circle_patch(self): - # unit circle centered on (0.5, 0.5) - return plt.Circle((0.5, 0.5), 0.5) - - patch_dict = {'polygon': draw_poly_patch, 'circle': draw_circle_patch} - if frame not in patch_dict: - raise ValueError('unknown value for `frame`: %s' % frame) - - class RadarAxes(PolarAxes): - - name = 'radar' - # use 1 line segment to connect specified points - RESOLUTION = 1 - # define draw_frame method - draw_patch = patch_dict[frame] - - def fill(self, *args, **kwargs): - """Override fill so that line is closed by default""" - closed = kwargs.pop('closed', True) - return super(RadarAxes, self).fill(closed=closed, *args, **kwargs) - - def plot(self, *args, **kwargs): - """Override plot so that line is closed by default""" - lines = super(RadarAxes, self).plot(*args, **kwargs) - for line in lines: - self._close_line(line) - - def _close_line(self, line): - x, y = line.get_data() - # FIXME: markers at x[0], y[0] get doubled-up - if x[0] != x[-1]: - x = np.concatenate((x, [x[0]])) - y = np.concatenate((y, [y[0]])) - line.set_data(x, y) - - def set_varlabels(self, labels): - self.set_thetagrids(np.degrees(theta), labels) - - def _gen_axes_patch(self): - return self.draw_patch() - - def _gen_axes_spines(self): - if frame == 'circle': - return PolarAxes._gen_axes_spines(self) - # The following is a hack to get the spines (i.e. the axes frame) - # to draw correctly for a polygon frame. - - # spine_type must be 'left', 'right', 'top', 'bottom', or `circle`. - spine_type = 'circle' - verts = unit_poly_verts(theta) - # close off polygon by repeating first vertex - verts.append(verts[0]) - path = Path(verts) - - spine = Spine(self, spine_type, path) - spine.set_transform(self.transAxes) - return {'polar': spine} - - register_projection(RadarAxes) - return theta - - - def unit_poly_verts(theta): - """Return vertices of polygon for subplot axes. - - This polygon is circumscribed by a unit circle centered at (0.5, 0.5) - """ - x0, y0, r = [0.5] * 3 - verts = [(r*np.cos(t) + x0, r*np.sin(t) + y0) for t in theta] - return verts - - - def example_data(): - # The following data is from the Denver Aerosol Sources and Health study. - # See doi:10.1016/j.atmosenv.2008.12.017 - # - # The data are pollution source profile estimates for five modeled - # pollution sources (e.g., cars, wood-burning, etc) that emit 7-9 chemical - # species. The radar charts are experimented with here to see if we can - # nicely visualize how the modeled source profiles change across four - # scenarios: - # 1) No gas-phase species present, just seven particulate counts on - # Sulfate - # Nitrate - # Elemental Carbon (EC) - # Organic Carbon fraction 1 (OC) - # Organic Carbon fraction 2 (OC2) - # Organic Carbon fraction 3 (OC3) - # Pyrolized Organic Carbon (OP) - # 2)Inclusion of gas-phase specie carbon monoxide (CO) - # 3)Inclusion of gas-phase specie ozone (O3). - # 4)Inclusion of both gas-phase species is present... - data = [ - ['Sulfate', 'Nitrate', 'EC', 'OC1', 'OC2', 'OC3', 'OP', 'CO', 'O3'], - ('Basecase', [ - [0.88, 0.01, 0.03, 0.03, 0.00, 0.06, 0.01, 0.00, 0.00], - [0.07, 0.95, 0.04, 0.05, 0.00, 0.02, 0.01, 0.00, 0.00], - [0.01, 0.02, 0.85, 0.19, 0.05, 0.10, 0.00, 0.00, 0.00], - [0.02, 0.01, 0.07, 0.01, 0.21, 0.12, 0.98, 0.00, 0.00], - [0.01, 0.01, 0.02, 0.71, 0.74, 0.70, 0.00, 0.00, 0.00]]), - ('With CO', [ - [0.88, 0.02, 0.02, 0.02, 0.00, 0.05, 0.00, 0.05, 0.00], - [0.08, 0.94, 0.04, 0.02, 0.00, 0.01, 0.12, 0.04, 0.00], - [0.01, 0.01, 0.79, 0.10, 0.00, 0.05, 0.00, 0.31, 0.00], - [0.00, 0.02, 0.03, 0.38, 0.31, 0.31, 0.00, 0.59, 0.00], - [0.02, 0.02, 0.11, 0.47, 0.69, 0.58, 0.88, 0.00, 0.00]]), - ('With O3', [ - [0.89, 0.01, 0.07, 0.00, 0.00, 0.05, 0.00, 0.00, 0.03], - [0.07, 0.95, 0.05, 0.04, 0.00, 0.02, 0.12, 0.00, 0.00], - [0.01, 0.02, 0.86, 0.27, 0.16, 0.19, 0.00, 0.00, 0.00], - [0.01, 0.03, 0.00, 0.32, 0.29, 0.27, 0.00, 0.00, 0.95], - [0.02, 0.00, 0.03, 0.37, 0.56, 0.47, 0.87, 0.00, 0.00]]), - ('CO & O3', [ - [0.87, 0.01, 0.08, 0.00, 0.00, 0.04, 0.00, 0.00, 0.01], - [0.09, 0.95, 0.02, 0.03, 0.00, 0.01, 0.13, 0.06, 0.00], - [0.01, 0.02, 0.71, 0.24, 0.13, 0.16, 0.00, 0.50, 0.00], - [0.01, 0.03, 0.00, 0.28, 0.24, 0.23, 0.00, 0.44, 0.88], - [0.02, 0.00, 0.18, 0.45, 0.64, 0.55, 0.86, 0.00, 0.16]]) - ] - return data - - - if __name__ == '__main__': - N = 9 - theta = radar_factory(N, frame='polygon') - - data = example_data() - spoke_labels = data.pop(0) - - fig, axes = plt.subplots(figsize=(9, 9), nrows=2, ncols=2, - subplot_kw=dict(projection='radar')) - fig.subplots_adjust(wspace=0.25, hspace=0.20, top=0.85, bottom=0.05) - - colors = ['b', 'r', 'g', 'm', 'y'] - # Plot the four cases from the example data on separate axes - for ax, (title, case_data) in zip(axes.flatten(), data): - ax.set_rgrids([0.2, 0.4, 0.6, 0.8]) - ax.set_title(title, weight='bold', size='medium', position=(0.5, 1.1), - horizontalalignment='center', verticalalignment='center') - for d, color in zip(case_data, colors): - ax.plot(theta, d, color=color) - ax.fill(theta, d, facecolor=color, alpha=0.25) - ax.set_varlabels(spoke_labels) - - # add legend relative to top-left plot - ax = axes[0, 0] - labels = ('Factor 1', 'Factor 2', 'Factor 3', 'Factor 4', 'Factor 5') - legend = ax.legend(labels, loc=(0.9, .95), - labelspacing=0.1, fontsize='small') - - fig.text(0.5, 0.965, '5-Factor Solution Profiles Across Four Scenarios', - horizontalalignment='center', color='black', weight='bold', - size='large') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/radar_chart.txt b/_sources/examples/api/radar_chart.txt deleted file mode 100644 index 57283541b8d..00000000000 --- a/_sources/examples/api/radar_chart.txt +++ /dev/null @@ -1,209 +0,0 @@ -.. _api-radar_chart: - -api example code: radar_chart.py -================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/radar_chart.py - -:: - - """ - Example of creating a radar chart (a.k.a. a spider or star chart) [1]_. - - Although this example allows a frame of either 'circle' or 'polygon', polygon - frames don't have proper gridlines (the lines are circles instead of polygons). - It's possible to get a polygon grid by setting GRIDLINE_INTERPOLATION_STEPS in - matplotlib.axis to the desired number of vertices, but the orientation of the - polygon is not aligned with the radial axes. - - .. [1] http://en.wikipedia.org/wiki/Radar_chart - """ - import numpy as np - - import matplotlib.pyplot as plt - from matplotlib.path import Path - from matplotlib.spines import Spine - from matplotlib.projections.polar import PolarAxes - from matplotlib.projections import register_projection - - - def radar_factory(num_vars, frame='circle'): - """Create a radar chart with `num_vars` axes. - - This function creates a RadarAxes projection and registers it. - - Parameters - ---------- - num_vars : int - Number of variables for radar chart. - frame : {'circle' | 'polygon'} - Shape of frame surrounding axes. - - """ - # calculate evenly-spaced axis angles - theta = np.linspace(0, 2*np.pi, num_vars, endpoint=False) - # rotate theta such that the first axis is at the top - theta += np.pi/2 - - def draw_poly_patch(self): - verts = unit_poly_verts(theta) - return plt.Polygon(verts, closed=True, edgecolor='k') - - def draw_circle_patch(self): - # unit circle centered on (0.5, 0.5) - return plt.Circle((0.5, 0.5), 0.5) - - patch_dict = {'polygon': draw_poly_patch, 'circle': draw_circle_patch} - if frame not in patch_dict: - raise ValueError('unknown value for `frame`: %s' % frame) - - class RadarAxes(PolarAxes): - - name = 'radar' - # use 1 line segment to connect specified points - RESOLUTION = 1 - # define draw_frame method - draw_patch = patch_dict[frame] - - def fill(self, *args, **kwargs): - """Override fill so that line is closed by default""" - closed = kwargs.pop('closed', True) - return super(RadarAxes, self).fill(closed=closed, *args, **kwargs) - - def plot(self, *args, **kwargs): - """Override plot so that line is closed by default""" - lines = super(RadarAxes, self).plot(*args, **kwargs) - for line in lines: - self._close_line(line) - - def _close_line(self, line): - x, y = line.get_data() - # FIXME: markers at x[0], y[0] get doubled-up - if x[0] != x[-1]: - x = np.concatenate((x, [x[0]])) - y = np.concatenate((y, [y[0]])) - line.set_data(x, y) - - def set_varlabels(self, labels): - self.set_thetagrids(np.degrees(theta), labels) - - def _gen_axes_patch(self): - return self.draw_patch() - - def _gen_axes_spines(self): - if frame == 'circle': - return PolarAxes._gen_axes_spines(self) - # The following is a hack to get the spines (i.e. the axes frame) - # to draw correctly for a polygon frame. - - # spine_type must be 'left', 'right', 'top', 'bottom', or `circle`. - spine_type = 'circle' - verts = unit_poly_verts(theta) - # close off polygon by repeating first vertex - verts.append(verts[0]) - path = Path(verts) - - spine = Spine(self, spine_type, path) - spine.set_transform(self.transAxes) - return {'polar': spine} - - register_projection(RadarAxes) - return theta - - - def unit_poly_verts(theta): - """Return vertices of polygon for subplot axes. - - This polygon is circumscribed by a unit circle centered at (0.5, 0.5) - """ - x0, y0, r = [0.5] * 3 - verts = [(r*np.cos(t) + x0, r*np.sin(t) + y0) for t in theta] - return verts - - - def example_data(): - # The following data is from the Denver Aerosol Sources and Health study. - # See doi:10.1016/j.atmosenv.2008.12.017 - # - # The data are pollution source profile estimates for five modeled - # pollution sources (e.g., cars, wood-burning, etc) that emit 7-9 chemical - # species. The radar charts are experimented with here to see if we can - # nicely visualize how the modeled source profiles change across four - # scenarios: - # 1) No gas-phase species present, just seven particulate counts on - # Sulfate - # Nitrate - # Elemental Carbon (EC) - # Organic Carbon fraction 1 (OC) - # Organic Carbon fraction 2 (OC2) - # Organic Carbon fraction 3 (OC3) - # Pyrolized Organic Carbon (OP) - # 2)Inclusion of gas-phase specie carbon monoxide (CO) - # 3)Inclusion of gas-phase specie ozone (O3). - # 4)Inclusion of both gas-phase speciesis present... - data = [ - ['Sulfate', 'Nitrate', 'EC', 'OC1', 'OC2', 'OC3', 'OP', 'CO', 'O3'], - ('Basecase', [ - [0.88, 0.01, 0.03, 0.03, 0.00, 0.06, 0.01, 0.00, 0.00], - [0.07, 0.95, 0.04, 0.05, 0.00, 0.02, 0.01, 0.00, 0.00], - [0.01, 0.02, 0.85, 0.19, 0.05, 0.10, 0.00, 0.00, 0.00], - [0.02, 0.01, 0.07, 0.01, 0.21, 0.12, 0.98, 0.00, 0.00], - [0.01, 0.01, 0.02, 0.71, 0.74, 0.70, 0.00, 0.00, 0.00]]), - ('With CO', [ - [0.88, 0.02, 0.02, 0.02, 0.00, 0.05, 0.00, 0.05, 0.00], - [0.08, 0.94, 0.04, 0.02, 0.00, 0.01, 0.12, 0.04, 0.00], - [0.01, 0.01, 0.79, 0.10, 0.00, 0.05, 0.00, 0.31, 0.00], - [0.00, 0.02, 0.03, 0.38, 0.31, 0.31, 0.00, 0.59, 0.00], - [0.02, 0.02, 0.11, 0.47, 0.69, 0.58, 0.88, 0.00, 0.00]]), - ('With O3', [ - [0.89, 0.01, 0.07, 0.00, 0.00, 0.05, 0.00, 0.00, 0.03], - [0.07, 0.95, 0.05, 0.04, 0.00, 0.02, 0.12, 0.00, 0.00], - [0.01, 0.02, 0.86, 0.27, 0.16, 0.19, 0.00, 0.00, 0.00], - [0.01, 0.03, 0.00, 0.32, 0.29, 0.27, 0.00, 0.00, 0.95], - [0.02, 0.00, 0.03, 0.37, 0.56, 0.47, 0.87, 0.00, 0.00]]), - ('CO & O3', [ - [0.87, 0.01, 0.08, 0.00, 0.00, 0.04, 0.00, 0.00, 0.01], - [0.09, 0.95, 0.02, 0.03, 0.00, 0.01, 0.13, 0.06, 0.00], - [0.01, 0.02, 0.71, 0.24, 0.13, 0.16, 0.00, 0.50, 0.00], - [0.01, 0.03, 0.00, 0.28, 0.24, 0.23, 0.00, 0.44, 0.88], - [0.02, 0.00, 0.18, 0.45, 0.64, 0.55, 0.86, 0.00, 0.16]]) - ] - return data - - - if __name__ == '__main__': - N = 9 - theta = radar_factory(N, frame='polygon') - - data = example_data() - spoke_labels = data.pop(0) - - fig = plt.figure(figsize=(9, 9)) - fig.subplots_adjust(wspace=0.25, hspace=0.20, top=0.85, bottom=0.05) - - colors = ['b', 'r', 'g', 'm', 'y'] - # Plot the four cases from the example data on separate axes - for n, (title, case_data) in enumerate(data): - ax = fig.add_subplot(2, 2, n + 1, projection='radar') - plt.rgrids([0.2, 0.4, 0.6, 0.8]) - ax.set_title(title, weight='bold', size='medium', position=(0.5, 1.1), - horizontalalignment='center', verticalalignment='center') - for d, color in zip(case_data, colors): - ax.plot(theta, d, color=color) - ax.fill(theta, d, facecolor=color, alpha=0.25) - ax.set_varlabels(spoke_labels) - - # add legend relative to top-left plot - plt.subplot(2, 2, 1) - labels = ('Factor 1', 'Factor 2', 'Factor 3', 'Factor 4', 'Factor 5') - legend = plt.legend(labels, loc=(0.9, .95), labelspacing=0.1) - plt.setp(legend.get_texts(), fontsize='small') - - plt.figtext(0.5, 0.965, '5-Factor Solution Profiles Across Four Scenarios', - ha='center', color='black', weight='bold', size='large') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/sankey_demo.txt b/_sources/examples/api/sankey_demo.txt deleted file mode 100644 index 1ae0a9de60d..00000000000 --- a/_sources/examples/api/sankey_demo.txt +++ /dev/null @@ -1,202 +0,0 @@ -.. _api-sankey_demo: - -api example code: sankey_demo.py -================================ - - - -.. plot:: /home/darren/Projects/matplotlib/doc/mpl_examples/api/sankey_demo.py - -:: - - #!/usr/bin/env python - - __author__ = "Yannick Copin " - __version__ = "Time-stamp: <10/02/2010 16:49 ycopin@lyopc548.in2p3.fr>" - - import numpy as N - - def sankey(ax, - outputs=[100.], outlabels=None, - inputs=[100.], inlabels='', - dx=40, dy=10, outangle=45, w=3, inangle=30, offset=2, **kwargs): - """Draw a Sankey diagram. - - outputs: array of outputs, should sum up to 100% - outlabels: output labels (same length as outputs), - or None (use default labels) or '' (no labels) - inputs and inlabels: similar for inputs - dx: horizontal elongation - dy: vertical elongation - outangle: output arrow angle [deg] - w: output arrow shoulder - inangle: input dip angle - offset: text offset - **kwargs: propagated to Patch (e.g. fill=False) - - Return (patch,[intexts,outtexts]).""" - - import matplotlib.patches as mpatches - from matplotlib.path import Path - - outs = N.absolute(outputs) - outsigns = N.sign(outputs) - outsigns[-1] = 0 # Last output - - ins = N.absolute(inputs) - insigns = N.sign(inputs) - insigns[0] = 0 # First input - - assert sum(outs)==100, "Outputs don't sum up to 100%" - assert sum(ins)==100, "Inputs don't sum up to 100%" - - def add_output(path, loss, sign=1): - h = (loss/2+w)*N.tan(outangle/180.*N.pi) # Arrow tip height - move,(x,y) = path[-1] # Use last point as reference - if sign==0: # Final loss (horizontal) - path.extend([(Path.LINETO,[x+dx,y]), - (Path.LINETO,[x+dx,y+w]), - (Path.LINETO,[x+dx+h,y-loss/2]), # Tip - (Path.LINETO,[x+dx,y-loss-w]), - (Path.LINETO,[x+dx,y-loss])]) - outtips.append((sign,path[-3][1])) - else: # Intermediate loss (vertical) - path.extend([(Path.CURVE4,[x+dx/2,y]), - (Path.CURVE4,[x+dx,y]), - (Path.CURVE4,[x+dx,y+sign*dy]), - (Path.LINETO,[x+dx-w,y+sign*dy]), - (Path.LINETO,[x+dx+loss/2,y+sign*(dy+h)]), # Tip - (Path.LINETO,[x+dx+loss+w,y+sign*dy]), - (Path.LINETO,[x+dx+loss,y+sign*dy]), - (Path.CURVE3,[x+dx+loss,y-sign*loss]), - (Path.CURVE3,[x+dx/2+loss,y-sign*loss])]) - outtips.append((sign,path[-5][1])) - - def add_input(path, gain, sign=1): - h = (gain/2)*N.tan(inangle/180.*N.pi) # Dip depth - move,(x,y) = path[-1] # Use last point as reference - if sign==0: # First gain (horizontal) - path.extend([(Path.LINETO,[x-dx,y]), - (Path.LINETO,[x-dx+h,y+gain/2]), # Dip - (Path.LINETO,[x-dx,y+gain])]) - xd,yd = path[-2][1] # Dip position - indips.append((sign,[xd-h,yd])) - else: # Intermediate gain (vertical) - path.extend([(Path.CURVE4,[x-dx/2,y]), - (Path.CURVE4,[x-dx,y]), - (Path.CURVE4,[x-dx,y+sign*dy]), - (Path.LINETO,[x-dx-gain/2,y+sign*(dy-h)]), # Dip - (Path.LINETO,[x-dx-gain,y+sign*dy]), - (Path.CURVE3,[x-dx-gain,y-sign*gain]), - (Path.CURVE3,[x-dx/2-gain,y-sign*gain])]) - xd,yd = path[-4][1] # Dip position - indips.append((sign,[xd,yd+sign*h])) - - outtips = [] # Output arrow tip dir. and positions - urpath = [(Path.MOVETO,[0,100])] # 1st point of upper right path - lrpath = [(Path.LINETO,[0,0])] # 1st point of lower right path - for loss,sign in zip(outs,outsigns): - add_output(sign>=0 and urpath or lrpath, loss, sign=sign) - - indips = [] # Input arrow tip dir. and positions - llpath = [(Path.LINETO,[0,0])] # 1st point of lower left path - ulpath = [(Path.MOVETO,[0,100])] # 1st point of upper left path - for gain,sign in zip(ins,insigns)[::-1]: - add_input(sign<=0 and llpath or ulpath, gain, sign=sign) - - def revert(path): - """A path is not just revertable by path[::-1] because of Bezier - curves.""" - rpath = [] - nextmove = Path.LINETO - for move,pos in path[::-1]: - rpath.append((nextmove,pos)) - nextmove = move - return rpath - - # Concatenate subpathes in correct order - path = urpath + revert(lrpath) + llpath + revert(ulpath) - - codes,verts = zip(*path) - verts = N.array(verts) - - # Path patch - path = Path(verts,codes) - patch = mpatches.PathPatch(path, **kwargs) - ax.add_patch(patch) - - if False: # DEBUG - print "urpath", urpath - print "lrpath", revert(lrpath) - print "llpath", llpath - print "ulpath", revert(ulpath) - - xs,ys = zip(*verts) - ax.plot(xs,ys,'go-') - - # Labels - - def set_labels(labels,values): - """Set or check labels according to values.""" - if labels=='': # No labels - return labels - elif labels is None: # Default labels - return [ '%2d%%' % val for val in values ] - else: - assert len(labels)==len(values) - return labels - - def put_labels(labels,positions,output=True): - """Put labels to positions.""" - texts = [] - lbls = output and labels or labels[::-1] - for i,label in enumerate(lbls): - s,(x,y) = positions[i] # Label direction and position - if s==0: - t = ax.text(x+offset,y,label, - ha=output and 'left' or 'right', va='center') - elif s>0: - t = ax.text(x,y+offset,label, ha='center', va='bottom') - else: - t = ax.text(x,y-offset,label, ha='center', va='top') - texts.append(t) - return texts - - outlabels = set_labels(outlabels, outs) - outtexts = put_labels(outlabels, outtips, output=True) - - inlabels = set_labels(inlabels, ins) - intexts = put_labels(inlabels, indips, output=False) - - # Axes management - ax.set_xlim(verts[:,0].min()-dx, verts[:,0].max()+dx) - ax.set_ylim(verts[:,1].min()-dy, verts[:,1].max()+dy) - ax.set_aspect('equal', adjustable='datalim') - - return patch,[intexts,outtexts] - - if __name__=='__main__': - - import matplotlib.pyplot as P - - outputs = [10.,-20.,5.,15.,-10.,40.] - outlabels = ['First','Second','Third','Fourth','Fifth','Hurray!'] - outlabels = [ s+'\n%d%%' % abs(l) for l,s in zip(outputs,outlabels) ] - - inputs = [60.,-25.,15.] - - fig = P.figure() - ax = fig.add_subplot(1,1,1, xticks=[],yticks=[], - title="Sankey diagram" - ) - - patch,(intexts,outtexts) = sankey(ax, outputs=outputs, outlabels=outlabels, - inputs=inputs, inlabels=None, - fc='g', alpha=0.2) - outtexts[1].set_color('r') - outtexts[-1].set_fontweight('bold') - - P.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/sankey_demo_basics.rst.txt b/_sources/examples/api/sankey_demo_basics.rst.txt deleted file mode 100644 index 8c759ce0e4b..00000000000 --- a/_sources/examples/api/sankey_demo_basics.rst.txt +++ /dev/null @@ -1,95 +0,0 @@ -.. _api-sankey_demo_basics: - -api example code: sankey_demo_basics.py -======================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/sankey_demo_basics.py - -:: - - """ - ================ - The Sankey class - ================ - - Demonstrate the Sankey class by producing three basic diagrams. - """ - import numpy as np - import matplotlib.pyplot as plt - - from matplotlib.sankey import Sankey - - - # Example 1 -- Mostly defaults - # This demonstrates how to create a simple diagram by implicitly calling the - # Sankey.add() method and by appending finish() to the call to the class. - Sankey(flows=[0.25, 0.15, 0.60, -0.20, -0.15, -0.05, -0.50, -0.10], - labels=['', '', '', 'First', 'Second', 'Third', 'Fourth', 'Fifth'], - orientations=[-1, 1, 0, 1, 1, 1, 0, -1]).finish() - plt.title("The default settings produce a diagram like this.") - # Notice: - # 1. Axes weren't provided when Sankey() was instantiated, so they were - # created automatically. - # 2. The scale argument wasn't necessary since the data was already - # normalized. - # 3. By default, the lengths of the paths are justified. - - # Example 2 - # This demonstrates: - # 1. Setting one path longer than the others - # 2. Placing a label in the middle of the diagram - # 3. Using the scale argument to normalize the flows - # 4. Implicitly passing keyword arguments to PathPatch() - # 5. Changing the angle of the arrow heads - # 6. Changing the offset between the tips of the paths and their labels - # 7. Formatting the numbers in the path labels and the associated unit - # 8. Changing the appearance of the patch and the labels after the figure is - # created - fig = plt.figure() - ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[], - title="Flow Diagram of a Widget") - sankey = Sankey(ax=ax, scale=0.01, offset=0.2, head_angle=180, - format='%.0f', unit='%') - sankey.add(flows=[25, 0, 60, -10, -20, -5, -15, -10, -40], - labels=['', '', '', 'First', 'Second', 'Third', 'Fourth', - 'Fifth', 'Hurray!'], - orientations=[-1, 1, 0, 1, 1, 1, -1, -1, 0], - pathlengths=[0.25, 0.25, 0.25, 0.25, 0.25, 0.6, 0.25, 0.25, - 0.25], - patchlabel="Widget\nA") # Arguments to matplotlib.patches.PathPatch() - diagrams = sankey.finish() - diagrams[0].texts[-1].set_color('r') - diagrams[0].text.set_fontweight('bold') - # Notice: - # 1. Since the sum of the flows is nonzero, the width of the trunk isn't - # uniform. If verbose.level is helpful (in matplotlibrc), a message is - # given in the terminal window. - # 2. The second flow doesn't appear because its value is zero. Again, if - # verbose.level is helpful, a message is given in the terminal window. - - # Example 3 - # This demonstrates: - # 1. Connecting two systems - # 2. Turning off the labels of the quantities - # 3. Adding a legend - fig = plt.figure() - ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[], title="Two Systems") - flows = [0.25, 0.15, 0.60, -0.10, -0.05, -0.25, -0.15, -0.10, -0.35] - sankey = Sankey(ax=ax, unit=None) - sankey.add(flows=flows, label='one', - orientations=[-1, 1, 0, 1, 1, 1, -1, -1, 0]) - sankey.add(flows=[-0.25, 0.15, 0.1], label='two', - orientations=[-1, -1, -1], prior=0, connect=(0, 0)) - diagrams = sankey.finish() - diagrams[-1].patch.set_hatch('/') - plt.legend(loc='best') - # Notice that only one connection is specified, but the systems form a - # circuit since: (1) the lengths of the paths are justified and (2) the - # orientation and ordering of the flows is mirrored. - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/sankey_demo_basics.txt b/_sources/examples/api/sankey_demo_basics.txt deleted file mode 100644 index 084dd2c46a4..00000000000 --- a/_sources/examples/api/sankey_demo_basics.txt +++ /dev/null @@ -1,92 +0,0 @@ -.. _api-sankey_demo_basics: - -api example code: sankey_demo_basics.py -======================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/sankey_demo_basics.py - -:: - - """Demonstrate the Sankey class by producing three basic diagrams. - """ - import numpy as np - import matplotlib.pyplot as plt - - from matplotlib.sankey import Sankey - - - # Example 1 -- Mostly defaults - # This demonstrates how to create a simple diagram by implicitly calling the - # Sankey.add() method and by appending finish() to the call to the class. - Sankey(flows=[0.25, 0.15, 0.60, -0.20, -0.15, -0.05, -0.50, -0.10], - labels=['', '', '', 'First', 'Second', 'Third', 'Fourth', 'Fifth'], - orientations=[-1, 1, 0, 1, 1, 1, 0, -1]).finish() - plt.title("The default settings produce a diagram like this.") - # Notice: - # 1. Axes weren't provided when Sankey() was instantiated, so they were - # created automatically. - # 2. The scale argument wasn't necessary since the data was already - # normalized. - # 3. By default, the lengths of the paths are justified. - - # Example 2 - # This demonstrates: - # 1. Setting one path longer than the others - # 2. Placing a label in the middle of the diagram - # 3. Using the scale argument to normalize the flows - # 4. Implicitly passing keyword arguments to PathPatch() - # 5. Changing the angle of the arrow heads - # 6. Changing the offset between the tips of the paths and their labels - # 7. Formatting the numbers in the path labels and the associated unit - # 8. Changing the appearance of the patch and the labels after the figure is - # created - fig = plt.figure() - ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[], - title="Flow Diagram of a Widget") - sankey = Sankey(ax=ax, scale=0.01, offset=0.2, head_angle=180, - format='%.0f', unit='%') - sankey.add(flows=[25, 0, 60, -10, -20, -5, -15, -10, -40], - labels=['', '', '', 'First', 'Second', 'Third', 'Fourth', - 'Fifth', 'Hurray!'], - orientations=[-1, 1, 0, 1, 1, 1, -1, -1, 0], - pathlengths=[0.25, 0.25, 0.25, 0.25, 0.25, 0.6, 0.25, 0.25, - 0.25], - patchlabel="Widget\nA", - alpha=0.2, lw=2.0) # Arguments to matplotlib.patches.PathPatch() - diagrams = sankey.finish() - diagrams[0].patch.set_facecolor('#37c959') - diagrams[0].texts[-1].set_color('r') - diagrams[0].text.set_fontweight('bold') - # Notice: - # 1. Since the sum of the flows is nonzero, the width of the trunk isn't - # uniform. If verbose.level is helpful (in matplotlibrc), a message is - # given in the terminal window. - # 2. The second flow doesn't appear because its value is zero. Again, if - # verbose.level is helpful, a message is given in the terminal window. - - # Example 3 - # This demonstrates: - # 1. Connecting two systems - # 2. Turning off the labels of the quantities - # 3. Adding a legend - fig = plt.figure() - ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[], title="Two Systems") - flows = [0.25, 0.15, 0.60, -0.10, -0.05, -0.25, -0.15, -0.10, -0.35] - sankey = Sankey(ax=ax, unit=None) - sankey.add(flows=flows, label='one', - orientations=[-1, 1, 0, 1, 1, 1, -1, -1, 0]) - sankey.add(flows=[-0.25, 0.15, 0.1], fc='#37c959', label='two', - orientations=[-1, -1, -1], prior=0, connect=(0, 0)) - diagrams = sankey.finish() - diagrams[-1].patch.set_hatch('/') - plt.legend(loc='best') - # Notice that only one connection is specified, but the systems form a - # circuit since: (1) the lengths of the paths are justified and (2) the - # orientation and ordering of the flows is mirrored. - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/sankey_demo_links.rst.txt b/_sources/examples/api/sankey_demo_links.rst.txt deleted file mode 100644 index 731568f283e..00000000000 --- a/_sources/examples/api/sankey_demo_links.rst.txt +++ /dev/null @@ -1,72 +0,0 @@ -.. _api-sankey_demo_links: - -api example code: sankey_demo_links.py -====================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/sankey_demo_links.py - -:: - - """ - ====================================== - Long chain of connections using Sankey - ====================================== - - Demonstrate/test the Sankey class by producing a long chain of connections. - """ - - from itertools import cycle - - import matplotlib.pyplot as plt - from matplotlib.sankey import Sankey - - links_per_side = 6 - - - def side(sankey, n=1): - """Generate a side chain.""" - prior = len(sankey.diagrams) - for i in range(0, 2*n, 2): - sankey.add(flows=[1, -1], orientations=[-1, -1], - patchlabel=str(prior + i), - prior=prior + i - 1, connect=(1, 0), alpha=0.5) - sankey.add(flows=[1, -1], orientations=[1, 1], - patchlabel=str(prior + i + 1), - prior=prior + i, connect=(1, 0), alpha=0.5) - - - def corner(sankey): - """Generate a corner link.""" - prior = len(sankey.diagrams) - sankey.add(flows=[1, -1], orientations=[0, 1], - patchlabel=str(prior), facecolor='k', - prior=prior - 1, connect=(1, 0), alpha=0.5) - - - fig = plt.figure() - ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[], - title="Why would you want to do this?\n(But you could.)") - sankey = Sankey(ax=ax, unit=None) - sankey.add(flows=[1, -1], orientations=[0, 1], - patchlabel="0", facecolor='k', - rotation=45) - side(sankey, n=links_per_side) - corner(sankey) - side(sankey, n=links_per_side) - corner(sankey) - side(sankey, n=links_per_side) - corner(sankey) - side(sankey, n=links_per_side) - sankey.finish() - # Notice: - # 1. The alignment doesn't drift significantly (if at all; with 16007 - # subdiagrams there is still closure). - # 2. The first diagram is rotated 45 deg, so all other diagrams are rotated - # accordingly. - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/sankey_demo_links.txt b/_sources/examples/api/sankey_demo_links.txt deleted file mode 100644 index f5dbd677351..00000000000 --- a/_sources/examples/api/sankey_demo_links.txt +++ /dev/null @@ -1,68 +0,0 @@ -.. _api-sankey_demo_links: - -api example code: sankey_demo_links.py -====================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/sankey_demo_links.py - -:: - - """Demonstrate/test the Sankey class by producing a long chain of connections. - """ - - from itertools import cycle - - import matplotlib.pyplot as plt - from matplotlib.sankey import Sankey - - links_per_side = 6 - - - def side(sankey, n=1): - """Generate a side chain.""" - prior = len(sankey.diagrams) - colors = cycle(['orange', 'b', 'g', 'r', 'c', 'm', 'y']) - for i in range(0, 2*n, 2): - sankey.add(flows=[1, -1], orientations=[-1, -1], - patchlabel=str(prior + i), facecolor=next(colors), - prior=prior + i - 1, connect=(1, 0), alpha=0.5) - sankey.add(flows=[1, -1], orientations=[1, 1], - patchlabel=str(prior + i + 1), facecolor=next(colors), - prior=prior + i, connect=(1, 0), alpha=0.5) - - - def corner(sankey): - """Generate a corner link.""" - prior = len(sankey.diagrams) - sankey.add(flows=[1, -1], orientations=[0, 1], - patchlabel=str(prior), facecolor='k', - prior=prior - 1, connect=(1, 0), alpha=0.5) - - - fig = plt.figure() - ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[], - title="Why would you want to do this?\n(But you could.)") - sankey = Sankey(ax=ax, unit=None) - sankey.add(flows=[1, -1], orientations=[0, 1], - patchlabel="0", facecolor='k', - rotation=45) - side(sankey, n=links_per_side) - corner(sankey) - side(sankey, n=links_per_side) - corner(sankey) - side(sankey, n=links_per_side) - corner(sankey) - side(sankey, n=links_per_side) - sankey.finish() - # Notice: - # 1. The alignment doesn't drift significantly (if at all; with 16007 - # subdiagrams there is still closure). - # 2. The first diagram is rotated 45 deg, so all other diagrams are rotated - # accordingly. - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/sankey_demo_old.rst.txt b/_sources/examples/api/sankey_demo_old.rst.txt deleted file mode 100644 index 5867e1e8f85..00000000000 --- a/_sources/examples/api/sankey_demo_old.rst.txt +++ /dev/null @@ -1,214 +0,0 @@ -.. _api-sankey_demo_old: - -api example code: sankey_demo_old.py -==================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/sankey_demo_old.py - -:: - - """ - ========================== - Yet another Sankey diagram - ========================== - - This example showcases a more complex sankey diagram. - """ - - from __future__ import print_function - - __author__ = "Yannick Copin " - __version__ = "Time-stamp: <10/02/2010 16:49 ycopin@lyopc548.in2p3.fr>" - - import numpy as np - - - def sankey(ax, - outputs=[100.], outlabels=None, - inputs=[100.], inlabels='', - dx=40, dy=10, outangle=45, w=3, inangle=30, offset=2, **kwargs): - """Draw a Sankey diagram. - - outputs: array of outputs, should sum up to 100% - outlabels: output labels (same length as outputs), - or None (use default labels) or '' (no labels) - inputs and inlabels: similar for inputs - dx: horizontal elongation - dy: vertical elongation - outangle: output arrow angle [deg] - w: output arrow shoulder - inangle: input dip angle - offset: text offset - **kwargs: propagated to Patch (e.g., fill=False) - - Return (patch,[intexts,outtexts]). - """ - import matplotlib.patches as mpatches - from matplotlib.path import Path - - outs = np.absolute(outputs) - outsigns = np.sign(outputs) - outsigns[-1] = 0 # Last output - - ins = np.absolute(inputs) - insigns = np.sign(inputs) - insigns[0] = 0 # First input - - assert sum(outs) == 100, "Outputs don't sum up to 100%" - assert sum(ins) == 100, "Inputs don't sum up to 100%" - - def add_output(path, loss, sign=1): - # Arrow tip height - h = (loss/2 + w) * np.tan(np.radians(outangle)) - move, (x, y) = path[-1] # Use last point as reference - if sign == 0: # Final loss (horizontal) - path.extend([(Path.LINETO, [x + dx, y]), - (Path.LINETO, [x + dx, y + w]), - (Path.LINETO, [x + dx + h, y - loss/2]), # Tip - (Path.LINETO, [x + dx, y - loss - w]), - (Path.LINETO, [x + dx, y - loss])]) - outtips.append((sign, path[-3][1])) - else: # Intermediate loss (vertical) - path.extend([(Path.CURVE4, [x + dx/2, y]), - (Path.CURVE4, [x + dx, y]), - (Path.CURVE4, [x + dx, y + sign*dy]), - (Path.LINETO, [x + dx - w, y + sign*dy]), - # Tip - (Path.LINETO, [ - x + dx + loss/2, y + sign*(dy + h)]), - (Path.LINETO, [x + dx + loss + w, y + sign*dy]), - (Path.LINETO, [x + dx + loss, y + sign*dy]), - (Path.CURVE3, [x + dx + loss, y - sign*loss]), - (Path.CURVE3, [x + dx/2 + loss, y - sign*loss])]) - outtips.append((sign, path[-5][1])) - - def add_input(path, gain, sign=1): - h = (gain / 2) * np.tan(np.radians(inangle)) # Dip depth - move, (x, y) = path[-1] # Use last point as reference - if sign == 0: # First gain (horizontal) - path.extend([(Path.LINETO, [x - dx, y]), - (Path.LINETO, [x - dx + h, y + gain/2]), # Dip - (Path.LINETO, [x - dx, y + gain])]) - xd, yd = path[-2][1] # Dip position - indips.append((sign, [xd - h, yd])) - else: # Intermediate gain (vertical) - path.extend([(Path.CURVE4, [x - dx/2, y]), - (Path.CURVE4, [x - dx, y]), - (Path.CURVE4, [x - dx, y + sign*dy]), - # Dip - (Path.LINETO, [ - x - dx - gain / 2, y + sign*(dy - h)]), - (Path.LINETO, [x - dx - gain, y + sign*dy]), - (Path.CURVE3, [x - dx - gain, y - sign*gain]), - (Path.CURVE3, [x - dx/2 - gain, y - sign*gain])]) - xd, yd = path[-4][1] # Dip position - indips.append((sign, [xd, yd + sign*h])) - - outtips = [] # Output arrow tip dir. and positions - urpath = [(Path.MOVETO, [0, 100])] # 1st point of upper right path - lrpath = [(Path.LINETO, [0, 0])] # 1st point of lower right path - for loss, sign in zip(outs, outsigns): - add_output(sign >= 0 and urpath or lrpath, loss, sign=sign) - - indips = [] # Input arrow tip dir. and positions - llpath = [(Path.LINETO, [0, 0])] # 1st point of lower left path - ulpath = [(Path.MOVETO, [0, 100])] # 1st point of upper left path - for gain, sign in reversed(list(zip(ins, insigns))): - add_input(sign <= 0 and llpath or ulpath, gain, sign=sign) - - def revert(path): - """A path is not just revertable by path[::-1] because of Bezier - curves.""" - rpath = [] - nextmove = Path.LINETO - for move, pos in path[::-1]: - rpath.append((nextmove, pos)) - nextmove = move - return rpath - - # Concatenate subpathes in correct order - path = urpath + revert(lrpath) + llpath + revert(ulpath) - - codes, verts = zip(*path) - verts = np.array(verts) - - # Path patch - path = Path(verts, codes) - patch = mpatches.PathPatch(path, **kwargs) - ax.add_patch(patch) - - if False: # DEBUG - print("urpath", urpath) - print("lrpath", revert(lrpath)) - print("llpath", llpath) - print("ulpath", revert(ulpath)) - xs, ys = zip(*verts) - ax.plot(xs, ys, 'go-') - - # Labels - - def set_labels(labels, values): - """Set or check labels according to values.""" - if labels == '': # No labels - return labels - elif labels is None: # Default labels - return ['%2d%%' % val for val in values] - else: - assert len(labels) == len(values) - return labels - - def put_labels(labels, positions, output=True): - """Put labels to positions.""" - texts = [] - lbls = output and labels or labels[::-1] - for i, label in enumerate(lbls): - s, (x, y) = positions[i] # Label direction and position - if s == 0: - t = ax.text(x + offset, y, label, - ha=output and 'left' or 'right', va='center') - elif s > 0: - t = ax.text(x, y + offset, label, ha='center', va='bottom') - else: - t = ax.text(x, y - offset, label, ha='center', va='top') - texts.append(t) - return texts - - outlabels = set_labels(outlabels, outs) - outtexts = put_labels(outlabels, outtips, output=True) - - inlabels = set_labels(inlabels, ins) - intexts = put_labels(inlabels, indips, output=False) - - # Axes management - ax.set_xlim(verts[:, 0].min() - dx, verts[:, 0].max() + dx) - ax.set_ylim(verts[:, 1].min() - dy, verts[:, 1].max() + dy) - ax.set_aspect('equal', adjustable='datalim') - - return patch, [intexts, outtexts] - - - if __name__ == '__main__': - - import matplotlib.pyplot as plt - - outputs = [10., -20., 5., 15., -10., 40.] - outlabels = ['First', 'Second', 'Third', 'Fourth', 'Fifth', 'Hurray!'] - outlabels = [s + '\n%d%%' % abs(l) for l, s in zip(outputs, outlabels)] - - inputs = [60., -25., 15.] - - fig = plt.figure() - ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[], title="Sankey diagram") - - patch, (intexts, outtexts) = sankey(ax, outputs=outputs, - outlabels=outlabels, inputs=inputs, - inlabels=None) - outtexts[1].set_color('r') - outtexts[-1].set_fontweight('bold') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/sankey_demo_old.txt b/_sources/examples/api/sankey_demo_old.txt deleted file mode 100644 index 8f4bb8d10f2..00000000000 --- a/_sources/examples/api/sankey_demo_old.txt +++ /dev/null @@ -1,208 +0,0 @@ -.. _api-sankey_demo_old: - -api example code: sankey_demo_old.py -==================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/sankey_demo_old.py - -:: - - #!/usr/bin/env python - - from __future__ import print_function - - __author__ = "Yannick Copin " - __version__ = "Time-stamp: <10/02/2010 16:49 ycopin@lyopc548.in2p3.fr>" - - import numpy as np - - - def sankey(ax, - outputs=[100.], outlabels=None, - inputs=[100.], inlabels='', - dx=40, dy=10, outangle=45, w=3, inangle=30, offset=2, **kwargs): - """Draw a Sankey diagram. - - outputs: array of outputs, should sum up to 100% - outlabels: output labels (same length as outputs), - or None (use default labels) or '' (no labels) - inputs and inlabels: similar for inputs - dx: horizontal elongation - dy: vertical elongation - outangle: output arrow angle [deg] - w: output arrow shoulder - inangle: input dip angle - offset: text offset - **kwargs: propagated to Patch (e.g., fill=False) - - Return (patch,[intexts,outtexts]). - """ - import matplotlib.patches as mpatches - from matplotlib.path import Path - - outs = np.absolute(outputs) - outsigns = np.sign(outputs) - outsigns[-1] = 0 # Last output - - ins = np.absolute(inputs) - insigns = np.sign(inputs) - insigns[0] = 0 # First input - - assert sum(outs) == 100, "Outputs don't sum up to 100%" - assert sum(ins) == 100, "Inputs don't sum up to 100%" - - def add_output(path, loss, sign=1): - # Arrow tip height - h = (loss/2 + w) * np.tan(np.radians(outangle)) - move, (x, y) = path[-1] # Use last point as reference - if sign == 0: # Final loss (horizontal) - path.extend([(Path.LINETO, [x + dx, y]), - (Path.LINETO, [x + dx, y + w]), - (Path.LINETO, [x + dx + h, y - loss/2]), # Tip - (Path.LINETO, [x + dx, y - loss - w]), - (Path.LINETO, [x + dx, y - loss])]) - outtips.append((sign, path[-3][1])) - else: # Intermediate loss (vertical) - path.extend([(Path.CURVE4, [x + dx/2, y]), - (Path.CURVE4, [x + dx, y]), - (Path.CURVE4, [x + dx, y + sign*dy]), - (Path.LINETO, [x + dx - w, y + sign*dy]), - # Tip - (Path.LINETO, [ - x + dx + loss/2, y + sign*(dy + h)]), - (Path.LINETO, [x + dx + loss + w, y + sign*dy]), - (Path.LINETO, [x + dx + loss, y + sign*dy]), - (Path.CURVE3, [x + dx + loss, y - sign*loss]), - (Path.CURVE3, [x + dx/2 + loss, y - sign*loss])]) - outtips.append((sign, path[-5][1])) - - def add_input(path, gain, sign=1): - h = (gain / 2) * np.tan(np.radians(inangle)) # Dip depth - move, (x, y) = path[-1] # Use last point as reference - if sign == 0: # First gain (horizontal) - path.extend([(Path.LINETO, [x - dx, y]), - (Path.LINETO, [x - dx + h, y + gain/2]), # Dip - (Path.LINETO, [x - dx, y + gain])]) - xd, yd = path[-2][1] # Dip position - indips.append((sign, [xd - h, yd])) - else: # Intermediate gain (vertical) - path.extend([(Path.CURVE4, [x - dx/2, y]), - (Path.CURVE4, [x - dx, y]), - (Path.CURVE4, [x - dx, y + sign*dy]), - # Dip - (Path.LINETO, [ - x - dx - gain / 2, y + sign*(dy - h)]), - (Path.LINETO, [x - dx - gain, y + sign*dy]), - (Path.CURVE3, [x - dx - gain, y - sign*gain]), - (Path.CURVE3, [x - dx/2 - gain, y - sign*gain])]) - xd, yd = path[-4][1] # Dip position - indips.append((sign, [xd, yd + sign*h])) - - outtips = [] # Output arrow tip dir. and positions - urpath = [(Path.MOVETO, [0, 100])] # 1st point of upper right path - lrpath = [(Path.LINETO, [0, 0])] # 1st point of lower right path - for loss, sign in zip(outs, outsigns): - add_output(sign >= 0 and urpath or lrpath, loss, sign=sign) - - indips = [] # Input arrow tip dir. and positions - llpath = [(Path.LINETO, [0, 0])] # 1st point of lower left path - ulpath = [(Path.MOVETO, [0, 100])] # 1st point of upper left path - for gain, sign in reversed(list(zip(ins, insigns))): - add_input(sign <= 0 and llpath or ulpath, gain, sign=sign) - - def revert(path): - """A path is not just revertable by path[::-1] because of Bezier - curves.""" - rpath = [] - nextmove = Path.LINETO - for move, pos in path[::-1]: - rpath.append((nextmove, pos)) - nextmove = move - return rpath - - # Concatenate subpathes in correct order - path = urpath + revert(lrpath) + llpath + revert(ulpath) - - codes, verts = zip(*path) - verts = np.array(verts) - - # Path patch - path = Path(verts, codes) - patch = mpatches.PathPatch(path, **kwargs) - ax.add_patch(patch) - - if False: # DEBUG - print("urpath", urpath) - print("lrpath", revert(lrpath)) - print("llpath", llpath) - print("ulpath", revert(ulpath)) - xs, ys = zip(*verts) - ax.plot(xs, ys, 'go-') - - # Labels - - def set_labels(labels, values): - """Set or check labels according to values.""" - if labels == '': # No labels - return labels - elif labels is None: # Default labels - return ['%2d%%' % val for val in values] - else: - assert len(labels) == len(values) - return labels - - def put_labels(labels, positions, output=True): - """Put labels to positions.""" - texts = [] - lbls = output and labels or labels[::-1] - for i, label in enumerate(lbls): - s, (x, y) = positions[i] # Label direction and position - if s == 0: - t = ax.text(x + offset, y, label, - ha=output and 'left' or 'right', va='center') - elif s > 0: - t = ax.text(x, y + offset, label, ha='center', va='bottom') - else: - t = ax.text(x, y - offset, label, ha='center', va='top') - texts.append(t) - return texts - - outlabels = set_labels(outlabels, outs) - outtexts = put_labels(outlabels, outtips, output=True) - - inlabels = set_labels(inlabels, ins) - intexts = put_labels(inlabels, indips, output=False) - - # Axes management - ax.set_xlim(verts[:, 0].min() - dx, verts[:, 0].max() + dx) - ax.set_ylim(verts[:, 1].min() - dy, verts[:, 1].max() + dy) - ax.set_aspect('equal', adjustable='datalim') - - return patch, [intexts, outtexts] - - - if __name__ == '__main__': - - import matplotlib.pyplot as plt - - outputs = [10., -20., 5., 15., -10., 40.] - outlabels = ['First', 'Second', 'Third', 'Fourth', 'Fifth', 'Hurray!'] - outlabels = [s + '\n%d%%' % abs(l) for l, s in zip(outputs, outlabels)] - - inputs = [60., -25., 15.] - - fig = plt.figure() - ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[], title="Sankey diagram") - - patch, (intexts, outtexts) = sankey(ax, outputs=outputs, - outlabels=outlabels, inputs=inputs, - inlabels=None, fc='g', alpha=0.2) - outtexts[1].set_color('r') - outtexts[-1].set_fontweight('bold') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/sankey_demo_rankine.rst.txt b/_sources/examples/api/sankey_demo_rankine.rst.txt deleted file mode 100644 index 28a8d0987a0..00000000000 --- a/_sources/examples/api/sankey_demo_rankine.rst.txt +++ /dev/null @@ -1,98 +0,0 @@ -.. _api-sankey_demo_rankine: - -api example code: sankey_demo_rankine.py -======================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/sankey_demo_rankine.py - -:: - - """ - =================== - Rankine power cycle - =================== - - Demonstrate the Sankey class with a practical example of a Rankine power - cycle. - - """ - import matplotlib.pyplot as plt - - from matplotlib.sankey import Sankey - - fig = plt.figure(figsize=(8, 9)) - ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[], - title="Rankine Power Cycle: Example 8.6 from Moran and " - "Shapiro\n\x22Fundamentals of Engineering Thermodynamics " - "\x22, 6th ed., 2008") - Hdot = [260.431, 35.078, 180.794, 221.115, 22.700, - 142.361, 10.193, 10.210, 43.670, 44.312, - 68.631, 10.758, 10.758, 0.017, 0.642, - 232.121, 44.559, 100.613, 132.168] # MW - sankey = Sankey(ax=ax, format='%.3G', unit=' MW', gap=0.5, scale=1.0/Hdot[0]) - sankey.add(patchlabel='\n\nPump 1', rotation=90, facecolor='#37c959', - flows=[Hdot[13], Hdot[6], -Hdot[7]], - labels=['Shaft power', '', None], - pathlengths=[0.4, 0.883, 0.25], - orientations=[1, -1, 0]) - sankey.add(patchlabel='\n\nOpen\nheater', facecolor='#37c959', - flows=[Hdot[11], Hdot[7], Hdot[4], -Hdot[8]], - labels=[None, '', None, None], - pathlengths=[0.25, 0.25, 1.93, 0.25], - orientations=[1, 0, -1, 0], prior=0, connect=(2, 1)) - sankey.add(patchlabel='\n\nPump 2', facecolor='#37c959', - flows=[Hdot[14], Hdot[8], -Hdot[9]], - labels=['Shaft power', '', None], - pathlengths=[0.4, 0.25, 0.25], - orientations=[1, 0, 0], prior=1, connect=(3, 1)) - sankey.add(patchlabel='Closed\nheater', trunklength=2.914, fc='#37c959', - flows=[Hdot[9], Hdot[1], -Hdot[11], -Hdot[10]], - pathlengths=[0.25, 1.543, 0.25, 0.25], - labels=['', '', None, None], - orientations=[0, -1, 1, -1], prior=2, connect=(2, 0)) - sankey.add(patchlabel='Trap', facecolor='#37c959', trunklength=5.102, - flows=[Hdot[11], -Hdot[12]], - labels=['\n', None], - pathlengths=[1.0, 1.01], - orientations=[1, 1], prior=3, connect=(2, 0)) - sankey.add(patchlabel='Steam\ngenerator', facecolor='#ff5555', - flows=[Hdot[15], Hdot[10], Hdot[2], -Hdot[3], -Hdot[0]], - labels=['Heat rate', '', '', None, None], - pathlengths=0.25, - orientations=[1, 0, -1, -1, -1], prior=3, connect=(3, 1)) - sankey.add(patchlabel='\n\n\nTurbine 1', facecolor='#37c959', - flows=[Hdot[0], -Hdot[16], -Hdot[1], -Hdot[2]], - labels=['', None, None, None], - pathlengths=[0.25, 0.153, 1.543, 0.25], - orientations=[0, 1, -1, -1], prior=5, connect=(4, 0)) - sankey.add(patchlabel='\n\n\nReheat', facecolor='#37c959', - flows=[Hdot[2], -Hdot[2]], - labels=[None, None], - pathlengths=[0.725, 0.25], - orientations=[-1, 0], prior=6, connect=(3, 0)) - sankey.add(patchlabel='Turbine 2', trunklength=3.212, facecolor='#37c959', - flows=[Hdot[3], Hdot[16], -Hdot[5], -Hdot[4], -Hdot[17]], - labels=[None, 'Shaft power', None, '', 'Shaft power'], - pathlengths=[0.751, 0.15, 0.25, 1.93, 0.25], - orientations=[0, -1, 0, -1, 1], prior=6, connect=(1, 1)) - sankey.add(patchlabel='Condenser', facecolor='#58b1fa', trunklength=1.764, - flows=[Hdot[5], -Hdot[18], -Hdot[6]], - labels=['', 'Heat rate', None], - pathlengths=[0.45, 0.25, 0.883], - orientations=[-1, 1, 0], prior=8, connect=(2, 0)) - diagrams = sankey.finish() - for diagram in diagrams: - diagram.text.set_fontweight('bold') - diagram.text.set_fontsize('10') - for text in diagram.texts: - text.set_fontsize('10') - # Notice that the explicit connections are handled automatically, but the - # implicit ones currently are not. The lengths of the paths and the trunks - # must be adjusted manually, and that is a bit tricky. - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/sankey_demo_rankine.txt b/_sources/examples/api/sankey_demo_rankine.txt deleted file mode 100644 index 2bfc2f6a365..00000000000 --- a/_sources/examples/api/sankey_demo_rankine.txt +++ /dev/null @@ -1,93 +0,0 @@ -.. _api-sankey_demo_rankine: - -api example code: sankey_demo_rankine.py -======================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/sankey_demo_rankine.py - -:: - - """Demonstrate the Sankey class with a practicle example of a Rankine power - cycle. - - """ - import matplotlib.pyplot as plt - - from matplotlib.sankey import Sankey - - fig = plt.figure(figsize=(8, 9)) - ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[], - title="Rankine Power Cycle: Example 8.6 from Moran and " - "Shapiro\n\x22Fundamentals of Engineering Thermodynamics " - "\x22, 6th ed., 2008") - Hdot = [260.431, 35.078, 180.794, 221.115, 22.700, - 142.361, 10.193, 10.210, 43.670, 44.312, - 68.631, 10.758, 10.758, 0.017, 0.642, - 232.121, 44.559, 100.613, 132.168] # MW - sankey = Sankey(ax=ax, format='%.3G', unit=' MW', gap=0.5, scale=1.0/Hdot[0]) - sankey.add(patchlabel='\n\nPump 1', rotation=90, facecolor='#37c959', - flows=[Hdot[13], Hdot[6], -Hdot[7]], - labels=['Shaft power', '', None], - pathlengths=[0.4, 0.883, 0.25], - orientations=[1, -1, 0]) - sankey.add(patchlabel='\n\nOpen\nheater', facecolor='#37c959', - flows=[Hdot[11], Hdot[7], Hdot[4], -Hdot[8]], - labels=[None, '', None, None], - pathlengths=[0.25, 0.25, 1.93, 0.25], - orientations=[1, 0, -1, 0], prior=0, connect=(2, 1)) - sankey.add(patchlabel='\n\nPump 2', facecolor='#37c959', - flows=[Hdot[14], Hdot[8], -Hdot[9]], - labels=['Shaft power', '', None], - pathlengths=[0.4, 0.25, 0.25], - orientations=[1, 0, 0], prior=1, connect=(3, 1)) - sankey.add(patchlabel='Closed\nheater', trunklength=2.914, fc='#37c959', - flows=[Hdot[9], Hdot[1], -Hdot[11], -Hdot[10]], - pathlengths=[0.25, 1.543, 0.25, 0.25], - labels=['', '', None, None], - orientations=[0, -1, 1, -1], prior=2, connect=(2, 0)) - sankey.add(patchlabel='Trap', facecolor='#37c959', trunklength=5.102, - flows=[Hdot[11], -Hdot[12]], - labels=['\n', None], - pathlengths=[1.0, 1.01], - orientations=[1, 1], prior=3, connect=(2, 0)) - sankey.add(patchlabel='Steam\ngenerator', facecolor='#ff5555', - flows=[Hdot[15], Hdot[10], Hdot[2], -Hdot[3], -Hdot[0]], - labels=['Heat rate', '', '', None, None], - pathlengths=0.25, - orientations=[1, 0, -1, -1, -1], prior=3, connect=(3, 1)) - sankey.add(patchlabel='\n\n\nTurbine 1', facecolor='#37c959', - flows=[Hdot[0], -Hdot[16], -Hdot[1], -Hdot[2]], - labels=['', None, None, None], - pathlengths=[0.25, 0.153, 1.543, 0.25], - orientations=[0, 1, -1, -1], prior=5, connect=(4, 0)) - sankey.add(patchlabel='\n\n\nReheat', facecolor='#37c959', - flows=[Hdot[2], -Hdot[2]], - labels=[None, None], - pathlengths=[0.725, 0.25], - orientations=[-1, 0], prior=6, connect=(3, 0)) - sankey.add(patchlabel='Turbine 2', trunklength=3.212, facecolor='#37c959', - flows=[Hdot[3], Hdot[16], -Hdot[5], -Hdot[4], -Hdot[17]], - labels=[None, 'Shaft power', None, '', 'Shaft power'], - pathlengths=[0.751, 0.15, 0.25, 1.93, 0.25], - orientations=[0, -1, 0, -1, 1], prior=6, connect=(1, 1)) - sankey.add(patchlabel='Condenser', facecolor='#58b1fa', trunklength=1.764, - flows=[Hdot[5], -Hdot[18], -Hdot[6]], - labels=['', 'Heat rate', None], - pathlengths=[0.45, 0.25, 0.883], - orientations=[-1, 1, 0], prior=8, connect=(2, 0)) - diagrams = sankey.finish() - for diagram in diagrams: - diagram.text.set_fontweight('bold') - diagram.text.set_fontsize('10') - for text in diagram.texts: - text.set_fontsize('10') - # Notice that the explicit connections are handled automatically, but the - # implicit ones currently are not. The lengths of the paths and the trunks - # must be adjusted manually, and that is a bit tricky. - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/scatter_piecharts.rst.txt b/_sources/examples/api/scatter_piecharts.rst.txt deleted file mode 100644 index 9caef9b90dd..00000000000 --- a/_sources/examples/api/scatter_piecharts.rst.txt +++ /dev/null @@ -1,64 +0,0 @@ -.. _api-scatter_piecharts: - -api example code: scatter_piecharts.py -====================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/scatter_piecharts.py - -:: - - """ - =================================== - Scatter plot with pie chart markers - =================================== - - This example makes custom 'pie charts' as the markers for a scatter plot. - - Thanks to Manuel Metz for the example - """ - import math - import numpy as np - import matplotlib.pyplot as plt - - # first define the ratios - r1 = 0.2 # 20% - r2 = r1 + 0.4 # 40% - - # define some sizes of the scatter marker - sizes = [60, 80, 120] - - # calculate the points of the first pie marker - # - # these are just the origin (0,0) + - # some points on a circle cos,sin - x = [0] + np.cos(np.linspace(0, 2*math.pi*r1, 10)).tolist() - y = [0] + np.sin(np.linspace(0, 2*math.pi*r1, 10)).tolist() - - xy1 = list(zip(x, y)) - s1 = max(max(x), max(y)) - - # ... - x = [0] + np.cos(np.linspace(2*math.pi*r1, 2*math.pi*r2, 10)).tolist() - y = [0] + np.sin(np.linspace(2*math.pi*r1, 2*math.pi*r2, 10)).tolist() - xy2 = list(zip(x, y)) - s2 = max(max(x), max(y)) - - x = [0] + np.cos(np.linspace(2*math.pi*r2, 2*math.pi, 10)).tolist() - y = [0] + np.sin(np.linspace(2*math.pi*r2, 2*math.pi, 10)).tolist() - xy3 = list(zip(x, y)) - s3 = max(max(x), max(y)) - - fig, ax = plt.subplots() - ax.scatter(np.arange(3), np.arange(3), marker=(xy1, 0), - s=[s1*s1*_ for _ in sizes], facecolor='blue') - ax.scatter(np.arange(3), np.arange(3), marker=(xy2, 0), - s=[s2*s2*_ for _ in sizes], facecolor='green') - ax.scatter(np.arange(3), np.arange(3), marker=(xy3, 0), - s=[s3*s3*_ for _ in sizes], facecolor='red') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/scatter_piecharts.txt b/_sources/examples/api/scatter_piecharts.txt deleted file mode 100644 index b08d817399a..00000000000 --- a/_sources/examples/api/scatter_piecharts.txt +++ /dev/null @@ -1,60 +0,0 @@ -.. _api-scatter_piecharts: - -api example code: scatter_piecharts.py -====================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/scatter_piecharts.py - -:: - - """ - This example makes custom 'pie charts' as the markers for a scatter plotqu - - Thanks to Manuel Metz for the example - """ - import math - import numpy as np - import matplotlib.pyplot as plt - - # first define the ratios - r1 = 0.2 # 20% - r2 = r1 + 0.4 # 40% - - # define some sizes of the scatter marker - sizes = [60, 80, 120] - - # calculate the points of the first pie marker - # - # these are just the origin (0,0) + - # some points on a circle cos,sin - x = [0] + np.cos(np.linspace(0, 2*math.pi*r1, 10)).tolist() - y = [0] + np.sin(np.linspace(0, 2*math.pi*r1, 10)).tolist() - - xy1 = list(zip(x, y)) - s1 = max(max(x), max(y)) - - # ... - x = [0] + np.cos(np.linspace(2*math.pi*r1, 2*math.pi*r2, 10)).tolist() - y = [0] + np.sin(np.linspace(2*math.pi*r1, 2*math.pi*r2, 10)).tolist() - xy2 = list(zip(x, y)) - s2 = max(max(x), max(y)) - - x = [0] + np.cos(np.linspace(2*math.pi*r2, 2*math.pi, 10)).tolist() - y = [0] + np.sin(np.linspace(2*math.pi*r2, 2*math.pi, 10)).tolist() - xy3 = list(zip(x, y)) - s3 = max(max(x), max(y)) - - fig, ax = plt.subplots() - ax.scatter(np.arange(3), np.arange(3), marker=(xy1, 0), - s=[s1*s1*_ for _ in sizes], facecolor='blue') - ax.scatter(np.arange(3), np.arange(3), marker=(xy2, 0), - s=[s2*s2*_ for _ in sizes], facecolor='green') - ax.scatter(np.arange(3), np.arange(3), marker=(xy3, 0), - s=[s3*s3*_ for _ in sizes], facecolor='red') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/skewt.rst.txt b/_sources/examples/api/skewt.rst.txt deleted file mode 100644 index f48132acc17..00000000000 --- a/_sources/examples/api/skewt.rst.txt +++ /dev/null @@ -1,307 +0,0 @@ -.. _api-skewt: - -api example code: skewt.py -========================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/skewt.py - -:: - - """ - =========================================================== - SkewT-logP diagram: using transforms and custom projections - =========================================================== - - This serves as an intensive exercise of matplotlib's transforms and custom - projection API. This example produces a so-called SkewT-logP diagram, which is - a common plot in meteorology for displaying vertical profiles of temperature. - As far as matplotlib is concerned, the complexity comes from having X and Y - axes that are not orthogonal. This is handled by including a skew component to - the basic Axes transforms. Additional complexity comes in handling the fact - that the upper and lower X-axes have different data ranges, which necessitates - a bunch of custom classes for ticks,spines, and the axis to handle this. - - """ - - from matplotlib.axes import Axes - import matplotlib.transforms as transforms - import matplotlib.axis as maxis - import matplotlib.spines as mspines - from matplotlib.projections import register_projection - - - # The sole purpose of this class is to look at the upper, lower, or total - # interval as appropriate and see what parts of the tick to draw, if any. - class SkewXTick(maxis.XTick): - def update_position(self, loc): - # This ensures that the new value of the location is set before - # any other updates take place - self._loc = loc - super(SkewXTick, self).update_position(loc) - - def _has_default_loc(self): - return self.get_loc() is None - - def _need_lower(self): - return (self._has_default_loc() or - transforms.interval_contains(self.axes.lower_xlim, - self.get_loc())) - - def _need_upper(self): - return (self._has_default_loc() or - transforms.interval_contains(self.axes.upper_xlim, - self.get_loc())) - - @property - def gridOn(self): - return (self._gridOn and (self._has_default_loc() or - transforms.interval_contains(self.get_view_interval(), - self.get_loc()))) - - @gridOn.setter - def gridOn(self, value): - self._gridOn = value - - @property - def tick1On(self): - return self._tick1On and self._need_lower() - - @tick1On.setter - def tick1On(self, value): - self._tick1On = value - - @property - def label1On(self): - return self._label1On and self._need_lower() - - @label1On.setter - def label1On(self, value): - self._label1On = value - - @property - def tick2On(self): - return self._tick2On and self._need_upper() - - @tick2On.setter - def tick2On(self, value): - self._tick2On = value - - @property - def label2On(self): - return self._label2On and self._need_upper() - - @label2On.setter - def label2On(self, value): - self._label2On = value - - def get_view_interval(self): - return self.axes.xaxis.get_view_interval() - - - # This class exists to provide two separate sets of intervals to the tick, - # as well as create instances of the custom tick - class SkewXAxis(maxis.XAxis): - def _get_tick(self, major): - return SkewXTick(self.axes, None, '', major=major) - - def get_view_interval(self): - return self.axes.upper_xlim[0], self.axes.lower_xlim[1] - - - # This class exists to calculate the separate data range of the - # upper X-axis and draw the spine there. It also provides this range - # to the X-axis artist for ticking and gridlines - class SkewSpine(mspines.Spine): - def _adjust_location(self): - pts = self._path.vertices - if self.spine_type == 'top': - pts[:, 0] = self.axes.upper_xlim - else: - pts[:, 0] = self.axes.lower_xlim - - - # This class handles registration of the skew-xaxes as a projection as well - # as setting up the appropriate transformations. It also overrides standard - # spines and axes instances as appropriate. - class SkewXAxes(Axes): - # The projection must specify a name. This will be used be the - # user to select the projection, i.e. ``subplot(111, - # projection='skewx')``. - name = 'skewx' - - def _init_axis(self): - # Taken from Axes and modified to use our modified X-axis - self.xaxis = SkewXAxis(self) - self.spines['top'].register_axis(self.xaxis) - self.spines['bottom'].register_axis(self.xaxis) - self.yaxis = maxis.YAxis(self) - self.spines['left'].register_axis(self.yaxis) - self.spines['right'].register_axis(self.yaxis) - - def _gen_axes_spines(self): - spines = {'top': SkewSpine.linear_spine(self, 'top'), - 'bottom': mspines.Spine.linear_spine(self, 'bottom'), - 'left': mspines.Spine.linear_spine(self, 'left'), - 'right': mspines.Spine.linear_spine(self, 'right')} - return spines - - def _set_lim_and_transforms(self): - """ - This is called once when the plot is created to set up all the - transforms for the data, text and grids. - """ - rot = 30 - - # Get the standard transform setup from the Axes base class - Axes._set_lim_and_transforms(self) - - # Need to put the skew in the middle, after the scale and limits, - # but before the transAxes. This way, the skew is done in Axes - # coordinates thus performing the transform around the proper origin - # We keep the pre-transAxes transform around for other users, like the - # spines for finding bounds - self.transDataToAxes = self.transScale + \ - self.transLimits + transforms.Affine2D().skew_deg(rot, 0) - - # Create the full transform from Data to Pixels - self.transData = self.transDataToAxes + self.transAxes - - # Blended transforms like this need to have the skewing applied using - # both axes, in axes coords like before. - self._xaxis_transform = (transforms.blended_transform_factory( - self.transScale + self.transLimits, - transforms.IdentityTransform()) + - transforms.Affine2D().skew_deg(rot, 0)) + self.transAxes - - @property - def lower_xlim(self): - return self.axes.viewLim.intervalx - - @property - def upper_xlim(self): - pts = [[0., 1.], [1., 1.]] - return self.transDataToAxes.inverted().transform(pts)[:, 0] - - - # Now register the projection with matplotlib so the user can select - # it. - register_projection(SkewXAxes) - - if __name__ == '__main__': - # Now make a simple example using the custom projection. - from matplotlib.ticker import (MultipleLocator, NullFormatter, - ScalarFormatter) - import matplotlib.pyplot as plt - from six import StringIO - import numpy as np - - # Some examples data - data_txt = ''' - 978.0 345 7.8 0.8 61 4.16 325 14 282.7 294.6 283.4 - 971.0 404 7.2 0.2 61 4.01 327 17 282.7 294.2 283.4 - 946.7 610 5.2 -1.8 61 3.56 335 26 282.8 293.0 283.4 - 944.0 634 5.0 -2.0 61 3.51 336 27 282.8 292.9 283.4 - 925.0 798 3.4 -2.6 65 3.43 340 32 282.8 292.7 283.4 - 911.8 914 2.4 -2.7 69 3.46 345 37 282.9 292.9 283.5 - 906.0 966 2.0 -2.7 71 3.47 348 39 283.0 293.0 283.6 - 877.9 1219 0.4 -3.2 77 3.46 0 48 283.9 293.9 284.5 - 850.0 1478 -1.3 -3.7 84 3.44 0 47 284.8 294.8 285.4 - 841.0 1563 -1.9 -3.8 87 3.45 358 45 285.0 295.0 285.6 - 823.0 1736 1.4 -0.7 86 4.44 353 42 290.3 303.3 291.0 - 813.6 1829 4.5 1.2 80 5.17 350 40 294.5 309.8 295.4 - 809.0 1875 6.0 2.2 77 5.57 347 39 296.6 313.2 297.6 - 798.0 1988 7.4 -0.6 57 4.61 340 35 299.2 313.3 300.1 - 791.0 2061 7.6 -1.4 53 4.39 335 33 300.2 313.6 301.0 - 783.9 2134 7.0 -1.7 54 4.32 330 31 300.4 313.6 301.2 - 755.1 2438 4.8 -3.1 57 4.06 300 24 301.2 313.7 301.9 - 727.3 2743 2.5 -4.4 60 3.81 285 29 301.9 313.8 302.6 - 700.5 3048 0.2 -5.8 64 3.57 275 31 302.7 313.8 303.3 - 700.0 3054 0.2 -5.8 64 3.56 280 31 302.7 313.8 303.3 - 698.0 3077 0.0 -6.0 64 3.52 280 31 302.7 313.7 303.4 - 687.0 3204 -0.1 -7.1 59 3.28 281 31 304.0 314.3 304.6 - 648.9 3658 -3.2 -10.9 55 2.59 285 30 305.5 313.8 305.9 - 631.0 3881 -4.7 -12.7 54 2.29 289 33 306.2 313.6 306.6 - 600.7 4267 -6.4 -16.7 44 1.73 295 39 308.6 314.3 308.9 - 592.0 4381 -6.9 -17.9 41 1.59 297 41 309.3 314.6 309.6 - 577.6 4572 -8.1 -19.6 39 1.41 300 44 310.1 314.9 310.3 - 555.3 4877 -10.0 -22.3 36 1.16 295 39 311.3 315.3 311.5 - 536.0 5151 -11.7 -24.7 33 0.97 304 39 312.4 315.8 312.6 - 533.8 5182 -11.9 -25.0 33 0.95 305 39 312.5 315.8 312.7 - 500.0 5680 -15.9 -29.9 29 0.64 290 44 313.6 315.9 313.7 - 472.3 6096 -19.7 -33.4 28 0.49 285 46 314.1 315.8 314.1 - 453.0 6401 -22.4 -36.0 28 0.39 300 50 314.4 315.8 314.4 - 400.0 7310 -30.7 -43.7 27 0.20 285 44 315.0 315.8 315.0 - 399.7 7315 -30.8 -43.8 27 0.20 285 44 315.0 315.8 315.0 - 387.0 7543 -33.1 -46.1 26 0.16 281 47 314.9 315.5 314.9 - 382.7 7620 -33.8 -46.8 26 0.15 280 48 315.0 315.6 315.0 - 342.0 8398 -40.5 -53.5 23 0.08 293 52 316.1 316.4 316.1 - 320.4 8839 -43.7 -56.7 22 0.06 300 54 317.6 317.8 317.6 - 318.0 8890 -44.1 -57.1 22 0.05 301 55 317.8 318.0 317.8 - 310.0 9060 -44.7 -58.7 19 0.04 304 61 319.2 319.4 319.2 - 306.1 9144 -43.9 -57.9 20 0.05 305 63 321.5 321.7 321.5 - 305.0 9169 -43.7 -57.7 20 0.05 303 63 322.1 322.4 322.1 - 300.0 9280 -43.5 -57.5 20 0.05 295 64 323.9 324.2 323.9 - 292.0 9462 -43.7 -58.7 17 0.05 293 67 326.2 326.4 326.2 - 276.0 9838 -47.1 -62.1 16 0.03 290 74 326.6 326.7 326.6 - 264.0 10132 -47.5 -62.5 16 0.03 288 79 330.1 330.3 330.1 - 251.0 10464 -49.7 -64.7 16 0.03 285 85 331.7 331.8 331.7 - 250.0 10490 -49.7 -64.7 16 0.03 285 85 332.1 332.2 332.1 - 247.0 10569 -48.7 -63.7 16 0.03 283 88 334.7 334.8 334.7 - 244.0 10649 -48.9 -63.9 16 0.03 280 91 335.6 335.7 335.6 - 243.3 10668 -48.9 -63.9 16 0.03 280 91 335.8 335.9 335.8 - 220.0 11327 -50.3 -65.3 15 0.03 280 85 343.5 343.6 343.5 - 212.0 11569 -50.5 -65.5 15 0.03 280 83 346.8 346.9 346.8 - 210.0 11631 -49.7 -64.7 16 0.03 280 83 349.0 349.1 349.0 - 200.0 11950 -49.9 -64.9 15 0.03 280 80 353.6 353.7 353.6 - 194.0 12149 -49.9 -64.9 15 0.03 279 78 356.7 356.8 356.7 - 183.0 12529 -51.3 -66.3 15 0.03 278 75 360.4 360.5 360.4 - 164.0 13233 -55.3 -68.3 18 0.02 277 69 365.2 365.3 365.2 - 152.0 13716 -56.5 -69.5 18 0.02 275 65 371.1 371.2 371.1 - 150.0 13800 -57.1 -70.1 18 0.02 275 64 371.5 371.6 371.5 - 136.0 14414 -60.5 -72.5 19 0.02 268 54 376.0 376.1 376.0 - 132.0 14600 -60.1 -72.1 19 0.02 265 51 380.0 380.1 380.0 - 131.4 14630 -60.2 -72.2 19 0.02 265 51 380.3 380.4 380.3 - 128.0 14792 -60.9 -72.9 19 0.02 266 50 381.9 382.0 381.9 - 125.0 14939 -60.1 -72.1 19 0.02 268 49 385.9 386.0 385.9 - 119.0 15240 -62.2 -73.8 20 0.01 270 48 387.4 387.5 387.4 - 112.0 15616 -64.9 -75.9 21 0.01 265 53 389.3 389.3 389.3 - 108.0 15838 -64.1 -75.1 21 0.01 265 58 394.8 394.9 394.8 - 107.8 15850 -64.1 -75.1 21 0.01 265 58 395.0 395.1 395.0 - 105.0 16010 -64.7 -75.7 21 0.01 272 50 396.9 396.9 396.9 - 103.0 16128 -62.9 -73.9 21 0.02 277 45 402.5 402.6 402.5 - 100.0 16310 -62.5 -73.5 21 0.02 285 36 406.7 406.8 406.7 - ''' - - # Parse the data - sound_data = StringIO(data_txt) - p, h, T, Td = np.loadtxt(sound_data, usecols=range(0, 4), unpack=True) - - # Create a new figure. The dimensions here give a good aspect ratio - fig = plt.figure(figsize=(6.5875, 6.2125)) - ax = fig.add_subplot(111, projection='skewx') - - plt.grid(True) - - # Plot the data using normal plotting functions, in this case using - # log scaling in Y, as dictated by the typical meteorological plot - ax.semilogy(T, p, color='C3') - ax.semilogy(Td, p, color='C2') - - # An example of a slanted line at constant X - l = ax.axvline(0, color='C0') - - # Disables the log-formatting that comes with semilogy - ax.yaxis.set_major_formatter(ScalarFormatter()) - ax.yaxis.set_minor_formatter(NullFormatter()) - ax.set_yticks(np.linspace(100, 1000, 10)) - ax.set_ylim(1050, 100) - - ax.xaxis.set_major_locator(MultipleLocator(10)) - ax.set_xlim(-50, 50) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/skewt.txt b/_sources/examples/api/skewt.txt deleted file mode 100644 index 89c60a12eea..00000000000 --- a/_sources/examples/api/skewt.txt +++ /dev/null @@ -1,269 +0,0 @@ -.. _api-skewt: - -api example code: skewt.py -========================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/skewt.py - -:: - - # This serves as an intensive exercise of matplotlib's transforms - # and custom projection API. This example produces a so-called - # SkewT-logP diagram, which is a common plot in meteorology for - # displaying vertical profiles of temperature. As far as matplotlib is - # concerned, the complexity comes from having X and Y axes that are - # not orthogonal. This is handled by including a skew component to the - # basic Axes transforms. Additional complexity comes in handling the - # fact that the upper and lower X-axes have different data ranges, which - # necessitates a bunch of custom classes for ticks,spines, and the axis - # to handle this. - - from matplotlib.axes import Axes - import matplotlib.transforms as transforms - import matplotlib.axis as maxis - import matplotlib.spines as mspines - import matplotlib.path as mpath - from matplotlib.projections import register_projection - - # The sole purpose of this class is to look at the upper, lower, or total - # interval as appropriate and see what parts of the tick to draw, if any. - - - class SkewXTick(maxis.XTick): - def draw(self, renderer): - if not self.get_visible(): - return - renderer.open_group(self.__name__) - - lower_interval = self.axes.xaxis.lower_interval - upper_interval = self.axes.xaxis.upper_interval - - if self.gridOn and transforms.interval_contains( - self.axes.xaxis.get_view_interval(), self.get_loc()): - self.gridline.draw(renderer) - - if transforms.interval_contains(lower_interval, self.get_loc()): - if self.tick1On: - self.tick1line.draw(renderer) - if self.label1On: - self.label1.draw(renderer) - - if transforms.interval_contains(upper_interval, self.get_loc()): - if self.tick2On: - self.tick2line.draw(renderer) - if self.label2On: - self.label2.draw(renderer) - - renderer.close_group(self.__name__) - - - # This class exists to provide two separate sets of intervals to the tick, - # as well as create instances of the custom tick - class SkewXAxis(maxis.XAxis): - def __init__(self, *args, **kwargs): - maxis.XAxis.__init__(self, *args, **kwargs) - self.upper_interval = 0.0, 1.0 - - def _get_tick(self, major): - return SkewXTick(self.axes, 0, '', major=major) - - @property - def lower_interval(self): - return self.axes.viewLim.intervalx - - def get_view_interval(self): - return self.upper_interval[0], self.axes.viewLim.intervalx[1] - - - # This class exists to calculate the separate data range of the - # upper X-axis and draw the spine there. It also provides this range - # to the X-axis artist for ticking and gridlines - class SkewSpine(mspines.Spine): - def _adjust_location(self): - trans = self.axes.transDataToAxes.inverted() - if self.spine_type == 'top': - yloc = 1.0 - else: - yloc = 0.0 - left = trans.transform_point((0.0, yloc))[0] - right = trans.transform_point((1.0, yloc))[0] - - pts = self._path.vertices - pts[0, 0] = left - pts[1, 0] = right - self.axis.upper_interval = (left, right) - - - # This class handles registration of the skew-xaxes as a projection as well - # as setting up the appropriate transformations. It also overrides standard - # spines and axes instances as appropriate. - class SkewXAxes(Axes): - # The projection must specify a name. This will be used be the - # user to select the projection, i.e. ``subplot(111, - # projection='skewx')``. - name = 'skewx' - - def _init_axis(self): - # Taken from Axes and modified to use our modified X-axis - self.xaxis = SkewXAxis(self) - self.spines['top'].register_axis(self.xaxis) - self.spines['bottom'].register_axis(self.xaxis) - self.yaxis = maxis.YAxis(self) - self.spines['left'].register_axis(self.yaxis) - self.spines['right'].register_axis(self.yaxis) - - def _gen_axes_spines(self): - spines = {'top': SkewSpine.linear_spine(self, 'top'), - 'bottom': mspines.Spine.linear_spine(self, 'bottom'), - 'left': mspines.Spine.linear_spine(self, 'left'), - 'right': mspines.Spine.linear_spine(self, 'right')} - return spines - - def _set_lim_and_transforms(self): - """ - This is called once when the plot is created to set up all the - transforms for the data, text and grids. - """ - rot = 30 - - # Get the standard transform setup from the Axes base class - Axes._set_lim_and_transforms(self) - - # Need to put the skew in the middle, after the scale and limits, - # but before the transAxes. This way, the skew is done in Axes - # coordinates thus performing the transform around the proper origin - # We keep the pre-transAxes transform around for other users, like the - # spines for finding bounds - self.transDataToAxes = self.transScale + \ - self.transLimits + transforms.Affine2D().skew_deg(rot, 0) - - # Create the full transform from Data to Pixels - self.transData = self.transDataToAxes + self.transAxes - - # Blended transforms like this need to have the skewing applied using - # both axes, in axes coords like before. - self._xaxis_transform = (transforms.blended_transform_factory( - self.transScale + self.transLimits, - transforms.IdentityTransform()) + - transforms.Affine2D().skew_deg(rot, 0)) + self.transAxes - - # Now register the projection with matplotlib so the user can select - # it. - register_projection(SkewXAxes) - - if __name__ == '__main__': - # Now make a simple example using the custom projection. - from matplotlib.ticker import ScalarFormatter, MultipleLocator - import matplotlib.pyplot as plt - from six import StringIO - import numpy as np - - # Some examples data - data_txt = ''' - 978.0 345 7.8 0.8 61 4.16 325 14 282.7 294.6 283.4 - 971.0 404 7.2 0.2 61 4.01 327 17 282.7 294.2 283.4 - 946.7 610 5.2 -1.8 61 3.56 335 26 282.8 293.0 283.4 - 944.0 634 5.0 -2.0 61 3.51 336 27 282.8 292.9 283.4 - 925.0 798 3.4 -2.6 65 3.43 340 32 282.8 292.7 283.4 - 911.8 914 2.4 -2.7 69 3.46 345 37 282.9 292.9 283.5 - 906.0 966 2.0 -2.7 71 3.47 348 39 283.0 293.0 283.6 - 877.9 1219 0.4 -3.2 77 3.46 0 48 283.9 293.9 284.5 - 850.0 1478 -1.3 -3.7 84 3.44 0 47 284.8 294.8 285.4 - 841.0 1563 -1.9 -3.8 87 3.45 358 45 285.0 295.0 285.6 - 823.0 1736 1.4 -0.7 86 4.44 353 42 290.3 303.3 291.0 - 813.6 1829 4.5 1.2 80 5.17 350 40 294.5 309.8 295.4 - 809.0 1875 6.0 2.2 77 5.57 347 39 296.6 313.2 297.6 - 798.0 1988 7.4 -0.6 57 4.61 340 35 299.2 313.3 300.1 - 791.0 2061 7.6 -1.4 53 4.39 335 33 300.2 313.6 301.0 - 783.9 2134 7.0 -1.7 54 4.32 330 31 300.4 313.6 301.2 - 755.1 2438 4.8 -3.1 57 4.06 300 24 301.2 313.7 301.9 - 727.3 2743 2.5 -4.4 60 3.81 285 29 301.9 313.8 302.6 - 700.5 3048 0.2 -5.8 64 3.57 275 31 302.7 313.8 303.3 - 700.0 3054 0.2 -5.8 64 3.56 280 31 302.7 313.8 303.3 - 698.0 3077 0.0 -6.0 64 3.52 280 31 302.7 313.7 303.4 - 687.0 3204 -0.1 -7.1 59 3.28 281 31 304.0 314.3 304.6 - 648.9 3658 -3.2 -10.9 55 2.59 285 30 305.5 313.8 305.9 - 631.0 3881 -4.7 -12.7 54 2.29 289 33 306.2 313.6 306.6 - 600.7 4267 -6.4 -16.7 44 1.73 295 39 308.6 314.3 308.9 - 592.0 4381 -6.9 -17.9 41 1.59 297 41 309.3 314.6 309.6 - 577.6 4572 -8.1 -19.6 39 1.41 300 44 310.1 314.9 310.3 - 555.3 4877 -10.0 -22.3 36 1.16 295 39 311.3 315.3 311.5 - 536.0 5151 -11.7 -24.7 33 0.97 304 39 312.4 315.8 312.6 - 533.8 5182 -11.9 -25.0 33 0.95 305 39 312.5 315.8 312.7 - 500.0 5680 -15.9 -29.9 29 0.64 290 44 313.6 315.9 313.7 - 472.3 6096 -19.7 -33.4 28 0.49 285 46 314.1 315.8 314.1 - 453.0 6401 -22.4 -36.0 28 0.39 300 50 314.4 315.8 314.4 - 400.0 7310 -30.7 -43.7 27 0.20 285 44 315.0 315.8 315.0 - 399.7 7315 -30.8 -43.8 27 0.20 285 44 315.0 315.8 315.0 - 387.0 7543 -33.1 -46.1 26 0.16 281 47 314.9 315.5 314.9 - 382.7 7620 -33.8 -46.8 26 0.15 280 48 315.0 315.6 315.0 - 342.0 8398 -40.5 -53.5 23 0.08 293 52 316.1 316.4 316.1 - 320.4 8839 -43.7 -56.7 22 0.06 300 54 317.6 317.8 317.6 - 318.0 8890 -44.1 -57.1 22 0.05 301 55 317.8 318.0 317.8 - 310.0 9060 -44.7 -58.7 19 0.04 304 61 319.2 319.4 319.2 - 306.1 9144 -43.9 -57.9 20 0.05 305 63 321.5 321.7 321.5 - 305.0 9169 -43.7 -57.7 20 0.05 303 63 322.1 322.4 322.1 - 300.0 9280 -43.5 -57.5 20 0.05 295 64 323.9 324.2 323.9 - 292.0 9462 -43.7 -58.7 17 0.05 293 67 326.2 326.4 326.2 - 276.0 9838 -47.1 -62.1 16 0.03 290 74 326.6 326.7 326.6 - 264.0 10132 -47.5 -62.5 16 0.03 288 79 330.1 330.3 330.1 - 251.0 10464 -49.7 -64.7 16 0.03 285 85 331.7 331.8 331.7 - 250.0 10490 -49.7 -64.7 16 0.03 285 85 332.1 332.2 332.1 - 247.0 10569 -48.7 -63.7 16 0.03 283 88 334.7 334.8 334.7 - 244.0 10649 -48.9 -63.9 16 0.03 280 91 335.6 335.7 335.6 - 243.3 10668 -48.9 -63.9 16 0.03 280 91 335.8 335.9 335.8 - 220.0 11327 -50.3 -65.3 15 0.03 280 85 343.5 343.6 343.5 - 212.0 11569 -50.5 -65.5 15 0.03 280 83 346.8 346.9 346.8 - 210.0 11631 -49.7 -64.7 16 0.03 280 83 349.0 349.1 349.0 - 200.0 11950 -49.9 -64.9 15 0.03 280 80 353.6 353.7 353.6 - 194.0 12149 -49.9 -64.9 15 0.03 279 78 356.7 356.8 356.7 - 183.0 12529 -51.3 -66.3 15 0.03 278 75 360.4 360.5 360.4 - 164.0 13233 -55.3 -68.3 18 0.02 277 69 365.2 365.3 365.2 - 152.0 13716 -56.5 -69.5 18 0.02 275 65 371.1 371.2 371.1 - 150.0 13800 -57.1 -70.1 18 0.02 275 64 371.5 371.6 371.5 - 136.0 14414 -60.5 -72.5 19 0.02 268 54 376.0 376.1 376.0 - 132.0 14600 -60.1 -72.1 19 0.02 265 51 380.0 380.1 380.0 - 131.4 14630 -60.2 -72.2 19 0.02 265 51 380.3 380.4 380.3 - 128.0 14792 -60.9 -72.9 19 0.02 266 50 381.9 382.0 381.9 - 125.0 14939 -60.1 -72.1 19 0.02 268 49 385.9 386.0 385.9 - 119.0 15240 -62.2 -73.8 20 0.01 270 48 387.4 387.5 387.4 - 112.0 15616 -64.9 -75.9 21 0.01 265 53 389.3 389.3 389.3 - 108.0 15838 -64.1 -75.1 21 0.01 265 58 394.8 394.9 394.8 - 107.8 15850 -64.1 -75.1 21 0.01 265 58 395.0 395.1 395.0 - 105.0 16010 -64.7 -75.7 21 0.01 272 50 396.9 396.9 396.9 - 103.0 16128 -62.9 -73.9 21 0.02 277 45 402.5 402.6 402.5 - 100.0 16310 -62.5 -73.5 21 0.02 285 36 406.7 406.8 406.7 - ''' - - # Parse the data - sound_data = StringIO(data_txt) - p, h, T, Td = np.loadtxt(sound_data, usecols=range(0, 4), unpack=True) - - # Create a new figure. The dimensions here give a good aspect ratio - fig = plt.figure(figsize=(6.5875, 6.2125)) - ax = fig.add_subplot(111, projection='skewx') - - plt.grid(True) - - # Plot the data using normal plotting functions, in this case using - # log scaling in Y, as dicatated by the typical meteorological plot - ax.semilogy(T, p, 'r') - ax.semilogy(Td, p, 'g') - - # An example of a slanted line at constant X - l = ax.axvline(0, color='b') - - # Disables the log-formatting that comes with semilogy - ax.yaxis.set_major_formatter(ScalarFormatter()) - ax.set_yticks(np.linspace(100, 1000, 10)) - ax.set_ylim(1050, 100) - - ax.xaxis.set_major_locator(MultipleLocator(10)) - ax.set_xlim(-50, 50) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/span_regions.rst.txt b/_sources/examples/api/span_regions.rst.txt deleted file mode 100644 index 1af53d6274f..00000000000 --- a/_sources/examples/api/span_regions.rst.txt +++ /dev/null @@ -1,49 +0,0 @@ -.. _api-span_regions: - -api example code: span_regions.py -================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/span_regions.py - -:: - - """ - ================ - Using span_where - ================ - - Illustrate some helper functions for shading regions where a logical - mask is True - - See :meth:`matplotlib.collections.BrokenBarHCollection.span_where` - """ - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.collections as collections - - - t = np.arange(0.0, 2, 0.01) - s1 = np.sin(2*np.pi*t) - s2 = 1.2*np.sin(4*np.pi*t) - - - fig, ax = plt.subplots() - ax.set_title('using span_where') - ax.plot(t, s1, color='black') - ax.axhline(0, color='black', lw=2) - - collection = collections.BrokenBarHCollection.span_where( - t, ymin=0, ymax=1, where=s1 > 0, facecolor='green', alpha=0.5) - ax.add_collection(collection) - - collection = collections.BrokenBarHCollection.span_where( - t, ymin=-1, ymax=0, where=s1 < 0, facecolor='red', alpha=0.5) - ax.add_collection(collection) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/span_regions.txt b/_sources/examples/api/span_regions.txt deleted file mode 100644 index f3aed4e9daf..00000000000 --- a/_sources/examples/api/span_regions.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _api-span_regions: - -api example code: span_regions.py -================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/span_regions.py - -:: - - """ - Illustrate some helper functions for shading regions where a logical - mask is True - - See :meth:`matplotlib.collections.BrokenBarHCollection.span_where` - """ - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.collections as collections - - - t = np.arange(0.0, 2, 0.01) - s1 = np.sin(2*np.pi*t) - s2 = 1.2*np.sin(4*np.pi*t) - - - fig, ax = plt.subplots() - ax.set_title('using span_where') - ax.plot(t, s1, color='black') - ax.axhline(0, color='black', lw=2) - - collection = collections.BrokenBarHCollection.span_where( - t, ymin=0, ymax=1, where=s1 > 0, facecolor='green', alpha=0.5) - ax.add_collection(collection) - - collection = collections.BrokenBarHCollection.span_where( - t, ymin=-1, ymax=0, where=s1 < 0, facecolor='red', alpha=0.5) - ax.add_collection(collection) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/two_scales.rst.txt b/_sources/examples/api/two_scales.rst.txt deleted file mode 100644 index ed182958be1..00000000000 --- a/_sources/examples/api/two_scales.rst.txt +++ /dev/null @@ -1,54 +0,0 @@ -.. _api-two_scales: - -api example code: two_scales.py -=============================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/two_scales.py - -:: - - """ - =========================== - Plots with different scales - =========================== - - Demonstrate how to do two plots on the same axes with different left and - right scales. - - The trick is to use *two different axes* that share the same *x* axis. - You can use separate `matplotlib.ticker` formatters and locators as - desired since the two axes are independent. - - Such axes are generated by calling the `Axes.twinx` method. Likewise, - `Axes.twiny` is available to generate axes that share a *y* axis but - have different top and bottom scales. - - The twinx and twiny methods are also exposed as pyplot functions. - - """ - - import numpy as np - import matplotlib.pyplot as plt - - fig, ax1 = plt.subplots() - t = np.arange(0.01, 10.0, 0.01) - s1 = np.exp(t) - ax1.plot(t, s1, 'b-') - ax1.set_xlabel('time (s)') - # Make the y-axis label, ticks and tick labels match the line color. - ax1.set_ylabel('exp', color='b') - ax1.tick_params('y', colors='b') - - ax2 = ax1.twinx() - s2 = np.sin(2 * np.pi * t) - ax2.plot(t, s2, 'r.') - ax2.set_ylabel('sin', color='r') - ax2.tick_params('y', colors='r') - - fig.tight_layout() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/two_scales.txt b/_sources/examples/api/two_scales.txt deleted file mode 100644 index a129be6a576..00000000000 --- a/_sources/examples/api/two_scales.txt +++ /dev/null @@ -1,58 +0,0 @@ -.. _api-two_scales: - -api example code: two_scales.py -=============================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/two_scales.py - -:: - - #!/usr/bin/env python - """ - - Demonstrate how to do two plots on the same axes with different left - right scales. - - - The trick is to use *2 different axes*. Turn the axes rectangular - frame off on the 2nd axes to keep it from obscuring the first. - Manually set the tick locs and labels as desired. You can use - separate matplotlib.ticker formatters and locators as desired since - the two axes are independent. - - This is achieved in the following example by calling the Axes.twinx() - method, which performs this work. See the source of twinx() in - axes.py for an example of how to do it for different x scales. (Hint: - use the xaxis instance and call tick_bottom and tick_top in place of - tick_left and tick_right.) - - The twinx and twiny methods are also exposed as pyplot functions. - - """ - - import numpy as np - import matplotlib.pyplot as plt - - fig, ax1 = plt.subplots() - t = np.arange(0.01, 10.0, 0.01) - s1 = np.exp(t) - ax1.plot(t, s1, 'b-') - ax1.set_xlabel('time (s)') - # Make the y-axis label and tick labels match the line color. - ax1.set_ylabel('exp', color='b') - for tl in ax1.get_yticklabels(): - tl.set_color('b') - - - ax2 = ax1.twinx() - s2 = np.sin(2*np.pi*t) - ax2.plot(t, s2, 'r.') - ax2.set_ylabel('sin', color='r') - for tl in ax2.get_yticklabels(): - tl.set_color('r') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/unicode_minus.rst.txt b/_sources/examples/api/unicode_minus.rst.txt deleted file mode 100644 index 5f58602fbb5..00000000000 --- a/_sources/examples/api/unicode_minus.rst.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _api-unicode_minus: - -api example code: unicode_minus.py -================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/unicode_minus.py - -:: - - """ - ============= - Unicode minus - ============= - - You can use the proper typesetting Unicode minus (see - https://en.wikipedia.org/wiki/Plus_sign#Plus_sign) or the ASCII hyphen - for minus, which some people prefer. The matplotlibrc param - axes.unicode_minus controls the default behavior. - - The default is to use the Unicode minus. - """ - import numpy as np - import matplotlib - import matplotlib.pyplot as plt - - matplotlib.rcParams['axes.unicode_minus'] = False - fig, ax = plt.subplots() - ax.plot(10*np.random.randn(100), 10*np.random.randn(100), 'o') - ax.set_title('Using hyphen instead of Unicode minus') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/unicode_minus.txt b/_sources/examples/api/unicode_minus.txt deleted file mode 100644 index 3f7b348d7bd..00000000000 --- a/_sources/examples/api/unicode_minus.txt +++ /dev/null @@ -1,31 +0,0 @@ -.. _api-unicode_minus: - -api example code: unicode_minus.py -================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/unicode_minus.py - -:: - - """ - You can use the proper typesetting unicode minus (see - http://en.wikipedia.org/wiki/Plus_sign#Plus_sign) or the ASCII hypen - for minus, which some people prefer. The matplotlibrc param - axes.unicode_minus controls the default behavior. - - The default is to use the unicode minus - """ - import numpy as np - import matplotlib - import matplotlib.pyplot as plt - - matplotlib.rcParams['axes.unicode_minus'] = False - fig, ax = plt.subplots() - ax.plot(10*np.random.randn(100), 10*np.random.randn(100), 'o') - ax.set_title('Using hypen instead of unicode minus') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/watermark_image.rst.txt b/_sources/examples/api/watermark_image.rst.txt deleted file mode 100644 index 2283fbef259..00000000000 --- a/_sources/examples/api/watermark_image.rst.txt +++ /dev/null @@ -1,39 +0,0 @@ -.. _api-watermark_image: - -api example code: watermark_image.py -==================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/watermark_image.py - -:: - - """ - =============== - Watermark image - =============== - - Use a PNG file as a watermark - """ - from __future__ import print_function - import numpy as np - import matplotlib.cbook as cbook - import matplotlib.image as image - import matplotlib.pyplot as plt - - datafile = cbook.get_sample_data('logo2.png', asfileobj=False) - print('loading %s' % datafile) - im = image.imread(datafile) - im[:, :, -1] = 0.5 # set the alpha channel - - fig, ax = plt.subplots() - - ax.plot(np.random.rand(20), '-o', ms=20, lw=2, alpha=0.7, mfc='orange') - ax.grid() - fig.figimage(im, 10, 10, zorder=3) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/watermark_image.txt b/_sources/examples/api/watermark_image.txt deleted file mode 100644 index b87edf8ecc2..00000000000 --- a/_sources/examples/api/watermark_image.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _api-watermark_image: - -api example code: watermark_image.py -==================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/watermark_image.py - -:: - - """ - Use a PNG file as a watermark - """ - from __future__ import print_function - import numpy as np - import matplotlib.cbook as cbook - import matplotlib.image as image - import matplotlib.pyplot as plt - - datafile = cbook.get_sample_data('logo2.png', asfileobj=False) - print('loading %s' % datafile) - im = image.imread(datafile) - im[:, :, -1] = 0.5 # set the alpha channel - - fig, ax = plt.subplots() - - ax.plot(np.random.rand(20), '-o', ms=20, lw=2, alpha=0.7, mfc='orange') - ax.grid() - fig.figimage(im, 10, 10) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/watermark_text.rst.txt b/_sources/examples/api/watermark_text.rst.txt deleted file mode 100644 index 8b1c9020f56..00000000000 --- a/_sources/examples/api/watermark_text.rst.txt +++ /dev/null @@ -1,37 +0,0 @@ -.. _api-watermark_text: - -api example code: watermark_text.py -=================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/api/watermark_text.py - -:: - - """ - ============== - Text watermark - ============== - - Use a Text as a watermark - """ - import numpy as np - #import matplotlib - #matplotlib.use('Agg') - - import matplotlib.pyplot as plt - - fig, ax = plt.subplots() - ax.plot(np.random.rand(20), '-o', ms=20, lw=2, alpha=0.7, mfc='orange') - ax.grid() - - # position bottom right - fig.text(0.95, 0.05, 'Property of MPL', - fontsize=50, color='gray', - ha='right', va='bottom', alpha=0.5) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/api/watermark_text.txt b/_sources/examples/api/watermark_text.txt deleted file mode 100644 index a4e16bbf410..00000000000 --- a/_sources/examples/api/watermark_text.txt +++ /dev/null @@ -1,33 +0,0 @@ -.. _api-watermark_text: - -api example code: watermark_text.py -=================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/api/watermark_text.py - -:: - - """ - Use a Text as a watermark - """ - import numpy as np - #import matplotlib - #matplotlib.use('Agg') - - import matplotlib.pyplot as plt - - fig, ax = plt.subplots() - ax.plot(np.random.rand(20), '-o', ms=20, lw=2, alpha=0.7, mfc='orange') - ax.grid() - - # position bottom right - fig.text(0.95, 0.05, 'Property of MPL', - fontsize=50, color='gray', - ha='right', va='bottom', alpha=0.5) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_axes_divider.rst.txt b/_sources/examples/axes_grid/demo_axes_divider.rst.txt deleted file mode 100644 index fbef2cfd2ab..00000000000 --- a/_sources/examples/axes_grid/demo_axes_divider.rst.txt +++ /dev/null @@ -1,142 +0,0 @@ -.. _axes_grid-demo_axes_divider: - -axes_grid example code: demo_axes_divider.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/axes_grid/demo_axes_divider.py - -:: - - import matplotlib.pyplot as plt - - - def get_demo_image(): - import numpy as np - from matplotlib.cbook import get_sample_data - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3, 4, -4, 3) - - - def demo_simple_image(ax): - Z, extent = get_demo_image() - - im = ax.imshow(Z, extent=extent, interpolation="nearest") - cb = plt.colorbar(im) - plt.setp(cb.ax.get_yticklabels(), visible=False) - - - def demo_locatable_axes_hard(fig1): - - from mpl_toolkits.axes_grid1 \ - import SubplotDivider, LocatableAxes, Size - - divider = SubplotDivider(fig1, 2, 2, 2, aspect=True) - - # axes for image - ax = LocatableAxes(fig1, divider.get_position()) - - # axes for colorbar - ax_cb = LocatableAxes(fig1, divider.get_position()) - - h = [Size.AxesX(ax), # main axes - Size.Fixed(0.05), # padding, 0.1 inch - Size.Fixed(0.2), # colorbar, 0.3 inch - ] - - v = [Size.AxesY(ax)] - - divider.set_horizontal(h) - divider.set_vertical(v) - - ax.set_axes_locator(divider.new_locator(nx=0, ny=0)) - ax_cb.set_axes_locator(divider.new_locator(nx=2, ny=0)) - - fig1.add_axes(ax) - fig1.add_axes(ax_cb) - - ax_cb.axis["left"].toggle(all=False) - ax_cb.axis["right"].toggle(ticks=True) - - Z, extent = get_demo_image() - - im = ax.imshow(Z, extent=extent, interpolation="nearest") - plt.colorbar(im, cax=ax_cb) - plt.setp(ax_cb.get_yticklabels(), visible=False) - - - def demo_locatable_axes_easy(ax): - from mpl_toolkits.axes_grid1 import make_axes_locatable - - divider = make_axes_locatable(ax) - - ax_cb = divider.new_horizontal(size="5%", pad=0.05) - fig1 = ax.get_figure() - fig1.add_axes(ax_cb) - - Z, extent = get_demo_image() - im = ax.imshow(Z, extent=extent, interpolation="nearest") - - plt.colorbar(im, cax=ax_cb) - ax_cb.yaxis.tick_right() - for tl in ax_cb.get_yticklabels(): - tl.set_visible(False) - ax_cb.yaxis.tick_right() - - - def demo_images_side_by_side(ax): - from mpl_toolkits.axes_grid1 import make_axes_locatable - - divider = make_axes_locatable(ax) - - Z, extent = get_demo_image() - ax2 = divider.new_horizontal(size="100%", pad=0.05) - fig1 = ax.get_figure() - fig1.add_axes(ax2) - - ax.imshow(Z, extent=extent, interpolation="nearest") - ax2.imshow(Z, extent=extent, interpolation="nearest") - for tl in ax2.get_yticklabels(): - tl.set_visible(False) - - - def demo(): - - fig1 = plt.figure(1, (6, 6)) - fig1.clf() - - # PLOT 1 - # simple image & colorbar - ax = fig1.add_subplot(2, 2, 1) - demo_simple_image(ax) - - # PLOT 2 - # image and colorbar whose location is adjusted in the drawing time. - # a hard way - - demo_locatable_axes_hard(fig1) - - # PLOT 3 - # image and colorbar whose location is adjusted in the drawing time. - # a easy way - - ax = fig1.add_subplot(2, 2, 3) - demo_locatable_axes_easy(ax) - - # PLOT 4 - # two images side by side with fixed padding. - - ax = fig1.add_subplot(2, 2, 4) - demo_images_side_by_side(ax) - - plt.draw() - plt.show() - - - demo() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_axes_divider.txt b/_sources/examples/axes_grid/demo_axes_divider.txt deleted file mode 100644 index 7bb1f75676f..00000000000 --- a/_sources/examples/axes_grid/demo_axes_divider.txt +++ /dev/null @@ -1,142 +0,0 @@ -.. _axes_grid-demo_axes_divider: - -axes_grid example code: demo_axes_divider.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/axes_grid/demo_axes_divider.py - -:: - - import matplotlib.pyplot as plt - - - def get_demo_image(): - import numpy as np - from matplotlib.cbook import get_sample_data - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3, 4, -4, 3) - - - def demo_simple_image(ax): - Z, extent = get_demo_image() - - im = ax.imshow(Z, extent=extent, interpolation="nearest") - cb = plt.colorbar(im) - plt.setp(cb.ax.get_yticklabels(), visible=False) - - - def demo_locatable_axes_hard(fig1): - - from mpl_toolkits.axes_grid1 \ - import SubplotDivider, LocatableAxes, Size - - divider = SubplotDivider(fig1, 2, 2, 2, aspect=True) - - # axes for image - ax = LocatableAxes(fig1, divider.get_position()) - - # axes for colorbar - ax_cb = LocatableAxes(fig1, divider.get_position()) - - h = [Size.AxesX(ax), # main axes - Size.Fixed(0.05), # padding, 0.1 inch - Size.Fixed(0.2), # colorbar, 0.3 inch - ] - - v = [Size.AxesY(ax)] - - divider.set_horizontal(h) - divider.set_vertical(v) - - ax.set_axes_locator(divider.new_locator(nx=0, ny=0)) - ax_cb.set_axes_locator(divider.new_locator(nx=2, ny=0)) - - fig1.add_axes(ax) - fig1.add_axes(ax_cb) - - ax_cb.axis["left"].toggle(all=False) - ax_cb.axis["right"].toggle(ticks=True) - - Z, extent = get_demo_image() - - im = ax.imshow(Z, extent=extent, interpolation="nearest") - plt.colorbar(im, cax=ax_cb) - plt.setp(ax_cb.get_yticklabels(), visible=False) - - - def demo_locatable_axes_easy(ax): - from mpl_toolkits.axes_grid1 import make_axes_locatable - - divider = make_axes_locatable(ax) - - ax_cb = divider.new_horizontal(size="5%", pad=0.05) - fig1 = ax.get_figure() - fig1.add_axes(ax_cb) - - Z, extent = get_demo_image() - im = ax.imshow(Z, extent=extent, interpolation="nearest") - - plt.colorbar(im, cax=ax_cb) - ax_cb.yaxis.tick_right() - for tl in ax_cb.get_yticklabels(): - tl.set_visible(False) - ax_cb.yaxis.tick_right() - - - def demo_images_side_by_side(ax): - from mpl_toolkits.axes_grid1 import make_axes_locatable - - divider = make_axes_locatable(ax) - - Z, extent = get_demo_image() - ax2 = divider.new_horizontal(size="100%", pad=0.05) - fig1 = ax.get_figure() - fig1.add_axes(ax2) - - ax.imshow(Z, extent=extent, interpolation="nearest") - ax2.imshow(Z, extent=extent, interpolation="nearest") - for tl in ax2.get_yticklabels(): - tl.set_visible(False) - - - def demo(): - - fig1 = plt.figure(1, (6, 6)) - fig1.clf() - - # PLOT 1 - # simple image & colorbar - ax = fig1.add_subplot(2, 2, 1) - demo_simple_image(ax) - - # PLOT 2 - # image and colorbar whose location is adjusted in the drawing time. - # a hard way - - demo_locatable_axes_hard(fig1) - - # PLOT 3 - # image and colorbar whose location is adjusted in the drawing time. - # a easy way - - ax = fig1.add_subplot(2, 2, 3) - demo_locatable_axes_easy(ax) - - # PLOT 4 - # two images side by side with fixed padding. - - ax = fig1.add_subplot(2, 2, 4) - demo_images_side_by_side(ax) - - plt.draw() - plt.show() - - - demo() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_axes_grid.rst.txt b/_sources/examples/axes_grid/demo_axes_grid.rst.txt deleted file mode 100644 index 7ae5f8d223e..00000000000 --- a/_sources/examples/axes_grid/demo_axes_grid.rst.txt +++ /dev/null @@ -1,147 +0,0 @@ -.. _axes_grid-demo_axes_grid: - -axes_grid example code: demo_axes_grid.py -========================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/axes_grid/demo_axes_grid.py - -:: - - import matplotlib.pyplot as plt - from mpl_toolkits.axes_grid1 import AxesGrid - - - def get_demo_image(): - import numpy as np - from matplotlib.cbook import get_sample_data - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3, 4, -4, 3) - - - def demo_simple_grid(fig): - """ - A grid of 2x2 images with 0.05 inch pad between images and only - the lower-left axes is labeled. - """ - grid = AxesGrid(fig, 141, # similar to subplot(141) - nrows_ncols=(2, 2), - axes_pad=0.05, - label_mode="1", - ) - - Z, extent = get_demo_image() - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest") - - # This only affects axes in first column and second row as share_all = - # False. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - - - def demo_grid_with_single_cbar(fig): - """ - A grid of 2x2 images with a single colorbar - """ - grid = AxesGrid(fig, 142, # similar to subplot(142) - nrows_ncols=(2, 2), - axes_pad=0.0, - share_all=True, - label_mode="L", - cbar_location="top", - cbar_mode="single", - ) - - Z, extent = get_demo_image() - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest") - #plt.colorbar(im, cax = grid.cbar_axes[0]) - grid.cbar_axes[0].colorbar(im) - - for cax in grid.cbar_axes: - cax.toggle_label(False) - - # This affects all axes as share_all = True. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - - - def demo_grid_with_each_cbar(fig): - """ - A grid of 2x2 images. Each image has its own colorbar. - """ - - grid = AxesGrid(fig, 143, # similar to subplot(143) - nrows_ncols=(2, 2), - axes_pad=0.1, - label_mode="1", - share_all=True, - cbar_location="top", - cbar_mode="each", - cbar_size="7%", - cbar_pad="2%", - ) - Z, extent = get_demo_image() - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest") - grid.cbar_axes[i].colorbar(im) - - for cax in grid.cbar_axes: - cax.toggle_label(False) - - # This affects all axes because we set share_all = True. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - - - def demo_grid_with_each_cbar_labelled(fig): - """ - A grid of 2x2 images. Each image has its own colorbar. - """ - - grid = AxesGrid(fig, 144, # similar to subplot(144) - nrows_ncols=(2, 2), - axes_pad=(0.45, 0.15), - label_mode="1", - share_all=True, - cbar_location="right", - cbar_mode="each", - cbar_size="7%", - cbar_pad="2%", - ) - Z, extent = get_demo_image() - - # Use a different colorbar range every time - limits = ((0, 1), (-2, 2), (-1.7, 1.4), (-1.5, 1)) - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest", - vmin=limits[i][0], vmax=limits[i][1]) - grid.cbar_axes[i].colorbar(im) - - for i, cax in enumerate(grid.cbar_axes): - cax.set_yticks((limits[i][0], limits[i][1])) - - # This affects all axes because we set share_all = True. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - - - if 1: - F = plt.figure(1, (10.5, 2.5)) - - F.subplots_adjust(left=0.05, right=0.95) - - demo_simple_grid(F) - demo_grid_with_single_cbar(F) - demo_grid_with_each_cbar(F) - demo_grid_with_each_cbar_labelled(F) - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_axes_grid.txt b/_sources/examples/axes_grid/demo_axes_grid.txt deleted file mode 100644 index 67228f559f9..00000000000 --- a/_sources/examples/axes_grid/demo_axes_grid.txt +++ /dev/null @@ -1,147 +0,0 @@ -.. _axes_grid-demo_axes_grid: - -axes_grid example code: demo_axes_grid.py -========================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/axes_grid/demo_axes_grid.py - -:: - - import matplotlib.pyplot as plt - from mpl_toolkits.axes_grid1 import AxesGrid - - - def get_demo_image(): - import numpy as np - from matplotlib.cbook import get_sample_data - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3, 4, -4, 3) - - - def demo_simple_grid(fig): - """ - A grid of 2x2 images with 0.05 inch pad between images and only - the lower-left axes is labeled. - """ - grid = AxesGrid(fig, 141, # similar to subplot(141) - nrows_ncols=(2, 2), - axes_pad=0.05, - label_mode="1", - ) - - Z, extent = get_demo_image() - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest") - - # This only affects axes in first column and second row as share_all = - # False. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - - - def demo_grid_with_single_cbar(fig): - """ - A grid of 2x2 images with a single colorbar - """ - grid = AxesGrid(fig, 142, # similar to subplot(142) - nrows_ncols=(2, 2), - axes_pad=0.0, - share_all=True, - label_mode="L", - cbar_location="top", - cbar_mode="single", - ) - - Z, extent = get_demo_image() - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest") - #plt.colorbar(im, cax = grid.cbar_axes[0]) - grid.cbar_axes[0].colorbar(im) - - for cax in grid.cbar_axes: - cax.toggle_label(False) - - # This affects all axes as share_all = True. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - - - def demo_grid_with_each_cbar(fig): - """ - A grid of 2x2 images. Each image has its own colorbar. - """ - - grid = AxesGrid(fig, 143, # similar to subplot(143) - nrows_ncols=(2, 2), - axes_pad=0.1, - label_mode="1", - share_all=True, - cbar_location="top", - cbar_mode="each", - cbar_size="7%", - cbar_pad="2%", - ) - Z, extent = get_demo_image() - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest") - grid.cbar_axes[i].colorbar(im) - - for cax in grid.cbar_axes: - cax.toggle_label(False) - - # This affects all axes because we set share_all = True. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - - - def demo_grid_with_each_cbar_labelled(fig): - """ - A grid of 2x2 images. Each image has its own colorbar. - """ - - grid = AxesGrid(fig, 144, # similar to subplot(144) - nrows_ncols=(2, 2), - axes_pad=(0.45, 0.15), - label_mode="1", - share_all=True, - cbar_location="right", - cbar_mode="each", - cbar_size="7%", - cbar_pad="2%", - ) - Z, extent = get_demo_image() - - # Use a different colorbar range every time - limits = ((0, 1), (-2, 2), (-1.7, 1.4), (-1.5, 1)) - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest", - vmin=limits[i][0], vmax=limits[i][1]) - grid.cbar_axes[i].colorbar(im) - - for i, cax in enumerate(grid.cbar_axes): - cax.set_yticks((limits[i][0], limits[i][1])) - - # This affects all axes because we set share_all = True. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - - - if 1: - F = plt.figure(1, (10.5, 2.5)) - - F.subplots_adjust(left=0.05, right=0.95) - - demo_simple_grid(F) - demo_grid_with_single_cbar(F) - demo_grid_with_each_cbar(F) - demo_grid_with_each_cbar_labelled(F) - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_axes_grid2.rst.txt b/_sources/examples/axes_grid/demo_axes_grid2.rst.txt deleted file mode 100644 index 73aaf0d8e03..00000000000 --- a/_sources/examples/axes_grid/demo_axes_grid2.rst.txt +++ /dev/null @@ -1,127 +0,0 @@ -.. _axes_grid-demo_axes_grid2: - -axes_grid example code: demo_axes_grid2.py -========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/axes_grid/demo_axes_grid2.py - -:: - - import matplotlib.pyplot as plt - from mpl_toolkits.axes_grid1 import ImageGrid - import numpy as np - - - def get_demo_image(): - from matplotlib.cbook import get_sample_data - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3, 4, -4, 3) - - - def add_inner_title(ax, title, loc, size=None, **kwargs): - from matplotlib.offsetbox import AnchoredText - from matplotlib.patheffects import withStroke - if size is None: - size = dict(size=plt.rcParams['legend.fontsize']) - at = AnchoredText(title, loc=loc, prop=size, - pad=0., borderpad=0.5, - frameon=False, **kwargs) - ax.add_artist(at) - at.txt._text.set_path_effects([withStroke(foreground="w", linewidth=3)]) - return at - - if 1: - F = plt.figure(1, (6, 6)) - F.clf() - - # prepare images - Z, extent = get_demo_image() - ZS = [Z[i::3, :] for i in range(3)] - extent = extent[0], extent[1]/3., extent[2], extent[3] - - # demo 1 : colorbar at each axes - - grid = ImageGrid(F, 211, # similar to subplot(111) - nrows_ncols=(1, 3), - direction="row", - axes_pad=0.05, - add_all=True, - label_mode="1", - share_all=True, - cbar_location="top", - cbar_mode="each", - cbar_size="7%", - cbar_pad="1%", - ) - - for ax, z in zip(grid, ZS): - im = ax.imshow( - z, origin="lower", extent=extent, interpolation="nearest") - ax.cax.colorbar(im) - - for ax, im_title in zip(grid, ["Image 1", "Image 2", "Image 3"]): - t = add_inner_title(ax, im_title, loc=3) - t.patch.set_alpha(0.5) - - for ax, z in zip(grid, ZS): - ax.cax.toggle_label(True) - #axis = ax.cax.axis[ax.cax.orientation] - #axis.label.set_text("counts s$^{-1}$") - #axis.label.set_size(10) - #axis.major_ticklabels.set_size(6) - - # changing the colorbar ticks - grid[1].cax.set_xticks([-1, 0, 1]) - grid[2].cax.set_xticks([-1, 0, 1]) - - grid[0].set_xticks([-2, 0]) - grid[0].set_yticks([-2, 0, 2]) - - # demo 2 : shared colorbar - - grid2 = ImageGrid(F, 212, - nrows_ncols=(1, 3), - direction="row", - axes_pad=0.05, - add_all=True, - label_mode="1", - share_all=True, - cbar_location="right", - cbar_mode="single", - cbar_size="10%", - cbar_pad=0.05, - ) - - grid2[0].set_xlabel("X") - grid2[0].set_ylabel("Y") - - vmax, vmin = np.max(ZS), np.min(ZS) - import matplotlib.colors - norm = matplotlib.colors.Normalize(vmax=vmax, vmin=vmin) - - for ax, z in zip(grid2, ZS): - im = ax.imshow(z, norm=norm, - origin="lower", extent=extent, - interpolation="nearest") - - # With cbar_mode="single", cax attribute of all axes are identical. - ax.cax.colorbar(im) - ax.cax.toggle_label(True) - - for ax, im_title in zip(grid2, ["(a)", "(b)", "(c)"]): - t = add_inner_title(ax, im_title, loc=2) - t.patch.set_ec("none") - t.patch.set_alpha(0.5) - - grid2[0].set_xticks([-2, 0]) - grid2[0].set_yticks([-2, 0, 2]) - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_axes_grid2.txt b/_sources/examples/axes_grid/demo_axes_grid2.txt deleted file mode 100644 index 27ed4e50328..00000000000 --- a/_sources/examples/axes_grid/demo_axes_grid2.txt +++ /dev/null @@ -1,127 +0,0 @@ -.. _axes_grid-demo_axes_grid2: - -axes_grid example code: demo_axes_grid2.py -========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/axes_grid/demo_axes_grid2.py - -:: - - import matplotlib.pyplot as plt - from mpl_toolkits.axes_grid1 import ImageGrid - import numpy as np - - - def get_demo_image(): - from matplotlib.cbook import get_sample_data - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3, 4, -4, 3) - - - def add_inner_title(ax, title, loc, size=None, **kwargs): - from matplotlib.offsetbox import AnchoredText - from matplotlib.patheffects import withStroke - if size is None: - size = dict(size=plt.rcParams['legend.fontsize']) - at = AnchoredText(title, loc=loc, prop=size, - pad=0., borderpad=0.5, - frameon=False, **kwargs) - ax.add_artist(at) - at.txt._text.set_path_effects([withStroke(foreground="w", linewidth=3)]) - return at - - if 1: - F = plt.figure(1, (6, 6)) - F.clf() - - # prepare images - Z, extent = get_demo_image() - ZS = [Z[i::3, :] for i in range(3)] - extent = extent[0], extent[1]/3., extent[2], extent[3] - - # demo 1 : colorbar at each axes - - grid = ImageGrid(F, 211, # similar to subplot(111) - nrows_ncols=(1, 3), - direction="row", - axes_pad=0.05, - add_all=True, - label_mode="1", - share_all=True, - cbar_location="top", - cbar_mode="each", - cbar_size="7%", - cbar_pad="1%", - ) - - for ax, z in zip(grid, ZS): - im = ax.imshow( - z, origin="lower", extent=extent, interpolation="nearest") - ax.cax.colorbar(im) - - for ax, im_title in zip(grid, ["Image 1", "Image 2", "Image 3"]): - t = add_inner_title(ax, im_title, loc=3) - t.patch.set_alpha(0.5) - - for ax, z in zip(grid, ZS): - ax.cax.toggle_label(True) - #axis = ax.cax.axis[ax.cax.orientation] - #axis.label.set_text("counts s$^{-1}$") - #axis.label.set_size(10) - #axis.major_ticklabels.set_size(6) - - # changing the colorbar ticks - grid[1].cax.set_xticks([-1, 0, 1]) - grid[2].cax.set_xticks([-1, 0, 1]) - - grid[0].set_xticks([-2, 0]) - grid[0].set_yticks([-2, 0, 2]) - - # demo 2 : shared colorbar - - grid2 = ImageGrid(F, 212, - nrows_ncols=(1, 3), - direction="row", - axes_pad=0.05, - add_all=True, - label_mode="1", - share_all=True, - cbar_location="right", - cbar_mode="single", - cbar_size="10%", - cbar_pad=0.05, - ) - - grid2[0].set_xlabel("X") - grid2[0].set_ylabel("Y") - - vmax, vmin = np.max(ZS), np.min(ZS) - import matplotlib.colors - norm = matplotlib.colors.Normalize(vmax=vmax, vmin=vmin) - - for ax, z in zip(grid2, ZS): - im = ax.imshow(z, norm=norm, - origin="lower", extent=extent, - interpolation="nearest") - - # With cbar_mode="single", cax attribute of all axes are identical. - ax.cax.colorbar(im) - ax.cax.toggle_label(True) - - for ax, im_title in zip(grid2, ["(a)", "(b)", "(c)"]): - t = add_inner_title(ax, im_title, loc=2) - t.patch.set_ec("none") - t.patch.set_alpha(0.5) - - grid2[0].set_xticks([-2, 0]) - grid2[0].set_yticks([-2, 0, 2]) - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_axes_hbox_divider.rst.txt b/_sources/examples/axes_grid/demo_axes_hbox_divider.rst.txt deleted file mode 100644 index dab895cd08d..00000000000 --- a/_sources/examples/axes_grid/demo_axes_hbox_divider.rst.txt +++ /dev/null @@ -1,63 +0,0 @@ -.. _axes_grid-demo_axes_hbox_divider: - -axes_grid example code: demo_axes_hbox_divider.py -================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/axes_grid/demo_axes_hbox_divider.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - from mpl_toolkits.axes_grid1.axes_divider import HBoxDivider - import mpl_toolkits.axes_grid1.axes_size as Size - - - def make_heights_equal(fig, rect, ax1, ax2, pad): - # pad in inches - - h1, v1 = Size.AxesX(ax1), Size.AxesY(ax1) - h2, v2 = Size.AxesX(ax2), Size.AxesY(ax2) - - pad_v = Size.Scaled(1) - pad_h = Size.Fixed(pad) - - my_divider = HBoxDivider(fig, rect, - horizontal=[h1, pad_h, h2], - vertical=[v1, pad_v, v2]) - - ax1.set_axes_locator(my_divider.new_locator(0)) - ax2.set_axes_locator(my_divider.new_locator(2)) - - - if __name__ == "__main__": - - arr1 = np.arange(20).reshape((4, 5)) - arr2 = np.arange(20).reshape((5, 4)) - - fig, (ax1, ax2) = plt.subplots(1, 2) - ax1.imshow(arr1, interpolation="nearest") - ax2.imshow(arr2, interpolation="nearest") - - rect = 111 # subplot param for combined axes - make_heights_equal(fig, rect, ax1, ax2, pad=0.5) # pad in inches - - for ax in [ax1, ax2]: - ax.locator_params(nbins=4) - - # annotate - ax3 = plt.axes([0.5, 0.5, 0.001, 0.001], frameon=False) - ax3.xaxis.set_visible(False) - ax3.yaxis.set_visible(False) - ax3.annotate("Location of two axes are adjusted\n" - "so that they have equal heights\n" - "while maintaining their aspect ratios", (0.5, 0.5), - xycoords="axes fraction", va="center", ha="center", - bbox=dict(boxstyle="round, pad=1", fc="w")) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_axes_hbox_divider.txt b/_sources/examples/axes_grid/demo_axes_hbox_divider.txt deleted file mode 100644 index d9b73ebb0ae..00000000000 --- a/_sources/examples/axes_grid/demo_axes_hbox_divider.txt +++ /dev/null @@ -1,63 +0,0 @@ -.. _axes_grid-demo_axes_hbox_divider: - -axes_grid example code: demo_axes_hbox_divider.py -================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/axes_grid/demo_axes_hbox_divider.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - from mpl_toolkits.axes_grid1.axes_divider import HBoxDivider - import mpl_toolkits.axes_grid1.axes_size as Size - - - def make_heights_equal(fig, rect, ax1, ax2, pad): - # pad in inches - - h1, v1 = Size.AxesX(ax1), Size.AxesY(ax1) - h2, v2 = Size.AxesX(ax2), Size.AxesY(ax2) - - pad_v = Size.Scaled(1) - pad_h = Size.Fixed(pad) - - my_divider = HBoxDivider(fig, rect, - horizontal=[h1, pad_h, h2], - vertical=[v1, pad_v, v2]) - - ax1.set_axes_locator(my_divider.new_locator(0)) - ax2.set_axes_locator(my_divider.new_locator(2)) - - - if __name__ == "__main__": - - arr1 = np.arange(20).reshape((4, 5)) - arr2 = np.arange(20).reshape((5, 4)) - - fig, (ax1, ax2) = plt.subplots(1, 2) - ax1.imshow(arr1, interpolation="nearest") - ax2.imshow(arr2, interpolation="nearest") - - rect = 111 # subplot param for combined axes - make_heights_equal(fig, rect, ax1, ax2, pad=0.5) # pad in inches - - for ax in [ax1, ax2]: - ax.locator_params(nbins=4) - - # annotate - ax3 = plt.axes([0.5, 0.5, 0.001, 0.001], frameon=False) - ax3.xaxis.set_visible(False) - ax3.yaxis.set_visible(False) - ax3.annotate("Location of two axes are adjusted\n" - "so that they have equal heights\n" - "while maintaining their aspect ratios", (0.5, 0.5), - xycoords="axes fraction", va="center", ha="center", - bbox=dict(boxstyle="round, pad=1", fc="w")) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_axes_rgb.rst.txt b/_sources/examples/axes_grid/demo_axes_rgb.rst.txt deleted file mode 100644 index f0b21418068..00000000000 --- a/_sources/examples/axes_grid/demo_axes_rgb.rst.txt +++ /dev/null @@ -1,98 +0,0 @@ -.. _axes_grid-demo_axes_rgb: - -axes_grid example code: demo_axes_rgb.py -======================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/axes_grid/demo_axes_rgb.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - - from mpl_toolkits.axes_grid1.axes_rgb import make_rgb_axes, RGBAxes - - - def get_demo_image(): - from matplotlib.cbook import get_sample_data - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3, 4, -4, 3) - - - def get_rgb(): - Z, extent = get_demo_image() - - Z[Z < 0] = 0. - Z = Z/Z.max() - - R = Z[:13, :13] - G = Z[2:, 2:] - B = Z[:13, 2:] - - return R, G, B - - - def make_cube(r, g, b): - ny, nx = r.shape - R = np.zeros([ny, nx, 3], dtype="d") - R[:, :, 0] = r - G = np.zeros_like(R) - G[:, :, 1] = g - B = np.zeros_like(R) - B[:, :, 2] = b - - RGB = R + G + B - - return R, G, B, RGB - - - def demo_rgb(): - fig, ax = plt.subplots() - ax_r, ax_g, ax_b = make_rgb_axes(ax, pad=0.02) - #fig.add_axes(ax_r) - #fig.add_axes(ax_g) - #fig.add_axes(ax_b) - - r, g, b = get_rgb() - im_r, im_g, im_b, im_rgb = make_cube(r, g, b) - kwargs = dict(origin="lower", interpolation="nearest") - ax.imshow(im_rgb, **kwargs) - ax_r.imshow(im_r, **kwargs) - ax_g.imshow(im_g, **kwargs) - ax_b.imshow(im_b, **kwargs) - - - def demo_rgb2(): - fig = plt.figure(2) - ax = RGBAxes(fig, [0.1, 0.1, 0.8, 0.8], pad=0.0) - #fig.add_axes(ax) - #ax.add_RGB_to_figure() - - r, g, b = get_rgb() - kwargs = dict(origin="lower", interpolation="nearest") - ax.imshow_rgb(r, g, b, **kwargs) - - ax.RGB.set_xlim(0., 9.5) - ax.RGB.set_ylim(0.9, 10.6) - - for ax1 in [ax.RGB, ax.R, ax.G, ax.B]: - for sp1 in ax1.spines.values(): - sp1.set_color("w") - for tick in ax1.xaxis.get_major_ticks() + ax1.yaxis.get_major_ticks(): - tick.tick1line.set_mec("w") - tick.tick2line.set_mec("w") - - return ax - - - demo_rgb() - ax = demo_rgb2() - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_axes_rgb.txt b/_sources/examples/axes_grid/demo_axes_rgb.txt deleted file mode 100644 index 43494c19b49..00000000000 --- a/_sources/examples/axes_grid/demo_axes_rgb.txt +++ /dev/null @@ -1,98 +0,0 @@ -.. _axes_grid-demo_axes_rgb: - -axes_grid example code: demo_axes_rgb.py -======================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/axes_grid/demo_axes_rgb.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - - from mpl_toolkits.axes_grid1.axes_rgb import make_rgb_axes, RGBAxes - - - def get_demo_image(): - from matplotlib.cbook import get_sample_data - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3, 4, -4, 3) - - - def get_rgb(): - Z, extent = get_demo_image() - - Z[Z < 0] = 0. - Z = Z/Z.max() - - R = Z[:13, :13] - G = Z[2:, 2:] - B = Z[:13, 2:] - - return R, G, B - - - def make_cube(r, g, b): - ny, nx = r.shape - R = np.zeros([ny, nx, 3], dtype="d") - R[:, :, 0] = r - G = np.zeros_like(R) - G[:, :, 1] = g - B = np.zeros_like(R) - B[:, :, 2] = b - - RGB = R + G + B - - return R, G, B, RGB - - - def demo_rgb(): - fig, ax = plt.subplots() - ax_r, ax_g, ax_b = make_rgb_axes(ax, pad=0.02) - #fig.add_axes(ax_r) - #fig.add_axes(ax_g) - #fig.add_axes(ax_b) - - r, g, b = get_rgb() - im_r, im_g, im_b, im_rgb = make_cube(r, g, b) - kwargs = dict(origin="lower", interpolation="nearest") - ax.imshow(im_rgb, **kwargs) - ax_r.imshow(im_r, **kwargs) - ax_g.imshow(im_g, **kwargs) - ax_b.imshow(im_b, **kwargs) - - - def demo_rgb2(): - fig = plt.figure(2) - ax = RGBAxes(fig, [0.1, 0.1, 0.8, 0.8], pad=0.0) - #fig.add_axes(ax) - #ax.add_RGB_to_figure() - - r, g, b = get_rgb() - kwargs = dict(origin="lower", interpolation="nearest") - ax.imshow_rgb(r, g, b, **kwargs) - - ax.RGB.set_xlim(0., 9.5) - ax.RGB.set_ylim(0.9, 10.6) - - for ax1 in [ax.RGB, ax.R, ax.G, ax.B]: - for sp1 in ax1.spines.values(): - sp1.set_color("w") - for tick in ax1.xaxis.get_major_ticks() + ax1.yaxis.get_major_ticks(): - tick.tick1line.set_mec("w") - tick.tick2line.set_mec("w") - - return ax - - - demo_rgb() - ax = demo_rgb2() - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_axisline_style.rst.txt b/_sources/examples/axes_grid/demo_axisline_style.rst.txt deleted file mode 100644 index f8a28cb9bf2..00000000000 --- a/_sources/examples/axes_grid/demo_axisline_style.rst.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _axes_grid-demo_axisline_style: - -axes_grid example code: demo_axisline_style.py -============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/axes_grid/demo_axisline_style.py - -:: - - - from mpl_toolkits.axes_grid.axislines import SubplotZero - import matplotlib.pyplot as plt - import numpy as np - - if 1: - fig = plt.figure(1) - ax = SubplotZero(fig, 111) - fig.add_subplot(ax) - - for direction in ["xzero", "yzero"]: - ax.axis[direction].set_axisline_style("-|>") - ax.axis[direction].set_visible(True) - - for direction in ["left", "right", "bottom", "top"]: - ax.axis[direction].set_visible(False) - - x = np.linspace(-0.5, 1., 100) - ax.plot(x, np.sin(x*np.pi)) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_axisline_style.txt b/_sources/examples/axes_grid/demo_axisline_style.txt deleted file mode 100644 index 261996ca22e..00000000000 --- a/_sources/examples/axes_grid/demo_axisline_style.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _axes_grid-demo_axisline_style: - -axes_grid example code: demo_axisline_style.py -============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/axes_grid/demo_axisline_style.py - -:: - - - from mpl_toolkits.axes_grid.axislines import SubplotZero - import matplotlib.pyplot as plt - import numpy as np - - if 1: - fig = plt.figure(1) - ax = SubplotZero(fig, 111) - fig.add_subplot(ax) - - for direction in ["xzero", "yzero"]: - ax.axis[direction].set_axisline_style("-|>") - ax.axis[direction].set_visible(True) - - for direction in ["left", "right", "bottom", "top"]: - ax.axis[direction].set_visible(False) - - x = np.linspace(-0.5, 1., 100) - ax.plot(x, np.sin(x*np.pi)) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_colorbar_with_inset_locator.rst.txt b/_sources/examples/axes_grid/demo_colorbar_with_inset_locator.rst.txt deleted file mode 100644 index 33151aab52a..00000000000 --- a/_sources/examples/axes_grid/demo_colorbar_with_inset_locator.rst.txt +++ /dev/null @@ -1,47 +0,0 @@ -.. _axes_grid-demo_colorbar_with_inset_locator: - -axes_grid example code: demo_colorbar_with_inset_locator.py -=========================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/axes_grid/demo_colorbar_with_inset_locator.py - -:: - - import matplotlib.pyplot as plt - - from mpl_toolkits.axes_grid1.inset_locator import inset_axes - - fig, (ax1, ax2) = plt.subplots(1, 2, figsize=[6, 3]) - - axins1 = inset_axes(ax1, - width="50%", # width = 10% of parent_bbox width - height="5%", # height : 50% - loc=1) - - im1 = ax1.imshow([[1, 2], [2, 3]]) - plt.colorbar(im1, cax=axins1, orientation="horizontal", ticks=[1, 2, 3]) - axins1.xaxis.set_ticks_position("bottom") - - axins = inset_axes(ax2, - width="5%", # width = 10% of parent_bbox width - height="50%", # height : 50% - loc=3, - bbox_to_anchor=(1.05, 0., 1, 1), - bbox_transform=ax2.transAxes, - borderpad=0, - ) - - # Controlling the placement of the inset axes is basically same as that - # of the legend. you may want to play with the borderpad value and - # the bbox_to_anchor coordinate. - - im = ax2.imshow([[1, 2], [2, 3]]) - plt.colorbar(im, cax=axins, ticks=[1, 2, 3]) - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_colorbar_with_inset_locator.txt b/_sources/examples/axes_grid/demo_colorbar_with_inset_locator.txt deleted file mode 100644 index 16183db36b9..00000000000 --- a/_sources/examples/axes_grid/demo_colorbar_with_inset_locator.txt +++ /dev/null @@ -1,47 +0,0 @@ -.. _axes_grid-demo_colorbar_with_inset_locator: - -axes_grid example code: demo_colorbar_with_inset_locator.py -=========================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/axes_grid/demo_colorbar_with_inset_locator.py - -:: - - import matplotlib.pyplot as plt - - from mpl_toolkits.axes_grid1.inset_locator import inset_axes - - fig, (ax1, ax2) = plt.subplots(1, 2, figsize=[6, 3]) - - axins1 = inset_axes(ax1, - width="50%", # width = 10% of parent_bbox width - height="5%", # height : 50% - loc=1) - - im1 = ax1.imshow([[1, 2], [2, 3]]) - plt.colorbar(im1, cax=axins1, orientation="horizontal", ticks=[1, 2, 3]) - axins1.xaxis.set_ticks_position("bottom") - - axins = inset_axes(ax2, - width="5%", # width = 10% of parent_bbox width - height="50%", # height : 50% - loc=3, - bbox_to_anchor=(1.05, 0., 1, 1), - bbox_transform=ax2.transAxes, - borderpad=0, - ) - - # Controlling the placement of the inset axes is basically same as that - # of the legend. you may want to play with the borderpad value and - # the bbox_to_anchor coordinate. - - im = ax2.imshow([[1, 2], [2, 3]]) - plt.colorbar(im, cax=axins, ticks=[1, 2, 3]) - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_curvelinear_grid.rst.txt b/_sources/examples/axes_grid/demo_curvelinear_grid.rst.txt deleted file mode 100644 index b96170719a4..00000000000 --- a/_sources/examples/axes_grid/demo_curvelinear_grid.rst.txt +++ /dev/null @@ -1,151 +0,0 @@ -.. _axes_grid-demo_curvelinear_grid: - -axes_grid example code: demo_curvelinear_grid.py -================================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/axes_grid/demo_curvelinear_grid.py - -:: - - """ - Custom grid and ticklines. - - This example demonstrates how to use GridHelperCurveLinear to define - custom grids and ticklines by applying a transformation on the grid. - This can be used, as showcase on the second plot, to create polar - projections in a rectangular box. - """ - - import numpy as np - - import matplotlib.pyplot as plt - import matplotlib.cbook as cbook - - from mpl_toolkits.axisartist import Subplot - from mpl_toolkits.axisartist import SubplotHost, \ - ParasiteAxesAuxTrans - from mpl_toolkits.axisartist.grid_helper_curvelinear import \ - GridHelperCurveLinear - - - def curvelinear_test1(fig): - """ - grid for custom transform. - """ - - def tr(x, y): - x, y = np.asarray(x), np.asarray(y) - return x, y - x - - def inv_tr(x, y): - x, y = np.asarray(x), np.asarray(y) - return x, y + x - - grid_helper = GridHelperCurveLinear((tr, inv_tr)) - - ax1 = Subplot(fig, 1, 2, 1, grid_helper=grid_helper) - # ax1 will have a ticks and gridlines defined by the given - # transform (+ transData of the Axes). Note that the transform of - # the Axes itself (i.e., transData) is not affected by the given - # transform. - - fig.add_subplot(ax1) - - xx, yy = tr([3, 6], [5.0, 10.]) - ax1.plot(xx, yy, linewidth=2.0) - - ax1.set_aspect(1.) - ax1.set_xlim(0, 10.) - ax1.set_ylim(0, 10.) - - ax1.axis["t"] = ax1.new_floating_axis(0, 3.) - ax1.axis["t2"] = ax1.new_floating_axis(1, 7.) - ax1.grid(True, zorder=0) - - - import mpl_toolkits.axisartist.angle_helper as angle_helper - - from matplotlib.projections import PolarAxes - from matplotlib.transforms import Affine2D - - - def curvelinear_test2(fig): - """ - polar projection, but in a rectangular box. - """ - - # PolarAxes.PolarTransform takes radian. However, we want our coordinate - # system in degree - tr = Affine2D().scale(np.pi/180., 1.) + PolarAxes.PolarTransform() - - # polar projection, which involves cycle, and also has limits in - # its coordinates, needs a special method to find the extremes - # (min, max of the coordinate within the view). - - # 20, 20 : number of sampling points along x, y direction - extreme_finder = angle_helper.ExtremeFinderCycle(20, 20, - lon_cycle=360, - lat_cycle=None, - lon_minmax=None, - lat_minmax=(0, np.inf), - ) - - grid_locator1 = angle_helper.LocatorDMS(12) - # Find a grid values appropriate for the coordinate (degree, - # minute, second). - - tick_formatter1 = angle_helper.FormatterDMS() - # And also uses an appropriate formatter. Note that,the - # acceptable Locator and Formatter class is a bit different than - # that of mpl's, and you cannot directly use mpl's Locator and - # Formatter here (but may be possible in the future). - - grid_helper = GridHelperCurveLinear(tr, - extreme_finder=extreme_finder, - grid_locator1=grid_locator1, - tick_formatter1=tick_formatter1 - ) - - ax1 = SubplotHost(fig, 1, 2, 2, grid_helper=grid_helper) - - # make ticklabels of right and top axis visible. - ax1.axis["right"].major_ticklabels.set_visible(True) - ax1.axis["top"].major_ticklabels.set_visible(True) - - # let right axis shows ticklabels for 1st coordinate (angle) - ax1.axis["right"].get_helper().nth_coord_ticks = 0 - # let bottom axis shows ticklabels for 2nd coordinate (radius) - ax1.axis["bottom"].get_helper().nth_coord_ticks = 1 - - fig.add_subplot(ax1) - - # A parasite axes with given transform - ax2 = ParasiteAxesAuxTrans(ax1, tr, "equal") - # note that ax2.transData == tr + ax1.transData - # Anything you draw in ax2 will match the ticks and grids of ax1. - ax1.parasites.append(ax2) - intp = cbook.simple_linear_interpolation - ax2.plot(intp(np.array([0, 30]), 50), - intp(np.array([10., 10.]), 50), - linewidth=2.0) - - ax1.set_aspect(1.) - ax1.set_xlim(-5, 12) - ax1.set_ylim(-5, 10) - - ax1.grid(True, zorder=0) - - if 1: - fig = plt.figure(1, figsize=(7, 4)) - fig.clf() - - curvelinear_test1(fig) - curvelinear_test2(fig) - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_curvelinear_grid.txt b/_sources/examples/axes_grid/demo_curvelinear_grid.txt deleted file mode 100644 index dae029323c3..00000000000 --- a/_sources/examples/axes_grid/demo_curvelinear_grid.txt +++ /dev/null @@ -1,140 +0,0 @@ -.. _axes_grid-demo_curvelinear_grid: - -axes_grid example code: demo_curvelinear_grid.py -================================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/axes_grid/demo_curvelinear_grid.py - -:: - - import numpy as np - - import matplotlib.pyplot as plt - import matplotlib.cbook as cbook - - from mpl_toolkits.axisartist import Subplot - from mpl_toolkits.axisartist import SubplotHost, \ - ParasiteAxesAuxTrans - from mpl_toolkits.axisartist.grid_helper_curvelinear import \ - GridHelperCurveLinear - - - def curvelinear_test1(fig): - """ - grid for custom transform. - """ - - def tr(x, y): - x, y = np.asarray(x), np.asarray(y) - return x, y - x - - def inv_tr(x, y): - x, y = np.asarray(x), np.asarray(y) - return x, y + x - - grid_helper = GridHelperCurveLinear((tr, inv_tr)) - - ax1 = Subplot(fig, 1, 2, 1, grid_helper=grid_helper) - # ax1 will have a ticks and gridlines defined by the given - # transform (+ transData of the Axes). Note that the transform of - # the Axes itself (i.e., transData) is not affected by the given - # transform. - - fig.add_subplot(ax1) - - xx, yy = tr([3, 6], [5.0, 10.]) - ax1.plot(xx, yy) - - ax1.set_aspect(1.) - ax1.set_xlim(0, 10.) - ax1.set_ylim(0, 10.) - - ax1.axis["t"] = ax1.new_floating_axis(0, 3.) - ax1.axis["t2"] = ax1.new_floating_axis(1, 7.) - ax1.grid(True) - - - import mpl_toolkits.axisartist.angle_helper as angle_helper - from matplotlib.projections import PolarAxes - from matplotlib.transforms import Affine2D - - - def curvelinear_test2(fig): - """ - polar projection, but in a rectangular box. - """ - - # PolarAxes.PolarTransform takes radian. However, we want our coordinate - # system in degree - tr = Affine2D().scale(np.pi/180., 1.) + PolarAxes.PolarTransform() - - # polar projection, which involves cycle, and also has limits in - # its coordinates, needs a special method to find the extremes - # (min, max of the coordinate within the view). - - # 20, 20 : number of sampling points along x, y direction - extreme_finder = angle_helper.ExtremeFinderCycle(20, 20, - lon_cycle=360, - lat_cycle=None, - lon_minmax=None, - lat_minmax=(0, np.inf), - ) - - grid_locator1 = angle_helper.LocatorDMS(12) - # Find a grid values appropriate for the coordinate (degree, - # minute, second). - - tick_formatter1 = angle_helper.FormatterDMS() - # And also uses an appropriate formatter. Note that,the - # acceptable Locator and Formatter class is a bit different than - # that of mpl's, and you cannot directly use mpl's Locator and - # Formatter here (but may be possible in the future). - - grid_helper = GridHelperCurveLinear(tr, - extreme_finder=extreme_finder, - grid_locator1=grid_locator1, - tick_formatter1=tick_formatter1 - ) - - ax1 = SubplotHost(fig, 1, 2, 2, grid_helper=grid_helper) - - # make ticklabels of right and top axis visible. - ax1.axis["right"].major_ticklabels.set_visible(True) - ax1.axis["top"].major_ticklabels.set_visible(True) - - # let right axis shows ticklabels for 1st coordinate (angle) - ax1.axis["right"].get_helper().nth_coord_ticks = 0 - # let bottom axis shows ticklabels for 2nd coordinate (radius) - ax1.axis["bottom"].get_helper().nth_coord_ticks = 1 - - fig.add_subplot(ax1) - - # A parasite axes with given transform - ax2 = ParasiteAxesAuxTrans(ax1, tr, "equal") - # note that ax2.transData == tr + ax1.transData - # Anthing you draw in ax2 will match the ticks and grids of ax1. - ax1.parasites.append(ax2) - intp = cbook.simple_linear_interpolation - ax2.plot(intp(np.array([0, 30]), 50), - intp(np.array([10., 10.]), 50)) - - ax1.set_aspect(1.) - ax1.set_xlim(-5, 12) - ax1.set_ylim(-5, 10) - - ax1.grid(True) - - if 1: - fig = plt.figure(1, figsize=(7, 4)) - fig.clf() - - curvelinear_test1(fig) - curvelinear_test2(fig) - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_curvelinear_grid2.rst.txt b/_sources/examples/axes_grid/demo_curvelinear_grid2.rst.txt deleted file mode 100644 index 482b0b721db..00000000000 --- a/_sources/examples/axes_grid/demo_curvelinear_grid2.rst.txt +++ /dev/null @@ -1,82 +0,0 @@ -.. _axes_grid-demo_curvelinear_grid2: - -axes_grid example code: demo_curvelinear_grid2.py -================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/axes_grid/demo_curvelinear_grid2.py - -:: - - """ - Custom grid and ticklines. - - This example demonstrates how to use GridHelperCurveLinear to define - custom grids and ticklines by applying a transformation on the grid. - As showcase on the plot, a 5x5 matrix is displayed on the axes. - """ - - import numpy as np - import matplotlib.pyplot as plt - - from mpl_toolkits.axes_grid.grid_helper_curvelinear import \ - GridHelperCurveLinear - from mpl_toolkits.axes_grid.axislines import Subplot - - import mpl_toolkits.axes_grid.angle_helper as angle_helper - - - def curvelinear_test1(fig): - """ - grid for custom transform. - """ - - def tr(x, y): - sgn = np.sign(x) - x, y = np.abs(np.asarray(x)), np.asarray(y) - return sgn*x**.5, y - - def inv_tr(x, y): - sgn = np.sign(x) - x, y = np.asarray(x), np.asarray(y) - return sgn*x**2, y - - extreme_finder = angle_helper.ExtremeFinderCycle(20, 20, - lon_cycle=None, - lat_cycle=None, - # (0, np.inf), - lon_minmax=None, - lat_minmax=None, - ) - - grid_helper = GridHelperCurveLinear((tr, inv_tr), - extreme_finder=extreme_finder) - - ax1 = Subplot(fig, 111, grid_helper=grid_helper) - # ax1 will have a ticks and gridlines defined by the given - # transform (+ transData of the Axes). Note that the transform of - # the Axes itself (i.e., transData) is not affected by the given - # transform. - - fig.add_subplot(ax1) - - ax1.imshow(np.arange(25).reshape(5, 5), - vmax=50, cmap=plt.cm.gray_r, - interpolation="nearest", - origin="lower") - - # tick density - grid_helper.grid_finder.grid_locator1._nbins = 6 - grid_helper.grid_finder.grid_locator2._nbins = 6 - - - if 1: - fig = plt.figure(1, figsize=(7, 4)) - fig.clf() - - curvelinear_test1(fig) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_curvelinear_grid2.txt b/_sources/examples/axes_grid/demo_curvelinear_grid2.txt deleted file mode 100644 index e1c5efb5621..00000000000 --- a/_sources/examples/axes_grid/demo_curvelinear_grid2.txt +++ /dev/null @@ -1,74 +0,0 @@ -.. _axes_grid-demo_curvelinear_grid2: - -axes_grid example code: demo_curvelinear_grid2.py -================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/axes_grid/demo_curvelinear_grid2.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - - from mpl_toolkits.axes_grid.grid_helper_curvelinear import \ - GridHelperCurveLinear - from mpl_toolkits.axes_grid.axislines import Subplot - - import mpl_toolkits.axes_grid.angle_helper as angle_helper - - - def curvelinear_test1(fig): - """ - grid for custom transform. - """ - - def tr(x, y): - sgn = np.sign(x) - x, y = np.abs(np.asarray(x)), np.asarray(y) - return sgn*x**.5, y - - def inv_tr(x, y): - sgn = np.sign(x) - x, y = np.asarray(x), np.asarray(y) - return sgn*x**2, y - - extreme_finder = angle_helper.ExtremeFinderCycle(20, 20, - lon_cycle=None, - lat_cycle=None, - # (0, np.inf), - lon_minmax=None, - lat_minmax=None, - ) - - grid_helper = GridHelperCurveLinear((tr, inv_tr), - extreme_finder=extreme_finder) - - ax1 = Subplot(fig, 111, grid_helper=grid_helper) - # ax1 will have a ticks and gridlines defined by the given - # transform (+ transData of the Axes). Note that the transform of - # the Axes itself (i.e., transData) is not affected by the given - # transform. - - fig.add_subplot(ax1) - - ax1.imshow(np.arange(25).reshape(5, 5), - vmax=50, cmap=plt.cm.gray_r, - interpolation="nearest", - origin="lower") - - # tick density - grid_helper.grid_finder.grid_locator1._nbins = 6 - grid_helper.grid_finder.grid_locator2._nbins = 6 - - - if 1: - fig = plt.figure(1, figsize=(7, 4)) - fig.clf() - - curvelinear_test1(fig) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_edge_colorbar.rst.txt b/_sources/examples/axes_grid/demo_edge_colorbar.rst.txt deleted file mode 100644 index ba8410b31bd..00000000000 --- a/_sources/examples/axes_grid/demo_edge_colorbar.rst.txt +++ /dev/null @@ -1,102 +0,0 @@ -.. _axes_grid-demo_edge_colorbar: - -axes_grid example code: demo_edge_colorbar.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/axes_grid/demo_edge_colorbar.py - -:: - - import matplotlib.pyplot as plt - from mpl_toolkits.axes_grid1 import AxesGrid - - - def get_demo_image(): - import numpy as np - from matplotlib.cbook import get_sample_data - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3, 4, -4, 3) - - - def demo_bottom_cbar(fig): - """ - A grid of 2x2 images with a colorbar for each column. - """ - grid = AxesGrid(fig, 121, # similar to subplot(132) - nrows_ncols=(2, 2), - axes_pad=0.10, - share_all=True, - label_mode="1", - cbar_location="bottom", - cbar_mode="edge", - cbar_pad=0.25, - cbar_size="15%", - direction="column" - ) - - Z, extent = get_demo_image() - cmaps = [plt.get_cmap("autumn"), plt.get_cmap("summer")] - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest", - cmap=cmaps[i//2]) - if i % 2: - cbar = grid.cbar_axes[i//2].colorbar(im) - - for cax in grid.cbar_axes: - cax.toggle_label(True) - cax.axis[cax.orientation].set_label("Bar") - - # This affects all axes as share_all = True. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - - - def demo_right_cbar(fig): - """ - A grid of 2x2 images. Each row has its own colorbar. - """ - - grid = AxesGrid(F, 122, # similar to subplot(122) - nrows_ncols=(2, 2), - axes_pad=0.10, - label_mode="1", - share_all=True, - cbar_location="right", - cbar_mode="edge", - cbar_size="7%", - cbar_pad="2%", - ) - Z, extent = get_demo_image() - cmaps = [plt.get_cmap("spring"), plt.get_cmap("winter")] - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest", - cmap=cmaps[i//2]) - if i % 2: - grid.cbar_axes[i//2].colorbar(im) - - for cax in grid.cbar_axes: - cax.toggle_label(True) - cax.axis[cax.orientation].set_label('Foo') - - # This affects all axes because we set share_all = True. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - - - if 1: - F = plt.figure(1, (5.5, 2.5)) - - F.subplots_adjust(left=0.05, right=0.93) - - demo_bottom_cbar(F) - demo_right_cbar(F) - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_edge_colorbar.txt b/_sources/examples/axes_grid/demo_edge_colorbar.txt deleted file mode 100644 index 1e4553ec5d0..00000000000 --- a/_sources/examples/axes_grid/demo_edge_colorbar.txt +++ /dev/null @@ -1,102 +0,0 @@ -.. _axes_grid-demo_edge_colorbar: - -axes_grid example code: demo_edge_colorbar.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/axes_grid/demo_edge_colorbar.py - -:: - - import matplotlib.pyplot as plt - from mpl_toolkits.axes_grid1 import AxesGrid - - - def get_demo_image(): - import numpy as np - from matplotlib.cbook import get_sample_data - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3, 4, -4, 3) - - - def demo_bottom_cbar(fig): - """ - A grid of 2x2 images with a colorbar for each column. - """ - grid = AxesGrid(fig, 121, # similar to subplot(132) - nrows_ncols=(2, 2), - axes_pad=0.10, - share_all=True, - label_mode="1", - cbar_location="bottom", - cbar_mode="edge", - cbar_pad=0.25, - cbar_size="15%", - direction="column" - ) - - Z, extent = get_demo_image() - cmaps = [plt.get_cmap("autumn"), plt.get_cmap("summer")] - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest", - cmap=cmaps[i//2]) - if i % 2: - cbar = grid.cbar_axes[i//2].colorbar(im) - - for cax in grid.cbar_axes: - cax.toggle_label(True) - cax.axis[cax.orientation].set_label("Bar") - - # This affects all axes as share_all = True. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - - - def demo_right_cbar(fig): - """ - A grid of 2x2 images. Each row has its own colorbar. - """ - - grid = AxesGrid(F, 122, # similar to subplot(122) - nrows_ncols=(2, 2), - axes_pad=0.10, - label_mode="1", - share_all=True, - cbar_location="right", - cbar_mode="edge", - cbar_size="7%", - cbar_pad="2%", - ) - Z, extent = get_demo_image() - cmaps = [plt.get_cmap("spring"), plt.get_cmap("winter")] - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest", - cmap=cmaps[i//2]) - if i % 2: - grid.cbar_axes[i//2].colorbar(im) - - for cax in grid.cbar_axes: - cax.toggle_label(True) - cax.axis[cax.orientation].set_label('Foo') - - # This affects all axes because we set share_all = True. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - - - if 1: - F = plt.figure(1, (5.5, 2.5)) - - F.subplots_adjust(left=0.05, right=0.93) - - demo_bottom_cbar(F) - demo_right_cbar(F) - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_floating_axes.rst.txt b/_sources/examples/axes_grid/demo_floating_axes.rst.txt deleted file mode 100644 index 62a8a413f9e..00000000000 --- a/_sources/examples/axes_grid/demo_floating_axes.rst.txt +++ /dev/null @@ -1,168 +0,0 @@ -.. _axes_grid-demo_floating_axes: - -axes_grid example code: demo_floating_axes.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/axes_grid/demo_floating_axes.py - -:: - - """ - Demo of the floating axes. - - This demo shows features of functions in floating_axes: - * Using scatter function and bar function with changing the - shape of the plot. - * Using GridHelperCurveLinear to rotate the plot and set the - boundary of the plot. - * Using FloatingSubplot to create a subplot using the return - value from GridHelperCurveLinear. - * Making sector plot by adding more features to GridHelperCurveLinear. - """ - from matplotlib.transforms import Affine2D - import mpl_toolkits.axisartist.floating_axes as floating_axes - import numpy as np - import mpl_toolkits.axisartist.angle_helper as angle_helper - from matplotlib.projections import PolarAxes - from mpl_toolkits.axisartist.grid_finder import (FixedLocator, MaxNLocator, - DictFormatter) - import matplotlib.pyplot as plt - - - def setup_axes1(fig, rect): - """ - A simple one. - """ - tr = Affine2D().scale(2, 1).rotate_deg(30) - - grid_helper = floating_axes.GridHelperCurveLinear( - tr, extremes=(-0.5, 3.5, 0, 4)) - - ax1 = floating_axes.FloatingSubplot(fig, rect, grid_helper=grid_helper) - fig.add_subplot(ax1) - - aux_ax = ax1.get_aux_axes(tr) - - grid_helper.grid_finder.grid_locator1._nbins = 4 - grid_helper.grid_finder.grid_locator2._nbins = 4 - - return ax1, aux_ax - - - def setup_axes2(fig, rect): - """ - With custom locator and formatter. - Note that the extreme values are swapped. - """ - tr = PolarAxes.PolarTransform() - - pi = np.pi - angle_ticks = [(0, r"$0$"), - (.25*pi, r"$\frac{1}{4}\pi$"), - (.5*pi, r"$\frac{1}{2}\pi$")] - grid_locator1 = FixedLocator([v for v, s in angle_ticks]) - tick_formatter1 = DictFormatter(dict(angle_ticks)) - - grid_locator2 = MaxNLocator(2) - - grid_helper = floating_axes.GridHelperCurveLinear( - tr, extremes=(.5*pi, 0, 2, 1), - grid_locator1=grid_locator1, - grid_locator2=grid_locator2, - tick_formatter1=tick_formatter1, - tick_formatter2=None) - - ax1 = floating_axes.FloatingSubplot(fig, rect, grid_helper=grid_helper) - fig.add_subplot(ax1) - - # create a parasite axes whose transData in RA, cz - aux_ax = ax1.get_aux_axes(tr) - - aux_ax.patch = ax1.patch # for aux_ax to have a clip path as in ax - ax1.patch.zorder = 0.9 # but this has a side effect that the patch is - # drawn twice, and possibly over some other - # artists. So, we decrease the zorder a bit to - # prevent this. - - return ax1, aux_ax - - - def setup_axes3(fig, rect): - """ - Sometimes, things like axis_direction need to be adjusted. - """ - - # rotate a bit for better orientation - tr_rotate = Affine2D().translate(-95, 0) - - # scale degree to radians - tr_scale = Affine2D().scale(np.pi/180., 1.) - - tr = tr_rotate + tr_scale + PolarAxes.PolarTransform() - - grid_locator1 = angle_helper.LocatorHMS(4) - tick_formatter1 = angle_helper.FormatterHMS() - - grid_locator2 = MaxNLocator(3) - - ra0, ra1 = 8.*15, 14.*15 - cz0, cz1 = 0, 14000 - grid_helper = floating_axes.GridHelperCurveLinear( - tr, extremes=(ra0, ra1, cz0, cz1), - grid_locator1=grid_locator1, - grid_locator2=grid_locator2, - tick_formatter1=tick_formatter1, - tick_formatter2=None) - - ax1 = floating_axes.FloatingSubplot(fig, rect, grid_helper=grid_helper) - fig.add_subplot(ax1) - - # adjust axis - ax1.axis["left"].set_axis_direction("bottom") - ax1.axis["right"].set_axis_direction("top") - - ax1.axis["bottom"].set_visible(False) - ax1.axis["top"].set_axis_direction("bottom") - ax1.axis["top"].toggle(ticklabels=True, label=True) - ax1.axis["top"].major_ticklabels.set_axis_direction("top") - ax1.axis["top"].label.set_axis_direction("top") - - ax1.axis["left"].label.set_text(r"cz [km$^{-1}$]") - ax1.axis["top"].label.set_text(r"$\alpha_{1950}$") - - # create a parasite axes whose transData in RA, cz - aux_ax = ax1.get_aux_axes(tr) - - aux_ax.patch = ax1.patch # for aux_ax to have a clip path as in ax - ax1.patch.zorder = 0.9 # but this has a side effect that the patch is - # drawn twice, and possibly over some other - # artists. So, we decrease the zorder a bit to - # prevent this. - - return ax1, aux_ax - - - ########################################################## - fig = plt.figure(1, figsize=(8, 4)) - fig.subplots_adjust(wspace=0.3, left=0.05, right=0.95) - - ax1, aux_ax1 = setup_axes1(fig, 131) - aux_ax1.bar([0, 1, 2, 3], [3, 2, 1, 3]) - - ax2, aux_ax2 = setup_axes2(fig, 132) - theta = np.random.rand(10)*.5*np.pi - radius = np.random.rand(10) + 1. - aux_ax2.scatter(theta, radius) - - ax3, aux_ax3 = setup_axes3(fig, 133) - - theta = (8 + np.random.rand(10)*(14 - 8))*15. # in degrees - radius = np.random.rand(10)*14000. - aux_ax3.scatter(theta, radius) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_floating_axes.txt b/_sources/examples/axes_grid/demo_floating_axes.txt deleted file mode 100644 index 40d2736b6ae..00000000000 --- a/_sources/examples/axes_grid/demo_floating_axes.txt +++ /dev/null @@ -1,156 +0,0 @@ -.. _axes_grid-demo_floating_axes: - -axes_grid example code: demo_floating_axes.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/axes_grid/demo_floating_axes.py - -:: - - from matplotlib.transforms import Affine2D - import mpl_toolkits.axisartist.floating_axes as floating_axes - import numpy as np - import mpl_toolkits.axisartist.angle_helper as angle_helper - from matplotlib.projections import PolarAxes - from mpl_toolkits.axisartist.grid_finder import (FixedLocator, MaxNLocator, - DictFormatter) - import matplotlib.pyplot as plt - - - def setup_axes1(fig, rect): - """ - A simple one. - """ - tr = Affine2D().scale(2, 1).rotate_deg(30) - - grid_helper = floating_axes.GridHelperCurveLinear( - tr, extremes=(0, 4, 0, 4)) - - ax1 = floating_axes.FloatingSubplot(fig, rect, grid_helper=grid_helper) - fig.add_subplot(ax1) - - aux_ax = ax1.get_aux_axes(tr) - - grid_helper.grid_finder.grid_locator1._nbins = 4 - grid_helper.grid_finder.grid_locator2._nbins = 4 - - return ax1, aux_ax - - - def setup_axes2(fig, rect): - """ - With custom locator and formatter. - Note that the extreme values are swapped. - """ - tr = PolarAxes.PolarTransform() - - pi = np.pi - angle_ticks = [(0, r"$0$"), - (.25*pi, r"$\frac{1}{4}\pi$"), - (.5*pi, r"$\frac{1}{2}\pi$")] - grid_locator1 = FixedLocator([v for v, s in angle_ticks]) - tick_formatter1 = DictFormatter(dict(angle_ticks)) - - grid_locator2 = MaxNLocator(2) - - grid_helper = floating_axes.GridHelperCurveLinear( - tr, extremes=(.5*pi, 0, 2, 1), - grid_locator1=grid_locator1, - grid_locator2=grid_locator2, - tick_formatter1=tick_formatter1, - tick_formatter2=None) - - ax1 = floating_axes.FloatingSubplot(fig, rect, grid_helper=grid_helper) - fig.add_subplot(ax1) - - # create a parasite axes whose transData in RA, cz - aux_ax = ax1.get_aux_axes(tr) - - aux_ax.patch = ax1.patch # for aux_ax to have a clip path as in ax - ax1.patch.zorder = 0.9 # but this has a side effect that the patch is - # drawn twice, and possibly over some other - # artists. So, we decrease the zorder a bit to - # prevent this. - - return ax1, aux_ax - - - def setup_axes3(fig, rect): - """ - Sometimes, things like axis_direction need to be adjusted. - """ - - # rotate a bit for better orientation - tr_rotate = Affine2D().translate(-95, 0) - - # scale degree to radians - tr_scale = Affine2D().scale(np.pi/180., 1.) - - tr = tr_rotate + tr_scale + PolarAxes.PolarTransform() - - grid_locator1 = angle_helper.LocatorHMS(4) - tick_formatter1 = angle_helper.FormatterHMS() - - grid_locator2 = MaxNLocator(3) - - ra0, ra1 = 8.*15, 14.*15 - cz0, cz1 = 0, 14000 - grid_helper = floating_axes.GridHelperCurveLinear( - tr, extremes=(ra0, ra1, cz0, cz1), - grid_locator1=grid_locator1, - grid_locator2=grid_locator2, - tick_formatter1=tick_formatter1, - tick_formatter2=None) - - ax1 = floating_axes.FloatingSubplot(fig, rect, grid_helper=grid_helper) - fig.add_subplot(ax1) - - # adjust axis - ax1.axis["left"].set_axis_direction("bottom") - ax1.axis["right"].set_axis_direction("top") - - ax1.axis["bottom"].set_visible(False) - ax1.axis["top"].set_axis_direction("bottom") - ax1.axis["top"].toggle(ticklabels=True, label=True) - ax1.axis["top"].major_ticklabels.set_axis_direction("top") - ax1.axis["top"].label.set_axis_direction("top") - - ax1.axis["left"].label.set_text(r"cz [km$^{-1}$]") - ax1.axis["top"].label.set_text(r"$\alpha_{1950}$") - - # create a parasite axes whose transData in RA, cz - aux_ax = ax1.get_aux_axes(tr) - - aux_ax.patch = ax1.patch # for aux_ax to have a clip path as in ax - ax1.patch.zorder = 0.9 # but this has a side effect that the patch is - # drawn twice, and possibly over some other - # artists. So, we decrease the zorder a bit to - # prevent this. - - return ax1, aux_ax - - - ########################################################## - fig = plt.figure(1, figsize=(8, 4)) - fig.subplots_adjust(wspace=0.3, left=0.05, right=0.95) - - ax1, aux_ax1 = setup_axes1(fig, 131) - aux_ax1.bar([0, 1, 2, 3], [3, 2, 1, 3]) - - ax2, aux_ax2 = setup_axes2(fig, 132) - theta = np.random.rand(10)*.5*np.pi - radius = np.random.rand(10) + 1. - aux_ax2.scatter(theta, radius) - - ax3, aux_ax3 = setup_axes3(fig, 133) - - theta = (8 + np.random.rand(10)*(14 - 8))*15. # in degrees - radius = np.random.rand(10)*14000. - aux_ax3.scatter(theta, radius) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_floating_axis.rst.txt b/_sources/examples/axes_grid/demo_floating_axis.rst.txt deleted file mode 100644 index 08fb628c04f..00000000000 --- a/_sources/examples/axes_grid/demo_floating_axis.rst.txt +++ /dev/null @@ -1,84 +0,0 @@ -.. _axes_grid-demo_floating_axis: - -axes_grid example code: demo_floating_axis.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/axes_grid/demo_floating_axis.py - -:: - - """ - Axis within rectangular frame - - The following code demonstrates how to put a floating polar curve within a - rectangular box. In order to get a better sense of polar curves, please look at - demo_curvelinear_grid.py. - """ - import numpy as np - import matplotlib.pyplot as plt - import mpl_toolkits.axisartist.angle_helper as angle_helper - from matplotlib.projections import PolarAxes - from matplotlib.transforms import Affine2D - from mpl_toolkits.axisartist import SubplotHost - from mpl_toolkits.axisartist import GridHelperCurveLinear - - - def curvelinear_test2(fig): - """ - polar projection, but in a rectangular box. - """ - global ax1 - # see demo_curvelinear_grid.py for details - tr = Affine2D().scale(np.pi / 180., 1.) + PolarAxes.PolarTransform() - - extreme_finder = angle_helper.ExtremeFinderCycle(20, - 20, - lon_cycle=360, - lat_cycle=None, - lon_minmax=None, - lat_minmax=(0, - np.inf), - ) - - grid_locator1 = angle_helper.LocatorDMS(12) - - tick_formatter1 = angle_helper.FormatterDMS() - - grid_helper = GridHelperCurveLinear(tr, - extreme_finder=extreme_finder, - grid_locator1=grid_locator1, - tick_formatter1=tick_formatter1 - ) - - ax1 = SubplotHost(fig, 1, 1, 1, grid_helper=grid_helper) - - fig.add_subplot(ax1) - - # Now creates floating axis - - # floating axis whose first coordinate (theta) is fixed at 60 - ax1.axis["lat"] = axis = ax1.new_floating_axis(0, 60) - axis.label.set_text(r"$\theta = 60^{\circ}$") - axis.label.set_visible(True) - - # floating axis whose second coordinate (r) is fixed at 6 - ax1.axis["lon"] = axis = ax1.new_floating_axis(1, 6) - axis.label.set_text(r"$r = 6$") - - ax1.set_aspect(1.) - ax1.set_xlim(-5, 12) - ax1.set_ylim(-5, 10) - - ax1.grid(True) - - fig = plt.figure(1, figsize=(5, 5)) - fig.clf() - - curvelinear_test2(fig) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_floating_axis.txt b/_sources/examples/axes_grid/demo_floating_axis.txt deleted file mode 100644 index 25b454f79ce..00000000000 --- a/_sources/examples/axes_grid/demo_floating_axis.txt +++ /dev/null @@ -1,82 +0,0 @@ -.. _axes_grid-demo_floating_axis: - -axes_grid example code: demo_floating_axis.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/axes_grid/demo_floating_axis.py - -:: - - """ - An experimental support for curvilinear grid. - """ - - - def curvelinear_test2(fig): - """ - polar projection, but in a rectangular box. - """ - global ax1 - import numpy as np - import mpl_toolkits.axisartist.angle_helper as angle_helper - from matplotlib.projections import PolarAxes - from matplotlib.transforms import Affine2D - - from mpl_toolkits.axisartist import SubplotHost - - from mpl_toolkits.axisartist import GridHelperCurveLinear - - # see demo_curvelinear_grid.py for details - tr = Affine2D().scale(np.pi/180., 1.) + PolarAxes.PolarTransform() - - extreme_finder = angle_helper.ExtremeFinderCycle(20, 20, - lon_cycle=360, - lat_cycle=None, - lon_minmax=None, - lat_minmax=(0, np.inf), - ) - - grid_locator1 = angle_helper.LocatorDMS(12) - - tick_formatter1 = angle_helper.FormatterDMS() - - grid_helper = GridHelperCurveLinear(tr, - extreme_finder=extreme_finder, - grid_locator1=grid_locator1, - tick_formatter1=tick_formatter1 - ) - - ax1 = SubplotHost(fig, 1, 1, 1, grid_helper=grid_helper) - - fig.add_subplot(ax1) - - # Now creates floating axis - - #grid_helper = ax1.get_grid_helper() - # floating axis whose first coordinate (theta) is fixed at 60 - ax1.axis["lat"] = axis = ax1.new_floating_axis(0, 60) - axis.label.set_text(r"$\theta = 60^{\circ}$") - axis.label.set_visible(True) - - # floating axis whose second coordinate (r) is fixed at 6 - ax1.axis["lon"] = axis = ax1.new_floating_axis(1, 6) - axis.label.set_text(r"$r = 6$") - - ax1.set_aspect(1.) - ax1.set_xlim(-5, 12) - ax1.set_ylim(-5, 10) - - ax1.grid(True) - - import matplotlib.pyplot as plt - fig = plt.figure(1, figsize=(5, 5)) - fig.clf() - - curvelinear_test2(fig) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_imagegrid_aspect.rst.txt b/_sources/examples/axes_grid/demo_imagegrid_aspect.rst.txt deleted file mode 100644 index 73db4844828..00000000000 --- a/_sources/examples/axes_grid/demo_imagegrid_aspect.rst.txt +++ /dev/null @@ -1,34 +0,0 @@ -.. _axes_grid-demo_imagegrid_aspect: - -axes_grid example code: demo_imagegrid_aspect.py -================================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/axes_grid/demo_imagegrid_aspect.py - -:: - - import matplotlib.pyplot as plt - - from mpl_toolkits.axes_grid1 import ImageGrid - fig = plt.figure(1) - - grid1 = ImageGrid(fig, 121, (2, 2), axes_pad=0.1, - aspect=True, share_all=True) - - for i in [0, 1]: - grid1[i].set_aspect(2) - - - grid2 = ImageGrid(fig, 122, (2, 2), axes_pad=0.1, - aspect=True, share_all=True) - - - for i in [1, 3]: - grid2[i].set_aspect(2) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_imagegrid_aspect.txt b/_sources/examples/axes_grid/demo_imagegrid_aspect.txt deleted file mode 100644 index 84cf6178406..00000000000 --- a/_sources/examples/axes_grid/demo_imagegrid_aspect.txt +++ /dev/null @@ -1,34 +0,0 @@ -.. _axes_grid-demo_imagegrid_aspect: - -axes_grid example code: demo_imagegrid_aspect.py -================================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/axes_grid/demo_imagegrid_aspect.py - -:: - - import matplotlib.pyplot as plt - - from mpl_toolkits.axes_grid1 import ImageGrid - fig = plt.figure(1) - - grid1 = ImageGrid(fig, 121, (2, 2), axes_pad=0.1, - aspect=True, share_all=True) - - for i in [0, 1]: - grid1[i].set_aspect(2) - - - grid2 = ImageGrid(fig, 122, (2, 2), axes_pad=0.1, - aspect=True, share_all=True) - - - for i in [1, 3]: - grid2[i].set_aspect(2) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_parasite_axes2.rst.txt b/_sources/examples/axes_grid/demo_parasite_axes2.rst.txt deleted file mode 100644 index 9d40847cb3a..00000000000 --- a/_sources/examples/axes_grid/demo_parasite_axes2.rst.txt +++ /dev/null @@ -1,65 +0,0 @@ -.. _axes_grid-demo_parasite_axes2: - -axes_grid example code: demo_parasite_axes2.py -============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/axes_grid/demo_parasite_axes2.py - -:: - - """ - Parasite axis demo - - The following code is an example of a parasite axis. It aims to show a user how - to plot multiple different values onto one single plot. Notice how in this - example, par1 and par2 are both calling twinx meaning both are tied directly to - the x-axis. From there, each of those two axis can behave separately from the - each other, meaning they can take on separate values from themselves as well as - the x-axis. - """ - from mpl_toolkits.axes_grid1 import host_subplot - import mpl_toolkits.axisartist as AA - import matplotlib.pyplot as plt - - host = host_subplot(111, axes_class=AA.Axes) - plt.subplots_adjust(right=0.75) - - par1 = host.twinx() - par2 = host.twinx() - - offset = 60 - new_fixed_axis = par2.get_grid_helper().new_fixed_axis - par2.axis["right"] = new_fixed_axis(loc="right", - axes=par2, - offset=(offset, 0)) - - par2.axis["right"].toggle(all=True) - - host.set_xlim(0, 2) - host.set_ylim(0, 2) - - host.set_xlabel("Distance") - host.set_ylabel("Density") - par1.set_ylabel("Temperature") - par2.set_ylabel("Velocity") - - p1, = host.plot([0, 1, 2], [0, 1, 2], label="Density") - p2, = par1.plot([0, 1, 2], [0, 3, 2], label="Temperature") - p3, = par2.plot([0, 1, 2], [50, 30, 15], label="Velocity") - - par1.set_ylim(0, 4) - par2.set_ylim(1, 65) - - host.legend() - - host.axis["left"].label.set_color(p1.get_color()) - par1.axis["right"].label.set_color(p2.get_color()) - par2.axis["right"].label.set_color(p3.get_color()) - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/demo_parasite_axes2.txt b/_sources/examples/axes_grid/demo_parasite_axes2.txt deleted file mode 100644 index 2e5ed0ef6ef..00000000000 --- a/_sources/examples/axes_grid/demo_parasite_axes2.txt +++ /dev/null @@ -1,59 +0,0 @@ -.. _axes_grid-demo_parasite_axes2: - -axes_grid example code: demo_parasite_axes2.py -============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/axes_grid/demo_parasite_axes2.py - -:: - - from mpl_toolkits.axes_grid1 import host_subplot - import mpl_toolkits.axisartist as AA - import matplotlib.pyplot as plt - - if 1: - - host = host_subplot(111, axes_class=AA.Axes) - plt.subplots_adjust(right=0.75) - - par1 = host.twinx() - par2 = host.twinx() - - offset = 60 - new_fixed_axis = par2.get_grid_helper().new_fixed_axis - par2.axis["right"] = new_fixed_axis(loc="right", - axes=par2, - offset=(offset, 0)) - - par2.axis["right"].toggle(all=True) - - host.set_xlim(0, 2) - host.set_ylim(0, 2) - - host.set_xlabel("Distance") - host.set_ylabel("Density") - par1.set_ylabel("Temperature") - par2.set_ylabel("Velocity") - - p1, = host.plot([0, 1, 2], [0, 1, 2], label="Density") - p2, = par1.plot([0, 1, 2], [0, 3, 2], label="Temperature") - p3, = par2.plot([0, 1, 2], [50, 30, 15], label="Velocity") - - par1.set_ylim(0, 4) - par2.set_ylim(1, 65) - - host.legend() - - host.axis["left"].label.set_color(p1.get_color()) - par1.axis["right"].label.set_color(p2.get_color()) - par2.axis["right"].label.set_color(p3.get_color()) - - plt.draw() - plt.show() - - #plt.savefig("Test") - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/index.rst.txt b/_sources/examples/axes_grid/index.rst.txt deleted file mode 100644 index ee9a7c36c76..00000000000 --- a/_sources/examples/axes_grid/index.rst.txt +++ /dev/null @@ -1,37 +0,0 @@ -.. _axes_grid-examples-index: - -############################################## -axes_grid Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - demo_axes_divider - demo_axes_grid - demo_axes_grid2 - demo_axes_hbox_divider - demo_axes_rgb - demo_axisline_style - demo_colorbar_with_inset_locator - demo_curvelinear_grid - demo_curvelinear_grid2 - demo_edge_colorbar - demo_floating_axes - demo_floating_axis - demo_imagegrid_aspect - demo_parasite_axes2 - inset_locator_demo - inset_locator_demo2 - make_room_for_ylabel_using_axesgrid - parasite_simple2 - scatter_hist - simple_anchored_artists - simple_axesgrid - simple_axesgrid2 - simple_axisline4 diff --git a/_sources/examples/axes_grid/index.txt b/_sources/examples/axes_grid/index.txt deleted file mode 100644 index ee9a7c36c76..00000000000 --- a/_sources/examples/axes_grid/index.txt +++ /dev/null @@ -1,37 +0,0 @@ -.. _axes_grid-examples-index: - -############################################## -axes_grid Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - demo_axes_divider - demo_axes_grid - demo_axes_grid2 - demo_axes_hbox_divider - demo_axes_rgb - demo_axisline_style - demo_colorbar_with_inset_locator - demo_curvelinear_grid - demo_curvelinear_grid2 - demo_edge_colorbar - demo_floating_axes - demo_floating_axis - demo_imagegrid_aspect - demo_parasite_axes2 - inset_locator_demo - inset_locator_demo2 - make_room_for_ylabel_using_axesgrid - parasite_simple2 - scatter_hist - simple_anchored_artists - simple_axesgrid - simple_axesgrid2 - simple_axisline4 diff --git a/_sources/examples/axes_grid/inset_locator_demo.rst.txt b/_sources/examples/axes_grid/inset_locator_demo.rst.txt deleted file mode 100644 index 3cfd2f59f79..00000000000 --- a/_sources/examples/axes_grid/inset_locator_demo.rst.txt +++ /dev/null @@ -1,60 +0,0 @@ -.. _axes_grid-inset_locator_demo: - -axes_grid example code: inset_locator_demo.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/axes_grid/inset_locator_demo.py - -:: - - import matplotlib.pyplot as plt - - from mpl_toolkits.axes_grid1.inset_locator import inset_axes, zoomed_inset_axes - from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar - - - def add_sizebar(ax, size): - asb = AnchoredSizeBar(ax.transData, - size, - str(size), - loc=8, - pad=0.1, borderpad=0.5, sep=5, - frameon=False) - ax.add_artist(asb) - - - fig, (ax, ax2) = plt.subplots(1, 2, figsize=[5.5, 3]) - - # first subplot - ax.set_aspect(1.) - - axins = inset_axes(ax, - width="30%", # width = 30% of parent_bbox - height=1., # height : 1 inch - loc=3) - - plt.xticks(visible=False) - plt.yticks(visible=False) - - - # second subplot - ax2.set_aspect(1.) - - axins = zoomed_inset_axes(ax2, 0.5, loc=1) # zoom = 0.5 - # fix the number of ticks on the inset axes - axins.yaxis.get_major_locator().set_params(nbins=7) - axins.xaxis.get_major_locator().set_params(nbins=7) - - plt.xticks(visible=False) - plt.yticks(visible=False) - - add_sizebar(ax2, 0.5) - add_sizebar(axins, 0.5) - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/inset_locator_demo.txt b/_sources/examples/axes_grid/inset_locator_demo.txt deleted file mode 100644 index c0699b425af..00000000000 --- a/_sources/examples/axes_grid/inset_locator_demo.txt +++ /dev/null @@ -1,57 +0,0 @@ -.. _axes_grid-inset_locator_demo: - -axes_grid example code: inset_locator_demo.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/axes_grid/inset_locator_demo.py - -:: - - import matplotlib.pyplot as plt - - from mpl_toolkits.axes_grid1.inset_locator import inset_axes, zoomed_inset_axes - from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar - - - def add_sizebar(ax, size): - asb = AnchoredSizeBar(ax.transData, - size, - str(size), - loc=8, - pad=0.1, borderpad=0.5, sep=5, - frameon=False) - ax.add_artist(asb) - - - fig, (ax, ax2) = plt.subplots(1, 2, figsize=[5.5, 3]) - - # first subplot - ax.set_aspect(1.) - - axins = inset_axes(ax, - width="30%", # width = 30% of parent_bbox - height=1., # height : 1 inch - loc=3) - - plt.xticks(visible=False) - plt.yticks(visible=False) - - - # second subplot - ax2.set_aspect(1.) - - axins = zoomed_inset_axes(ax2, 0.5, loc=1) # zoom = 0.5 - - plt.xticks(visible=False) - plt.yticks(visible=False) - - add_sizebar(ax2, 0.5) - add_sizebar(axins, 0.5) - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/inset_locator_demo2.rst.txt b/_sources/examples/axes_grid/inset_locator_demo2.rst.txt deleted file mode 100644 index 9f8399414ef..00000000000 --- a/_sources/examples/axes_grid/inset_locator_demo2.rst.txt +++ /dev/null @@ -1,63 +0,0 @@ -.. _axes_grid-inset_locator_demo2: - -axes_grid example code: inset_locator_demo2.py -============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/axes_grid/inset_locator_demo2.py - -:: - - import matplotlib.pyplot as plt - - from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes - from mpl_toolkits.axes_grid1.inset_locator import mark_inset - - import numpy as np - - - def get_demo_image(): - from matplotlib.cbook import get_sample_data - import numpy as np - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3, 4, -4, 3) - - fig, ax = plt.subplots(figsize=[5, 4]) - - # prepare the demo image - Z, extent = get_demo_image() - Z2 = np.zeros([150, 150], dtype="d") - ny, nx = Z.shape - Z2[30:30 + ny, 30:30 + nx] = Z - - # extent = [-3, 4, -4, 3] - ax.imshow(Z2, extent=extent, interpolation="nearest", - origin="lower") - - axins = zoomed_inset_axes(ax, 6, loc=1) # zoom = 6 - axins.imshow(Z2, extent=extent, interpolation="nearest", - origin="lower") - - # sub region of the original image - x1, x2, y1, y2 = -1.5, -0.9, -2.5, -1.9 - axins.set_xlim(x1, x2) - axins.set_ylim(y1, y2) - # fix the number of ticks on the inset axes - axins.yaxis.get_major_locator().set_params(nbins=7) - axins.xaxis.get_major_locator().set_params(nbins=7) - - plt.xticks(visible=False) - plt.yticks(visible=False) - - # draw a bbox of the region of the inset axes in the parent axes and - # connecting lines between the bbox and the inset axes area - mark_inset(ax, axins, loc1=2, loc2=4, fc="none", ec="0.5") - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/inset_locator_demo2.txt b/_sources/examples/axes_grid/inset_locator_demo2.txt deleted file mode 100644 index 5a5dc93f020..00000000000 --- a/_sources/examples/axes_grid/inset_locator_demo2.txt +++ /dev/null @@ -1,60 +0,0 @@ -.. _axes_grid-inset_locator_demo2: - -axes_grid example code: inset_locator_demo2.py -============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/axes_grid/inset_locator_demo2.py - -:: - - import matplotlib.pyplot as plt - - from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes - from mpl_toolkits.axes_grid1.inset_locator import mark_inset - - import numpy as np - - - def get_demo_image(): - from matplotlib.cbook import get_sample_data - import numpy as np - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3, 4, -4, 3) - - fig, ax = plt.subplots(figsize=[5, 4]) - - # prepare the demo image - Z, extent = get_demo_image() - Z2 = np.zeros([150, 150], dtype="d") - ny, nx = Z.shape - Z2[30:30 + ny, 30:30 + nx] = Z - - # extent = [-3, 4, -4, 3] - ax.imshow(Z2, extent=extent, interpolation="nearest", - origin="lower") - - axins = zoomed_inset_axes(ax, 6, loc=1) # zoom = 6 - axins.imshow(Z2, extent=extent, interpolation="nearest", - origin="lower") - - # sub region of the original image - x1, x2, y1, y2 = -1.5, -0.9, -2.5, -1.9 - axins.set_xlim(x1, x2) - axins.set_ylim(y1, y2) - - plt.xticks(visible=False) - plt.yticks(visible=False) - - # draw a bbox of the region of the inset axes in the parent axes and - # connecting lines between the bbox and the inset axes area - mark_inset(ax, axins, loc1=2, loc2=4, fc="none", ec="0.5") - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/make_room_for_ylabel_using_axesgrid.rst.txt b/_sources/examples/axes_grid/make_room_for_ylabel_using_axesgrid.rst.txt deleted file mode 100644 index 9c367b5140a..00000000000 --- a/_sources/examples/axes_grid/make_room_for_ylabel_using_axesgrid.rst.txt +++ /dev/null @@ -1,75 +0,0 @@ -.. _axes_grid-make_room_for_ylabel_using_axesgrid: - -axes_grid example code: make_room_for_ylabel_using_axesgrid.py -============================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid.py - -:: - - from mpl_toolkits.axes_grid1 import make_axes_locatable - from mpl_toolkits.axes_grid1.axes_divider import make_axes_area_auto_adjustable - - - if __name__ == "__main__": - - import matplotlib.pyplot as plt - - def ex1(): - plt.figure(1) - ax = plt.axes([0, 0, 1, 1]) - #ax = plt.subplot(111) - - ax.set_yticks([0.5]) - ax.set_yticklabels(["very long label"]) - - make_axes_area_auto_adjustable(ax) - - def ex2(): - - plt.figure(2) - ax1 = plt.axes([0, 0, 1, 0.5]) - ax2 = plt.axes([0, 0.5, 1, 0.5]) - - ax1.set_yticks([0.5]) - ax1.set_yticklabels(["very long label"]) - ax1.set_ylabel("Y label") - - ax2.set_title("Title") - - make_axes_area_auto_adjustable(ax1, pad=0.1, use_axes=[ax1, ax2]) - make_axes_area_auto_adjustable(ax2, pad=0.1, use_axes=[ax1, ax2]) - - def ex3(): - - fig = plt.figure(3) - ax1 = plt.axes([0, 0, 1, 1]) - divider = make_axes_locatable(ax1) - - ax2 = divider.new_horizontal("100%", pad=0.3, sharey=ax1) - ax2.tick_params(labelleft="off") - fig.add_axes(ax2) - - divider.add_auto_adjustable_area(use_axes=[ax1], pad=0.1, - adjust_dirs=["left"]) - divider.add_auto_adjustable_area(use_axes=[ax2], pad=0.1, - adjust_dirs=["right"]) - divider.add_auto_adjustable_area(use_axes=[ax1, ax2], pad=0.1, - adjust_dirs=["top", "bottom"]) - - ax1.set_yticks([0.5]) - ax1.set_yticklabels(["very long label"]) - - ax2.set_title("Title") - ax2.set_xlabel("X - Label") - - ex1() - ex2() - ex3() - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/make_room_for_ylabel_using_axesgrid.txt b/_sources/examples/axes_grid/make_room_for_ylabel_using_axesgrid.txt deleted file mode 100644 index 3a06654cbc0..00000000000 --- a/_sources/examples/axes_grid/make_room_for_ylabel_using_axesgrid.txt +++ /dev/null @@ -1,75 +0,0 @@ -.. _axes_grid-make_room_for_ylabel_using_axesgrid: - -axes_grid example code: make_room_for_ylabel_using_axesgrid.py -============================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid.py - -:: - - from mpl_toolkits.axes_grid1 import make_axes_locatable - from mpl_toolkits.axes_grid1.axes_divider import make_axes_area_auto_adjustable - - - if __name__ == "__main__": - - import matplotlib.pyplot as plt - - def ex1(): - plt.figure(1) - ax = plt.axes([0, 0, 1, 1]) - #ax = plt.subplot(111) - - ax.set_yticks([0.5]) - ax.set_yticklabels(["very long label"]) - - make_axes_area_auto_adjustable(ax) - - def ex2(): - - plt.figure(2) - ax1 = plt.axes([0, 0, 1, 0.5]) - ax2 = plt.axes([0, 0.5, 1, 0.5]) - - ax1.set_yticks([0.5]) - ax1.set_yticklabels(["very long label"]) - ax1.set_ylabel("Y label") - - ax2.set_title("Title") - - make_axes_area_auto_adjustable(ax1, pad=0.1, use_axes=[ax1, ax2]) - make_axes_area_auto_adjustable(ax2, pad=0.1, use_axes=[ax1, ax2]) - - def ex3(): - - fig = plt.figure(3) - ax1 = plt.axes([0, 0, 1, 1]) - divider = make_axes_locatable(ax1) - - ax2 = divider.new_horizontal("100%", pad=0.3, sharey=ax1) - ax2.tick_params(labelleft="off") - fig.add_axes(ax2) - - divider.add_auto_adjustable_area(use_axes=[ax1], pad=0.1, - adjust_dirs=["left"]) - divider.add_auto_adjustable_area(use_axes=[ax2], pad=0.1, - adjust_dirs=["right"]) - divider.add_auto_adjustable_area(use_axes=[ax1, ax2], pad=0.1, - adjust_dirs=["top", "bottom"]) - - ax1.set_yticks([0.5]) - ax1.set_yticklabels(["very long label"]) - - ax2.set_title("Title") - ax2.set_xlabel("X - Label") - - ex1() - ex2() - ex3() - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/parasite_simple2.rst.txt b/_sources/examples/axes_grid/parasite_simple2.rst.txt deleted file mode 100644 index 281cbf280cf..00000000000 --- a/_sources/examples/axes_grid/parasite_simple2.rst.txt +++ /dev/null @@ -1,56 +0,0 @@ -.. _axes_grid-parasite_simple2: - -axes_grid example code: parasite_simple2.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/axes_grid/parasite_simple2.py - -:: - - import matplotlib.transforms as mtransforms - import matplotlib.pyplot as plt - from mpl_toolkits.axes_grid1.parasite_axes import SubplotHost - - obs = [["01_S1", 3.88, 0.14, 1970, 63], - ["01_S4", 5.6, 0.82, 1622, 150], - ["02_S1", 2.4, 0.54, 1570, 40], - ["03_S1", 4.1, 0.62, 2380, 170]] - - - fig = plt.figure() - - ax_kms = SubplotHost(fig, 1, 1, 1, aspect=1.) - - # angular proper motion("/yr) to linear velocity(km/s) at distance=2.3kpc - pm_to_kms = 1./206265.*2300*3.085e18/3.15e7/1.e5 - - aux_trans = mtransforms.Affine2D().scale(pm_to_kms, 1.) - ax_pm = ax_kms.twin(aux_trans) - ax_pm.set_viewlim_mode("transform") - - fig.add_subplot(ax_kms) - - for n, ds, dse, w, we in obs: - time = ((2007 + (10. + 4/30.)/12) - 1988.5) - v = ds / time * pm_to_kms - ve = dse / time * pm_to_kms - ax_kms.errorbar([v], [w], xerr=[ve], yerr=[we], color="k") - - - ax_kms.axis["bottom"].set_label("Linear velocity at 2.3 kpc [km/s]") - ax_kms.axis["left"].set_label("FWHM [km/s]") - ax_pm.axis["top"].set_label(r"Proper Motion [$''$/yr]") - ax_pm.axis["top"].label.set_visible(True) - ax_pm.axis["right"].major_ticklabels.set_visible(False) - - ax_kms.set_xlim(950, 3700) - ax_kms.set_ylim(950, 3100) - # xlim and ylim of ax_pms will be automatically adjusted. - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/parasite_simple2.txt b/_sources/examples/axes_grid/parasite_simple2.txt deleted file mode 100644 index 44e52c4a162..00000000000 --- a/_sources/examples/axes_grid/parasite_simple2.txt +++ /dev/null @@ -1,56 +0,0 @@ -.. _axes_grid-parasite_simple2: - -axes_grid example code: parasite_simple2.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/axes_grid/parasite_simple2.py - -:: - - import matplotlib.transforms as mtransforms - import matplotlib.pyplot as plt - from mpl_toolkits.axes_grid1.parasite_axes import SubplotHost - - obs = [["01_S1", 3.88, 0.14, 1970, 63], - ["01_S4", 5.6, 0.82, 1622, 150], - ["02_S1", 2.4, 0.54, 1570, 40], - ["03_S1", 4.1, 0.62, 2380, 170]] - - - fig = plt.figure() - - ax_kms = SubplotHost(fig, 1, 1, 1, aspect=1.) - - # angular proper motion("/yr) to linear velocity(km/s) at distance=2.3kpc - pm_to_kms = 1./206265.*2300*3.085e18/3.15e7/1.e5 - - aux_trans = mtransforms.Affine2D().scale(pm_to_kms, 1.) - ax_pm = ax_kms.twin(aux_trans) - ax_pm.set_viewlim_mode("transform") - - fig.add_subplot(ax_kms) - - for n, ds, dse, w, we in obs: - time = ((2007 + (10. + 4/30.)/12) - 1988.5) - v = ds / time * pm_to_kms - ve = dse / time * pm_to_kms - ax_kms.errorbar([v], [w], xerr=[ve], yerr=[we], color="k") - - - ax_kms.axis["bottom"].set_label("Linear velocity at 2.3 kpc [km/s]") - ax_kms.axis["left"].set_label("FWHM [km/s]") - ax_pm.axis["top"].set_label(r"Proper Motion [$''$/yr]") - ax_pm.axis["top"].label.set_visible(True) - ax_pm.axis["right"].major_ticklabels.set_visible(False) - - ax_kms.set_xlim(950, 3700) - ax_kms.set_ylim(950, 3100) - # xlim and ylim of ax_pms will be automatically adjusted. - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/scatter_hist.rst.txt b/_sources/examples/axes_grid/scatter_hist.rst.txt deleted file mode 100644 index 2413d9a0c00..00000000000 --- a/_sources/examples/axes_grid/scatter_hist.rst.txt +++ /dev/null @@ -1,65 +0,0 @@ -.. _axes_grid-scatter_hist: - -axes_grid example code: scatter_hist.py -======================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/axes_grid/scatter_hist.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - from mpl_toolkits.axes_grid1 import make_axes_locatable - - # the random data - x = np.random.randn(1000) - y = np.random.randn(1000) - - - fig, axScatter = plt.subplots(figsize=(5.5, 5.5)) - - # the scatter plot: - axScatter.scatter(x, y) - axScatter.set_aspect(1.) - - # create new axes on the right and on the top of the current axes - # The first argument of the new_vertical(new_horizontal) method is - # the height (width) of the axes to be created in inches. - divider = make_axes_locatable(axScatter) - axHistx = divider.append_axes("top", 1.2, pad=0.1, sharex=axScatter) - axHisty = divider.append_axes("right", 1.2, pad=0.1, sharey=axScatter) - - # make some labels invisible - plt.setp(axHistx.get_xticklabels() + axHisty.get_yticklabels(), - visible=False) - - # now determine nice limits by hand: - binwidth = 0.25 - xymax = np.max([np.max(np.fabs(x)), np.max(np.fabs(y))]) - lim = (int(xymax/binwidth) + 1)*binwidth - - bins = np.arange(-lim, lim + binwidth, binwidth) - axHistx.hist(x, bins=bins) - axHisty.hist(y, bins=bins, orientation='horizontal') - - # the xaxis of axHistx and yaxis of axHisty are shared with axScatter, - # thus there is no need to manually adjust the xlim and ylim of these - # axis. - - #axHistx.axis["bottom"].major_ticklabels.set_visible(False) - for tl in axHistx.get_xticklabels(): - tl.set_visible(False) - axHistx.set_yticks([0, 50, 100]) - - #axHisty.axis["left"].major_ticklabels.set_visible(False) - for tl in axHisty.get_yticklabels(): - tl.set_visible(False) - axHisty.set_xticks([0, 50, 100]) - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/scatter_hist.txt b/_sources/examples/axes_grid/scatter_hist.txt deleted file mode 100644 index 38c65f65030..00000000000 --- a/_sources/examples/axes_grid/scatter_hist.txt +++ /dev/null @@ -1,65 +0,0 @@ -.. _axes_grid-scatter_hist: - -axes_grid example code: scatter_hist.py -======================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/axes_grid/scatter_hist.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - from mpl_toolkits.axes_grid1 import make_axes_locatable - - # the random data - x = np.random.randn(1000) - y = np.random.randn(1000) - - - fig, axScatter = plt.subplots(figsize=(5.5, 5.5)) - - # the scatter plot: - axScatter.scatter(x, y) - axScatter.set_aspect(1.) - - # create new axes on the right and on the top of the current axes - # The first argument of the new_vertical(new_horizontal) method is - # the height (width) of the axes to be created in inches. - divider = make_axes_locatable(axScatter) - axHistx = divider.append_axes("top", 1.2, pad=0.1, sharex=axScatter) - axHisty = divider.append_axes("right", 1.2, pad=0.1, sharey=axScatter) - - # make some labels invisible - plt.setp(axHistx.get_xticklabels() + axHisty.get_yticklabels(), - visible=False) - - # now determine nice limits by hand: - binwidth = 0.25 - xymax = np.max([np.max(np.fabs(x)), np.max(np.fabs(y))]) - lim = (int(xymax/binwidth) + 1)*binwidth - - bins = np.arange(-lim, lim + binwidth, binwidth) - axHistx.hist(x, bins=bins) - axHisty.hist(y, bins=bins, orientation='horizontal') - - # the xaxis of axHistx and yaxis of axHisty are shared with axScatter, - # thus there is no need to manually adjust the xlim and ylim of these - # axis. - - #axHistx.axis["bottom"].major_ticklabels.set_visible(False) - for tl in axHistx.get_xticklabels(): - tl.set_visible(False) - axHistx.set_yticks([0, 50, 100]) - - #axHisty.axis["left"].major_ticklabels.set_visible(False) - for tl in axHisty.get_yticklabels(): - tl.set_visible(False) - axHisty.set_xticks([0, 50, 100]) - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/simple_anchored_artists.rst.txt b/_sources/examples/axes_grid/simple_anchored_artists.rst.txt deleted file mode 100644 index 6a0cf15d93f..00000000000 --- a/_sources/examples/axes_grid/simple_anchored_artists.rst.txt +++ /dev/null @@ -1,76 +0,0 @@ -.. _axes_grid-simple_anchored_artists: - -axes_grid example code: simple_anchored_artists.py -================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/axes_grid/simple_anchored_artists.py - -:: - - import matplotlib.pyplot as plt - - - def draw_text(ax): - from matplotlib.offsetbox import AnchoredText - at = AnchoredText("Figure 1a", - loc=2, prop=dict(size=8), frameon=True, - ) - at.patch.set_boxstyle("round,pad=0.,rounding_size=0.2") - ax.add_artist(at) - - at2 = AnchoredText("Figure 1(b)", - loc=3, prop=dict(size=8), frameon=True, - bbox_to_anchor=(0., 1.), - bbox_transform=ax.transAxes - ) - at2.patch.set_boxstyle("round,pad=0.,rounding_size=0.2") - ax.add_artist(at2) - - - def draw_circle(ax): # circle in the canvas coordinate - from mpl_toolkits.axes_grid1.anchored_artists import AnchoredDrawingArea - from matplotlib.patches import Circle - ada = AnchoredDrawingArea(20, 20, 0, 0, - loc=1, pad=0., frameon=False) - p = Circle((10, 10), 10) - ada.da.add_artist(p) - ax.add_artist(ada) - - - def draw_ellipse(ax): - from mpl_toolkits.axes_grid1.anchored_artists import AnchoredEllipse - # draw an ellipse of width=0.1, height=0.15 in the data coordinate - ae = AnchoredEllipse(ax.transData, width=0.1, height=0.15, angle=0., - loc=3, pad=0.5, borderpad=0.4, frameon=True) - - ax.add_artist(ae) - - - def draw_sizebar(ax): - from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar - # draw a horizontal bar with length of 0.1 in Data coordinate - # (ax.transData) with a label underneath. - asb = AnchoredSizeBar(ax.transData, - 0.1, - r"1$^{\prime}$", - loc=8, - pad=0.1, borderpad=0.5, sep=5, - frameon=False) - ax.add_artist(asb) - - - if 1: - ax = plt.gca() - ax.set_aspect(1.) - - draw_text(ax) - draw_circle(ax) - draw_ellipse(ax) - draw_sizebar(ax) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/simple_anchored_artists.txt b/_sources/examples/axes_grid/simple_anchored_artists.txt deleted file mode 100644 index bac27d32edd..00000000000 --- a/_sources/examples/axes_grid/simple_anchored_artists.txt +++ /dev/null @@ -1,76 +0,0 @@ -.. _axes_grid-simple_anchored_artists: - -axes_grid example code: simple_anchored_artists.py -================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/axes_grid/simple_anchored_artists.py - -:: - - import matplotlib.pyplot as plt - - - def draw_text(ax): - from mpl_toolkits.axes_grid1.anchored_artists import AnchoredText - at = AnchoredText("Figure 1a", - loc=2, prop=dict(size=8), frameon=True, - ) - at.patch.set_boxstyle("round,pad=0.,rounding_size=0.2") - ax.add_artist(at) - - at2 = AnchoredText("Figure 1(b)", - loc=3, prop=dict(size=8), frameon=True, - bbox_to_anchor=(0., 1.), - bbox_transform=ax.transAxes - ) - at2.patch.set_boxstyle("round,pad=0.,rounding_size=0.2") - ax.add_artist(at2) - - - def draw_circle(ax): # circle in the canvas coordinate - from mpl_toolkits.axes_grid1.anchored_artists import AnchoredDrawingArea - from matplotlib.patches import Circle - ada = AnchoredDrawingArea(20, 20, 0, 0, - loc=1, pad=0., frameon=False) - p = Circle((10, 10), 10) - ada.da.add_artist(p) - ax.add_artist(ada) - - - def draw_ellipse(ax): - from mpl_toolkits.axes_grid1.anchored_artists import AnchoredEllipse - # draw an ellipse of width=0.1, height=0.15 in the data coordinate - ae = AnchoredEllipse(ax.transData, width=0.1, height=0.15, angle=0., - loc=3, pad=0.5, borderpad=0.4, frameon=True) - - ax.add_artist(ae) - - - def draw_sizebar(ax): - from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar - # draw a horizontal bar with length of 0.1 in Data coordinate - # (ax.transData) with a label underneath. - asb = AnchoredSizeBar(ax.transData, - 0.1, - r"1$^{\prime}$", - loc=8, - pad=0.1, borderpad=0.5, sep=5, - frameon=False) - ax.add_artist(asb) - - - if 1: - ax = plt.gca() - ax.set_aspect(1.) - - draw_text(ax) - draw_circle(ax) - draw_ellipse(ax) - draw_sizebar(ax) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/simple_axesgrid.rst.txt b/_sources/examples/axes_grid/simple_axesgrid.rst.txt deleted file mode 100644 index 79c7c700824..00000000000 --- a/_sources/examples/axes_grid/simple_axesgrid.rst.txt +++ /dev/null @@ -1,31 +0,0 @@ -.. _axes_grid-simple_axesgrid: - -axes_grid example code: simple_axesgrid.py -========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/axes_grid/simple_axesgrid.py - -:: - - import matplotlib.pyplot as plt - from mpl_toolkits.axes_grid1 import ImageGrid - import numpy as np - - im = np.arange(100) - im.shape = 10, 10 - - fig = plt.figure(1, (4., 4.)) - grid = ImageGrid(fig, 111, # similar to subplot(111) - nrows_ncols=(2, 2), # creates 2x2 grid of axes - axes_pad=0.1, # pad between axes in inch. - ) - - for i in range(4): - grid[i].imshow(im) # The AxesGrid object work as a list of axes. - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/simple_axesgrid.txt b/_sources/examples/axes_grid/simple_axesgrid.txt deleted file mode 100644 index 881e7a2b5c2..00000000000 --- a/_sources/examples/axes_grid/simple_axesgrid.txt +++ /dev/null @@ -1,31 +0,0 @@ -.. _axes_grid-simple_axesgrid: - -axes_grid example code: simple_axesgrid.py -========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/axes_grid/simple_axesgrid.py - -:: - - import matplotlib.pyplot as plt - from mpl_toolkits.axes_grid1 import ImageGrid - import numpy as np - - im = np.arange(100) - im.shape = 10, 10 - - fig = plt.figure(1, (4., 4.)) - grid = ImageGrid(fig, 111, # similar to subplot(111) - nrows_ncols=(2, 2), # creates 2x2 grid of axes - axes_pad=0.1, # pad between axes in inch. - ) - - for i in range(4): - grid[i].imshow(im) # The AxesGrid object work as a list of axes. - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/simple_axesgrid2.rst.txt b/_sources/examples/axes_grid/simple_axesgrid2.rst.txt deleted file mode 100644 index b91b0daa79d..00000000000 --- a/_sources/examples/axes_grid/simple_axesgrid2.rst.txt +++ /dev/null @@ -1,47 +0,0 @@ -.. _axes_grid-simple_axesgrid2: - -axes_grid example code: simple_axesgrid2.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/axes_grid/simple_axesgrid2.py - -:: - - import matplotlib.pyplot as plt - from mpl_toolkits.axes_grid1 import ImageGrid - - - def get_demo_image(): - import numpy as np - from matplotlib.cbook import get_sample_data - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3, 4, -4, 3) - - F = plt.figure(1, (5.5, 3.5)) - grid = ImageGrid(F, 111, # similar to subplot(111) - nrows_ncols=(1, 3), - axes_pad=0.1, - add_all=True, - label_mode="L", - ) - - Z, extent = get_demo_image() # demo image - - im1 = Z - im2 = Z[:, :10] - im3 = Z[:, 10:] - vmin, vmax = Z.min(), Z.max() - for i, im in enumerate([im1, im2, im3]): - ax = grid[i] - ax.imshow(im, origin="lower", vmin=vmin, - vmax=vmax, interpolation="nearest") - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/simple_axesgrid2.txt b/_sources/examples/axes_grid/simple_axesgrid2.txt deleted file mode 100644 index 64411c08992..00000000000 --- a/_sources/examples/axes_grid/simple_axesgrid2.txt +++ /dev/null @@ -1,47 +0,0 @@ -.. _axes_grid-simple_axesgrid2: - -axes_grid example code: simple_axesgrid2.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/axes_grid/simple_axesgrid2.py - -:: - - import matplotlib.pyplot as plt - from mpl_toolkits.axes_grid1 import ImageGrid - - - def get_demo_image(): - import numpy as np - from matplotlib.cbook import get_sample_data - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3, 4, -4, 3) - - F = plt.figure(1, (5.5, 3.5)) - grid = ImageGrid(F, 111, # similar to subplot(111) - nrows_ncols=(1, 3), - axes_pad=0.1, - add_all=True, - label_mode="L", - ) - - Z, extent = get_demo_image() # demo image - - im1 = Z - im2 = Z[:, :10] - im3 = Z[:, 10:] - vmin, vmax = Z.min(), Z.max() - for i, im in enumerate([im1, im2, im3]): - ax = grid[i] - ax.imshow(im, origin="lower", vmin=vmin, - vmax=vmax, interpolation="nearest") - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/simple_axisline4.rst.txt b/_sources/examples/axes_grid/simple_axisline4.rst.txt deleted file mode 100644 index 5763fafb3ec..00000000000 --- a/_sources/examples/axes_grid/simple_axisline4.rst.txt +++ /dev/null @@ -1,33 +0,0 @@ -.. _axes_grid-simple_axisline4: - -axes_grid example code: simple_axisline4.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/axes_grid/simple_axisline4.py - -:: - - import matplotlib.pyplot as plt - from mpl_toolkits.axes_grid1 import host_subplot - import mpl_toolkits.axisartist as AA - import numpy as np - - ax = host_subplot(111, axes_class=AA.Axes) - xx = np.arange(0, 2*np.pi, 0.01) - ax.plot(xx, np.sin(xx)) - - ax2 = ax.twin() # ax2 is responsible for "top" axis and "right" axis - ax2.set_xticks([0., .5*np.pi, np.pi, 1.5*np.pi, 2*np.pi]) - ax2.set_xticklabels(["$0$", r"$\frac{1}{2}\pi$", - r"$\pi$", r"$\frac{3}{2}\pi$", r"$2\pi$"]) - - ax2.axis["right"].major_ticklabels.set_visible(False) - ax2.axis["top"].major_ticklabels.set_visible(True) - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/axes_grid/simple_axisline4.txt b/_sources/examples/axes_grid/simple_axisline4.txt deleted file mode 100644 index 7b210239db5..00000000000 --- a/_sources/examples/axes_grid/simple_axisline4.txt +++ /dev/null @@ -1,32 +0,0 @@ -.. _axes_grid-simple_axisline4: - -axes_grid example code: simple_axisline4.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/axes_grid/simple_axisline4.py - -:: - - import matplotlib.pyplot as plt - from mpl_toolkits.axes_grid1 import host_subplot - import mpl_toolkits.axisartist as AA - import numpy as np - - ax = host_subplot(111, axes_class=AA.Axes) - xx = np.arange(0, 2*np.pi, 0.01) - ax.plot(xx, np.sin(xx)) - - ax2 = ax.twin() # ax2 is responsible for "top" axis and "right" axis - ax2.set_xticks([0., .5*np.pi, np.pi, 1.5*np.pi, 2*np.pi]) - ax2.set_xticklabels(["$0$", r"$\frac{1}{2}\pi$", - r"$\pi$", r"$\frac{3}{2}\pi$", r"$2\pi$"]) - - ax2.axis["right"].major_ticklabels.set_visible(False) - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/color/color_cycle_default.rst.txt b/_sources/examples/color/color_cycle_default.rst.txt deleted file mode 100644 index de0379feb10..00000000000 --- a/_sources/examples/color/color_cycle_default.rst.txt +++ /dev/null @@ -1,54 +0,0 @@ -.. _color-color_cycle_default: - -color example code: color_cycle_default.py -========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/color/color_cycle_default.py - -:: - - """ - ==================================== - Colors in the default property cycle - ==================================== - - Display the colors from the default prop_cycle. - """ - import numpy as np - import matplotlib.pyplot as plt - - - prop_cycle = plt.rcParams['axes.prop_cycle'] - colors = prop_cycle.by_key()['color'] - - lwbase = plt.rcParams['lines.linewidth'] - thin = float('%.1f' % (lwbase / 2)) - thick = lwbase * 3 - - fig, axs = plt.subplots(nrows=2, ncols=2, sharex=True, sharey=True) - for icol in range(2): - if icol == 0: - lwx, lwy = thin, lwbase - else: - lwx, lwy = lwbase, thick - for irow in range(2): - for i, color in enumerate(colors): - axs[irow, icol].axhline(i, color=color, lw=lwx) - axs[irow, icol].axvline(i, color=color, lw=lwy) - - axs[1, icol].set_facecolor('k') - axs[1, icol].xaxis.set_ticks(np.arange(0, 10, 2)) - axs[0, icol].set_title('line widths (pts): %.1f, %.1f' % (lwx, lwy), - fontsize='medium') - - for irow in range(2): - axs[irow, 0].yaxis.set_ticks(np.arange(0, 10, 2)) - - fig.suptitle('Colors in the default prop_cycle', fontsize='large') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/color/color_cycle_demo.rst.txt b/_sources/examples/color/color_cycle_demo.rst.txt deleted file mode 100644 index 3d27ad70d74..00000000000 --- a/_sources/examples/color/color_cycle_demo.rst.txt +++ /dev/null @@ -1,55 +0,0 @@ -.. _color-color_cycle_demo: - -color example code: color_cycle_demo.py -======================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/color/color_cycle_demo.py - -:: - - """ - =================== - Styling with cycler - =================== - - Demo of custom property-cycle settings to control colors and other style - properties for multi-line plots. - - This example demonstrates two different APIs: - - 1. Setting the default rc parameter specifying the property cycle. - This affects all subsequent axes (but not axes already created). - 2. Setting the property cycle for a single pair of axes. - """ - from cycler import cycler - import numpy as np - import matplotlib.pyplot as plt - - - x = np.linspace(0, 2 * np.pi) - offsets = np.linspace(0, 2*np.pi, 4, endpoint=False) - # Create array with shifted-sine curve along each column - yy = np.transpose([np.sin(x + phi) for phi in offsets]) - - # 1. Setting prop cycle on default rc parameter - plt.rc('lines', linewidth=4) - plt.rc('axes', prop_cycle=(cycler('color', ['r', 'g', 'b', 'y']) + - cycler('linestyle', ['-', '--', ':', '-.']))) - fig, (ax0, ax1) = plt.subplots(nrows=2) - ax0.plot(yy) - ax0.set_title('Set default color cycle to rgby') - - # 2. Define prop cycle for single set of axes - ax1.set_prop_cycle(cycler('color', ['c', 'm', 'y', 'k']) + - cycler('lw', [1, 2, 3, 4])) - ax1.plot(yy) - ax1.set_title('Set axes color cycle to cmyk') - - # Tweak spacing between subplots to prevent labels from overlapping - fig.subplots_adjust(hspace=0.3) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/color/color_cycle_demo.txt b/_sources/examples/color/color_cycle_demo.txt deleted file mode 100644 index b0b67559e33..00000000000 --- a/_sources/examples/color/color_cycle_demo.txt +++ /dev/null @@ -1,49 +0,0 @@ -.. _color-color_cycle_demo: - -color example code: color_cycle_demo.py -======================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/color/color_cycle_demo.py - -:: - - """ - Demo of custom property-cycle settings to control colors and such - for multi-line plots. - - This example demonstrates two different APIs: - - 1. Setting the default rc-parameter specifying the property cycle. - This affects all subsequent axes (but not axes already created). - 2. Setting the property cycle for a specific axes. This only - affects a single axes. - """ - from cycler import cycler - import numpy as np - import matplotlib.pyplot as plt - - x = np.linspace(0, 2 * np.pi) - offsets = np.linspace(0, 2*np.pi, 4, endpoint=False) - # Create array with shifted-sine curve along each column - yy = np.transpose([np.sin(x + phi) for phi in offsets]) - - plt.rc('lines', linewidth=4) - plt.rc('axes', prop_cycle=(cycler('color', ['r', 'g', 'b', 'y']) + - cycler('linestyle', ['-', '--', ':', '-.']))) - fig, (ax0, ax1) = plt.subplots(nrows=2) - ax0.plot(yy) - ax0.set_title('Set default color cycle to rgby') - - ax1.set_prop_cycle(cycler('color', ['c', 'm', 'y', 'k']) + - cycler('lw', [1, 2, 3, 4])) - ax1.plot(yy) - ax1.set_title('Set axes color cycle to cmyk') - - # Tweak spacing between subplots to prevent labels from overlapping - plt.subplots_adjust(hspace=0.3) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/color/colormaps_reference.rst.txt b/_sources/examples/color/colormaps_reference.rst.txt deleted file mode 100644 index 6cd01984ed9..00000000000 --- a/_sources/examples/color/colormaps_reference.rst.txt +++ /dev/null @@ -1,107 +0,0 @@ -.. _color-colormaps_reference: - -color example code: colormaps_reference.py -========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/color/colormaps_reference.py - -:: - - """ - ================== - Colormap reference - ================== - - Reference for colormaps included with Matplotlib. - - This reference example shows all colormaps included with Matplotlib. Note that - any colormap listed here can be reversed by appending "_r" (e.g., "pink_r"). - These colormaps are divided into the following categories: - - Sequential: - These colormaps are approximately monochromatic colormaps varying smoothly - between two color tones---usually from low saturation (e.g. white) to high - saturation (e.g. a bright blue). Sequential colormaps are ideal for - representing most scientific data since they show a clear progression from - low-to-high values. - - Diverging: - These colormaps have a median value (usually light in color) and vary - smoothly to two different color tones at high and low values. Diverging - colormaps are ideal when your data has a median value that is significant - (e.g. 0, such that positive and negative values are represented by - different colors of the colormap). - - Qualitative: - These colormaps vary rapidly in color. Qualitative colormaps are useful for - choosing a set of discrete colors. For example:: - - color_list = plt.cm.Set3(np.linspace(0, 1, 12)) - - gives a list of RGB colors that are good for plotting a series of lines on - a dark background. - - Miscellaneous: - Colormaps that don't fit into the categories above. - - """ - import numpy as np - import matplotlib.pyplot as plt - - - # Have colormaps separated into categories: - # http://matplotlib.org/examples/color/colormaps_reference.html - cmaps = [('Perceptually Uniform Sequential', [ - 'viridis', 'plasma', 'inferno', 'magma']), - ('Sequential', [ - 'Greys', 'Purples', 'Blues', 'Greens', 'Oranges', 'Reds', - 'YlOrBr', 'YlOrRd', 'OrRd', 'PuRd', 'RdPu', 'BuPu', - 'GnBu', 'PuBu', 'YlGnBu', 'PuBuGn', 'BuGn', 'YlGn']), - ('Sequential (2)', [ - 'binary', 'gist_yarg', 'gist_gray', 'gray', 'bone', 'pink', - 'spring', 'summer', 'autumn', 'winter', 'cool', 'Wistia', - 'hot', 'afmhot', 'gist_heat', 'copper']), - ('Diverging', [ - 'PiYG', 'PRGn', 'BrBG', 'PuOr', 'RdGy', 'RdBu', - 'RdYlBu', 'RdYlGn', 'Spectral', 'coolwarm', 'bwr', 'seismic']), - ('Qualitative', [ - 'Pastel1', 'Pastel2', 'Paired', 'Accent', - 'Dark2', 'Set1', 'Set2', 'Set3', - 'tab10', 'tab20', 'tab20b', 'tab20c']), - ('Miscellaneous', [ - 'flag', 'prism', 'ocean', 'gist_earth', 'terrain', 'gist_stern', - 'gnuplot', 'gnuplot2', 'CMRmap', 'cubehelix', 'brg', 'hsv', - 'gist_rainbow', 'rainbow', 'jet', 'nipy_spectral', 'gist_ncar'])] - - - nrows = max(len(cmap_list) for cmap_category, cmap_list in cmaps) - gradient = np.linspace(0, 1, 256) - gradient = np.vstack((gradient, gradient)) - - - def plot_color_gradients(cmap_category, cmap_list, nrows): - fig, axes = plt.subplots(nrows=nrows) - fig.subplots_adjust(top=0.95, bottom=0.01, left=0.2, right=0.99) - axes[0].set_title(cmap_category + ' colormaps', fontsize=14) - - for ax, name in zip(axes, cmap_list): - ax.imshow(gradient, aspect='auto', cmap=plt.get_cmap(name)) - pos = list(ax.get_position().bounds) - x_text = pos[0] - 0.01 - y_text = pos[1] + pos[3]/2. - fig.text(x_text, y_text, name, va='center', ha='right', fontsize=10) - - # Turn off *all* ticks & spines, not just the ones with colormaps. - for ax in axes: - ax.set_axis_off() - - - for cmap_category, cmap_list in cmaps: - plot_color_gradients(cmap_category, cmap_list, nrows) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/color/colormaps_reference.txt b/_sources/examples/color/colormaps_reference.txt deleted file mode 100644 index 958109deca5..00000000000 --- a/_sources/examples/color/colormaps_reference.txt +++ /dev/null @@ -1,100 +0,0 @@ -.. _color-colormaps_reference: - -color example code: colormaps_reference.py -========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/color/colormaps_reference.py - -:: - - """ - Reference for colormaps included with Matplotlib. - - This reference example shows all colormaps included with Matplotlib. Note that - any colormap listed here can be reversed by appending "_r" (e.g., "pink_r"). - These colormaps are divided into the following categories: - - Sequential: - These colormaps are approximately monochromatic colormaps varying smoothly - between two color tones---usually from low saturation (e.g. white) to high - saturation (e.g. a bright blue). Sequential colormaps are ideal for - representing most scientific data since they show a clear progression from - low-to-high values. - - Diverging: - These colormaps have a median value (usually light in color) and vary - smoothly to two different color tones at high and low values. Diverging - colormaps are ideal when your data has a median value that is significant - (e.g. 0, such that positive and negative values are represented by - different colors of the colormap). - - Qualitative: - These colormaps vary rapidly in color. Qualitative colormaps are useful for - choosing a set of discrete colors. For example:: - - color_list = plt.cm.Set3(np.linspace(0, 1, 12)) - - gives a list of RGB colors that are good for plotting a series of lines on - a dark background. - - Miscellaneous: - Colormaps that don't fit into the categories above. - - """ - import numpy as np - import matplotlib.pyplot as plt - - # Have colormaps separated into categories: - # http://matplotlib.org/examples/color/colormaps_reference.html - - cmaps = [('Perceptually Uniform Sequential', - ['viridis', 'inferno', 'plasma', 'magma']), - ('Sequential', ['Blues', 'BuGn', 'BuPu', - 'GnBu', 'Greens', 'Greys', 'Oranges', 'OrRd', - 'PuBu', 'PuBuGn', 'PuRd', 'Purples', 'RdPu', - 'Reds', 'YlGn', 'YlGnBu', 'YlOrBr', 'YlOrRd']), - ('Sequential (2)', ['afmhot', 'autumn', 'bone', 'cool', - 'copper', 'gist_heat', 'gray', 'hot', - 'pink', 'spring', 'summer', 'winter']), - ('Diverging', ['BrBG', 'bwr', 'coolwarm', 'PiYG', 'PRGn', 'PuOr', - 'RdBu', 'RdGy', 'RdYlBu', 'RdYlGn', 'Spectral', - 'seismic']), - ('Qualitative', ['Accent', 'Dark2', 'Paired', 'Pastel1', - 'Pastel2', 'Set1', 'Set2', 'Set3']), - ('Miscellaneous', ['gist_earth', 'terrain', 'ocean', 'gist_stern', - 'brg', 'CMRmap', 'cubehelix', - 'gnuplot', 'gnuplot2', 'gist_ncar', - 'nipy_spectral', 'jet', 'rainbow', - 'gist_rainbow', 'hsv', 'flag', 'prism'])] - - - nrows = max(len(cmap_list) for cmap_category, cmap_list in cmaps) - gradient = np.linspace(0, 1, 256) - gradient = np.vstack((gradient, gradient)) - - - def plot_color_gradients(cmap_category, cmap_list): - fig, axes = plt.subplots(nrows=nrows) - fig.subplots_adjust(top=0.95, bottom=0.01, left=0.2, right=0.99) - axes[0].set_title(cmap_category + ' colormaps', fontsize=14) - - for ax, name in zip(axes, cmap_list): - ax.imshow(gradient, aspect='auto', cmap=plt.get_cmap(name)) - pos = list(ax.get_position().bounds) - x_text = pos[0] - 0.01 - y_text = pos[1] + pos[3]/2. - fig.text(x_text, y_text, name, va='center', ha='right', fontsize=10) - - # Turn off *all* ticks & spines, not just the ones with colormaps. - for ax in axes: - ax.set_axis_off() - - for cmap_category, cmap_list in cmaps: - plot_color_gradients(cmap_category, cmap_list) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/color/index.rst.txt b/_sources/examples/color/index.rst.txt deleted file mode 100644 index 873efd89607..00000000000 --- a/_sources/examples/color/index.rst.txt +++ /dev/null @@ -1,18 +0,0 @@ -.. _color-examples-index: - -############################################## -color Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - color_cycle_default - color_cycle_demo - colormaps_reference - named_colors diff --git a/_sources/examples/color/index.txt b/_sources/examples/color/index.txt deleted file mode 100644 index de1201c38c7..00000000000 --- a/_sources/examples/color/index.txt +++ /dev/null @@ -1,17 +0,0 @@ -.. _color-examples-index: - -############################################## -color Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - color_cycle_demo - colormaps_reference - named_colors diff --git a/_sources/examples/color/named_colors.rst.txt b/_sources/examples/color/named_colors.rst.txt deleted file mode 100644 index 17983ffb678..00000000000 --- a/_sources/examples/color/named_colors.rst.txt +++ /dev/null @@ -1,69 +0,0 @@ -.. _color-named_colors: - -color example code: named_colors.py -=================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/color/named_colors.py - -:: - - """ - ======================== - Visualizing named colors - ======================== - - Simple plot example with the named colors and its visual representation. - """ - from __future__ import division - - import matplotlib.pyplot as plt - from matplotlib import colors as mcolors - - - colors = dict(mcolors.BASE_COLORS, **mcolors.CSS4_COLORS) - - # Sort colors by hue, saturation, value and name. - by_hsv = sorted((tuple(mcolors.rgb_to_hsv(mcolors.to_rgba(color)[:3])), name) - for name, color in colors.items()) - sorted_names = [name for hsv, name in by_hsv] - - n = len(sorted_names) - ncols = 4 - nrows = n // ncols + 1 - - fig, ax = plt.subplots(figsize=(8, 5)) - - # Get height and width - X, Y = fig.get_dpi() * fig.get_size_inches() - h = Y / (nrows + 1) - w = X / ncols - - for i, name in enumerate(sorted_names): - col = i % ncols - row = i // ncols - y = Y - (row * h) - h - - xi_line = w * (col + 0.05) - xf_line = w * (col + 0.25) - xi_text = w * (col + 0.3) - - ax.text(xi_text, y, name, fontsize=(h * 0.8), - horizontalalignment='left', - verticalalignment='center') - - ax.hlines(y + h * 0.1, xi_line, xf_line, - color=colors[name], linewidth=(h * 0.6)) - - ax.set_xlim(0, X) - ax.set_ylim(0, Y) - ax.set_axis_off() - - fig.subplots_adjust(left=0, right=1, - top=1, bottom=0, - hspace=0, wspace=0) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/color/named_colors.txt b/_sources/examples/color/named_colors.txt deleted file mode 100644 index db721b935b0..00000000000 --- a/_sources/examples/color/named_colors.txt +++ /dev/null @@ -1,92 +0,0 @@ -.. _color-named_colors: - -color example code: named_colors.py -=================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/color/named_colors.py - -:: - - """ - Visualization of named colors. - - Simple plot example with the named colors and its visual representation. - """ - - from __future__ import (absolute_import, division, print_function, - unicode_literals) - - import six - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib import colors - - - colors_ = list(six.iteritems(colors.cnames)) - - # Add the single letter colors. - for name, rgb in six.iteritems(colors.ColorConverter.colors): - hex_ = colors.rgb2hex(rgb) - colors_.append((name, hex_)) - - # Transform to hex color values. - hex_ = [color[1] for color in colors_] - # Get the rgb equivalent. - rgb = [colors.hex2color(color) for color in hex_] - # Get the hsv equivalent. - hsv = [colors.rgb_to_hsv(color) for color in rgb] - - # Split the hsv values to sort. - hue = [color[0] for color in hsv] - sat = [color[1] for color in hsv] - val = [color[2] for color in hsv] - - # Sort by hue, saturation and value. - ind = np.lexsort((val, sat, hue)) - sorted_colors = [colors_[i] for i in ind] - - n = len(sorted_colors) - ncols = 4 - nrows = int(np.ceil(1. * n / ncols)) - - fig, ax = plt.subplots() - - X, Y = fig.get_dpi() * fig.get_size_inches() - - # row height - h = Y / (nrows + 1) - # col width - w = X / ncols - - for i, (name, color) in enumerate(sorted_colors): - col = i % ncols - row = int(i / ncols) - y = Y - (row * h) - h - - xi_line = w * (col + 0.05) - xf_line = w * (col + 0.25) - xi_text = w * (col + 0.3) - - ax.text(xi_text, y, name, fontsize=(h * 0.8), - horizontalalignment='left', - verticalalignment='center') - - # Add extra black line a little bit thicker to make - # clear colors more visible. - ax.hlines(y, xi_line, xf_line, color='black', linewidth=(h * 0.7)) - ax.hlines(y + h * 0.1, xi_line, xf_line, color=color, linewidth=(h * 0.6)) - - ax.set_xlim(0, X) - ax.set_ylim(0, Y) - ax.set_axis_off() - - fig.subplots_adjust(left=0, right=1, - top=1, bottom=0, - hspace=0, wspace=0) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/close_event.rst.txt b/_sources/examples/event_handling/close_event.rst.txt deleted file mode 100644 index 257e14f0f04..00000000000 --- a/_sources/examples/event_handling/close_event.rst.txt +++ /dev/null @@ -1,24 +0,0 @@ -.. _event_handling-close_event: - -event_handling example code: close_event.py -=========================================== - -[`source code `_] - -:: - - from __future__ import print_function - import matplotlib.pyplot as plt - - - def handle_close(evt): - print('Closed Figure!') - - fig = plt.figure() - fig.canvas.mpl_connect('close_event', handle_close) - - plt.text(0.35, 0.5, 'Close Me!', dict(size=30)) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/close_event.txt b/_sources/examples/event_handling/close_event.txt deleted file mode 100644 index 257e14f0f04..00000000000 --- a/_sources/examples/event_handling/close_event.txt +++ /dev/null @@ -1,24 +0,0 @@ -.. _event_handling-close_event: - -event_handling example code: close_event.py -=========================================== - -[`source code `_] - -:: - - from __future__ import print_function - import matplotlib.pyplot as plt - - - def handle_close(evt): - print('Closed Figure!') - - fig = plt.figure() - fig.canvas.mpl_connect('close_event', handle_close) - - plt.text(0.35, 0.5, 'Close Me!', dict(size=30)) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/data_browser.rst.txt b/_sources/examples/event_handling/data_browser.rst.txt deleted file mode 100644 index 932b4f1fbf4..00000000000 --- a/_sources/examples/event_handling/data_browser.rst.txt +++ /dev/null @@ -1,100 +0,0 @@ -.. _event_handling-data_browser: - -event_handling example code: data_browser.py -============================================ - -[`source code `_] - -:: - - import numpy as np - - - class PointBrowser(object): - """ - Click on a point to select and highlight it -- the data that - generated the point will be shown in the lower axes. Use the 'n' - and 'p' keys to browse through the next and previous points - """ - - def __init__(self): - self.lastind = 0 - - self.text = ax.text(0.05, 0.95, 'selected: none', - transform=ax.transAxes, va='top') - self.selected, = ax.plot([xs[0]], [ys[0]], 'o', ms=12, alpha=0.4, - color='yellow', visible=False) - - def onpress(self, event): - if self.lastind is None: - return - if event.key not in ('n', 'p'): - return - if event.key == 'n': - inc = 1 - else: - inc = -1 - - self.lastind += inc - self.lastind = np.clip(self.lastind, 0, len(xs) - 1) - self.update() - - def onpick(self, event): - - if event.artist != line: - return True - - N = len(event.ind) - if not N: - return True - - # the click locations - x = event.mouseevent.xdata - y = event.mouseevent.ydata - - distances = np.hypot(x - xs[event.ind], y - ys[event.ind]) - indmin = distances.argmin() - dataind = event.ind[indmin] - - self.lastind = dataind - self.update() - - def update(self): - if self.lastind is None: - return - - dataind = self.lastind - - ax2.cla() - ax2.plot(X[dataind]) - - ax2.text(0.05, 0.9, 'mu=%1.3f\nsigma=%1.3f' % (xs[dataind], ys[dataind]), - transform=ax2.transAxes, va='top') - ax2.set_ylim(-0.5, 1.5) - self.selected.set_visible(True) - self.selected.set_data(xs[dataind], ys[dataind]) - - self.text.set_text('selected: %d' % dataind) - fig.canvas.draw() - - - if __name__ == '__main__': - import matplotlib.pyplot as plt - - X = np.random.rand(100, 200) - xs = np.mean(X, axis=1) - ys = np.std(X, axis=1) - - fig, (ax, ax2) = plt.subplots(2, 1) - ax.set_title('click on point to plot time series') - line, = ax.plot(xs, ys, 'o', picker=5) # 5 points tolerance - - browser = PointBrowser() - - fig.canvas.mpl_connect('pick_event', browser.onpick) - fig.canvas.mpl_connect('key_press_event', browser.onpress) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/data_browser.txt b/_sources/examples/event_handling/data_browser.txt deleted file mode 100644 index 932b4f1fbf4..00000000000 --- a/_sources/examples/event_handling/data_browser.txt +++ /dev/null @@ -1,100 +0,0 @@ -.. _event_handling-data_browser: - -event_handling example code: data_browser.py -============================================ - -[`source code `_] - -:: - - import numpy as np - - - class PointBrowser(object): - """ - Click on a point to select and highlight it -- the data that - generated the point will be shown in the lower axes. Use the 'n' - and 'p' keys to browse through the next and previous points - """ - - def __init__(self): - self.lastind = 0 - - self.text = ax.text(0.05, 0.95, 'selected: none', - transform=ax.transAxes, va='top') - self.selected, = ax.plot([xs[0]], [ys[0]], 'o', ms=12, alpha=0.4, - color='yellow', visible=False) - - def onpress(self, event): - if self.lastind is None: - return - if event.key not in ('n', 'p'): - return - if event.key == 'n': - inc = 1 - else: - inc = -1 - - self.lastind += inc - self.lastind = np.clip(self.lastind, 0, len(xs) - 1) - self.update() - - def onpick(self, event): - - if event.artist != line: - return True - - N = len(event.ind) - if not N: - return True - - # the click locations - x = event.mouseevent.xdata - y = event.mouseevent.ydata - - distances = np.hypot(x - xs[event.ind], y - ys[event.ind]) - indmin = distances.argmin() - dataind = event.ind[indmin] - - self.lastind = dataind - self.update() - - def update(self): - if self.lastind is None: - return - - dataind = self.lastind - - ax2.cla() - ax2.plot(X[dataind]) - - ax2.text(0.05, 0.9, 'mu=%1.3f\nsigma=%1.3f' % (xs[dataind], ys[dataind]), - transform=ax2.transAxes, va='top') - ax2.set_ylim(-0.5, 1.5) - self.selected.set_visible(True) - self.selected.set_data(xs[dataind], ys[dataind]) - - self.text.set_text('selected: %d' % dataind) - fig.canvas.draw() - - - if __name__ == '__main__': - import matplotlib.pyplot as plt - - X = np.random.rand(100, 200) - xs = np.mean(X, axis=1) - ys = np.std(X, axis=1) - - fig, (ax, ax2) = plt.subplots(2, 1) - ax.set_title('click on point to plot time series') - line, = ax.plot(xs, ys, 'o', picker=5) # 5 points tolerance - - browser = PointBrowser() - - fig.canvas.mpl_connect('pick_event', browser.onpick) - fig.canvas.mpl_connect('key_press_event', browser.onpress) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/figure_axes_enter_leave.rst.txt b/_sources/examples/event_handling/figure_axes_enter_leave.rst.txt deleted file mode 100644 index c8fa6d8a31d..00000000000 --- a/_sources/examples/event_handling/figure_axes_enter_leave.rst.txt +++ /dev/null @@ -1,60 +0,0 @@ -.. _event_handling-figure_axes_enter_leave: - -event_handling example code: figure_axes_enter_leave.py -======================================================= - -[`source code `_] - -:: - - """ - Illustrate the figure and axes enter and leave events by changing the - frame colors on enter and leave - """ - from __future__ import print_function - import matplotlib.pyplot as plt - - - def enter_axes(event): - print('enter_axes', event.inaxes) - event.inaxes.patch.set_facecolor('yellow') - event.canvas.draw() - - - def leave_axes(event): - print('leave_axes', event.inaxes) - event.inaxes.patch.set_facecolor('white') - event.canvas.draw() - - - def enter_figure(event): - print('enter_figure', event.canvas.figure) - event.canvas.figure.patch.set_facecolor('red') - event.canvas.draw() - - - def leave_figure(event): - print('leave_figure', event.canvas.figure) - event.canvas.figure.patch.set_facecolor('grey') - event.canvas.draw() - - fig1, (ax, ax2) = plt.subplots(2, 1) - fig1.suptitle('mouse hover over figure or axes to trigger events') - - fig1.canvas.mpl_connect('figure_enter_event', enter_figure) - fig1.canvas.mpl_connect('figure_leave_event', leave_figure) - fig1.canvas.mpl_connect('axes_enter_event', enter_axes) - fig1.canvas.mpl_connect('axes_leave_event', leave_axes) - - fig2, (ax, ax2) = plt.subplots(2, 1) - fig2.suptitle('mouse hover over figure or axes to trigger events') - - fig2.canvas.mpl_connect('figure_enter_event', enter_figure) - fig2.canvas.mpl_connect('figure_leave_event', leave_figure) - fig2.canvas.mpl_connect('axes_enter_event', enter_axes) - fig2.canvas.mpl_connect('axes_leave_event', leave_axes) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/figure_axes_enter_leave.txt b/_sources/examples/event_handling/figure_axes_enter_leave.txt deleted file mode 100644 index c8fa6d8a31d..00000000000 --- a/_sources/examples/event_handling/figure_axes_enter_leave.txt +++ /dev/null @@ -1,60 +0,0 @@ -.. _event_handling-figure_axes_enter_leave: - -event_handling example code: figure_axes_enter_leave.py -======================================================= - -[`source code `_] - -:: - - """ - Illustrate the figure and axes enter and leave events by changing the - frame colors on enter and leave - """ - from __future__ import print_function - import matplotlib.pyplot as plt - - - def enter_axes(event): - print('enter_axes', event.inaxes) - event.inaxes.patch.set_facecolor('yellow') - event.canvas.draw() - - - def leave_axes(event): - print('leave_axes', event.inaxes) - event.inaxes.patch.set_facecolor('white') - event.canvas.draw() - - - def enter_figure(event): - print('enter_figure', event.canvas.figure) - event.canvas.figure.patch.set_facecolor('red') - event.canvas.draw() - - - def leave_figure(event): - print('leave_figure', event.canvas.figure) - event.canvas.figure.patch.set_facecolor('grey') - event.canvas.draw() - - fig1, (ax, ax2) = plt.subplots(2, 1) - fig1.suptitle('mouse hover over figure or axes to trigger events') - - fig1.canvas.mpl_connect('figure_enter_event', enter_figure) - fig1.canvas.mpl_connect('figure_leave_event', leave_figure) - fig1.canvas.mpl_connect('axes_enter_event', enter_axes) - fig1.canvas.mpl_connect('axes_leave_event', leave_axes) - - fig2, (ax, ax2) = plt.subplots(2, 1) - fig2.suptitle('mouse hover over figure or axes to trigger events') - - fig2.canvas.mpl_connect('figure_enter_event', enter_figure) - fig2.canvas.mpl_connect('figure_leave_event', leave_figure) - fig2.canvas.mpl_connect('axes_enter_event', enter_axes) - fig2.canvas.mpl_connect('axes_leave_event', leave_axes) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/idle_and_timeout.rst.txt b/_sources/examples/event_handling/idle_and_timeout.rst.txt deleted file mode 100644 index 4a1919e3295..00000000000 --- a/_sources/examples/event_handling/idle_and_timeout.rst.txt +++ /dev/null @@ -1,49 +0,0 @@ -.. _event_handling-idle_and_timeout: - -event_handling example code: idle_and_timeout.py -================================================ - -[`source code `_] - -:: - - from __future__ import print_function - """ - Demonstrate/test the idle and timeout API - - WARNING: idle_event is deprecated. Use the animations module instead. - - This is only tested on gtk so far and is a prototype implementation - """ - import numpy as np - import matplotlib.pyplot as plt - - fig, ax = plt.subplots() - - t = np.arange(0.0, 2.0, 0.01) - y1 = np.sin(2*np.pi*t) - y2 = np.cos(2*np.pi*t) - line1, = ax.plot(y1) - line2, = ax.plot(y2) - - N = 100 - - - def on_idle(event): - on_idle.count += 1 - print('idle', on_idle.count) - line1.set_ydata(np.sin(2*np.pi*t*(N - on_idle.count)/float(N))) - event.canvas.draw() - # test boolean return removal - if on_idle.count == N: - return False - return True - on_idle.cid = None - on_idle.count = 0 - - fig.canvas.mpl_connect('idle_event', on_idle) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/idle_and_timeout.txt b/_sources/examples/event_handling/idle_and_timeout.txt deleted file mode 100644 index 4a1919e3295..00000000000 --- a/_sources/examples/event_handling/idle_and_timeout.txt +++ /dev/null @@ -1,49 +0,0 @@ -.. _event_handling-idle_and_timeout: - -event_handling example code: idle_and_timeout.py -================================================ - -[`source code `_] - -:: - - from __future__ import print_function - """ - Demonstrate/test the idle and timeout API - - WARNING: idle_event is deprecated. Use the animations module instead. - - This is only tested on gtk so far and is a prototype implementation - """ - import numpy as np - import matplotlib.pyplot as plt - - fig, ax = plt.subplots() - - t = np.arange(0.0, 2.0, 0.01) - y1 = np.sin(2*np.pi*t) - y2 = np.cos(2*np.pi*t) - line1, = ax.plot(y1) - line2, = ax.plot(y2) - - N = 100 - - - def on_idle(event): - on_idle.count += 1 - print('idle', on_idle.count) - line1.set_ydata(np.sin(2*np.pi*t*(N - on_idle.count)/float(N))) - event.canvas.draw() - # test boolean return removal - if on_idle.count == N: - return False - return True - on_idle.cid = None - on_idle.count = 0 - - fig.canvas.mpl_connect('idle_event', on_idle) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/index.rst.txt b/_sources/examples/event_handling/index.rst.txt deleted file mode 100644 index 4ee81468451..00000000000 --- a/_sources/examples/event_handling/index.rst.txt +++ /dev/null @@ -1,34 +0,0 @@ -.. _event_handling-examples-index: - -############################################## -event_handling Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - close_event - data_browser - figure_axes_enter_leave - idle_and_timeout - keypress_demo - lasso_demo - legend_picking - looking_glass - path_editor - pick_event_demo - pick_event_demo2 - pipong - poly_editor - pong_gtk - resample - test_mouseclicks - timers - trifinder_event_demo - viewlims - zoom_window diff --git a/_sources/examples/event_handling/index.txt b/_sources/examples/event_handling/index.txt deleted file mode 100644 index 4ee81468451..00000000000 --- a/_sources/examples/event_handling/index.txt +++ /dev/null @@ -1,34 +0,0 @@ -.. _event_handling-examples-index: - -############################################## -event_handling Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - close_event - data_browser - figure_axes_enter_leave - idle_and_timeout - keypress_demo - lasso_demo - legend_picking - looking_glass - path_editor - pick_event_demo - pick_event_demo2 - pipong - poly_editor - pong_gtk - resample - test_mouseclicks - timers - trifinder_event_demo - viewlims - zoom_window diff --git a/_sources/examples/event_handling/keypress_demo.rst.txt b/_sources/examples/event_handling/keypress_demo.rst.txt deleted file mode 100644 index 216e25bfcb1..00000000000 --- a/_sources/examples/event_handling/keypress_demo.rst.txt +++ /dev/null @@ -1,37 +0,0 @@ -.. _event_handling-keypress_demo: - -event_handling example code: keypress_demo.py -============================================= - -[`source code `_] - -:: - - """ - Show how to connect to keypress events - """ - from __future__ import print_function - import sys - import numpy as np - import matplotlib.pyplot as plt - - - def press(event): - print('press', event.key) - sys.stdout.flush() - if event.key == 'x': - visible = xl.get_visible() - xl.set_visible(not visible) - fig.canvas.draw() - - fig, ax = plt.subplots() - - fig.canvas.mpl_connect('key_press_event', press) - - ax.plot(np.random.rand(12), np.random.rand(12), 'go') - xl = ax.set_xlabel('easy come, easy go') - ax.set_title('Press a key') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/keypress_demo.txt b/_sources/examples/event_handling/keypress_demo.txt deleted file mode 100644 index d7561df8d99..00000000000 --- a/_sources/examples/event_handling/keypress_demo.txt +++ /dev/null @@ -1,39 +0,0 @@ -.. _event_handling-keypress_demo: - -event_handling example code: keypress_demo.py -============================================= - -[`source code `_] - -:: - - #!/usr/bin/env python - - """ - Show how to connect to keypress events - """ - from __future__ import print_function - import sys - import numpy as np - import matplotlib.pyplot as plt - - - def press(event): - print('press', event.key) - sys.stdout.flush() - if event.key == 'x': - visible = xl.get_visible() - xl.set_visible(not visible) - fig.canvas.draw() - - fig, ax = plt.subplots() - - fig.canvas.mpl_connect('key_press_event', press) - - ax.plot(np.random.rand(12), np.random.rand(12), 'go') - xl = ax.set_xlabel('easy come, easy go') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/lasso_demo.rst.txt b/_sources/examples/event_handling/lasso_demo.rst.txt deleted file mode 100644 index 02fff64db5a..00000000000 --- a/_sources/examples/event_handling/lasso_demo.rst.txt +++ /dev/null @@ -1,96 +0,0 @@ -.. _event_handling-lasso_demo: - -event_handling example code: lasso_demo.py -========================================== - -[`source code `_] - -:: - - """ - Show how to use a lasso to select a set of points and get the indices - of the selected points. A callback is used to change the color of the - selected points - - This is currently a proof-of-concept implementation (though it is - usable as is). There will be some refinement of the API. - """ - from matplotlib.widgets import Lasso - from matplotlib.collections import RegularPolyCollection - from matplotlib import colors as mcolors, path - - import matplotlib.pyplot as plt - from numpy import nonzero - from numpy.random import rand - - - class Datum(object): - colorin = mcolors.to_rgba("red") - colorout = mcolors.to_rgba("blue") - - def __init__(self, x, y, include=False): - self.x = x - self.y = y - if include: - self.color = self.colorin - else: - self.color = self.colorout - - - class LassoManager(object): - def __init__(self, ax, data): - self.axes = ax - self.canvas = ax.figure.canvas - self.data = data - - self.Nxy = len(data) - - facecolors = [d.color for d in data] - self.xys = [(d.x, d.y) for d in data] - self.collection = RegularPolyCollection( - 6, sizes=(100,), - facecolors=facecolors, - offsets=self.xys, - transOffset=ax.transData) - - ax.add_collection(self.collection) - - self.cid = self.canvas.mpl_connect('button_press_event', self.onpress) - - def callback(self, verts): - facecolors = self.collection.get_facecolors() - p = path.Path(verts) - ind = p.contains_points(self.xys) - for i in range(len(self.xys)): - if ind[i]: - facecolors[i] = Datum.colorin - else: - facecolors[i] = Datum.colorout - - self.canvas.draw_idle() - self.canvas.widgetlock.release(self.lasso) - del self.lasso - - def onpress(self, event): - if self.canvas.widgetlock.locked(): - return - if event.inaxes is None: - return - self.lasso = Lasso(event.inaxes, - (event.xdata, event.ydata), - self.callback) - # acquire a lock on the widget drawing - self.canvas.widgetlock(self.lasso) - - if __name__ == '__main__': - - data = [Datum(*xy) for xy in rand(100, 2)] - ax = plt.axes(xlim=(0, 1), ylim=(0, 1), autoscale_on=False) - ax.set_title('Lasso points using left mouse button') - - lman = LassoManager(ax, data) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/lasso_demo.txt b/_sources/examples/event_handling/lasso_demo.txt deleted file mode 100644 index 23b04b3d9d3..00000000000 --- a/_sources/examples/event_handling/lasso_demo.txt +++ /dev/null @@ -1,97 +0,0 @@ -.. _event_handling-lasso_demo: - -event_handling example code: lasso_demo.py -========================================== - -[`source code `_] - -:: - - """ - Show how to use a lasso to select a set of points and get the indices - of the selected points. A callback is used to change the color of the - selected points - - This is currently a proof-of-concept implementation (though it is - usable as is). There will be some refinement of the API. - """ - from matplotlib.widgets import Lasso - from matplotlib.colors import colorConverter - from matplotlib.collections import RegularPolyCollection - from matplotlib import path - - import matplotlib.pyplot as plt - from numpy import nonzero - from numpy.random import rand - - - class Datum(object): - colorin = colorConverter.to_rgba('red') - colorout = colorConverter.to_rgba('blue') - - def __init__(self, x, y, include=False): - self.x = x - self.y = y - if include: - self.color = self.colorin - else: - self.color = self.colorout - - - class LassoManager(object): - def __init__(self, ax, data): - self.axes = ax - self.canvas = ax.figure.canvas - self.data = data - - self.Nxy = len(data) - - facecolors = [d.color for d in data] - self.xys = [(d.x, d.y) for d in data] - fig = ax.figure - self.collection = RegularPolyCollection( - fig.dpi, 6, sizes=(100,), - facecolors=facecolors, - offsets=self.xys, - transOffset=ax.transData) - - ax.add_collection(self.collection) - - self.cid = self.canvas.mpl_connect('button_press_event', self.onpress) - - def callback(self, verts): - facecolors = self.collection.get_facecolors() - p = path.Path(verts) - ind = p.contains_points(self.xys) - for i in range(len(self.xys)): - if ind[i]: - facecolors[i] = Datum.colorin - else: - facecolors[i] = Datum.colorout - - self.canvas.draw_idle() - self.canvas.widgetlock.release(self.lasso) - del self.lasso - - def onpress(self, event): - if self.canvas.widgetlock.locked(): - return - if event.inaxes is None: - return - self.lasso = Lasso(event.inaxes, - (event.xdata, event.ydata), - self.callback) - # acquire a lock on the widget drawing - self.canvas.widgetlock(self.lasso) - - if __name__ == '__main__': - - data = [Datum(*xy) for xy in rand(100, 2)] - - ax = plt.axes(xlim=(0, 1), ylim=(0, 1), autoscale_on=False) - lman = LassoManager(ax, data) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/legend_picking.rst.txt b/_sources/examples/event_handling/legend_picking.rst.txt deleted file mode 100644 index 86e288ab6c2..00000000000 --- a/_sources/examples/event_handling/legend_picking.rst.txt +++ /dev/null @@ -1,57 +0,0 @@ -.. _event_handling-legend_picking: - -event_handling example code: legend_picking.py -============================================== - -[`source code `_] - -:: - - """ - Enable picking on the legend to toggle the original line on and off - """ - import numpy as np - import matplotlib.pyplot as plt - - t = np.arange(0.0, 0.2, 0.1) - y1 = 2*np.sin(2*np.pi*t) - y2 = 4*np.sin(2*np.pi*2*t) - - fig, ax = plt.subplots() - ax.set_title('Click on legend line to toggle line on/off') - line1, = ax.plot(t, y1, lw=2, color='red', label='1 HZ') - line2, = ax.plot(t, y2, lw=2, color='blue', label='2 HZ') - leg = ax.legend(loc='upper left', fancybox=True, shadow=True) - leg.get_frame().set_alpha(0.4) - - - # we will set up a dict mapping legend line to orig line, and enable - # picking on the legend line - lines = [line1, line2] - lined = dict() - for legline, origline in zip(leg.get_lines(), lines): - legline.set_picker(5) # 5 pts tolerance - lined[legline] = origline - - - def onpick(event): - # on the pick event, find the orig line corresponding to the - # legend proxy line, and toggle the visibility - legline = event.artist - origline = lined[legline] - vis = not origline.get_visible() - origline.set_visible(vis) - # Change the alpha on the line in the legend so we can see what lines - # have been toggled - if vis: - legline.set_alpha(1.0) - else: - legline.set_alpha(0.2) - fig.canvas.draw() - - fig.canvas.mpl_connect('pick_event', onpick) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/legend_picking.txt b/_sources/examples/event_handling/legend_picking.txt deleted file mode 100644 index 827a9247d31..00000000000 --- a/_sources/examples/event_handling/legend_picking.txt +++ /dev/null @@ -1,57 +0,0 @@ -.. _event_handling-legend_picking: - -event_handling example code: legend_picking.py -============================================== - -[`source code `_] - -:: - - """ - Enable picking on the legend to toggle the legended line on and off - """ - import numpy as np - import matplotlib.pyplot as plt - - t = np.arange(0.0, 0.2, 0.1) - y1 = 2*np.sin(2*np.pi*t) - y2 = 4*np.sin(2*np.pi*2*t) - - fig, ax = plt.subplots() - ax.set_title('Click on legend line to toggle line on/off') - line1, = ax.plot(t, y1, lw=2, color='red', label='1 HZ') - line2, = ax.plot(t, y2, lw=2, color='blue', label='2 HZ') - leg = ax.legend(loc='upper left', fancybox=True, shadow=True) - leg.get_frame().set_alpha(0.4) - - - # we will set up a dict mapping legend line to orig line, and enable - # picking on the legend line - lines = [line1, line2] - lined = dict() - for legline, origline in zip(leg.get_lines(), lines): - legline.set_picker(5) # 5 pts tolerance - lined[legline] = origline - - - def onpick(event): - # on the pick event, find the orig line corresponding to the - # legend proxy line, and toggle the visibility - legline = event.artist - origline = lined[legline] - vis = not origline.get_visible() - origline.set_visible(vis) - # Change the alpha on the line in the legend so we can see what lines - # have been toggled - if vis: - legline.set_alpha(1.0) - else: - legline.set_alpha(0.2) - fig.canvas.draw() - - fig.canvas.mpl_connect('pick_event', onpick) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/looking_glass.rst.txt b/_sources/examples/event_handling/looking_glass.rst.txt deleted file mode 100644 index ae8a46ca8d4..00000000000 --- a/_sources/examples/event_handling/looking_glass.rst.txt +++ /dev/null @@ -1,60 +0,0 @@ -.. _event_handling-looking_glass: - -event_handling example code: looking_glass.py -============================================= - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.patches as patches - x, y = np.random.rand(2, 200) - - fig, ax = plt.subplots() - circ = patches.Circle((0.5, 0.5), 0.25, alpha=0.8, fc='yellow') - ax.add_patch(circ) - - - ax.plot(x, y, alpha=0.2) - line, = ax.plot(x, y, alpha=1.0, clip_path=circ) - ax.set_title("Left click and drag to move looking glass") - - - class EventHandler(object): - def __init__(self): - fig.canvas.mpl_connect('button_press_event', self.onpress) - fig.canvas.mpl_connect('button_release_event', self.onrelease) - fig.canvas.mpl_connect('motion_notify_event', self.onmove) - self.x0, self.y0 = circ.center - self.pressevent = None - - def onpress(self, event): - if event.inaxes != ax: - return - - if not circ.contains(event)[0]: - return - - self.pressevent = event - - def onrelease(self, event): - self.pressevent = None - self.x0, self.y0 = circ.center - - def onmove(self, event): - if self.pressevent is None or event.inaxes != self.pressevent.inaxes: - return - - dx = event.xdata - self.pressevent.xdata - dy = event.ydata - self.pressevent.ydata - circ.center = self.x0 + dx, self.y0 + dy - line.set_clip_path(circ) - fig.canvas.draw() - - handler = EventHandler() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/looking_glass.txt b/_sources/examples/event_handling/looking_glass.txt deleted file mode 100644 index 8bbab12cc58..00000000000 --- a/_sources/examples/event_handling/looking_glass.txt +++ /dev/null @@ -1,59 +0,0 @@ -.. _event_handling-looking_glass: - -event_handling example code: looking_glass.py -============================================= - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.patches as patches - x, y = np.random.rand(2, 200) - - fig, ax = plt.subplots() - circ = patches.Circle((0.5, 0.5), 0.25, alpha=0.8, fc='yellow') - ax.add_patch(circ) - - - ax.plot(x, y, alpha=0.2) - line, = ax.plot(x, y, alpha=1.0, clip_path=circ) - - - class EventHandler(object): - def __init__(self): - fig.canvas.mpl_connect('button_press_event', self.onpress) - fig.canvas.mpl_connect('button_release_event', self.onrelease) - fig.canvas.mpl_connect('motion_notify_event', self.onmove) - self.x0, self.y0 = circ.center - self.pressevent = None - - def onpress(self, event): - if event.inaxes != ax: - return - - if not circ.contains(event)[0]: - return - - self.pressevent = event - - def onrelease(self, event): - self.pressevent = None - self.x0, self.y0 = circ.center - - def onmove(self, event): - if self.pressevent is None or event.inaxes != self.pressevent.inaxes: - return - - dx = event.xdata - self.pressevent.xdata - dy = event.ydata - self.pressevent.ydata - circ.center = self.x0 + dx, self.y0 + dy - line.set_clip_path(circ) - fig.canvas.draw() - - handler = EventHandler() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/path_editor.rst.txt b/_sources/examples/event_handling/path_editor.rst.txt deleted file mode 100644 index f0091c93611..00000000000 --- a/_sources/examples/event_handling/path_editor.rst.txt +++ /dev/null @@ -1,161 +0,0 @@ -.. _event_handling-path_editor: - -event_handling example code: path_editor.py -=========================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.path as mpath - import matplotlib.patches as mpatches - import matplotlib.pyplot as plt - - Path = mpath.Path - - fig, ax = plt.subplots() - - pathdata = [ - (Path.MOVETO, (1.58, -2.57)), - (Path.CURVE4, (0.35, -1.1)), - (Path.CURVE4, (-1.75, 2.0)), - (Path.CURVE4, (0.375, 2.0)), - (Path.LINETO, (0.85, 1.15)), - (Path.CURVE4, (2.2, 3.2)), - (Path.CURVE4, (3, 0.05)), - (Path.CURVE4, (2.0, -0.5)), - (Path.CLOSEPOLY, (1.58, -2.57)), - ] - - codes, verts = zip(*pathdata) - path = mpath.Path(verts, codes) - patch = mpatches.PathPatch(path, facecolor='green', edgecolor='yellow', alpha=0.5) - ax.add_patch(patch) - - - class PathInteractor(object): - """ - An path editor. - - Key-bindings - - 't' toggle vertex markers on and off. When vertex markers are on, - you can move them, delete them - - - """ - - showverts = True - epsilon = 5 # max pixel distance to count as a vertex hit - - def __init__(self, pathpatch): - - self.ax = pathpatch.axes - canvas = self.ax.figure.canvas - self.pathpatch = pathpatch - self.pathpatch.set_animated(True) - - x, y = zip(*self.pathpatch.get_path().vertices) - - self.line, = ax.plot(x, y, marker='o', markerfacecolor='r', animated=True) - - self._ind = None # the active vert - - canvas.mpl_connect('draw_event', self.draw_callback) - canvas.mpl_connect('button_press_event', self.button_press_callback) - canvas.mpl_connect('key_press_event', self.key_press_callback) - canvas.mpl_connect('button_release_event', self.button_release_callback) - canvas.mpl_connect('motion_notify_event', self.motion_notify_callback) - self.canvas = canvas - - def draw_callback(self, event): - self.background = self.canvas.copy_from_bbox(self.ax.bbox) - self.ax.draw_artist(self.pathpatch) - self.ax.draw_artist(self.line) - self.canvas.blit(self.ax.bbox) - - def pathpatch_changed(self, pathpatch): - 'this method is called whenever the pathpatchgon object is called' - # only copy the artist props to the line (except visibility) - vis = self.line.get_visible() - plt.Artist.update_from(self.line, pathpatch) - self.line.set_visible(vis) # don't use the pathpatch visibility state - - def get_ind_under_point(self, event): - 'get the index of the vertex under point if within epsilon tolerance' - - # display coords - xy = np.asarray(self.pathpatch.get_path().vertices) - xyt = self.pathpatch.get_transform().transform(xy) - xt, yt = xyt[:, 0], xyt[:, 1] - d = np.sqrt((xt - event.x)**2 + (yt - event.y)**2) - ind = d.argmin() - - if d[ind] >= self.epsilon: - ind = None - - return ind - - def button_press_callback(self, event): - 'whenever a mouse button is pressed' - if not self.showverts: - return - if event.inaxes is None: - return - if event.button != 1: - return - self._ind = self.get_ind_under_point(event) - - def button_release_callback(self, event): - 'whenever a mouse button is released' - if not self.showverts: - return - if event.button != 1: - return - self._ind = None - - def key_press_callback(self, event): - 'whenever a key is pressed' - if not event.inaxes: - return - if event.key == 't': - self.showverts = not self.showverts - self.line.set_visible(self.showverts) - if not self.showverts: - self._ind = None - - self.canvas.draw() - - def motion_notify_callback(self, event): - 'on mouse movement' - if not self.showverts: - return - if self._ind is None: - return - if event.inaxes is None: - return - if event.button != 1: - return - x, y = event.xdata, event.ydata - - vertices = self.pathpatch.get_path().vertices - - vertices[self._ind] = x, y - self.line.set_data(zip(*vertices)) - - self.canvas.restore_region(self.background) - self.ax.draw_artist(self.pathpatch) - self.ax.draw_artist(self.line) - self.canvas.blit(self.ax.bbox) - - - interactor = PathInteractor(patch) - ax.set_title('drag vertices to update path') - ax.set_xlim(-3, 4) - ax.set_ylim(-3, 4) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/path_editor.txt b/_sources/examples/event_handling/path_editor.txt deleted file mode 100644 index f0091c93611..00000000000 --- a/_sources/examples/event_handling/path_editor.txt +++ /dev/null @@ -1,161 +0,0 @@ -.. _event_handling-path_editor: - -event_handling example code: path_editor.py -=========================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.path as mpath - import matplotlib.patches as mpatches - import matplotlib.pyplot as plt - - Path = mpath.Path - - fig, ax = plt.subplots() - - pathdata = [ - (Path.MOVETO, (1.58, -2.57)), - (Path.CURVE4, (0.35, -1.1)), - (Path.CURVE4, (-1.75, 2.0)), - (Path.CURVE4, (0.375, 2.0)), - (Path.LINETO, (0.85, 1.15)), - (Path.CURVE4, (2.2, 3.2)), - (Path.CURVE4, (3, 0.05)), - (Path.CURVE4, (2.0, -0.5)), - (Path.CLOSEPOLY, (1.58, -2.57)), - ] - - codes, verts = zip(*pathdata) - path = mpath.Path(verts, codes) - patch = mpatches.PathPatch(path, facecolor='green', edgecolor='yellow', alpha=0.5) - ax.add_patch(patch) - - - class PathInteractor(object): - """ - An path editor. - - Key-bindings - - 't' toggle vertex markers on and off. When vertex markers are on, - you can move them, delete them - - - """ - - showverts = True - epsilon = 5 # max pixel distance to count as a vertex hit - - def __init__(self, pathpatch): - - self.ax = pathpatch.axes - canvas = self.ax.figure.canvas - self.pathpatch = pathpatch - self.pathpatch.set_animated(True) - - x, y = zip(*self.pathpatch.get_path().vertices) - - self.line, = ax.plot(x, y, marker='o', markerfacecolor='r', animated=True) - - self._ind = None # the active vert - - canvas.mpl_connect('draw_event', self.draw_callback) - canvas.mpl_connect('button_press_event', self.button_press_callback) - canvas.mpl_connect('key_press_event', self.key_press_callback) - canvas.mpl_connect('button_release_event', self.button_release_callback) - canvas.mpl_connect('motion_notify_event', self.motion_notify_callback) - self.canvas = canvas - - def draw_callback(self, event): - self.background = self.canvas.copy_from_bbox(self.ax.bbox) - self.ax.draw_artist(self.pathpatch) - self.ax.draw_artist(self.line) - self.canvas.blit(self.ax.bbox) - - def pathpatch_changed(self, pathpatch): - 'this method is called whenever the pathpatchgon object is called' - # only copy the artist props to the line (except visibility) - vis = self.line.get_visible() - plt.Artist.update_from(self.line, pathpatch) - self.line.set_visible(vis) # don't use the pathpatch visibility state - - def get_ind_under_point(self, event): - 'get the index of the vertex under point if within epsilon tolerance' - - # display coords - xy = np.asarray(self.pathpatch.get_path().vertices) - xyt = self.pathpatch.get_transform().transform(xy) - xt, yt = xyt[:, 0], xyt[:, 1] - d = np.sqrt((xt - event.x)**2 + (yt - event.y)**2) - ind = d.argmin() - - if d[ind] >= self.epsilon: - ind = None - - return ind - - def button_press_callback(self, event): - 'whenever a mouse button is pressed' - if not self.showverts: - return - if event.inaxes is None: - return - if event.button != 1: - return - self._ind = self.get_ind_under_point(event) - - def button_release_callback(self, event): - 'whenever a mouse button is released' - if not self.showverts: - return - if event.button != 1: - return - self._ind = None - - def key_press_callback(self, event): - 'whenever a key is pressed' - if not event.inaxes: - return - if event.key == 't': - self.showverts = not self.showverts - self.line.set_visible(self.showverts) - if not self.showverts: - self._ind = None - - self.canvas.draw() - - def motion_notify_callback(self, event): - 'on mouse movement' - if not self.showverts: - return - if self._ind is None: - return - if event.inaxes is None: - return - if event.button != 1: - return - x, y = event.xdata, event.ydata - - vertices = self.pathpatch.get_path().vertices - - vertices[self._ind] = x, y - self.line.set_data(zip(*vertices)) - - self.canvas.restore_region(self.background) - self.ax.draw_artist(self.pathpatch) - self.ax.draw_artist(self.line) - self.canvas.blit(self.ax.bbox) - - - interactor = PathInteractor(patch) - ax.set_title('drag vertices to update path') - ax.set_xlim(-3, 4) - ax.set_ylim(-3, 4) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/pick_event_demo.rst.txt b/_sources/examples/event_handling/pick_event_demo.rst.txt deleted file mode 100644 index a83f3d04ea5..00000000000 --- a/_sources/examples/event_handling/pick_event_demo.rst.txt +++ /dev/null @@ -1,185 +0,0 @@ -.. _event_handling-pick_event_demo: - -event_handling example code: pick_event_demo.py -=============================================== - -[`source code `_] - -:: - - """ - - You can enable picking by setting the "picker" property of an artist - (for example, a matplotlib Line2D, Text, Patch, Polygon, AxesImage, - etc...) - - There are a variety of meanings of the picker property - - None - picking is disabled for this artist (default) - - boolean - if True then picking will be enabled and the - artist will fire a pick event if the mouse event is over - the artist - - float - if picker is a number it is interpreted as an - epsilon tolerance in points and the artist will fire - off an event if it's data is within epsilon of the mouse - event. For some artists like lines and patch collections, - the artist may provide additional data to the pick event - that is generated, for example, the indices of the data within - epsilon of the pick event - - function - if picker is callable, it is a user supplied - function which determines whether the artist is hit by the - mouse event. - - hit, props = picker(artist, mouseevent) - - to determine the hit test. If the mouse event is over the - artist, return hit=True and props is a dictionary of properties - you want added to the PickEvent attributes - - - After you have enabled an artist for picking by setting the "picker" - property, you need to connect to the figure canvas pick_event to get - pick callbacks on mouse press events. For example, - - def pick_handler(event): - mouseevent = event.mouseevent - artist = event.artist - # now do something with this... - - - The pick event (matplotlib.backend_bases.PickEvent) which is passed to - your callback is always fired with two attributes: - - mouseevent - the mouse event that generate the pick event. The - mouse event in turn has attributes like x and y (the coordinates in - display space, such as pixels from left, bottom) and xdata, ydata (the - coords in data space). Additionally, you can get information about - which buttons were pressed, which keys were pressed, which Axes - the mouse is over, etc. See matplotlib.backend_bases.MouseEvent - for details. - - artist - the matplotlib.artist that generated the pick event. - - Additionally, certain artists like Line2D and PatchCollection may - attach additional meta data like the indices into the data that meet - the picker criteria (for example, all the points in the line that are within - the specified epsilon tolerance) - - The examples below illustrate each of these methods. - """ - - from __future__ import print_function - import matplotlib.pyplot as plt - from matplotlib.lines import Line2D - from matplotlib.patches import Rectangle - from matplotlib.text import Text - from matplotlib.image import AxesImage - import numpy as np - from numpy.random import rand - - if 1: # simple picking, lines, rectangles and text - fig, (ax1, ax2) = plt.subplots(2, 1) - ax1.set_title('click on points, rectangles or text', picker=True) - ax1.set_ylabel('ylabel', picker=True, bbox=dict(facecolor='red')) - line, = ax1.plot(rand(100), 'o', picker=5) # 5 points tolerance - - # pick the rectangle - bars = ax2.bar(range(10), rand(10), picker=True) - for label in ax2.get_xticklabels(): # make the xtick labels pickable - label.set_picker(True) - - def onpick1(event): - if isinstance(event.artist, Line2D): - thisline = event.artist - xdata = thisline.get_xdata() - ydata = thisline.get_ydata() - ind = event.ind - print('onpick1 line:', zip(np.take(xdata, ind), np.take(ydata, ind))) - elif isinstance(event.artist, Rectangle): - patch = event.artist - print('onpick1 patch:', patch.get_path()) - elif isinstance(event.artist, Text): - text = event.artist - print('onpick1 text:', text.get_text()) - - fig.canvas.mpl_connect('pick_event', onpick1) - - if 1: # picking with a custom hit test function - # you can define custom pickers by setting picker to a callable - # function. The function has the signature - # - # hit, props = func(artist, mouseevent) - # - # to determine the hit test. if the mouse event is over the artist, - # return hit=True and props is a dictionary of - # properties you want added to the PickEvent attributes - - def line_picker(line, mouseevent): - """ - find the points within a certain distance from the mouseclick in - data coords and attach some extra attributes, pickx and picky - which are the data points that were picked - """ - if mouseevent.xdata is None: - return False, dict() - xdata = line.get_xdata() - ydata = line.get_ydata() - maxd = 0.05 - d = np.sqrt((xdata - mouseevent.xdata)**2. + (ydata - mouseevent.ydata)**2.) - - ind = np.nonzero(np.less_equal(d, maxd)) - if len(ind): - pickx = np.take(xdata, ind) - picky = np.take(ydata, ind) - props = dict(ind=ind, pickx=pickx, picky=picky) - return True, props - else: - return False, dict() - - def onpick2(event): - print('onpick2 line:', event.pickx, event.picky) - - fig, ax = plt.subplots() - ax.set_title('custom picker for line data') - line, = ax.plot(rand(100), rand(100), 'o', picker=line_picker) - fig.canvas.mpl_connect('pick_event', onpick2) - - - if 1: # picking on a scatter plot (matplotlib.collections.RegularPolyCollection) - - x, y, c, s = rand(4, 100) - - def onpick3(event): - ind = event.ind - print('onpick3 scatter:', ind, np.take(x, ind), np.take(y, ind)) - - fig, ax = plt.subplots() - col = ax.scatter(x, y, 100*s, c, picker=True) - #fig.savefig('pscoll.eps') - fig.canvas.mpl_connect('pick_event', onpick3) - - if 1: # picking images (matplotlib.image.AxesImage) - fig, ax = plt.subplots() - im1 = ax.imshow(rand(10, 5), extent=(1, 2, 1, 2), picker=True) - im2 = ax.imshow(rand(5, 10), extent=(3, 4, 1, 2), picker=True) - im3 = ax.imshow(rand(20, 25), extent=(1, 2, 3, 4), picker=True) - im4 = ax.imshow(rand(30, 12), extent=(3, 4, 3, 4), picker=True) - ax.axis([0, 5, 0, 5]) - - def onpick4(event): - artist = event.artist - if isinstance(artist, AxesImage): - im = artist - A = im.get_array() - print('onpick4 image', A.shape) - - fig.canvas.mpl_connect('pick_event', onpick4) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/pick_event_demo.txt b/_sources/examples/event_handling/pick_event_demo.txt deleted file mode 100644 index e0566b37329..00000000000 --- a/_sources/examples/event_handling/pick_event_demo.txt +++ /dev/null @@ -1,187 +0,0 @@ -.. _event_handling-pick_event_demo: - -event_handling example code: pick_event_demo.py -=============================================== - -[`source code `_] - -:: - - #!/usr/bin/env python - - """ - - You can enable picking by setting the "picker" property of an artist - (for example, a matplotlib Line2D, Text, Patch, Polygon, AxesImage, - etc...) - - There are a variety of meanings of the picker property - - None - picking is disabled for this artist (default) - - boolean - if True then picking will be enabled and the - artist will fire a pick event if the mouse event is over - the artist - - float - if picker is a number it is interpreted as an - epsilon tolerance in points and the artist will fire - off an event if it's data is within epsilon of the mouse - event. For some artists like lines and patch collections, - the artist may provide additional data to the pick event - that is generated, for example, the indices of the data within - epsilon of the pick event - - function - if picker is callable, it is a user supplied - function which determines whether the artist is hit by the - mouse event. - - hit, props = picker(artist, mouseevent) - - to determine the hit test. If the mouse event is over the - artist, return hit=True and props is a dictionary of properties - you want added to the PickEvent attributes - - - After you have enabled an artist for picking by setting the "picker" - property, you need to connect to the figure canvas pick_event to get - pick callbacks on mouse press events. For example, - - def pick_handler(event): - mouseevent = event.mouseevent - artist = event.artist - # now do something with this... - - - The pick event (matplotlib.backend_bases.PickEvent) which is passed to - your callback is always fired with two attributes: - - mouseevent - the mouse event that generate the pick event. The - mouse event in turn has attributes like x and y (the coordinates in - display space, such as pixels from left, bottom) and xdata, ydata (the - coords in data space). Additionally, you can get information about - which buttons were pressed, which keys were pressed, which Axes - the mouse is over, etc. See matplotlib.backend_bases.MouseEvent - for details. - - artist - the matplotlib.artist that generated the pick event. - - Additionally, certain artists like Line2D and PatchCollection may - attach additional meta data like the indices into the data that meet - the picker criteria (for example, all the points in the line that are within - the specified epsilon tolerance) - - The examples below illustrate each of these methods. - """ - - from __future__ import print_function - import matplotlib.pyplot as plt - from matplotlib.lines import Line2D - from matplotlib.patches import Rectangle - from matplotlib.text import Text - from matplotlib.image import AxesImage - import numpy as np - from numpy.random import rand - - if 1: # simple picking, lines, rectangles and text - fig, (ax1, ax2) = plt.subplots(2, 1) - ax1.set_title('click on points, rectangles or text', picker=True) - ax1.set_ylabel('ylabel', picker=True, bbox=dict(facecolor='red')) - line, = ax1.plot(rand(100), 'o', picker=5) # 5 points tolerance - - # pick the rectangle - bars = ax2.bar(range(10), rand(10), picker=True) - for label in ax2.get_xticklabels(): # make the xtick labels pickable - label.set_picker(True) - - def onpick1(event): - if isinstance(event.artist, Line2D): - thisline = event.artist - xdata = thisline.get_xdata() - ydata = thisline.get_ydata() - ind = event.ind - print('onpick1 line:', zip(np.take(xdata, ind), np.take(ydata, ind))) - elif isinstance(event.artist, Rectangle): - patch = event.artist - print('onpick1 patch:', patch.get_path()) - elif isinstance(event.artist, Text): - text = event.artist - print('onpick1 text:', text.get_text()) - - fig.canvas.mpl_connect('pick_event', onpick1) - - if 1: # picking with a custom hit test function - # you can define custom pickers by setting picker to a callable - # function. The function has the signature - # - # hit, props = func(artist, mouseevent) - # - # to determine the hit test. if the mouse event is over the artist, - # return hit=True and props is a dictionary of - # properties you want added to the PickEvent attributes - - def line_picker(line, mouseevent): - """ - find the points within a certain distance from the mouseclick in - data coords and attach some extra attributes, pickx and picky - which are the data points that were picked - """ - if mouseevent.xdata is None: - return False, dict() - xdata = line.get_xdata() - ydata = line.get_ydata() - maxd = 0.05 - d = np.sqrt((xdata - mouseevent.xdata)**2. + (ydata - mouseevent.ydata)**2.) - - ind = np.nonzero(np.less_equal(d, maxd)) - if len(ind): - pickx = np.take(xdata, ind) - picky = np.take(ydata, ind) - props = dict(ind=ind, pickx=pickx, picky=picky) - return True, props - else: - return False, dict() - - def onpick2(event): - print('onpick2 line:', event.pickx, event.picky) - - fig, ax = plt.subplots() - ax.set_title('custom picker for line data') - line, = ax.plot(rand(100), rand(100), 'o', picker=line_picker) - fig.canvas.mpl_connect('pick_event', onpick2) - - - if 1: # picking on a scatter plot (matplotlib.collections.RegularPolyCollection) - - x, y, c, s = rand(4, 100) - - def onpick3(event): - ind = event.ind - print('onpick3 scatter:', ind, np.take(x, ind), np.take(y, ind)) - - fig, ax = plt.subplots() - col = ax.scatter(x, y, 100*s, c, picker=True) - #fig.savefig('pscoll.eps') - fig.canvas.mpl_connect('pick_event', onpick3) - - if 1: # picking images (matplotlib.image.AxesImage) - fig, ax = plt.subplots() - im1 = ax.imshow(rand(10, 5), extent=(1, 2, 1, 2), picker=True) - im2 = ax.imshow(rand(5, 10), extent=(3, 4, 1, 2), picker=True) - im3 = ax.imshow(rand(20, 25), extent=(1, 2, 3, 4), picker=True) - im4 = ax.imshow(rand(30, 12), extent=(3, 4, 3, 4), picker=True) - ax.axis([0, 5, 0, 5]) - - def onpick4(event): - artist = event.artist - if isinstance(artist, AxesImage): - im = artist - A = im.get_array() - print('onpick4 image', A.shape) - - fig.canvas.mpl_connect('pick_event', onpick4) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/pick_event_demo2.rst.txt b/_sources/examples/event_handling/pick_event_demo2.rst.txt deleted file mode 100644 index 61f1c68e646..00000000000 --- a/_sources/examples/event_handling/pick_event_demo2.rst.txt +++ /dev/null @@ -1,52 +0,0 @@ -.. _event_handling-pick_event_demo2: - -event_handling example code: pick_event_demo2.py -================================================ - -[`source code `_] - -:: - - """ - compute the mean and standard deviation (stddev) of 100 data sets and plot - mean vs stddev. When you click on one of the mu, sigma points, plot the raw - data from the dataset that generated the mean and stddev. - """ - import numpy - import matplotlib.pyplot as plt - - - X = numpy.random.rand(100, 1000) - xs = numpy.mean(X, axis=1) - ys = numpy.std(X, axis=1) - - fig, ax = plt.subplots() - ax.set_title('click on point to plot time series') - line, = ax.plot(xs, ys, 'o', picker=5) # 5 points tolerance - - - def onpick(event): - - if event.artist != line: - return True - - N = len(event.ind) - if not N: - return True - - figi = plt.figure() - for subplotnum, dataind in enumerate(event.ind): - ax = figi.add_subplot(N, 1, subplotnum + 1) - ax.plot(X[dataind]) - ax.text(0.05, 0.9, 'mu=%1.3f\nsigma=%1.3f' % (xs[dataind], ys[dataind]), - transform=ax.transAxes, va='top') - ax.set_ylim(-0.5, 1.5) - figi.show() - return True - - fig.canvas.mpl_connect('pick_event', onpick) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/pick_event_demo2.txt b/_sources/examples/event_handling/pick_event_demo2.txt deleted file mode 100644 index 61f1c68e646..00000000000 --- a/_sources/examples/event_handling/pick_event_demo2.txt +++ /dev/null @@ -1,52 +0,0 @@ -.. _event_handling-pick_event_demo2: - -event_handling example code: pick_event_demo2.py -================================================ - -[`source code `_] - -:: - - """ - compute the mean and standard deviation (stddev) of 100 data sets and plot - mean vs stddev. When you click on one of the mu, sigma points, plot the raw - data from the dataset that generated the mean and stddev. - """ - import numpy - import matplotlib.pyplot as plt - - - X = numpy.random.rand(100, 1000) - xs = numpy.mean(X, axis=1) - ys = numpy.std(X, axis=1) - - fig, ax = plt.subplots() - ax.set_title('click on point to plot time series') - line, = ax.plot(xs, ys, 'o', picker=5) # 5 points tolerance - - - def onpick(event): - - if event.artist != line: - return True - - N = len(event.ind) - if not N: - return True - - figi = plt.figure() - for subplotnum, dataind in enumerate(event.ind): - ax = figi.add_subplot(N, 1, subplotnum + 1) - ax.plot(X[dataind]) - ax.text(0.05, 0.9, 'mu=%1.3f\nsigma=%1.3f' % (xs[dataind], ys[dataind]), - transform=ax.transAxes, va='top') - ax.set_ylim(-0.5, 1.5) - figi.show() - return True - - fig.canvas.mpl_connect('pick_event', onpick) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/pipong.rst.txt b/_sources/examples/event_handling/pipong.rst.txt deleted file mode 100644 index d8d1d3230e3..00000000000 --- a/_sources/examples/event_handling/pipong.rst.txt +++ /dev/null @@ -1,277 +0,0 @@ -.. _event_handling-pipong: - -event_handling example code: pipong.py -====================================== - -[`source code `_] - -:: - - # A matplotlib based game of Pong illustrating one way to write interactive - # animation which are easily ported to multiple backends - # pipong.py was written by Paul Ivanov - - from __future__ import print_function - - import numpy as np - import matplotlib.pyplot as plt - from numpy.random import randn, randint - - instructions = """ - Player A: Player B: - 'e' up 'i' - 'd' down 'k' - - press 't' -- close these instructions - (animation will be much faster) - press 'a' -- add a puck - press 'A' -- remove a puck - press '1' -- slow down all pucks - press '2' -- speed up all pucks - press '3' -- slow down distractors - press '4' -- speed up distractors - press ' ' -- reset the first puck - press 'n' -- toggle distractors on/off - press 'g' -- toggle the game on/off - - """ - - - class Pad(object): - def __init__(self, disp, x, y, type='l'): - self.disp = disp - self.x = x - self.y = y - self.w = .3 - self.score = 0 - self.xoffset = 0.3 - self.yoffset = 0.1 - if type == 'r': - self.xoffset *= -1.0 - - if type == 'l' or type == 'r': - self.signx = -1.0 - self.signy = 1.0 - else: - self.signx = 1.0 - self.signy = -1.0 - - def contains(self, loc): - return self.disp.get_bbox().contains(loc.x, loc.y) - - - class Puck(object): - def __init__(self, disp, pad, field): - self.vmax = .2 - self.disp = disp - self.field = field - self._reset(pad) - - def _reset(self, pad): - self.x = pad.x + pad.xoffset - if pad.y < 0: - self.y = pad.y + pad.yoffset - else: - self.y = pad.y - pad.yoffset - self.vx = pad.x - self.x - self.vy = pad.y + pad.w/2 - self.y - self._speedlimit() - self._slower() - self._slower() - - def update(self, pads): - self.x += self.vx - self.y += self.vy - for pad in pads: - if pad.contains(self): - self.vx *= 1.2 * pad.signx - self.vy *= 1.2 * pad.signy - fudge = .001 - # probably cleaner with something like... - #if not self.field.contains(self.x, self.y): - if self.x < fudge: - #print("player A loses") - pads[1].score += 1 - self._reset(pads[0]) - return True - if self.x > 7 - fudge: - #print("player B loses") - pads[0].score += 1 - self._reset(pads[1]) - return True - if self.y < -1 + fudge or self.y > 1 - fudge: - self.vy *= -1.0 - # add some randomness, just to make it interesting - self.vy -= (randn()/300.0 + 1/300.0) * np.sign(self.vy) - self._speedlimit() - return False - - def _slower(self): - self.vx /= 5.0 - self.vy /= 5.0 - - def _faster(self): - self.vx *= 5.0 - self.vy *= 5.0 - - def _speedlimit(self): - if self.vx > self.vmax: - self.vx = self.vmax - if self.vx < -self.vmax: - self.vx = -self.vmax - - if self.vy > self.vmax: - self.vy = self.vmax - if self.vy < -self.vmax: - self.vy = -self.vmax - - - class Game(object): - def __init__(self, ax): - # create the initial line - self.ax = ax - padAx = padBx = .50 - padAy = padBy = .30 - padBx += 6.3 - pA, = self.ax.barh(padAy, .2, height=.3, color='k', alpha=.5, edgecolor='b', lw=2, label="Player B", animated=True) - pB, = self.ax.barh(padBy, .2, height=.3, left=padBx, color='k', alpha=.5, edgecolor='r', lw=2, label="Player A", animated=True) - - # distractors - self.x = np.arange(0, 2.22*np.pi, 0.01) - self.line, = self.ax.plot(self.x, np.sin(self.x), "r", animated=True, lw=4) - self.line2, = self.ax.plot(self.x, np.cos(self.x), "g", animated=True, lw=4) - self.line3, = self.ax.plot(self.x, np.cos(self.x), "g", animated=True, lw=4) - self.line4, = self.ax.plot(self.x, np.cos(self.x), "r", animated=True, lw=4) - self.centerline, = self.ax.plot([3.5, 3.5], [1, -1], 'k', alpha=.5, animated=True, lw=8) - self.puckdisp = self.ax.scatter([1], [1], label='_nolegend_', s=200, c='g', alpha=.9, animated=True) - - self.canvas = self.ax.figure.canvas - self.background = None - self.cnt = 0 - self.distract = True - self.res = 100.0 - self.on = False - self.inst = True # show instructions from the beginning - self.background = None - self.pads = [] - self.pads.append(Pad(pA, 0, padAy)) - self.pads.append(Pad(pB, padBx, padBy, 'r')) - self.pucks = [] - self.i = self.ax.annotate(instructions, (.5, 0.5), - name='monospace', - verticalalignment='center', - horizontalalignment='center', - multialignment='left', - textcoords='axes fraction', animated=True) - self.canvas.mpl_connect('key_press_event', self.key_press) - - def draw(self, evt): - draw_artist = self.ax.draw_artist - if self.background is None: - self.background = self.canvas.copy_from_bbox(self.ax.bbox) - - # restore the clean slate background - self.canvas.restore_region(self.background) - - # show the distractors - if self.distract: - self.line.set_ydata(np.sin(self.x + self.cnt/self.res)) - self.line2.set_ydata(np.cos(self.x - self.cnt/self.res)) - self.line3.set_ydata(np.tan(self.x + self.cnt/self.res)) - self.line4.set_ydata(np.tan(self.x - self.cnt/self.res)) - draw_artist(self.line) - draw_artist(self.line2) - draw_artist(self.line3) - draw_artist(self.line4) - - # show the instructions - this is very slow - if self.inst: - self.ax.draw_artist(self.i) - - # pucks and pads - if self.on: - self.ax.draw_artist(self.centerline) - for pad in self.pads: - pad.disp.set_y(pad.y) - pad.disp.set_x(pad.x) - self.ax.draw_artist(pad.disp) - - for puck in self.pucks: - if puck.update(self.pads): - # we only get here if someone scored - self.pads[0].disp.set_label(" " + str(self.pads[0].score)) - self.pads[1].disp.set_label(" " + str(self.pads[1].score)) - self.ax.legend(loc='center') - self.leg = self.ax.get_legend() - #self.leg.draw_frame(False) #don't draw the legend border - self.leg.get_frame().set_alpha(.2) - plt.setp(self.leg.get_texts(), fontweight='bold', fontsize='xx-large') - self.leg.get_frame().set_facecolor('0.2') - self.background = None - self.ax.figure.canvas.draw() - return True - puck.disp.set_offsets([puck.x, puck.y]) - self.ax.draw_artist(puck.disp) - - # just redraw the axes rectangle - self.canvas.blit(self.ax.bbox) - - if self.cnt == 50000: - # just so we don't get carried away - print("...and you've been playing for too long!!!") - plt.close() - - self.cnt += 1 - return True - - def key_press(self, event): - if event.key == '3': - self.res *= 5.0 - if event.key == '4': - self.res /= 5.0 - - if event.key == 'e': - self.pads[0].y += .1 - if self.pads[0].y > 1 - .3: - self.pads[0].y = 1 - .3 - if event.key == 'd': - self.pads[0].y -= .1 - if self.pads[0].y < -1: - self.pads[0].y = -1 - - if event.key == 'i': - self.pads[1].y += .1 - if self.pads[1].y > 1 - .3: - self.pads[1].y = 1 - .3 - if event.key == 'k': - self.pads[1].y -= .1 - if self.pads[1].y < -1: - self.pads[1].y = -1 - - if event.key == 'a': - self.pucks.append(Puck(self.puckdisp, self.pads[randint(2)], self.ax.bbox)) - if event.key == 'A' and len(self.pucks): - self.pucks.pop() - if event.key == ' ' and len(self.pucks): - self.pucks[0]._reset(self.pads[randint(2)]) - if event.key == '1': - for p in self.pucks: - p._slower() - if event.key == '2': - for p in self.pucks: - p._faster() - - if event.key == 'n': - self.distract = not self.distract - - if event.key == 'g': - #self.ax.clear() - self.on = not self.on - if event.key == 't': - self.inst = not self.inst - self.i.set_visible(self.i.get_visible()) - if event.key == 'q': - plt.close() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/pipong.txt b/_sources/examples/event_handling/pipong.txt deleted file mode 100644 index aff5c98c0cf..00000000000 --- a/_sources/examples/event_handling/pipong.txt +++ /dev/null @@ -1,278 +0,0 @@ -.. _event_handling-pipong: - -event_handling example code: pipong.py -====================================== - -[`source code `_] - -:: - - #!/usr/bin/env python - # A matplotlib based game of Pong illustrating one way to write interactive - # animation which are easily ported to multiple backends - # pipong.py was written by Paul Ivanov - - from __future__ import print_function - - import numpy as np - import matplotlib.pyplot as plt - from numpy.random import randn, randint - - instructions = """ - Player A: Player B: - 'e' up 'i' - 'd' down 'k' - - press 't' -- close these instructions - (animation will be much faster) - press 'a' -- add a puck - press 'A' -- remove a puck - press '1' -- slow down all pucks - press '2' -- speed up all pucks - press '3' -- slow down distractors - press '4' -- speed up distractors - press ' ' -- reset the first puck - press 'n' -- toggle distractors on/off - press 'g' -- toggle the game on/off - - """ - - - class Pad(object): - def __init__(self, disp, x, y, type='l'): - self.disp = disp - self.x = x - self.y = y - self.w = .3 - self.score = 0 - self.xoffset = 0.3 - self.yoffset = 0.1 - if type == 'r': - self.xoffset *= -1.0 - - if type == 'l' or type == 'r': - self.signx = -1.0 - self.signy = 1.0 - else: - self.signx = 1.0 - self.signy = -1.0 - - def contains(self, loc): - return self.disp.get_bbox().contains(loc.x, loc.y) - - - class Puck(object): - def __init__(self, disp, pad, field): - self.vmax = .2 - self.disp = disp - self.field = field - self._reset(pad) - - def _reset(self, pad): - self.x = pad.x + pad.xoffset - if pad.y < 0: - self.y = pad.y + pad.yoffset - else: - self.y = pad.y - pad.yoffset - self.vx = pad.x - self.x - self.vy = pad.y + pad.w/2 - self.y - self._speedlimit() - self._slower() - self._slower() - - def update(self, pads): - self.x += self.vx - self.y += self.vy - for pad in pads: - if pad.contains(self): - self.vx *= 1.2 * pad.signx - self.vy *= 1.2 * pad.signy - fudge = .001 - # probably cleaner with something like... - #if not self.field.contains(self.x, self.y): - if self.x < fudge: - #print("player A loses") - pads[1].score += 1 - self._reset(pads[0]) - return True - if self.x > 7 - fudge: - #print("player B loses") - pads[0].score += 1 - self._reset(pads[1]) - return True - if self.y < -1 + fudge or self.y > 1 - fudge: - self.vy *= -1.0 - # add some randomness, just to make it interesting - self.vy -= (randn()/300.0 + 1/300.0) * np.sign(self.vy) - self._speedlimit() - return False - - def _slower(self): - self.vx /= 5.0 - self.vy /= 5.0 - - def _faster(self): - self.vx *= 5.0 - self.vy *= 5.0 - - def _speedlimit(self): - if self.vx > self.vmax: - self.vx = self.vmax - if self.vx < -self.vmax: - self.vx = -self.vmax - - if self.vy > self.vmax: - self.vy = self.vmax - if self.vy < -self.vmax: - self.vy = -self.vmax - - - class Game(object): - def __init__(self, ax): - # create the initial line - self.ax = ax - padAx = padBx = .50 - padAy = padBy = .30 - padBx += 6.3 - pA, = self.ax.barh(padAy, .2, height=.3, color='k', alpha=.5, edgecolor='b', lw=2, label="Player B", animated=True) - pB, = self.ax.barh(padBy, .2, height=.3, left=padBx, color='k', alpha=.5, edgecolor='r', lw=2, label="Player A", animated=True) - - # distractors - self.x = np.arange(0, 2.22*np.pi, 0.01) - self.line, = self.ax.plot(self.x, np.sin(self.x), "r", animated=True, lw=4) - self.line2, = self.ax.plot(self.x, np.cos(self.x), "g", animated=True, lw=4) - self.line3, = self.ax.plot(self.x, np.cos(self.x), "g", animated=True, lw=4) - self.line4, = self.ax.plot(self.x, np.cos(self.x), "r", animated=True, lw=4) - self.centerline, = self.ax.plot([3.5, 3.5], [1, -1], 'k', alpha=.5, animated=True, lw=8) - self.puckdisp = self.ax.scatter([1], [1], label='_nolegend_', s=200, c='g', alpha=.9, animated=True) - - self.canvas = self.ax.figure.canvas - self.background = None - self.cnt = 0 - self.distract = True - self.res = 100.0 - self.on = False - self.inst = True # show instructions from the beginning - self.background = None - self.pads = [] - self.pads.append(Pad(pA, 0, padAy)) - self.pads.append(Pad(pB, padBx, padBy, 'r')) - self.pucks = [] - self.i = self.ax.annotate(instructions, (.5, 0.5), - name='monospace', - verticalalignment='center', - horizontalalignment='center', - multialignment='left', - textcoords='axes fraction', animated=True) - self.canvas.mpl_connect('key_press_event', self.key_press) - - def draw(self, evt): - draw_artist = self.ax.draw_artist - if self.background is None: - self.background = self.canvas.copy_from_bbox(self.ax.bbox) - - # restore the clean slate background - self.canvas.restore_region(self.background) - - # show the distractors - if self.distract: - self.line.set_ydata(np.sin(self.x + self.cnt/self.res)) - self.line2.set_ydata(np.cos(self.x - self.cnt/self.res)) - self.line3.set_ydata(np.tan(self.x + self.cnt/self.res)) - self.line4.set_ydata(np.tan(self.x - self.cnt/self.res)) - draw_artist(self.line) - draw_artist(self.line2) - draw_artist(self.line3) - draw_artist(self.line4) - - # show the instructions - this is very slow - if self.inst: - self.ax.draw_artist(self.i) - - # pucks and pads - if self.on: - self.ax.draw_artist(self.centerline) - for pad in self.pads: - pad.disp.set_y(pad.y) - pad.disp.set_x(pad.x) - self.ax.draw_artist(pad.disp) - - for puck in self.pucks: - if puck.update(self.pads): - # we only get here if someone scored - self.pads[0].disp.set_label(" " + str(self.pads[0].score)) - self.pads[1].disp.set_label(" " + str(self.pads[1].score)) - self.ax.legend(loc='center') - self.leg = self.ax.get_legend() - #self.leg.draw_frame(False) #don't draw the legend border - self.leg.get_frame().set_alpha(.2) - plt.setp(self.leg.get_texts(), fontweight='bold', fontsize='xx-large') - self.leg.get_frame().set_facecolor('0.2') - self.background = None - self.ax.figure.canvas.draw() - return True - puck.disp.set_offsets([puck.x, puck.y]) - self.ax.draw_artist(puck.disp) - - # just redraw the axes rectangle - self.canvas.blit(self.ax.bbox) - - if self.cnt == 50000: - # just so we don't get carried away - print("...and you've been playing for too long!!!") - plt.close() - - self.cnt += 1 - return True - - def key_press(self, event): - if event.key == '3': - self.res *= 5.0 - if event.key == '4': - self.res /= 5.0 - - if event.key == 'e': - self.pads[0].y += .1 - if self.pads[0].y > 1 - .3: - self.pads[0].y = 1 - .3 - if event.key == 'd': - self.pads[0].y -= .1 - if self.pads[0].y < -1: - self.pads[0].y = -1 - - if event.key == 'i': - self.pads[1].y += .1 - if self.pads[1].y > 1 - .3: - self.pads[1].y = 1 - .3 - if event.key == 'k': - self.pads[1].y -= .1 - if self.pads[1].y < -1: - self.pads[1].y = -1 - - if event.key == 'a': - self.pucks.append(Puck(self.puckdisp, self.pads[randint(2)], self.ax.bbox)) - if event.key == 'A' and len(self.pucks): - self.pucks.pop() - if event.key == ' ' and len(self.pucks): - self.pucks[0]._reset(self.pads[randint(2)]) - if event.key == '1': - for p in self.pucks: - p._slower() - if event.key == '2': - for p in self.pucks: - p._faster() - - if event.key == 'n': - self.distract = not self.distract - - if event.key == 'g': - #self.ax.clear() - self.on = not self.on - if event.key == 't': - self.inst = not self.inst - self.i.set_visible(self.i.get_visible()) - if event.key == 'q': - plt.close() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/poly_editor.rst.txt b/_sources/examples/event_handling/poly_editor.rst.txt deleted file mode 100644 index 8f37c6ab3b5..00000000000 --- a/_sources/examples/event_handling/poly_editor.rst.txt +++ /dev/null @@ -1,188 +0,0 @@ -.. _event_handling-poly_editor: - -event_handling example code: poly_editor.py -=========================================== - -[`source code `_] - -:: - - """ - This is an example to show how to build cross-GUI applications using - matplotlib event handling to interact with objects on the canvas - - """ - import numpy as np - from matplotlib.lines import Line2D - from matplotlib.artist import Artist - from matplotlib.mlab import dist_point_to_segment - - - class PolygonInteractor(object): - """ - An polygon editor. - - Key-bindings - - 't' toggle vertex markers on and off. When vertex markers are on, - you can move them, delete them - - 'd' delete the vertex under point - - 'i' insert a vertex at point. You must be within epsilon of the - line connecting two existing vertices - - """ - - showverts = True - epsilon = 5 # max pixel distance to count as a vertex hit - - def __init__(self, ax, poly): - if poly.figure is None: - raise RuntimeError('You must first add the polygon to a figure or canvas before defining the interactor') - self.ax = ax - canvas = poly.figure.canvas - self.poly = poly - - x, y = zip(*self.poly.xy) - self.line = Line2D(x, y, marker='o', markerfacecolor='r', animated=True) - self.ax.add_line(self.line) - #self._update_line(poly) - - cid = self.poly.add_callback(self.poly_changed) - self._ind = None # the active vert - - canvas.mpl_connect('draw_event', self.draw_callback) - canvas.mpl_connect('button_press_event', self.button_press_callback) - canvas.mpl_connect('key_press_event', self.key_press_callback) - canvas.mpl_connect('button_release_event', self.button_release_callback) - canvas.mpl_connect('motion_notify_event', self.motion_notify_callback) - self.canvas = canvas - - def draw_callback(self, event): - self.background = self.canvas.copy_from_bbox(self.ax.bbox) - self.ax.draw_artist(self.poly) - self.ax.draw_artist(self.line) - self.canvas.blit(self.ax.bbox) - - def poly_changed(self, poly): - 'this method is called whenever the polygon object is called' - # only copy the artist props to the line (except visibility) - vis = self.line.get_visible() - Artist.update_from(self.line, poly) - self.line.set_visible(vis) # don't use the poly visibility state - - def get_ind_under_point(self, event): - 'get the index of the vertex under point if within epsilon tolerance' - - # display coords - xy = np.asarray(self.poly.xy) - xyt = self.poly.get_transform().transform(xy) - xt, yt = xyt[:, 0], xyt[:, 1] - d = np.sqrt((xt - event.x)**2 + (yt - event.y)**2) - indseq = np.nonzero(np.equal(d, np.amin(d)))[0] - ind = indseq[0] - - if d[ind] >= self.epsilon: - ind = None - - return ind - - def button_press_callback(self, event): - 'whenever a mouse button is pressed' - if not self.showverts: - return - if event.inaxes is None: - return - if event.button != 1: - return - self._ind = self.get_ind_under_point(event) - - def button_release_callback(self, event): - 'whenever a mouse button is released' - if not self.showverts: - return - if event.button != 1: - return - self._ind = None - - def key_press_callback(self, event): - 'whenever a key is pressed' - if not event.inaxes: - return - if event.key == 't': - self.showverts = not self.showverts - self.line.set_visible(self.showverts) - if not self.showverts: - self._ind = None - elif event.key == 'd': - ind = self.get_ind_under_point(event) - if ind is not None: - self.poly.xy = [tup for i, tup in enumerate(self.poly.xy) if i != ind] - self.line.set_data(zip(*self.poly.xy)) - elif event.key == 'i': - xys = self.poly.get_transform().transform(self.poly.xy) - p = event.x, event.y # display coords - for i in range(len(xys) - 1): - s0 = xys[i] - s1 = xys[i + 1] - d = dist_point_to_segment(p, s0, s1) - if d <= self.epsilon: - self.poly.xy = np.array( - list(self.poly.xy[:i]) + - [(event.xdata, event.ydata)] + - list(self.poly.xy[i:])) - self.line.set_data(zip(*self.poly.xy)) - break - - self.canvas.draw() - - def motion_notify_callback(self, event): - 'on mouse movement' - if not self.showverts: - return - if self._ind is None: - return - if event.inaxes is None: - return - if event.button != 1: - return - x, y = event.xdata, event.ydata - - self.poly.xy[self._ind] = x, y - if self._ind == 0: - self.poly.xy[-1] = x, y - elif self._ind == len(self.poly.xy) - 1: - self.poly.xy[0] = x, y - self.line.set_data(zip(*self.poly.xy)) - - self.canvas.restore_region(self.background) - self.ax.draw_artist(self.poly) - self.ax.draw_artist(self.line) - self.canvas.blit(self.ax.bbox) - - - if __name__ == '__main__': - import matplotlib.pyplot as plt - from matplotlib.patches import Polygon - - theta = np.arange(0, 2*np.pi, 0.1) - r = 1.5 - - xs = r*np.cos(theta) - ys = r*np.sin(theta) - - poly = Polygon(list(zip(xs, ys)), animated=True) - - fig, ax = plt.subplots() - ax.add_patch(poly) - p = PolygonInteractor(ax, poly) - - #ax.add_line(p.line) - ax.set_title('Click and drag a point to move it') - ax.set_xlim((-2, 2)) - ax.set_ylim((-2, 2)) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/poly_editor.txt b/_sources/examples/event_handling/poly_editor.txt deleted file mode 100644 index e72bd6e7288..00000000000 --- a/_sources/examples/event_handling/poly_editor.txt +++ /dev/null @@ -1,184 +0,0 @@ -.. _event_handling-poly_editor: - -event_handling example code: poly_editor.py -=========================================== - -[`source code `_] - -:: - - """ - This is an example to show how to build cross-GUI applications using - matplotlib event handling to interact with objects on the canvas - - """ - import numpy as np - from matplotlib.lines import Line2D - from matplotlib.artist import Artist - from matplotlib.mlab import dist_point_to_segment - - - class PolygonInteractor(object): - """ - An polygon editor. - - Key-bindings - - 't' toggle vertex markers on and off. When vertex markers are on, - you can move them, delete them - - 'd' delete the vertex under point - - 'i' insert a vertex at point. You must be within epsilon of the - line connecting two existing vertices - - """ - - showverts = True - epsilon = 5 # max pixel distance to count as a vertex hit - - def __init__(self, ax, poly): - if poly.figure is None: - raise RuntimeError('You must first add the polygon to a figure or canvas before defining the interactor') - self.ax = ax - canvas = poly.figure.canvas - self.poly = poly - - x, y = zip(*self.poly.xy) - self.line = Line2D(x, y, marker='o', markerfacecolor='r', animated=True) - self.ax.add_line(self.line) - #self._update_line(poly) - - cid = self.poly.add_callback(self.poly_changed) - self._ind = None # the active vert - - canvas.mpl_connect('draw_event', self.draw_callback) - canvas.mpl_connect('button_press_event', self.button_press_callback) - canvas.mpl_connect('key_press_event', self.key_press_callback) - canvas.mpl_connect('button_release_event', self.button_release_callback) - canvas.mpl_connect('motion_notify_event', self.motion_notify_callback) - self.canvas = canvas - - def draw_callback(self, event): - self.background = self.canvas.copy_from_bbox(self.ax.bbox) - self.ax.draw_artist(self.poly) - self.ax.draw_artist(self.line) - self.canvas.blit(self.ax.bbox) - - def poly_changed(self, poly): - 'this method is called whenever the polygon object is called' - # only copy the artist props to the line (except visibility) - vis = self.line.get_visible() - Artist.update_from(self.line, poly) - self.line.set_visible(vis) # don't use the poly visibility state - - def get_ind_under_point(self, event): - 'get the index of the vertex under point if within epsilon tolerance' - - # display coords - xy = np.asarray(self.poly.xy) - xyt = self.poly.get_transform().transform(xy) - xt, yt = xyt[:, 0], xyt[:, 1] - d = np.sqrt((xt - event.x)**2 + (yt - event.y)**2) - indseq = np.nonzero(np.equal(d, np.amin(d)))[0] - ind = indseq[0] - - if d[ind] >= self.epsilon: - ind = None - - return ind - - def button_press_callback(self, event): - 'whenever a mouse button is pressed' - if not self.showverts: - return - if event.inaxes is None: - return - if event.button != 1: - return - self._ind = self.get_ind_under_point(event) - - def button_release_callback(self, event): - 'whenever a mouse button is released' - if not self.showverts: - return - if event.button != 1: - return - self._ind = None - - def key_press_callback(self, event): - 'whenever a key is pressed' - if not event.inaxes: - return - if event.key == 't': - self.showverts = not self.showverts - self.line.set_visible(self.showverts) - if not self.showverts: - self._ind = None - elif event.key == 'd': - ind = self.get_ind_under_point(event) - if ind is not None: - self.poly.xy = [tup for i, tup in enumerate(self.poly.xy) if i != ind] - self.line.set_data(zip(*self.poly.xy)) - elif event.key == 'i': - xys = self.poly.get_transform().transform(self.poly.xy) - p = event.x, event.y # display coords - for i in range(len(xys) - 1): - s0 = xys[i] - s1 = xys[i + 1] - d = dist_point_to_segment(p, s0, s1) - if d <= self.epsilon: - self.poly.xy = np.array( - list(self.poly.xy[:i]) + - [(event.xdata, event.ydata)] + - list(self.poly.xy[i:])) - self.line.set_data(zip(*self.poly.xy)) - break - - self.canvas.draw() - - def motion_notify_callback(self, event): - 'on mouse movement' - if not self.showverts: - return - if self._ind is None: - return - if event.inaxes is None: - return - if event.button != 1: - return - x, y = event.xdata, event.ydata - - self.poly.xy[self._ind] = x, y - self.line.set_data(zip(*self.poly.xy)) - - self.canvas.restore_region(self.background) - self.ax.draw_artist(self.poly) - self.ax.draw_artist(self.line) - self.canvas.blit(self.ax.bbox) - - - if __name__ == '__main__': - import matplotlib.pyplot as plt - from matplotlib.patches import Polygon - - theta = np.arange(0, 2*np.pi, 0.1) - r = 1.5 - - xs = r*np.cos(theta) - ys = r*np.sin(theta) - - poly = Polygon(list(zip(xs, ys)), animated=True) - - fig, ax = plt.subplots() - ax.add_patch(poly) - p = PolygonInteractor(ax, poly) - - #ax.add_line(p.line) - ax.set_title('Click and drag a point to move it') - ax.set_xlim((-2, 2)) - ax.set_ylim((-2, 2)) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/pong_gtk.rst.txt b/_sources/examples/event_handling/pong_gtk.rst.txt deleted file mode 100644 index 3303079f013..00000000000 --- a/_sources/examples/event_handling/pong_gtk.rst.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _event_handling-pong_gtk: - -event_handling example code: pong_gtk.py -======================================== - -[`source code `_] - -:: - - from __future__ import print_function - - # For detailed comments on animation and the techniques used here, see - # the wiki entry - # http://www.scipy.org/wikis/topical_software/MatplotlibAnimation - import time - - import gobject - - import matplotlib - matplotlib.use('GTKAgg') - - import matplotlib.pyplot as plt - import pipong - - - fig, ax = plt.subplots() - canvas = ax.figure.canvas - - - def start_anim(event): - # gobject.idle_add(animation.draw,animation) - gobject.timeout_add(10, animation.draw, animation) - canvas.mpl_disconnect(start_anim.cid) - - animation = pipong.Game(ax) - start_anim.cid = canvas.mpl_connect('draw_event', start_anim) - - - tstart = time.time() - plt.grid() # to ensure proper background restore - plt.show() - print('FPS: %f' % animation.cnt/(time.time() - tstart)) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/pong_gtk.txt b/_sources/examples/event_handling/pong_gtk.txt deleted file mode 100644 index fcce7f84f4e..00000000000 --- a/_sources/examples/event_handling/pong_gtk.txt +++ /dev/null @@ -1,47 +0,0 @@ -.. _event_handling-pong_gtk: - -event_handling example code: pong_gtk.py -======================================== - -[`source code `_] - -:: - - #!/usr/bin/env python - - from __future__ import print_function - - # For detailed comments on animation and the techniques used here, see - # the wiki entry - # http://www.scipy.org/wikis/topical_software/MatplotlibAnimation - import time - - import gobject - - import matplotlib - matplotlib.use('GTKAgg') - - import matplotlib.pyplot as plt - import pipong - - - fig, ax = plt.subplots() - canvas = ax.figure.canvas - - - def start_anim(event): - # gobject.idle_add(animation.draw,animation) - gobject.timeout_add(10, animation.draw, animation) - canvas.mpl_disconnect(start_anim.cid) - - animation = pipong.Game(ax) - start_anim.cid = canvas.mpl_connect('draw_event', start_anim) - - - tstart = time.time() - plt.grid() # to ensure proper background restore - plt.show() - print('FPS: %f' % animation.cnt/(time.time() - tstart)) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/pong_qt.txt b/_sources/examples/event_handling/pong_qt.txt deleted file mode 100644 index b084a7ada58..00000000000 --- a/_sources/examples/event_handling/pong_qt.txt +++ /dev/null @@ -1,52 +0,0 @@ -.. _event_handling-pong_qt: - -event_handling example code: pong_qt.py -======================================= - -[`source code `_] - -:: - - # For detailed comments on animation and the techniqes used here, see - # the wiki entry http://www.scipy.org/Cookbook/Matplotlib/Animations - - from __future__ import print_function - - import matplotlib - matplotlib.use('QtAgg') # qt3 example - - from qt import * - # Note: color-intensive applications may require a different color allocation - # strategy. - QApplication.setColorSpec(QApplication.NormalColor) - - TRUE = 1 - FALSE = 0 - ITERS = 1000 - - import matplotlib.pyplot as plt - import time - import pipong - - class BlitQT(QObject): - def __init__(self): - QObject.__init__(self, None, "app") - - self.ax = plt.subplot(111) - self.animation = pipong.Game(self.ax) - - def timerEvent(self, evt): - self.animation.draw(evt) - - plt.grid() # to ensure proper background restore - - app = BlitQT() - # for profiling - app.tstart = time.time() - app.startTimer(10) - - plt.show() - print('FPS:' , app.animation.cnt/(time.time()-app.tstart)) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/resample.rst.txt b/_sources/examples/event_handling/resample.rst.txt deleted file mode 100644 index d2220ee98f5..00000000000 --- a/_sources/examples/event_handling/resample.rst.txt +++ /dev/null @@ -1,61 +0,0 @@ -.. _event_handling-resample: - -event_handling example code: resample.py -======================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - - - # A class that will downsample the data and recompute when zoomed. - class DataDisplayDownsampler(object): - def __init__(self, xdata, ydata): - self.origYData = ydata - self.origXData = xdata - self.ratio = 5 - self.delta = xdata[-1] - xdata[0] - - def downsample(self, xstart, xend): - # Very simple downsampling that takes the points within the range - # and picks every Nth point - mask = (self.origXData > xstart) & (self.origXData < xend) - xdata = self.origXData[mask] - xdata = xdata[::self.ratio] - - ydata = self.origYData[mask] - ydata = ydata[::self.ratio] - - return xdata, ydata - - def update(self, ax): - # Update the line - lims = ax.viewLim - if np.abs(lims.width - self.delta) > 1e-8: - self.delta = lims.width - xstart, xend = lims.intervalx - self.line.set_data(*self.downsample(xstart, xend)) - ax.figure.canvas.draw_idle() - - # Create a signal - xdata = np.linspace(16, 365, 365-16) - ydata = np.sin(2*np.pi*xdata/153) + np.cos(2*np.pi*xdata/127) - - d = DataDisplayDownsampler(xdata, ydata) - - fig, ax = plt.subplots() - - # Hook up the line - d.line, = ax.plot(xdata, ydata, 'o-') - ax.set_autoscale_on(False) # Otherwise, infinite loop - - # Connect for changing the view limits - ax.callbacks.connect('xlim_changed', d.update) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/resample.txt b/_sources/examples/event_handling/resample.txt deleted file mode 100644 index 8797d88c139..00000000000 --- a/_sources/examples/event_handling/resample.txt +++ /dev/null @@ -1,65 +0,0 @@ -.. _event_handling-resample: - -event_handling example code: resample.py -======================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - from scikits.audiolab import wavread - - - # A class that will downsample the data and recompute when zoomed. - class DataDisplayDownsampler(object): - def __init__(self, xdata, ydata): - self.origYData = ydata - self.origXData = xdata - self.numpts = 3000 - self.delta = xdata[-1] - xdata[0] - - def resample(self, xstart, xend): - # Very simple downsampling that takes the points within the range - # and picks every Nth point - mask = (self.origXData > xstart) & (self.origXData < xend) - xdata = self.origXData[mask] - ratio = int(xdata.size / self.numpts) + 1 - xdata = xdata[::ratio] - - ydata = self.origYData[mask] - ydata = ydata[::ratio] - - return xdata, ydata - - def update(self, ax): - # Update the line - lims = ax.viewLim - if np.abs(lims.width - self.delta) > 1e-8: - self.delta = lims.width - xstart, xend = lims.intervalx - self.line.set_data(*self.downsample(xstart, xend)) - ax.figure.canvas.draw_idle() - - # Read data - data = wavread('/usr/share/sounds/purple/receive.wav')[0] - ydata = np.tile(data[:, 0], 100) - xdata = np.arange(ydata.size) - - d = DataDisplayDownsampler(xdata, ydata) - - fig, ax = plt.subplots() - - # Hook up the line - xdata, ydata = d.downsample(xdata[0], xdata[-1]) - d.line, = ax.plot(xdata, ydata) - ax.set_autoscale_on(False) # Otherwise, infinite loop - - # Connect for changing the view limits - ax.callbacks.connect('xlim_changed', d.update) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/test_mouseclicks.rst.txt b/_sources/examples/event_handling/test_mouseclicks.rst.txt deleted file mode 100644 index 0397eccea1e..00000000000 --- a/_sources/examples/event_handling/test_mouseclicks.rst.txt +++ /dev/null @@ -1,44 +0,0 @@ -.. _event_handling-test_mouseclicks: - -event_handling example code: test_mouseclicks.py -================================================ - -[`source code `_] - -:: - - from __future__ import print_function - - import matplotlib - #matplotlib.use("WxAgg") - #matplotlib.use("TkAgg") - #matplotlib.use("GTKAgg") - #matplotlib.use("Qt4Agg") - #matplotlib.use("MacOSX") - import matplotlib.pyplot as plt - - #print("***** TESTING WITH BACKEND: %s"%matplotlib.get_backend() + " *****") - - - def OnClick(event): - if event.dblclick: - print("DBLCLICK", event) - else: - print("DOWN ", event) - - - def OnRelease(event): - print("UP ", event) - - - fig = plt.gcf() - cid_up = fig.canvas.mpl_connect('button_press_event', OnClick) - cid_down = fig.canvas.mpl_connect('button_release_event', OnRelease) - - plt.gca().text(0.5, 0.5, "Click on the canvas to test mouse events.", - ha="center", va="center") - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/test_mouseclicks.txt b/_sources/examples/event_handling/test_mouseclicks.txt deleted file mode 100644 index 7f4c7194d67..00000000000 --- a/_sources/examples/event_handling/test_mouseclicks.txt +++ /dev/null @@ -1,46 +0,0 @@ -.. _event_handling-test_mouseclicks: - -event_handling example code: test_mouseclicks.py -================================================ - -[`source code `_] - -:: - - #!/usr/bin/env python - from __future__ import print_function - - import matplotlib - #matplotlib.use("WxAgg") - #matplotlib.use("TkAgg") - #matplotlib.use("GTKAgg") - #matplotlib.use("Qt4Agg") - #matplotlib.use("CocoaAgg") - #matplotlib.use("MacOSX") - import matplotlib.pyplot as plt - - #print("***** TESTING WITH BACKEND: %s"%matplotlib.get_backend() + " *****") - - - def OnClick(event): - if event.dblclick: - print("DBLCLICK", event) - else: - print("DOWN ", event) - - - def OnRelease(event): - print("UP ", event) - - - fig = plt.gcf() - cid_up = fig.canvas.mpl_connect('button_press_event', OnClick) - cid_down = fig.canvas.mpl_connect('button_release_event', OnRelease) - - plt.gca().text(0.5, 0.5, "Click on the canvas to test mouse events.", - ha="center", va="center") - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/timers.rst.txt b/_sources/examples/event_handling/timers.rst.txt deleted file mode 100644 index b4b9bceec9f..00000000000 --- a/_sources/examples/event_handling/timers.rst.txt +++ /dev/null @@ -1,41 +0,0 @@ -.. _event_handling-timers: - -event_handling example code: timers.py -====================================== - -[`source code `_] - -:: - - # Simple example of using general timer objects. This is used to update - # the time placed in the title of the figure. - import matplotlib.pyplot as plt - import numpy as np - from datetime import datetime - - - def update_title(axes): - axes.set_title(datetime.now()) - axes.figure.canvas.draw() - - fig, ax = plt.subplots() - - x = np.linspace(-3, 3) - ax.plot(x, x*x) - - # Create a new timer object. Set the interval to 100 milliseconds - # (1000 is default) and tell the timer what function should be called. - timer = fig.canvas.new_timer(interval=100) - timer.add_callback(update_title, ax) - timer.start() - - # Or could start the timer on first figure draw - #def start_timer(evt): - # timer.start() - # fig.canvas.mpl_disconnect(drawid) - #drawid = fig.canvas.mpl_connect('draw_event', start_timer) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/timers.txt b/_sources/examples/event_handling/timers.txt deleted file mode 100644 index b4b9bceec9f..00000000000 --- a/_sources/examples/event_handling/timers.txt +++ /dev/null @@ -1,41 +0,0 @@ -.. _event_handling-timers: - -event_handling example code: timers.py -====================================== - -[`source code `_] - -:: - - # Simple example of using general timer objects. This is used to update - # the time placed in the title of the figure. - import matplotlib.pyplot as plt - import numpy as np - from datetime import datetime - - - def update_title(axes): - axes.set_title(datetime.now()) - axes.figure.canvas.draw() - - fig, ax = plt.subplots() - - x = np.linspace(-3, 3) - ax.plot(x, x*x) - - # Create a new timer object. Set the interval to 100 milliseconds - # (1000 is default) and tell the timer what function should be called. - timer = fig.canvas.new_timer(interval=100) - timer.add_callback(update_title, ax) - timer.start() - - # Or could start the timer on first figure draw - #def start_timer(evt): - # timer.start() - # fig.canvas.mpl_disconnect(drawid) - #drawid = fig.canvas.mpl_connect('draw_event', start_timer) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/trifinder_event_demo.rst.txt b/_sources/examples/event_handling/trifinder_event_demo.rst.txt deleted file mode 100644 index f8d709766f8..00000000000 --- a/_sources/examples/event_handling/trifinder_event_demo.rst.txt +++ /dev/null @@ -1,71 +0,0 @@ -.. _event_handling-trifinder_event_demo: - -event_handling example code: trifinder_event_demo.py -==================================================== - -[`source code `_] - -:: - - """ - Example showing the use of a TriFinder object. As the mouse is moved over the - triangulation, the triangle under the cursor is highlighted and the index of - the triangle is displayed in the plot title. - """ - import matplotlib.pyplot as plt - from matplotlib.tri import Triangulation - from matplotlib.patches import Polygon - import numpy as np - import math - - - def update_polygon(tri): - if tri == -1: - points = [0, 0, 0] - else: - points = triangulation.triangles[tri] - xs = triangulation.x[points] - ys = triangulation.y[points] - polygon.set_xy(list(zip(xs, ys))) - - - def motion_notify(event): - if event.inaxes is None: - tri = -1 - else: - tri = trifinder(event.xdata, event.ydata) - update_polygon(tri) - plt.title('In triangle %i' % tri) - event.canvas.draw() - - - # Create a Triangulation. - n_angles = 16 - n_radii = 5 - min_radius = 0.25 - radii = np.linspace(min_radius, 0.95, n_radii) - angles = np.linspace(0, 2*math.pi, n_angles, endpoint=False) - angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) - angles[:, 1::2] += math.pi / n_angles - x = (radii*np.cos(angles)).flatten() - y = (radii*np.sin(angles)).flatten() - triangulation = Triangulation(x, y) - xmid = x[triangulation.triangles].mean(axis=1) - ymid = y[triangulation.triangles].mean(axis=1) - mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0) - triangulation.set_mask(mask) - - # Use the triangulation's default TriFinder object. - trifinder = triangulation.get_trifinder() - - # Setup plot and callbacks. - plt.subplot(111, aspect='equal') - plt.triplot(triangulation, 'bo-') - polygon = Polygon([[0, 0], [0, 0]], facecolor='y') # dummy data for xs,ys - update_polygon(-1) - plt.gca().add_patch(polygon) - plt.gcf().canvas.mpl_connect('motion_notify_event', motion_notify) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/trifinder_event_demo.txt b/_sources/examples/event_handling/trifinder_event_demo.txt deleted file mode 100644 index 7e534e2ecce..00000000000 --- a/_sources/examples/event_handling/trifinder_event_demo.txt +++ /dev/null @@ -1,71 +0,0 @@ -.. _event_handling-trifinder_event_demo: - -event_handling example code: trifinder_event_demo.py -==================================================== - -[`source code `_] - -:: - - """ - Example showing the use of a TriFinder object. As the mouse is moved over the - triangulation, the triangle under the cursor is highlighted and the index of - the triangle is displayed in the plot title. - """ - import matplotlib.pyplot as plt - from matplotlib.tri import Triangulation - from matplotlib.patches import Polygon - import numpy as np - import math - - - def update_polygon(tri): - if tri == -1: - points = [0, 0, 0] - else: - points = triangulation.triangles[tri] - xs = triangulation.x[points] - ys = triangulation.y[points] - polygon.set_xy(zip(xs, ys)) - - - def motion_notify(event): - if event.inaxes is None: - tri = -1 - else: - tri = trifinder(event.xdata, event.ydata) - update_polygon(tri) - plt.title('In triangle %i' % tri) - event.canvas.draw() - - - # Create a Triangulation. - n_angles = 16 - n_radii = 5 - min_radius = 0.25 - radii = np.linspace(min_radius, 0.95, n_radii) - angles = np.linspace(0, 2*math.pi, n_angles, endpoint=False) - angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) - angles[:, 1::2] += math.pi / n_angles - x = (radii*np.cos(angles)).flatten() - y = (radii*np.sin(angles)).flatten() - triangulation = Triangulation(x, y) - xmid = x[triangulation.triangles].mean(axis=1) - ymid = y[triangulation.triangles].mean(axis=1) - mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0) - triangulation.set_mask(mask) - - # Use the triangulation's default TriFinder object. - trifinder = triangulation.get_trifinder() - - # Setup plot and callbacks. - plt.subplot(111, aspect='equal') - plt.triplot(triangulation, 'bo-') - polygon = Polygon([[0, 0], [0, 0]], facecolor='y') # dummy data for xs,ys - update_polygon(-1) - plt.gca().add_patch(polygon) - plt.gcf().canvas.mpl_connect('motion_notify_event', motion_notify) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/viewlims.rst.txt b/_sources/examples/event_handling/viewlims.rst.txt deleted file mode 100644 index a2407a2393a..00000000000 --- a/_sources/examples/event_handling/viewlims.rst.txt +++ /dev/null @@ -1,91 +0,0 @@ -.. _event_handling-viewlims: - -event_handling example code: viewlims.py -======================================== - -[`source code `_] - -:: - - # Creates two identical panels. Zooming in on the right panel will show - # a rectangle in the first panel, denoting the zoomed region. - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.patches import Rectangle - - - # We just subclass Rectangle so that it can be called with an Axes - # instance, causing the rectangle to update its shape to match the - # bounds of the Axes - class UpdatingRect(Rectangle): - def __call__(self, ax): - self.set_bounds(*ax.viewLim.bounds) - ax.figure.canvas.draw_idle() - - - # A class that will regenerate a fractal set as we zoom in, so that you - # can actually see the increasing detail. A box in the left panel will show - # the area to which we are zoomed. - class MandelbrotDisplay(object): - def __init__(self, h=500, w=500, niter=50, radius=2., power=2): - self.height = h - self.width = w - self.niter = niter - self.radius = radius - self.power = power - - def __call__(self, xstart, xend, ystart, yend): - self.x = np.linspace(xstart, xend, self.width) - self.y = np.linspace(ystart, yend, self.height).reshape(-1, 1) - c = self.x + 1.0j * self.y - threshold_time = np.zeros((self.height, self.width)) - z = np.zeros(threshold_time.shape, dtype=np.complex) - mask = np.ones(threshold_time.shape, dtype=np.bool) - for i in range(self.niter): - z[mask] = z[mask]**self.power + c[mask] - mask = (np.abs(z) < self.radius) - threshold_time += mask - return threshold_time - - def ax_update(self, ax): - ax.set_autoscale_on(False) # Otherwise, infinite loop - - # Get the number of points from the number of pixels in the window - dims = ax.axesPatch.get_window_extent().bounds - self.width = int(dims[2] + 0.5) - self.height = int(dims[2] + 0.5) - - # Get the range for the new area - xstart, ystart, xdelta, ydelta = ax.viewLim.bounds - xend = xstart + xdelta - yend = ystart + ydelta - - # Update the image object with our new data and extent - im = ax.images[-1] - im.set_data(self.__call__(xstart, xend, ystart, yend)) - im.set_extent((xstart, xend, ystart, yend)) - ax.figure.canvas.draw_idle() - - md = MandelbrotDisplay() - Z = md(-2., 0.5, -1.25, 1.25) - - fig1, (ax1, ax2) = plt.subplots(1, 2) - ax1.imshow(Z, origin='lower', extent=(md.x.min(), md.x.max(), md.y.min(), md.y.max())) - ax2.imshow(Z, origin='lower', extent=(md.x.min(), md.x.max(), md.y.min(), md.y.max())) - - rect = UpdatingRect([0, 0], 0, 0, facecolor='None', edgecolor='black', linewidth=1.0) - rect.set_bounds(*ax2.viewLim.bounds) - ax1.add_patch(rect) - - # Connect for changing the view limits - ax2.callbacks.connect('xlim_changed', rect) - ax2.callbacks.connect('ylim_changed', rect) - - ax2.callbacks.connect('xlim_changed', md.ax_update) - ax2.callbacks.connect('ylim_changed', md.ax_update) - ax2.set_title("Zoom here") - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/viewlims.txt b/_sources/examples/event_handling/viewlims.txt deleted file mode 100644 index 3c78b883a0d..00000000000 --- a/_sources/examples/event_handling/viewlims.txt +++ /dev/null @@ -1,90 +0,0 @@ -.. _event_handling-viewlims: - -event_handling example code: viewlims.py -======================================== - -[`source code `_] - -:: - - # Creates two identical panels. Zooming in on the right panel will show - # a rectangle in the first panel, denoting the zoomed region. - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.patches import Rectangle - - - # We just subclass Rectangle so that it can be called with an Axes - # instance, causing the rectangle to update its shape to match the - # bounds of the Axes - class UpdatingRect(Rectangle): - def __call__(self, ax): - self.set_bounds(*ax.viewLim.bounds) - ax.figure.canvas.draw_idle() - - - # A class that will regenerate a fractal set as we zoom in, so that you - # can actually see the increasing detail. A box in the left panel will show - # the area to which we are zoomed. - class MandlebrotDisplay(object): - def __init__(self, h=500, w=500, niter=50, radius=2., power=2): - self.height = h - self.width = w - self.niter = niter - self.radius = radius - self.power = power - - def __call__(self, xstart, xend, ystart, yend): - self.x = np.linspace(xstart, xend, self.width) - self.y = np.linspace(ystart, yend, self.height).reshape(-1, 1) - c = self.x + 1.0j * self.y - threshold_time = np.zeros((self.height, self.width)) - z = np.zeros(threshold_time.shape, dtype=np.complex) - mask = np.ones(threshold_time.shape, dtype=np.bool) - for i in range(self.niter): - z[mask] = z[mask]**self.power + c[mask] - mask = (np.abs(z) < self.radius) - threshold_time += mask - return threshold_time - - def ax_update(self, ax): - ax.set_autoscale_on(False) # Otherwise, infinite loop - - # Get the number of points from the number of pixels in the window - dims = ax.axesPatch.get_window_extent().bounds - self.width = int(dims[2] + 0.5) - self.height = int(dims[2] + 0.5) - - # Get the range for the new area - xstart, ystart, xdelta, ydelta = ax.viewLim.bounds - xend = xstart + xdelta - yend = ystart + ydelta - - # Update the image object with our new data and extent - im = ax.images[-1] - im.set_data(self.__call__(xstart, xend, ystart, yend)) - im.set_extent((xstart, xend, ystart, yend)) - ax.figure.canvas.draw_idle() - - md = MandlebrotDisplay() - Z = md(-2., 0.5, -1.25, 1.25) - - fig1, (ax1, ax2) = plt.subplots(1, 2) - ax1.imshow(Z, origin='lower', extent=(md.x.min(), md.x.max(), md.y.min(), md.y.max())) - ax2.imshow(Z, origin='lower', extent=(md.x.min(), md.x.max(), md.y.min(), md.y.max())) - - rect = UpdatingRect([0, 0], 0, 0, facecolor='None', edgecolor='black') - rect.set_bounds(*ax2.viewLim.bounds) - ax1.add_patch(rect) - - # Connect for changing the view limits - ax2.callbacks.connect('xlim_changed', rect) - ax2.callbacks.connect('ylim_changed', rect) - - ax2.callbacks.connect('xlim_changed', md.ax_update) - ax2.callbacks.connect('ylim_changed', md.ax_update) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/zoom_window.rst.txt b/_sources/examples/event_handling/zoom_window.rst.txt deleted file mode 100644 index 7b0937aa50c..00000000000 --- a/_sources/examples/event_handling/zoom_window.rst.txt +++ /dev/null @@ -1,51 +0,0 @@ -.. _event_handling-zoom_window: - -event_handling example code: zoom_window.py -=========================================== - -[`source code `_] - -:: - - """ - This example shows how to connect events in one window, for example, a mouse - press, to another figure window. - - If you click on a point in the first window, the z and y limits of the - second will be adjusted so that the center of the zoom in the second - window will be the x,y coordinates of the clicked point. - - Note the diameter of the circles in the scatter are defined in - points**2, so their size is independent of the zoom - """ - from matplotlib.pyplot import figure, show - import numpy - figsrc = figure() - figzoom = figure() - - axsrc = figsrc.add_subplot(111, xlim=(0, 1), ylim=(0, 1), autoscale_on=False) - axzoom = figzoom.add_subplot(111, xlim=(0.45, 0.55), ylim=(0.4, .6), - autoscale_on=False) - axsrc.set_title('Click to zoom') - axzoom.set_title('zoom window') - x, y, s, c = numpy.random.rand(4, 200) - s *= 200 - - - axsrc.scatter(x, y, s, c) - axzoom.scatter(x, y, s, c) - - - def onpress(event): - if event.button != 1: - return - x, y = event.xdata, event.ydata - axzoom.set_xlim(x - 0.1, x + 0.1) - axzoom.set_ylim(y - 0.1, y + 0.1) - figzoom.canvas.draw() - - figsrc.canvas.mpl_connect('button_press_event', onpress) - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/event_handling/zoom_window.txt b/_sources/examples/event_handling/zoom_window.txt deleted file mode 100644 index 7b0937aa50c..00000000000 --- a/_sources/examples/event_handling/zoom_window.txt +++ /dev/null @@ -1,51 +0,0 @@ -.. _event_handling-zoom_window: - -event_handling example code: zoom_window.py -=========================================== - -[`source code `_] - -:: - - """ - This example shows how to connect events in one window, for example, a mouse - press, to another figure window. - - If you click on a point in the first window, the z and y limits of the - second will be adjusted so that the center of the zoom in the second - window will be the x,y coordinates of the clicked point. - - Note the diameter of the circles in the scatter are defined in - points**2, so their size is independent of the zoom - """ - from matplotlib.pyplot import figure, show - import numpy - figsrc = figure() - figzoom = figure() - - axsrc = figsrc.add_subplot(111, xlim=(0, 1), ylim=(0, 1), autoscale_on=False) - axzoom = figzoom.add_subplot(111, xlim=(0.45, 0.55), ylim=(0.4, .6), - autoscale_on=False) - axsrc.set_title('Click to zoom') - axzoom.set_title('zoom window') - x, y, s, c = numpy.random.rand(4, 200) - s *= 200 - - - axsrc.scatter(x, y, s, c) - axzoom.scatter(x, y, s, c) - - - def onpress(event): - if event.button != 1: - return - x, y = event.xdata, event.ydata - axzoom.set_xlim(x - 0.1, x + 0.1) - axzoom.set_ylim(y - 0.1, y + 0.1) - figzoom.canvas.draw() - - figsrc.canvas.mpl_connect('button_press_event', onpress) - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/frontpage/index.rst.txt b/_sources/examples/frontpage/index.rst.txt deleted file mode 100644 index 76880b4ecf5..00000000000 --- a/_sources/examples/frontpage/index.rst.txt +++ /dev/null @@ -1,18 +0,0 @@ -.. _frontpage-examples-index: - -############################################## -frontpage Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - plot_3D - plot_contour - plot_histogram - plot_membrane diff --git a/_sources/examples/frontpage/plot_3D.rst.txt b/_sources/examples/frontpage/plot_3D.rst.txt deleted file mode 100644 index 659e47320f0..00000000000 --- a/_sources/examples/frontpage/plot_3D.rst.txt +++ /dev/null @@ -1,50 +0,0 @@ -.. _frontpage-plot_3D: - -frontpage example code: plot_3D.py -================================== - -[`source code `_] - -:: - - """ - ==================== - Frontpage 3D example - ==================== - - This example reproduces the frontpage 3D example. - - """ - from mpl_toolkits.mplot3d import Axes3D - from matplotlib import cbook - from matplotlib import cm - from matplotlib.colors import LightSource - import matplotlib.pyplot as plt - import numpy as np - - filename = cbook.get_sample_data('jacksboro_fault_dem.npz', asfileobj=False) - with np.load(filename) as dem: - z = dem['elevation'] - nrows, ncols = z.shape - x = np.linspace(dem['xmin'], dem['xmax'], ncols) - y = np.linspace(dem['ymin'], dem['ymax'], nrows) - x, y = np.meshgrid(x, y) - - region = np.s_[5:50, 5:50] - x, y, z = x[region], y[region], z[region] - - fig, ax = plt.subplots(subplot_kw=dict(projection='3d')) - - ls = LightSource(270, 45) - # To use a custom hillshading mode, override the built-in shading and pass - # in the rgb colors of the shaded surface calculated from "shade". - rgb = ls.shade(z, cmap=cm.gist_earth, vert_exag=0.1, blend_mode='soft') - surf = ax.plot_surface(x, y, z, rstride=1, cstride=1, facecolors=rgb, - linewidth=0, antialiased=False, shade=False) - ax.set_xticks([]) - ax.set_yticks([]) - ax.set_zticks([]) - fig.savefig("surface3d_frontpage.png", dpi=25) # results in 160x120 px image - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/frontpage/plot_contour.rst.txt b/_sources/examples/frontpage/plot_contour.rst.txt deleted file mode 100644 index 2b487a5a7f5..00000000000 --- a/_sources/examples/frontpage/plot_contour.rst.txt +++ /dev/null @@ -1,46 +0,0 @@ -.. _frontpage-plot_contour: - -frontpage example code: plot_contour.py -======================================= - -[`source code `_] - -:: - - """ - ========================= - Frontpage contour example - ========================= - - This example reproduces the frontpage contour example. - """ - - import matplotlib.pyplot as plt - import numpy as np - from matplotlib import mlab, cm - - extent = (-3, 3, -3, 3) - - delta = 0.5 - x = np.arange(-3.0, 4.001, delta) - y = np.arange(-4.0, 3.001, delta) - X, Y = np.meshgrid(x, y) - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, -0.5) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - Z = (Z1 - Z2) * 10 - - levels = np.linspace(-2.0, 1.601, 40) - norm = cm.colors.Normalize(vmax=abs(Z).max(), vmin=-abs(Z).max()) - - fig, ax = plt.subplots() - cset1 = ax.contourf( - X, Y, Z, levels, - norm=norm) - ax.set_xlim(-3, 3) - ax.set_ylim(-3, 3) - ax.set_xticks([]) - ax.set_yticks([]) - fig.savefig("contour_frontpage.png", dpi=25) # results in 160x120 px image - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/frontpage/plot_histogram.rst.txt b/_sources/examples/frontpage/plot_histogram.rst.txt deleted file mode 100644 index 6e381e6a4f5..00000000000 --- a/_sources/examples/frontpage/plot_histogram.rst.txt +++ /dev/null @@ -1,34 +0,0 @@ -.. _frontpage-plot_histogram: - -frontpage example code: plot_histogram.py -========================================= - -[`source code `_] - -:: - - """ - =========================== - Frontpage histogram example - =========================== - - This example reproduces the frontpage histogram example. - """ - - import matplotlib.pyplot as plt - import numpy as np - - - random_state = np.random.RandomState(19680801) - X = random_state.randn(10000) - - fig, ax = plt.subplots() - ax.hist(X, bins=25, normed=True) - x = np.linspace(-5, 5, 1000) - ax.plot(x, 1 / np.sqrt(2*np.pi) * np.exp(-(x**2)/2), linewidth=4) - ax.set_xticks([]) - ax.set_yticks([]) - fig.savefig("histogram_frontpage.png", dpi=25) # results in 160x120 px image - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/frontpage/plot_membrane.rst.txt b/_sources/examples/frontpage/plot_membrane.rst.txt deleted file mode 100644 index 3463c2f5989..00000000000 --- a/_sources/examples/frontpage/plot_membrane.rst.txt +++ /dev/null @@ -1,37 +0,0 @@ -.. _frontpage-plot_membrane: - -frontpage example code: plot_membrane.py -======================================== - -[`source code `_] - -:: - - """ - ====================== - Frontpage plot example - ====================== - - - This example reproduces the frontpage simple plot example. - """ - - import matplotlib.pyplot as plt - import matplotlib.cbook as cbook - import numpy as np - - - datafile = cbook.get_sample_data('membrane.dat', asfileobj=False) - x = np.fromfile(datafile, np.float32) - # 0.0005 is the sample interval - - fig, ax = plt.subplots() - ax.plot(x, linewidth=4) - ax.set_xlim(5000, 6000) - ax.set_ylim(-0.6, 0.1) - ax.set_xticks([]) - ax.set_yticks([]) - fig.savefig("membrane_frontpage.png", dpi=25) # results in 160x120 px image - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/images_contours_and_fields/contourf_log.rst.txt b/_sources/examples/images_contours_and_fields/contourf_log.rst.txt deleted file mode 100644 index f60a7a7e29e..00000000000 --- a/_sources/examples/images_contours_and_fields/contourf_log.rst.txt +++ /dev/null @@ -1,61 +0,0 @@ -.. _images_contours_and_fields-contourf_log: - -images_contours_and_fields example code: contourf_log.py -======================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/images_contours_and_fields/contourf_log.py - -:: - - ''' - Demonstrate use of a log color scale in contourf - ''' - - import matplotlib.pyplot as plt - import numpy as np - from numpy import ma - from matplotlib import colors, ticker, cm - from matplotlib.mlab import bivariate_normal - - N = 100 - x = np.linspace(-3.0, 3.0, N) - y = np.linspace(-2.0, 2.0, N) - - X, Y = np.meshgrid(x, y) - - # A low hump with a spike coming out of the top right. - # Needs to have z/colour axis on a log scale so we see both hump and spike. - # linear scale only shows the spike. - z = (bivariate_normal(X, Y, 0.1, 0.2, 1.0, 1.0) - + 0.1 * bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)) - - # Put in some negative values (lower left corner) to cause trouble with logs: - z[:5, :5] = -1 - - # The following is not strictly essential, but it will eliminate - # a warning. Comment it out to see the warning. - z = ma.masked_where(z <= 0, z) - - - # Automatic selection of levels works; setting the - # log locator tells contourf to use a log scale: - fig, ax = plt.subplots() - cs = ax.contourf(X, Y, z, locator=ticker.LogLocator(), cmap=cm.PuBu_r) - - # Alternatively, you can manually set the levels - # and the norm: - #lev_exp = np.arange(np.floor(np.log10(z.min())-1), - # np.ceil(np.log10(z.max())+1)) - #levs = np.power(10, lev_exp) - #cs = P.contourf(X, Y, z, levs, norm=colors.LogNorm()) - - # The 'extend' kwarg does not work yet with a log scale. - - cbar = fig.colorbar(cs) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/images_contours_and_fields/contourf_log.txt b/_sources/examples/images_contours_and_fields/contourf_log.txt deleted file mode 100644 index 4f6f757d677..00000000000 --- a/_sources/examples/images_contours_and_fields/contourf_log.txt +++ /dev/null @@ -1,60 +0,0 @@ -.. _images_contours_and_fields-contourf_log: - -images_contours_and_fields example code: contourf_log.py -======================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/images_contours_and_fields/contourf_log.py - -:: - - ''' - Demonstrate use of a log color scale in contourf - ''' - - import matplotlib.pyplot as plt - import numpy as np - from numpy import ma - from matplotlib import colors, ticker, cm - from matplotlib.mlab import bivariate_normal - - N = 100 - x = np.linspace(-3.0, 3.0, N) - y = np.linspace(-2.0, 2.0, N) - - X, Y = np.meshgrid(x, y) - - # A low hump with a spike coming out of the top right. - # Needs to have z/colour axis on a log scale so we see both hump and spike. - # linear scale only shows the spike. - z = (bivariate_normal(X, Y, 0.1, 0.2, 1.0, 1.0) - + 0.1 * bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)) - - # Put in some negative values (lower left corner) to cause trouble with logs: - z[:5, :5] = -1 - - # The following is not strictly essential, but it will eliminate - # a warning. Comment it out to see the warning. - z = ma.masked_where(z <= 0, z) - - - # Automatic selection of levels works; setting the - # log locator tells contourf to use a log scale: - cs = plt.contourf(X, Y, z, locator=ticker.LogLocator(), cmap=cm.PuBu_r) - - # Alternatively, you can manually set the levels - # and the norm: - #lev_exp = np.arange(np.floor(np.log10(z.min())-1), - # np.ceil(np.log10(z.max())+1)) - #levs = np.power(10, lev_exp) - #cs = P.contourf(X, Y, z, levs, norm=colors.LogNorm()) - - # The 'extend' kwarg does not work yet with a log scale. - - cbar = plt.colorbar() - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/images_contours_and_fields/image_demo.rst.txt b/_sources/examples/images_contours_and_fields/image_demo.rst.txt deleted file mode 100644 index 7a79dbfbbff..00000000000 --- a/_sources/examples/images_contours_and_fields/image_demo.rst.txt +++ /dev/null @@ -1,27 +0,0 @@ -.. _images_contours_and_fields-image_demo: - -images_contours_and_fields example code: image_demo.py -====================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/images_contours_and_fields/image_demo.py - -:: - - """ - Simple demo of the imshow function. - """ - import matplotlib.pyplot as plt - import matplotlib.cbook as cbook - - image_file = cbook.get_sample_data('ada.png') - image = plt.imread(image_file) - - fig, ax = plt.subplots() - ax.imshow(image) - ax.axis('off') # clear x- and y-axes - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/images_contours_and_fields/image_demo.txt b/_sources/examples/images_contours_and_fields/image_demo.txt deleted file mode 100644 index a59176c6348..00000000000 --- a/_sources/examples/images_contours_and_fields/image_demo.txt +++ /dev/null @@ -1,26 +0,0 @@ -.. _images_contours_and_fields-image_demo: - -images_contours_and_fields example code: image_demo.py -====================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/images_contours_and_fields/image_demo.py - -:: - - """ - Simple demo of the imshow function. - """ - import matplotlib.pyplot as plt - import matplotlib.cbook as cbook - - image_file = cbook.get_sample_data('ada.png') - image = plt.imread(image_file) - - plt.imshow(image) - plt.axis('off') # clear x- and y-axes - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/images_contours_and_fields/image_demo_clip_path.rst.txt b/_sources/examples/images_contours_and_fields/image_demo_clip_path.rst.txt deleted file mode 100644 index bf542e13697..00000000000 --- a/_sources/examples/images_contours_and_fields/image_demo_clip_path.rst.txt +++ /dev/null @@ -1,32 +0,0 @@ -.. _images_contours_and_fields-image_demo_clip_path: - -images_contours_and_fields example code: image_demo_clip_path.py -================================================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/images_contours_and_fields/image_demo_clip_path.py - -:: - - """ - Demo of image that's been clipped by a circular patch. - """ - import matplotlib.pyplot as plt - import matplotlib.patches as patches - import matplotlib.cbook as cbook - - - image_file = cbook.get_sample_data('grace_hopper.png') - image = plt.imread(image_file) - - fig, ax = plt.subplots() - im = ax.imshow(image) - patch = patches.Circle((260, 200), radius=200, transform=ax.transData) - im.set_clip_path(patch) - - ax.axis('off') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/images_contours_and_fields/image_demo_clip_path.txt b/_sources/examples/images_contours_and_fields/image_demo_clip_path.txt deleted file mode 100644 index f37621e719f..00000000000 --- a/_sources/examples/images_contours_and_fields/image_demo_clip_path.txt +++ /dev/null @@ -1,32 +0,0 @@ -.. _images_contours_and_fields-image_demo_clip_path: - -images_contours_and_fields example code: image_demo_clip_path.py -================================================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/images_contours_and_fields/image_demo_clip_path.py - -:: - - """ - Demo of image that's been clipped by a circular patch. - """ - import matplotlib.pyplot as plt - import matplotlib.patches as patches - import matplotlib.cbook as cbook - - - image_file = cbook.get_sample_data('grace_hopper.png') - image = plt.imread(image_file) - - fig, ax = plt.subplots() - im = ax.imshow(image) - patch = patches.Circle((260, 200), radius=200, transform=ax.transData) - im.set_clip_path(patch) - - plt.axis('off') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/images_contours_and_fields/index.rst.txt b/_sources/examples/images_contours_and_fields/index.rst.txt deleted file mode 100644 index 5a1ecf9214f..00000000000 --- a/_sources/examples/images_contours_and_fields/index.rst.txt +++ /dev/null @@ -1,22 +0,0 @@ -.. _images_contours_and_fields-examples-index: - -############################################## -images_contours_and_fields Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - contourf_log - image_demo - image_demo_clip_path - interpolation_methods - pcolormesh_levels - streamplot_demo_features - streamplot_demo_masking - streamplot_demo_start_points diff --git a/_sources/examples/images_contours_and_fields/index.txt b/_sources/examples/images_contours_and_fields/index.txt deleted file mode 100644 index 91653b59b5d..00000000000 --- a/_sources/examples/images_contours_and_fields/index.txt +++ /dev/null @@ -1,23 +0,0 @@ -.. _images_contours_and_fields-examples-index: - -############################################## -images_contours_and_fields Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - contourf_log - image_demo - image_demo_clip_path - interpolation_methods - interpolation_none_vs_nearest - pcolormesh_levels - streamplot_demo_features - streamplot_demo_masking - streamplot_demo_start_points diff --git a/_sources/examples/images_contours_and_fields/interpolation_methods.rst.txt b/_sources/examples/images_contours_and_fields/interpolation_methods.rst.txt deleted file mode 100644 index 194c1fbec5a..00000000000 --- a/_sources/examples/images_contours_and_fields/interpolation_methods.rst.txt +++ /dev/null @@ -1,47 +0,0 @@ -.. _images_contours_and_fields-interpolation_methods: - -images_contours_and_fields example code: interpolation_methods.py -================================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/images_contours_and_fields/interpolation_methods.py - -:: - - ''' - Show all different interpolation methods for imshow - ''' - - import matplotlib.pyplot as plt - import numpy as np - - # from the docs: - - # If interpolation is None, default to rc image.interpolation. See also - # the filternorm and filterrad parameters. If interpolation is 'none', then - # no interpolation is performed on the Agg, ps and pdf backends. Other - # backends will fall back to 'nearest'. - # - # http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.imshow - - methods = [None, 'none', 'nearest', 'bilinear', 'bicubic', 'spline16', - 'spline36', 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric', - 'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc', 'lanczos'] - - np.random.seed(0) - grid = np.random.rand(4, 4) - - fig, axes = plt.subplots(3, 6, figsize=(12, 6), - subplot_kw={'xticks': [], 'yticks': []}) - - fig.subplots_adjust(hspace=0.3, wspace=0.05) - - for ax, interp_method in zip(axes.flat, methods): - ax.imshow(grid, interpolation=interp_method, cmap='viridis') - ax.set_title(interp_method) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/images_contours_and_fields/interpolation_methods.txt b/_sources/examples/images_contours_and_fields/interpolation_methods.txt deleted file mode 100644 index 13c5d900f8f..00000000000 --- a/_sources/examples/images_contours_and_fields/interpolation_methods.txt +++ /dev/null @@ -1,46 +0,0 @@ -.. _images_contours_and_fields-interpolation_methods: - -images_contours_and_fields example code: interpolation_methods.py -================================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/images_contours_and_fields/interpolation_methods.py - -:: - - ''' - Show all different interpolation methods for imshow - ''' - - import matplotlib.pyplot as plt - import numpy as np - - # from the docs: - - # If interpolation is None, default to rc image.interpolation. See also - # the filternorm and filterrad parameters. If interpolation is 'none', then - # no interpolation is performed on the Agg, ps and pdf backends. Other - # backends will fall back to 'nearest'. - # - # http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.imshow - - methods = [None, 'none', 'nearest', 'bilinear', 'bicubic', 'spline16', - 'spline36', 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric', - 'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc', 'lanczos'] - - grid = np.random.rand(4, 4) - - fig, axes = plt.subplots(3, 6, figsize=(12, 6), - subplot_kw={'xticks': [], 'yticks': []}) - - fig.subplots_adjust(hspace=0.3, wspace=0.05) - - for ax, interp_method in zip(axes.flat, methods): - ax.imshow(grid, interpolation=interp_method) - ax.set_title(interp_method) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/images_contours_and_fields/interpolation_none_vs_nearest.rst.txt b/_sources/examples/images_contours_and_fields/interpolation_none_vs_nearest.rst.txt deleted file mode 100644 index 7f3319d9922..00000000000 --- a/_sources/examples/images_contours_and_fields/interpolation_none_vs_nearest.rst.txt +++ /dev/null @@ -1,76 +0,0 @@ -.. _images_contours_and_fields-interpolation_none_vs_nearest: - -images_contours_and_fields example code: interpolation_none_vs_nearest.py -========================================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/images_contours_and_fields/interpolation_none_vs_nearest.py - -:: - - """ - Displays the difference between interpolation = 'none' and - interpolation = 'nearest'. - - Interpolation = 'none' and interpolation = 'nearest' are equivalent when - converting a figure to an image file, such as a PNG. - Interpolation = 'none' and interpolation = 'nearest' behave quite - differently, however, when converting a figure to a vector graphics file, - such as a PDF. As shown, Interpolation = 'none' works well when a big - image is scaled down, while interpolation = 'nearest' works well when a - small image is blown up. - """ - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.cbook as cbook - - # Load big image - big_im_path = cbook.get_sample_data('necked_tensile_specimen.png') - big_im = plt.imread(big_im_path) - # Define small image - small_im = np.array([[0.25, 0.75, 1.0, 0.75], [0.1, 0.65, 0.5, 0.4], - [0.6, 0.3, 0.0, 0.2], [0.7, 0.9, 0.4, 0.6]]) - - # Create a 2x2 table of plots - fig, axes = plt.subplots(figsize=[8.0, 7.5], ncols=2, nrows=2) - - axes[0, 0].imshow(big_im, interpolation='none') - axes[0, 1].imshow(big_im, interpolation='nearest') - axes[1, 0].imshow(small_im, interpolation='none') - axes[1, 1].imshow(small_im, interpolation='nearest') - fig.subplots_adjust(left=0.24, wspace=0.2, hspace=0.1, - bottom=0.05, top=0.86) - - # Label the rows and columns of the table - fig.text(0.03, 0.645, 'Big Image\nScaled Down', ha='left') - fig.text(0.03, 0.225, 'Small Image\nBlown Up', ha='left') - fig.text(0.383, 0.90, "Interpolation = 'none'", ha='center') - fig.text(0.75, 0.90, "Interpolation = 'nearest'", ha='center') - - # If you were going to run this example on your local machine, you - # would save the figure as a PNG, save the same figure as a PDF, and - # then compare them. The following code would suffice. - txt = fig.text(0.452, 0.95, 'Saved as a PNG', fontsize=18) - # plt.savefig('None_vs_nearest-png.png') - # txt.set_text('Saved as a PDF') - # plt.savefig('None_vs_nearest-pdf.pdf') - - # Here, however, we need to display the PDF on a webpage, which means - # the PDF must be converted into an image. For the purposes of this - # example, the 'Nearest_vs_none-pdf.pdf' has been pre-converted into - #'Nearest_vs_none-pdf.png' at 80 dpi. We simply need to load and - # display it. - # The conversion is done with: - # gs -dNOPAUSE -dBATCH -dDOINTERPOLATE -sDEVICE=pngalpha \ - # -sOutputFile=None_vs_nearest-pdf.png -r80 None_vs_nearest-pdf.pdf - pdf_im_path = cbook.get_sample_data('None_vs_nearest-pdf.png') - pdf_im = plt.imread(pdf_im_path) - fig2 = plt.figure(figsize=[8.0, 7.5]) - fig2.figimage(pdf_im) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/images_contours_and_fields/interpolation_none_vs_nearest.txt b/_sources/examples/images_contours_and_fields/interpolation_none_vs_nearest.txt deleted file mode 100644 index d5332586993..00000000000 --- a/_sources/examples/images_contours_and_fields/interpolation_none_vs_nearest.txt +++ /dev/null @@ -1,76 +0,0 @@ -.. _images_contours_and_fields-interpolation_none_vs_nearest: - -images_contours_and_fields example code: interpolation_none_vs_nearest.py -========================================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/images_contours_and_fields/interpolation_none_vs_nearest.py - -:: - - """ - Displays the difference between interpolation = 'none' and - interpolation = 'nearest'. - - Interpolation = 'none' and interpolation = 'nearest' are equivalent when - converting a figure to an image file, such as a PNG. - Interpolation = 'none' and interpolation = 'nearest' behave quite - differently, however, when converting a figure to a vector graphics file, - such as a PDF. As shown, Interpolation = 'none' works well when a big - image is scaled down, while interpolation = 'nearest' works well when a - small image is blown up. - """ - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.cbook as cbook - - # Load big image - big_im_path = cbook.get_sample_data('necked_tensile_specimen.png') - big_im = plt.imread(big_im_path) - # Define small image - small_im = np.array([[0.25, 0.75, 1.0, 0.75], [0.1, 0.65, 0.5, 0.4], - [0.6, 0.3, 0.0, 0.2], [0.7, 0.9, 0.4, 0.6]]) - - # Create a 2x2 table of plots - fig = plt.figure(figsize=[8.0, 7.5]) - ax = plt.subplot(2, 2, 1) - ax.imshow(big_im, interpolation='none') - ax = plt.subplot(2, 2, 2) - ax.imshow(big_im, interpolation='nearest') - ax = plt.subplot(2, 2, 3) - ax.imshow(small_im, interpolation='none') - ax = plt.subplot(2, 2, 4) - ax.imshow(small_im, interpolation='nearest') - plt.subplots_adjust(left=0.24, wspace=0.2, hspace=0.1, - bottom=0.05, top=0.86) - - # Label the rows and columns of the table - fig.text(0.03, 0.645, 'Big Image\nScaled Down', ha='left') - fig.text(0.03, 0.225, 'Small Image\nBlown Up', ha='left') - fig.text(0.383, 0.90, "Interpolation = 'none'", ha='center') - fig.text(0.75, 0.90, "Interpolation = 'nearest'", ha='center') - - # If you were going to run this example on your local machine, you - # would save the figure as a PNG, save the same figure as a PDF, and - # then compare them. The following code would suffice. - txt = fig.text(0.452, 0.95, 'Saved as a PNG', fontsize=18) - # plt.savefig('None_vs_nearest-png.png') - # txt.set_text('Saved as a PDF') - # plt.savefig('None_vs_nearest-pdf.pdf') - - # Here, however, we need to display the PDF on a webpage, which means - # the PDF must be converted into an image. For the purposes of this - # example, the 'Nearest_vs_none-pdf.pdf' has been pre-converted into - #'Nearest_vs_none-pdf.png' at 80 dpi. We simply need to load and - # display it. - pdf_im_path = cbook.get_sample_data('None_vs_nearest-pdf.png') - pdf_im = plt.imread(pdf_im_path) - fig2 = plt.figure(figsize=[8.0, 7.5]) - plt.figimage(pdf_im) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/images_contours_and_fields/pcolormesh_levels.rst.txt b/_sources/examples/images_contours_and_fields/pcolormesh_levels.rst.txt deleted file mode 100644 index b783f014ef8..00000000000 --- a/_sources/examples/images_contours_and_fields/pcolormesh_levels.rst.txt +++ /dev/null @@ -1,67 +0,0 @@ -.. _images_contours_and_fields-pcolormesh_levels: - -images_contours_and_fields example code: pcolormesh_levels.py -============================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/images_contours_and_fields/pcolormesh_levels.py - -:: - - """ - Shows how to combine Normalization and Colormap instances to draw - "levels" in pcolor, pcolormesh and imshow type plots in a similar - way to the levels keyword argument to contour/contourf. - - """ - - import matplotlib.pyplot as plt - from matplotlib.colors import BoundaryNorm - from matplotlib.ticker import MaxNLocator - import numpy as np - - - # make these smaller to increase the resolution - dx, dy = 0.05, 0.05 - - # generate 2 2d grids for the x & y bounds - y, x = np.mgrid[slice(1, 5 + dy, dy), - slice(1, 5 + dx, dx)] - - z = np.sin(x)**10 + np.cos(10 + y*x) * np.cos(x) - - # x and y are bounds, so z should be the value *inside* those bounds. - # Therefore, remove the last value from the z array. - z = z[:-1, :-1] - levels = MaxNLocator(nbins=15).tick_values(z.min(), z.max()) - - - # pick the desired colormap, sensible levels, and define a normalization - # instance which takes data values and translates those into levels. - cmap = plt.get_cmap('PiYG') - norm = BoundaryNorm(levels, ncolors=cmap.N, clip=True) - - fig, (ax0, ax1) = plt.subplots(nrows=2) - - im = ax0.pcolormesh(x, y, z, cmap=cmap, norm=norm) - fig.colorbar(im, ax=ax0) - ax0.set_title('pcolormesh with levels') - - - # contours are *point* based plots, so convert our bound into point - # centers - cf = ax1.contourf(x[:-1, :-1] + dx/2., - y[:-1, :-1] + dy/2., z, levels=levels, - cmap=cmap) - fig.colorbar(cf, ax=ax1) - ax1.set_title('contourf with levels') - - # adjust spacing between subplots so `ax1` title and `ax0` tick labels - # don't overlap - fig.tight_layout() - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/images_contours_and_fields/pcolormesh_levels.txt b/_sources/examples/images_contours_and_fields/pcolormesh_levels.txt deleted file mode 100644 index 7bfa4d0ac68..00000000000 --- a/_sources/examples/images_contours_and_fields/pcolormesh_levels.txt +++ /dev/null @@ -1,67 +0,0 @@ -.. _images_contours_and_fields-pcolormesh_levels: - -images_contours_and_fields example code: pcolormesh_levels.py -============================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/images_contours_and_fields/pcolormesh_levels.py - -:: - - """ - Shows how to combine Normalization and Colormap instances to draw - "levels" in pcolor, pcolormesh and imshow type plots in a similar - way to the levels keyword argument to contour/contourf. - - """ - - import matplotlib.pyplot as plt - from matplotlib.colors import BoundaryNorm - from matplotlib.ticker import MaxNLocator - import numpy as np - - - # make these smaller to increase the resolution - dx, dy = 0.05, 0.05 - - # generate 2 2d grids for the x & y bounds - y, x = np.mgrid[slice(1, 5 + dy, dy), - slice(1, 5 + dx, dx)] - - z = np.sin(x)**10 + np.cos(10 + y*x) * np.cos(x) - - # x and y are bounds, so z should be the value *inside* those bounds. - # Therefore, remove the last value from the z array. - z = z[:-1, :-1] - levels = MaxNLocator(nbins=15).tick_values(z.min(), z.max()) - - - # pick the desired colormap, sensible levels, and define a normalization - # instance which takes data values and translates those into levels. - cmap = plt.get_cmap('PiYG') - norm = BoundaryNorm(levels, ncolors=cmap.N, clip=True) - - fig, (ax0, ax1) = plt.subplots(nrows=2) - - im = ax0.pcolormesh(x, y, z, cmap=cmap, norm=norm) - fig.colorbar(im, ax=ax0) - ax0.set_title('pcolormesh with levels') - - - # contours are *point* based plots, so convert our bound into point - # centers - cf = ax1.contourf(x[:-1, :-1] + dx/2., - y[:-1, :-1] + dy/2., z, levels=levels, - cmap=cmap) - fig.colorbar(cf, ax=ax1) - ax1.set_title('contourf with levels') - - # adjust spacing between subplots so `ax1` title and `ax0` tick labels - # don't overlap - fig.tight_layout() - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/images_contours_and_fields/streamplot_demo_features.rst.txt b/_sources/examples/images_contours_and_fields/streamplot_demo_features.rst.txt deleted file mode 100644 index 3fb70540f04..00000000000 --- a/_sources/examples/images_contours_and_fields/streamplot_demo_features.rst.txt +++ /dev/null @@ -1,43 +0,0 @@ -.. _images_contours_and_fields-streamplot_demo_features: - -images_contours_and_fields example code: streamplot_demo_features.py -==================================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/images_contours_and_fields/streamplot_demo_features.py - -:: - - """ - Demo of the `streamplot` function. - - A streamplot, or streamline plot, is used to display 2D vector fields. This - example shows a few features of the stream plot function: - - * Varying the color along a streamline. - * Varying the density of streamlines. - * Varying the line width along a stream line. - """ - import numpy as np - import matplotlib.pyplot as plt - - Y, X = np.mgrid[-3:3:100j, -3:3:100j] - U = -1 - X**2 + Y - V = 1 + X - Y**2 - speed = np.sqrt(U*U + V*V) - - fig0, ax0 = plt.subplots() - strm = ax0.streamplot(X, Y, U, V, color=U, linewidth=2, cmap=plt.cm.autumn) - fig0.colorbar(strm.lines) - - fig1, (ax1, ax2) = plt.subplots(ncols=2) - ax1.streamplot(X, Y, U, V, density=[0.5, 1]) - - lw = 5*speed / speed.max() - ax2.streamplot(X, Y, U, V, density=0.6, color='k', linewidth=lw) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/images_contours_and_fields/streamplot_demo_features.txt b/_sources/examples/images_contours_and_fields/streamplot_demo_features.txt deleted file mode 100644 index 3841cd6b305..00000000000 --- a/_sources/examples/images_contours_and_fields/streamplot_demo_features.txt +++ /dev/null @@ -1,43 +0,0 @@ -.. _images_contours_and_fields-streamplot_demo_features: - -images_contours_and_fields example code: streamplot_demo_features.py -==================================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/images_contours_and_fields/streamplot_demo_features.py - -:: - - """ - Demo of the `streamplot` function. - - A streamplot, or streamline plot, is used to display 2D vector fields. This - example shows a few features of the stream plot function: - - * Varying the color along a streamline. - * Varying the density of streamlines. - * Varying the line width along a stream line. - """ - import numpy as np - import matplotlib.pyplot as plt - - Y, X = np.mgrid[-3:3:100j, -3:3:100j] - U = -1 - X**2 + Y - V = 1 + X - Y**2 - speed = np.sqrt(U*U + V*V) - - fig0, ax0 = plt.subplots() - strm = ax0.streamplot(X, Y, U, V, color=U, linewidth=2, cmap=plt.cm.autumn) - fig0.colorbar(strm.lines) - - fig1, (ax1, ax2) = plt.subplots(ncols=2) - ax1.streamplot(X, Y, U, V, density=[0.5, 1]) - - lw = 5*speed / speed.max() - ax2.streamplot(X, Y, U, V, density=0.6, color='k', linewidth=lw) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/images_contours_and_fields/streamplot_demo_masking.rst.txt b/_sources/examples/images_contours_and_fields/streamplot_demo_masking.rst.txt deleted file mode 100644 index 5f22450b492..00000000000 --- a/_sources/examples/images_contours_and_fields/streamplot_demo_masking.rst.txt +++ /dev/null @@ -1,41 +0,0 @@ -.. _images_contours_and_fields-streamplot_demo_masking: - -images_contours_and_fields example code: streamplot_demo_masking.py -=================================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/images_contours_and_fields/streamplot_demo_masking.py - -:: - - """ - Demo of the streamplot function with masking. - - This example shows how streamlines created by the streamplot function skips - masked regions and NaN values. - """ - import numpy as np - import matplotlib.pyplot as plt - - w = 3 - Y, X = np.mgrid[-w:w:100j, -w:w:100j] - U = -1 - X**2 + Y - V = 1 + X - Y**2 - speed = np.sqrt(U*U + V*V) - - mask = np.zeros(U.shape, dtype=bool) - mask[40:60, 40:60] = True - U[:20, :20] = np.nan - U = np.ma.array(U, mask=mask) - - fig, ax = plt.subplots() - ax.streamplot(X, Y, U, V, color='r') - - ax.imshow(~mask, extent=(-w, w, -w, w), alpha=0.5, - interpolation='nearest', cmap=plt.cm.gray) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/images_contours_and_fields/streamplot_demo_masking.txt b/_sources/examples/images_contours_and_fields/streamplot_demo_masking.txt deleted file mode 100644 index 2414131507d..00000000000 --- a/_sources/examples/images_contours_and_fields/streamplot_demo_masking.txt +++ /dev/null @@ -1,40 +0,0 @@ -.. _images_contours_and_fields-streamplot_demo_masking: - -images_contours_and_fields example code: streamplot_demo_masking.py -=================================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/images_contours_and_fields/streamplot_demo_masking.py - -:: - - """ - Demo of the streamplot function with masking. - - This example shows how streamlines created by the streamplot function skips - masked regions and NaN values. - """ - import numpy as np - import matplotlib.pyplot as plt - - w = 3 - Y, X = np.mgrid[-w:w:100j, -w:w:100j] - U = -1 - X**2 + Y - V = 1 + X - Y**2 - speed = np.sqrt(U*U + V*V) - - mask = np.zeros(U.shape, dtype=bool) - mask[40:60, 40:60] = 1 - U = np.ma.array(U, mask=mask) - U[:20, :20] = np.nan - - plt.streamplot(X, Y, U, V, color='r') - - plt.imshow(~mask, extent=(-w, w, -w, w), alpha=0.5, - interpolation='nearest', cmap=plt.cm.gray) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/images_contours_and_fields/streamplot_demo_start_points.rst.txt b/_sources/examples/images_contours_and_fields/streamplot_demo_start_points.rst.txt deleted file mode 100644 index 4aae4da7c9b..00000000000 --- a/_sources/examples/images_contours_and_fields/streamplot_demo_start_points.rst.txt +++ /dev/null @@ -1,44 +0,0 @@ -.. _images_contours_and_fields-streamplot_demo_start_points: - -images_contours_and_fields example code: streamplot_demo_start_points.py -======================================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/images_contours_and_fields/streamplot_demo_start_points.py - -:: - - """ - Demo of the `streamplot` function. - - A streamplot, or streamline plot, is used to display 2D vector fields. This - example shows a few features of the stream plot function: - - * Varying the color along a streamline. - * Varying the density of streamlines. - * Varying the line width along a stream line. - """ - import numpy as np - import matplotlib.pyplot as plt - - X, Y = (np.linspace(-3, 3, 100), - np.linspace(-3, 3, 100)) - - U, V = np.mgrid[-3:3:100j, 0:0:100j] - - seed_points = np.array([[-2, 0, 1], [-2, 0, 1]]) - - fig0, ax0 = plt.subplots() - strm = ax0.streamplot(X, Y, U, V, color=U, linewidth=2, - cmap=plt.cm.autumn, start_points=seed_points.T) - fig0.colorbar(strm.lines) - - ax0.plot(seed_points[0], seed_points[1], 'bo') - - ax0.axis((-3, 3, -3, 3)) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/images_contours_and_fields/streamplot_demo_start_points.txt b/_sources/examples/images_contours_and_fields/streamplot_demo_start_points.txt deleted file mode 100644 index f4123a4587a..00000000000 --- a/_sources/examples/images_contours_and_fields/streamplot_demo_start_points.txt +++ /dev/null @@ -1,44 +0,0 @@ -.. _images_contours_and_fields-streamplot_demo_start_points: - -images_contours_and_fields example code: streamplot_demo_start_points.py -======================================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/images_contours_and_fields/streamplot_demo_start_points.py - -:: - - """ - Demo of the `streamplot` function. - - A streamplot, or streamline plot, is used to display 2D vector fields. This - example shows a few features of the stream plot function: - - * Varying the color along a streamline. - * Varying the density of streamlines. - * Varying the line width along a stream line. - """ - import numpy as np - import matplotlib.pyplot as plt - - X, Y = (np.linspace(-3, 3, 100), - np.linspace(-3, 3, 100)) - - U, V = np.mgrid[-3:3:100j, 0:0:100j] - - seed_points = np.array([[-2, 0, 1], [-2, 0, 1]]) - - fig0, ax0 = plt.subplots() - strm = ax0.streamplot(X, Y, U, V, color=U, linewidth=2, - cmap=plt.cm.autumn, start_points=seed_points.T) - fig0.colorbar(strm.lines) - - ax0.plot(seed_points[0], seed_points[1], 'bo') - - ax0.axis((-3, 3, -3, 3)) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/index.rst.txt b/_sources/examples/index.rst.txt deleted file mode 100644 index ade1d3b7d57..00000000000 --- a/_sources/examples/index.rst.txt +++ /dev/null @@ -1,66 +0,0 @@ -.. _examples-index: - -#################### -Matplotlib Examples -#################### - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 2 - - animation/index.rst - - api/index.rst - - axes_grid/index.rst - - color/index.rst - - event_handling/index.rst - - frontpage/index.rst - - images_contours_and_fields/index.rst - - lines_bars_and_markers/index.rst - - misc/index.rst - - mplot3d/index.rst - - pie_and_polar_charts/index.rst - - pylab_examples/index.rst - - pyplots/index.rst - - scales/index.rst - - shapes_and_collections/index.rst - - showcase/index.rst - - specialty_plots/index.rst - - statistics/index.rst - - style_sheets/index.rst - - subplots_axes_and_figures/index.rst - - tests/index.rst - - text_labels_and_annotations/index.rst - - ticks_and_spines/index.rst - - units/index.rst - - user_interfaces/index.rst - - widgets/index.rst - diff --git a/_sources/examples/index.txt b/_sources/examples/index.txt deleted file mode 100644 index ff43871c5a4..00000000000 --- a/_sources/examples/index.txt +++ /dev/null @@ -1,62 +0,0 @@ -.. _examples-index: - -#################### -Matplotlib Examples -#################### - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 2 - - animation/index.rst - - api/index.rst - - axes_grid/index.rst - - color/index.rst - - event_handling/index.rst - - images_contours_and_fields/index.rst - - lines_bars_and_markers/index.rst - - misc/index.rst - - mplot3d/index.rst - - pie_and_polar_charts/index.rst - - pylab_examples/index.rst - - scales/index.rst - - shapes_and_collections/index.rst - - showcase/index.rst - - specialty_plots/index.rst - - statistics/index.rst - - style_sheets/index.rst - - subplots_axes_and_figures/index.rst - - tests/index.rst - - text_labels_and_annotations/index.rst - - ticks_and_spines/index.rst - - units/index.rst - - user_interfaces/index.rst - - widgets/index.rst - diff --git a/_sources/examples/lines_bars_and_markers/barh_demo.rst.txt b/_sources/examples/lines_bars_and_markers/barh_demo.rst.txt deleted file mode 100644 index f321172dbbd..00000000000 --- a/_sources/examples/lines_bars_and_markers/barh_demo.rst.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _lines_bars_and_markers-barh_demo: - -lines_bars_and_markers example code: barh_demo.py -================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/lines_bars_and_markers/barh_demo.py - -:: - - """ - ==================== - Horizontal bar chart - ==================== - - This example showcases a simple horizontal bar chart. - """ - import matplotlib.pyplot as plt - plt.rcdefaults() - import numpy as np - import matplotlib.pyplot as plt - - - plt.rcdefaults() - fig, ax = plt.subplots() - - # Example data - people = ('Tom', 'Dick', 'Harry', 'Slim', 'Jim') - y_pos = np.arange(len(people)) - performance = 3 + 10 * np.random.rand(len(people)) - error = np.random.rand(len(people)) - - ax.barh(y_pos, performance, xerr=error, align='center', - color='green', ecolor='black') - ax.set_yticks(y_pos) - ax.set_yticklabels(people) - ax.invert_yaxis() # labels read top-to-bottom - ax.set_xlabel('Performance') - ax.set_title('How fast do you want to go today?') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/lines_bars_and_markers/barh_demo.txt b/_sources/examples/lines_bars_and_markers/barh_demo.txt deleted file mode 100644 index 2e3af5f2dcd..00000000000 --- a/_sources/examples/lines_bars_and_markers/barh_demo.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _lines_bars_and_markers-barh_demo: - -lines_bars_and_markers example code: barh_demo.py -================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/lines_bars_and_markers/barh_demo.py - -:: - - """ - Simple demo of a horizontal bar chart. - """ - import matplotlib.pyplot as plt - plt.rcdefaults() - import numpy as np - import matplotlib.pyplot as plt - - - # Example data - people = ('Tom', 'Dick', 'Harry', 'Slim', 'Jim') - y_pos = np.arange(len(people)) - performance = 3 + 10 * np.random.rand(len(people)) - error = np.random.rand(len(people)) - - plt.barh(y_pos, performance, xerr=error, align='center', alpha=0.4) - plt.yticks(y_pos, people) - plt.xlabel('Performance') - plt.title('How fast do you want to go today?') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/lines_bars_and_markers/fill_demo.rst.txt b/_sources/examples/lines_bars_and_markers/fill_demo.rst.txt deleted file mode 100644 index 1660e3b5e00..00000000000 --- a/_sources/examples/lines_bars_and_markers/fill_demo.rst.txt +++ /dev/null @@ -1,32 +0,0 @@ -.. _lines_bars_and_markers-fill_demo: - -lines_bars_and_markers example code: fill_demo.py -================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/lines_bars_and_markers/fill_demo.py - -:: - - """ - ================== - A simple Fill plot - ================== - - This example showcases the most basic fill plot a user can do with matplotlib. - """ - import numpy as np - import matplotlib.pyplot as plt - - x = np.linspace(0, 1, 500) - y = np.sin(4 * np.pi * x) * np.exp(-5 * x) - - fig, ax = plt.subplots() - - ax.fill(x, y, zorder=10) - ax.grid(True, zorder=5) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/lines_bars_and_markers/fill_demo.txt b/_sources/examples/lines_bars_and_markers/fill_demo.txt deleted file mode 100644 index e06fafbe5bc..00000000000 --- a/_sources/examples/lines_bars_and_markers/fill_demo.txt +++ /dev/null @@ -1,27 +0,0 @@ -.. _lines_bars_and_markers-fill_demo: - -lines_bars_and_markers example code: fill_demo.py -================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/lines_bars_and_markers/fill_demo.py - -:: - - """ - Simple demo of the fill function. - """ - import numpy as np - import matplotlib.pyplot as plt - - - x = np.linspace(0, 1) - y = np.sin(4 * np.pi * x) * np.exp(-5 * x) - - plt.fill(x, y, 'r') - plt.grid(True) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/lines_bars_and_markers/fill_demo_features.rst.txt b/_sources/examples/lines_bars_and_markers/fill_demo_features.rst.txt deleted file mode 100644 index afff226c86d..00000000000 --- a/_sources/examples/lines_bars_and_markers/fill_demo_features.rst.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _lines_bars_and_markers-fill_demo_features: - -lines_bars_and_markers example code: fill_demo_features.py -========================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/lines_bars_and_markers/fill_demo_features.py - -:: - - """ - ======================== - A more complex fill demo - ======================== - - In addition to the basic fill plot, this demo shows a few optional features: - - * Multiple curves with a single command. - * Setting the fill color. - * Setting the opacity (alpha value). - """ - import numpy as np - import matplotlib.pyplot as plt - - x = np.linspace(0, 2 * np.pi, 500) - y1 = np.sin(x) - y2 = np.sin(3 * x) - - fig, ax = plt.subplots() - ax.fill(x, y1, 'b', x, y2, 'r', alpha=0.3) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/lines_bars_and_markers/fill_demo_features.txt b/_sources/examples/lines_bars_and_markers/fill_demo_features.txt deleted file mode 100644 index 0ccba8fe30f..00000000000 --- a/_sources/examples/lines_bars_and_markers/fill_demo_features.txt +++ /dev/null @@ -1,31 +0,0 @@ -.. _lines_bars_and_markers-fill_demo_features: - -lines_bars_and_markers example code: fill_demo_features.py -========================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/lines_bars_and_markers/fill_demo_features.py - -:: - - """ - Demo of the fill function with a few features. - - In addition to the basic fill plot, this demo shows a few optional features: - - * Multiple curves with a single command. - * Setting the fill color. - * Setting the opacity (alpha value). - """ - import numpy as np - import matplotlib.pyplot as plt - - x = np.linspace(0, 2 * np.pi, 100) - y1 = np.sin(x) - y2 = np.sin(3 * x) - plt.fill(x, y1, 'b', x, y2, 'r', alpha=0.3) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/lines_bars_and_markers/index.rst.txt b/_sources/examples/lines_bars_and_markers/index.rst.txt deleted file mode 100644 index 352560e04a6..00000000000 --- a/_sources/examples/lines_bars_and_markers/index.rst.txt +++ /dev/null @@ -1,23 +0,0 @@ -.. _lines_bars_and_markers-examples-index: - -############################################## -lines_bars_and_markers Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - barh_demo - fill_demo - fill_demo_features - line_demo_dash_control - line_styles_reference - linestyles - marker_fillstyle_reference - marker_reference - scatter_with_legend diff --git a/_sources/examples/lines_bars_and_markers/index.txt b/_sources/examples/lines_bars_and_markers/index.txt deleted file mode 100644 index 906780f455c..00000000000 --- a/_sources/examples/lines_bars_and_markers/index.txt +++ /dev/null @@ -1,22 +0,0 @@ -.. _lines_bars_and_markers-examples-index: - -############################################## -lines_bars_and_markers Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - barh_demo - fill_demo - fill_demo_features - line_demo_dash_control - line_styles_reference - marker_fillstyle_reference - marker_reference - scatter_with_legend diff --git a/_sources/examples/lines_bars_and_markers/line_demo_dash_control.rst.txt b/_sources/examples/lines_bars_and_markers/line_demo_dash_control.rst.txt deleted file mode 100644 index b9143beebb5..00000000000 --- a/_sources/examples/lines_bars_and_markers/line_demo_dash_control.rst.txt +++ /dev/null @@ -1,39 +0,0 @@ -.. _lines_bars_and_markers-line_demo_dash_control: - -lines_bars_and_markers example code: line_demo_dash_control.py -============================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/lines_bars_and_markers/line_demo_dash_control.py - -:: - - """ - ======================================= - A simple plot with a custom dashed line - ======================================= - - A Line object's ``set_dashes`` method allows you to specify dashes with - a series of on/off lengths (in points). - """ - import numpy as np - import matplotlib.pyplot as plt - - - x = np.linspace(0, 10, 500) - dashes = [10, 5, 100, 5] # 10 points on, 5 off, 100 on, 5 off - - fig, ax = plt.subplots() - line1, = ax.plot(x, np.sin(x), '--', linewidth=2, - label='Dashes set retroactively') - line1.set_dashes(dashes) - - line2, = ax.plot(x, -1 * np.sin(x), dashes=[30, 5, 10, 5], - label='Dashes set proactively') - - ax.legend(loc='lower right') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/lines_bars_and_markers/line_demo_dash_control.txt b/_sources/examples/lines_bars_and_markers/line_demo_dash_control.txt deleted file mode 100644 index 45da08c5bb6..00000000000 --- a/_sources/examples/lines_bars_and_markers/line_demo_dash_control.txt +++ /dev/null @@ -1,31 +0,0 @@ -.. _lines_bars_and_markers-line_demo_dash_control: - -lines_bars_and_markers example code: line_demo_dash_control.py -============================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/lines_bars_and_markers/line_demo_dash_control.py - -:: - - """ - Demo of a simple plot with a custom dashed line. - - A Line object's ``set_dashes`` method allows you to specify dashes with - a series of on/off lengths (in points). - """ - import numpy as np - import matplotlib.pyplot as plt - - - x = np.linspace(0, 10) - line, = plt.plot(x, np.sin(x), '--', linewidth=2) - - dashes = [10, 5, 100, 5] # 10 points on, 5 off, 100 on, 5 off - line.set_dashes(dashes) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/lines_bars_and_markers/line_styles_reference.rst.txt b/_sources/examples/lines_bars_and_markers/line_styles_reference.rst.txt deleted file mode 100644 index 10b539adbf8..00000000000 --- a/_sources/examples/lines_bars_and_markers/line_styles_reference.rst.txt +++ /dev/null @@ -1,51 +0,0 @@ -.. _lines_bars_and_markers-line_styles_reference: - -lines_bars_and_markers example code: line_styles_reference.py -============================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/lines_bars_and_markers/line_styles_reference.py - -:: - - """ - ==================== - Line-style reference - ==================== - - Reference for line-styles included with Matplotlib. - """ - import numpy as np - import matplotlib.pyplot as plt - - - color = 'cornflowerblue' - points = np.ones(5) # Draw 5 points for each line - text_style = dict(horizontalalignment='right', verticalalignment='center', - fontsize=12, fontdict={'family': 'monospace'}) - - - def format_axes(ax): - ax.margins(0.2) - ax.set_axis_off() - - - def nice_repr(text): - return repr(text).lstrip('u') - - - # Plot all line styles. - fig, ax = plt.subplots() - - linestyles = ['-', '--', '-.', ':'] - for y, linestyle in enumerate(linestyles): - ax.text(-0.1, y, nice_repr(linestyle), **text_style) - ax.plot(y * points, linestyle=linestyle, color=color, linewidth=3) - format_axes(ax) - ax.set_title('line styles') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/lines_bars_and_markers/line_styles_reference.txt b/_sources/examples/lines_bars_and_markers/line_styles_reference.txt deleted file mode 100644 index 9d3bd6e662c..00000000000 --- a/_sources/examples/lines_bars_and_markers/line_styles_reference.txt +++ /dev/null @@ -1,47 +0,0 @@ -.. _lines_bars_and_markers-line_styles_reference: - -lines_bars_and_markers example code: line_styles_reference.py -============================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/lines_bars_and_markers/line_styles_reference.py - -:: - - """ - Reference for line-styles included with Matplotlib. - """ - import numpy as np - import matplotlib.pyplot as plt - - - color = 'cornflowerblue' - points = np.ones(5) # Draw 5 points for each line - text_style = dict(horizontalalignment='right', verticalalignment='center', - fontsize=12, fontdict={'family': 'monospace'}) - - - def format_axes(ax): - ax.margins(0.2) - ax.set_axis_off() - - - def nice_repr(text): - return repr(text).lstrip('u') - - - # Plot all line styles. - f, ax = plt.subplots() - - linestyles = ['-', '--', '-.', ':'] - for y, linestyle in enumerate(linestyles): - ax.text(-0.5, y, nice_repr(linestyle), **text_style) - ax.plot(y * points, linestyle=linestyle, color=color, linewidth=3) - format_axes(ax) - ax.set_title('line styles') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/lines_bars_and_markers/linestyles.rst.txt b/_sources/examples/lines_bars_and_markers/linestyles.rst.txt deleted file mode 100644 index fcc96f5d8f4..00000000000 --- a/_sources/examples/lines_bars_and_markers/linestyles.rst.txt +++ /dev/null @@ -1,66 +0,0 @@ -.. _lines_bars_and_markers-linestyles: - -lines_bars_and_markers example code: linestyles.py -================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/lines_bars_and_markers/linestyles.py - -:: - - """ - ========== - Linestyles - ========== - - This examples showcases different linestyles copying those of Tikz/PGF. - """ - import numpy as np - import matplotlib.pyplot as plt - from collections import OrderedDict - from matplotlib.transforms import blended_transform_factory - - linestyles = OrderedDict( - [('solid', (0, ())), - ('loosely dotted', (0, (1, 10))), - ('dotted', (0, (1, 5))), - ('densely dotted', (0, (1, 1))), - - ('loosely dashed', (0, (5, 10))), - ('dashed', (0, (5, 5))), - ('densely dashed', (0, (5, 1))), - - ('loosely dashdotted', (0, (3, 10, 1, 10))), - ('dashdotted', (0, (3, 5, 1, 5))), - ('densely dashdotted', (0, (3, 1, 1, 1))), - - ('loosely dashdotdotted', (0, (3, 10, 1, 10, 1, 10))), - ('dashdotdotted', (0, (3, 5, 1, 5, 1, 5))), - ('densely dashdotdotted', (0, (3, 1, 1, 1, 1, 1)))]) - - - plt.figure(figsize=(10, 6)) - ax = plt.subplot(1, 1, 1) - - X, Y = np.linspace(0, 100, 10), np.zeros(10) - for i, (name, linestyle) in enumerate(linestyles.items()): - ax.plot(X, Y+i, linestyle=linestyle, linewidth=1.5, color='black') - - ax.set_ylim(-0.5, len(linestyles)-0.5) - plt.yticks(np.arange(len(linestyles)), linestyles.keys()) - plt.xticks([]) - - # For each line style, add a text annotation with a small offset from - # the reference point (0 in Axes coords, y tick value in Data coords). - reference_transform = blended_transform_factory(ax.transAxes, ax.transData) - for i, (name, linestyle) in enumerate(linestyles.items()): - ax.annotate(str(linestyle), xy=(0.0, i), xycoords=reference_transform, - xytext=(-6, -12), textcoords='offset points', color="blue", - fontsize=8, ha="right", family="monospace") - - plt.tight_layout() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/lines_bars_and_markers/marker_fillstyle_reference.rst.txt b/_sources/examples/lines_bars_and_markers/marker_fillstyle_reference.rst.txt deleted file mode 100644 index af2e2e4ef03..00000000000 --- a/_sources/examples/lines_bars_and_markers/marker_fillstyle_reference.rst.txt +++ /dev/null @@ -1,52 +0,0 @@ -.. _lines_bars_and_markers-marker_fillstyle_reference: - -lines_bars_and_markers example code: marker_fillstyle_reference.py -================================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/lines_bars_and_markers/marker_fillstyle_reference.py - -:: - - """ - ===================== - Marker filling-styles - ===================== - - Reference for marker fill-styles included with Matplotlib. - """ - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.lines import Line2D - - - points = np.ones(5) # Draw 3 points for each line - text_style = dict(horizontalalignment='right', verticalalignment='center', - fontsize=12, fontdict={'family': 'monospace'}) - marker_style = dict(color='cornflowerblue', linestyle=':', marker='o', - markersize=15, markerfacecoloralt='gray') - - - def format_axes(ax): - ax.margins(0.2) - ax.set_axis_off() - - - def nice_repr(text): - return repr(text).lstrip('u') - - - fig, ax = plt.subplots() - - # Plot all fill styles. - for y, fill_style in enumerate(Line2D.fillStyles): - ax.text(-0.5, y, nice_repr(fill_style), **text_style) - ax.plot(y * points, fillstyle=fill_style, **marker_style) - format_axes(ax) - ax.set_title('fill style') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/lines_bars_and_markers/marker_fillstyle_reference.txt b/_sources/examples/lines_bars_and_markers/marker_fillstyle_reference.txt deleted file mode 100644 index b80ed6ff2f2..00000000000 --- a/_sources/examples/lines_bars_and_markers/marker_fillstyle_reference.txt +++ /dev/null @@ -1,48 +0,0 @@ -.. _lines_bars_and_markers-marker_fillstyle_reference: - -lines_bars_and_markers example code: marker_fillstyle_reference.py -================================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/lines_bars_and_markers/marker_fillstyle_reference.py - -:: - - """ - Reference for marker fill-styles included with Matplotlib. - """ - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.lines import Line2D - - - points = np.ones(5) # Draw 3 points for each line - text_style = dict(horizontalalignment='right', verticalalignment='center', - fontsize=12, fontdict={'family': 'monospace'}) - marker_style = dict(color='cornflowerblue', linestyle=':', marker='o', - markersize=15, markerfacecoloralt='gray') - - - def format_axes(ax): - ax.margins(0.2) - ax.set_axis_off() - - - def nice_repr(text): - return repr(text).lstrip('u') - - - fig, ax = plt.subplots() - - # Plot all fill styles. - for y, fill_style in enumerate(Line2D.fillStyles): - ax.text(-0.5, y, nice_repr(fill_style), **text_style) - ax.plot(y * points, fillstyle=fill_style, **marker_style) - format_axes(ax) - ax.set_title('fill style') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/lines_bars_and_markers/marker_reference.rst.txt b/_sources/examples/lines_bars_and_markers/marker_reference.rst.txt deleted file mode 100644 index 29b464da76a..00000000000 --- a/_sources/examples/lines_bars_and_markers/marker_reference.rst.txt +++ /dev/null @@ -1,81 +0,0 @@ -.. _lines_bars_and_markers-marker_reference: - -lines_bars_and_markers example code: marker_reference.py -======================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/lines_bars_and_markers/marker_reference.py - -:: - - """ - ================================ - Filled and unfilled-marker types - ================================ - - Reference for filled- and unfilled-marker types included with Matplotlib. - """ - from six import iteritems - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.lines import Line2D - - - points = np.ones(3) # Draw 3 points for each line - text_style = dict(horizontalalignment='right', verticalalignment='center', - fontsize=12, fontdict={'family': 'monospace'}) - marker_style = dict(linestyle=':', color='cornflowerblue', markersize=10) - - - def format_axes(ax): - ax.margins(0.2) - ax.set_axis_off() - - - def nice_repr(text): - return repr(text).lstrip('u') - - - def split_list(a_list): - i_half = len(a_list) // 2 - return (a_list[:i_half], a_list[i_half:]) - - - # Plot all un-filled markers - # -------------------------- - - fig, axes = plt.subplots(ncols=2) - - # Filter out filled markers and marker settings that do nothing. - # We use iteritems from six to make sure that we get an iterator - # in both python 2 and 3 - unfilled_markers = [m for m, func in iteritems(Line2D.markers) - if func != 'nothing' and m not in Line2D.filled_markers] - # Reverse-sort for pretty. We use our own sort key which is essentially - # a python3 compatible reimplementation of python2 sort. - unfilled_markers = sorted(unfilled_markers, - key=lambda x: (str(type(x)), str(x)))[::-1] - for ax, markers in zip(axes, split_list(unfilled_markers)): - for y, marker in enumerate(markers): - ax.text(-0.5, y, nice_repr(marker), **text_style) - ax.plot(y * points, marker=marker, **marker_style) - format_axes(ax) - fig.suptitle('un-filled markers', fontsize=14) - - - # Plot all filled markers. - # ------------------------ - - fig, axes = plt.subplots(ncols=2) - for ax, markers in zip(axes, split_list(Line2D.filled_markers)): - for y, marker in enumerate(markers): - ax.text(-0.5, y, nice_repr(marker), **text_style) - ax.plot(y * points, marker=marker, **marker_style) - format_axes(ax) - fig.suptitle('filled markers', fontsize=14) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/lines_bars_and_markers/marker_reference.txt b/_sources/examples/lines_bars_and_markers/marker_reference.txt deleted file mode 100644 index 38c0dbc30c9..00000000000 --- a/_sources/examples/lines_bars_and_markers/marker_reference.txt +++ /dev/null @@ -1,77 +0,0 @@ -.. _lines_bars_and_markers-marker_reference: - -lines_bars_and_markers example code: marker_reference.py -======================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/lines_bars_and_markers/marker_reference.py - -:: - - """ - Reference for filled- and unfilled-marker types included with Matplotlib. - """ - from six import iteritems - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.lines import Line2D - - - points = np.ones(3) # Draw 3 points for each line - text_style = dict(horizontalalignment='right', verticalalignment='center', - fontsize=12, fontdict={'family': 'monospace'}) - marker_style = dict(linestyle=':', color='cornflowerblue', markersize=10) - - - def format_axes(ax): - ax.margins(0.2) - ax.set_axis_off() - - - def nice_repr(text): - return repr(text).lstrip('u') - - - def split_list(a_list): - i_half = len(a_list) // 2 - return (a_list[:i_half], a_list[i_half:]) - - - # Plot all un-filled markers - # -------------------------- - - fig, axes = plt.subplots(ncols=2) - - # Filter out filled markers and marker settings that do nothing. - # We use iteritems from six to make sure that we get an iterator - # in both python 2 and 3 - unfilled_markers = [m for m, func in iteritems(Line2D.markers) - if func != 'nothing' and m not in Line2D.filled_markers] - # Reverse-sort for pretty. We use our own sort key which is essentially - # a python3 compatible reimplementation of python2 sort. - unfilled_markers = sorted(unfilled_markers, - key=lambda x: (str(type(x)), str(x)))[::-1] - for ax, markers in zip(axes, split_list(unfilled_markers)): - for y, marker in enumerate(markers): - ax.text(-0.5, y, nice_repr(marker), **text_style) - ax.plot(y * points, marker=marker, **marker_style) - format_axes(ax) - fig.suptitle('un-filled markers', fontsize=14) - - - # Plot all filled markers. - # ------------------------ - - fig, axes = plt.subplots(ncols=2) - for ax, markers in zip(axes, split_list(Line2D.filled_markers)): - for y, marker in enumerate(markers): - ax.text(-0.5, y, nice_repr(marker), **text_style) - ax.plot(y * points, marker=marker, **marker_style) - format_axes(ax) - fig.suptitle('filled markers', fontsize=14) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/lines_bars_and_markers/scatter_with_legend.rst.txt b/_sources/examples/lines_bars_and_markers/scatter_with_legend.rst.txt deleted file mode 100644 index 0dbfce330b6..00000000000 --- a/_sources/examples/lines_bars_and_markers/scatter_with_legend.rst.txt +++ /dev/null @@ -1,30 +0,0 @@ -.. _lines_bars_and_markers-scatter_with_legend: - -lines_bars_and_markers example code: scatter_with_legend.py -=========================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/lines_bars_and_markers/scatter_with_legend.py - -:: - - import matplotlib.pyplot as plt - from numpy.random import rand - - - fig, ax = plt.subplots() - for color in ['red', 'green', 'blue']: - n = 750 - x, y = rand(2, n) - scale = 200.0 * rand(n) - ax.scatter(x, y, c=color, s=scale, label=color, - alpha=0.3, edgecolors='none') - - ax.legend() - ax.grid(True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/lines_bars_and_markers/scatter_with_legend.txt b/_sources/examples/lines_bars_and_markers/scatter_with_legend.txt deleted file mode 100644 index a644b4b7f3f..00000000000 --- a/_sources/examples/lines_bars_and_markers/scatter_with_legend.txt +++ /dev/null @@ -1,29 +0,0 @@ -.. _lines_bars_and_markers-scatter_with_legend: - -lines_bars_and_markers example code: scatter_with_legend.py -=========================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/lines_bars_and_markers/scatter_with_legend.py - -:: - - import matplotlib.pyplot as plt - from numpy.random import rand - - - for color in ['red', 'green', 'blue']: - n = 750 - x, y = rand(2, n) - scale = 200.0 * rand(n) - plt.scatter(x, y, c=color, s=scale, label=color, - alpha=0.3, edgecolors='none') - - plt.legend() - plt.grid(True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/contour_manual.rst.txt b/_sources/examples/misc/contour_manual.rst.txt deleted file mode 100644 index 81a19f1c898..00000000000 --- a/_sources/examples/misc/contour_manual.rst.txt +++ /dev/null @@ -1,63 +0,0 @@ -.. _misc-contour_manual: - -misc example code: contour_manual.py -==================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/misc/contour_manual.py - -:: - - """ - Example of displaying your own contour lines and polygons using ContourSet. - """ - import matplotlib.pyplot as plt - from matplotlib.contour import ContourSet - import matplotlib.cm as cm - - # Contour lines for each level are a list/tuple of polygons. - lines0 = [[[0, 0], [0, 4]]] - lines1 = [[[2, 0], [1, 2], [1, 3]]] - lines2 = [[[3, 0], [3, 2]], [[3, 3], [3, 4]]] # Note two lines. - - # Filled contours between two levels are also a list/tuple of polygons. - # Points can be ordered clockwise or anticlockwise. - filled01 = [[[0, 0], [0, 4], [1, 3], [1, 2], [2, 0]]] - filled12 = [[[2, 0], [3, 0], [3, 2], [1, 3], [1, 2]], # Note two polygons. - [[1, 4], [3, 4], [3, 3]]] - - - plt.figure() - - # Filled contours using filled=True. - cs = ContourSet(plt.gca(), [0, 1, 2], [filled01, filled12], filled=True, cmap=cm.bone) - cbar = plt.colorbar(cs) - - # Contour lines (non-filled). - lines = ContourSet(plt.gca(), [0, 1, 2], [lines0, lines1, lines2], cmap=cm.cool, - linewidths=3) - cbar.add_lines(lines) - - plt.axis([-0.5, 3.5, -0.5, 4.5]) - plt.title('User-specified contours') - - - # Multiple filled contour lines can be specified in a single list of polygon - # vertices along with a list of vertex kinds (code types) as described in the - # Path class. This is particularly useful for polygons with holes. - # Here a code type of 1 is a MOVETO, and 2 is a LINETO. - - plt.figure() - filled01 = [[[0, 0], [3, 0], [3, 3], [0, 3], [1, 1], [1, 2], [2, 2], [2, 1]]] - kinds01 = [[1, 2, 2, 2, 1, 2, 2, 2]] - cs = ContourSet(plt.gca(), [0, 1], [filled01], [kinds01], filled=True) - cbar = plt.colorbar(cs) - - plt.axis([-0.5, 3.5, -0.5, 3.5]) - plt.title('User specified filled contours with holes') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/contour_manual.txt b/_sources/examples/misc/contour_manual.txt deleted file mode 100644 index 5871d169905..00000000000 --- a/_sources/examples/misc/contour_manual.txt +++ /dev/null @@ -1,61 +0,0 @@ -.. _misc-contour_manual: - -misc example code: contour_manual.py -==================================== - -[`source code `_] - -:: - - """ - Example of displaying your own contour lines and polygons using ContourSet. - """ - import matplotlib.pyplot as plt - from matplotlib.contour import ContourSet - import matplotlib.cm as cm - - # Contour lines for each level are a list/tuple of polygons. - lines0 = [[[0, 0], [0, 4]]] - lines1 = [[[2, 0], [1, 2], [1, 3]]] - lines2 = [[[3, 0], [3, 2]], [[3, 3], [3, 4]]] # Note two lines. - - # Filled contours between two levels are also a list/tuple of polygons. - # Points can be ordered clockwise or anticlockwise. - filled01 = [[[0, 0], [0, 4], [1, 3], [1, 2], [2, 0]]] - filled12 = [[[2, 0], [3, 0], [3, 2], [1, 3], [1, 2]], # Note two polygons. - [[1, 4], [3, 4], [3, 3]]] - - - plt.figure() - - # Filled contours using filled=True. - cs = ContourSet(plt.gca(), [0, 1, 2], [filled01, filled12], filled=True, cmap=cm.bone) - cbar = plt.colorbar(cs) - - # Contour lines (non-filled). - lines = ContourSet(plt.gca(), [0, 1, 2], [lines0, lines1, lines2], cmap=cm.cool, - linewidths=3) - cbar.add_lines(lines) - - plt.axis([-0.5, 3.5, -0.5, 4.5]) - plt.title('User-specified contours') - - - # Multiple filled contour lines can be specified in a single list of polygon - # vertices along with a list of vertex kinds (code types) as described in the - # Path class. This is particularly useful for polygons with holes. - # Here a code type of 1 is a MOVETO, and 2 is a LINETO. - - plt.figure() - filled01 = [[[0, 0], [3, 0], [3, 3], [0, 3], [1, 1], [1, 2], [2, 2], [2, 1]]] - kinds01 = [[1, 2, 2, 2, 1, 2, 2, 2]] - cs = ContourSet(plt.gca(), [0, 1], [filled01], [kinds01], filled=True) - cbar = plt.colorbar(cs) - - plt.axis([-0.5, 3.5, -0.5, 3.5]) - plt.title('User specified filled contours with holes') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/developer_commit_history.txt b/_sources/examples/misc/developer_commit_history.txt deleted file mode 100644 index 732a9ecf609..00000000000 --- a/_sources/examples/misc/developer_commit_history.txt +++ /dev/null @@ -1,57 +0,0 @@ -.. _misc-developer_commit_history: - -misc example code: developer_commit_history.py -============================================== - -[`source code `_] - -:: - - from __future__ import print_function - """ - report how many days it has been since each developer committed. You - must do an - - svn log > log.txt - - and place the output next to this file before running - - """ - import os, datetime - - import matplotlib.cbook as cbook - - todate = cbook.todate('%Y-%m-%d') - today = datetime.date.today() - if not os.path.exists('log.txt'): - print('You must place the "svn log" output into a file "log.txt"') - raise SystemExit - - parse = False - - lastd = dict() - for line in file('log.txt'): - if line.startswith('--------'): - parse = True - continue - - if parse: - parts = [part.strip() for part in line.split('|')] - developer = parts[1] - dateparts = parts[2].split(' ') - ymd = todate(dateparts[0]) - - - if developer not in lastd: - lastd[developer] = ymd - - parse = False - - dsu = [((today - lastdate).days, developer) for developer, lastdate in lastd.items()] - - dsu.sort() - for timedelta, developer in dsu: - print('%s : %d'%(developer, timedelta)) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/font_indexing.rst.txt b/_sources/examples/misc/font_indexing.rst.txt deleted file mode 100644 index 9a0a807e935..00000000000 --- a/_sources/examples/misc/font_indexing.rst.txt +++ /dev/null @@ -1,54 +0,0 @@ -.. _misc-font_indexing: - -misc example code: font_indexing.py -=================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/misc/font_indexing.py - -:: - - """ - A little example that shows how the various indexing into the font - tables relate to one another. Mainly for mpl developers.... - - """ - from __future__ import print_function - import matplotlib - from matplotlib.ft2font import FT2Font, KERNING_DEFAULT, KERNING_UNFITTED, KERNING_UNSCALED - - - #fname = '/usr/share/fonts/sfd/FreeSans.ttf' - fname = matplotlib.get_data_path() + '/fonts/ttf/DejaVuSans.ttf' - font = FT2Font(fname) - font.set_charmap(0) - - codes = font.get_charmap().items() - #dsu = [(ccode, glyphind) for ccode, glyphind in codes] - #dsu.sort() - #for ccode, glyphind in dsu: - # try: name = font.get_glyph_name(glyphind) - # except RuntimeError: pass - # else: print('% 4d % 4d %s %s' % (glyphind, ccode, hex(int(ccode)), name)) - - - # make a charname to charcode and glyphind dictionary - coded = {} - glyphd = {} - for ccode, glyphind in codes: - name = font.get_glyph_name(glyphind) - coded[name] = ccode - glyphd[name] = glyphind - - code = coded['A'] - glyph = font.load_char(code) - #print(glyph.bbox) - print(glyphd['A'], glyphd['V'], coded['A'], coded['V']) - print('AV', font.get_kerning(glyphd['A'], glyphd['V'], KERNING_DEFAULT)) - print('AV', font.get_kerning(glyphd['A'], glyphd['V'], KERNING_UNFITTED)) - print('AV', font.get_kerning(glyphd['A'], glyphd['V'], KERNING_UNSCALED)) - print('AV', font.get_kerning(glyphd['A'], glyphd['T'], KERNING_UNSCALED)) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/font_indexing.txt b/_sources/examples/misc/font_indexing.txt deleted file mode 100644 index 2a1d60d085e..00000000000 --- a/_sources/examples/misc/font_indexing.txt +++ /dev/null @@ -1,52 +0,0 @@ -.. _misc-font_indexing: - -misc example code: font_indexing.py -=================================== - -[`source code `_] - -:: - - """ - A little example that shows how the various indexing into the font - tables relate to one another. Mainly for mpl developers.... - - """ - from __future__ import print_function - import matplotlib - from matplotlib.ft2font import FT2Font, KERNING_DEFAULT, KERNING_UNFITTED, KERNING_UNSCALED - - - #fname = '/usr/share/fonts/sfd/FreeSans.ttf' - fname = matplotlib.get_data_path() + '/fonts/ttf/Vera.ttf' - font = FT2Font(fname) - font.set_charmap(0) - - codes = font.get_charmap().items() - #dsu = [(ccode, glyphind) for ccode, glyphind in codes] - #dsu.sort() - #for ccode, glyphind in dsu: - # try: name = font.get_glyph_name(glyphind) - # except RuntimeError: pass - # else: print('% 4d % 4d %s %s' % (glyphind, ccode, hex(int(ccode)), name)) - - - # make a charname to charcode and glyphind dictionary - coded = {} - glyphd = {} - for ccode, glyphind in codes: - name = font.get_glyph_name(glyphind) - coded[name] = ccode - glyphd[name] = glyphind - - code = coded['A'] - glyph = font.load_char(code) - #print(glyph.bbox) - print(glyphd['A'], glyphd['V'], coded['A'], coded['V']) - print('AV', font.get_kerning(glyphd['A'], glyphd['V'], KERNING_DEFAULT)) - print('AV', font.get_kerning(glyphd['A'], glyphd['V'], KERNING_UNFITTED)) - print('AV', font.get_kerning(glyphd['A'], glyphd['V'], KERNING_UNSCALED)) - print('AV', font.get_kerning(glyphd['A'], glyphd['T'], KERNING_UNSCALED)) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/ftface_props.rst.txt b/_sources/examples/misc/ftface_props.rst.txt deleted file mode 100644 index 49497bd115d..00000000000 --- a/_sources/examples/misc/ftface_props.rst.txt +++ /dev/null @@ -1,78 +0,0 @@ -.. _misc-ftface_props: - -misc example code: ftface_props.py -================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/misc/ftface_props.py - -:: - - from __future__ import print_function - """ - This is a demo script to show you how to use all the properties of an - FT2Font object. These describe global font properties. For - individual character metrics, use the Glyph object, as returned by - load_char - """ - import matplotlib - import matplotlib.ft2font as ft - - - #fname = '/usr/local/share/matplotlib/VeraIt.ttf' - fname = matplotlib.get_data_path() + '/fonts/ttf/DejaVuSans-Oblique.ttf' - #fname = '/usr/local/share/matplotlib/cmr10.ttf' - - font = ft.FT2Font(fname) - - print('Num faces :', font.num_faces) # number of faces in file - print('Num glyphs :', font.num_glyphs) # number of glyphs in the face - print('Family name :', font.family_name) # face family name - print('Style name :', font.style_name) # face style name - print('PS name :', font.postscript_name) # the postscript name - print('Num fixed :', font.num_fixed_sizes) # number of embedded bitmap in face - - # the following are only available if face.scalable - if font.scalable: - # the face global bounding box (xmin, ymin, xmax, ymax) - print('Bbox :', font.bbox) - # number of font units covered by the EM - print('EM :', font.units_per_EM) - # the ascender in 26.6 units - print('Ascender :', font.ascender) - # the descender in 26.6 units - print('Descender :', font.descender) - # the height in 26.6 units - print('Height :', font.height) - # maximum horizontal cursor advance - print('Max adv width :', font.max_advance_width) - # same for vertical layout - print('Max adv height :', font.max_advance_height) - # vertical position of the underline bar - print('Underline pos :', font.underline_position) - # vertical thickness of the underline - print('Underline thickness :', font.underline_thickness) - - for style in ('Italic', - 'Bold', - 'Scalable', - 'Fixed sizes', - 'Fixed width', - 'SFNT', - 'Horizontal', - 'Vertical', - 'Kerning', - 'Fast glyphs', - 'Multiple masters', - 'Glyph names', - 'External stream'): - bitpos = getattr(ft, style.replace(' ', '_').upper()) - 1 - print('%-17s:' % style, bool(font.style_flags & (1 << bitpos))) - - print(dir(font)) - - print(font.get_kerning) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/ftface_props.txt b/_sources/examples/misc/ftface_props.txt deleted file mode 100644 index 17b6070d078..00000000000 --- a/_sources/examples/misc/ftface_props.txt +++ /dev/null @@ -1,79 +0,0 @@ -.. _misc-ftface_props: - -misc example code: ftface_props.py -================================== - -[`source code `_] - -:: - - #!/usr/bin/env python - - from __future__ import print_function - """ - This is a demo script to show you how to use all the properties of an - FT2Font object. These describe global font properties. For - individual character metrices, use the Glyp object, as returned by - load_char - """ - import matplotlib - import matplotlib.ft2font as ft - - - #fname = '/usr/local/share/matplotlib/VeraIt.ttf' - fname = matplotlib.get_data_path() + '/fonts/ttf/VeraIt.ttf' - #fname = '/usr/local/share/matplotlib/cmr10.ttf' - - font = ft.FT2Font(fname) - - print('Num faces :', font.num_faces) # number of faces in file - print('Num glyphs :', font.num_glyphs) # number of glyphs in the face - print('Family name :', font.family_name) # face family name - print('Syle name :', font.style_name) # face syle name - print('PS name :', font.postscript_name) # the postscript name - print('Num fixed :', font.num_fixed_sizes) # number of embedded bitmap in face - - # the following are only available if face.scalable - if font.scalable: - # the face global bounding box (xmin, ymin, xmax, ymax) - print('Bbox :', font.bbox) - # number of font units covered by the EM - print('EM :', font.units_per_EM) - # the ascender in 26.6 units - print('Ascender :', font.ascender) - # the descender in 26.6 units - print('Descender :', font.descender) - # the height in 26.6 units - print('Height :', font.height) - # maximum horizontal cursor advance - print('Max adv width :', font.max_advance_width) - # same for vertical layout - print('Max adv height :', font.max_advance_height) - # vertical position of the underline bar - print('Underline pos :', font.underline_position) - # vertical thickness of the underline - print('Underline thickness :', font.underline_thickness) - - for style in ('Italic', - 'Bold', - 'Scalable', - 'Fixed sizes', - 'Fixed width', - 'SFNT', - 'Horizontal', - 'Vertical', - 'Kerning', - 'Fast glyphs', - 'Multiple masters', - 'Glyph names', - 'External stream'): - bitpos = getattr(ft, style.replace(' ', '_').upper()) - 1 - print('%-17s:' % style, bool(font.style_flags & (1 << bitpos))) - - print(dir(font)) - - cmap = font.get_charmap() - print(font.get_kerning) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/image_thumbnail.rst.txt b/_sources/examples/misc/image_thumbnail.rst.txt deleted file mode 100644 index 88f0a1d4bb2..00000000000 --- a/_sources/examples/misc/image_thumbnail.rst.txt +++ /dev/null @@ -1,44 +0,0 @@ -.. _misc-image_thumbnail: - -misc example code: image_thumbnail.py -===================================== - -[`source code `_] - -:: - - # -*- noplot -*- - """ - You can use matplotlib to generate thumbnails from existing images. - matplotlib natively supports PNG files on the input side, and other - image types transparently if your have PIL installed - """ - - from __future__ import print_function - # build thumbnails of all images in a directory - import sys - import os - import glob - import matplotlib.image as image - - - if len(sys.argv) != 2: - print('Usage: python %s IMAGEDIR' % __file__) - raise SystemExit - indir = sys.argv[1] - if not os.path.isdir(indir): - print('Could not find input directory "%s"' % indir) - raise SystemExit - - outdir = 'thumbs' - if not os.path.exists(outdir): - os.makedirs(outdir) - - for fname in glob.glob(os.path.join(indir, '*.png')): - basedir, basename = os.path.split(fname) - outfile = os.path.join(outdir, basename) - fig = image.thumbnail(fname, outfile, scale=0.15) - print('saved thumbnail of %s to %s' % (fname, outfile)) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/image_thumbnail.txt b/_sources/examples/misc/image_thumbnail.txt deleted file mode 100644 index be9dd6c756e..00000000000 --- a/_sources/examples/misc/image_thumbnail.txt +++ /dev/null @@ -1,43 +0,0 @@ -.. _misc-image_thumbnail: - -misc example code: image_thumbnail.py -===================================== - -[`source code `_] - -:: - - """ - You can use matplotlib to generate thumbnails from existing images. - matplotlib natively supports PNG files on the input side, and other - image types transparently if your have PIL installed - """ - - from __future__ import print_function - # build thumbnails of all images in a directory - import sys - import os - import glob - import matplotlib.image as image - - - if len(sys.argv) != 2: - print('Usage: python %s IMAGEDIR' % __file__) - raise SystemExit - indir = sys.argv[1] - if not os.path.isdir(indir): - print('Could not find input directory "%s"' % indir) - raise SystemExit - - outdir = 'thumbs' - if not os.path.exists(outdir): - os.makedirs(outdir) - - for fname in glob.glob(os.path.join(indir, '*.png')): - basedir, basename = os.path.split(fname) - outfile = os.path.join(outdir, basename) - fig = image.thumbnail(fname, outfile, scale=0.15) - print('saved thumbnail of %s to %s' % (fname, outfile)) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/index.rst.txt b/_sources/examples/misc/index.rst.txt deleted file mode 100644 index 5f23c210984..00000000000 --- a/_sources/examples/misc/index.rst.txt +++ /dev/null @@ -1,27 +0,0 @@ -.. _misc-examples-index: - -############################################## -misc Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - contour_manual - font_indexing - ftface_props - image_thumbnail - multiprocess - rasterization_demo - rc_traits - rec_groupby_demo - rec_join_demo - sample_data_demo - svg_filter_line - svg_filter_pie - tight_bbox_test diff --git a/_sources/examples/misc/index.txt b/_sources/examples/misc/index.txt deleted file mode 100644 index e6d14c688d8..00000000000 --- a/_sources/examples/misc/index.txt +++ /dev/null @@ -1,28 +0,0 @@ -.. _misc-examples-index: - -############################################## -misc Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - contour_manual - font_indexing - ftface_props - image_thumbnail - longshort - multiprocess - rasterization_demo - rc_traits - rec_groupby_demo - rec_join_demo - sample_data_demo - svg_filter_line - svg_filter_pie - tight_bbox_test diff --git a/_sources/examples/misc/longshort.txt b/_sources/examples/misc/longshort.txt deleted file mode 100644 index 81cda61f316..00000000000 --- a/_sources/examples/misc/longshort.txt +++ /dev/null @@ -1,58 +0,0 @@ -.. _misc-longshort: - -misc example code: longshort.py -=============================== - -[`source code `_] - -:: - - """ - Illustrate the rec array utility funcitons by loading prices from a - csv file, computing the daily returns, appending the results to the - record arrays, joining on date - """ - import urllib - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.mlab as mlab - - # grab the price data off yahoo - u1 = urllib.urlretrieve('http://ichart.finance.yahoo.com/table.csv?s=AAPL&d=9&e=14&f=2008&g=d&a=8&b=7&c=1984&ignore=.csv') - u2 = urllib.urlretrieve('http://ichart.finance.yahoo.com/table.csv?s=GOOG&d=9&e=14&f=2008&g=d&a=8&b=7&c=1984&ignore=.csv') - - # load the CSV files into record arrays - r1 = mlab.csv2rec(file(u1[0])) - r2 = mlab.csv2rec(file(u2[0])) - - # compute the daily returns and add these columns to the arrays - gains1 = np.zeros_like(r1.adj_close) - gains2 = np.zeros_like(r2.adj_close) - gains1[1:] = np.diff(r1.adj_close)/r1.adj_close[:-1] - gains2[1:] = np.diff(r2.adj_close)/r2.adj_close[:-1] - r1 = mlab.rec_append_fields(r1, 'gains', gains1) - r2 = mlab.rec_append_fields(r2, 'gains', gains2) - - # now join them by date; the default postfixes are 1 and 2. The - # default jointype is inner so it will do an intersection of dates and - # drop the dates in AAPL which occurred before GOOG started trading in - # 2004. r1 and r2 are reverse ordered by date since Yahoo returns - # most recent first in the CSV files, but rec_join will sort by key so - # r below will be properly sorted - r = mlab.rec_join('date', r1, r2) - - - # long appl, short goog - g = r.gains1 - r.gains2 - tr = (1 + g).cumprod() # the total return - - # plot the return - fig, ax = plt.subplots() - ax.plot(r.date, tr) - ax.set_title('total return: long APPL, short GOOG') - ax.grid() - fig.autofmt_xdate() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/multiprocess.rst.txt b/_sources/examples/misc/multiprocess.rst.txt deleted file mode 100644 index 215d80e1ff9..00000000000 --- a/_sources/examples/misc/multiprocess.rst.txt +++ /dev/null @@ -1,102 +0,0 @@ -.. _misc-multiprocess: - -misc example code: multiprocess.py -================================== - -[`source code `_] - -:: - - # -*- noplot -*- - # Demo of using multiprocessing for generating data in one process and plotting - # in another. - # Written by Robert Cimrman - - from __future__ import print_function - import time - from multiprocessing import Process, Pipe - import numpy as np - - import matplotlib - matplotlib.use('GtkAgg') - import matplotlib.pyplot as plt - import gobject - - - class ProcessPlotter(object): - def __init__(self): - self.x = [] - self.y = [] - - def terminate(self): - plt.close('all') - - def poll_draw(self): - - def call_back(): - while 1: - if not self.pipe.poll(): - break - - command = self.pipe.recv() - - if command is None: - self.terminate() - return False - - else: - self.x.append(command[0]) - self.y.append(command[1]) - self.ax.plot(self.x, self.y, 'ro') - - self.fig.canvas.draw() - return True - - return call_back - - def __call__(self, pipe): - print('starting plotter...') - - self.pipe = pipe - self.fig, self.ax = plt.subplots() - self.gid = gobject.timeout_add(1000, self.poll_draw()) - - print('...done') - plt.show() - - - class NBPlot(object): - def __init__(self): - self.plot_pipe, plotter_pipe = Pipe() - self.plotter = ProcessPlotter() - self.plot_process = Process(target=self.plotter, - args=(plotter_pipe,)) - self.plot_process.daemon = True - self.plot_process.start() - - def plot(self, finished=False): - send = self.plot_pipe.send - if finished: - send(None) - else: - data = np.random.random(2) - send(data) - - - def main(): - pl = NBPlot() - for ii in range(10): - pl.plot() - time.sleep(0.5) - try: - input = raw_input - except NameError: - pass - input('press Enter...') - pl.plot(finished=True) - - if __name__ == '__main__': - main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/multiprocess.txt b/_sources/examples/misc/multiprocess.txt deleted file mode 100644 index 43185077fbd..00000000000 --- a/_sources/examples/misc/multiprocess.txt +++ /dev/null @@ -1,102 +0,0 @@ -.. _misc-multiprocess: - -misc example code: multiprocess.py -================================== - -[`source code `_] - -:: - - # Demo of using multiprocessing for generating data in one process and plotting - # in another. - # Written by Robert Cimrman - # Requires >= Python 2.6 for the multiprocessing module or having the - # standalone processing module installed - - from __future__ import print_function - import time - try: - from multiprocessing import Process, Pipe - except ImportError: - from processing import Process, Pipe - import numpy as np - - import matplotlib - matplotlib.use('GtkAgg') - import matplotlib.pyplot as plt - import gobject - - - class ProcessPlotter(object): - def __init__(self): - self.x = [] - self.y = [] - - def terminate(self): - plt.close('all') - - def poll_draw(self): - - def call_back(): - while 1: - if not self.pipe.poll(): - break - - command = self.pipe.recv() - - if command is None: - self.terminate() - return False - - else: - self.x.append(command[0]) - self.y.append(command[1]) - self.ax.plot(self.x, self.y, 'ro') - - self.fig.canvas.draw() - return True - - return call_back - - def __call__(self, pipe): - print('starting plotter...') - - self.pipe = pipe - self.fig, self.ax = plt.subplots() - self.gid = gobject.timeout_add(1000, self.poll_draw()) - - print('...done') - plt.show() - - - class NBPlot(object): - def __init__(self): - self.plot_pipe, plotter_pipe = Pipe() - self.plotter = ProcessPlotter() - self.plot_process = Process(target=self.plotter, - args=(plotter_pipe,)) - self.plot_process.daemon = True - self.plot_process.start() - - def plot(self, finished=False): - send = self.plot_pipe.send - if finished: - send(None) - else: - data = np.random.random(2) - send(data) - - - def main(): - pl = NBPlot() - for ii in range(10): - pl.plot() - time.sleep(0.5) - raw_input('press Enter...') - pl.plot(finished=True) - - if __name__ == '__main__': - main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/rasterization_demo.rst.txt b/_sources/examples/misc/rasterization_demo.rst.txt deleted file mode 100644 index 0ec6d962407..00000000000 --- a/_sources/examples/misc/rasterization_demo.rst.txt +++ /dev/null @@ -1,64 +0,0 @@ -.. _misc-rasterization_demo: - -misc example code: rasterization_demo.py -======================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/misc/rasterization_demo.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - - d = np.arange(100).reshape(10, 10) - x, y = np.meshgrid(np.arange(11), np.arange(11)) - - theta = 0.25*np.pi - xx = x*np.cos(theta) - y*np.sin(theta) - yy = x*np.sin(theta) + y*np.cos(theta) - - fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2) - ax1.set_aspect(1) - ax1.pcolormesh(xx, yy, d) - ax1.set_title("No Rasterization") - - ax2.set_aspect(1) - ax2.set_title("Rasterization") - - m = ax2.pcolormesh(xx, yy, d) - m.set_rasterized(True) - - ax3.set_aspect(1) - ax3.pcolormesh(xx, yy, d) - ax3.text(0.5, 0.5, "Text", alpha=0.2, - va="center", ha="center", size=50, transform=ax3.transAxes) - - ax3.set_title("No Rasterization") - - - ax4.set_aspect(1) - m = ax4.pcolormesh(xx, yy, d) - m.set_zorder(-20) - - ax4.text(0.5, 0.5, "Text", alpha=0.2, - zorder=-15, - va="center", ha="center", size=50, transform=ax4.transAxes) - - ax4.set_rasterization_zorder(-10) - - ax4.set_title("Rasterization z$<-10$") - - - # ax2.title.set_rasterized(True) # should display a warning - - plt.savefig("test_rasterization.pdf", dpi=150) - plt.savefig("test_rasterization.eps", dpi=150) - - if not plt.rcParams["text.usetex"]: - plt.savefig("test_rasterization.svg", dpi=150) - # svg backend currently ignores the dpi - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/rasterization_demo.txt b/_sources/examples/misc/rasterization_demo.txt deleted file mode 100644 index 1d223281c92..00000000000 --- a/_sources/examples/misc/rasterization_demo.txt +++ /dev/null @@ -1,62 +0,0 @@ -.. _misc-rasterization_demo: - -misc example code: rasterization_demo.py -======================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - - d = np.arange(100).reshape(10, 10) - x, y = np.meshgrid(np.arange(11), np.arange(11)) - - theta = 0.25*np.pi - xx = x*np.cos(theta) - y*np.sin(theta) - yy = x*np.sin(theta) + y*np.cos(theta) - - fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2) - ax1.set_aspect(1) - ax1.pcolormesh(xx, yy, d) - ax1.set_title("No Rasterization") - - ax2.set_aspect(1) - ax2.set_title("Rasterization") - - m = ax2.pcolormesh(xx, yy, d) - m.set_rasterized(True) - - ax3.set_aspect(1) - ax3.pcolormesh(xx, yy, d) - ax3.text(0.5, 0.5, "Text", alpha=0.2, - va="center", ha="center", size=50, transform=ax3.transAxes) - - ax3.set_title("No Rasterization") - - - ax4.set_aspect(1) - m = ax4.pcolormesh(xx, yy, d) - m.set_zorder(-20) - - ax4.text(0.5, 0.5, "Text", alpha=0.2, - zorder=-15, - va="center", ha="center", size=50, transform=ax4.transAxes) - - ax4.set_rasterization_zorder(-10) - - ax4.set_title("Rasterization z$<-10$") - - - # ax2.title.set_rasterized(True) # should display a warning - - plt.savefig("test_rasterization.pdf", dpi=150) - plt.savefig("test_rasterization.eps", dpi=150) - - if not plt.rcParams["text.usetex"]: - plt.savefig("test_rasterization.svg", dpi=150) - # svg backend currently ignores the dpi - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/rc_traits.rst.txt b/_sources/examples/misc/rc_traits.rst.txt deleted file mode 100644 index 697c6809666..00000000000 --- a/_sources/examples/misc/rc_traits.rst.txt +++ /dev/null @@ -1,225 +0,0 @@ -.. _misc-rc_traits: - -misc example code: rc_traits.py -=============================== - -[`source code `_] - -:: - - # -*- noplot -*- - # Here is some example code showing how to define some representative - # rc properties and construct a matplotlib artist using traits. - # matplotlib does not ship with enthought.traits, so you will need to - # install it separately. - - from __future__ import print_function - - import sys - import os - import re - import traits.api as traits - from matplotlib.cbook import is_string_like - from matplotlib.artist import Artist - - doprint = True - flexible_true_trait = traits.Trait( - True, - {'true': True, 't': True, 'yes': True, 'y': True, 'on': True, True: True, - 'false': False, 'f': False, 'no': False, 'n': False, 'off': False, False: False - }) - flexible_false_trait = traits.Trait(False, flexible_true_trait) - - colors = { - 'c': '#00bfbf', - 'b': '#0000ff', - 'g': '#008000', - 'k': '#000000', - 'm': '#bf00bf', - 'r': '#ff0000', - 'w': '#ffffff', - 'y': '#bfbf00', - 'gold': '#FFD700', - 'peachpuff': '#FFDAB9', - 'navajowhite': '#FFDEAD', - } - - - def hex2color(s): - "Convert hex string (like html uses, eg, #efefef) to a r,g,b tuple" - return tuple([int(n, 16)/255.0 for n in (s[1:3], s[3:5], s[5:7])]) - - - class RGBA(traits.HasTraits): - # r,g,b,a in the range 0-1 with default color 0,0,0,1 (black) - r = traits.Range(0., 1., 0.) - g = traits.Range(0., 1., 0.) - b = traits.Range(0., 1., 0.) - a = traits.Range(0., 1., 1.) - - def __init__(self, r=0., g=0., b=0., a=1.): - self.r = r - self.g = g - self.b = b - self.a = a - - def __repr__(self): - return 'r,g,b,a = (%1.2f, %1.2f, %1.2f, %1.2f)' %\ - (self.r, self.g, self.b, self.a) - - - def tuple_to_rgba(ob, name, val): - tup = [float(x) for x in val] - if len(tup) == 3: - r, g, b = tup - return RGBA(r, g, b) - elif len(tup) == 4: - r, g, b, a = tup - return RGBA(r, g, b, a) - else: - raise ValueError - tuple_to_rgba.info = 'a RGB or RGBA tuple of floats' - - - def hex_to_rgba(ob, name, val): - rgx = re.compile('^#[0-9A-Fa-f]{6}$') - - if not is_string_like(val): - raise TypeError - if rgx.match(val) is None: - raise ValueError - r, g, b = hex2color(val) - return RGBA(r, g, b, 1.0) - hex_to_rgba.info = 'a hex color string' - - - def colorname_to_rgba(ob, name, val): - hex = colors[val.lower()] - r, g, b = hex2color(hex) - return RGBA(r, g, b, 1.0) - colorname_to_rgba.info = 'a named color' - - - def float_to_rgba(ob, name, val): - val = float(val) - return RGBA(val, val, val, 1.) - float_to_rgba.info = 'a grayscale intensity' - - - Color = traits.Trait(RGBA(), float_to_rgba, colorname_to_rgba, RGBA, - hex_to_rgba, tuple_to_rgba) - - - def file_exists(ob, name, val): - fh = file(val, 'r') - return val - - linestyles = ('-', '--', '-.', ':', 'steps', 'None') - TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN = range(4) - linemarkers = (None, '.', ',', 'o', '^', 'v', '<', '>', 's', - '+', 'x', 'd', 'D', '|', '_', 'h', 'H', - 'p', '1', '2', '3', '4', - TICKLEFT, - TICKRIGHT, - TICKUP, - TICKDOWN, - 'None' - ) - - - class LineRC(traits.HasTraits): - linewidth = traits.Float(0.5) - linestyle = traits.Trait(*linestyles) - color = Color - marker = traits.Trait(*linemarkers) - markerfacecolor = Color - markeredgecolor = Color - markeredgewidth = traits.Float(0.5) - markersize = traits.Float(6) - antialiased = flexible_true_trait - data_clipping = flexible_false_trait - - - class PatchRC(traits.HasTraits): - linewidth = traits.Float(1.0) - facecolor = Color - edgecolor = Color - antialiased = flexible_true_trait - - timezones = 'UTC', 'US/Central', 'ES/Eastern' # fixme: and many more - backends = ('GTKAgg', 'Cairo', 'GDK', 'GTK', 'Agg', - 'GTKCairo', 'PS', 'SVG', 'Template', 'TkAgg', - 'WX') - - - class RC(traits.HasTraits): - backend = traits.Trait(*backends) - interactive = flexible_false_trait - toolbar = traits.Trait('toolbar2', 'classic', None) - timezone = traits.Trait(*timezones) - lines = traits.Trait(LineRC()) - patch = traits.Trait(PatchRC()) - - rc = RC() - rc.lines.color = 'r' - if doprint: - print('RC') - rc.print_traits() - print('RC lines') - rc.lines.print_traits() - print('RC patches') - rc.patch.print_traits() - - - class Patch(Artist, traits.HasTraits): - linewidth = traits.Float(0.5) - facecolor = Color - fc = facecolor - edgecolor = Color - fill = flexible_true_trait - - def __init__(self, - edgecolor=None, - facecolor=None, - linewidth=None, - antialiased=None, - fill=1, - **kwargs - ): - Artist.__init__(self) - - if edgecolor is None: - edgecolor = rc.patch.edgecolor - if facecolor is None: - facecolor = rc.patch.facecolor - if linewidth is None: - linewidth = rc.patch.linewidth - if antialiased is None: - antialiased = rc.patch.antialiased - - self.edgecolor = edgecolor - self.facecolor = facecolor - self.linewidth = linewidth - self.antialiased = antialiased - self.fill = fill - - - p = Patch() - p.facecolor = '#bfbf00' - p.edgecolor = 'gold' - p.facecolor = (1, .5, .5, .25) - p.facecolor = 0.25 - p.fill = 'f' - print('p.facecolor', type(p.facecolor), p.facecolor) - print('p.fill', type(p.fill), p.fill) - if p.fill_: - print('fill') - else: - print('no fill') - if doprint: - print() - print('Patch') - p.print_traits() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/rc_traits.txt b/_sources/examples/misc/rc_traits.txt deleted file mode 100644 index 4528fae4abb..00000000000 --- a/_sources/examples/misc/rc_traits.txt +++ /dev/null @@ -1,224 +0,0 @@ -.. _misc-rc_traits: - -misc example code: rc_traits.py -=============================== - -[`source code `_] - -:: - - # Here is some example code showing how to define some representative - # rc properties and construct a matplotlib artist using traits. - # matplotlib does not ship with enthought.traits, so you will need to - # install it separately. - - from __future__ import print_function - - import sys - import os - import re - import traits.api as traits - from matplotlib.cbook import is_string_like - from matplotlib.artist import Artist - - doprint = True - flexible_true_trait = traits.Trait( - True, - {'true': True, 't': True, 'yes': True, 'y': True, 'on': True, True: True, - 'false': False, 'f': False, 'no': False, 'n': False, 'off': False, False: False - }) - flexible_false_trait = traits.Trait(False, flexible_true_trait) - - colors = { - 'c': '#00bfbf', - 'b': '#0000ff', - 'g': '#008000', - 'k': '#000000', - 'm': '#bf00bf', - 'r': '#ff0000', - 'w': '#ffffff', - 'y': '#bfbf00', - 'gold': '#FFD700', - 'peachpuff': '#FFDAB9', - 'navajowhite': '#FFDEAD', - } - - - def hex2color(s): - "Convert hex string (like html uses, eg, #efefef) to a r,g,b tuple" - return tuple([int(n, 16)/255.0 for n in (s[1:3], s[3:5], s[5:7])]) - - - class RGBA(traits.HasTraits): - # r,g,b,a in the range 0-1 with default color 0,0,0,1 (black) - r = traits.Range(0., 1., 0.) - g = traits.Range(0., 1., 0.) - b = traits.Range(0., 1., 0.) - a = traits.Range(0., 1., 1.) - - def __init__(self, r=0., g=0., b=0., a=1.): - self.r = r - self.g = g - self.b = b - self.a = a - - def __repr__(self): - return 'r,g,b,a = (%1.2f, %1.2f, %1.2f, %1.2f)' %\ - (self.r, self.g, self.b, self.a) - - - def tuple_to_rgba(ob, name, val): - tup = [float(x) for x in val] - if len(tup) == 3: - r, g, b = tup - return RGBA(r, g, b) - elif len(tup) == 4: - r, g, b, a = tup - return RGBA(r, g, b, a) - else: - raise ValueError - tuple_to_rgba.info = 'a RGB or RGBA tuple of floats' - - - def hex_to_rgba(ob, name, val): - rgx = re.compile('^#[0-9A-Fa-f]{6}$') - - if not is_string_like(val): - raise TypeError - if rgx.match(val) is None: - raise ValueError - r, g, b = hex2color(val) - return RGBA(r, g, b, 1.0) - hex_to_rgba.info = 'a hex color string' - - - def colorname_to_rgba(ob, name, val): - hex = colors[val.lower()] - r, g, b = hex2color(hex) - return RGBA(r, g, b, 1.0) - colorname_to_rgba.info = 'a named color' - - - def float_to_rgba(ob, name, val): - val = float(val) - return RGBA(val, val, val, 1.) - float_to_rgba.info = 'a grayscale intensity' - - - Color = traits.Trait(RGBA(), float_to_rgba, colorname_to_rgba, RGBA, - hex_to_rgba, tuple_to_rgba) - - - def file_exists(ob, name, val): - fh = file(val, 'r') - return val - - linestyles = ('-', '--', '-.', ':', 'steps', 'None') - TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN = range(4) - linemarkers = (None, '.', ',', 'o', '^', 'v', '<', '>', 's', - '+', 'x', 'd', 'D', '|', '_', 'h', 'H', - 'p', '1', '2', '3', '4', - TICKLEFT, - TICKRIGHT, - TICKUP, - TICKDOWN, - 'None' - ) - - - class LineRC(traits.HasTraits): - linewidth = traits.Float(0.5) - linestyle = traits.Trait(*linestyles) - color = Color - marker = traits.Trait(*linemarkers) - markerfacecolor = Color - markeredgecolor = Color - markeredgewidth = traits.Float(0.5) - markersize = traits.Float(6) - antialiased = flexible_true_trait - data_clipping = flexible_false_trait - - - class PatchRC(traits.HasTraits): - linewidth = traits.Float(1.0) - facecolor = Color - edgecolor = Color - antialiased = flexible_true_trait - - timezones = 'UTC', 'US/Central', 'ES/Eastern' # fixme: and many more - backends = ('GTKAgg', 'Cairo', 'GDK', 'GTK', 'Agg', - 'GTKCairo', 'PS', 'SVG', 'Template', 'TkAgg', - 'WX') - - - class RC(traits.HasTraits): - backend = traits.Trait(*backends) - interactive = flexible_false_trait - toolbar = traits.Trait('toolbar2', 'classic', None) - timezone = traits.Trait(*timezones) - lines = traits.Trait(LineRC()) - patch = traits.Trait(PatchRC()) - - rc = RC() - rc.lines.color = 'r' - if doprint: - print('RC') - rc.print_traits() - print('RC lines') - rc.lines.print_traits() - print('RC patches') - rc.patch.print_traits() - - - class Patch(Artist, traits.HasTraits): - linewidth = traits.Float(0.5) - facecolor = Color - fc = facecolor - edgecolor = Color - fill = flexible_true_trait - - def __init__(self, - edgecolor=None, - facecolor=None, - linewidth=None, - antialiased=None, - fill=1, - **kwargs - ): - Artist.__init__(self) - - if edgecolor is None: - edgecolor = rc.patch.edgecolor - if facecolor is None: - facecolor = rc.patch.facecolor - if linewidth is None: - linewidth = rc.patch.linewidth - if antialiased is None: - antialiased = rc.patch.antialiased - - self.edgecolor = edgecolor - self.facecolor = facecolor - self.linewidth = linewidth - self.antialiased = antialiased - self.fill = fill - - - p = Patch() - p.facecolor = '#bfbf00' - p.edgecolor = 'gold' - p.facecolor = (1, .5, .5, .25) - p.facecolor = 0.25 - p.fill = 'f' - print('p.facecolor', type(p.facecolor), p.facecolor) - print('p.fill', type(p.fill), p.fill) - if p.fill_: - print('fill') - else: - print('no fill') - if doprint: - print() - print('Patch') - p.print_traits() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/rec_groupby_demo.rst.txt b/_sources/examples/misc/rec_groupby_demo.rst.txt deleted file mode 100644 index 99f569b8802..00000000000 --- a/_sources/examples/misc/rec_groupby_demo.rst.txt +++ /dev/null @@ -1,79 +0,0 @@ -.. _misc-rec_groupby_demo: - -misc example code: rec_groupby_demo.py -====================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/misc/rec_groupby_demo.py - -:: - - from __future__ import print_function - import numpy as np - import matplotlib.mlab as mlab - import matplotlib.cbook as cbook - - datafile = cbook.get_sample_data('aapl.csv', asfileobj=False) - print('loading', datafile) - r = mlab.csv2rec(datafile) - r.sort() - - - def daily_return(prices): - 'an array of daily returns from price array' - g = np.zeros_like(prices) - g[1:] = (prices[1:] - prices[:-1])/prices[:-1] - return g - - - def volume_code(volume): - 'code the continuous volume data categorically' - ind = np.searchsorted([1e5, 1e6, 5e6, 10e6, 1e7], volume) - return ind - - # a list of (dtype_name, summary_function, output_dtype_name). - # rec_summarize will call on each function on the indicated recarray - # attribute, and the result assigned to output name in the return - # record array. - summaryfuncs = ( - ('date', lambda x: [thisdate.year for thisdate in x], 'years'), - ('date', lambda x: [thisdate.month for thisdate in x], 'months'), - ('date', lambda x: [thisdate.weekday() for thisdate in x], 'weekday'), - ('adj_close', daily_return, 'dreturn'), - ('volume', volume_code, 'volcode'), - ) - - rsum = mlab.rec_summarize(r, summaryfuncs) - - # stats is a list of (dtype_name, function, output_dtype_name). - # rec_groupby will summarize the attribute identified by the - # dtype_name over the groups in the groupby list, and assign the - # result to the output_dtype_name - stats = ( - ('dreturn', len, 'rcnt'), - ('dreturn', np.mean, 'rmean'), - ('dreturn', np.median, 'rmedian'), - ('dreturn', np.std, 'rsigma'), - ) - - # you can summarize over a single variable, like years or months - print('summary by years') - ry = mlab.rec_groupby(rsum, ('years',), stats) - print(mlab. rec2txt(ry)) - - print('summary by months') - rm = mlab.rec_groupby(rsum, ('months',), stats) - print(mlab.rec2txt(rm)) - - # or over multiple variables like years and months - print('summary by year and month') - rym = mlab.rec_groupby(rsum, ('years', 'months'), stats) - print(mlab.rec2txt(rym)) - - print('summary by volume') - rv = mlab.rec_groupby(rsum, ('volcode',), stats) - print(mlab.rec2txt(rv)) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/rec_groupby_demo.txt b/_sources/examples/misc/rec_groupby_demo.txt deleted file mode 100644 index f93613504ab..00000000000 --- a/_sources/examples/misc/rec_groupby_demo.txt +++ /dev/null @@ -1,77 +0,0 @@ -.. _misc-rec_groupby_demo: - -misc example code: rec_groupby_demo.py -====================================== - -[`source code `_] - -:: - - from __future__ import print_function - import numpy as np - import matplotlib.mlab as mlab - import matplotlib.cbook as cbook - - datafile = cbook.get_sample_data('aapl.csv', asfileobj=False) - print('loading', datafile) - r = mlab.csv2rec(datafile) - r.sort() - - - def daily_return(prices): - 'an array of daily returns from price array' - g = np.zeros_like(prices) - g[1:] = (prices[1:] - prices[:-1])/prices[:-1] - return g - - - def volume_code(volume): - 'code the continuous volume data categorically' - ind = np.searchsorted([1e5, 1e6, 5e6, 10e6, 1e7], volume) - return ind - - # a list of (dtype_name, summary_function, output_dtype_name). - # rec_summarize will call on each function on the indicated recarray - # attribute, and the result assigned to output name in the return - # record array. - summaryfuncs = ( - ('date', lambda x: [thisdate.year for thisdate in x], 'years'), - ('date', lambda x: [thisdate.month for thisdate in x], 'months'), - ('date', lambda x: [thisdate.weekday() for thisdate in x], 'weekday'), - ('adj_close', daily_return, 'dreturn'), - ('volume', volume_code, 'volcode'), - ) - - rsum = mlab.rec_summarize(r, summaryfuncs) - - # stats is a list of (dtype_name, function, output_dtype_name). - # rec_groupby will summarize the attribute identified by the - # dtype_name over the groups in the groupby list, and assign the - # result to the output_dtype_name - stats = ( - ('dreturn', len, 'rcnt'), - ('dreturn', np.mean, 'rmean'), - ('dreturn', np.median, 'rmedian'), - ('dreturn', np.std, 'rsigma'), - ) - - # you can summarize over a single variable, like years or months - print('summary by years') - ry = mlab.rec_groupby(rsum, ('years',), stats) - print(mlab. rec2txt(ry)) - - print('summary by months') - rm = mlab.rec_groupby(rsum, ('months',), stats) - print(mlab.rec2txt(rm)) - - # or over multiple variables like years and months - print('summary by year and month') - rym = mlab.rec_groupby(rsum, ('years', 'months'), stats) - print(mlab.rec2txt(rym)) - - print('summary by volume') - rv = mlab.rec_groupby(rsum, ('volcode',), stats) - print(mlab.rec2txt(rv)) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/rec_join_demo.rst.txt b/_sources/examples/misc/rec_join_demo.rst.txt deleted file mode 100644 index 603dfebb294..00000000000 --- a/_sources/examples/misc/rec_join_demo.rst.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _misc-rec_join_demo: - -misc example code: rec_join_demo.py -=================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/misc/rec_join_demo.py - -:: - - from __future__ import print_function - import numpy as np - import matplotlib.mlab as mlab - import matplotlib.cbook as cbook - - datafile = cbook.get_sample_data('aapl.csv', asfileobj=False) - print('loading', datafile) - r = mlab.csv2rec(datafile) - - r.sort() - r1 = r[-10:] - - # Create a new array - r2 = np.empty(12, dtype=[('date', '|O4'), ('high', np.float), - ('marker', np.float)]) - r2 = r2.view(np.recarray) - r2.date = r.date[-17:-5] - r2.high = r.high[-17:-5] - r2.marker = np.arange(12) - - print("r1:") - print(mlab.rec2txt(r1)) - print("r2:") - print(mlab.rec2txt(r2)) - - defaults = {'marker': -1, 'close': np.NaN, 'low': -4444.} - - for s in ('inner', 'outer', 'leftouter'): - rec = mlab.rec_join(['date', 'high'], r1, r2, - jointype=s, defaults=defaults) - print("\n%sjoin :\n%s" % (s, mlab.rec2txt(rec))) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/rec_join_demo.txt b/_sources/examples/misc/rec_join_demo.txt deleted file mode 100644 index 51e156d5e04..00000000000 --- a/_sources/examples/misc/rec_join_demo.txt +++ /dev/null @@ -1,43 +0,0 @@ -.. _misc-rec_join_demo: - -misc example code: rec_join_demo.py -=================================== - -[`source code `_] - -:: - - from __future__ import print_function - import numpy as np - import matplotlib.mlab as mlab - import matplotlib.cbook as cbook - - datafile = cbook.get_sample_data('aapl.csv', asfileobj=False) - print('loading', datafile) - r = mlab.csv2rec(datafile) - - r.sort() - r1 = r[-10:] - - # Create a new array - r2 = np.empty(12, dtype=[('date', '|O4'), ('high', np.float), - ('marker', np.float)]) - r2 = r2.view(np.recarray) - r2.date = r.date[-17:-5] - r2.high = r.high[-17:-5] - r2.marker = np.arange(12) - - print("r1:") - print(mlab.rec2txt(r1)) - print("r2:") - print(mlab.rec2txt(r2)) - - defaults = {'marker': -1, 'close': np.NaN, 'low': -4444.} - - for s in ('inner', 'outer', 'leftouter'): - rec = mlab.rec_join(['date', 'high'], r1, r2, - jointype=s, defaults=defaults) - print("\n%sjoin :\n%s" % (s, mlab.rec2txt(rec))) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/sample_data_demo.rst.txt b/_sources/examples/misc/sample_data_demo.rst.txt deleted file mode 100644 index c116b209545..00000000000 --- a/_sources/examples/misc/sample_data_demo.rst.txt +++ /dev/null @@ -1,27 +0,0 @@ -.. _misc-sample_data_demo: - -misc example code: sample_data_demo.py -====================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/misc/sample_data_demo.py - -:: - - """ - Grab mpl data from the ~/.matplotlib/sample_data cache if it exists, else - fetch it from GitHub and cache it - """ - from __future__ import print_function - import matplotlib.cbook as cbook - import matplotlib.pyplot as plt - fname = cbook.get_sample_data('ada.png', asfileobj=False) - - print('fname', fname) - im = plt.imread(fname) - plt.imshow(im) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/sample_data_demo.txt b/_sources/examples/misc/sample_data_demo.txt deleted file mode 100644 index 66ab7c5965b..00000000000 --- a/_sources/examples/misc/sample_data_demo.txt +++ /dev/null @@ -1,25 +0,0 @@ -.. _misc-sample_data_demo: - -misc example code: sample_data_demo.py -====================================== - -[`source code `_] - -:: - - """ - Grab mpl data from the ~/.matplotlib/sample_data cache if it exists, else - fetch it from github and cache it - """ - from __future__ import print_function - import matplotlib.cbook as cbook - import matplotlib.pyplot as plt - fname = cbook.get_sample_data('ada.png', asfileobj=False) - - print('fname', fname) - im = plt.imread(fname) - plt.imshow(im) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/sample_data_test.txt b/_sources/examples/misc/sample_data_test.txt deleted file mode 100644 index 629b519061c..00000000000 --- a/_sources/examples/misc/sample_data_test.txt +++ /dev/null @@ -1,38 +0,0 @@ -.. _misc-sample_data_test: - -misc example code: sample_data_test.py -====================================== - -[`source code `_] - -:: - - """ - Demonstrate how get_sample_data works with git revisions in the data. - - git clone git@github.com/matplotlib/sample_data.git - - and edit testdata.csv to add a new row. After committing the changes, - when you rerun this script you will get the updated data (and the new - git version will be cached in ~/.matplotlib/sample_data) - """ - - import matplotlib.mlab as mlab - import matplotlib.cbook as cbook - - # get the file handle to the cached data and print the contents - datafile = 'testdir/subdir/testsub.csv' - fh = cbook.get_sample_data(datafile) - print fh.read() - - # make sure we can read it using csv2rec - fh.seek(0) - r = mlab.csv2rec(fh) - - print mlab.rec2txt(r) - - fh.close() - - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/svg_filter_line.rst.txt b/_sources/examples/misc/svg_filter_line.rst.txt deleted file mode 100644 index 3a0cb901ec7..00000000000 --- a/_sources/examples/misc/svg_filter_line.rst.txt +++ /dev/null @@ -1,100 +0,0 @@ -.. _misc-svg_filter_line: - -misc example code: svg_filter_line.py -===================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/misc/svg_filter_line.py - -:: - - """ - Demonstrate SVG filtering effects which might be used with mpl. - - Note that the filtering effects are only effective if your svg renderer - support it. - """ - - from __future__ import print_function - import matplotlib - - matplotlib.use("Svg") - - import matplotlib.pyplot as plt - import matplotlib.transforms as mtransforms - - fig1 = plt.figure() - ax = fig1.add_axes([0.1, 0.1, 0.8, 0.8]) - - # draw lines - l1, = ax.plot([0.1, 0.5, 0.9], [0.1, 0.9, 0.5], "bo-", - mec="b", lw=5, ms=10, label="Line 1") - l2, = ax.plot([0.1, 0.5, 0.9], [0.5, 0.2, 0.7], "rs-", - mec="r", lw=5, ms=10, color="r", label="Line 2") - - - for l in [l1, l2]: - - # draw shadows with same lines with slight offset and gray colors. - - xx = l.get_xdata() - yy = l.get_ydata() - shadow, = ax.plot(xx, yy) - shadow.update_from(l) - - # adjust color - shadow.set_color("0.2") - # adjust zorder of the shadow lines so that it is drawn below the - # original lines - shadow.set_zorder(l.get_zorder() - 0.5) - - # offset transform - ot = mtransforms.offset_copy(l.get_transform(), fig1, - x=4.0, y=-6.0, units='points') - - shadow.set_transform(ot) - - # set the id for a later use - shadow.set_gid(l.get_label() + "_shadow") - - - ax.set_xlim(0., 1.) - ax.set_ylim(0., 1.) - - # save the figure as a bytes string in the svg format. - from io import BytesIO - f = BytesIO() - plt.savefig(f, format="svg") - - - import xml.etree.cElementTree as ET - - # filter definition for a gaussian blur - filter_def = """ - - - - - - """ - - - # read in the saved svg - tree, xmlid = ET.XMLID(f.getvalue()) - - # insert the filter definition in the svg dom tree. - tree.insert(0, ET.XML(filter_def)) - - for l in [l1, l2]: - # pick up the svg element with given id - shadow = xmlid[l.get_label() + "_shadow"] - # apply shadow filter - shadow.set("filter", 'url(#dropshadow)') - - fn = "svg_filter_line.svg" - print("Saving '%s'" % fn) - ET.ElementTree(tree).write(fn) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/svg_filter_line.txt b/_sources/examples/misc/svg_filter_line.txt deleted file mode 100644 index 190063e6e7e..00000000000 --- a/_sources/examples/misc/svg_filter_line.txt +++ /dev/null @@ -1,98 +0,0 @@ -.. _misc-svg_filter_line: - -misc example code: svg_filter_line.py -===================================== - -[`source code `_] - -:: - - """ - Demonstrate SVG filtering effects which might be used with mpl. - - Note that the filtering effects are only effective if your svg rederer - support it. - """ - - from __future__ import print_function - import matplotlib - - matplotlib.use("Svg") - - import matplotlib.pyplot as plt - import matplotlib.transforms as mtransforms - - fig1 = plt.figure() - ax = fig1.add_axes([0.1, 0.1, 0.8, 0.8]) - - # draw lines - l1, = ax.plot([0.1, 0.5, 0.9], [0.1, 0.9, 0.5], "bo-", - mec="b", lw=5, ms=10, label="Line 1") - l2, = ax.plot([0.1, 0.5, 0.9], [0.5, 0.2, 0.7], "rs-", - mec="r", lw=5, ms=10, color="r", label="Line 2") - - - for l in [l1, l2]: - - # draw shadows with same lines with slight offset and gray colors. - - xx = l.get_xdata() - yy = l.get_ydata() - shadow, = ax.plot(xx, yy) - shadow.update_from(l) - - # adjust color - shadow.set_color("0.2") - # adjust zorder of the shadow lines so that it is drawn below the - # original lines - shadow.set_zorder(l.get_zorder() - 0.5) - - # offset transform - ot = mtransforms.offset_copy(l.get_transform(), fig1, - x=4.0, y=-6.0, units='points') - - shadow.set_transform(ot) - - # set the id for a later use - shadow.set_gid(l.get_label() + "_shadow") - - - ax.set_xlim(0., 1.) - ax.set_ylim(0., 1.) - - # save the figure as a bytes string in the svg format. - from io import BytesIO - f = BytesIO() - plt.savefig(f, format="svg") - - - import xml.etree.cElementTree as ET - - # filter definition for a gaussian blur - filter_def = """ - - - - - - """ - - - # read in the saved svg - tree, xmlid = ET.XMLID(f.getvalue()) - - # insert the filter definition in the svg dom tree. - tree.insert(0, ET.XML(filter_def)) - - for l in [l1, l2]: - # pick up the svg element with given id - shadow = xmlid[l.get_label() + "_shadow"] - # apply shdow filter - shadow.set("filter", 'url(#dropshadow)') - - fn = "svg_filter_line.svg" - print("Saving '%s'" % fn) - ET.ElementTree(tree).write(fn) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/svg_filter_pie.rst.txt b/_sources/examples/misc/svg_filter_pie.rst.txt deleted file mode 100644 index 23cfff19d22..00000000000 --- a/_sources/examples/misc/svg_filter_pie.rst.txt +++ /dev/null @@ -1,109 +0,0 @@ -.. _misc-svg_filter_pie: - -misc example code: svg_filter_pie.py -==================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/misc/svg_filter_pie.py - -:: - - """ - Demonstrate SVG filtering effects which might be used with mpl. - The pie chart drawing code is borrowed from pie_demo.py - - Note that the filtering effects are only effective if your svg renderer - support it. - """ - - - import matplotlib - matplotlib.use("Svg") - - import matplotlib.pyplot as plt - from matplotlib.patches import Shadow - - # make a square figure and axes - fig1 = plt.figure(1, figsize=(6, 6)) - ax = fig1.add_axes([0.1, 0.1, 0.8, 0.8]) - - labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' - fracs = [15, 30, 45, 10] - - explode = (0, 0.05, 0, 0) - - # We want to draw the shadow for each pie but we will not use "shadow" - # option as it does'n save the references to the shadow patches. - pies = ax.pie(fracs, explode=explode, labels=labels, autopct='%1.1f%%') - - for w in pies[0]: - # set the id with the label. - w.set_gid(w.get_label()) - - # we don't want to draw the edge of the pie - w.set_ec("none") - - for w in pies[0]: - # create shadow patch - s = Shadow(w, -0.01, -0.01) - s.set_gid(w.get_gid() + "_shadow") - s.set_zorder(w.get_zorder() - 0.1) - ax.add_patch(s) - - - # save - from io import BytesIO - f = BytesIO() - plt.savefig(f, format="svg") - - import xml.etree.cElementTree as ET - - - # filter definition for shadow using a gaussian blur - # and lightening effect. - # The lightening filter is copied from http://www.w3.org/TR/SVG/filters.html - - # I tested it with Inkscape and Firefox3. "Gaussian blur" is supported - # in both, but the lightening effect only in the Inkscape. Also note - # that, Inkscape's exporting also may not support it. - - filter_def = """ - - - - - - - - - - - - - - - - """ - - - tree, xmlid = ET.XMLID(f.getvalue()) - - # insert the filter definition in the svg dom tree. - tree.insert(0, ET.XML(filter_def)) - - for i, pie_name in enumerate(labels): - pie = xmlid[pie_name] - pie.set("filter", 'url(#MyFilter)') - - shadow = xmlid[pie_name + "_shadow"] - shadow.set("filter", 'url(#dropshadow)') - - fn = "svg_filter_pie.svg" - print("Saving '%s'" % fn) - ET.ElementTree(tree).write(fn) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/svg_filter_pie.txt b/_sources/examples/misc/svg_filter_pie.txt deleted file mode 100644 index cfc9a73b753..00000000000 --- a/_sources/examples/misc/svg_filter_pie.txt +++ /dev/null @@ -1,107 +0,0 @@ -.. _misc-svg_filter_pie: - -misc example code: svg_filter_pie.py -==================================== - -[`source code `_] - -:: - - """ - Demonstrate SVG filtering effects which might be used with mpl. - The pie chart drawing code is borrowed from pie_demo.py - - Note that the filtering effects are only effective if your svg rederer - support it. - """ - - - import matplotlib - matplotlib.use("Svg") - - import matplotlib.pyplot as plt - from matplotlib.patches import Shadow - - # make a square figure and axes - fig1 = plt.figure(1, figsize=(6, 6)) - ax = fig1.add_axes([0.1, 0.1, 0.8, 0.8]) - - labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' - fracs = [15, 30, 45, 10] - - explode = (0, 0.05, 0, 0) - - # We want to draw the shadow for each pie but we will not use "shadow" - # option as it does'n save the references to the shadow patches. - pies = ax.pie(fracs, explode=explode, labels=labels, autopct='%1.1f%%') - - for w in pies[0]: - # set the id with the label. - w.set_gid(w.get_label()) - - # we don't want to draw the edge of the pie - w.set_ec("none") - - for w in pies[0]: - # create shadow patch - s = Shadow(w, -0.01, -0.01) - s.set_gid(w.get_gid() + "_shadow") - s.set_zorder(w.get_zorder() - 0.1) - ax.add_patch(s) - - - # save - from io import BytesIO - f = BytesIO() - plt.savefig(f, format="svg") - - import xml.etree.cElementTree as ET - - - # filter definition for shadow using a gaussian blur - # and lighteneing effect. - # The lightnening filter is copied from http://www.w3.org/TR/SVG/filters.html - - # I tested it with Inkscape and Firefox3. "Gaussian blur" is supported - # in both, but the lightnening effect only in the inkscape. Also note - # that, inkscape's exporting also may not support it. - - filter_def = """ - - - - - - - - - - - - - - - - """ - - - tree, xmlid = ET.XMLID(f.getvalue()) - - # insert the filter definition in the svg dom tree. - tree.insert(0, ET.XML(filter_def)) - - for i, pie_name in enumerate(labels): - pie = xmlid[pie_name] - pie.set("filter", 'url(#MyFilter)') - - shadow = xmlid[pie_name + "_shadow"] - shadow.set("filter", 'url(#dropshadow)') - - fn = "svg_filter_pie.svg" - print("Saving '%s'" % fn) - ET.ElementTree(tree).write(fn) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/tight_bbox_test.rst.txt b/_sources/examples/misc/tight_bbox_test.rst.txt deleted file mode 100644 index 5c8ebd56674..00000000000 --- a/_sources/examples/misc/tight_bbox_test.rst.txt +++ /dev/null @@ -1,29 +0,0 @@ -.. _misc-tight_bbox_test: - -misc example code: tight_bbox_test.py -===================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/misc/tight_bbox_test.py - -:: - - from __future__ import print_function - import matplotlib.pyplot as plt - import numpy as np - - ax = plt.axes([0.1, 0.3, 0.5, 0.5]) - - ax.pcolormesh(np.array([[1, 2], [3, 4]])) - plt.yticks([0.5, 1.5], ["long long tick label", - "tick label"]) - plt.ylabel("My y-label") - plt.title("Check saved figures for their bboxes") - for ext in ["png", "pdf", "svg", "svgz", "eps"]: - print("saving tight_bbox_test.%s" % (ext,)) - plt.savefig("tight_bbox_test.%s" % (ext,), bbox_inches="tight") - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/misc/tight_bbox_test.txt b/_sources/examples/misc/tight_bbox_test.txt deleted file mode 100644 index 3c4909bc2c3..00000000000 --- a/_sources/examples/misc/tight_bbox_test.txt +++ /dev/null @@ -1,27 +0,0 @@ -.. _misc-tight_bbox_test: - -misc example code: tight_bbox_test.py -===================================== - -[`source code `_] - -:: - - from __future__ import print_function - import matplotlib.pyplot as plt - import numpy as np - - ax = plt.axes([0.1, 0.3, 0.5, 0.5]) - - ax.pcolormesh(np.array([[1, 2], [3, 4]])) - plt.yticks([0.5, 1.5], ["long long tick label", - "tick label"]) - plt.ylabel("My y-label") - plt.title("Check saved figures for their bboxes") - for ext in ["png", "pdf", "svg", "svgz", "eps"]: - print("saving tight_bbox_test.%s" % (ext,)) - plt.savefig("tight_bbox_test.%s" % (ext,), bbox_inches="tight") - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/2dcollections3d_demo.rst.txt b/_sources/examples/mplot3d/2dcollections3d_demo.rst.txt deleted file mode 100644 index 53c968900a4..00000000000 --- a/_sources/examples/mplot3d/2dcollections3d_demo.rst.txt +++ /dev/null @@ -1,60 +0,0 @@ -.. _mplot3d-2dcollections3d_demo: - -mplot3d example code: 2dcollections3d_demo.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/2dcollections3d_demo.py - -:: - - """ - ======================= - Plot 2D data on 3D plot - ======================= - - Demonstrates using ax.plot's zdir keyword to plot 2D data on - selective axes of a 3D plot. - """ - - from mpl_toolkits.mplot3d import Axes3D - import numpy as np - import matplotlib.pyplot as plt - - fig = plt.figure() - ax = fig.gca(projection='3d') - - # Plot a sin curve using the x and y axes. - x = np.linspace(0, 1, 100) - y = np.sin(x * 2 * np.pi) / 2 + 0.5 - ax.plot(x, y, zs=0, zdir='z', label='curve in (x,y)') - - # Plot scatterplot data (20 2D points per colour) on the x and z axes. - colors = ('r', 'g', 'b', 'k') - x = np.random.sample(20*len(colors)) - y = np.random.sample(20*len(colors)) - c_list = [] - for c in colors: - c_list.append([c]*20) - # By using zdir='y', the y value of these points is fixed to the zs value 0 - # and the (x,y) points are plotted on the x and z axes. - ax.scatter(x, y, zs=0, zdir='y', c=c_list, label='points in (x,z)') - - # Make legend, set axes limits and labels - ax.legend() - ax.set_xlim(0, 1) - ax.set_ylim(0, 1) - ax.set_zlim(0, 1) - ax.set_xlabel('X') - ax.set_ylabel('Y') - ax.set_zlabel('Z') - - # Customize the view angle so it's easier to see that the scatter points lie - # on the plane y=0 - ax.view_init(elev=20., azim=-35) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/2dcollections3d_demo.txt b/_sources/examples/mplot3d/2dcollections3d_demo.txt deleted file mode 100644 index ac98b687f79..00000000000 --- a/_sources/examples/mplot3d/2dcollections3d_demo.txt +++ /dev/null @@ -1,37 +0,0 @@ -.. _mplot3d-2dcollections3d_demo: - -mplot3d example code: 2dcollections3d_demo.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/2dcollections3d_demo.py - -:: - - from mpl_toolkits.mplot3d import Axes3D - import numpy as np - import matplotlib.pyplot as plt - - fig = plt.figure() - ax = fig.gca(projection='3d') - - x = np.linspace(0, 1, 100) - y = np.sin(x * 2 * np.pi) / 2 + 0.5 - ax.plot(x, y, zs=0, zdir='z', label='zs=0, zdir=z') - - colors = ('r', 'g', 'b', 'k') - for c in colors: - x = np.random.sample(20) - y = np.random.sample(20) - ax.scatter(x, y, 0, zdir='y', c=c) - - ax.legend() - ax.set_xlim3d(0, 1) - ax.set_ylim3d(0, 1) - ax.set_zlim3d(0, 1) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/bars3d_demo.rst.txt b/_sources/examples/mplot3d/bars3d_demo.rst.txt deleted file mode 100644 index acaad5dde2b..00000000000 --- a/_sources/examples/mplot3d/bars3d_demo.rst.txt +++ /dev/null @@ -1,44 +0,0 @@ -.. _mplot3d-bars3d_demo: - -mplot3d example code: bars3d_demo.py -==================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/bars3d_demo.py - -:: - - """ - ======================================== - Create 2D bar graphs in different planes - ======================================== - - Demonstrates making a 3D plot which has 2D bar graphs projected onto - planes y=0, y=1, etc. - """ - - from mpl_toolkits.mplot3d import Axes3D - import matplotlib.pyplot as plt - import numpy as np - - fig = plt.figure() - ax = fig.add_subplot(111, projection='3d') - for c, z in zip(['r', 'g', 'b', 'y'], [30, 20, 10, 0]): - xs = np.arange(20) - ys = np.random.rand(20) - - # You can provide either a single color or an array. To demonstrate this, - # the first bar of each set will be colored cyan. - cs = [c] * len(xs) - cs[0] = 'c' - ax.bar(xs, ys, zs=z, zdir='y', color=cs, alpha=0.8) - - ax.set_xlabel('X') - ax.set_ylabel('Y') - ax.set_zlabel('Z') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/bars3d_demo.txt b/_sources/examples/mplot3d/bars3d_demo.txt deleted file mode 100644 index 922a33eecba..00000000000 --- a/_sources/examples/mplot3d/bars3d_demo.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _mplot3d-bars3d_demo: - -mplot3d example code: bars3d_demo.py -==================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/bars3d_demo.py - -:: - - from mpl_toolkits.mplot3d import Axes3D - import matplotlib.pyplot as plt - import numpy as np - - fig = plt.figure() - ax = fig.add_subplot(111, projection='3d') - for c, z in zip(['r', 'g', 'b', 'y'], [30, 20, 10, 0]): - xs = np.arange(20) - ys = np.random.rand(20) - - # You can provide either a single color or an array. To demonstrate this, - # the first bar of each set will be colored cyan. - cs = [c] * len(xs) - cs[0] = 'c' - ax.bar(xs, ys, zs=z, zdir='y', color=cs, alpha=0.8) - - ax.set_xlabel('X') - ax.set_ylabel('Y') - ax.set_zlabel('Z') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/contour3d_demo.rst.txt b/_sources/examples/mplot3d/contour3d_demo.rst.txt deleted file mode 100644 index 05254b47492..00000000000 --- a/_sources/examples/mplot3d/contour3d_demo.rst.txt +++ /dev/null @@ -1,25 +0,0 @@ -.. _mplot3d-contour3d_demo: - -mplot3d example code: contour3d_demo.py -======================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/contour3d_demo.py - -:: - - from mpl_toolkits.mplot3d import axes3d - import matplotlib.pyplot as plt - from matplotlib import cm - - fig = plt.figure() - ax = fig.add_subplot(111, projection='3d') - X, Y, Z = axes3d.get_test_data(0.05) - cset = ax.contour(X, Y, Z, cmap=cm.coolwarm) - ax.clabel(cset, fontsize=9, inline=1) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/contour3d_demo.txt b/_sources/examples/mplot3d/contour3d_demo.txt deleted file mode 100644 index 87d7fcb6058..00000000000 --- a/_sources/examples/mplot3d/contour3d_demo.txt +++ /dev/null @@ -1,25 +0,0 @@ -.. _mplot3d-contour3d_demo: - -mplot3d example code: contour3d_demo.py -======================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/contour3d_demo.py - -:: - - from mpl_toolkits.mplot3d import axes3d - import matplotlib.pyplot as plt - from matplotlib import cm - - fig = plt.figure() - ax = fig.add_subplot(111, projection='3d') - X, Y, Z = axes3d.get_test_data(0.05) - cset = ax.contour(X, Y, Z, cmap=cm.coolwarm) - ax.clabel(cset, fontsize=9, inline=1) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/contour3d_demo2.rst.txt b/_sources/examples/mplot3d/contour3d_demo2.rst.txt deleted file mode 100644 index 1b72776760f..00000000000 --- a/_sources/examples/mplot3d/contour3d_demo2.rst.txt +++ /dev/null @@ -1,25 +0,0 @@ -.. _mplot3d-contour3d_demo2: - -mplot3d example code: contour3d_demo2.py -======================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/contour3d_demo2.py - -:: - - from mpl_toolkits.mplot3d import axes3d - import matplotlib.pyplot as plt - from matplotlib import cm - - fig = plt.figure() - ax = fig.gca(projection='3d') - X, Y, Z = axes3d.get_test_data(0.05) - cset = ax.contour(X, Y, Z, extend3d=True, cmap=cm.coolwarm) - ax.clabel(cset, fontsize=9, inline=1) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/contour3d_demo2.txt b/_sources/examples/mplot3d/contour3d_demo2.txt deleted file mode 100644 index 0ae3876a026..00000000000 --- a/_sources/examples/mplot3d/contour3d_demo2.txt +++ /dev/null @@ -1,25 +0,0 @@ -.. _mplot3d-contour3d_demo2: - -mplot3d example code: contour3d_demo2.py -======================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/contour3d_demo2.py - -:: - - from mpl_toolkits.mplot3d import axes3d - import matplotlib.pyplot as plt - from matplotlib import cm - - fig = plt.figure() - ax = fig.gca(projection='3d') - X, Y, Z = axes3d.get_test_data(0.05) - cset = ax.contour(X, Y, Z, extend3d=True, cmap=cm.coolwarm) - ax.clabel(cset, fontsize=9, inline=1) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/contour3d_demo3.rst.txt b/_sources/examples/mplot3d/contour3d_demo3.rst.txt deleted file mode 100644 index 3b7a46c7dd1..00000000000 --- a/_sources/examples/mplot3d/contour3d_demo3.rst.txt +++ /dev/null @@ -1,34 +0,0 @@ -.. _mplot3d-contour3d_demo3: - -mplot3d example code: contour3d_demo3.py -======================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/contour3d_demo3.py - -:: - - from mpl_toolkits.mplot3d import axes3d - import matplotlib.pyplot as plt - from matplotlib import cm - - fig = plt.figure() - ax = fig.gca(projection='3d') - X, Y, Z = axes3d.get_test_data(0.05) - ax.plot_surface(X, Y, Z, rstride=8, cstride=8, alpha=0.3) - cset = ax.contour(X, Y, Z, zdir='z', offset=-100, cmap=cm.coolwarm) - cset = ax.contour(X, Y, Z, zdir='x', offset=-40, cmap=cm.coolwarm) - cset = ax.contour(X, Y, Z, zdir='y', offset=40, cmap=cm.coolwarm) - - ax.set_xlabel('X') - ax.set_xlim(-40, 40) - ax.set_ylabel('Y') - ax.set_ylim(-40, 40) - ax.set_zlabel('Z') - ax.set_zlim(-100, 100) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/contour3d_demo3.txt b/_sources/examples/mplot3d/contour3d_demo3.txt deleted file mode 100644 index 05709266992..00000000000 --- a/_sources/examples/mplot3d/contour3d_demo3.txt +++ /dev/null @@ -1,34 +0,0 @@ -.. _mplot3d-contour3d_demo3: - -mplot3d example code: contour3d_demo3.py -======================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/contour3d_demo3.py - -:: - - from mpl_toolkits.mplot3d import axes3d - import matplotlib.pyplot as plt - from matplotlib import cm - - fig = plt.figure() - ax = fig.gca(projection='3d') - X, Y, Z = axes3d.get_test_data(0.05) - ax.plot_surface(X, Y, Z, rstride=8, cstride=8, alpha=0.3) - cset = ax.contour(X, Y, Z, zdir='z', offset=-100, cmap=cm.coolwarm) - cset = ax.contour(X, Y, Z, zdir='x', offset=-40, cmap=cm.coolwarm) - cset = ax.contour(X, Y, Z, zdir='y', offset=40, cmap=cm.coolwarm) - - ax.set_xlabel('X') - ax.set_xlim(-40, 40) - ax.set_ylabel('Y') - ax.set_ylim(-40, 40) - ax.set_zlabel('Z') - ax.set_zlim(-100, 100) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/contourf3d_demo.rst.txt b/_sources/examples/mplot3d/contourf3d_demo.rst.txt deleted file mode 100644 index 7aa8ee72d01..00000000000 --- a/_sources/examples/mplot3d/contourf3d_demo.rst.txt +++ /dev/null @@ -1,25 +0,0 @@ -.. _mplot3d-contourf3d_demo: - -mplot3d example code: contourf3d_demo.py -======================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/contourf3d_demo.py - -:: - - from mpl_toolkits.mplot3d import axes3d - import matplotlib.pyplot as plt - from matplotlib import cm - - fig = plt.figure() - ax = fig.gca(projection='3d') - X, Y, Z = axes3d.get_test_data(0.05) - cset = ax.contourf(X, Y, Z, cmap=cm.coolwarm) - ax.clabel(cset, fontsize=9, inline=1) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/contourf3d_demo.txt b/_sources/examples/mplot3d/contourf3d_demo.txt deleted file mode 100644 index 0ee5b93f0d9..00000000000 --- a/_sources/examples/mplot3d/contourf3d_demo.txt +++ /dev/null @@ -1,25 +0,0 @@ -.. _mplot3d-contourf3d_demo: - -mplot3d example code: contourf3d_demo.py -======================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/contourf3d_demo.py - -:: - - from mpl_toolkits.mplot3d import axes3d - import matplotlib.pyplot as plt - from matplotlib import cm - - fig = plt.figure() - ax = fig.gca(projection='3d') - X, Y, Z = axes3d.get_test_data(0.05) - cset = ax.contourf(X, Y, Z, cmap=cm.coolwarm) - ax.clabel(cset, fontsize=9, inline=1) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/contourf3d_demo2.rst.txt b/_sources/examples/mplot3d/contourf3d_demo2.rst.txt deleted file mode 100644 index ea5b42d4eb2..00000000000 --- a/_sources/examples/mplot3d/contourf3d_demo2.rst.txt +++ /dev/null @@ -1,39 +0,0 @@ -.. _mplot3d-contourf3d_demo2: - -mplot3d example code: contourf3d_demo2.py -========================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/contourf3d_demo2.py - -:: - - """ - .. versionadded:: 1.1.0 - This demo depends on new features added to contourf3d. - """ - - from mpl_toolkits.mplot3d import axes3d - import matplotlib.pyplot as plt - from matplotlib import cm - - fig = plt.figure() - ax = fig.gca(projection='3d') - X, Y, Z = axes3d.get_test_data(0.05) - ax.plot_surface(X, Y, Z, rstride=8, cstride=8, alpha=0.3) - cset = ax.contourf(X, Y, Z, zdir='z', offset=-100, cmap=cm.coolwarm) - cset = ax.contourf(X, Y, Z, zdir='x', offset=-40, cmap=cm.coolwarm) - cset = ax.contourf(X, Y, Z, zdir='y', offset=40, cmap=cm.coolwarm) - - ax.set_xlabel('X') - ax.set_xlim(-40, 40) - ax.set_ylabel('Y') - ax.set_ylim(-40, 40) - ax.set_zlabel('Z') - ax.set_zlim(-100, 100) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/contourf3d_demo2.txt b/_sources/examples/mplot3d/contourf3d_demo2.txt deleted file mode 100644 index c1dcf03c17a..00000000000 --- a/_sources/examples/mplot3d/contourf3d_demo2.txt +++ /dev/null @@ -1,39 +0,0 @@ -.. _mplot3d-contourf3d_demo2: - -mplot3d example code: contourf3d_demo2.py -========================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/contourf3d_demo2.py - -:: - - """ - .. versionadded:: 1.1.0 - This demo depends on new features added to contourf3d. - """ - - from mpl_toolkits.mplot3d import axes3d - import matplotlib.pyplot as plt - from matplotlib import cm - - fig = plt.figure() - ax = fig.gca(projection='3d') - X, Y, Z = axes3d.get_test_data(0.05) - ax.plot_surface(X, Y, Z, rstride=8, cstride=8, alpha=0.3) - cset = ax.contourf(X, Y, Z, zdir='z', offset=-100, cmap=cm.coolwarm) - cset = ax.contourf(X, Y, Z, zdir='x', offset=-40, cmap=cm.coolwarm) - cset = ax.contourf(X, Y, Z, zdir='y', offset=40, cmap=cm.coolwarm) - - ax.set_xlabel('X') - ax.set_xlim(-40, 40) - ax.set_ylabel('Y') - ax.set_ylim(-40, 40) - ax.set_zlabel('Z') - ax.set_zlim(-100, 100) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/custom_shaded_3d_surface.rst.txt b/_sources/examples/mplot3d/custom_shaded_3d_surface.rst.txt deleted file mode 100644 index 334bc2dd26e..00000000000 --- a/_sources/examples/mplot3d/custom_shaded_3d_surface.rst.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _mplot3d-custom_shaded_3d_surface: - -mplot3d example code: custom_shaded_3d_surface.py -================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/custom_shaded_3d_surface.py - -:: - - """ - Demonstrates using custom hillshading in a 3D surface plot. - """ - from mpl_toolkits.mplot3d import Axes3D - from matplotlib import cbook - from matplotlib import cm - from matplotlib.colors import LightSource - import matplotlib.pyplot as plt - import numpy as np - - filename = cbook.get_sample_data('jacksboro_fault_dem.npz', asfileobj=False) - with np.load(filename) as dem: - z = dem['elevation'] - nrows, ncols = z.shape - x = np.linspace(dem['xmin'], dem['xmax'], ncols) - y = np.linspace(dem['ymin'], dem['ymax'], nrows) - x, y = np.meshgrid(x, y) - - region = np.s_[5:50, 5:50] - x, y, z = x[region], y[region], z[region] - - fig, ax = plt.subplots(subplot_kw=dict(projection='3d')) - - ls = LightSource(270, 45) - # To use a custom hillshading mode, override the built-in shading and pass - # in the rgb colors of the shaded surface calculated from "shade". - rgb = ls.shade(z, cmap=cm.gist_earth, vert_exag=0.1, blend_mode='soft') - surf = ax.plot_surface(x, y, z, rstride=1, cstride=1, facecolors=rgb, - linewidth=0, antialiased=False, shade=False) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/custom_shaded_3d_surface.txt b/_sources/examples/mplot3d/custom_shaded_3d_surface.txt deleted file mode 100644 index 1268a4b8ec9..00000000000 --- a/_sources/examples/mplot3d/custom_shaded_3d_surface.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _mplot3d-custom_shaded_3d_surface: - -mplot3d example code: custom_shaded_3d_surface.py -================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/custom_shaded_3d_surface.py - -:: - - """ - Demonstrates using custom hillshading in a 3D surface plot. - """ - from mpl_toolkits.mplot3d import Axes3D - from matplotlib import cbook - from matplotlib import cm - from matplotlib.colors import LightSource - import matplotlib.pyplot as plt - import numpy as np - - filename = cbook.get_sample_data('jacksboro_fault_dem.npz', asfileobj=False) - with np.load(filename) as dem: - z = dem['elevation'] - nrows, ncols = z.shape - x = np.linspace(dem['xmin'], dem['xmax'], ncols) - y = np.linspace(dem['ymin'], dem['ymax'], nrows) - x, y = np.meshgrid(x, y) - - region = np.s_[5:50, 5:50] - x, y, z = x[region], y[region], z[region] - - fig, ax = plt.subplots(subplot_kw=dict(projection='3d')) - - ls = LightSource(270, 45) - # To use a custom hillshading mode, override the built-in shading and pass - # in the rgb colors of the shaded surface calculated from "shade". - rgb = ls.shade(z, cmap=cm.gist_earth, vert_exag=0.1, blend_mode='soft') - surf = ax.plot_surface(x, y, z, rstride=1, cstride=1, facecolors=rgb, - linewidth=0, antialiased=False, shade=False) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/hist3d_demo.rst.txt b/_sources/examples/mplot3d/hist3d_demo.rst.txt deleted file mode 100644 index 1c125ddd5fc..00000000000 --- a/_sources/examples/mplot3d/hist3d_demo.rst.txt +++ /dev/null @@ -1,48 +0,0 @@ -.. _mplot3d-hist3d_demo: - -mplot3d example code: hist3d_demo.py -==================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/hist3d_demo.py - -:: - - """ - ============================== - Create 3D histogram of 2D data - ============================== - - Demo of a histogram for 2 dimensional data as a bar graph in 3D. - """ - - from mpl_toolkits.mplot3d import Axes3D - import matplotlib.pyplot as plt - import numpy as np - - fig = plt.figure() - ax = fig.add_subplot(111, projection='3d') - x, y = np.random.rand(2, 100) * 4 - hist, xedges, yedges = np.histogram2d(x, y, bins=4, range=[[0, 4], [0, 4]]) - - # Construct arrays for the anchor positions of the 16 bars. - # Note: np.meshgrid gives arrays in (ny, nx) so we use 'F' to flatten xpos, - # ypos in column-major order. For numpy >= 1.7, we could instead call meshgrid - # with indexing='ij'. - xpos, ypos = np.meshgrid(xedges[:-1] + 0.25, yedges[:-1] + 0.25) - xpos = xpos.flatten('F') - ypos = ypos.flatten('F') - zpos = np.zeros_like(xpos) - - # Construct arrays with the dimensions for the 16 bars. - dx = 0.5 * np.ones_like(zpos) - dy = dx.copy() - dz = hist.flatten() - - ax.bar3d(xpos, ypos, zpos, dx, dy, dz, color='b', zsort='average') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/hist3d_demo.txt b/_sources/examples/mplot3d/hist3d_demo.txt deleted file mode 100644 index 0da1e02afbd..00000000000 --- a/_sources/examples/mplot3d/hist3d_demo.txt +++ /dev/null @@ -1,44 +0,0 @@ -.. _mplot3d-hist3d_demo: - -mplot3d example code: hist3d_demo.py -==================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/hist3d_demo.py - -:: - - ''' - Demo of a histogram for 2 dimensional data as a bar graph in 3D. - ''' - - from mpl_toolkits.mplot3d import Axes3D - import matplotlib.pyplot as plt - import numpy as np - - fig = plt.figure() - ax = fig.add_subplot(111, projection='3d') - x, y = np.random.rand(2, 100) * 4 - hist, xedges, yedges = np.histogram2d(x, y, bins=4, range=[[0, 4], [0, 4]]) - - # Construct arrays for the anchor positions of the 16 bars. - # Note: np.meshgrid gives arrays in (ny, nx) so we use 'F' to flatten xpos, - # ypos in column-major order. For numpy >= 1.7, we could instead call meshgrid - # with indexing='ij'. - xpos, ypos = np.meshgrid(xedges[:-1] + 0.25, yedges[:-1] + 0.25) - xpos = xpos.flatten('F') - ypos = ypos.flatten('F') - zpos = np.zeros_like(xpos) - - # Construct arrays with the dimensions for the 16 bars. - dx = 0.5 * np.ones_like(zpos) - dy = dx.copy() - dz = hist.flatten() - - ax.bar3d(xpos, ypos, zpos, dx, dy, dz, color='b', zsort='average') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/index.rst.txt b/_sources/examples/mplot3d/index.rst.txt deleted file mode 100644 index dceb1dae91b..00000000000 --- a/_sources/examples/mplot3d/index.rst.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _mplot3d-examples-index: - -############################################## -mplot3d Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - 2dcollections3d_demo <2dcollections3d_demo.rst> - bars3d_demo - contour3d_demo - contour3d_demo2 - contour3d_demo3 - contourf3d_demo - contourf3d_demo2 - custom_shaded_3d_surface - hist3d_demo - lines3d_demo - lorenz_attractor - mixed_subplots_demo - offset_demo - pathpatch3d_demo - polys3d_demo - quiver3d_demo - rotate_axes3d_demo - scatter3d_demo - subplot3d_demo - surface3d_demo - surface3d_demo2 - surface3d_demo3 - surface3d_radial_demo - text3d_demo - tricontour3d_demo - tricontourf3d_demo - trisurf3d_demo - trisurf3d_demo2 - wire3d_animation_demo - wire3d_demo - wire3d_zero_stride diff --git a/_sources/examples/mplot3d/index.txt b/_sources/examples/mplot3d/index.txt deleted file mode 100644 index dceb1dae91b..00000000000 --- a/_sources/examples/mplot3d/index.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _mplot3d-examples-index: - -############################################## -mplot3d Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - 2dcollections3d_demo <2dcollections3d_demo.rst> - bars3d_demo - contour3d_demo - contour3d_demo2 - contour3d_demo3 - contourf3d_demo - contourf3d_demo2 - custom_shaded_3d_surface - hist3d_demo - lines3d_demo - lorenz_attractor - mixed_subplots_demo - offset_demo - pathpatch3d_demo - polys3d_demo - quiver3d_demo - rotate_axes3d_demo - scatter3d_demo - subplot3d_demo - surface3d_demo - surface3d_demo2 - surface3d_demo3 - surface3d_radial_demo - text3d_demo - tricontour3d_demo - tricontourf3d_demo - trisurf3d_demo - trisurf3d_demo2 - wire3d_animation_demo - wire3d_demo - wire3d_zero_stride diff --git a/_sources/examples/mplot3d/lines3d_demo.rst.txt b/_sources/examples/mplot3d/lines3d_demo.rst.txt deleted file mode 100644 index e4a592b5201..00000000000 --- a/_sources/examples/mplot3d/lines3d_demo.rst.txt +++ /dev/null @@ -1,32 +0,0 @@ -.. _mplot3d-lines3d_demo: - -mplot3d example code: lines3d_demo.py -===================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/lines3d_demo.py - -:: - - import matplotlib as mpl - from mpl_toolkits.mplot3d import Axes3D - import numpy as np - import matplotlib.pyplot as plt - - mpl.rcParams['legend.fontsize'] = 10 - - fig = plt.figure() - ax = fig.gca(projection='3d') - theta = np.linspace(-4 * np.pi, 4 * np.pi, 100) - z = np.linspace(-2, 2, 100) - r = z**2 + 1 - x = r * np.sin(theta) - y = r * np.cos(theta) - ax.plot(x, y, z, label='parametric curve') - ax.legend() - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/lines3d_demo.txt b/_sources/examples/mplot3d/lines3d_demo.txt deleted file mode 100644 index 0abbe9620b1..00000000000 --- a/_sources/examples/mplot3d/lines3d_demo.txt +++ /dev/null @@ -1,32 +0,0 @@ -.. _mplot3d-lines3d_demo: - -mplot3d example code: lines3d_demo.py -===================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/lines3d_demo.py - -:: - - import matplotlib as mpl - from mpl_toolkits.mplot3d import Axes3D - import numpy as np - import matplotlib.pyplot as plt - - mpl.rcParams['legend.fontsize'] = 10 - - fig = plt.figure() - ax = fig.gca(projection='3d') - theta = np.linspace(-4 * np.pi, 4 * np.pi, 100) - z = np.linspace(-2, 2, 100) - r = z**2 + 1 - x = r * np.sin(theta) - y = r * np.cos(theta) - ax.plot(x, y, z, label='parametric curve') - ax.legend() - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/lorenz_attractor.rst.txt b/_sources/examples/mplot3d/lorenz_attractor.rst.txt deleted file mode 100644 index cfe6355f83c..00000000000 --- a/_sources/examples/mplot3d/lorenz_attractor.rst.txt +++ /dev/null @@ -1,63 +0,0 @@ -.. _mplot3d-lorenz_attractor: - -mplot3d example code: lorenz_attractor.py -========================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/lorenz_attractor.py - -:: - - # Plot of the Lorenz Attractor based on Edward Lorenz's 1963 "Deterministic - # Nonperiodic Flow" publication. - # http://journals.ametsoc.org/doi/abs/10.1175/1520-0469%281963%29020%3C0130%3ADNF%3E2.0.CO%3B2 - # - # Note: Because this is a simple non-linear ODE, it would be more easily - # done using SciPy's ode solver, but this approach depends only - # upon NumPy. - - import numpy as np - import matplotlib.pyplot as plt - from mpl_toolkits.mplot3d import Axes3D - - - def lorenz(x, y, z, s=10, r=28, b=2.667): - x_dot = s*(y - x) - y_dot = r*x - y - x*z - z_dot = x*y - b*z - return x_dot, y_dot, z_dot - - - dt = 0.01 - stepCnt = 10000 - - # Need one more for the initial values - xs = np.empty((stepCnt + 1,)) - ys = np.empty((stepCnt + 1,)) - zs = np.empty((stepCnt + 1,)) - - # Setting initial values - xs[0], ys[0], zs[0] = (0., 1., 1.05) - - # Stepping through "time". - for i in range(stepCnt): - # Derivatives of the X, Y, Z state - x_dot, y_dot, z_dot = lorenz(xs[i], ys[i], zs[i]) - xs[i + 1] = xs[i] + (x_dot * dt) - ys[i + 1] = ys[i] + (y_dot * dt) - zs[i + 1] = zs[i] + (z_dot * dt) - - fig = plt.figure() - ax = fig.gca(projection='3d') - - ax.plot(xs, ys, zs, lw=0.5) - ax.set_xlabel("X Axis") - ax.set_ylabel("Y Axis") - ax.set_zlabel("Z Axis") - ax.set_title("Lorenz Attractor") - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/lorenz_attractor.txt b/_sources/examples/mplot3d/lorenz_attractor.txt deleted file mode 100644 index b9aefcbec3e..00000000000 --- a/_sources/examples/mplot3d/lorenz_attractor.txt +++ /dev/null @@ -1,63 +0,0 @@ -.. _mplot3d-lorenz_attractor: - -mplot3d example code: lorenz_attractor.py -========================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/lorenz_attractor.py - -:: - - # Plot of the Lorenz Attractor based on Edward Lorenz's 1963 "Deterministic - # Nonperiodic Flow" publication. - # http://journals.ametsoc.org/doi/abs/10.1175/1520-0469%281963%29020%3C0130%3ADNF%3E2.0.CO%3B2 - # - # Note: Because this is a simple non-linear ODE, it would be more easily - # done using SciPy's ode solver, but this approach depends only - # upon NumPy. - - import numpy as np - import matplotlib.pyplot as plt - from mpl_toolkits.mplot3d import Axes3D - - - def lorenz(x, y, z, s=10, r=28, b=2.667): - x_dot = s*(y - x) - y_dot = r*x - y - x*z - z_dot = x*y - b*z - return x_dot, y_dot, z_dot - - - dt = 0.01 - stepCnt = 10000 - - # Need one more for the initial values - xs = np.empty((stepCnt + 1,)) - ys = np.empty((stepCnt + 1,)) - zs = np.empty((stepCnt + 1,)) - - # Setting initial values - xs[0], ys[0], zs[0] = (0., 1., 1.05) - - # Stepping through "time". - for i in range(stepCnt): - # Derivatives of the X, Y, Z state - x_dot, y_dot, z_dot = lorenz(xs[i], ys[i], zs[i]) - xs[i + 1] = xs[i] + (x_dot * dt) - ys[i + 1] = ys[i] + (y_dot * dt) - zs[i + 1] = zs[i] + (z_dot * dt) - - fig = plt.figure() - ax = fig.gca(projection='3d') - - ax.plot(xs, ys, zs) - ax.set_xlabel("X Axis") - ax.set_ylabel("Y Axis") - ax.set_zlabel("Z Axis") - ax.set_title("Lorenz Attractor") - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/mixed_subplots_demo.rst.txt b/_sources/examples/mplot3d/mixed_subplots_demo.rst.txt deleted file mode 100644 index 02c4ea129df..00000000000 --- a/_sources/examples/mplot3d/mixed_subplots_demo.rst.txt +++ /dev/null @@ -1,63 +0,0 @@ -.. _mplot3d-mixed_subplots_demo: - -mplot3d example code: mixed_subplots_demo.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/mixed_subplots_demo.py - -:: - - """ - Demonstrate the mixing of 2d and 3d subplots - """ - from mpl_toolkits.mplot3d import Axes3D - import matplotlib.pyplot as plt - import numpy as np - - - def f(t): - s1 = np.cos(2*np.pi*t) - e1 = np.exp(-t) - return np.multiply(s1, e1) - - - ################ - # First subplot - ################ - t1 = np.arange(0.0, 5.0, 0.1) - t2 = np.arange(0.0, 5.0, 0.02) - t3 = np.arange(0.0, 2.0, 0.01) - - # Twice as tall as it is wide. - fig = plt.figure(figsize=plt.figaspect(2.)) - fig.suptitle('A tale of 2 subplots') - ax = fig.add_subplot(2, 1, 1) - l = ax.plot(t1, f(t1), 'bo', - t2, f(t2), 'k--', markerfacecolor='green') - ax.grid(True) - ax.set_ylabel('Damped oscillation') - - - ################# - # Second subplot - ################# - ax = fig.add_subplot(2, 1, 2, projection='3d') - X = np.arange(-5, 5, 0.25) - xlen = len(X) - Y = np.arange(-5, 5, 0.25) - ylen = len(Y) - X, Y = np.meshgrid(X, Y) - R = np.sqrt(X**2 + Y**2) - Z = np.sin(R) - - surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, - linewidth=0, antialiased=False) - - ax.set_zlim3d(-1, 1) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/mixed_subplots_demo.txt b/_sources/examples/mplot3d/mixed_subplots_demo.txt deleted file mode 100644 index b39af252b09..00000000000 --- a/_sources/examples/mplot3d/mixed_subplots_demo.txt +++ /dev/null @@ -1,63 +0,0 @@ -.. _mplot3d-mixed_subplots_demo: - -mplot3d example code: mixed_subplots_demo.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/mixed_subplots_demo.py - -:: - - """ - Demonstrate the mixing of 2d and 3d subplots - """ - from mpl_toolkits.mplot3d import Axes3D - import matplotlib.pyplot as plt - import numpy as np - - - def f(t): - s1 = np.cos(2*np.pi*t) - e1 = np.exp(-t) - return np.multiply(s1, e1) - - - ################ - # First subplot - ################ - t1 = np.arange(0.0, 5.0, 0.1) - t2 = np.arange(0.0, 5.0, 0.02) - t3 = np.arange(0.0, 2.0, 0.01) - - # Twice as tall as it is wide. - fig = plt.figure(figsize=plt.figaspect(2.)) - fig.suptitle('A tale of 2 subplots') - ax = fig.add_subplot(2, 1, 1) - l = ax.plot(t1, f(t1), 'bo', - t2, f(t2), 'k--', markerfacecolor='green') - ax.grid(True) - ax.set_ylabel('Damped oscillation') - - - ################# - # Second subplot - ################# - ax = fig.add_subplot(2, 1, 2, projection='3d') - X = np.arange(-5, 5, 0.25) - xlen = len(X) - Y = np.arange(-5, 5, 0.25) - ylen = len(Y) - X, Y = np.meshgrid(X, Y) - R = np.sqrt(X**2 + Y**2) - Z = np.sin(R) - - surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, - linewidth=0, antialiased=False) - - ax.set_zlim3d(-1, 1) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/offset_demo.rst.txt b/_sources/examples/mplot3d/offset_demo.rst.txt deleted file mode 100644 index bb7eda3c90d..00000000000 --- a/_sources/examples/mplot3d/offset_demo.rst.txt +++ /dev/null @@ -1,39 +0,0 @@ -.. _mplot3d-offset_demo: - -mplot3d example code: offset_demo.py -==================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/offset_demo.py - -:: - - from mpl_toolkits.mplot3d import Axes3D - import matplotlib.pyplot as plt - import numpy as np - - # This example demonstrates mplot3d's offset text display. - # As one rotates the 3D figure, the offsets should remain oriented - # same way as the axis label, and should also be located "away" - # from the center of the plot. - # - # This demo triggers the display of the offset text for the x and - # y axis by adding 1e5 to X and Y. Anything less would not - # automatically trigger it. - - fig = plt.figure() - ax = fig.gca(projection='3d') - X, Y = np.mgrid[0:6*np.pi:0.25, 0:4*np.pi:0.25] - Z = np.sqrt(np.abs(np.cos(X) + np.cos(Y))) - - surf = ax.plot_surface(X + 1e5, Y + 1e5, Z, cmap='autumn', cstride=2, rstride=2) - ax.set_xlabel("X-Label") - ax.set_ylabel("Y-Label") - ax.set_zlabel("Z-Label") - ax.set_zlim(0, 2) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/offset_demo.txt b/_sources/examples/mplot3d/offset_demo.txt deleted file mode 100644 index 2fb998f07ee..00000000000 --- a/_sources/examples/mplot3d/offset_demo.txt +++ /dev/null @@ -1,39 +0,0 @@ -.. _mplot3d-offset_demo: - -mplot3d example code: offset_demo.py -==================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/offset_demo.py - -:: - - from mpl_toolkits.mplot3d import Axes3D - import matplotlib.pyplot as plt - import numpy as np - - # This example demonstrates mplot3d's offset text display. - # As one rotates the 3D figure, the offsets should remain oriented - # same way as the axis label, and should also be located "away" - # from the center of the plot. - # - # This demo triggers the display of the offset text for the x and - # y axis by adding 1e5 to X and Y. Anything less would not - # automatically trigger it. - - fig = plt.figure() - ax = fig.gca(projection='3d') - X, Y = np.mgrid[0:6*np.pi:0.25, 0:4*np.pi:0.25] - Z = np.sqrt(np.abs(np.cos(X) + np.cos(Y))) - - surf = ax.plot_surface(X + 1e5, Y + 1e5, Z, cmap='autumn', cstride=2, rstride=2) - ax.set_xlabel("X-Label") - ax.set_ylabel("Y-Label") - ax.set_zlabel("Z-Label") - ax.set_zlim(0, 2) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/pathpatch3d_demo.rst.txt b/_sources/examples/mplot3d/pathpatch3d_demo.rst.txt deleted file mode 100644 index e9cd25f9ee7..00000000000 --- a/_sources/examples/mplot3d/pathpatch3d_demo.rst.txt +++ /dev/null @@ -1,75 +0,0 @@ -.. _mplot3d-pathpatch3d_demo: - -mplot3d example code: pathpatch3d_demo.py -========================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/pathpatch3d_demo.py - -:: - - """ - ============================ - Draw flat objects in 3D plot - ============================ - - Demonstrate using pathpatch_2d_to_3d to 'draw' shapes and text on a 3D plot. - """ - - import matplotlib.pyplot as plt - from matplotlib.patches import Circle, PathPatch - # register Axes3D class with matplotlib by importing Axes3D - from mpl_toolkits.mplot3d import Axes3D - import mpl_toolkits.mplot3d.art3d as art3d - from matplotlib.text import TextPath - from matplotlib.transforms import Affine2D - - - def text3d(ax, xyz, s, zdir="z", size=None, angle=0, usetex=False, **kwargs): - - x, y, z = xyz - if zdir == "y": - xy1, z1 = (x, z), y - elif zdir == "y": - xy1, z1 = (y, z), x - else: - xy1, z1 = (x, y), z - - text_path = TextPath((0, 0), s, size=size, usetex=usetex) - trans = Affine2D().rotate(angle).translate(xy1[0], xy1[1]) - - p1 = PathPatch(trans.transform_path(text_path), **kwargs) - ax.add_patch(p1) - art3d.pathpatch_2d_to_3d(p1, z=z1, zdir=zdir) - - - fig = plt.figure() - ax = fig.add_subplot(111, projection='3d') - - p = Circle((5, 5), 3) - ax.add_patch(p) - art3d.pathpatch_2d_to_3d(p, z=0, zdir="x") - - - text3d(ax, (4, -2, 0), "X-axis", zdir="z", size=.5, usetex=False, - ec="none", fc="k") - text3d(ax, (12, 4, 0), "Y-axis", zdir="z", size=.5, usetex=False, - angle=.5*3.14159, ec="none", fc="k") - text3d(ax, (12, 10, 4), "Z-axis", zdir="y", size=.5, usetex=False, - angle=.5*3.14159, ec="none", fc="k") - - text3d(ax, (1, 5, 0), - r"$\displaystyle G_{\mu\nu} + \Lambda g_{\mu\nu} = " - r"\frac{8\pi G}{c^4} T_{\mu\nu} $", - zdir="z", size=1, usetex=True, - ec="none", fc="k") - - ax.set_xlim3d(0, 10) - ax.set_ylim3d(0, 10) - ax.set_zlim3d(0, 10) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/pathpatch3d_demo.txt b/_sources/examples/mplot3d/pathpatch3d_demo.txt deleted file mode 100644 index b11f15e3087..00000000000 --- a/_sources/examples/mplot3d/pathpatch3d_demo.txt +++ /dev/null @@ -1,67 +0,0 @@ -.. _mplot3d-pathpatch3d_demo: - -mplot3d example code: pathpatch3d_demo.py -========================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/pathpatch3d_demo.py - -:: - - import matplotlib.pyplot as plt - from matplotlib.patches import Circle, PathPatch - # register Axes3D class with matplotlib by importing Axes3D - from mpl_toolkits.mplot3d import Axes3D - import mpl_toolkits.mplot3d.art3d as art3d - from matplotlib.text import TextPath - from matplotlib.transforms import Affine2D - - - def text3d(ax, xyz, s, zdir="z", size=None, angle=0, usetex=False, **kwargs): - - x, y, z = xyz - if zdir == "y": - xy1, z1 = (x, z), y - elif zdir == "y": - xy1, z1 = (y, z), x - else: - xy1, z1 = (x, y), z - - text_path = TextPath((0, 0), s, size=size, usetex=usetex) - trans = Affine2D().rotate(angle).translate(xy1[0], xy1[1]) - - p1 = PathPatch(trans.transform_path(text_path), **kwargs) - ax.add_patch(p1) - art3d.pathpatch_2d_to_3d(p1, z=z1, zdir=zdir) - - - fig = plt.figure() - ax = fig.add_subplot(111, projection='3d') - - p = Circle((5, 5), 3) - ax.add_patch(p) - art3d.pathpatch_2d_to_3d(p, z=0, zdir="x") - - - text3d(ax, (4, -2, 0), "X-axis", zdir="z", size=.5, usetex=False, - ec="none", fc="k") - text3d(ax, (12, 4, 0), "Y-axis", zdir="z", size=.5, usetex=False, - angle=.5*3.14159, ec="none", fc="k") - text3d(ax, (12, 10, 4), "Z-axis", zdir="y", size=.5, usetex=False, - angle=.5*3.14159, ec="none", fc="k") - - text3d(ax, (1, 5, 0), - r"$\displaystyle G_{\mu\nu} + \Lambda g_{\mu\nu} = " - r"\frac{8\pi G}{c^4} T_{\mu\nu} $", - zdir="z", size=1, usetex=True, - ec="none", fc="k") - - ax.set_xlim3d(0, 10) - ax.set_ylim3d(0, 10) - ax.set_zlim3d(0, 10) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/polys3d_demo.rst.txt b/_sources/examples/mplot3d/polys3d_demo.rst.txt deleted file mode 100644 index 19df79eeac8..00000000000 --- a/_sources/examples/mplot3d/polys3d_demo.rst.txt +++ /dev/null @@ -1,59 +0,0 @@ -.. _mplot3d-polys3d_demo: - -mplot3d example code: polys3d_demo.py -===================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/polys3d_demo.py - -:: - - """ - ============================================= - Generate polygons to fill under 3D line graph - ============================================= - - Demonstrate how to create polygons which fill the space under a line - graph. In this example polygons are semi-transparent, creating a sort - of 'jagged stained glass' effect. - """ - - from mpl_toolkits.mplot3d import Axes3D - from matplotlib.collections import PolyCollection - import matplotlib.pyplot as plt - from matplotlib import colors as mcolors - import numpy as np - - - fig = plt.figure() - ax = fig.gca(projection='3d') - - - def cc(arg): - return mcolors.to_rgba(arg, alpha=0.6) - - xs = np.arange(0, 10, 0.4) - verts = [] - zs = [0.0, 1.0, 2.0, 3.0] - for z in zs: - ys = np.random.rand(len(xs)) - ys[0], ys[-1] = 0, 0 - verts.append(list(zip(xs, ys))) - - poly = PolyCollection(verts, facecolors=[cc('r'), cc('g'), cc('b'), - cc('y')]) - poly.set_alpha(0.7) - ax.add_collection3d(poly, zs=zs, zdir='y') - - ax.set_xlabel('X') - ax.set_xlim3d(0, 10) - ax.set_ylabel('Y') - ax.set_ylim3d(-1, 4) - ax.set_zlabel('Z') - ax.set_zlim3d(0, 1) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/polys3d_demo.txt b/_sources/examples/mplot3d/polys3d_demo.txt deleted file mode 100644 index 9a658fa057a..00000000000 --- a/_sources/examples/mplot3d/polys3d_demo.txt +++ /dev/null @@ -1,49 +0,0 @@ -.. _mplot3d-polys3d_demo: - -mplot3d example code: polys3d_demo.py -===================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/polys3d_demo.py - -:: - - from mpl_toolkits.mplot3d import Axes3D - from matplotlib.collections import PolyCollection - from matplotlib.colors import colorConverter - import matplotlib.pyplot as plt - import numpy as np - - - fig = plt.figure() - ax = fig.gca(projection='3d') - - - def cc(arg): - return colorConverter.to_rgba(arg, alpha=0.6) - - xs = np.arange(0, 10, 0.4) - verts = [] - zs = [0.0, 1.0, 2.0, 3.0] - for z in zs: - ys = np.random.rand(len(xs)) - ys[0], ys[-1] = 0, 0 - verts.append(list(zip(xs, ys))) - - poly = PolyCollection(verts, facecolors=[cc('r'), cc('g'), cc('b'), - cc('y')]) - poly.set_alpha(0.7) - ax.add_collection3d(poly, zs=zs, zdir='y') - - ax.set_xlabel('X') - ax.set_xlim3d(0, 10) - ax.set_ylabel('Y') - ax.set_ylim3d(-1, 4) - ax.set_zlabel('Z') - ax.set_zlim3d(0, 1) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/quiver3d_demo.rst.txt b/_sources/examples/mplot3d/quiver3d_demo.rst.txt deleted file mode 100644 index 4afe79b9f7b..00000000000 --- a/_sources/examples/mplot3d/quiver3d_demo.rst.txt +++ /dev/null @@ -1,43 +0,0 @@ -.. _mplot3d-quiver3d_demo: - -mplot3d example code: quiver3d_demo.py -====================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/quiver3d_demo.py - -:: - - ''' - ============== - 3D quiver plot - ============== - - Demonstrates plotting directional arrows at points on a 3d meshgrid. - ''' - - from mpl_toolkits.mplot3d import axes3d - import matplotlib.pyplot as plt - import numpy as np - - fig = plt.figure() - ax = fig.gca(projection='3d') - - # Make the grid - x, y, z = np.meshgrid(np.arange(-0.8, 1, 0.2), - np.arange(-0.8, 1, 0.2), - np.arange(-0.8, 1, 0.8)) - - # Make the direction data for the arrows - u = np.sin(np.pi * x) * np.cos(np.pi * y) * np.cos(np.pi * z) - v = -np.cos(np.pi * x) * np.sin(np.pi * y) * np.cos(np.pi * z) - w = (np.sqrt(2.0 / 3.0) * np.cos(np.pi * x) * np.cos(np.pi * y) * - np.sin(np.pi * z)) - - ax.quiver(x, y, z, u, v, w, length=0.1, normalize=True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/quiver3d_demo.txt b/_sources/examples/mplot3d/quiver3d_demo.txt deleted file mode 100644 index 180d2b1b77b..00000000000 --- a/_sources/examples/mplot3d/quiver3d_demo.txt +++ /dev/null @@ -1,33 +0,0 @@ -.. _mplot3d-quiver3d_demo: - -mplot3d example code: quiver3d_demo.py -====================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/quiver3d_demo.py - -:: - - from mpl_toolkits.mplot3d import axes3d - import matplotlib.pyplot as plt - import numpy as np - - fig = plt.figure() - ax = fig.gca(projection='3d') - - x, y, z = np.meshgrid(np.arange(-0.8, 1, 0.2), - np.arange(-0.8, 1, 0.2), - np.arange(-0.8, 1, 0.8)) - - u = np.sin(np.pi * x) * np.cos(np.pi * y) * np.cos(np.pi * z) - v = -np.cos(np.pi * x) * np.sin(np.pi * y) * np.cos(np.pi * z) - w = (np.sqrt(2.0 / 3.0) * np.cos(np.pi * x) * np.cos(np.pi * y) * - np.sin(np.pi * z)) - - ax.quiver(x, y, z, u, v, w, length=0.1) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/rotate_axes3d_demo.rst.txt b/_sources/examples/mplot3d/rotate_axes3d_demo.rst.txt deleted file mode 100644 index 558d13b8034..00000000000 --- a/_sources/examples/mplot3d/rotate_axes3d_demo.rst.txt +++ /dev/null @@ -1,39 +0,0 @@ -.. _mplot3d-rotate_axes3d_demo: - -mplot3d example code: rotate_axes3d_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/rotate_axes3d_demo.py - -:: - - ''' - ================== - Rotating a 3D plot - ================== - - A very simple animation of a rotating 3D plot. - - See wire3d_animation_demo for another simple example of animating a 3D plot. - ''' - - from mpl_toolkits.mplot3d import axes3d - import matplotlib.pyplot as plt - - fig = plt.figure() - ax = fig.add_subplot(111, projection='3d') - - # load some test data for demonstration and plot a wireframe - X, Y, Z = axes3d.get_test_data(0.1) - ax.plot_wireframe(X, Y, Z, rstride=5, cstride=5) - - # rotate the axes and update - for angle in range(0, 360): - ax.view_init(30, angle) - plt.draw() - plt.pause(.001) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/rotate_axes3d_demo.txt b/_sources/examples/mplot3d/rotate_axes3d_demo.txt deleted file mode 100644 index 0f09731dc01..00000000000 --- a/_sources/examples/mplot3d/rotate_axes3d_demo.txt +++ /dev/null @@ -1,27 +0,0 @@ -.. _mplot3d-rotate_axes3d_demo: - -mplot3d example code: rotate_axes3d_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/rotate_axes3d_demo.py - -:: - - from mpl_toolkits.mplot3d import axes3d - import matplotlib.pyplot as plt - import numpy as np - - - fig = plt.figure() - ax = fig.add_subplot(111, projection='3d') - X, Y, Z = axes3d.get_test_data(0.1) - ax.plot_wireframe(X, Y, Z, rstride=5, cstride=5) - - for angle in range(0, 360): - ax.view_init(30, angle) - plt.draw() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/scatter3d_demo.rst.txt b/_sources/examples/mplot3d/scatter3d_demo.rst.txt deleted file mode 100644 index 15532f1edfe..00000000000 --- a/_sources/examples/mplot3d/scatter3d_demo.rst.txt +++ /dev/null @@ -1,52 +0,0 @@ -.. _mplot3d-scatter3d_demo: - -mplot3d example code: scatter3d_demo.py -======================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/scatter3d_demo.py - -:: - - ''' - ============== - 3D scatterplot - ============== - - Demonstration of a basic scatterplot in 3D. - ''' - - from mpl_toolkits.mplot3d import Axes3D - import matplotlib.pyplot as plt - import numpy as np - - - def randrange(n, vmin, vmax): - ''' - Helper function to make an array of random numbers having shape (n, ) - with each number distributed Uniform(vmin, vmax). - ''' - return (vmax - vmin)*np.random.rand(n) + vmin - - fig = plt.figure() - ax = fig.add_subplot(111, projection='3d') - - n = 100 - - # For each set of style and range settings, plot n random points in the box - # defined by x in [23, 32], y in [0, 100], z in [zlow, zhigh]. - for c, m, zlow, zhigh in [('r', 'o', -50, -25), ('b', '^', -30, -5)]: - xs = randrange(n, 23, 32) - ys = randrange(n, 0, 100) - zs = randrange(n, zlow, zhigh) - ax.scatter(xs, ys, zs, c=c, marker=m) - - ax.set_xlabel('X Label') - ax.set_ylabel('Y Label') - ax.set_zlabel('Z Label') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/scatter3d_demo.txt b/_sources/examples/mplot3d/scatter3d_demo.txt deleted file mode 100644 index 2fe411bc2f1..00000000000 --- a/_sources/examples/mplot3d/scatter3d_demo.txt +++ /dev/null @@ -1,36 +0,0 @@ -.. _mplot3d-scatter3d_demo: - -mplot3d example code: scatter3d_demo.py -======================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/scatter3d_demo.py - -:: - - import numpy as np - from mpl_toolkits.mplot3d import Axes3D - import matplotlib.pyplot as plt - - - def randrange(n, vmin, vmax): - return (vmax - vmin)*np.random.rand(n) + vmin - - fig = plt.figure() - ax = fig.add_subplot(111, projection='3d') - n = 100 - for c, m, zl, zh in [('r', 'o', -50, -25), ('b', '^', -30, -5)]: - xs = randrange(n, 23, 32) - ys = randrange(n, 0, 100) - zs = randrange(n, zl, zh) - ax.scatter(xs, ys, zs, c=c, marker=m) - - ax.set_xlabel('X Label') - ax.set_ylabel('Y Label') - ax.set_zlabel('Z Label') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/subplot3d_demo.rst.txt b/_sources/examples/mplot3d/subplot3d_demo.rst.txt deleted file mode 100644 index 8adaec62b4a..00000000000 --- a/_sources/examples/mplot3d/subplot3d_demo.rst.txt +++ /dev/null @@ -1,59 +0,0 @@ -.. _mplot3d-subplot3d_demo: - -mplot3d example code: subplot3d_demo.py -======================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/subplot3d_demo.py - -:: - - ''' - ==================== - 3D plots as subplots - ==================== - - Demonstrate including 3D plots as subplots. - ''' - - import matplotlib.pyplot as plt - from mpl_toolkits.mplot3d.axes3d import Axes3D, get_test_data - from matplotlib import cm - import numpy as np - - - # set up a figure twice as wide as it is tall - fig = plt.figure(figsize=plt.figaspect(0.5)) - - #=============== - # First subplot - #=============== - # set up the axes for the first plot - ax = fig.add_subplot(1, 2, 1, projection='3d') - - # plot a 3D surface like in the example mplot3d/surface3d_demo - X = np.arange(-5, 5, 0.25) - Y = np.arange(-5, 5, 0.25) - X, Y = np.meshgrid(X, Y) - R = np.sqrt(X**2 + Y**2) - Z = np.sin(R) - surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.coolwarm, - linewidth=0, antialiased=False) - ax.set_zlim(-1.01, 1.01) - fig.colorbar(surf, shrink=0.5, aspect=10) - - #=============== - # Second subplot - #=============== - # set up the axes for the second plot - ax = fig.add_subplot(1, 2, 2, projection='3d') - - # plot a 3D wireframe like in the example mplot3d/wire3d_demo - X, Y, Z = get_test_data(0.05) - ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/subplot3d_demo.txt b/_sources/examples/mplot3d/subplot3d_demo.txt deleted file mode 100644 index 37f12a1f3fd..00000000000 --- a/_sources/examples/mplot3d/subplot3d_demo.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _mplot3d-subplot3d_demo: - -mplot3d example code: subplot3d_demo.py -======================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/subplot3d_demo.py - -:: - - from mpl_toolkits.mplot3d.axes3d import Axes3D - import matplotlib.pyplot as plt - - - # imports specific to the plots in this example - import numpy as np - from matplotlib import cm - from mpl_toolkits.mplot3d.axes3d import get_test_data - - # Twice as wide as it is tall. - fig = plt.figure(figsize=plt.figaspect(0.5)) - - #---- First subplot - ax = fig.add_subplot(1, 2, 1, projection='3d') - X = np.arange(-5, 5, 0.25) - Y = np.arange(-5, 5, 0.25) - X, Y = np.meshgrid(X, Y) - R = np.sqrt(X**2 + Y**2) - Z = np.sin(R) - surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.coolwarm, - linewidth=0, antialiased=False) - ax.set_zlim3d(-1.01, 1.01) - - fig.colorbar(surf, shrink=0.5, aspect=10) - - #---- Second subplot - ax = fig.add_subplot(1, 2, 2, projection='3d') - X, Y, Z = get_test_data(0.05) - ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/surface3d_demo.rst.txt b/_sources/examples/mplot3d/surface3d_demo.rst.txt deleted file mode 100644 index 933ed784f69..00000000000 --- a/_sources/examples/mplot3d/surface3d_demo.rst.txt +++ /dev/null @@ -1,56 +0,0 @@ -.. _mplot3d-surface3d_demo: - -mplot3d example code: surface3d_demo.py -======================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/surface3d_demo.py - -:: - - ''' - ====================== - 3D surface (color map) - ====================== - - Demonstrates plotting a 3D surface colored with the coolwarm color map. - The surface is made opaque by using antialiased=False. - - Also demonstrates using the LinearLocator and custom formatting for the - z axis tick labels. - ''' - - from mpl_toolkits.mplot3d import Axes3D - import matplotlib.pyplot as plt - from matplotlib import cm - from matplotlib.ticker import LinearLocator, FormatStrFormatter - import numpy as np - - - fig = plt.figure() - ax = fig.gca(projection='3d') - - # Make data. - X = np.arange(-5, 5, 0.25) - Y = np.arange(-5, 5, 0.25) - X, Y = np.meshgrid(X, Y) - R = np.sqrt(X**2 + Y**2) - Z = np.sin(R) - - # Plot the surface. - surf = ax.plot_surface(X, Y, Z, cmap=cm.coolwarm, - linewidth=0, antialiased=False) - - # Customize the z axis. - ax.set_zlim(-1.01, 1.01) - ax.zaxis.set_major_locator(LinearLocator(10)) - ax.zaxis.set_major_formatter(FormatStrFormatter('%.02f')) - - # Add a color bar which maps values to colors. - fig.colorbar(surf, shrink=0.5, aspect=5) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/surface3d_demo.txt b/_sources/examples/mplot3d/surface3d_demo.txt deleted file mode 100644 index e29cd573bbe..00000000000 --- a/_sources/examples/mplot3d/surface3d_demo.txt +++ /dev/null @@ -1,37 +0,0 @@ -.. _mplot3d-surface3d_demo: - -mplot3d example code: surface3d_demo.py -======================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/surface3d_demo.py - -:: - - from mpl_toolkits.mplot3d import Axes3D - from matplotlib import cm - from matplotlib.ticker import LinearLocator, FormatStrFormatter - import matplotlib.pyplot as plt - import numpy as np - - fig = plt.figure() - ax = fig.gca(projection='3d') - X = np.arange(-5, 5, 0.25) - Y = np.arange(-5, 5, 0.25) - X, Y = np.meshgrid(X, Y) - R = np.sqrt(X**2 + Y**2) - Z = np.sin(R) - surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.coolwarm, - linewidth=0, antialiased=False) - ax.set_zlim(-1.01, 1.01) - - ax.zaxis.set_major_locator(LinearLocator(10)) - ax.zaxis.set_major_formatter(FormatStrFormatter('%.02f')) - - fig.colorbar(surf, shrink=0.5, aspect=5) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/surface3d_demo2.rst.txt b/_sources/examples/mplot3d/surface3d_demo2.rst.txt deleted file mode 100644 index 9c0ae388beb..00000000000 --- a/_sources/examples/mplot3d/surface3d_demo2.rst.txt +++ /dev/null @@ -1,41 +0,0 @@ -.. _mplot3d-surface3d_demo2: - -mplot3d example code: surface3d_demo2.py -======================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/surface3d_demo2.py - -:: - - ''' - ======================== - 3D surface (solid color) - ======================== - - Demonstrates a very basic plot of a 3D surface using a solid color. - ''' - - from mpl_toolkits.mplot3d import Axes3D - import matplotlib.pyplot as plt - import numpy as np - - - fig = plt.figure() - ax = fig.add_subplot(111, projection='3d') - - # Make data - u = np.linspace(0, 2 * np.pi, 100) - v = np.linspace(0, np.pi, 100) - x = 10 * np.outer(np.cos(u), np.sin(v)) - y = 10 * np.outer(np.sin(u), np.sin(v)) - z = 10 * np.outer(np.ones(np.size(u)), np.cos(v)) - - # Plot the surface - ax.plot_surface(x, y, z, color='b') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/surface3d_demo2.txt b/_sources/examples/mplot3d/surface3d_demo2.txt deleted file mode 100644 index 353e534f0cd..00000000000 --- a/_sources/examples/mplot3d/surface3d_demo2.txt +++ /dev/null @@ -1,30 +0,0 @@ -.. _mplot3d-surface3d_demo2: - -mplot3d example code: surface3d_demo2.py -======================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/surface3d_demo2.py - -:: - - from mpl_toolkits.mplot3d import Axes3D - import matplotlib.pyplot as plt - import numpy as np - - fig = plt.figure() - ax = fig.add_subplot(111, projection='3d') - - u = np.linspace(0, 2 * np.pi, 100) - v = np.linspace(0, np.pi, 100) - - x = 10 * np.outer(np.cos(u), np.sin(v)) - y = 10 * np.outer(np.sin(u), np.sin(v)) - z = 10 * np.outer(np.ones(np.size(u)), np.cos(v)) - ax.plot_surface(x, y, z, rstride=4, cstride=4, color='b') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/surface3d_demo3.rst.txt b/_sources/examples/mplot3d/surface3d_demo3.rst.txt deleted file mode 100644 index 629aa53b926..00000000000 --- a/_sources/examples/mplot3d/surface3d_demo3.rst.txt +++ /dev/null @@ -1,57 +0,0 @@ -.. _mplot3d-surface3d_demo3: - -mplot3d example code: surface3d_demo3.py -======================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/surface3d_demo3.py - -:: - - ''' - ========================= - 3D surface (checkerboard) - ========================= - - Demonstrates plotting a 3D surface colored in a checkerboard pattern. - ''' - - from mpl_toolkits.mplot3d import Axes3D - import matplotlib.pyplot as plt - from matplotlib import cm - from matplotlib.ticker import LinearLocator - import numpy as np - - - fig = plt.figure() - ax = fig.gca(projection='3d') - - # Make data. - X = np.arange(-5, 5, 0.25) - xlen = len(X) - Y = np.arange(-5, 5, 0.25) - ylen = len(Y) - X, Y = np.meshgrid(X, Y) - R = np.sqrt(X**2 + Y**2) - Z = np.sin(R) - - # Create an empty array of strings with the same shape as the meshgrid, and - # populate it with two colors in a checkerboard pattern. - colortuple = ('y', 'b') - colors = np.empty(X.shape, dtype=str) - for y in range(ylen): - for x in range(xlen): - colors[x, y] = colortuple[(x + y) % len(colortuple)] - - # Plot the surface with face colors taken from the array we made. - surf = ax.plot_surface(X, Y, Z, facecolors=colors, linewidth=0) - - # Customize the z axis. - ax.set_zlim(-1, 1) - ax.w_zaxis.set_major_locator(LinearLocator(6)) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/surface3d_demo3.txt b/_sources/examples/mplot3d/surface3d_demo3.txt deleted file mode 100644 index 70028ecb651..00000000000 --- a/_sources/examples/mplot3d/surface3d_demo3.txt +++ /dev/null @@ -1,43 +0,0 @@ -.. _mplot3d-surface3d_demo3: - -mplot3d example code: surface3d_demo3.py -======================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/surface3d_demo3.py - -:: - - from mpl_toolkits.mplot3d import Axes3D - from matplotlib import cm - from matplotlib.ticker import LinearLocator - import matplotlib.pyplot as plt - import numpy as np - - fig = plt.figure() - ax = fig.gca(projection='3d') - X = np.arange(-5, 5, 0.25) - xlen = len(X) - Y = np.arange(-5, 5, 0.25) - ylen = len(Y) - X, Y = np.meshgrid(X, Y) - R = np.sqrt(X**2 + Y**2) - Z = np.sin(R) - - colortuple = ('y', 'b') - colors = np.empty(X.shape, dtype=str) - for y in range(ylen): - for x in range(xlen): - colors[x, y] = colortuple[(x + y) % len(colortuple)] - - surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, facecolors=colors, - linewidth=0, antialiased=False) - - ax.set_zlim3d(-1, 1) - ax.w_zaxis.set_major_locator(LinearLocator(6)) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/surface3d_radial_demo.rst.txt b/_sources/examples/mplot3d/surface3d_radial_demo.rst.txt deleted file mode 100644 index e6387ef927a..00000000000 --- a/_sources/examples/mplot3d/surface3d_radial_demo.rst.txt +++ /dev/null @@ -1,53 +0,0 @@ -.. _mplot3d-surface3d_radial_demo: - -mplot3d example code: surface3d_radial_demo.py -============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/surface3d_radial_demo.py - -:: - - ''' - ================================= - 3D surface with polar coordinates - ================================= - - Demonstrates plotting a surface defined in polar coordinates. - Uses the reversed version of the YlGnBu color map. - Also demonstrates writing axis labels with latex math mode. - - Example contributed by Armin Moser. - ''' - - from mpl_toolkits.mplot3d import Axes3D - from matplotlib import pyplot as plt - import numpy as np - - - fig = plt.figure() - ax = fig.add_subplot(111, projection='3d') - - # Create the mesh in polar coordinates and compute corresponding Z. - r = np.linspace(0, 1.25, 50) - p = np.linspace(0, 2*np.pi, 50) - R, P = np.meshgrid(r, p) - Z = ((R**2 - 1)**2) - - # Express the mesh in the cartesian system. - X, Y = R*np.cos(P), R*np.sin(P) - - # Plot the surface. - ax.plot_surface(X, Y, Z, cmap=plt.cm.YlGnBu_r) - - # Tweak the limits and add latex math labels. - ax.set_zlim(0, 1) - ax.set_xlabel(r'$\phi_\mathrm{real}$') - ax.set_ylabel(r'$\phi_\mathrm{im}$') - ax.set_zlabel(r'$V(\phi)$') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/surface3d_radial_demo.txt b/_sources/examples/mplot3d/surface3d_radial_demo.txt deleted file mode 100644 index a2c63b8a389..00000000000 --- a/_sources/examples/mplot3d/surface3d_radial_demo.txt +++ /dev/null @@ -1,40 +0,0 @@ -.. _mplot3d-surface3d_radial_demo: - -mplot3d example code: surface3d_radial_demo.py -============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/surface3d_radial_demo.py - -:: - - # By Armin Moser - - from mpl_toolkits.mplot3d import Axes3D - import matplotlib - import numpy as np - from matplotlib import cm - from matplotlib import pyplot as plt - step = 0.04 - maxval = 1.0 - fig = plt.figure() - ax = fig.add_subplot(111, projection='3d') - - # create supporting points in polar coordinates - r = np.linspace(0, 1.25, 50) - p = np.linspace(0, 2*np.pi, 50) - R, P = np.meshgrid(r, p) - # transform them to cartesian system - X, Y = R*np.cos(P), R*np.sin(P) - - Z = ((R**2 - 1)**2) - ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.YlGnBu_r) - ax.set_zlim3d(0, 1) - ax.set_xlabel(r'$\phi_\mathrm{real}$') - ax.set_ylabel(r'$\phi_\mathrm{im}$') - ax.set_zlabel(r'$V(\phi)$') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/text3d_demo.rst.txt b/_sources/examples/mplot3d/text3d_demo.rst.txt deleted file mode 100644 index 5ecb5b5ac3d..00000000000 --- a/_sources/examples/mplot3d/text3d_demo.rst.txt +++ /dev/null @@ -1,61 +0,0 @@ -.. _mplot3d-text3d_demo: - -mplot3d example code: text3d_demo.py -==================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/text3d_demo.py - -:: - - ''' - ====================== - Text annotations in 3D - ====================== - - Demonstrates the placement of text annotations on a 3D plot. - - Functionality shown: - - Using the text function with three types of 'zdir' values: None, - an axis name (ex. 'x'), or a direction tuple (ex. (1, 1, 0)). - - Using the text function with the color keyword. - - Using the text2D function to place text on a fixed position on the ax object. - ''' - - from mpl_toolkits.mplot3d import Axes3D - import matplotlib.pyplot as plt - - - fig = plt.figure() - ax = fig.gca(projection='3d') - - # Demo 1: zdir - zdirs = (None, 'x', 'y', 'z', (1, 1, 0), (1, 1, 1)) - xs = (1, 4, 4, 9, 4, 1) - ys = (2, 5, 8, 10, 1, 2) - zs = (10, 3, 8, 9, 1, 8) - - for zdir, x, y, z in zip(zdirs, xs, ys, zs): - label = '(%d, %d, %d), dir=%s' % (x, y, z, zdir) - ax.text(x, y, z, label, zdir) - - # Demo 2: color - ax.text(9, 0, 0, "red", color='red') - - # Demo 3: text2D - # Placement 0, 0 would be the bottom left, 1, 1 would be the top right. - ax.text2D(0.05, 0.95, "2D Text", transform=ax.transAxes) - - # Tweaking display region and labels - ax.set_xlim(0, 10) - ax.set_ylim(0, 10) - ax.set_zlim(0, 10) - ax.set_xlabel('X axis') - ax.set_ylabel('Y axis') - ax.set_zlabel('Z axis') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/text3d_demo.txt b/_sources/examples/mplot3d/text3d_demo.txt deleted file mode 100644 index a9e6951e776..00000000000 --- a/_sources/examples/mplot3d/text3d_demo.txt +++ /dev/null @@ -1,41 +0,0 @@ -.. _mplot3d-text3d_demo: - -mplot3d example code: text3d_demo.py -==================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/text3d_demo.py - -:: - - from mpl_toolkits.mplot3d import Axes3D - import matplotlib.pyplot as plt - - fig = plt.figure() - ax = fig.gca(projection='3d') - - zdirs = (None, 'x', 'y', 'z', (1, 1, 0), (1, 1, 1)) - xs = (1, 4, 4, 9, 4, 1) - ys = (2, 5, 8, 10, 1, 2) - zs = (10, 3, 8, 9, 1, 8) - - for zdir, x, y, z in zip(zdirs, xs, ys, zs): - label = '(%d, %d, %d), dir=%s' % (x, y, z, zdir) - ax.text(x, y, z, label, zdir) - - ax.text(9, 0, 0, "red", color='red') - ax.text2D(0.05, 0.95, "2D Text", transform=ax.transAxes) - - ax.set_xlim3d(0, 10) - ax.set_ylim3d(0, 10) - ax.set_zlim3d(0, 10) - - ax.set_xlabel('X axis') - ax.set_ylabel('Y axis') - ax.set_zlabel('Z axis') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/tricontour3d_demo.rst.txt b/_sources/examples/mplot3d/tricontour3d_demo.rst.txt deleted file mode 100644 index 301ba2e72ed..00000000000 --- a/_sources/examples/mplot3d/tricontour3d_demo.rst.txt +++ /dev/null @@ -1,61 +0,0 @@ -.. _mplot3d-tricontour3d_demo: - -mplot3d example code: tricontour3d_demo.py -========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/tricontour3d_demo.py - -:: - - """ - ========================== - Triangular 3D contour plot - ========================== - - Contour plots of unstructured triangular grids. - - The data used is the same as in the second plot of trisurf3d_demo2. - tricontourf3d_demo shows the filled version of this example. - """ - - import matplotlib.pyplot as plt - from mpl_toolkits.mplot3d import Axes3D - import matplotlib.tri as tri - import numpy as np - - n_angles = 48 - n_radii = 8 - min_radius = 0.25 - - # Create the mesh in polar coordinates and compute x, y, z. - radii = np.linspace(min_radius, 0.95, n_radii) - angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False) - angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) - angles[:, 1::2] += np.pi/n_angles - - x = (radii*np.cos(angles)).flatten() - y = (radii*np.sin(angles)).flatten() - z = (np.cos(radii)*np.cos(angles*3.0)).flatten() - - # Create a custom triangulation. - triang = tri.Triangulation(x, y) - - # Mask off unwanted triangles. - xmid = x[triang.triangles].mean(axis=1) - ymid = y[triang.triangles].mean(axis=1) - mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0) - triang.set_mask(mask) - - fig = plt.figure() - ax = fig.gca(projection='3d') - ax.tricontour(triang, z, cmap=plt.cm.CMRmap) - - # Customize the view angle so it's easier to understand the plot. - ax.view_init(elev=45.) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/tricontour3d_demo.txt b/_sources/examples/mplot3d/tricontour3d_demo.txt deleted file mode 100644 index 4df31127b5c..00000000000 --- a/_sources/examples/mplot3d/tricontour3d_demo.txt +++ /dev/null @@ -1,50 +0,0 @@ -.. _mplot3d-tricontour3d_demo: - -mplot3d example code: tricontour3d_demo.py -========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/tricontour3d_demo.py - -:: - - """ - Contour plots of unstructured triangular grids. - """ - import matplotlib.pyplot as plt - from mpl_toolkits.mplot3d import Axes3D - import matplotlib.tri as tri - import numpy as np - import math - - # First create the x and y coordinates of the points. - n_angles = 48 - n_radii = 8 - min_radius = 0.25 - radii = np.linspace(min_radius, 0.95, n_radii) - - angles = np.linspace(0, 2*math.pi, n_angles, endpoint=False) - angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) - angles[:, 1::2] += math.pi/n_angles - - x = (radii*np.cos(angles)).flatten() - y = (radii*np.sin(angles)).flatten() - z = (np.cos(radii)*np.cos(angles*3.0)).flatten() - - # Create a custom triangulation - triang = tri.Triangulation(x, y) - - # Mask off unwanted triangles. - xmid = x[triang.triangles].mean(axis=1) - ymid = y[triang.triangles].mean(axis=1) - mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0) - triang.set_mask(mask) - - plt.figure() - plt.gca(projection='3d') - plt.tricontour(triang, z) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/tricontourf3d_demo.rst.txt b/_sources/examples/mplot3d/tricontourf3d_demo.rst.txt deleted file mode 100644 index 4b466f6d798..00000000000 --- a/_sources/examples/mplot3d/tricontourf3d_demo.rst.txt +++ /dev/null @@ -1,62 +0,0 @@ -.. _mplot3d-tricontourf3d_demo: - -mplot3d example code: tricontourf3d_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/tricontourf3d_demo.py - -:: - - """ - ================================= - Triangular 3D filled contour plot - ================================= - - Filled contour plots of unstructured triangular grids. - - The data used is the same as in the second plot of trisurf3d_demo2. - tricontour3d_demo shows the unfilled version of this example. - """ - - import matplotlib.pyplot as plt - from mpl_toolkits.mplot3d import Axes3D - import matplotlib.tri as tri - import numpy as np - - # First create the x, y, z coordinates of the points. - n_angles = 48 - n_radii = 8 - min_radius = 0.25 - - # Create the mesh in polar coordinates and compute x, y, z. - radii = np.linspace(min_radius, 0.95, n_radii) - angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False) - angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) - angles[:, 1::2] += np.pi/n_angles - - x = (radii*np.cos(angles)).flatten() - y = (radii*np.sin(angles)).flatten() - z = (np.cos(radii)*np.cos(angles*3.0)).flatten() - - # Create a custom triangulation. - triang = tri.Triangulation(x, y) - - # Mask off unwanted triangles. - xmid = x[triang.triangles].mean(axis=1) - ymid = y[triang.triangles].mean(axis=1) - mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0) - triang.set_mask(mask) - - fig = plt.figure() - ax = fig.gca(projection='3d') - ax.tricontourf(triang, z, cmap=plt.cm.CMRmap) - - # Customize the view angle so it's easier to understand the plot. - ax.view_init(elev=45.) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/tricontourf3d_demo.txt b/_sources/examples/mplot3d/tricontourf3d_demo.txt deleted file mode 100644 index 215b9592c03..00000000000 --- a/_sources/examples/mplot3d/tricontourf3d_demo.txt +++ /dev/null @@ -1,50 +0,0 @@ -.. _mplot3d-tricontourf3d_demo: - -mplot3d example code: tricontourf3d_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/tricontourf3d_demo.py - -:: - - """ - Contour plots of unstructured triangular grids. - """ - import matplotlib.pyplot as plt - from mpl_toolkits.mplot3d import Axes3D - import matplotlib.tri as tri - import numpy as np - import math - - # First create the x and y coordinates of the points. - n_angles = 48 - n_radii = 8 - min_radius = 0.25 - radii = np.linspace(min_radius, 0.95, n_radii) - - angles = np.linspace(0, 2*math.pi, n_angles, endpoint=False) - angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) - angles[:, 1::2] += math.pi/n_angles - - x = (radii*np.cos(angles)).flatten() - y = (radii*np.sin(angles)).flatten() - z = (np.cos(radii)*np.cos(angles*3.0)).flatten() - - # Create a custom triangulation - triang = tri.Triangulation(x, y) - - # Mask off unwanted triangles. - xmid = x[triang.triangles].mean(axis=1) - ymid = y[triang.triangles].mean(axis=1) - mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0) - triang.set_mask(mask) - - plt.figure() - plt.gca(projection='3d') - plt.tricontourf(triang, z) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/trisurf3d_demo.rst.txt b/_sources/examples/mplot3d/trisurf3d_demo.rst.txt deleted file mode 100644 index a2c1414ad62..00000000000 --- a/_sources/examples/mplot3d/trisurf3d_demo.rst.txt +++ /dev/null @@ -1,52 +0,0 @@ -.. _mplot3d-trisurf3d_demo: - -mplot3d example code: trisurf3d_demo.py -======================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/trisurf3d_demo.py - -:: - - ''' - ====================== - Triangular 3D surfaces - ====================== - - Plot a 3D surface with a triangular mesh. - ''' - - from mpl_toolkits.mplot3d import Axes3D - import matplotlib.pyplot as plt - import numpy as np - - - n_radii = 8 - n_angles = 36 - - # Make radii and angles spaces (radius r=0 omitted to eliminate duplication). - radii = np.linspace(0.125, 1.0, n_radii) - angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False) - - # Repeat all angles for each radius. - angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) - - # Convert polar (radii, angles) coords to cartesian (x, y) coords. - # (0, 0) is manually added at this stage, so there will be no duplicate - # points in the (x, y) plane. - x = np.append(0, (radii*np.cos(angles)).flatten()) - y = np.append(0, (radii*np.sin(angles)).flatten()) - - # Compute z to make the pringle surface. - z = np.sin(-x*y) - - fig = plt.figure() - ax = fig.gca(projection='3d') - - ax.plot_trisurf(x, y, z, linewidth=0.2, antialiased=True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/trisurf3d_demo.txt b/_sources/examples/mplot3d/trisurf3d_demo.txt deleted file mode 100644 index 9c52f2287ac..00000000000 --- a/_sources/examples/mplot3d/trisurf3d_demo.txt +++ /dev/null @@ -1,46 +0,0 @@ -.. _mplot3d-trisurf3d_demo: - -mplot3d example code: trisurf3d_demo.py -======================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/trisurf3d_demo.py - -:: - - from mpl_toolkits.mplot3d import Axes3D - from matplotlib import cm - import matplotlib.pyplot as plt - import numpy as np - - n_angles = 36 - n_radii = 8 - - # An array of radii - # Does not include radius r=0, this is to eliminate duplicate points - radii = np.linspace(0.125, 1.0, n_radii) - - # An array of angles - angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False) - - # Repeat all angles for each radius - angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) - - # Convert polar (radii, angles) coords to cartesian (x, y) coords - # (0, 0) is added here. There are no duplicate points in the (x, y) plane - x = np.append(0, (radii*np.cos(angles)).flatten()) - y = np.append(0, (radii*np.sin(angles)).flatten()) - - # Pringle surface - z = np.sin(-x*y) - - fig = plt.figure() - ax = fig.gca(projection='3d') - - ax.plot_trisurf(x, y, z, cmap=cm.jet, linewidth=0.2) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/trisurf3d_demo2.rst.txt b/_sources/examples/mplot3d/trisurf3d_demo2.rst.txt deleted file mode 100644 index 820d7b7bfa2..00000000000 --- a/_sources/examples/mplot3d/trisurf3d_demo2.rst.txt +++ /dev/null @@ -1,94 +0,0 @@ -.. _mplot3d-trisurf3d_demo2: - -mplot3d example code: trisurf3d_demo2.py -======================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/trisurf3d_demo2.py - -:: - - ''' - =========================== - More triangular 3D surfaces - =========================== - - Two additional examples of plotting surfaces with triangular mesh. - - The first demonstrates use of plot_trisurf's triangles argument, and the - second sets a Triangulation object's mask and passes the object directly - to plot_trisurf. - ''' - - import numpy as np - import matplotlib.pyplot as plt - from mpl_toolkits.mplot3d import Axes3D - import matplotlib.tri as mtri - - - fig = plt.figure(figsize=plt.figaspect(0.5)) - - #============ - # First plot - #============ - - # Make a mesh in the space of parameterisation variables u and v - u = np.linspace(0, 2.0 * np.pi, endpoint=True, num=50) - v = np.linspace(-0.5, 0.5, endpoint=True, num=10) - u, v = np.meshgrid(u, v) - u, v = u.flatten(), v.flatten() - - # This is the Mobius mapping, taking a u, v pair and returning an x, y, z - # triple - x = (1 + 0.5 * v * np.cos(u / 2.0)) * np.cos(u) - y = (1 + 0.5 * v * np.cos(u / 2.0)) * np.sin(u) - z = 0.5 * v * np.sin(u / 2.0) - - # Triangulate parameter space to determine the triangles - tri = mtri.Triangulation(u, v) - - # Plot the surface. The triangles in parameter space determine which x, y, z - # points are connected by an edge. - ax = fig.add_subplot(1, 2, 1, projection='3d') - ax.plot_trisurf(x, y, z, triangles=tri.triangles, cmap=plt.cm.Spectral) - ax.set_zlim(-1, 1) - - - #============ - # Second plot - #============ - - # Make parameter spaces radii and angles. - n_angles = 36 - n_radii = 8 - min_radius = 0.25 - radii = np.linspace(min_radius, 0.95, n_radii) - - angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False) - angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) - angles[:, 1::2] += np.pi/n_angles - - # Map radius, angle pairs to x, y, z points. - x = (radii*np.cos(angles)).flatten() - y = (radii*np.sin(angles)).flatten() - z = (np.cos(radii)*np.cos(angles*3.0)).flatten() - - # Create the Triangulation; no triangles so Delaunay triangulation created. - triang = mtri.Triangulation(x, y) - - # Mask off unwanted triangles. - xmid = x[triang.triangles].mean(axis=1) - ymid = y[triang.triangles].mean(axis=1) - mask = np.where(xmid**2 + ymid**2 < min_radius**2, 1, 0) - triang.set_mask(mask) - - # Plot the surface. - ax = fig.add_subplot(1, 2, 2, projection='3d') - ax.plot_trisurf(triang, z, cmap=plt.cm.CMRmap) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/trisurf3d_demo2.txt b/_sources/examples/mplot3d/trisurf3d_demo2.txt deleted file mode 100644 index ee7e720953b..00000000000 --- a/_sources/examples/mplot3d/trisurf3d_demo2.txt +++ /dev/null @@ -1,69 +0,0 @@ -.. _mplot3d-trisurf3d_demo2: - -mplot3d example code: trisurf3d_demo2.py -======================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/trisurf3d_demo2.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - from mpl_toolkits.mplot3d import Axes3D - import matplotlib.tri as mtri - - # u, v are parameterisation variables - u = (np.linspace(0, 2.0 * np.pi, endpoint=True, num=50) * np.ones((10, 1))).flatten() - v = np.repeat(np.linspace(-0.5, 0.5, endpoint=True, num=10), repeats=50).flatten() - - # This is the Mobius mapping, taking a u, v pair and returning an x, y, z - # triple - x = (1 + 0.5 * v * np.cos(u / 2.0)) * np.cos(u) - y = (1 + 0.5 * v * np.cos(u / 2.0)) * np.sin(u) - z = 0.5 * v * np.sin(u / 2.0) - - # Triangulate parameter space to determine the triangles - tri = mtri.Triangulation(u, v) - - fig = plt.figure() - ax = fig.add_subplot(1, 1, 1, projection='3d') - - # The triangles in parameter space determine which x, y, z points are - # connected by an edge - ax.plot_trisurf(x, y, z, triangles=tri.triangles, cmap=plt.cm.Spectral) - - ax.set_zlim(-1, 1) - - # First create the x and y coordinates of the points. - n_angles = 36 - n_radii = 8 - min_radius = 0.25 - radii = np.linspace(min_radius, 0.95, n_radii) - - angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False) - angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) - angles[:, 1::2] += np.pi/n_angles - - x = (radii*np.cos(angles)).flatten() - y = (radii*np.sin(angles)).flatten() - z = (np.cos(radii)*np.cos(angles*3.0)).flatten() - - # Create the Triangulation; no triangles so Delaunay triangulation created. - triang = mtri.Triangulation(x, y) - - # Mask off unwanted triangles. - xmid = x[triang.triangles].mean(axis=1) - ymid = y[triang.triangles].mean(axis=1) - mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0) - triang.set_mask(mask) - - # tripcolor plot. - fig = plt.figure() - ax = fig.add_subplot(1, 1, 1, projection='3d') - ax.plot_trisurf(triang, z, cmap=plt.cm.CMRmap) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/wire3d_animation_demo.rst.txt b/_sources/examples/mplot3d/wire3d_animation_demo.rst.txt deleted file mode 100644 index 8f8d3e0e3dc..00000000000 --- a/_sources/examples/mplot3d/wire3d_animation_demo.rst.txt +++ /dev/null @@ -1,63 +0,0 @@ -.. _mplot3d-wire3d_animation_demo: - -mplot3d example code: wire3d_animation_demo.py -============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/wire3d_animation_demo.py - -:: - - """ - ========================== - Rotating 3D wireframe plot - ========================== - - A very simple 'animation' of a 3D plot. See also rotate_axes3d_demo. - """ - - from __future__ import print_function - - from mpl_toolkits.mplot3d import axes3d - import matplotlib.pyplot as plt - import numpy as np - import time - - - def generate(X, Y, phi): - ''' - Generates Z data for the points in the X, Y meshgrid and parameter phi. - ''' - R = 1 - np.sqrt(X**2 + Y**2) - return np.cos(2 * np.pi * X + phi) * R - - - fig = plt.figure() - ax = fig.add_subplot(111, projection='3d') - - # Make the X, Y meshgrid. - xs = np.linspace(-1, 1, 50) - ys = np.linspace(-1, 1, 50) - X, Y = np.meshgrid(xs, ys) - - # Set the z axis limits so they aren't recalculated each frame. - ax.set_zlim(-1, 1) - - # Begin plotting. - wframe = None - tstart = time.time() - for phi in np.linspace(0, 180. / np.pi, 100): - # If a line collection is already remove it before drawing. - if wframe: - ax.collections.remove(wframe) - - # Plot the new wireframe and pause briefly before continuing. - Z = generate(X, Y, phi) - wframe = ax.plot_wireframe(X, Y, Z, rstride=2, cstride=2) - plt.pause(.001) - - print('Average FPS: %f' % (100 / (time.time() - tstart))) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/wire3d_animation_demo.txt b/_sources/examples/mplot3d/wire3d_animation_demo.txt deleted file mode 100644 index 09e14474365..00000000000 --- a/_sources/examples/mplot3d/wire3d_animation_demo.txt +++ /dev/null @@ -1,52 +0,0 @@ -.. _mplot3d-wire3d_animation_demo: - -mplot3d example code: wire3d_animation_demo.py -============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/wire3d_animation_demo.py - -:: - - from __future__ import print_function - """ - A very simple 'animation' of a 3D plot - """ - from mpl_toolkits.mplot3d import axes3d - import matplotlib.pyplot as plt - import numpy as np - import time - - - def generate(X, Y, phi): - R = 1 - np.sqrt(X**2 + Y**2) - return np.cos(2 * np.pi * X + phi) * R - - fig = plt.figure() - ax = fig.add_subplot(111, projection='3d') - - xs = np.linspace(-1, 1, 50) - ys = np.linspace(-1, 1, 50) - X, Y = np.meshgrid(xs, ys) - Z = generate(X, Y, 0.0) - - wframe = None - tstart = time.time() - for phi in np.linspace(0, 360 / 2 / np.pi, 100): - - oldcol = wframe - - Z = generate(X, Y, phi) - wframe = ax.plot_wireframe(X, Y, Z, rstride=2, cstride=2) - - # Remove old line collection before drawing - if oldcol is not None: - ax.collections.remove(oldcol) - - plt.pause(.001) - - print('FPS: %f' % (100 / (time.time() - tstart))) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/wire3d_demo.rst.txt b/_sources/examples/mplot3d/wire3d_demo.rst.txt deleted file mode 100644 index 34feca77992..00000000000 --- a/_sources/examples/mplot3d/wire3d_demo.rst.txt +++ /dev/null @@ -1,36 +0,0 @@ -.. _mplot3d-wire3d_demo: - -mplot3d example code: wire3d_demo.py -==================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/wire3d_demo.py - -:: - - ''' - ================= - 3D wireframe plot - ================= - - A very basic demonstration of a wireframe plot. - ''' - - from mpl_toolkits.mplot3d import axes3d - import matplotlib.pyplot as plt - - - fig = plt.figure() - ax = fig.add_subplot(111, projection='3d') - - # Grab some test data. - X, Y, Z = axes3d.get_test_data(0.05) - - # Plot a basic wireframe. - ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/wire3d_demo.txt b/_sources/examples/mplot3d/wire3d_demo.txt deleted file mode 100644 index f3e2caeffcd..00000000000 --- a/_sources/examples/mplot3d/wire3d_demo.txt +++ /dev/null @@ -1,24 +0,0 @@ -.. _mplot3d-wire3d_demo: - -mplot3d example code: wire3d_demo.py -==================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/wire3d_demo.py - -:: - - from mpl_toolkits.mplot3d import axes3d - import matplotlib.pyplot as plt - import numpy as np - - fig = plt.figure() - ax = fig.add_subplot(111, projection='3d') - X, Y, Z = axes3d.get_test_data(0.05) - ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/wire3d_zero_stride.rst.txt b/_sources/examples/mplot3d/wire3d_zero_stride.rst.txt deleted file mode 100644 index 04e459fd10a..00000000000 --- a/_sources/examples/mplot3d/wire3d_zero_stride.rst.txt +++ /dev/null @@ -1,42 +0,0 @@ -.. _mplot3d-wire3d_zero_stride: - -mplot3d example code: wire3d_zero_stride.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/mplot3d/wire3d_zero_stride.py - -:: - - ''' - =================================== - 3D wireframe plots in one direction - =================================== - - Demonstrates that setting rstride or cstride to 0 causes wires to not be - generated in the corresponding direction. - ''' - - from mpl_toolkits.mplot3d import axes3d - import matplotlib.pyplot as plt - - - fig, [ax1, ax2] = plt.subplots(2, 1, figsize=(8, 12), subplot_kw={'projection': '3d'}) - - # Get the test data - X, Y, Z = axes3d.get_test_data(0.05) - - # Give the first plot only wireframes of the type y = c - ax1.plot_wireframe(X, Y, Z, rstride=10, cstride=0) - ax1.set_title("Column (x) stride set to 0") - - # Give the second plot only wireframes of the type x = c - ax2.plot_wireframe(X, Y, Z, rstride=0, cstride=10) - ax2.set_title("Row (y) stride set to 0") - - plt.tight_layout() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/mplot3d/wire3d_zero_stride.txt b/_sources/examples/mplot3d/wire3d_zero_stride.txt deleted file mode 100644 index 1d263b97be8..00000000000 --- a/_sources/examples/mplot3d/wire3d_zero_stride.txt +++ /dev/null @@ -1,26 +0,0 @@ -.. _mplot3d-wire3d_zero_stride: - -mplot3d example code: wire3d_zero_stride.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/mplot3d/wire3d_zero_stride.py - -:: - - from mpl_toolkits.mplot3d import axes3d - import matplotlib.pyplot as plt - import numpy as np - - fig, [ax1, ax2] = plt.subplots(2, 1, figsize=(8, 12), subplot_kw={'projection': '3d'}) - X, Y, Z = axes3d.get_test_data(0.05) - ax1.plot_wireframe(X, Y, Z, rstride=10, cstride=0) - ax1.set_title("Column stride 0") - ax2.plot_wireframe(X, Y, Z, rstride=0, cstride=10) - ax2.set_title("Row stride 0") - plt.tight_layout() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/old_animation/animate_decay_tk_blit.txt b/_sources/examples/old_animation/animate_decay_tk_blit.txt deleted file mode 100644 index 1fbb9704ebd..00000000000 --- a/_sources/examples/old_animation/animate_decay_tk_blit.txt +++ /dev/null @@ -1,70 +0,0 @@ -.. _old_animation-animate_decay_tk_blit: - -old_animation example code: animate_decay_tk_blit.py -==================================================== - -[`source code `_] - -:: - - from __future__ import print_function - import time, sys - import numpy as np - import matplotlib.pyplot as plt - - - def data_gen(): - t = data_gen.t - data_gen.t += 0.05 - return np.sin(2*np.pi*t) * np.exp(-t/10.) - data_gen.t = 0 - - fig, ax = plt.subplots() - line, = ax.plot([], [], animated=True, lw=2) - ax.set_ylim(-1.1, 1.1) - ax.set_xlim(0, 5) - ax.grid() - xdata, ydata = [], [] - def run(*args): - background = fig.canvas.copy_from_bbox(ax.bbox) - # for profiling - tstart = time.time() - - while 1: - # restore the clean slate background - fig.canvas.restore_region(background) - # update the data - t = data_gen.t - y = data_gen() - xdata.append(t) - ydata.append(y) - xmin, xmax = ax.get_xlim() - if t>=xmax: - ax.set_xlim(xmin, 2*xmax) - fig.canvas.draw() - background = fig.canvas.copy_from_bbox(ax.bbox) - - line.set_data(xdata, ydata) - - # just draw the animated artist - ax.draw_artist(line) - # just redraw the axes rectangle - fig.canvas.blit(ax.bbox) - - if run.cnt==1000: - # print the timing info and quit - print('FPS:' , 1000/(time.time()-tstart)) - sys.exit() - - run.cnt += 1 - run.cnt = 0 - - - - manager = plt.get_current_fig_manager() - manager.window.after(100, run) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/old_animation/animation_blit_fltk.txt b/_sources/examples/old_animation/animation_blit_fltk.txt deleted file mode 100644 index 10a1b02f2a3..00000000000 --- a/_sources/examples/old_animation/animation_blit_fltk.txt +++ /dev/null @@ -1,67 +0,0 @@ -.. _old_animation-animation_blit_fltk: - -old_animation example code: animation_blit_fltk.py -================================================== - -[`source code `_] - -:: - - from __future__ import print_function - import sys - import fltk - import matplotlib - matplotlib.use('FltkAgg') - import pylab as p - import numpy as npy - import time - - - # save the clean slate background -- everything but the animated line - # is drawn and saved in the pixel buffer background - class animator: - def __init__(self,ax): - self.ax=ax - self.canvas=ax.figure.canvas - self.canvas.mpl_connect('draw_event',self.clear) - self.cnt=0 - self.background=None - - # for profiling - self.tstart = time.time() - - def clear(self,event): - self.background = self.canvas.copy_from_bbox(self.ax.bbox) - - def update(self,ptr): - # restore the clean slate background - if self.background is None: - self.background = self.canvas.copy_from_bbox(self.ax.bbox) - self.canvas.restore_region(self.background) - # update the data - line.set_ydata(npy.sin(x+self.cnt/10.0)) - # just draw the animated artist - self.ax.draw_artist(line) - # just redraw the axes rectangle - self.canvas.blit(ax.bbox) - self.cnt+=1 - if self.cnt==1000: - # print the timing info and quit - print('FPS:' , 1000/(time.time()-self.tstart)) - sys.exit() - return True - - ax = p.subplot(111) - p.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs - p.grid() # to ensure proper background restore - # create the initial line - x = npy.arange(0,2*npy.pi,0.01) - line, = p.plot(x, npy.sin(x), animated=True) - p.draw() - anim=animator(ax) - - fltk.Fl.add_idle(anim.update) - fltk.Fl.run() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/old_animation/animation_blit_gtk.txt b/_sources/examples/old_animation/animation_blit_gtk.txt deleted file mode 100644 index fcdaed6a1df..00000000000 --- a/_sources/examples/old_animation/animation_blit_gtk.txt +++ /dev/null @@ -1,81 +0,0 @@ -.. _old_animation-animation_blit_gtk: - -old_animation example code: animation_blit_gtk.py -================================================= - -[`source code `_] - -:: - - #!/usr/bin/env python - - from __future__ import print_function - - # For detailed comments on animation and the techniques used here, see - # the wiki entry - # http://www.scipy.org/wikis/topical_software/MatplotlibAnimation - import time - - import gtk, gobject - - import matplotlib - matplotlib.use('GTKAgg') - - import numpy as np - import matplotlib.pyplot as plt - - - fig, ax = plt.subplots() - canvas = fig.canvas - - fig.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs - ax.grid() # to ensure proper background restore - - # create the initial line - x = np.arange(0,2*np.pi,0.01) - line, = ax.plot(x, np.sin(x), animated=True, lw=2) - canvas.draw() - - # for profiling - tstart = time.time() - - def update_line(*args): - print('you are here', update_line.cnt) - if update_line.background is None: - update_line.background = canvas.copy_from_bbox(ax.bbox) - - # restore the clean slate background - canvas.restore_region(update_line.background) - # update the data - line.set_ydata(np.sin(x+update_line.cnt/10.0)) - # just draw the animated artist - ax.draw_artist(line) - - # just redraw the axes rectangle - canvas.blit(ax.bbox) - - if update_line.cnt==1000: - # print the timing info and quit - print('FPS:' , 1000/(time.time()-tstart)) - gtk.mainquit() - raise SystemExit - - update_line.cnt += 1 - return True - - update_line.cnt = 0 - update_line.background = None - - - def start_anim(event): - gobject.idle_add(update_line) - canvas.mpl_disconnect(start_anim.cid) - - start_anim.cid = canvas.mpl_connect('draw_event', start_anim) - - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/old_animation/animation_blit_gtk2.txt b/_sources/examples/old_animation/animation_blit_gtk2.txt deleted file mode 100644 index 1c06db9619a..00000000000 --- a/_sources/examples/old_animation/animation_blit_gtk2.txt +++ /dev/null @@ -1,180 +0,0 @@ -.. _old_animation-animation_blit_gtk2: - -old_animation example code: animation_blit_gtk2.py -================================================== - -[`source code `_] - -:: - - #!/usr/bin/env python - - from __future__ import print_function - - """ - This example utlizes restore_region with optional bbox and xy - arguments. The plot is continuously shifted to the left. Instead of - drawing everything again, the plot is saved (copy_from_bbox) and - restored with offset by the amount of the shift. And only newly - exposed area is drawn. This technique may reduce drawing time for some cases. - """ - - import time - - import gtk, gobject - - import matplotlib - matplotlib.use('GTKAgg') - - import numpy as np - import matplotlib.pyplot as plt - - class UpdateLine(object): - def get_bg_bbox(self): - - return self.ax.bbox.padded(-3) - - def __init__(self, canvas, ax): - self.cnt = 0 - self.canvas = canvas - self.ax = ax - - self.prev_time = time.time() - self.start_time = self.prev_time - self.prev_pixel_offset = 0. - - - self.x0 = 0 - self.phases = np.random.random_sample((20,)) * np.pi * 2 - self.line, = ax.plot([], [], "-", animated=True, lw=2) - - self.point, = ax.plot([], [], "ro", animated=True, lw=2) - - self.ax.set_ylim(-1.1, 1.1) - - self.background1 = None - - cmap = plt.cm.jet - from itertools import cycle - self.color_cycle = cycle(cmap(np.arange(cmap.N))) - - - def save_bg(self): - self.background1 = self.canvas.copy_from_bbox(self.ax.get_figure().bbox) - - self.background2 = self.canvas.copy_from_bbox(self.get_bg_bbox()) - - - def get_dx_data(self, dx_pixel): - tp = self.ax.transData.inverted().transform_point - x0, y0 = tp((0, 0)) - x1, y1 = tp((dx_pixel, 0)) - return (x1-x0) - - - def restore_background_shifted(self, dx_pixel): - """ - restore bacground shifted by dx in data coordinate. This only - works if the data coordinate system is linear. - """ - - # restore the clean slate background - self.canvas.restore_region(self.background1) - - # restore subregion (x1+dx, y1, x2, y2) of the second bg - # in a offset position (x1-dx, y1) - x1, y1, x2, y2 = self.background2.get_extents() - self.canvas.restore_region(self.background2, - bbox=(x1+dx_pixel, y1, x2, y2), - xy=(x1-dx_pixel, y1)) - - return dx_pixel - - def on_draw(self, *args): - self.save_bg() - return False - - def update_line(self, *args): - - if self.background1 is None: - return True - - cur_time = time.time() - pixel_offset = int((cur_time - self.start_time)*100.) - dx_pixel = pixel_offset - self.prev_pixel_offset - self.prev_pixel_offset = pixel_offset - dx_data = self.get_dx_data(dx_pixel) #cur_time - self.prev_time) - - x0 = self.x0 - self.x0 += dx_data - self.prev_time = cur_time - - self.ax.set_xlim(self.x0-2, self.x0+0.1) - - - # restore background which will plot lines from previous plots - self.restore_background_shifted(dx_pixel) #x0, self.x0) - # This restores lines between [x0-2, x0] - - - - self.line.set_color(self.color_cycle.next()) - - # now plot line segment within [x0, x0+dx_data], - # Note that we're only plotting a line between [x0, x0+dx_data]. - xx = np.array([x0, self.x0]) - self.line.set_xdata(xx) - - # the for loop below could be improved by using collection. - [(self.line.set_ydata(np.sin(xx+p)), - self.ax.draw_artist(self.line)) \ - for p in self.phases] - - self.background2 = canvas.copy_from_bbox(self.get_bg_bbox()) - - self.point.set_xdata([self.x0]) - - [(self.point.set_ydata(np.sin([self.x0+p])), - self.ax.draw_artist(self.point)) \ - for p in self.phases] - - - self.ax.draw_artist(self.ax.xaxis) - self.ax.draw_artist(self.ax.yaxis) - - self.canvas.blit(self.ax.get_figure().bbox) - - - dt = (time.time()-tstart) - if dt>15: - # print the timing info and quit - print('FPS:' , self.cnt/dt) - gtk.main_quit() - raise SystemExit - - self.cnt += 1 - return True - - - plt.rcParams["text.usetex"] = False - - fig, ax = plt.subplots() - ax.xaxis.set_animated(True) - ax.yaxis.set_animated(True) - canvas = fig.canvas - - fig.subplots_adjust(left=0.2, bottom=0.2) - canvas.draw() - - # for profiling - tstart = time.time() - - ul = UpdateLine(canvas, ax) - gobject.idle_add(ul.update_line) - - canvas.mpl_connect('draw_event', ul.on_draw) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/old_animation/animation_blit_qt.txt b/_sources/examples/old_animation/animation_blit_qt.txt deleted file mode 100644 index d67f60bd945..00000000000 --- a/_sources/examples/old_animation/animation_blit_qt.txt +++ /dev/null @@ -1,78 +0,0 @@ -.. _old_animation-animation_blit_qt: - -old_animation example code: animation_blit_qt.py -================================================ - -[`source code `_] - -:: - - # For detailed comments on animation and the techniqes used here, see - # the wiki entry http://www.scipy.org/Cookbook/Matplotlib/Animations - - from __future__ import print_function - - import os, sys - import matplotlib - matplotlib.use('QtAgg') # qt3 example - - from qt import * - # Note: color-intensive applications may require a different color allocation - # strategy. - QApplication.setColorSpec(QApplication.NormalColor) - - TRUE = 1 - FALSE = 0 - ITERS = 1000 - - import pylab as p - import numpy as npy - import time - - class BlitQT(QObject): - def __init__(self): - QObject.__init__(self, None, "app") - - self.ax = p.subplot(111) - self.canvas = self.ax.figure.canvas - self.cnt = 0 - - # create the initial line - self.x = npy.arange(0,2*npy.pi,0.01) - self.line, = p.plot(self.x, npy.sin(self.x), animated=True, lw=2) - - self.background = None - - def timerEvent(self, evt): - if self.background is None: - self.background = self.canvas.copy_from_bbox(self.ax.bbox) - - # restore the clean slate background - self.canvas.restore_region(self.background) - # update the data - self.line.set_ydata(npy.sin(self.x+self.cnt/10.0)) - # just draw the animated artist - self.ax.draw_artist(self.line) - # just redraw the axes rectangle - self.canvas.blit(self.ax.bbox) - - if self.cnt==ITERS: - # print the timing info and quit - print('FPS:', ITERS/(time.time()-self.tstart)) - sys.exit() - - else: - self.cnt += 1 - - p.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs - p.grid() # to ensure proper background restore - - app = BlitQT() - # for profiling - app.tstart = time.time() - app.startTimer(0) - - p.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/old_animation/animation_blit_qt4.txt b/_sources/examples/old_animation/animation_blit_qt4.txt deleted file mode 100644 index 4a1e28df433..00000000000 --- a/_sources/examples/old_animation/animation_blit_qt4.txt +++ /dev/null @@ -1,89 +0,0 @@ -.. _old_animation-animation_blit_qt4: - -old_animation example code: animation_blit_qt4.py -================================================= - -[`source code `_] - -:: - - # For detailed comments on animation and the techniqes used here, see - # the wiki entry http://www.scipy.org/Cookbook/Matplotlib/Animations - - from __future__ import print_function - - import os - import sys - - #import matplotlib - #matplotlib.use('Qt4Agg') - from matplotlib.figure import Figure - from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas - - from PyQt4 import QtCore, QtGui - - ITERS = 1000 - - import numpy as np - import time - - class BlitQT(FigureCanvas): - - def __init__(self): - FigureCanvas.__init__(self, Figure()) - - self.ax = self.figure.add_subplot(111) - self.ax.grid() - self.draw() - - self.old_size = self.ax.bbox.width, self.ax.bbox.height - self.ax_background = self.copy_from_bbox(self.ax.bbox) - self.cnt = 0 - - self.x = np.arange(0,2*np.pi,0.01) - self.sin_line, = self.ax.plot(self.x, np.sin(self.x), animated=True) - self.cos_line, = self.ax.plot(self.x, np.cos(self.x), animated=True) - self.draw() - - self.tstart = time.time() - self.startTimer(10) - - def timerEvent(self, evt): - current_size = self.ax.bbox.width, self.ax.bbox.height - if self.old_size != current_size: - self.old_size = current_size - self.ax.clear() - self.ax.grid() - self.draw() - self.ax_background = self.copy_from_bbox(self.ax.bbox) - - self.restore_region(self.ax_background) - - # update the data - self.sin_line.set_ydata(np.sin(self.x+self.cnt/10.0)) - self.cos_line.set_ydata(np.cos(self.x+self.cnt/10.0)) - # just draw the animated artist - self.ax.draw_artist(self.sin_line) - self.ax.draw_artist(self.cos_line) - # just redraw the axes rectangle - self.blit(self.ax.bbox) - - if self.cnt == 0: - # TODO: this shouldn't be necessary, but if it is excluded the - # canvas outside the axes is not initially painted. - self.draw() - if self.cnt==ITERS: - # print the timing info and quit - print('FPS:' , ITERS/(time.time()-self.tstart)) - sys.exit() - else: - self.cnt += 1 - - app = QtGui.QApplication(sys.argv) - widget = BlitQT() - widget.show() - - sys.exit(app.exec_()) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/old_animation/animation_blit_tk.txt b/_sources/examples/old_animation/animation_blit_tk.txt deleted file mode 100644 index 4259a44b8ad..00000000000 --- a/_sources/examples/old_animation/animation_blit_tk.txt +++ /dev/null @@ -1,66 +0,0 @@ -.. _old_animation-animation_blit_tk: - -old_animation example code: animation_blit_tk.py -================================================ - -[`source code `_] - -:: - - # For detailed comments on animation and the techniqes used here, see - # the wiki entry http://www.scipy.org/Cookbook/Matplotlib/Animations - - from __future__ import print_function - - import matplotlib - matplotlib.use('TkAgg') - - import sys - import matplotlib.pyplot as plt - import numpy as npy - import time - - fig, ax = plt.subplots() - canvas = fig.canvas - - - # create the initial line - x = npy.arange(0,2*npy.pi,0.01) - line, = plt.plot(x, npy.sin(x), animated=True, lw=2) - - def run(*args): - background = canvas.copy_from_bbox(ax.bbox) - # for profiling - tstart = time.time() - - while 1: - # restore the clean slate background - canvas.restore_region(background) - # update the data - line.set_ydata(npy.sin(x+run.cnt/10.0)) - # just draw the animated artist - ax.draw_artist(line) - # just redraw the axes rectangle - canvas.blit(ax.bbox) - - if run.cnt==1000: - # print the timing info and quit - print('FPS:', 1000/(time.time()-tstart)) - sys.exit() - - run.cnt += 1 - run.cnt = 0 - - - plt.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs - plt.grid() # to ensure proper background restore - manager = plt.get_current_fig_manager() - manager.window.after(100, run) - - plt.show() - - - - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/old_animation/animation_blit_wx.txt b/_sources/examples/old_animation/animation_blit_wx.txt deleted file mode 100644 index bfb334cda9f..00000000000 --- a/_sources/examples/old_animation/animation_blit_wx.txt +++ /dev/null @@ -1,91 +0,0 @@ -.. _old_animation-animation_blit_wx: - -old_animation example code: animation_blit_wx.py -================================================ - -[`source code `_] - -:: - - # For detailed comments on animation and the techniqes used here, see - # the wiki entry - # http://www.scipy.org/wikis/topical_software/MatplotlibAnimation - - from __future__ import print_function - - # The number of blits() to make before exiting - NBLITS = 1000 - - import matplotlib - matplotlib.use('WXAgg') - matplotlib.rcParams['toolbar'] = 'None' - import matplotlib.pyplot as plt - - import wx - import sys - import pylab as p - import numpy as npy - import time - - - # allow the user to disable the WXAgg accelerator from the command line - if '--no-accel' in sys.argv: - import matplotlib.backends.backend_wxagg - matplotlib.backends.backend_wxagg._use_accelerator(False) - - - fig, ax = plt.subplots() - canvas = fig.canvas - - - p.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs - p.grid() # to ensure proper background restore - - # create the initial line - x = npy.arange(0,2*npy.pi,0.01) - line, = p.plot(x, npy.sin(x), animated=True, lw=2) - - # for profiling - tstart = time.time() - blit_time = 0.0 - - def update_line(*args): - global blit_time - - if update_line.background is None: - update_line.background = canvas.copy_from_bbox(ax.bbox) - - # restore the clean slate background - canvas.restore_region(update_line.background) - # update the data - line.set_ydata(npy.sin(x+update_line.cnt/10.0)) - # just draw the animated artist - ax.draw_artist(line) - # just redraw the axes rectangle - - t = time.time() - canvas.blit(ax.bbox) - blit_time += time.time() - t - - if update_line.cnt == NBLITS: - # print the timing info and quit - frame_time = time.time() - tstart - print('%d frames: %.2f seconds' % (NBLITS, frame_time)) - print('%d blits: %.2f seconds' % (NBLITS, blit_time)) - print() - print('FPS: %.2f' % (NBLITS/frame_time)) - print('BPS: %.2f' % (NBLITS/blit_time)) - sys.exit() - - update_line.cnt += 1 - wx.WakeUpIdle() - - - - update_line.cnt = 0 - update_line.background = None - wx.EVT_IDLE(wx.GetApp(), update_line) - p.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/old_animation/draggable_legend.txt b/_sources/examples/old_animation/draggable_legend.txt deleted file mode 100644 index 16f1ae9c55f..00000000000 --- a/_sources/examples/old_animation/draggable_legend.txt +++ /dev/null @@ -1,54 +0,0 @@ -.. _old_animation-draggable_legend: - -old_animation example code: draggable_legend.py -=============================================== - -[`source code `_] - -:: - - import matplotlib.pyplot as plt - - fig, ax = plt.subplots() - ax.plot([1,2,3], label="test") - - l = ax.legend() - d1 = l.draggable() - - xy = 1, 2 - txt = ax.annotate("Test", xy, xytext=(-30, 30), - textcoords="offset points", - bbox=dict(boxstyle="round",fc=(0.2, 1, 1)), - arrowprops=dict(arrowstyle="->")) - d2 = txt.draggable() - - - from matplotlib._png import read_png - from matplotlib.cbook import get_sample_data - - from matplotlib.offsetbox import OffsetImage, AnnotationBbox - - fn = get_sample_data("ada.png", asfileobj=False) - arr_ada = read_png(fn) - - imagebox = OffsetImage(arr_ada, zoom=0.2) - - ab = AnnotationBbox(imagebox, xy, - xybox=(120., -80.), - xycoords='data', - boxcoords="offset points", - pad=0.5, - arrowprops=dict(arrowstyle="->", - connectionstyle="angle,angleA=0,angleB=90,rad=3") - ) - - - ax.add_artist(ab) - - d3 = ab.draggable(use_blit=True) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/old_animation/dynamic_collection.txt b/_sources/examples/old_animation/dynamic_collection.txt deleted file mode 100644 index 102f08873d5..00000000000 --- a/_sources/examples/old_animation/dynamic_collection.txt +++ /dev/null @@ -1,64 +0,0 @@ -.. _old_animation-dynamic_collection: - -old_animation example code: dynamic_collection.py -================================================= - -[`source code `_] - -:: - - import random - from matplotlib.collections import RegularPolyCollection - import matplotlib.cm as cm - from matplotlib.pyplot import figure, show - from numpy.random import rand - - fig = figure() - ax = fig.add_subplot(111, xlim=(0,1), ylim=(0,1), autoscale_on=False) - ax.set_title("Press 'a' to add a point, 'd' to delete one") - # a single point - offsets = [(0.5,0.5)] - facecolors = [cm.jet(0.5)] - - collection = RegularPolyCollection( - #fig.dpi, - 5, # a pentagon - rotation=0, - sizes=(50,), - facecolors = facecolors, - edgecolors = 'black', - linewidths = (1,), - offsets = offsets, - transOffset = ax.transData, - ) - - ax.add_collection(collection) - - def onpress(event): - """ - press 'a' to add a random point from the collection, 'd' to delete one - """ - if event.key=='a': - x,y = rand(2) - color = cm.jet(rand()) - offsets.append((x,y)) - facecolors.append(color) - collection.set_offsets(offsets) - collection.set_facecolors(facecolors) - fig.canvas.draw() - elif event.key=='d': - N = len(offsets) - if N>0: - ind = random.randint(0,N-1) - offsets.pop(ind) - facecolors.pop(ind) - collection.set_offsets(offsets) - collection.set_facecolors(facecolors) - fig.canvas.draw() - - fig.canvas.mpl_connect('key_press_event', onpress) - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/old_animation/dynamic_image_gtkagg.txt b/_sources/examples/old_animation/dynamic_image_gtkagg.txt deleted file mode 100644 index 07775c7fe68..00000000000 --- a/_sources/examples/old_animation/dynamic_image_gtkagg.txt +++ /dev/null @@ -1,58 +0,0 @@ -.. _old_animation-dynamic_image_gtkagg: - -old_animation example code: dynamic_image_gtkagg.py -=================================================== - -[`source code `_] - -:: - - #!/usr/bin/env python - - from __future__ import print_function - """ - An animated image - """ - import time - - import gobject - import gtk - - import matplotlib - matplotlib.use('GTKAgg') - - from pylab import * - - fig = figure(1) - a = subplot(111) - x = arange(120.0)*2*pi/120.0 - x = resize(x, (100,120)) - y = arange(100.0)*2*pi/100.0 - y = resize(y, (120,100)) - y = transpose(y) - z = sin(x) + cos(y) - im = a.imshow( z, cmap=cm.jet)#, interpolation='nearest') - - manager = get_current_fig_manager() - cnt = 0 - tstart = time.time() - def updatefig(*args): - global x, y, cnt, start - x += pi/15 - y += pi/20 - z = sin(x) + cos(y) - im.set_array(z) - manager.canvas.draw() - cnt += 1 - if cnt==50: - print('FPS', cnt/(time.time() - tstart)) - return False - return True - - cnt = 0 - - gobject.idle_add(updatefig) - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/old_animation/dynamic_image_wxagg2.txt b/_sources/examples/old_animation/dynamic_image_wxagg2.txt deleted file mode 100644 index 90ef7d4b783..00000000000 --- a/_sources/examples/old_animation/dynamic_image_wxagg2.txt +++ /dev/null @@ -1,112 +0,0 @@ -.. _old_animation-dynamic_image_wxagg2: - -old_animation example code: dynamic_image_wxagg2.py -=================================================== - -[`source code `_] - -:: - - #!/usr/bin/env python - """ - Copyright (C) 2003-2005 Jeremy O'Donoghue and others - - License: This work is licensed under the PSF. A copy should be included - with this source code, and is also available at - http://www.python.org/psf/license.html - - """ - import sys, time, os, gc - - import matplotlib - matplotlib.use('WXAgg') - - from matplotlib import rcParams - import numpy as npy - - import matplotlib.cm as cm - - from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg - from matplotlib.backends.backend_wx import NavigationToolbar2Wx - - from matplotlib.figure import Figure - from wx import * - - - TIMER_ID = NewId() - - class PlotFigure(Frame): - - def __init__(self): - Frame.__init__(self, None, -1, "Test embedded wxFigure") - - self.fig = Figure((5,4), 75) - self.canvas = FigureCanvasWxAgg(self, -1, self.fig) - self.toolbar = NavigationToolbar2Wx(self.canvas) - self.toolbar.Realize() - - # On Windows, default frame size behaviour is incorrect - # you don't need this under Linux - tw, th = self.toolbar.GetSizeTuple() - fw, fh = self.canvas.GetSizeTuple() - self.toolbar.SetSize(Size(fw, th)) - - # Create a figure manager to manage things - - # Now put all into a sizer - sizer = BoxSizer(VERTICAL) - # This way of adding to sizer allows resizing - sizer.Add(self.canvas, 1, LEFT|TOP|GROW) - # Best to allow the toolbar to resize! - sizer.Add(self.toolbar, 0, GROW) - self.SetSizer(sizer) - self.Fit() - EVT_TIMER(self, TIMER_ID, self.onTimer) - - def init_plot_data(self): - # jdh you can add a subplot directly from the fig rather than - # the fig manager - a = self.fig.add_axes([0.075,0.1,0.75,0.85]) - cax = self.fig.add_axes([0.85,0.1,0.075,0.85]) - self.x = npy.empty((120,120)) - self.x.flat = npy.arange(120.0)*2*npy.pi/120.0 - self.y = npy.empty((120,120)) - self.y.flat = npy.arange(120.0)*2*npy.pi/100.0 - self.y = npy.transpose(self.y) - z = npy.sin(self.x) + npy.cos(self.y) - self.im = a.imshow( z, cmap=cm.jet)#, interpolation='nearest') - self.fig.colorbar(self.im,cax=cax,orientation='vertical') - - def GetToolBar(self): - # You will need to override GetToolBar if you are using an - # unmanaged toolbar in your frame - return self.toolbar - - def onTimer(self, evt): - self.x += npy.pi/15 - self.y += npy.pi/20 - z = npy.sin(self.x) + npy.cos(self.y) - self.im.set_array(z) - self.canvas.draw() - #self.canvas.gui_repaint() # jdh wxagg_draw calls this already - - def onEraseBackground(self, evt): - # this is supposed to prevent redraw flicker on some X servers... - pass - - if __name__ == '__main__': - app = PySimpleApp() - frame = PlotFigure() - frame.init_plot_data() - - # Initialise the timer - wxPython requires this to be connected to - # the receiving event handler - t = Timer(frame, TIMER_ID) - t.Start(200) - - frame.Show() - app.MainLoop() - - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/old_animation/gtk_timeout.txt b/_sources/examples/old_animation/gtk_timeout.txt deleted file mode 100644 index 85f3d842591..00000000000 --- a/_sources/examples/old_animation/gtk_timeout.txt +++ /dev/null @@ -1,30 +0,0 @@ -.. _old_animation-gtk_timeout: - -old_animation example code: gtk_timeout.py -========================================== - -[`source code `_] - -:: - - import gobject - import numpy as np - import matplotlib - matplotlib.use('GTKAgg') - - import matplotlib.pyplot as plt - - fig, ax = plt.subplots() - line, = ax.plot(np.random.rand(10)) - ax.set_ylim(0, 1) - - def update(): - line.set_ydata(np.random.rand(10)) - fig.canvas.draw_idle() - return True # return False to terminate the updates - - gobject.timeout_add(100, update) # you can also use idle_add to update when gtk is idle - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/old_animation/histogram_tkagg.txt b/_sources/examples/old_animation/histogram_tkagg.txt deleted file mode 100644 index 657fbb7b58b..00000000000 --- a/_sources/examples/old_animation/histogram_tkagg.txt +++ /dev/null @@ -1,80 +0,0 @@ -.. _old_animation-histogram_tkagg: - -old_animation example code: histogram_tkagg.py -============================================== - -[`source code `_] - -:: - - """ - This example shows how to use a path patch to draw a bunch of - rectangles for an animated histogram - """ - import numpy as np - import matplotlib - matplotlib.use('TkAgg') # do this before importing pylab - - import matplotlib.pyplot as plt - import matplotlib.patches as patches - import matplotlib.path as path - - fig, ax = plt.subplots() - - # histogram our data with numpy - data = np.random.randn(1000) - n, bins = np.histogram(data, 100) - - # get the corners of the rectangles for the histogram - left = np.array(bins[:-1]) - right = np.array(bins[1:]) - bottom = np.zeros(len(left)) - top = bottom + n - nrects = len(left) - - # here comes the tricky part -- we have to set up the vertex and path - # codes arrays using moveto, lineto and closepoly - - # for each rect: 1 for the MOVETO, 3 for the LINETO, 1 for the - # CLOSEPOLY; the vert for the closepoly is ignored but we still need - # it to keep the codes aligned with the vertices - nverts = nrects*(1+3+1) - verts = np.zeros((nverts, 2)) - codes = np.ones(nverts, int) * path.Path.LINETO - codes[0::5] = path.Path.MOVETO - codes[4::5] = path.Path.CLOSEPOLY - verts[0::5,0] = left - verts[0::5,1] = bottom - verts[1::5,0] = left - verts[1::5,1] = top - verts[2::5,0] = right - verts[2::5,1] = top - verts[3::5,0] = right - verts[3::5,1] = bottom - - barpath = path.Path(verts, codes) - patch = patches.PathPatch(barpath, facecolor='green', edgecolor='yellow', alpha=0.5) - ax.add_patch(patch) - - ax.set_xlim(left[0], right[-1]) - ax.set_ylim(bottom.min(), top.max()) - - def animate(): - if animate.cnt>=100: - return - - animate.cnt += 1 - # simulate new data coming in - data = np.random.randn(1000) - n, bins = np.histogram(data, 100) - top = bottom + n - verts[1::5,1] = top - verts[2::5,1] = top - fig.canvas.draw() - fig.canvas.manager.window.after(100, animate) - animate.cnt = 0 - fig.canvas.manager.window.after(100, animate) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/old_animation/index.txt b/_sources/examples/old_animation/index.txt deleted file mode 100644 index dd00950116e..00000000000 --- a/_sources/examples/old_animation/index.txt +++ /dev/null @@ -1,32 +0,0 @@ -.. _old_animation-examples-index: - -############################################## -old_animation Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - animate_decay_tk_blit - animation_blit_gtk - animation_blit_gtk2 - animation_blit_qt4 - animation_blit_tk - animation_blit_wx - draggable_legend - dynamic_collection - dynamic_image_gtkagg - dynamic_image_wxagg2 - gtk_timeout - histogram_tkagg - movie_demo - simple_anim_gtk - simple_anim_tkagg - simple_idle_wx - simple_timer_wx - strip_chart_demo diff --git a/_sources/examples/old_animation/movie_demo.txt b/_sources/examples/old_animation/movie_demo.txt deleted file mode 100644 index a02e72f7b75..00000000000 --- a/_sources/examples/old_animation/movie_demo.txt +++ /dev/null @@ -1,170 +0,0 @@ -.. _old_animation-movie_demo: - -old_animation example code: movie_demo.py -========================================= - -[`source code `_] - -:: - - #!/usr/bin/python - # - # Josh Lifton 2004 - # - # Permission is hereby granted to use and abuse this document - # so long as proper attribution is given. - # - # This Python script demonstrates how to use the numarray package - # to generate and handle large arrays of data and how to use the - # matplotlib package to generate plots from the data and then save - # those plots as images. These images are then stitched together - # by Mencoder to create a movie of the plotted data. This script - # is for demonstration purposes only and is not intended to be - # for general use. In particular, you will likely need to modify - # the script to suit your own needs. - # - - from __future__ import print_function - - import matplotlib - matplotlib.use('Agg') - import matplotlib.pyplot as plt # For plotting graphs. - import numpy as np - import subprocess # For issuing commands to the OS. - import os - import sys # For determining the Python version. - - # - # Print the version information for the machine, OS, - # Python interpreter, and matplotlib. The version of - # Mencoder is printed when it is called. - # - print('Executing on', os.uname()) - print('Python version', sys.version) - print('matplotlib version', matplotlib.__version__) - - not_found_msg = """ - The mencoder command was not found; - mencoder is used by this script to make an avi file from a set of pngs. - It is typically not installed by default on linux distros because of - legal restrictions, but it is widely available. - """ - - try: - subprocess.check_call(['mencoder']) - except subprocess.CalledProcessError: - print("mencoder command was found") - pass # mencoder is found, but returns non-zero exit as expected - # This is a quick and dirty check; it leaves some spurious output - # for the user to puzzle over. - except OSError: - print(not_found_msg) - sys.exit("quitting\n") - - - # - # First, let's create some data to work with. In this example - # we'll use a normalized Gaussian waveform whose mean and - # standard deviation both increase linearly with time. Such a - # waveform can be thought of as a propagating system that loses - # coherence over time, as might happen to the probability - # distribution of a clock subjected to independent, identically - # distributed Gaussian noise at each time step. - # - - print('Initializing data set...') # Let the user know what's happening. - - # Initialize variables needed to create and store the example data set. - numberOfTimeSteps = 100 # Number of frames we want in the movie. - x = np.arange(-10,10,0.01) # Values to be plotted on the x-axis. - mean = -6 # Initial mean of the Gaussian. - stddev = 0.2 # Initial standard deviation. - meaninc = 0.1 # Mean increment. - stddevinc = 0.1 # Standard deviation increment. - - # Create an array of zeros and fill it with the example data. - y = np.zeros((numberOfTimeSteps,len(x)), float) - for i in range(numberOfTimeSteps) : - y[i] = (1/np.sqrt(2*np.pi*stddev))*np.exp(-((x-mean)**2)/(2*stddev)) - mean = mean + meaninc - stddev = stddev + stddevinc - - print('Done.') # Let the user know what's happening. - - # - # Now that we have an example data set (x,y) to work with, we can - # start graphing it and saving the images. - # - - for i in range(len(y)) : - # - # The next four lines are just like MATLAB. - # - plt.plot(x,y[i],'b.') - plt.axis((x[0],x[-1],-0.25,1)) - plt.xlabel('time (ms)') - plt.ylabel('probability density function') - - # - # Notice the use of LaTeX-like markup. - # - plt.title(r'$\cal{N}(\mu, \sigma^2)$', fontsize=20) - - # - # The file name indicates how the image will be saved and the - # order it will appear in the movie. If you actually wanted each - # graph to be displayed on the screen, you would include commands - # such as show() and draw() here. See the matplotlib - # documentation for details. In this case, we are saving the - # images directly to a file without displaying them. - # - filename = str('%03d' % i) + '.png' - plt.savefig(filename, dpi=100) - - # - # Let the user know what's happening. - # - print('Wrote file', filename) - - # - # Clear the figure to make way for the next image. - # - plt.clf() - - # - # Now that we have graphed images of the dataset, we will stitch them - # together using Mencoder to create a movie. Each image will become - # a single frame in the movie. - # - # We want to use Python to make what would normally be a command line - # call to Mencoder. Specifically, the command line call we want to - # emulate is (without the initial '#'): - # mencoder mf://*.png -mf type=png:w=800:h=600:fps=25 -ovc lavc -lavcopts vcodec=mpeg4 -oac copy -o output.avi - # See the MPlayer and Mencoder documentation for details. - # - - command = ('mencoder', - 'mf://*.png', - '-mf', - 'type=png:w=800:h=600:fps=25', - '-ovc', - 'lavc', - '-lavcopts', - 'vcodec=mpeg4', - '-oac', - 'copy', - '-o', - 'output.avi') - - #os.spawnvp(os.P_WAIT, 'mencoder', command) - - print("\n\nabout to execute:\n%s\n\n" % ' '.join(command)) - subprocess.check_call(command) - - print("\n\n The movie was written to 'output.avi'") - - print("\n\n You may want to delete *.png now.\n\n") - - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/old_animation/simple_anim_gtk.txt b/_sources/examples/old_animation/simple_anim_gtk.txt deleted file mode 100644 index 868ca8a672b..00000000000 --- a/_sources/examples/old_animation/simple_anim_gtk.txt +++ /dev/null @@ -1,41 +0,0 @@ -.. _old_animation-simple_anim_gtk: - -old_animation example code: simple_anim_gtk.py -============================================== - -[`source code `_] - -:: - - """ - A simple example of an animated plot using a gtk backend - """ - from __future__ import print_function - import time - import numpy as np - import matplotlib - matplotlib.use('GTKAgg') # do this before importing pylab - - import matplotlib.pyplot as plt - - fig, ax = plt.subplots() - - def animate(): - tstart = time.time() # for profiling - x = np.arange(0, 2*np.pi, 0.01) # x-array - line, = ax.plot(x, np.sin(x)) - - for i in np.arange(1,200): - line.set_ydata(np.sin(x+i/10.0)) # update the data - fig.canvas.draw() # redraw the canvas - print('FPS:' , 200/(time.time()-tstart)) - raise SystemExit - - import gobject - print('adding idle') - gobject.idle_add(animate) - print('showing') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/old_animation/simple_anim_tkagg.txt b/_sources/examples/old_animation/simple_anim_tkagg.txt deleted file mode 100644 index 1f72c93866b..00000000000 --- a/_sources/examples/old_animation/simple_anim_tkagg.txt +++ /dev/null @@ -1,39 +0,0 @@ -.. _old_animation-simple_anim_tkagg: - -old_animation example code: simple_anim_tkagg.py -================================================ - -[`source code `_] - -:: - - #!/usr/bin/env python - - """ - A simple example of an animated plot in tkagg - """ - from __future__ import print_function - import time - import numpy as np - import matplotlib - matplotlib.use('TkAgg') # do this before importing pylab - - import matplotlib.pyplot as plt - fig, ax = plt.subplots() - - def animate(): - tstart = time.time() # for profiling - x = np.arange(0, 2*np.pi, 0.01) # x-array - line, = ax.plot(x, np.sin(x)) - - for i in np.arange(1,200): - line.set_ydata(np.sin(x+i/10.0)) # update the data - fig.canvas.draw() # redraw the canvas - print('FPS:' , 200/(time.time()-tstart)) - - win = fig.canvas.manager.window - fig.canvas.manager.window.after(100, animate) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/old_animation/simple_idle_wx.txt b/_sources/examples/old_animation/simple_idle_wx.txt deleted file mode 100644 index 6d0d7c21dc2..00000000000 --- a/_sources/examples/old_animation/simple_idle_wx.txt +++ /dev/null @@ -1,39 +0,0 @@ -.. _old_animation-simple_idle_wx: - -old_animation example code: simple_idle_wx.py -============================================= - -[`source code `_] - -:: - - """ - A simple example of an animated plot using a wx backend - """ - from __future__ import print_function - import numpy as np - import matplotlib - matplotlib.use('WXAgg') # do this before importing pylab - - import matplotlib.pyplot as plt - - fig, ax = plt.subplots() - t = np.arange(0, 2*np.pi, 0.1) - line, = ax.plot(t, np.sin(t)) - dt = 0.05 - - def update_line(idleevent): - if update_line.i==200: - return False - print('animate', update_line.i) - line.set_ydata(np.sin(t+update_line.i/10.)) - fig.canvas.draw_idle() # redraw the canvas - update_line.i += 1 - update_line.i = 0 - - import wx - wx.EVT_IDLE(wx.GetApp(), update_line) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/old_animation/simple_timer_wx.txt b/_sources/examples/old_animation/simple_timer_wx.txt deleted file mode 100644 index f07d02a1b4f..00000000000 --- a/_sources/examples/old_animation/simple_timer_wx.txt +++ /dev/null @@ -1,46 +0,0 @@ -.. _old_animation-simple_timer_wx: - -old_animation example code: simple_timer_wx.py -============================================== - -[`source code `_] - -:: - - from __future__ import print_function - """ - A simple example of an animated plot using a wx backend - """ - import numpy as np - import matplotlib - matplotlib.use('WXAgg') # do this before importing pylab - - import matplotlib.pyplot as plt - - fig, ax = plt.subplots() - t = np.arange(0, 2*np.pi, 0.1) - line, = ax.plot(t, np.sin(t)) - dt = 0.05 - - - def update_line(event): - if update_line.i==200: - return False - print('update', update_line.i) - line.set_ydata(np.sin(t+update_line.i/10.)) - fig.canvas.draw() # redraw the canvas - update_line.i += 1 - update_line.i = 0 - - import wx - id = wx.NewId() - actor = fig.canvas.manager.frame - timer = wx.Timer(actor, id=id) - timer.Start(100) - wx.EVT_TIMER(actor, id, update_line) - #actor.Bind(wx.EVT_TIMER, update_line, id=id) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/old_animation/strip_chart_demo.txt b/_sources/examples/old_animation/strip_chart_demo.txt deleted file mode 100644 index ae23a77acf2..00000000000 --- a/_sources/examples/old_animation/strip_chart_demo.txt +++ /dev/null @@ -1,82 +0,0 @@ -.. _old_animation-strip_chart_demo: - -old_animation example code: strip_chart_demo.py -=============================================== - -[`source code `_] - -:: - - """ - Emulate an oscilloscope. Requires the animation API introduced in - matplotlib 0.84. See - http://www.scipy.org/wikis/topical_software/Animations for an - explanation. - - This example uses gtk but does not depend on it intimately. It just - uses the idle handler to trigger events. You can plug this into a - different GUI that supports animation (GTKAgg, TkAgg, WXAgg) and use - your toolkits idle/timer functions. - """ - import gobject - import matplotlib - matplotlib.use('GTKAgg') - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.lines import Line2D - - - class Scope: - def __init__(self, ax, maxt=10, dt=0.01): - self.ax = ax - self.canvas = ax.figure.canvas - self.dt = dt - self.maxt = maxt - self.tdata = [0] - self.ydata = [0] - self.line = Line2D(self.tdata, self.ydata, animated=True) - self.ax.add_line(self.line) - self.background = None - self.canvas.mpl_connect('draw_event', self.update_background) - self.ax.set_ylim(-.1, 1.1) - self.ax.set_xlim(0, self.maxt) - - def update_background(self, event): - self.background = self.canvas.copy_from_bbox(self.ax.bbox) - - def emitter(self, p=0.01): - 'return a random value with probability p, else 0' - v = np.random.rand(1) - if v>p: return 0. - else: return np.random.rand(1) - - def update(self, *args): - if self.background is None: return True - y = self.emitter() - lastt = self.tdata[-1] - if lastt>self.tdata[0]+self.maxt: # reset the arrays - self.tdata = [self.tdata[-1]] - self.ydata = [self.ydata[-1]] - self.ax.set_xlim(self.tdata[0], self.tdata[0]+self.maxt) - self.ax.figure.canvas.draw() - - self.canvas.restore_region(self.background) - - t = self.tdata[-1] + self.dt - self.tdata.append(t) - self.ydata.append(y) - self.line.set_data(self.tdata, self.ydata) - self.ax.draw_artist(self.line) - - self.canvas.blit(self.ax.bbox) - return True - - - fig, ax = plt.subplots() - scope = Scope(ax) - gobject.idle_add(scope.update) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pie_and_polar_charts/index.rst.txt b/_sources/examples/pie_and_polar_charts/index.rst.txt deleted file mode 100644 index 4f67152315e..00000000000 --- a/_sources/examples/pie_and_polar_charts/index.rst.txt +++ /dev/null @@ -1,17 +0,0 @@ -.. _pie_and_polar_charts-examples-index: - -############################################## -pie_and_polar_charts Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - pie_demo_features - polar_bar_demo - polar_scatter_demo diff --git a/_sources/examples/pie_and_polar_charts/index.txt b/_sources/examples/pie_and_polar_charts/index.txt deleted file mode 100644 index 4f67152315e..00000000000 --- a/_sources/examples/pie_and_polar_charts/index.txt +++ /dev/null @@ -1,17 +0,0 @@ -.. _pie_and_polar_charts-examples-index: - -############################################## -pie_and_polar_charts Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - pie_demo_features - polar_bar_demo - polar_scatter_demo diff --git a/_sources/examples/pie_and_polar_charts/pie_demo_features.rst.txt b/_sources/examples/pie_and_polar_charts/pie_demo_features.rst.txt deleted file mode 100644 index 7bb5b3d729f..00000000000 --- a/_sources/examples/pie_and_polar_charts/pie_demo_features.rst.txt +++ /dev/null @@ -1,49 +0,0 @@ -.. _pie_and_polar_charts-pie_demo_features: - -pie_and_polar_charts example code: pie_demo_features.py -======================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pie_and_polar_charts/pie_demo_features.py - -:: - - """ - =============== - Basic pie chart - =============== - - Demo of a basic pie chart plus a few additional features. - - In addition to the basic pie chart, this demo shows a few optional features: - - * slice labels - * auto-labeling the percentage - * offsetting a slice with "explode" - * drop-shadow - * custom start angle - - Note about the custom start angle: - - The default ``startangle`` is 0, which would start the "Frogs" slice on the - positive x-axis. This example sets ``startangle = 90`` such that everything is - rotated counter-clockwise by 90 degrees, and the frog slice starts on the - positive y-axis. - """ - import matplotlib.pyplot as plt - - # Pie chart, where the slices will be ordered and plotted counter-clockwise: - labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' - sizes = [15, 30, 45, 10] - explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs') - - fig1, ax1 = plt.subplots() - ax1.pie(sizes, explode=explode, labels=labels, autopct='%1.1f%%', - shadow=True, startangle=90) - ax1.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle. - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pie_and_polar_charts/pie_demo_features.txt b/_sources/examples/pie_and_polar_charts/pie_demo_features.txt deleted file mode 100644 index 69d6d1c4b35..00000000000 --- a/_sources/examples/pie_and_polar_charts/pie_demo_features.txt +++ /dev/null @@ -1,73 +0,0 @@ -.. _pie_and_polar_charts-pie_demo_features: - -pie_and_polar_charts example code: pie_demo_features.py -======================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pie_and_polar_charts/pie_demo_features.py - -:: - - """ - Demo of a basic pie chart plus a few additional features. - - In addition to the basic pie chart, this demo shows a few optional features: - - * slice labels - * auto-labeling the percentage - * offsetting a slice with "explode" - * drop-shadow - * custom start angle - - Note about the custom start angle: - - The default ``startangle`` is 0, which would start the "Frogs" slice on the - positive x-axis. This example sets ``startangle = 90`` such that everything is - rotated counter-clockwise by 90 degrees, and the frog slice starts on the - positive y-axis. - """ - import matplotlib.pyplot as plt - - # The slices will be ordered and plotted counter-clockwise. - labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' - sizes = [15, 30, 45, 10] - colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral'] - explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs') - - plt.pie(sizes, explode=explode, labels=labels, colors=colors, - autopct='%1.1f%%', shadow=True, startangle=90) - # Set aspect ratio to be equal so that pie is drawn as a circle. - plt.axis('equal') - - fig = plt.figure() - ax = fig.gca() - import numpy as np - - ax.pie(np.random.random(4), explode=explode, labels=labels, colors=colors, - autopct='%1.1f%%', shadow=True, startangle=90, - radius=0.25, center=(0, 0), frame=True) - ax.pie(np.random.random(4), explode=explode, labels=labels, colors=colors, - autopct='%1.1f%%', shadow=True, startangle=90, - radius=0.25, center=(1, 1), frame=True) - ax.pie(np.random.random(4), explode=explode, labels=labels, colors=colors, - autopct='%1.1f%%', shadow=True, startangle=90, - radius=0.25, center=(0, 1), frame=True) - ax.pie(np.random.random(4), explode=explode, labels=labels, colors=colors, - autopct='%1.1f%%', shadow=True, startangle=90, - radius=0.25, center=(1, 0), frame=True) - - ax.set_xticks([0, 1]) - ax.set_yticks([0, 1]) - ax.set_xticklabels(["Sunny", "Cloudy"]) - ax.set_yticklabels(["Dry", "Rainy"]) - ax.set_xlim((-0.5, 1.5)) - ax.set_ylim((-0.5, 1.5)) - - # Set aspect ratio to be equal so that pie is drawn as a circle. - ax.set_aspect('equal') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pie_and_polar_charts/polar_bar_demo.rst.txt b/_sources/examples/pie_and_polar_charts/polar_bar_demo.rst.txt deleted file mode 100644 index 0544e2b88f3..00000000000 --- a/_sources/examples/pie_and_polar_charts/polar_bar_demo.rst.txt +++ /dev/null @@ -1,40 +0,0 @@ -.. _pie_and_polar_charts-polar_bar_demo: - -pie_and_polar_charts example code: polar_bar_demo.py -==================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pie_and_polar_charts/polar_bar_demo.py - -:: - - """ - ======================= - Pie chart on polar axis - ======================= - - Demo of bar plot on a polar axis. - """ - import numpy as np - import matplotlib.pyplot as plt - - - # Compute pie slices - N = 20 - theta = np.linspace(0.0, 2 * np.pi, N, endpoint=False) - radii = 10 * np.random.rand(N) - width = np.pi / 4 * np.random.rand(N) - - ax = plt.subplot(111, projection='polar') - bars = ax.bar(theta, radii, width=width, bottom=0.0) - - # Use custom colors and opacity - for r, bar in zip(radii, bars): - bar.set_facecolor(plt.cm.viridis(r / 10.)) - bar.set_alpha(0.5) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pie_and_polar_charts/polar_bar_demo.txt b/_sources/examples/pie_and_polar_charts/polar_bar_demo.txt deleted file mode 100644 index 1376d719d3f..00000000000 --- a/_sources/examples/pie_and_polar_charts/polar_bar_demo.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _pie_and_polar_charts-polar_bar_demo: - -pie_and_polar_charts example code: polar_bar_demo.py -==================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pie_and_polar_charts/polar_bar_demo.py - -:: - - """ - Demo of bar plot on a polar axis. - """ - import numpy as np - import matplotlib.pyplot as plt - - - N = 20 - theta = np.linspace(0.0, 2 * np.pi, N, endpoint=False) - radii = 10 * np.random.rand(N) - width = np.pi / 4 * np.random.rand(N) - - ax = plt.subplot(111, projection='polar') - bars = ax.bar(theta, radii, width=width, bottom=0.0) - - # Use custom colors and opacity - for r, bar in zip(radii, bars): - bar.set_facecolor(plt.cm.jet(r / 10.)) - bar.set_alpha(0.5) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pie_and_polar_charts/polar_scatter_demo.rst.txt b/_sources/examples/pie_and_polar_charts/polar_scatter_demo.rst.txt deleted file mode 100644 index c208188594b..00000000000 --- a/_sources/examples/pie_and_polar_charts/polar_scatter_demo.rst.txt +++ /dev/null @@ -1,39 +0,0 @@ -.. _pie_and_polar_charts-polar_scatter_demo: - -pie_and_polar_charts example code: polar_scatter_demo.py -======================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pie_and_polar_charts/polar_scatter_demo.py - -:: - - """ - ========================== - Scatter plot on polar axis - ========================== - - Demo of scatter plot on a polar axis. - - Size increases radially in this example and color increases with angle - (just to verify the symbols are being scattered correctly). - """ - import numpy as np - import matplotlib.pyplot as plt - - - # Compute areas and colors - N = 150 - r = 2 * np.random.rand(N) - theta = 2 * np.pi * np.random.rand(N) - area = 200 * r**2 - colors = theta - - ax = plt.subplot(111, projection='polar') - c = ax.scatter(theta, r, c=colors, s=area, cmap='hsv', alpha=0.75) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pie_and_polar_charts/polar_scatter_demo.txt b/_sources/examples/pie_and_polar_charts/polar_scatter_demo.txt deleted file mode 100644 index a03faaee17e..00000000000 --- a/_sources/examples/pie_and_polar_charts/polar_scatter_demo.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _pie_and_polar_charts-polar_scatter_demo: - -pie_and_polar_charts example code: polar_scatter_demo.py -======================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pie_and_polar_charts/polar_scatter_demo.py - -:: - - """ - Demo of scatter plot on a polar axis. - - Size increases radially in this example and color increases with angle (just to - verify the symbols are being scattered correctly). - """ - import numpy as np - import matplotlib.pyplot as plt - - - N = 150 - r = 2 * np.random.rand(N) - theta = 2 * np.pi * np.random.rand(N) - area = 200 * r**2 * np.random.rand(N) - colors = theta - - ax = plt.subplot(111, projection='polar') - c = plt.scatter(theta, r, c=colors, s=area, cmap=plt.cm.hsv) - c.set_alpha(0.75) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pngsuite/index.txt b/_sources/examples/pngsuite/index.txt deleted file mode 100644 index e4baa5f847c..00000000000 --- a/_sources/examples/pngsuite/index.txt +++ /dev/null @@ -1,15 +0,0 @@ -.. _pngsuite-examples-index: - -############################################## -pngsuite Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - pngsuite.rst diff --git a/_sources/examples/pngsuite/pngsuite.txt b/_sources/examples/pngsuite/pngsuite.txt deleted file mode 100644 index 430081c7f15..00000000000 --- a/_sources/examples/pngsuite/pngsuite.txt +++ /dev/null @@ -1,41 +0,0 @@ -.. _pngsuite-pngsuite: - -pngsuite example code: pngsuite.py -================================== - -[`source code `_] - -:: - - """ - This test loads a subset of the files in Willem van Schaik's PNG test - suite available here: - - http://libpng.org/pub/png/pngsuite.html - - The result should look like truth.png. - """ - - from matplotlib import pyplot as plt - import matplotlib.cm as cm - import glob - - files = glob.glob("basn*.png") - files.sort() - - plt.figure(figsize=(len(files), 2)) - - for i, fname in enumerate(files): - data = plt.imread(fname) - cmap = None # use default colormap - if data.ndim==2: - # keep grayscale images gray - cmap = cm.gray - plt.imshow(data, extent=[i,i+1,0,1], cmap=cmap) - - plt.gca().get_frame().set_facecolor("#ddffff") - plt.gca().set_xlim(0, len(files)) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/accented_text.rst.txt b/_sources/examples/pylab_examples/accented_text.rst.txt deleted file mode 100644 index 00321f311b9..00000000000 --- a/_sources/examples/pylab_examples/accented_text.rst.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _pylab_examples-accented_text: - -pylab_examples example code: accented_text.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/accented_text.py - -:: - - r""" - matplotlib supports accented characters via TeX mathtext - - The following accents are provided: \hat, \breve, \grave, \bar, - \acute, \tilde, \vec, \dot, \ddot. All of them have the same syntax, - e.g., to make an overbar you do \bar{o} or to make an o umlaut you do - \ddot{o}. The shortcuts are also provided, e.g.,: \"o \'e \`e \~n \.x - \^y - - """ - import matplotlib.pyplot as plt - - plt.axes([0.1, 0.15, 0.8, 0.75]) - plt.plot(range(10)) - - plt.title(r'$\ddot{o}\acute{e}\grave{e}\hat{O}\breve{i}\bar{A}\tilde{n}\vec{q}$', fontsize=20) - # shorthand is also supported and curly's are optional - plt.xlabel(r"""$\"o\ddot o \'e\`e\~n\.x\^y$""", fontsize=20) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/accented_text.txt b/_sources/examples/pylab_examples/accented_text.txt deleted file mode 100644 index 8c379380f45..00000000000 --- a/_sources/examples/pylab_examples/accented_text.txt +++ /dev/null @@ -1,36 +0,0 @@ -.. _pylab_examples-accented_text: - -pylab_examples example code: accented_text.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/accented_text.py - -:: - - #!/usr/bin/env python - """ - matplotlib supports accented characters via TeX mathtext - - The following accents are provided: \hat, \breve, \grave, \bar, - \acute, \tilde, \vec, \dot, \ddot. All of them have the same syntax, - e.g., to make an overbar you do \bar{o} or to make an o umlaut you do - \ddot{o}. The shortcuts are also provided, e.g.,: \"o \'e \`e \~n \.x - \^y - - """ - import matplotlib.pyplot as plt - - plt.axes([0.1, 0.15, 0.8, 0.75]) - plt.plot(range(10)) - - plt.title(r'$\ddot{o}\acute{e}\grave{e}\hat{O}\breve{i}\bar{A}\tilde{n}\vec{q}$', fontsize=20) - # shorthand is also supported and curly's are optional - plt.xlabel(r"""$\"o\ddot o \'e\`e\~n\.x\^y$""", fontsize=20) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/agg_buffer.rst.txt b/_sources/examples/pylab_examples/agg_buffer.rst.txt deleted file mode 100644 index a31c384eb04..00000000000 --- a/_sources/examples/pylab_examples/agg_buffer.rst.txt +++ /dev/null @@ -1,53 +0,0 @@ -.. _pylab_examples-agg_buffer: - -pylab_examples example code: agg_buffer.py -========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/agg_buffer.py - -:: - - """ - Use backend agg to access the figure canvas as an RGB string and then - convert it to an array and pass it to Pillow for rendering. - """ - - import numpy as np - - import matplotlib.pyplot as plt - from matplotlib.backends.backend_agg import FigureCanvasAgg - - - try: - from PIL import Image - except ImportError: - raise SystemExit("Pillow must be installed to run this example") - - plt.plot([1, 2, 3]) - - canvas = plt.get_current_fig_manager().canvas - - agg = canvas.switch_backends(FigureCanvasAgg) - agg.draw() - s = agg.tostring_rgb() - - # get the width and the height to resize the matrix - l, b, w, h = agg.figure.bbox.bounds - w, h = int(w), int(h) - - X = np.fromstring(s, np.uint8) - X.shape = h, w, 3 - - try: - im = Image.fromstring("RGB", (w, h), s) - except Exception: - im = Image.frombytes("RGB", (w, h), s) - - # Uncomment this line to display the image using ImageMagick's - # `display` tool. - # im.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/agg_buffer.txt b/_sources/examples/pylab_examples/agg_buffer.txt deleted file mode 100644 index d54e0202fb0..00000000000 --- a/_sources/examples/pylab_examples/agg_buffer.txt +++ /dev/null @@ -1,54 +0,0 @@ -.. _pylab_examples-agg_buffer: - -pylab_examples example code: agg_buffer.py -========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/agg_buffer.py - -:: - - #!/usr/bin/env python - """ - Use backend agg to access the figure canvas as an RGB string and then - convert it to an array and pass it to Pillow for rendering. - """ - - import numpy as np - - import matplotlib.pyplot as plt - from matplotlib.backends.backend_agg import FigureCanvasAgg - - - try: - from PIL import Image - except ImportError: - raise SystemExit("Pillow must be installed to run this example") - - plt.plot([1, 2, 3]) - - canvas = plt.get_current_fig_manager().canvas - - agg = canvas.switch_backends(FigureCanvasAgg) - agg.draw() - s = agg.tostring_rgb() - - # get the width and the height to resize the matrix - l, b, w, h = agg.figure.bbox.bounds - w, h = int(w), int(h) - - X = np.fromstring(s, np.uint8) - X.shape = h, w, 3 - - try: - im = Image.fromstring("RGB", (w, h), s) - except Exception: - im = Image.frombytes("RGB", (w, h), s) - - # Uncomment this line to display the image using ImageMagick's - # `display` tool. - # im.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/agg_buffer_to_array.rst.txt b/_sources/examples/pylab_examples/agg_buffer_to_array.rst.txt deleted file mode 100644 index 26ff86d01d5..00000000000 --- a/_sources/examples/pylab_examples/agg_buffer_to_array.rst.txt +++ /dev/null @@ -1,31 +0,0 @@ -.. _pylab_examples-agg_buffer_to_array: - -pylab_examples example code: agg_buffer_to_array.py -=================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/agg_buffer_to_array.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - # make an agg figure - fig, ax = plt.subplots() - ax.plot([1, 2, 3]) - ax.set_title('a simple figure') - fig.canvas.draw() - - # grab the pixel buffer and dump it into a numpy array - X = np.array(fig.canvas.renderer._renderer) - - # now display the array X as an Axes in a new figure - fig2 = plt.figure() - ax2 = fig2.add_subplot(111, frameon=False) - ax2.imshow(X) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/agg_buffer_to_array.txt b/_sources/examples/pylab_examples/agg_buffer_to_array.txt deleted file mode 100644 index e6572a5bd4f..00000000000 --- a/_sources/examples/pylab_examples/agg_buffer_to_array.txt +++ /dev/null @@ -1,31 +0,0 @@ -.. _pylab_examples-agg_buffer_to_array: - -pylab_examples example code: agg_buffer_to_array.py -=================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/agg_buffer_to_array.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - # make an agg figure - fig, ax = plt.subplots() - ax.plot([1, 2, 3]) - ax.set_title('a simple figure') - fig.canvas.draw() - - # grab the pixel buffer and dump it into a numpy array - X = np.array(fig.canvas.renderer._renderer) - - # now display the array X as an Axes in a new figure - fig2 = plt.figure() - ax2 = fig2.add_subplot(111, frameon=False) - ax2.imshow(X) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/alignment_test.rst.txt b/_sources/examples/pylab_examples/alignment_test.rst.txt deleted file mode 100644 index 4483515b039..00000000000 --- a/_sources/examples/pylab_examples/alignment_test.rst.txt +++ /dev/null @@ -1,95 +0,0 @@ -.. _pylab_examples-alignment_test: - -pylab_examples example code: alignment_test.py -============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/alignment_test.py - -:: - - """ - You can precisely layout text in data or axes (0,1) coordinates. This - example shows you some of the alignment and rotation specifications to - layout text - """ - - import matplotlib.pyplot as plt - from matplotlib.lines import Line2D - from matplotlib.patches import Rectangle - - # build a rectangle in axes coords - left, width = .25, .5 - bottom, height = .25, .5 - right = left + width - top = bottom + height - ax = plt.gca() - p = plt.Rectangle((left, bottom), width, height, - fill=False, - ) - p.set_transform(ax.transAxes) - p.set_clip_on(False) - ax.add_patch(p) - - - ax.text(left, bottom, 'left top', - horizontalalignment='left', - verticalalignment='top', - transform=ax.transAxes) - - ax.text(left, bottom, 'left bottom', - horizontalalignment='left', - verticalalignment='bottom', - transform=ax.transAxes) - - ax.text(right, top, 'right bottom', - horizontalalignment='right', - verticalalignment='bottom', - transform=ax.transAxes) - - ax.text(right, top, 'right top', - horizontalalignment='right', - verticalalignment='top', - transform=ax.transAxes) - - ax.text(right, bottom, 'center top', - horizontalalignment='center', - verticalalignment='top', - transform=ax.transAxes) - - ax.text(left, 0.5*(bottom + top), 'right center', - horizontalalignment='right', - verticalalignment='center', - rotation='vertical', - transform=ax.transAxes) - - ax.text(left, 0.5*(bottom + top), 'left center', - horizontalalignment='left', - verticalalignment='center', - rotation='vertical', - transform=ax.transAxes) - - ax.text(0.5*(left + right), 0.5*(bottom + top), 'middle', - horizontalalignment='center', - verticalalignment='center', - transform=ax.transAxes) - - ax.text(right, 0.5*(bottom + top), 'centered', - horizontalalignment='center', - verticalalignment='center', - rotation='vertical', - transform=ax.transAxes) - - ax.text(left, top, 'rotated\nwith newlines', - horizontalalignment='center', - verticalalignment='center', - rotation=45, - transform=ax.transAxes) - - plt.axis('off') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/alignment_test.txt b/_sources/examples/pylab_examples/alignment_test.txt deleted file mode 100644 index 55352ff22d1..00000000000 --- a/_sources/examples/pylab_examples/alignment_test.txt +++ /dev/null @@ -1,96 +0,0 @@ -.. _pylab_examples-alignment_test: - -pylab_examples example code: alignment_test.py -============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/alignment_test.py - -:: - - #!/usr/bin/env python - """ - You can precisely layout text in data or axes (0,1) coordinates. This - example shows you some of the alignment and rotation specifications to - layout text - """ - - import matplotlib.pyplot as plt - from matplotlib.lines import Line2D - from matplotlib.patches import Rectangle - - # build a rectangle in axes coords - left, width = .25, .5 - bottom, height = .25, .5 - right = left + width - top = bottom + height - ax = plt.gca() - p = plt.Rectangle((left, bottom), width, height, - fill=False, - ) - p.set_transform(ax.transAxes) - p.set_clip_on(False) - ax.add_patch(p) - - - ax.text(left, bottom, 'left top', - horizontalalignment='left', - verticalalignment='top', - transform=ax.transAxes) - - ax.text(left, bottom, 'left bottom', - horizontalalignment='left', - verticalalignment='bottom', - transform=ax.transAxes) - - ax.text(right, top, 'right bottom', - horizontalalignment='right', - verticalalignment='bottom', - transform=ax.transAxes) - - ax.text(right, top, 'right top', - horizontalalignment='right', - verticalalignment='top', - transform=ax.transAxes) - - ax.text(right, bottom, 'center top', - horizontalalignment='center', - verticalalignment='top', - transform=ax.transAxes) - - ax.text(left, 0.5*(bottom + top), 'right center', - horizontalalignment='right', - verticalalignment='center', - rotation='vertical', - transform=ax.transAxes) - - ax.text(left, 0.5*(bottom + top), 'left center', - horizontalalignment='left', - verticalalignment='center', - rotation='vertical', - transform=ax.transAxes) - - ax.text(0.5*(left + right), 0.5*(bottom + top), 'middle', - horizontalalignment='center', - verticalalignment='center', - transform=ax.transAxes) - - ax.text(right, 0.5*(bottom + top), 'centered', - horizontalalignment='center', - verticalalignment='center', - rotation='vertical', - transform=ax.transAxes) - - ax.text(left, top, 'rotated\nwith newlines', - horizontalalignment='center', - verticalalignment='center', - rotation=45, - transform=ax.transAxes) - - plt.axis('off') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/anchored_artists.rst.txt b/_sources/examples/pylab_examples/anchored_artists.rst.txt deleted file mode 100644 index a858dcfec20..00000000000 --- a/_sources/examples/pylab_examples/anchored_artists.rst.txt +++ /dev/null @@ -1,124 +0,0 @@ -.. _pylab_examples-anchored_artists: - -pylab_examples example code: anchored_artists.py -================================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/anchored_artists.py - -:: - - from matplotlib.patches import Rectangle, Ellipse - - from matplotlib.offsetbox import AnchoredOffsetbox, AuxTransformBox, VPacker,\ - TextArea, DrawingArea - - - class AnchoredText(AnchoredOffsetbox): - def __init__(self, s, loc, pad=0.4, borderpad=0.5, prop=None, frameon=True): - - self.txt = TextArea(s, - minimumdescent=False) - - super(AnchoredText, self).__init__(loc, pad=pad, borderpad=borderpad, - child=self.txt, - prop=prop, - frameon=frameon) - - - class AnchoredSizeBar(AnchoredOffsetbox): - def __init__(self, transform, size, label, loc, - pad=0.1, borderpad=0.1, sep=2, prop=None, frameon=True): - """ - Draw a horizontal bar with the size in data coordinate of the give axes. - A label will be drawn underneath (center-aligned). - - pad, borderpad in fraction of the legend font size (or prop) - sep in points. - """ - self.size_bar = AuxTransformBox(transform) - self.size_bar.add_artist(Rectangle((0, 0), size, 0, fc="none", lw=1.0)) - - self.txt_label = TextArea(label, minimumdescent=False) - - self._box = VPacker(children=[self.size_bar, self.txt_label], - align="center", - pad=0, sep=sep) - - AnchoredOffsetbox.__init__(self, loc, pad=pad, borderpad=borderpad, - child=self._box, - prop=prop, - frameon=frameon) - - - class AnchoredEllipse(AnchoredOffsetbox): - def __init__(self, transform, width, height, angle, loc, - pad=0.1, borderpad=0.1, prop=None, frameon=True): - """ - Draw an ellipse the size in data coordinate of the give axes. - - pad, borderpad in fraction of the legend font size (or prop) - """ - self._box = AuxTransformBox(transform) - self.ellipse = Ellipse((0, 0), width, height, angle) - self._box.add_artist(self.ellipse) - - AnchoredOffsetbox.__init__(self, loc, pad=pad, borderpad=borderpad, - child=self._box, - prop=prop, - frameon=frameon) - - - class AnchoredDrawingArea(AnchoredOffsetbox): - def __init__(self, width, height, xdescent, ydescent, - loc, pad=0.4, borderpad=0.5, prop=None, frameon=True): - - self.da = DrawingArea(width, height, xdescent, ydescent) - - super(AnchoredDrawingArea, self).__init__(loc, pad=pad, borderpad=borderpad, - child=self.da, - prop=None, - frameon=frameon) - - - if __name__ == "__main__": - - import matplotlib.pyplot as plt - - ax = plt.gca() - ax.set_aspect(1.) - - at = AnchoredText("Figure 1a", - loc=2, frameon=True) - at.patch.set_boxstyle("round,pad=0.,rounding_size=0.2") - ax.add_artist(at) - - from matplotlib.patches import Circle - ada = AnchoredDrawingArea(20, 20, 0, 0, - loc=1, pad=0., frameon=False) - p = Circle((10, 10), 10) - ada.da.add_artist(p) - ax.add_artist(ada) - - # draw an ellipse of width=0.1, height=0.15 in the data coordinate - ae = AnchoredEllipse(ax.transData, width=0.1, height=0.15, angle=0., - loc=3, pad=0.5, borderpad=0.4, frameon=True) - - ax.add_artist(ae) - - # draw a horizontal bar with length of 0.1 in Data coordinate - # (ax.transData) with a label underneath. - asb = AnchoredSizeBar(ax.transData, - 0.1, - r"1$^{\prime}$", - loc=8, - pad=0.1, borderpad=0.5, sep=5, - frameon=False) - ax.add_artist(asb) - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/anchored_artists.txt b/_sources/examples/pylab_examples/anchored_artists.txt deleted file mode 100644 index b9331d6fa36..00000000000 --- a/_sources/examples/pylab_examples/anchored_artists.txt +++ /dev/null @@ -1,124 +0,0 @@ -.. _pylab_examples-anchored_artists: - -pylab_examples example code: anchored_artists.py -================================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/anchored_artists.py - -:: - - from matplotlib.patches import Rectangle, Ellipse - - from matplotlib.offsetbox import AnchoredOffsetbox, AuxTransformBox, VPacker,\ - TextArea, DrawingArea - - - class AnchoredText(AnchoredOffsetbox): - def __init__(self, s, loc, pad=0.4, borderpad=0.5, prop=None, frameon=True): - - self.txt = TextArea(s, - minimumdescent=False) - - super(AnchoredText, self).__init__(loc, pad=pad, borderpad=borderpad, - child=self.txt, - prop=prop, - frameon=frameon) - - - class AnchoredSizeBar(AnchoredOffsetbox): - def __init__(self, transform, size, label, loc, - pad=0.1, borderpad=0.1, sep=2, prop=None, frameon=True): - """ - Draw a horizontal bar with the size in data coordinate of the give axes. - A label will be drawn underneath (center-aligned). - - pad, borderpad in fraction of the legend font size (or prop) - sep in points. - """ - self.size_bar = AuxTransformBox(transform) - self.size_bar.add_artist(Rectangle((0, 0), size, 0, fc="none")) - - self.txt_label = TextArea(label, minimumdescent=False) - - self._box = VPacker(children=[self.size_bar, self.txt_label], - align="center", - pad=0, sep=sep) - - AnchoredOffsetbox.__init__(self, loc, pad=pad, borderpad=borderpad, - child=self._box, - prop=prop, - frameon=frameon) - - - class AnchoredEllipse(AnchoredOffsetbox): - def __init__(self, transform, width, height, angle, loc, - pad=0.1, borderpad=0.1, prop=None, frameon=True): - """ - Draw an ellipse the size in data coordinate of the give axes. - - pad, borderpad in fraction of the legend font size (or prop) - """ - self._box = AuxTransformBox(transform) - self.ellipse = Ellipse((0, 0), width, height, angle) - self._box.add_artist(self.ellipse) - - AnchoredOffsetbox.__init__(self, loc, pad=pad, borderpad=borderpad, - child=self._box, - prop=prop, - frameon=frameon) - - - class AnchoredDrawingArea(AnchoredOffsetbox): - def __init__(self, width, height, xdescent, ydescent, - loc, pad=0.4, borderpad=0.5, prop=None, frameon=True): - - self.da = DrawingArea(width, height, xdescent, ydescent) - - super(AnchoredDrawingArea, self).__init__(loc, pad=pad, borderpad=borderpad, - child=self.da, - prop=None, - frameon=frameon) - - - if __name__ == "__main__": - - import matplotlib.pyplot as plt - - ax = plt.gca() - ax.set_aspect(1.) - - at = AnchoredText("Figure 1a", - loc=2, frameon=True) - at.patch.set_boxstyle("round,pad=0.,rounding_size=0.2") - ax.add_artist(at) - - from matplotlib.patches import Circle - ada = AnchoredDrawingArea(20, 20, 0, 0, - loc=1, pad=0., frameon=False) - p = Circle((10, 10), 10) - ada.da.add_artist(p) - ax.add_artist(ada) - - # draw an ellipse of width=0.1, height=0.15 in the data coordinate - ae = AnchoredEllipse(ax.transData, width=0.1, height=0.15, angle=0., - loc=3, pad=0.5, borderpad=0.4, frameon=True) - - ax.add_artist(ae) - - # draw a horizontal bar with length of 0.1 in Data coordinate - # (ax.transData) with a label underneath. - asb = AnchoredSizeBar(ax.transData, - 0.1, - r"1$^{\prime}$", - loc=8, - pad=0.1, borderpad=0.5, sep=5, - frameon=False) - ax.add_artist(asb) - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/animation_demo.rst.txt b/_sources/examples/pylab_examples/animation_demo.rst.txt deleted file mode 100644 index 23909f94c22..00000000000 --- a/_sources/examples/pylab_examples/animation_demo.rst.txt +++ /dev/null @@ -1,41 +0,0 @@ -.. _pylab_examples-animation_demo: - -pylab_examples example code: animation_demo.py -============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/animation_demo.py - -:: - - """ - Pyplot animation example. - - The method shown here is only for very simple, low-performance - use. For more demanding applications, look at the animation - module and the examples that use it. - """ - - import matplotlib.pyplot as plt - import numpy as np - - x = np.arange(6) - y = np.arange(5) - z = x * y[:, np.newaxis] - - for i in range(5): - if i == 0: - p = plt.imshow(z) - fig = plt.gcf() - plt.clim() # clamp the color limits - plt.title("Boring slide show") - else: - z = z + 2 - p.set_data(z) - - print("step", i) - plt.pause(0.5) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/animation_demo.txt b/_sources/examples/pylab_examples/animation_demo.txt deleted file mode 100644 index c27dc780559..00000000000 --- a/_sources/examples/pylab_examples/animation_demo.txt +++ /dev/null @@ -1,41 +0,0 @@ -.. _pylab_examples-animation_demo: - -pylab_examples example code: animation_demo.py -============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/animation_demo.py - -:: - - """ - Pyplot animation example. - - The method shown here is only for very simple, low-performance - use. For more demanding applications, look at the animation - module and the examples that use it. - """ - - import matplotlib.pyplot as plt - import numpy as np - - x = np.arange(6) - y = np.arange(5) - z = x * y[:, np.newaxis] - - for i in range(5): - if i == 0: - p = plt.imshow(z) - fig = plt.gcf() - plt.clim() # clamp the color limits - plt.title("Boring slide show") - else: - z = z + 2 - p.set_data(z) - - print("step", i) - plt.pause(0.5) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/annotation_demo.rst.txt b/_sources/examples/pylab_examples/annotation_demo.rst.txt deleted file mode 100644 index 08705d06972..00000000000 --- a/_sources/examples/pylab_examples/annotation_demo.rst.txt +++ /dev/null @@ -1,146 +0,0 @@ -.. _pylab_examples-annotation_demo: - -pylab_examples example code: annotation_demo.py -=============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/annotation_demo.py - -:: - - """ - Some examples of how to annotate points in figures. You specify an - annotation point xy=(x,y) and a text point xytext=(x,y) for the - annotated points and text location, respectively. Optionally, you can - specify the coordinate system of xy and xytext with one of the - following strings for xycoords and textcoords (default is 'data') - - - 'figure points' : points from the lower left corner of the figure - 'figure pixels' : pixels from the lower left corner of the figure - 'figure fraction' : 0,0 is lower left of figure and 1,1 is upper, right - 'axes points' : points from lower left corner of axes - 'axes pixels' : pixels from lower left corner of axes - 'axes fraction' : 0,0 is lower left of axes and 1,1 is upper right - 'offset points' : Specify an offset (in points) from the xy value - 'offset pixels' : Specify an offset (in pixels) from the xy value - 'data' : use the axes data coordinate system - - Optionally, you can specify arrow properties which draws and arrow - from the text to the annotated point by giving a dictionary of arrow - properties - - Valid keys are - - width : the width of the arrow in points - frac : the fraction of the arrow length occupied by the head - headwidth : the width of the base of the arrow head in points - shrink : move the tip and base some percent away from the - annotated point and text - any key for matplotlib.patches.polygon (e.g., facecolor) - - For physical coordinate systems (points or pixels) the origin is the - (bottom, left) of the figure or axes. - """ - - - import matplotlib.pyplot as plt - from matplotlib.patches import Ellipse - import numpy as np - - - # If only one location is given, the text and xypoint being - # annotated are assumed to be the same - fig = plt.figure() - ax = fig.add_subplot(111, autoscale_on=False, xlim=(-1, 5), ylim=(-3, 5)) - - t = np.arange(0.0, 5.0, 0.01) - s = np.cos(2*np.pi*t) - line, = ax.plot(t, s) - - ax.annotate('figure pixels', - xy=(10, 10), xycoords='figure pixels') - - ax.annotate('figure points', - xy=(80, 80), xycoords='figure points') - - ax.annotate('point offset from data', - xy=(2, 1), xycoords='data', - xytext=(-15, 25), textcoords='offset points', - arrowprops=dict(facecolor='black', shrink=0.05), - horizontalalignment='right', verticalalignment='bottom') - - ax.annotate('axes fraction', - xy=(3, 1), xycoords='data', - xytext=(0.8, 0.95), textcoords='axes fraction', - arrowprops=dict(facecolor='black', shrink=0.05), - horizontalalignment='right', verticalalignment='top') - - ax.annotate('figure fraction', - xy=(.025, .975), xycoords='figure fraction', - horizontalalignment='left', verticalalignment='top', - fontsize=20) - - # use negative points or pixels to specify from right, top -10, 10 - # is 10 points to the left of the right side of the axes and 10 - # points above the bottom - ax.annotate('pixel offset from axes fraction', - xy=(1, 0), xycoords='axes fraction', - xytext=(-20, 20), textcoords='offset pixels', - horizontalalignment='right', - verticalalignment='bottom') - - - # You can specify the xypoint and the xytext in different positions and - # coordinate systems, and optionally turn on a connecting line and mark - # the point with a marker. Annotations work on polar axes too. - # In the example below, the xy point is in native coordinates (xycoords - # defaults to 'data'). For a polar axes, this is in (theta, radius) space. - # The text in the example is placed in the fractional figure coordinate system. - # Text keyword args like horizontal and vertical alignment are respected. - fig = plt.figure() - ax = fig.add_subplot(111, projection='polar') - r = np.arange(0, 1, 0.001) - theta = 2*2*np.pi*r - line, = ax.plot(theta, r) - - ind = 800 - thisr, thistheta = r[ind], theta[ind] - ax.plot([thistheta], [thisr], 'o') - ax.annotate('a polar annotation', - xy=(thistheta, thisr), # theta, radius - xytext=(0.05, 0.05), # fraction, fraction - textcoords='figure fraction', - arrowprops=dict(facecolor='black', shrink=0.05), - horizontalalignment='left', - verticalalignment='bottom') - - - # You can also use polar notation on a cartesian axes. Here the native - # coordinate system ('data') is cartesian, so you need to specify the - # xycoords and textcoords as 'polar' if you want to use (theta, radius). - - el = Ellipse((0, 0), 10, 20, facecolor='r', alpha=0.5) - - fig = plt.figure() - ax = fig.add_subplot(111, aspect='equal') - ax.add_artist(el) - el.set_clip_box(ax.bbox) - ax.annotate('the top', - xy=(np.pi/2., 10.), # theta, radius - xytext=(np.pi/3, 20.), # theta, radius - xycoords='polar', - textcoords='polar', - arrowprops=dict(facecolor='black', shrink=0.05), - horizontalalignment='left', - verticalalignment='bottom', - clip_on=True) # clip to the axes bounding box - - ax.set_xlim([-20, 20]) - ax.set_ylim([-20, 20]) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/annotation_demo.txt b/_sources/examples/pylab_examples/annotation_demo.txt deleted file mode 100644 index b3cb23b77ad..00000000000 --- a/_sources/examples/pylab_examples/annotation_demo.txt +++ /dev/null @@ -1,156 +0,0 @@ -.. _pylab_examples-annotation_demo: - -pylab_examples example code: annotation_demo.py -=============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/annotation_demo.py - -:: - - """ - Some examples of how to annotate points in figures. You specify an - annotation point xy=(x,y) and a text point xytext=(x,y) for the - annotated points and text location, respectively. Optionally, you can - specify the coordinate system of xy and xytext with one of the - following strings for xycoords and textcoords (default is 'data') - - - 'figure points' : points from the lower left corner of the figure - 'figure pixels' : pixels from the lower left corner of the figure - 'figure fraction' : 0,0 is lower left of figure and 1,1 is upper, right - 'axes points' : points from lower left corner of axes - 'axes pixels' : pixels from lower left corner of axes - 'axes fraction' : 0,0 is lower left of axes and 1,1 is upper right - 'offset points' : Specify an offset (in points) from the xy value - 'offset pixels' : Specify an offset (in pixels) from the xy value - 'data' : use the axes data coordinate system - - Optionally, you can specify arrow properties which draws and arrow - from the text to the annotated point by giving a dictionary of arrow - properties - - Valid keys are - - width : the width of the arrow in points - frac : the fraction of the arrow length occupied by the head - headwidth : the width of the base of the arrow head in points - shrink : move the tip and base some percent away from the - annotated point and text - any key for matplotlib.patches.polygon (e.g., facecolor) - - For physical coordinate systems (points or pixels) the origin is the - (bottom, left) of the figure or axes. - """ - - - import matplotlib.pyplot as plt - from matplotlib.patches import Ellipse - import numpy as np - - - if 1: - # if only one location is given, the text and xypoint being - # annotated are assumed to be the same - fig = plt.figure() - ax = fig.add_subplot(111, autoscale_on=False, xlim=(-1, 5), ylim=(-3, 5)) - - t = np.arange(0.0, 5.0, 0.01) - s = np.cos(2*np.pi*t) - line, = ax.plot(t, s, lw=3, color='purple') - - ax.annotate('figure pixels', - xy=(10, 10), xycoords='figure pixels') - - ax.annotate('figure points', xy=(80, 80), - xycoords='figure points') - - ax.annotate('point offset from data', xy=(2, 1), - xycoords='data', - xytext=(-15, 25), textcoords='offset points', - arrowprops=dict(facecolor='black', shrink=0.05), - horizontalalignment='right', verticalalignment='bottom', - ) - - ax.annotate('axes fraction', xy=(3, 1), xycoords='data', - xytext=(0.8, 0.95), textcoords='axes fraction', - arrowprops=dict(facecolor='black', shrink=0.05), - horizontalalignment='right', verticalalignment='top', - ) - - ax.annotate('figure fraction', xy=(.025, .975), - xycoords='figure fraction', - horizontalalignment='left', verticalalignment='top', - fontsize=20) - - # use negative points or pixels to specify from right, top -10, 10 - # is 10 points to the left of the right side of the axes and 10 - # points above the bottom - ax.annotate('pixel offset from axes fraction', xy=(1, 0), - xycoords='axes fraction', - xytext=(-20, 20), - textcoords='offset pixels', - horizontalalignment='right', - verticalalignment='bottom') - - - if 1: - # you can specify the xypoint and the xytext in different - # positions and coordinate systems, and optionally turn on a - # connecting line and mark the point with a marker. Annotations - # work on polar axes too. In the example below, the xy point is - # in native coordinates (xycoords defaults to 'data'). For a - # polar axes, this is in (theta, radius) space. The text in this - # example is placed in the fractional figure coordinate system. - # Text keyword args like horizontal and vertical alignment are - # respected - fig = plt.figure() - ax = fig.add_subplot(111, projection='polar') - r = np.arange(0, 1, 0.001) - theta = 2*2*np.pi*r - line, = ax.plot(theta, r, color='#ee8d18', lw=3) - - ind = 800 - thisr, thistheta = r[ind], theta[ind] - ax.plot([thistheta], [thisr], 'o') - ax.annotate('a polar annotation', - xy=(thistheta, thisr), # theta, radius - xytext=(0.05, 0.05), # fraction, fraction - textcoords='figure fraction', - arrowprops=dict(facecolor='black', shrink=0.05), - horizontalalignment='left', - verticalalignment='bottom', - ) - - - if 1: - # You can also use polar notation on a cartesian axes. Here the - # native coordinate system ('data') is cartesian, so you need to - # specify the xycoords and textcoords as 'polar' if you want to - # use (theta, radius) - - el = Ellipse((0, 0), 10, 20, facecolor='r', alpha=0.5) - - fig = plt.figure() - ax = fig.add_subplot(111, aspect='equal') - ax.add_artist(el) - el.set_clip_box(ax.bbox) - ax.annotate('the top', - xy=(np.pi/2., 10.), # theta, radius - xytext=(np.pi/3, 20.), # theta, radius - xycoords='polar', - textcoords='polar', - arrowprops=dict(facecolor='black', shrink=0.05), - horizontalalignment='left', - verticalalignment='bottom', - clip_on=True, # clip to the axes bounding box - ) - - ax.set_xlim(-20, 20) - ax.set_ylim(-20, 20) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/annotation_demo2.rst.txt b/_sources/examples/pylab_examples/annotation_demo2.rst.txt deleted file mode 100644 index ba56359008b..00000000000 --- a/_sources/examples/pylab_examples/annotation_demo2.rst.txt +++ /dev/null @@ -1,164 +0,0 @@ -.. _pylab_examples-annotation_demo2: - -pylab_examples example code: annotation_demo2.py -================================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/annotation_demo2.py - -:: - - import matplotlib.pyplot as plt - from matplotlib.patches import Ellipse - import numpy as np - - - fig = plt.figure(1, figsize=(8, 5)) - ax = fig.add_subplot(111, autoscale_on=False, xlim=(-1, 5), ylim=(-4, 3)) - - t = np.arange(0.0, 5.0, 0.01) - s = np.cos(2*np.pi*t) - line, = ax.plot(t, s, lw=3) - - ax.annotate('straight', - xy=(0, 1), xycoords='data', - xytext=(-50, 30), textcoords='offset points', - arrowprops=dict(arrowstyle="->")) - - ax.annotate('arc3,\nrad 0.2', - xy=(0.5, -1), xycoords='data', - xytext=(-80, -60), textcoords='offset points', - arrowprops=dict(arrowstyle="->", - connectionstyle="arc3,rad=.2")) - - ax.annotate('arc,\nangle 50', - xy=(1., 1), xycoords='data', - xytext=(-90, 50), textcoords='offset points', - arrowprops=dict(arrowstyle="->", - connectionstyle="arc,angleA=0,armA=50,rad=10")) - - ax.annotate('arc,\narms', - xy=(1.5, -1), xycoords='data', - xytext=(-80, -60), textcoords='offset points', - arrowprops=dict(arrowstyle="->", - connectionstyle="arc,angleA=0,armA=40,angleB=-90,armB=30,rad=7")) - - ax.annotate('angle,\nangle 90', - xy=(2., 1), xycoords='data', - xytext=(-70, 30), textcoords='offset points', - arrowprops=dict(arrowstyle="->", - connectionstyle="angle,angleA=0,angleB=90,rad=10")) - - ax.annotate('angle3,\nangle -90', - xy=(2.5, -1), xycoords='data', - xytext=(-80, -60), textcoords='offset points', - arrowprops=dict(arrowstyle="->", - connectionstyle="angle3,angleA=0,angleB=-90")) - - ax.annotate('angle,\nround', - xy=(3., 1), xycoords='data', - xytext=(-60, 30), textcoords='offset points', - bbox=dict(boxstyle="round", fc="0.8"), - arrowprops=dict(arrowstyle="->", - connectionstyle="angle,angleA=0,angleB=90,rad=10")) - - ax.annotate('angle,\nround4', - xy=(3.5, -1), xycoords='data', - xytext=(-70, -80), textcoords='offset points', - size=20, - bbox=dict(boxstyle="round4,pad=.5", fc="0.8"), - arrowprops=dict(arrowstyle="->", - connectionstyle="angle,angleA=0,angleB=-90,rad=10")) - - ax.annotate('angle,\nshrink', - xy=(4., 1), xycoords='data', - xytext=(-60, 30), textcoords='offset points', - bbox=dict(boxstyle="round", fc="0.8"), - arrowprops=dict(arrowstyle="->", - shrinkA=0, shrinkB=10, - connectionstyle="angle,angleA=0,angleB=90,rad=10")) - - # You can pass an empty string to get only annotation arrows rendered - ann = ax.annotate('', xy=(4., 1.), xycoords='data', - xytext=(4.5, -1), textcoords='data', - arrowprops=dict(arrowstyle="<->", - connectionstyle="bar", - ec="k", - shrinkA=5, shrinkB=5)) - - - fig = plt.figure(2) - fig.clf() - ax = fig.add_subplot(111, autoscale_on=False, xlim=(-1, 5), ylim=(-5, 3)) - - el = Ellipse((2, -1), 0.5, 0.5) - ax.add_patch(el) - - ax.annotate('$->$', - xy=(2., -1), xycoords='data', - xytext=(-150, -140), textcoords='offset points', - bbox=dict(boxstyle="round", fc="0.8"), - arrowprops=dict(arrowstyle="->", - patchB=el, - connectionstyle="angle,angleA=90,angleB=0,rad=10")) - - ax.annotate('arrow\nfancy', - xy=(2., -1), xycoords='data', - xytext=(-100, 60), textcoords='offset points', - size=20, - # bbox=dict(boxstyle="round", fc="0.8"), - arrowprops=dict(arrowstyle="fancy", - fc="0.6", ec="none", - patchB=el, - connectionstyle="angle3,angleA=0,angleB=-90")) - - ax.annotate('arrow\nsimple', - xy=(2., -1), xycoords='data', - xytext=(100, 60), textcoords='offset points', - size=20, - # bbox=dict(boxstyle="round", fc="0.8"), - arrowprops=dict(arrowstyle="simple", - fc="0.6", ec="none", - patchB=el, - connectionstyle="arc3,rad=0.3")) - - ax.annotate('wedge', - xy=(2., -1), xycoords='data', - xytext=(-100, -100), textcoords='offset points', - size=20, - # bbox=dict(boxstyle="round", fc="0.8"), - arrowprops=dict(arrowstyle="wedge,tail_width=0.7", - fc="0.6", ec="none", - patchB=el, - connectionstyle="arc3,rad=-0.3")) - - ann = ax.annotate('bubble,\ncontours', - xy=(2., -1), xycoords='data', - xytext=(0, -70), textcoords='offset points', - size=20, - bbox=dict(boxstyle="round", - fc=(1.0, 0.7, 0.7), - ec=(1., .5, .5)), - arrowprops=dict(arrowstyle="wedge,tail_width=1.", - fc=(1.0, 0.7, 0.7), ec=(1., .5, .5), - patchA=None, - patchB=el, - relpos=(0.2, 0.8), - connectionstyle="arc3,rad=-0.1")) - - ann = ax.annotate('bubble', - xy=(2., -1), xycoords='data', - xytext=(55, 0), textcoords='offset points', - size=20, va="center", - bbox=dict(boxstyle="round", fc=(1.0, 0.7, 0.7), ec="none"), - arrowprops=dict(arrowstyle="wedge,tail_width=1.", - fc=(1.0, 0.7, 0.7), ec="none", - patchA=None, - patchB=el, - relpos=(0.2, 0.5))) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/annotation_demo2.txt b/_sources/examples/pylab_examples/annotation_demo2.txt deleted file mode 100644 index a640e7eda62..00000000000 --- a/_sources/examples/pylab_examples/annotation_demo2.txt +++ /dev/null @@ -1,167 +0,0 @@ -.. _pylab_examples-annotation_demo2: - -pylab_examples example code: annotation_demo2.py -================================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/annotation_demo2.py - -:: - - - import matplotlib.pyplot as plt - from matplotlib.patches import Ellipse - import numpy as np - - if 1: - fig = plt.figure(1, figsize=(8, 5)) - ax = fig.add_subplot(111, autoscale_on=False, xlim=(-1, 5), ylim=(-4, 3)) - - t = np.arange(0.0, 5.0, 0.01) - s = np.cos(2*np.pi*t) - line, = ax.plot(t, s, lw=3, color='purple') - - ax.annotate('arrowstyle', xy=(0, 1), xycoords='data', - xytext=(-50, 30), textcoords='offset points', - arrowprops=dict(arrowstyle="->") - ) - - ax.annotate('arc3', xy=(0.5, -1), xycoords='data', - xytext=(-30, -30), textcoords='offset points', - arrowprops=dict(arrowstyle="->", - connectionstyle="arc3,rad=.2") - ) - - ax.annotate('arc', xy=(1., 1), xycoords='data', - xytext=(-40, 30), textcoords='offset points', - arrowprops=dict(arrowstyle="->", - connectionstyle="arc,angleA=0,armA=30,rad=10"), - ) - - ax.annotate('arc', xy=(1.5, -1), xycoords='data', - xytext=(-40, -30), textcoords='offset points', - arrowprops=dict(arrowstyle="->", - connectionstyle="arc,angleA=0,armA=20,angleB=-90,armB=15,rad=7"), - ) - - ax.annotate('angle', xy=(2., 1), xycoords='data', - xytext=(-50, 30), textcoords='offset points', - arrowprops=dict(arrowstyle="->", - connectionstyle="angle,angleA=0,angleB=90,rad=10"), - ) - - ax.annotate('angle3', xy=(2.5, -1), xycoords='data', - xytext=(-50, -30), textcoords='offset points', - arrowprops=dict(arrowstyle="->", - connectionstyle="angle3,angleA=0,angleB=-90"), - ) - - ax.annotate('angle', xy=(3., 1), xycoords='data', - xytext=(-50, 30), textcoords='offset points', - bbox=dict(boxstyle="round", fc="0.8"), - arrowprops=dict(arrowstyle="->", - connectionstyle="angle,angleA=0,angleB=90,rad=10"), - ) - - ax.annotate('angle', xy=(3.5, -1), xycoords='data', - xytext=(-70, -60), textcoords='offset points', - size=20, - bbox=dict(boxstyle="round4,pad=.5", fc="0.8"), - arrowprops=dict(arrowstyle="->", - connectionstyle="angle,angleA=0,angleB=-90,rad=10"), - ) - - ax.annotate('angle', xy=(4., 1), xycoords='data', - xytext=(-50, 30), textcoords='offset points', - bbox=dict(boxstyle="round", fc="0.8"), - arrowprops=dict(arrowstyle="->", - shrinkA=0, shrinkB=10, - connectionstyle="angle,angleA=0,angleB=90,rad=10"), - ) - - ann = ax.annotate('', xy=(4., 1.), xycoords='data', - xytext=(4.5, -1), textcoords='data', - arrowprops=dict(arrowstyle="<->", - connectionstyle="bar", - ec="k", - shrinkA=5, shrinkB=5, - ) - ) - - - if 1: - fig = plt.figure(2) - fig.clf() - ax = fig.add_subplot(111, autoscale_on=False, xlim=(-1, 5), ylim=(-5, 3)) - - el = Ellipse((2, -1), 0.5, 0.5) - ax.add_patch(el) - - ax.annotate('$->$', xy=(2., -1), xycoords='data', - xytext=(-150, -140), textcoords='offset points', - bbox=dict(boxstyle="round", fc="0.8"), - arrowprops=dict(arrowstyle="->", - patchB=el, - connectionstyle="angle,angleA=90,angleB=0,rad=10"), - ) - - ax.annotate('fancy', xy=(2., -1), xycoords='data', - xytext=(-100, 60), textcoords='offset points', - size=20, - # bbox=dict(boxstyle="round", fc="0.8"), - arrowprops=dict(arrowstyle="fancy", - fc="0.6", ec="none", - patchB=el, - connectionstyle="angle3,angleA=0,angleB=-90"), - ) - - ax.annotate('simple', xy=(2., -1), xycoords='data', - xytext=(100, 60), textcoords='offset points', - size=20, - # bbox=dict(boxstyle="round", fc="0.8"), - arrowprops=dict(arrowstyle="simple", - fc="0.6", ec="none", - patchB=el, - connectionstyle="arc3,rad=0.3"), - ) - - ax.annotate('wedge', xy=(2., -1), xycoords='data', - xytext=(-100, -100), textcoords='offset points', - size=20, - # bbox=dict(boxstyle="round", fc="0.8"), - arrowprops=dict(arrowstyle="wedge,tail_width=0.7", - fc="0.6", ec="none", - patchB=el, - connectionstyle="arc3,rad=-0.3"), - ) - - ann = ax.annotate('wedge', xy=(2., -1), xycoords='data', - xytext=(0, -45), textcoords='offset points', - size=20, - bbox=dict(boxstyle="round", fc=(1.0, 0.7, 0.7), ec=(1., .5, .5)), - arrowprops=dict(arrowstyle="wedge,tail_width=1.", - fc=(1.0, 0.7, 0.7), ec=(1., .5, .5), - patchA=None, - patchB=el, - relpos=(0.2, 0.8), - connectionstyle="arc3,rad=-0.1"), - ) - - ann = ax.annotate('wedge', xy=(2., -1), xycoords='data', - xytext=(35, 0), textcoords='offset points', - size=20, va="center", - bbox=dict(boxstyle="round", fc=(1.0, 0.7, 0.7), ec="none"), - arrowprops=dict(arrowstyle="wedge,tail_width=1.", - fc=(1.0, 0.7, 0.7), ec="none", - patchA=None, - patchB=el, - relpos=(0.2, 0.5), - ) - ) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/annotation_demo3.rst.txt b/_sources/examples/pylab_examples/annotation_demo3.rst.txt deleted file mode 100644 index ca85a1074da..00000000000 --- a/_sources/examples/pylab_examples/annotation_demo3.rst.txt +++ /dev/null @@ -1,102 +0,0 @@ -.. _pylab_examples-annotation_demo3: - -pylab_examples example code: annotation_demo3.py -================================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/annotation_demo3.py - -:: - - import matplotlib.pyplot as plt - from matplotlib.text import OffsetFrom - - - fig, (ax1, ax2) = plt.subplots(1, 2) - - bbox_args = dict(boxstyle="round", fc="0.8") - arrow_args = dict(arrowstyle="->") - - ax1.annotate('figure fraction : 0, 0', xy=(0, 0), xycoords='figure fraction', - xytext=(20, 20), textcoords='offset points', - ha="left", va="bottom", - bbox=bbox_args, - arrowprops=arrow_args) - - ax1.annotate('figure fraction : 1, 1', xy=(1, 1), xycoords='figure fraction', - xytext=(-20, -20), textcoords='offset points', - ha="right", va="top", - bbox=bbox_args, - arrowprops=arrow_args) - - ax1.annotate('axes fraction : 0, 0', xy=(0, 0), xycoords='axes fraction', - xytext=(20, 20), textcoords='offset points', - ha="left", va="bottom", - bbox=bbox_args, - arrowprops=arrow_args) - - ax1.annotate('axes fraction : 1, 1', xy=(1, 1), xycoords='axes fraction', - xytext=(-20, -20), textcoords='offset points', - ha="right", va="top", - bbox=bbox_args, - arrowprops=arrow_args) - - - an1 = ax1.annotate('Drag me 1', xy=(.5, .7), xycoords='data', - #xytext=(.5, .7), textcoords='data', - ha="center", va="center", - bbox=bbox_args, - #arrowprops=arrow_args - ) - - an2 = ax1.annotate('Drag me 2', xy=(.5, .5), xycoords=an1, - xytext=(.5, .3), textcoords='axes fraction', - ha="center", va="center", - bbox=bbox_args, - arrowprops=dict(patchB=an1.get_bbox_patch(), - connectionstyle="arc3,rad=0.2", - **arrow_args)) - - an3 = ax1.annotate('', xy=(.5, .5), xycoords=an2, - xytext=(.5, .5), textcoords=an1, - ha="center", va="center", - bbox=bbox_args, - arrowprops=dict(patchA=an1.get_bbox_patch(), - patchB=an2.get_bbox_patch(), - connectionstyle="arc3,rad=0.2", - **arrow_args)) - - - t = ax2.annotate('xy=(0, 1)\nxycoords=("data", "axes fraction")', - xy=(0, 1), xycoords=("data", 'axes fraction'), - xytext=(0, -20), textcoords='offset points', - ha="center", va="top", - bbox=bbox_args, - arrowprops=arrow_args) - - ax2.annotate('xy=(0.5, 0)\nxycoords=artist', - xy=(0.5, 0.), xycoords=t, - xytext=(0, -20), textcoords='offset points', - ha="center", va="top", - bbox=bbox_args, - arrowprops=arrow_args) - - ax2.annotate('xy=(0.8, 0.5)\nxycoords=ax1.transData', - xy=(0.8, 0.5), xycoords=ax1.transData, - xytext=(10, 10), - textcoords=OffsetFrom(ax2.bbox, (0, 0), "points"), - ha="left", va="bottom", - bbox=bbox_args, - arrowprops=arrow_args) - - ax2.set_xlim([-2, 2]) - ax2.set_ylim([-2, 2]) - - an1.draggable() - an2.draggable() - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/annotation_demo3.txt b/_sources/examples/pylab_examples/annotation_demo3.txt deleted file mode 100644 index 41d8970a796..00000000000 --- a/_sources/examples/pylab_examples/annotation_demo3.txt +++ /dev/null @@ -1,110 +0,0 @@ -.. _pylab_examples-annotation_demo3: - -pylab_examples example code: annotation_demo3.py -================================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/annotation_demo3.py - -:: - - import matplotlib.pyplot as plt - - fig, (ax1, ax2) = plt.subplots(1, 2) - - bbox_args = dict(boxstyle="round", fc="0.8") - arrow_args = dict(arrowstyle="->") - - ax1.annotate('figure fraction : 0, 0', xy=(0, 0), xycoords='figure fraction', - xytext=(20, 20), textcoords='offset points', - ha="left", va="bottom", - bbox=bbox_args, - arrowprops=arrow_args - ) - - ax1.annotate('figure fraction : 1, 1', xy=(1, 1), xycoords='figure fraction', - xytext=(-20, -20), textcoords='offset points', - ha="right", va="top", - bbox=bbox_args, - arrowprops=arrow_args - ) - - ax1.annotate('axes fraction : 0, 0', xy=(0, 0), xycoords='axes fraction', - xytext=(20, 20), textcoords='offset points', - ha="left", va="bottom", - bbox=bbox_args, - arrowprops=arrow_args - ) - - ax1.annotate('axes fraction : 1, 1', xy=(1, 1), xycoords='axes fraction', - xytext=(-20, -20), textcoords='offset points', - ha="right", va="top", - bbox=bbox_args, - arrowprops=arrow_args - ) - - - an1 = ax1.annotate('Drag me 1', xy=(.5, .7), xycoords='data', - #xytext=(.5, .7), textcoords='data', - ha="center", va="center", - bbox=bbox_args, - #arrowprops=arrow_args - ) - - an2 = ax1.annotate('Drag me 2', xy=(.5, .5), xycoords=an1, - xytext=(.5, .3), textcoords='axes fraction', - ha="center", va="center", - bbox=bbox_args, - arrowprops=dict(patchB=an1.get_bbox_patch(), - connectionstyle="arc3,rad=0.2", - **arrow_args) - ) - - an3 = ax1.annotate('', xy=(.5, .5), xycoords=an2, - xytext=(.5, .5), textcoords=an1, - ha="center", va="center", - bbox=bbox_args, - arrowprops=dict(patchA=an1.get_bbox_patch(), - patchB=an2.get_bbox_patch(), - connectionstyle="arc3,rad=0.2", - **arrow_args) - ) - - - t = ax2.annotate('xy=(0, 1)\nxycoords=("data", "axes fraction")', - xy=(0, 1), xycoords=("data", 'axes fraction'), - xytext=(0, -20), textcoords='offset points', - ha="center", va="top", - bbox=bbox_args, - arrowprops=arrow_args - ) - - from matplotlib.text import OffsetFrom - - ax2.annotate('xy=(0.5, 0)\nxycoords=artist', - xy=(0.5, 0.), xycoords=t, - xytext=(0, -20), textcoords='offset points', - ha="center", va="top", - bbox=bbox_args, - arrowprops=arrow_args - ) - - ax2.annotate('xy=(0.8, 0.5)\nxycoords=ax1.transData', - xy=(0.8, 0.5), xycoords=ax1.transData, - xytext=(10, 10), textcoords=OffsetFrom(ax2.bbox, (0, 0), "points"), - ha="left", va="bottom", - bbox=bbox_args, - arrowprops=arrow_args - ) - - ax2.set_xlim(-2, 2) - ax2.set_ylim(-2, 2) - - an1.draggable() - an2.draggable() - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/anscombe.rst.txt b/_sources/examples/pylab_examples/anscombe.rst.txt deleted file mode 100644 index 83ac3aecb5a..00000000000 --- a/_sources/examples/pylab_examples/anscombe.rst.txt +++ /dev/null @@ -1,72 +0,0 @@ -.. _pylab_examples-anscombe: - -pylab_examples example code: anscombe.py -======================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/anscombe.py - -:: - - from __future__ import print_function - """ - Edward Tufte uses this example from Anscombe to show 4 datasets of x - and y that have the same mean, standard deviation, and regression - line, but which are qualitatively different. - - matplotlib fun for a rainy day - """ - - import matplotlib.pyplot as plt - import numpy as np - - x = np.array([10, 8, 13, 9, 11, 14, 6, 4, 12, 7, 5]) - y1 = np.array([8.04, 6.95, 7.58, 8.81, 8.33, 9.96, 7.24, 4.26, 10.84, 4.82, 5.68]) - y2 = np.array([9.14, 8.14, 8.74, 8.77, 9.26, 8.10, 6.13, 3.10, 9.13, 7.26, 4.74]) - y3 = np.array([7.46, 6.77, 12.74, 7.11, 7.81, 8.84, 6.08, 5.39, 8.15, 6.42, 5.73]) - x4 = np.array([8, 8, 8, 8, 8, 8, 8, 19, 8, 8, 8]) - y4 = np.array([6.58, 5.76, 7.71, 8.84, 8.47, 7.04, 5.25, 12.50, 5.56, 7.91, 6.89]) - - - def fit(x): - return 3 + 0.5*x - - - xfit = np.array([np.amin(x), np.amax(x)]) - - plt.subplot(221) - plt.plot(x, y1, 'ks', xfit, fit(xfit), 'r-', lw=2) - plt.axis([2, 20, 2, 14]) - plt.setp(plt.gca(), xticklabels=[], yticks=(4, 8, 12), xticks=(0, 10, 20)) - plt.text(3, 12, 'I', fontsize=20) - - plt.subplot(222) - plt.plot(x, y2, 'ks', xfit, fit(xfit), 'r-', lw=2) - plt.axis([2, 20, 2, 14]) - plt.setp(plt.gca(), xticklabels=[], yticks=(4, 8, 12), yticklabels=[], xticks=(0, 10, 20)) - plt.text(3, 12, 'II', fontsize=20) - - plt.subplot(223) - plt.plot(x, y3, 'ks', xfit, fit(xfit), 'r-', lw=2) - plt.axis([2, 20, 2, 14]) - plt.text(3, 12, 'III', fontsize=20) - plt.setp(plt.gca(), yticks=(4, 8, 12), xticks=(0, 10, 20)) - - plt.subplot(224) - - xfit = np.array([np.amin(x4), np.amax(x4)]) - plt.plot(x4, y4, 'ks', xfit, fit(xfit), 'r-', lw=2) - plt.axis([2, 20, 2, 14]) - plt.setp(plt.gca(), yticklabels=[], yticks=(4, 8, 12), xticks=(0, 10, 20)) - plt.text(3, 12, 'IV', fontsize=20) - - # verify the stats - pairs = (x, y1), (x, y2), (x, y3), (x4, y4) - for x, y in pairs: - print('mean=%1.2f, std=%1.2f, r=%1.2f' % (np.mean(y), np.std(y), np.corrcoef(x, y)[0][1])) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/anscombe.txt b/_sources/examples/pylab_examples/anscombe.txt deleted file mode 100644 index ca1d8d0f239..00000000000 --- a/_sources/examples/pylab_examples/anscombe.txt +++ /dev/null @@ -1,74 +0,0 @@ -.. _pylab_examples-anscombe: - -pylab_examples example code: anscombe.py -======================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/anscombe.py - -:: - - #!/usr/bin/env python - - from __future__ import print_function - """ - Edward Tufte uses this example from Anscombe to show 4 datasets of x - and y that have the same mean, standard deviation, and regression - line, but which are qualitatively different. - - matplotlib fun for a rainy day - """ - - import matplotlib.pyplot as plt - import numpy as np - - x = np.array([10, 8, 13, 9, 11, 14, 6, 4, 12, 7, 5]) - y1 = np.array([8.04, 6.95, 7.58, 8.81, 8.33, 9.96, 7.24, 4.26, 10.84, 4.82, 5.68]) - y2 = np.array([9.14, 8.14, 8.74, 8.77, 9.26, 8.10, 6.13, 3.10, 9.13, 7.26, 4.74]) - y3 = np.array([7.46, 6.77, 12.74, 7.11, 7.81, 8.84, 6.08, 5.39, 8.15, 6.42, 5.73]) - x4 = np.array([8, 8, 8, 8, 8, 8, 8, 19, 8, 8, 8]) - y4 = np.array([6.58, 5.76, 7.71, 8.84, 8.47, 7.04, 5.25, 12.50, 5.56, 7.91, 6.89]) - - - def fit(x): - return 3 + 0.5*x - - - xfit = np.array([np.amin(x), np.amax(x)]) - - plt.subplot(221) - plt.plot(x, y1, 'ks', xfit, fit(xfit), 'r-', lw=2) - plt.axis([2, 20, 2, 14]) - plt.setp(plt.gca(), xticklabels=[], yticks=(4, 8, 12), xticks=(0, 10, 20)) - plt.text(3, 12, 'I', fontsize=20) - - plt.subplot(222) - plt.plot(x, y2, 'ks', xfit, fit(xfit), 'r-', lw=2) - plt.axis([2, 20, 2, 14]) - plt.setp(plt.gca(), xticklabels=[], yticks=(4, 8, 12), yticklabels=[], xticks=(0, 10, 20)) - plt.text(3, 12, 'II', fontsize=20) - - plt.subplot(223) - plt.plot(x, y3, 'ks', xfit, fit(xfit), 'r-', lw=2) - plt.axis([2, 20, 2, 14]) - plt.text(3, 12, 'III', fontsize=20) - plt.setp(plt.gca(), yticks=(4, 8, 12), xticks=(0, 10, 20)) - - plt.subplot(224) - - xfit = np.array([np.amin(x4), np.amax(x4)]) - plt.plot(x4, y4, 'ks', xfit, fit(xfit), 'r-', lw=2) - plt.axis([2, 20, 2, 14]) - plt.setp(plt.gca(), yticklabels=[], yticks=(4, 8, 12), xticks=(0, 10, 20)) - plt.text(3, 12, 'IV', fontsize=20) - - # verify the stats - pairs = (x, y1), (x, y2), (x, y3), (x4, y4) - for x, y in pairs: - print('mean=%1.2f, std=%1.2f, r=%1.2f' % (np.mean(y), np.std(y), np.corrcoef(x, y)[0][1])) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/arctest.rst.txt b/_sources/examples/pylab_examples/arctest.rst.txt deleted file mode 100644 index e371e6d9828..00000000000 --- a/_sources/examples/pylab_examples/arctest.rst.txt +++ /dev/null @@ -1,32 +0,0 @@ -.. _pylab_examples-arctest: - -pylab_examples example code: arctest.py -======================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/arctest.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - - def f(t): - 'a damped exponential' - s1 = np.cos(2 * np.pi * t) - e1 = np.exp(-t) - return s1 * e1 - - t1 = np.arange(0.0, 5.0, .2) - - - l = plt.plot(t1, f(t1), 'ro') - plt.setp(l, 'markersize', 30) - plt.setp(l, 'markerfacecolor', 'b') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/arctest.txt b/_sources/examples/pylab_examples/arctest.txt deleted file mode 100644 index 77f58cff65c..00000000000 --- a/_sources/examples/pylab_examples/arctest.txt +++ /dev/null @@ -1,32 +0,0 @@ -.. _pylab_examples-arctest: - -pylab_examples example code: arctest.py -======================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/arctest.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - - def f(t): - 'a damped exponential' - s1 = np.cos(2 * np.pi * t) - e1 = np.exp(-t) - return s1 * e1 - - t1 = np.arange(0.0, 5.0, .2) - - - l = plt.plot(t1, f(t1), 'ro') - plt.setp(l, 'markersize', 30) - plt.setp(l, 'markerfacecolor', 'b') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/arrow_demo.rst.txt b/_sources/examples/pylab_examples/arrow_demo.rst.txt deleted file mode 100644 index 7e7bc0aed6b..00000000000 --- a/_sources/examples/pylab_examples/arrow_demo.rst.txt +++ /dev/null @@ -1,327 +0,0 @@ -.. _pylab_examples-arrow_demo: - -pylab_examples example code: arrow_demo.py -========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/arrow_demo.py - -:: - - """Arrow drawing example for the new fancy_arrow facilities. - - Code contributed by: Rob Knight - - usage: - - python arrow_demo.py realistic|full|sample|extreme - - - """ - import matplotlib.pyplot as plt - import numpy as np - - rates_to_bases = {'r1': 'AT', 'r2': 'TA', 'r3': 'GA', 'r4': 'AG', 'r5': 'CA', - 'r6': 'AC', 'r7': 'GT', 'r8': 'TG', 'r9': 'CT', 'r10': 'TC', - 'r11': 'GC', 'r12': 'CG'} - numbered_bases_to_rates = dict([(v, k) for k, v in rates_to_bases.items()]) - lettered_bases_to_rates = dict([(v, 'r' + v) for k, v in rates_to_bases.items()]) - - - def add_dicts(d1, d2): - """Adds two dicts and returns the result.""" - result = d1.copy() - result.update(d2) - return result - - - def make_arrow_plot(data, size=4, display='length', shape='right', - max_arrow_width=0.03, arrow_sep=0.02, alpha=0.5, - normalize_data=False, ec=None, labelcolor=None, - head_starts_at_zero=True, rate_labels=lettered_bases_to_rates, - **kwargs): - """Makes an arrow plot. - - Parameters: - - data: dict with probabilities for the bases and pair transitions. - size: size of the graph in inches. - display: 'length', 'width', or 'alpha' for arrow property to change. - shape: 'full', 'left', or 'right' for full or half arrows. - max_arrow_width: maximum width of an arrow, data coordinates. - arrow_sep: separation between arrows in a pair, data coordinates. - alpha: maximum opacity of arrows, default 0.8. - - **kwargs can be anything allowed by a Arrow object, e.g. - linewidth and edgecolor. - """ - - plt.xlim(-0.5, 1.5) - plt.ylim(-0.5, 1.5) - plt.gcf().set_size_inches(size, size) - plt.xticks([]) - plt.yticks([]) - max_text_size = size*12 - min_text_size = size - label_text_size = size*2.5 - text_params = {'ha': 'center', 'va': 'center', 'family': 'sans-serif', - 'fontweight': 'bold'} - r2 = np.sqrt(2) - - deltas = { - 'AT': (1, 0), - 'TA': (-1, 0), - 'GA': (0, 1), - 'AG': (0, -1), - 'CA': (-1/r2, 1/r2), - 'AC': (1/r2, -1/r2), - 'GT': (1/r2, 1/r2), - 'TG': (-1/r2, -1/r2), - 'CT': (0, 1), - 'TC': (0, -1), - 'GC': (1, 0), - 'CG': (-1, 0) - } - - colors = { - 'AT': 'r', - 'TA': 'k', - 'GA': 'g', - 'AG': 'r', - 'CA': 'b', - 'AC': 'r', - 'GT': 'g', - 'TG': 'k', - 'CT': 'b', - 'TC': 'k', - 'GC': 'g', - 'CG': 'b' - } - - label_positions = { - 'AT': 'center', - 'TA': 'center', - 'GA': 'center', - 'AG': 'center', - 'CA': 'left', - 'AC': 'left', - 'GT': 'left', - 'TG': 'left', - 'CT': 'center', - 'TC': 'center', - 'GC': 'center', - 'CG': 'center' - } - - def do_fontsize(k): - return float(np.clip(max_text_size*np.sqrt(data[k]), - min_text_size, max_text_size)) - - A = plt.text(0, 1, '$A_3$', color='r', size=do_fontsize('A'), **text_params) - T = plt.text(1, 1, '$T_3$', color='k', size=do_fontsize('T'), **text_params) - G = plt.text(0, 0, '$G_3$', color='g', size=do_fontsize('G'), **text_params) - C = plt.text(1, 0, '$C_3$', color='b', size=do_fontsize('C'), **text_params) - - arrow_h_offset = 0.25 # data coordinates, empirically determined - max_arrow_length = 1 - 2*arrow_h_offset - - max_arrow_width = max_arrow_width - max_head_width = 2.5*max_arrow_width - max_head_length = 2*max_arrow_width - arrow_params = {'length_includes_head': True, 'shape': shape, - 'head_starts_at_zero': head_starts_at_zero} - ax = plt.gca() - sf = 0.6 # max arrow size represents this in data coords - - d = (r2/2 + arrow_h_offset - 0.5)/r2 # distance for diags - r2v = arrow_sep/r2 # offset for diags - - # tuple of x, y for start position - positions = { - 'AT': (arrow_h_offset, 1 + arrow_sep), - 'TA': (1 - arrow_h_offset, 1 - arrow_sep), - 'GA': (-arrow_sep, arrow_h_offset), - 'AG': (arrow_sep, 1 - arrow_h_offset), - 'CA': (1 - d - r2v, d - r2v), - 'AC': (d + r2v, 1 - d + r2v), - 'GT': (d - r2v, d + r2v), - 'TG': (1 - d + r2v, 1 - d - r2v), - 'CT': (1 - arrow_sep, arrow_h_offset), - 'TC': (1 + arrow_sep, 1 - arrow_h_offset), - 'GC': (arrow_h_offset, arrow_sep), - 'CG': (1 - arrow_h_offset, -arrow_sep), - } - - if normalize_data: - # find maximum value for rates, i.e. where keys are 2 chars long - max_val = 0 - for k, v in data.items(): - if len(k) == 2: - max_val = max(max_val, v) - # divide rates by max val, multiply by arrow scale factor - for k, v in data.items(): - data[k] = v/max_val*sf - - def draw_arrow(pair, alpha=alpha, ec=ec, labelcolor=labelcolor): - # set the length of the arrow - if display == 'length': - length = max_head_length + data[pair]/sf*(max_arrow_length - - max_head_length) - else: - length = max_arrow_length - # set the transparency of the arrow - if display == 'alph': - alpha = min(data[pair]/sf, alpha) - else: - alpha = alpha - # set the width of the arrow - if display == 'width': - scale = data[pair]/sf - width = max_arrow_width*scale - head_width = max_head_width*scale - head_length = max_head_length*scale - else: - width = max_arrow_width - head_width = max_head_width - head_length = max_head_length - - fc = colors[pair] - ec = ec or fc - - x_scale, y_scale = deltas[pair] - x_pos, y_pos = positions[pair] - plt.arrow(x_pos, y_pos, x_scale*length, y_scale*length, - fc=fc, ec=ec, alpha=alpha, width=width, head_width=head_width, - head_length=head_length, **arrow_params) - - # figure out coordinates for text - # if drawing relative to base: x and y are same as for arrow - # dx and dy are one arrow width left and up - # need to rotate based on direction of arrow, use x_scale and y_scale - # as sin x and cos x? - sx, cx = y_scale, x_scale - - where = label_positions[pair] - if where == 'left': - orig_position = 3*np.array([[max_arrow_width, max_arrow_width]]) - elif where == 'absolute': - orig_position = np.array([[max_arrow_length/2.0, 3*max_arrow_width]]) - elif where == 'right': - orig_position = np.array([[length - 3*max_arrow_width, - 3*max_arrow_width]]) - elif where == 'center': - orig_position = np.array([[length/2.0, 3*max_arrow_width]]) - else: - raise ValueError("Got unknown position parameter %s" % where) - - M = np.array([[cx, sx], [-sx, cx]]) - coords = np.dot(orig_position, M) + [[x_pos, y_pos]] - x, y = np.ravel(coords) - orig_label = rate_labels[pair] - label = '$%s_{_{\mathrm{%s}}}$' % (orig_label[0], orig_label[1:]) - - plt.text(x, y, label, size=label_text_size, ha='center', va='center', - color=labelcolor or fc) - - for p in sorted(positions): - draw_arrow(p) - - # test data - all_on_max = dict([(i, 1) for i in 'TCAG'] + - [(i + j, 0.6) for i in 'TCAG' for j in 'TCAG']) - - realistic_data = { - 'A': 0.4, - 'T': 0.3, - 'G': 0.5, - 'C': 0.2, - 'AT': 0.4, - 'AC': 0.3, - 'AG': 0.2, - 'TA': 0.2, - 'TC': 0.3, - 'TG': 0.4, - 'CT': 0.2, - 'CG': 0.3, - 'CA': 0.2, - 'GA': 0.1, - 'GT': 0.4, - 'GC': 0.1, - } - - extreme_data = { - 'A': 0.75, - 'T': 0.10, - 'G': 0.10, - 'C': 0.05, - 'AT': 0.6, - 'AC': 0.3, - 'AG': 0.1, - 'TA': 0.02, - 'TC': 0.3, - 'TG': 0.01, - 'CT': 0.2, - 'CG': 0.5, - 'CA': 0.2, - 'GA': 0.1, - 'GT': 0.4, - 'GC': 0.2, - } - - sample_data = { - 'A': 0.2137, - 'T': 0.3541, - 'G': 0.1946, - 'C': 0.2376, - 'AT': 0.0228, - 'AC': 0.0684, - 'AG': 0.2056, - 'TA': 0.0315, - 'TC': 0.0629, - 'TG': 0.0315, - 'CT': 0.1355, - 'CG': 0.0401, - 'CA': 0.0703, - 'GA': 0.1824, - 'GT': 0.0387, - 'GC': 0.1106, - } - - - if __name__ == '__main__': - from sys import argv - d = None - if len(argv) > 1: - if argv[1] == 'full': - d = all_on_max - scaled = False - elif argv[1] == 'extreme': - d = extreme_data - scaled = False - elif argv[1] == 'realistic': - d = realistic_data - scaled = False - elif argv[1] == 'sample': - d = sample_data - scaled = True - if d is None: - d = all_on_max - scaled = False - if len(argv) > 2: - display = argv[2] - else: - display = 'length' - - size = 4 - plt.figure(figsize=(size, size)) - - make_arrow_plot(d, display=display, linewidth=0.001, edgecolor=None, - normalize_data=scaled, head_starts_at_zero=True, size=size) - - plt.draw() - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/arrow_demo.txt b/_sources/examples/pylab_examples/arrow_demo.txt deleted file mode 100644 index 11d501d9161..00000000000 --- a/_sources/examples/pylab_examples/arrow_demo.txt +++ /dev/null @@ -1,328 +0,0 @@ -.. _pylab_examples-arrow_demo: - -pylab_examples example code: arrow_demo.py -========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/arrow_demo.py - -:: - - #!/usr/bin/env python - """Arrow drawing example for the new fancy_arrow facilities. - - Code contributed by: Rob Knight - - usage: - - python arrow_demo.py realistic|full|sample|extreme - - - """ - import matplotlib.pyplot as plt - import numpy as np - - rates_to_bases = {'r1': 'AT', 'r2': 'TA', 'r3': 'GA', 'r4': 'AG', 'r5': 'CA', - 'r6': 'AC', 'r7': 'GT', 'r8': 'TG', 'r9': 'CT', 'r10': 'TC', - 'r11': 'GC', 'r12': 'CG'} - numbered_bases_to_rates = dict([(v, k) for k, v in rates_to_bases.items()]) - lettered_bases_to_rates = dict([(v, 'r' + v) for k, v in rates_to_bases.items()]) - - - def add_dicts(d1, d2): - """Adds two dicts and returns the result.""" - result = d1.copy() - result.update(d2) - return result - - - def make_arrow_plot(data, size=4, display='length', shape='right', - max_arrow_width=0.03, arrow_sep=0.02, alpha=0.5, - normalize_data=False, ec=None, labelcolor=None, - head_starts_at_zero=True, rate_labels=lettered_bases_to_rates, - **kwargs): - """Makes an arrow plot. - - Parameters: - - data: dict with probabilities for the bases and pair transitions. - size: size of the graph in inches. - display: 'length', 'width', or 'alpha' for arrow property to change. - shape: 'full', 'left', or 'right' for full or half arrows. - max_arrow_width: maximum width of an arrow, data coordinates. - arrow_sep: separation between arrows in a pair, data coordinates. - alpha: maximum opacity of arrows, default 0.8. - - **kwargs can be anything allowed by a Arrow object, e.g. - linewidth and edgecolor. - """ - - plt.xlim(-0.5, 1.5) - plt.ylim(-0.5, 1.5) - plt.gcf().set_size_inches(size, size) - plt.xticks([]) - plt.yticks([]) - max_text_size = size*12 - min_text_size = size - label_text_size = size*2.5 - text_params = {'ha': 'center', 'va': 'center', 'family': 'sans-serif', - 'fontweight': 'bold'} - r2 = np.sqrt(2) - - deltas = { - 'AT': (1, 0), - 'TA': (-1, 0), - 'GA': (0, 1), - 'AG': (0, -1), - 'CA': (-1/r2, 1/r2), - 'AC': (1/r2, -1/r2), - 'GT': (1/r2, 1/r2), - 'TG': (-1/r2, -1/r2), - 'CT': (0, 1), - 'TC': (0, -1), - 'GC': (1, 0), - 'CG': (-1, 0) - } - - colors = { - 'AT': 'r', - 'TA': 'k', - 'GA': 'g', - 'AG': 'r', - 'CA': 'b', - 'AC': 'r', - 'GT': 'g', - 'TG': 'k', - 'CT': 'b', - 'TC': 'k', - 'GC': 'g', - 'CG': 'b' - } - - label_positions = { - 'AT': 'center', - 'TA': 'center', - 'GA': 'center', - 'AG': 'center', - 'CA': 'left', - 'AC': 'left', - 'GT': 'left', - 'TG': 'left', - 'CT': 'center', - 'TC': 'center', - 'GC': 'center', - 'CG': 'center' - } - - def do_fontsize(k): - return float(np.clip(max_text_size*np.sqrt(data[k]), - min_text_size, max_text_size)) - - A = plt.text(0, 1, '$A_3$', color='r', size=do_fontsize('A'), **text_params) - T = plt.text(1, 1, '$T_3$', color='k', size=do_fontsize('T'), **text_params) - G = plt.text(0, 0, '$G_3$', color='g', size=do_fontsize('G'), **text_params) - C = plt.text(1, 0, '$C_3$', color='b', size=do_fontsize('C'), **text_params) - - arrow_h_offset = 0.25 # data coordinates, empirically determined - max_arrow_length = 1 - 2*arrow_h_offset - - max_arrow_width = max_arrow_width - max_head_width = 2.5*max_arrow_width - max_head_length = 2*max_arrow_width - arrow_params = {'length_includes_head': True, 'shape': shape, - 'head_starts_at_zero': head_starts_at_zero} - ax = plt.gca() - sf = 0.6 # max arrow size represents this in data coords - - d = (r2/2 + arrow_h_offset - 0.5)/r2 # distance for diags - r2v = arrow_sep/r2 # offset for diags - - # tuple of x, y for start position - positions = { - 'AT': (arrow_h_offset, 1 + arrow_sep), - 'TA': (1 - arrow_h_offset, 1 - arrow_sep), - 'GA': (-arrow_sep, arrow_h_offset), - 'AG': (arrow_sep, 1 - arrow_h_offset), - 'CA': (1 - d - r2v, d - r2v), - 'AC': (d + r2v, 1 - d + r2v), - 'GT': (d - r2v, d + r2v), - 'TG': (1 - d + r2v, 1 - d - r2v), - 'CT': (1 - arrow_sep, arrow_h_offset), - 'TC': (1 + arrow_sep, 1 - arrow_h_offset), - 'GC': (arrow_h_offset, arrow_sep), - 'CG': (1 - arrow_h_offset, -arrow_sep), - } - - if normalize_data: - # find maximum value for rates, i.e. where keys are 2 chars long - max_val = 0 - for k, v in data.items(): - if len(k) == 2: - max_val = max(max_val, v) - # divide rates by max val, multiply by arrow scale factor - for k, v in data.items(): - data[k] = v/max_val*sf - - def draw_arrow(pair, alpha=alpha, ec=ec, labelcolor=labelcolor): - # set the length of the arrow - if display == 'length': - length = max_head_length + data[pair]/sf*(max_arrow_length - - max_head_length) - else: - length = max_arrow_length - # set the transparency of the arrow - if display == 'alph': - alpha = min(data[pair]/sf, alpha) - else: - alpha = alpha - # set the width of the arrow - if display == 'width': - scale = data[pair]/sf - width = max_arrow_width*scale - head_width = max_head_width*scale - head_length = max_head_length*scale - else: - width = max_arrow_width - head_width = max_head_width - head_length = max_head_length - - fc = colors[pair] - ec = ec or fc - - x_scale, y_scale = deltas[pair] - x_pos, y_pos = positions[pair] - plt.arrow(x_pos, y_pos, x_scale*length, y_scale*length, - fc=fc, ec=ec, alpha=alpha, width=width, head_width=head_width, - head_length=head_length, **arrow_params) - - # figure out coordinates for text - # if drawing relative to base: x and y are same as for arrow - # dx and dy are one arrow width left and up - # need to rotate based on direction of arrow, use x_scale and y_scale - # as sin x and cos x? - sx, cx = y_scale, x_scale - - where = label_positions[pair] - if where == 'left': - orig_position = 3*np.array([[max_arrow_width, max_arrow_width]]) - elif where == 'absolute': - orig_position = np.array([[max_arrow_length/2.0, 3*max_arrow_width]]) - elif where == 'right': - orig_position = np.array([[length - 3*max_arrow_width, - 3*max_arrow_width]]) - elif where == 'center': - orig_position = np.array([[length/2.0, 3*max_arrow_width]]) - else: - raise ValueError("Got unknown position parameter %s" % where) - - M = np.array([[cx, sx], [-sx, cx]]) - coords = np.dot(orig_position, M) + [[x_pos, y_pos]] - x, y = np.ravel(coords) - orig_label = rate_labels[pair] - label = '$%s_{_{\mathrm{%s}}}$' % (orig_label[0], orig_label[1:]) - - plt.text(x, y, label, size=label_text_size, ha='center', va='center', - color=labelcolor or fc) - - for p in positions.keys(): - draw_arrow(p) - - # test data - all_on_max = dict([(i, 1) for i in 'TCAG'] + - [(i + j, 0.6) for i in 'TCAG' for j in 'TCAG']) - - realistic_data = { - 'A': 0.4, - 'T': 0.3, - 'G': 0.5, - 'C': 0.2, - 'AT': 0.4, - 'AC': 0.3, - 'AG': 0.2, - 'TA': 0.2, - 'TC': 0.3, - 'TG': 0.4, - 'CT': 0.2, - 'CG': 0.3, - 'CA': 0.2, - 'GA': 0.1, - 'GT': 0.4, - 'GC': 0.1, - } - - extreme_data = { - 'A': 0.75, - 'T': 0.10, - 'G': 0.10, - 'C': 0.05, - 'AT': 0.6, - 'AC': 0.3, - 'AG': 0.1, - 'TA': 0.02, - 'TC': 0.3, - 'TG': 0.01, - 'CT': 0.2, - 'CG': 0.5, - 'CA': 0.2, - 'GA': 0.1, - 'GT': 0.4, - 'GC': 0.2, - } - - sample_data = { - 'A': 0.2137, - 'T': 0.3541, - 'G': 0.1946, - 'C': 0.2376, - 'AT': 0.0228, - 'AC': 0.0684, - 'AG': 0.2056, - 'TA': 0.0315, - 'TC': 0.0629, - 'TG': 0.0315, - 'CT': 0.1355, - 'CG': 0.0401, - 'CA': 0.0703, - 'GA': 0.1824, - 'GT': 0.0387, - 'GC': 0.1106, - } - - - if __name__ == '__main__': - from sys import argv - d = None - if len(argv) > 1: - if argv[1] == 'full': - d = all_on_max - scaled = False - elif argv[1] == 'extreme': - d = extreme_data - scaled = False - elif argv[1] == 'realistic': - d = realistic_data - scaled = False - elif argv[1] == 'sample': - d = sample_data - scaled = True - if d is None: - d = all_on_max - scaled = False - if len(argv) > 2: - display = argv[2] - else: - display = 'length' - - size = 4 - plt.figure(figsize=(size, size)) - - make_arrow_plot(d, display=display, linewidth=0.001, edgecolor=None, - normalize_data=scaled, head_starts_at_zero=True, size=size) - - plt.draw() - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/arrow_simple_demo.rst.txt b/_sources/examples/pylab_examples/arrow_simple_demo.rst.txt deleted file mode 100644 index edc60bbae79..00000000000 --- a/_sources/examples/pylab_examples/arrow_simple_demo.rst.txt +++ /dev/null @@ -1,19 +0,0 @@ -.. _pylab_examples-arrow_simple_demo: - -pylab_examples example code: arrow_simple_demo.py -================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/arrow_simple_demo.py - -:: - - import matplotlib.pyplot as plt - - ax = plt.axes() - ax.arrow(0, 0, 0.5, 0.5, head_width=0.05, head_length=0.1, fc='k', ec='k') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/arrow_simple_demo.txt b/_sources/examples/pylab_examples/arrow_simple_demo.txt deleted file mode 100644 index 9c99020335a..00000000000 --- a/_sources/examples/pylab_examples/arrow_simple_demo.txt +++ /dev/null @@ -1,19 +0,0 @@ -.. _pylab_examples-arrow_simple_demo: - -pylab_examples example code: arrow_simple_demo.py -================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/arrow_simple_demo.py - -:: - - import matplotlib.pyplot as plt - - ax = plt.axes() - ax.arrow(0, 0, 0.5, 0.5, head_width=0.05, head_length=0.1, fc='k', ec='k') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/aspect_loglog.rst.txt b/_sources/examples/pylab_examples/aspect_loglog.rst.txt deleted file mode 100644 index 8e61cf01841..00000000000 --- a/_sources/examples/pylab_examples/aspect_loglog.rst.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _pylab_examples-aspect_loglog: - -pylab_examples example code: aspect_loglog.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/aspect_loglog.py - -:: - - import matplotlib.pyplot as plt - - fig, (ax1, ax2) = plt.subplots(1, 2) - ax1.set_xscale("log") - ax1.set_yscale("log") - ax1.set_xlim(1e1, 1e3) - ax1.set_ylim(1e2, 1e3) - ax1.set_aspect(1) - ax1.set_title("adjustable = box") - - ax2.set_xscale("log") - ax2.set_yscale("log") - ax2.set_adjustable("datalim") - ax2.plot([1, 3, 10], [1, 9, 100], "o-") - ax2.set_xlim(1e-1, 1e2) - ax2.set_ylim(1e-1, 1e3) - ax2.set_aspect(1) - ax2.set_title("adjustable = datalim") - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/aspect_loglog.txt b/_sources/examples/pylab_examples/aspect_loglog.txt deleted file mode 100644 index 997297bf9d4..00000000000 --- a/_sources/examples/pylab_examples/aspect_loglog.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _pylab_examples-aspect_loglog: - -pylab_examples example code: aspect_loglog.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/aspect_loglog.py - -:: - - import matplotlib.pyplot as plt - - fig, (ax1, ax2) = plt.subplots(1, 2) - ax1.set_xscale("log") - ax1.set_yscale("log") - ax1.set_xlim(1e1, 1e3) - ax1.set_ylim(1e2, 1e3) - ax1.set_aspect(1) - ax1.set_title("adjustable = box") - - ax2.set_xscale("log") - ax2.set_yscale("log") - ax2.set_adjustable("datalim") - ax2.plot([1, 3, 10], [1, 9, 100], "o-") - ax2.set_xlim(1e-1, 1e2) - ax2.set_ylim(1e-1, 1e3) - ax2.set_aspect(1) - ax2.set_title("adjustable = datalim") - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/axes_demo.rst.txt b/_sources/examples/pylab_examples/axes_demo.rst.txt deleted file mode 100644 index aeabef02b36..00000000000 --- a/_sources/examples/pylab_examples/axes_demo.rst.txt +++ /dev/null @@ -1,47 +0,0 @@ -.. _pylab_examples-axes_demo: - -pylab_examples example code: axes_demo.py -========================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/axes_demo.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - # create some data to use for the plot - dt = 0.001 - t = np.arange(0.0, 10.0, dt) - r = np.exp(-t[:1000]/0.05) # impulse response - x = np.random.randn(len(t)) - s = np.convolve(x, r)[:len(x)]*dt # colored noise - - # the main axes is subplot(111) by default - plt.plot(t, s) - plt.axis([0, 1, 1.1*np.amin(s), 2*np.amax(s)]) - plt.xlabel('time (s)') - plt.ylabel('current (nA)') - plt.title('Gaussian colored noise') - - # this is an inset axes over the main axes - a = plt.axes([.65, .6, .2, .2], facecolor='y') - n, bins, patches = plt.hist(s, 400, normed=1) - plt.title('Probability') - plt.xticks([]) - plt.yticks([]) - - # this is another inset axes over the main axes - a = plt.axes([0.2, 0.6, .2, .2], facecolor='y') - plt.plot(t[:len(r)], r) - plt.title('Impulse response') - plt.xlim(0, 0.2) - plt.xticks([]) - plt.yticks([]) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/axes_demo.txt b/_sources/examples/pylab_examples/axes_demo.txt deleted file mode 100644 index ca44228e175..00000000000 --- a/_sources/examples/pylab_examples/axes_demo.txt +++ /dev/null @@ -1,47 +0,0 @@ -.. _pylab_examples-axes_demo: - -pylab_examples example code: axes_demo.py -========================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/axes_demo.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - # create some data to use for the plot - dt = 0.001 - t = np.arange(0.0, 10.0, dt) - r = np.exp(-t[:1000]/0.05) # impulse response - x = np.random.randn(len(t)) - s = np.convolve(x, r)[:len(x)]*dt # colored noise - - # the main axes is subplot(111) by default - plt.plot(t, s) - plt.axis([0, 1, 1.1*np.amin(s), 2*np.amax(s)]) - plt.xlabel('time (s)') - plt.ylabel('current (nA)') - plt.title('Gaussian colored noise') - - # this is an inset axes over the main axes - a = plt.axes([.65, .6, .2, .2], axisbg='y') - n, bins, patches = plt.hist(s, 400, normed=1) - plt.title('Probability') - plt.xticks([]) - plt.yticks([]) - - # this is another inset axes over the main axes - a = plt.axes([0.2, 0.6, .2, .2], axisbg='y') - plt.plot(t[:len(r)], r) - plt.title('Impulse response') - plt.xlim(0, 0.2) - plt.xticks([]) - plt.yticks([]) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/axes_props.rst.txt b/_sources/examples/pylab_examples/axes_props.rst.txt deleted file mode 100644 index b8543e46a33..00000000000 --- a/_sources/examples/pylab_examples/axes_props.rst.txt +++ /dev/null @@ -1,42 +0,0 @@ -.. _pylab_examples-axes_props: - -pylab_examples example code: axes_props.py -========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/axes_props.py - -:: - - """ - You can control the axis tick and grid properties - """ - - import matplotlib.pyplot as plt - import numpy as np - - t = np.arange(0.0, 2.0, 0.01) - s = np.sin(2 * np.pi * t) - fig, ax = plt.subplots() - ax.plot(t, s) - ax.grid(True) - - ticklines = ax.get_xticklines() + ax.get_yticklines() - gridlines = ax.get_xgridlines() + ax.get_ygridlines() - ticklabels = ax.get_xticklabels() + ax.get_yticklabels() - - for line in ticklines: - line.set_linewidth(3) - - for line in gridlines: - line.set_linestyle('-.') - - for label in ticklabels: - label.set_color('r') - label.set_fontsize('medium') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/axes_props.txt b/_sources/examples/pylab_examples/axes_props.txt deleted file mode 100644 index 5c3a103df84..00000000000 --- a/_sources/examples/pylab_examples/axes_props.txt +++ /dev/null @@ -1,42 +0,0 @@ -.. _pylab_examples-axes_props: - -pylab_examples example code: axes_props.py -========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/axes_props.py - -:: - - """ - You can control the axis tick and grid properties - """ - - import matplotlib.pyplot as plt - import numpy as np - - t = np.arange(0.0, 2.0, 0.01) - s = np.sin(2 * np.pi * t) - fig, ax = plt.subplots() - ax.plot(t, s) - ax.grid(True) - - ticklines = ax.get_xticklines() + ax.get_yticklines() - gridlines = ax.get_xgridlines() + ax.get_ygridlines() - ticklabels = ax.get_xticklabels() + ax.get_yticklabels() - - for line in ticklines: - line.set_linewidth(3) - - for line in gridlines: - line.set_linestyle('-') - - for label in ticklabels: - label.set_color('r') - label.set_fontsize('medium') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/axes_zoom_effect.rst.txt b/_sources/examples/pylab_examples/axes_zoom_effect.rst.txt deleted file mode 100644 index bd36cfac2fe..00000000000 --- a/_sources/examples/pylab_examples/axes_zoom_effect.rst.txt +++ /dev/null @@ -1,132 +0,0 @@ -.. _pylab_examples-axes_zoom_effect: - -pylab_examples example code: axes_zoom_effect.py -================================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/axes_zoom_effect.py - -:: - - from matplotlib.transforms import Bbox, TransformedBbox, \ - blended_transform_factory - - from mpl_toolkits.axes_grid1.inset_locator import BboxPatch, BboxConnector,\ - BboxConnectorPatch - - - def connect_bbox(bbox1, bbox2, - loc1a, loc2a, loc1b, loc2b, - prop_lines, prop_patches=None): - if prop_patches is None: - prop_patches = prop_lines.copy() - prop_patches["alpha"] = prop_patches.get("alpha", 1)*0.2 - - c1 = BboxConnector(bbox1, bbox2, loc1=loc1a, loc2=loc2a, **prop_lines) - c1.set_clip_on(False) - c2 = BboxConnector(bbox1, bbox2, loc1=loc1b, loc2=loc2b, **prop_lines) - c2.set_clip_on(False) - - bbox_patch1 = BboxPatch(bbox1, **prop_patches) - bbox_patch2 = BboxPatch(bbox2, **prop_patches) - - p = BboxConnectorPatch(bbox1, bbox2, - # loc1a=3, loc2a=2, loc1b=4, loc2b=1, - loc1a=loc1a, loc2a=loc2a, loc1b=loc1b, loc2b=loc2b, - **prop_patches) - p.set_clip_on(False) - - return c1, c2, bbox_patch1, bbox_patch2, p - - - def zoom_effect01(ax1, ax2, xmin, xmax, **kwargs): - """ - ax1 : the main axes - ax1 : the zoomed axes - (xmin,xmax) : the limits of the colored area in both plot axes. - - connect ax1 & ax2. The x-range of (xmin, xmax) in both axes will - be marked. The keywords parameters will be used ti create - patches. - - """ - - trans1 = blended_transform_factory(ax1.transData, ax1.transAxes) - trans2 = blended_transform_factory(ax2.transData, ax2.transAxes) - - bbox = Bbox.from_extents(xmin, 0, xmax, 1) - - mybbox1 = TransformedBbox(bbox, trans1) - mybbox2 = TransformedBbox(bbox, trans2) - - prop_patches = kwargs.copy() - prop_patches["ec"] = "none" - prop_patches["alpha"] = 0.2 - - c1, c2, bbox_patch1, bbox_patch2, p = \ - connect_bbox(mybbox1, mybbox2, - loc1a=3, loc2a=2, loc1b=4, loc2b=1, - prop_lines=kwargs, prop_patches=prop_patches) - - ax1.add_patch(bbox_patch1) - ax2.add_patch(bbox_patch2) - ax2.add_patch(c1) - ax2.add_patch(c2) - ax2.add_patch(p) - - return c1, c2, bbox_patch1, bbox_patch2, p - - - def zoom_effect02(ax1, ax2, **kwargs): - """ - ax1 : the main axes - ax1 : the zoomed axes - - Similar to zoom_effect01. The xmin & xmax will be taken from the - ax1.viewLim. - """ - - tt = ax1.transScale + (ax1.transLimits + ax2.transAxes) - trans = blended_transform_factory(ax2.transData, tt) - - mybbox1 = ax1.bbox - mybbox2 = TransformedBbox(ax1.viewLim, trans) - - prop_patches = kwargs.copy() - prop_patches["ec"] = "none" - prop_patches["alpha"] = 0.2 - - c1, c2, bbox_patch1, bbox_patch2, p = \ - connect_bbox(mybbox1, mybbox2, - loc1a=3, loc2a=2, loc1b=4, loc2b=1, - prop_lines=kwargs, prop_patches=prop_patches) - - ax1.add_patch(bbox_patch1) - ax2.add_patch(bbox_patch2) - ax2.add_patch(c1) - ax2.add_patch(c2) - ax2.add_patch(p) - - return c1, c2, bbox_patch1, bbox_patch2, p - - - import matplotlib.pyplot as plt - - plt.figure(1, figsize=(5, 5)) - ax1 = plt.subplot(221) - ax2 = plt.subplot(212) - ax2.set_xlim(0, 1) - ax2.set_xlim(0, 5) - zoom_effect01(ax1, ax2, 0.2, 0.8) - - - ax1 = plt.subplot(222) - ax1.set_xlim(2, 3) - ax2.set_xlim(0, 5) - zoom_effect02(ax1, ax2) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/axes_zoom_effect.txt b/_sources/examples/pylab_examples/axes_zoom_effect.txt deleted file mode 100644 index 451e3f3cf0d..00000000000 --- a/_sources/examples/pylab_examples/axes_zoom_effect.txt +++ /dev/null @@ -1,132 +0,0 @@ -.. _pylab_examples-axes_zoom_effect: - -pylab_examples example code: axes_zoom_effect.py -================================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/axes_zoom_effect.py - -:: - - from matplotlib.transforms import Bbox, TransformedBbox, \ - blended_transform_factory - - from mpl_toolkits.axes_grid1.inset_locator import BboxPatch, BboxConnector,\ - BboxConnectorPatch - - - def connect_bbox(bbox1, bbox2, - loc1a, loc2a, loc1b, loc2b, - prop_lines, prop_patches=None): - if prop_patches is None: - prop_patches = prop_lines.copy() - prop_patches["alpha"] = prop_patches.get("alpha", 1)*0.2 - - c1 = BboxConnector(bbox1, bbox2, loc1=loc1a, loc2=loc2a, **prop_lines) - c1.set_clip_on(False) - c2 = BboxConnector(bbox1, bbox2, loc1=loc1b, loc2=loc2b, **prop_lines) - c2.set_clip_on(False) - - bbox_patch1 = BboxPatch(bbox1, **prop_patches) - bbox_patch2 = BboxPatch(bbox2, **prop_patches) - - p = BboxConnectorPatch(bbox1, bbox2, - # loc1a=3, loc2a=2, loc1b=4, loc2b=1, - loc1a=loc1a, loc2a=loc2a, loc1b=loc1b, loc2b=loc2b, - **prop_patches) - p.set_clip_on(False) - - return c1, c2, bbox_patch1, bbox_patch2, p - - - def zoom_effect01(ax1, ax2, xmin, xmax, **kwargs): - """ - ax1 : the main axes - ax1 : the zoomed axes - (xmin,xmax) : the limits of the colored area in both plot axes. - - connect ax1 & ax2. The x-range of (xmin, xmax) in both axes will - be marked. The keywords parameters will be used ti create - patches. - - """ - - trans1 = blended_transform_factory(ax1.transData, ax1.transAxes) - trans2 = blended_transform_factory(ax2.transData, ax2.transAxes) - - bbox = Bbox.from_extents(xmin, 0, xmax, 1) - - mybbox1 = TransformedBbox(bbox, trans1) - mybbox2 = TransformedBbox(bbox, trans2) - - prop_patches = kwargs.copy() - prop_patches["ec"] = "none" - prop_patches["alpha"] = 0.2 - - c1, c2, bbox_patch1, bbox_patch2, p = \ - connect_bbox(mybbox1, mybbox2, - loc1a=3, loc2a=2, loc1b=4, loc2b=1, - prop_lines=kwargs, prop_patches=prop_patches) - - ax1.add_patch(bbox_patch1) - ax2.add_patch(bbox_patch2) - ax2.add_patch(c1) - ax2.add_patch(c2) - ax2.add_patch(p) - - return c1, c2, bbox_patch1, bbox_patch2, p - - - def zoom_effect02(ax1, ax2, **kwargs): - """ - ax1 : the main axes - ax1 : the zoomed axes - - Similar to zoom_effect01. The xmin & xmax will be taken from the - ax1.viewLim. - """ - - tt = ax1.transScale + (ax1.transLimits + ax2.transAxes) - trans = blended_transform_factory(ax2.transData, tt) - - mybbox1 = ax1.bbox - mybbox2 = TransformedBbox(ax1.viewLim, trans) - - prop_patches = kwargs.copy() - prop_patches["ec"] = "none" - prop_patches["alpha"] = 0.2 - - c1, c2, bbox_patch1, bbox_patch2, p = \ - connect_bbox(mybbox1, mybbox2, - loc1a=3, loc2a=2, loc1b=4, loc2b=1, - prop_lines=kwargs, prop_patches=prop_patches) - - ax1.add_patch(bbox_patch1) - ax2.add_patch(bbox_patch2) - ax2.add_patch(c1) - ax2.add_patch(c2) - ax2.add_patch(p) - - return c1, c2, bbox_patch1, bbox_patch2, p - - - import matplotlib.pyplot as plt - - plt.figure(1, figsize=(5, 5)) - ax1 = plt.subplot(221) - ax2 = plt.subplot(212) - ax2.set_xlim(0, 1) - ax2.set_xlim(0, 5) - zoom_effect01(ax1, ax2, 0.2, 0.8) - - - ax1 = plt.subplot(222) - ax1.set_xlim(2, 3) - ax2.set_xlim(0, 5) - zoom_effect02(ax1, ax2) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/axhspan_demo.rst.txt b/_sources/examples/pylab_examples/axhspan_demo.rst.txt deleted file mode 100644 index 75256d30f8a..00000000000 --- a/_sources/examples/pylab_examples/axhspan_demo.rst.txt +++ /dev/null @@ -1,46 +0,0 @@ -.. _pylab_examples-axhspan_demo: - -pylab_examples example code: axhspan_demo.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/axhspan_demo.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - - t = np.arange(-1, 2, .01) - s = np.sin(2*np.pi*t) - - plt.plot(t, s) - # draw a thick red hline at y=0 that spans the xrange - l = plt.axhline(linewidth=8, color='#d62728') - - # draw a default hline at y=1 that spans the xrange - l = plt.axhline(y=1) - - # draw a default vline at x=1 that spans the yrange - l = plt.axvline(x=1) - - # draw a thick blue vline at x=0 that spans the upper quadrant of - # the yrange - l = plt.axvline(x=0, ymin=0.75, linewidth=8, color='#1f77b4') - - # draw a default hline at y=.5 that spans the middle half of - # the axes - l = plt.axhline(y=.5, xmin=0.25, xmax=0.75) - - p = plt.axhspan(0.25, 0.75, facecolor='0.5', alpha=0.5) - - p = plt.axvspan(1.25, 1.55, facecolor='#2ca02c', alpha=0.5) - - plt.axis([-1, 2, -1, 2]) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/axhspan_demo.txt b/_sources/examples/pylab_examples/axhspan_demo.txt deleted file mode 100644 index 1ae841ff1c7..00000000000 --- a/_sources/examples/pylab_examples/axhspan_demo.txt +++ /dev/null @@ -1,46 +0,0 @@ -.. _pylab_examples-axhspan_demo: - -pylab_examples example code: axhspan_demo.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/axhspan_demo.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - - t = np.arange(-1, 2, .01) - s = np.sin(2*np.pi*t) - - plt.plot(t, s) - # draw a thick red hline at y=0 that spans the xrange - l = plt.axhline(linewidth=4, color='r') - - # draw a default hline at y=1 that spans the xrange - l = plt.axhline(y=1) - - # draw a default vline at x=1 that spans the yrange - l = plt.axvline(x=1) - - # draw a thick blue vline at x=0 that spans the upper quadrant of - # the yrange - l = plt.axvline(x=0, ymin=0.75, linewidth=4, color='b') - - # draw a default hline at y=.5 that spans the middle half of - # the axes - l = plt.axhline(y=.5, xmin=0.25, xmax=0.75) - - p = plt.axhspan(0.25, 0.75, facecolor='0.5', alpha=0.5) - - p = plt.axvspan(1.25, 1.55, facecolor='g', alpha=0.5) - - plt.axis([-1, 2, -1, 2]) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/axis_equal_demo.rst.txt b/_sources/examples/pylab_examples/axis_equal_demo.rst.txt deleted file mode 100644 index deb3a9f6d0b..00000000000 --- a/_sources/examples/pylab_examples/axis_equal_demo.rst.txt +++ /dev/null @@ -1,46 +0,0 @@ -.. _pylab_examples-axis_equal_demo: - -pylab_examples example code: axis_equal_demo.py -=============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/axis_equal_demo.py - -:: - - '''This example is only interesting when ran in interactive mode''' - - import matplotlib.pyplot as plt - import numpy as np - - # Plot circle or radius 3 - - an = np.linspace(0, 2*np.pi, 100) - - plt.subplot(221) - plt.plot(3*np.cos(an), 3*np.sin(an)) - plt.title('not equal, looks like ellipse', fontsize=10) - - plt.subplot(222) - plt.plot(3*np.cos(an), 3*np.sin(an)) - plt.axis('equal') - plt.title('equal, looks like circle', fontsize=10) - - plt.subplot(223) - plt.plot(3*np.cos(an), 3*np.sin(an)) - plt.axis('equal') - plt.axis([-3, 3, -3, 3]) - plt.title('looks like circle, even after changing limits', fontsize=10) - - plt.subplot(224) - plt.plot(3*np.cos(an), 3*np.sin(an)) - plt.axis('equal') - plt.axis([-3, 3, -3, 3]) - plt.plot([0, 4], [0, 4]) - plt.title('still equal after adding line', fontsize=10) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/axis_equal_demo.txt b/_sources/examples/pylab_examples/axis_equal_demo.txt deleted file mode 100644 index ea515237703..00000000000 --- a/_sources/examples/pylab_examples/axis_equal_demo.txt +++ /dev/null @@ -1,46 +0,0 @@ -.. _pylab_examples-axis_equal_demo: - -pylab_examples example code: axis_equal_demo.py -=============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/axis_equal_demo.py - -:: - - '''This example is only interesting when ran in interactive mode''' - - import matplotlib.pyplot as plt - import numpy as np - - # Plot circle or radius 3 - - an = np.linspace(0, 2*np.pi, 100) - - plt.subplot(221) - plt.plot(3*np.cos(an), 3*np.sin(an)) - plt.title('not equal, looks like ellipse', fontsize=10) - - plt.subplot(222) - plt.plot(3*np.cos(an), 3*np.sin(an)) - plt.axis('equal') - plt.title('equal, looks like circle', fontsize=10) - - plt.subplot(223) - plt.plot(3*np.cos(an), 3*np.sin(an)) - plt.axis('equal') - plt.axis([-3, 3, -3, 3]) - plt.title('looks like circle, even after changing limits', fontsize=10) - - plt.subplot(224) - plt.plot(3*np.cos(an), 3*np.sin(an)) - plt.axis('equal') - plt.axis([-3, 3, -3, 3]) - plt.plot([0, 4], [0, 4]) - plt.title('still equal after adding line', fontsize=10) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/bar_stacked.rst.txt b/_sources/examples/pylab_examples/bar_stacked.rst.txt deleted file mode 100644 index 944fe216bc5..00000000000 --- a/_sources/examples/pylab_examples/bar_stacked.rst.txt +++ /dev/null @@ -1,38 +0,0 @@ -.. _pylab_examples-bar_stacked: - -pylab_examples example code: bar_stacked.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/bar_stacked.py - -:: - - # a stacked bar plot with errorbars - import numpy as np - import matplotlib.pyplot as plt - - - N = 5 - menMeans = (20, 35, 30, 35, 27) - womenMeans = (25, 32, 34, 20, 25) - menStd = (2, 3, 4, 1, 2) - womenStd = (3, 5, 2, 3, 3) - ind = np.arange(N) # the x locations for the groups - width = 0.35 # the width of the bars: can also be len(x) sequence - - p1 = plt.bar(ind, menMeans, width, color='#d62728', yerr=menStd) - p2 = plt.bar(ind, womenMeans, width, - bottom=menMeans, yerr=womenStd) - - plt.ylabel('Scores') - plt.title('Scores by group and gender') - plt.xticks(ind, ('G1', 'G2', 'G3', 'G4', 'G5')) - plt.yticks(np.arange(0, 81, 10)) - plt.legend((p1[0], p2[0]), ('Men', 'Women')) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/bar_stacked.txt b/_sources/examples/pylab_examples/bar_stacked.txt deleted file mode 100644 index fc8264e3779..00000000000 --- a/_sources/examples/pylab_examples/bar_stacked.txt +++ /dev/null @@ -1,39 +0,0 @@ -.. _pylab_examples-bar_stacked: - -pylab_examples example code: bar_stacked.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/bar_stacked.py - -:: - - #!/usr/bin/env python - # a stacked bar plot with errorbars - import numpy as np - import matplotlib.pyplot as plt - - - N = 5 - menMeans = (20, 35, 30, 35, 27) - womenMeans = (25, 32, 34, 20, 25) - menStd = (2, 3, 4, 1, 2) - womenStd = (3, 5, 2, 3, 3) - ind = np.arange(N) # the x locations for the groups - width = 0.35 # the width of the bars: can also be len(x) sequence - - p1 = plt.bar(ind, menMeans, width, color='r', yerr=menStd) - p2 = plt.bar(ind, womenMeans, width, color='y', - bottom=menMeans, yerr=womenStd) - - plt.ylabel('Scores') - plt.title('Scores by group and gender') - plt.xticks(ind + width/2., ('G1', 'G2', 'G3', 'G4', 'G5')) - plt.yticks(np.arange(0, 81, 10)) - plt.legend((p1[0], p2[0]), ('Men', 'Women')) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/barb_demo.rst.txt b/_sources/examples/pylab_examples/barb_demo.rst.txt deleted file mode 100644 index 73c831dc183..00000000000 --- a/_sources/examples/pylab_examples/barb_demo.rst.txt +++ /dev/null @@ -1,67 +0,0 @@ -.. _pylab_examples-barb_demo: - -pylab_examples example code: barb_demo.py -========================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/barb_demo.py - -:: - - ''' - Demonstration of wind barb plots - ''' - import matplotlib.pyplot as plt - import numpy as np - - x = np.linspace(-5, 5, 5) - X, Y = np.meshgrid(x, x) - U, V = 12*X, 12*Y - - data = [(-1.5, .5, -6, -6), - (1, -1, -46, 46), - (-3, -1, 11, -11), - (1, 1.5, 80, 80), - (0.5, 0.25, 25, 15), - (-1.5, -0.5, -5, 40)] - - data = np.array(data, dtype=[('x', np.float32), ('y', np.float32), - ('u', np.float32), ('v', np.float32)]) - - # Default parameters, uniform grid - ax = plt.subplot(2, 2, 1) - ax.barbs(X, Y, U, V) - - # Arbitrary set of vectors, make them longer and change the pivot point - #(point around which they're rotated) to be the middle - ax = plt.subplot(2, 2, 2) - ax.barbs(data['x'], data['y'], data['u'], data['v'], length=8, pivot='middle') - - # Showing colormapping with uniform grid. Fill the circle for an empty barb, - # don't round the values, and change some of the size parameters - ax = plt.subplot(2, 2, 3) - ax.barbs(X, Y, U, V, np.sqrt(U*U + V*V), fill_empty=True, rounding=False, - sizes=dict(emptybarb=0.25, spacing=0.2, height=0.3)) - - # Change colors as well as the increments for parts of the barbs - ax = plt.subplot(2, 2, 4) - ax.barbs(data['x'], data['y'], data['u'], data['v'], flagcolor='r', - barbcolor=['b', 'g'], barb_increments=dict(half=10, full=20, flag=100), - flip_barb=True) - - # Masked arrays are also supported - masked_u = np.ma.masked_array(data['u']) - masked_u[4] = 1000 # Bad value that should not be plotted when masked - masked_u[4] = np.ma.masked - - # Identical plot to panel 2 in the first figure, but with the point at - #(0.5, 0.25) missing (masked) - fig2 = plt.figure() - ax = fig2.add_subplot(1, 1, 1) - ax.barbs(data['x'], data['y'], masked_u, data['v'], length=8, pivot='middle') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/barb_demo.txt b/_sources/examples/pylab_examples/barb_demo.txt deleted file mode 100644 index c34b7a5b886..00000000000 --- a/_sources/examples/pylab_examples/barb_demo.txt +++ /dev/null @@ -1,67 +0,0 @@ -.. _pylab_examples-barb_demo: - -pylab_examples example code: barb_demo.py -========================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/barb_demo.py - -:: - - ''' - Demonstration of wind barb plots - ''' - import matplotlib.pyplot as plt - import numpy as np - - x = np.linspace(-5, 5, 5) - X, Y = np.meshgrid(x, x) - U, V = 12*X, 12*Y - - data = [(-1.5, .5, -6, -6), - (1, -1, -46, 46), - (-3, -1, 11, -11), - (1, 1.5, 80, 80), - (0.5, 0.25, 25, 15), - (-1.5, -0.5, -5, 40)] - - data = np.array(data, dtype=[('x', np.float32), ('y', np.float32), - ('u', np.float32), ('v', np.float32)]) - - # Default parameters, uniform grid - ax = plt.subplot(2, 2, 1) - ax.barbs(X, Y, U, V) - - # Arbitrary set of vectors, make them longer and change the pivot point - #(point around which they're rotated) to be the middle - ax = plt.subplot(2, 2, 2) - ax.barbs(data['x'], data['y'], data['u'], data['v'], length=8, pivot='middle') - - # Showing colormapping with uniform grid. Fill the circle for an empty barb, - # don't round the values, and change some of the size parameters - ax = plt.subplot(2, 2, 3) - ax.barbs(X, Y, U, V, np.sqrt(U*U + V*V), fill_empty=True, rounding=False, - sizes=dict(emptybarb=0.25, spacing=0.2, height=0.3)) - - # Change colors as well as the increments for parts of the barbs - ax = plt.subplot(2, 2, 4) - ax.barbs(data['x'], data['y'], data['u'], data['v'], flagcolor='r', - barbcolor=['b', 'g'], barb_increments=dict(half=10, full=20, flag=100), - flip_barb=True) - - # Masked arrays are also supported - masked_u = np.ma.masked_array(data['u']) - masked_u[4] = 1000 # Bad value that should not be plotted when masked - masked_u[4] = np.ma.masked - - # Identical plot to panel 2 in the first figure, but with the point at - #(0.5, 0.25) missing (masked) - fig2 = plt.figure() - ax = fig2.add_subplot(1, 1, 1) - ax.barbs(data['x'], data['y'], masked_u, data['v'], length=8, pivot='middle') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/barchart_demo.rst.txt b/_sources/examples/pylab_examples/barchart_demo.rst.txt deleted file mode 100644 index c6759b56839..00000000000 --- a/_sources/examples/pylab_examples/barchart_demo.rst.txt +++ /dev/null @@ -1,59 +0,0 @@ -.. _pylab_examples-barchart_demo: - -pylab_examples example code: barchart_demo.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/barchart_demo.py - -:: - - """ - Bar chart demo with pairs of bars grouped for easy comparison. - """ - import numpy as np - import matplotlib.pyplot as plt - - - n_groups = 5 - - means_men = (20, 35, 30, 35, 27) - std_men = (2, 3, 4, 1, 2) - - means_women = (25, 32, 34, 20, 25) - std_women = (3, 5, 2, 3, 3) - - fig, ax = plt.subplots() - - index = np.arange(n_groups) - bar_width = 0.35 - - opacity = 0.4 - error_config = {'ecolor': '0.3'} - - rects1 = plt.bar(index, means_men, bar_width, - alpha=opacity, - color='b', - yerr=std_men, - error_kw=error_config, - label='Men') - - rects2 = plt.bar(index + bar_width, means_women, bar_width, - alpha=opacity, - color='r', - yerr=std_women, - error_kw=error_config, - label='Women') - - plt.xlabel('Group') - plt.ylabel('Scores') - plt.title('Scores by group and gender') - plt.xticks(index + bar_width / 2, ('A', 'B', 'C', 'D', 'E')) - plt.legend() - - plt.tight_layout() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/barchart_demo.txt b/_sources/examples/pylab_examples/barchart_demo.txt deleted file mode 100644 index 9e959cf027d..00000000000 --- a/_sources/examples/pylab_examples/barchart_demo.txt +++ /dev/null @@ -1,59 +0,0 @@ -.. _pylab_examples-barchart_demo: - -pylab_examples example code: barchart_demo.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/barchart_demo.py - -:: - - """ - Bar chart demo with pairs of bars grouped for easy comparison. - """ - import numpy as np - import matplotlib.pyplot as plt - - - n_groups = 5 - - means_men = (20, 35, 30, 35, 27) - std_men = (2, 3, 4, 1, 2) - - means_women = (25, 32, 34, 20, 25) - std_women = (3, 5, 2, 3, 3) - - fig, ax = plt.subplots() - - index = np.arange(n_groups) - bar_width = 0.35 - - opacity = 0.4 - error_config = {'ecolor': '0.3'} - - rects1 = plt.bar(index, means_men, bar_width, - alpha=opacity, - color='b', - yerr=std_men, - error_kw=error_config, - label='Men') - - rects2 = plt.bar(index + bar_width, means_women, bar_width, - alpha=opacity, - color='r', - yerr=std_women, - error_kw=error_config, - label='Women') - - plt.xlabel('Group') - plt.ylabel('Scores') - plt.title('Scores by group and gender') - plt.xticks(index + bar_width, ('A', 'B', 'C', 'D', 'E')) - plt.legend() - - plt.tight_layout() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/barchart_demo2.rst.txt b/_sources/examples/pylab_examples/barchart_demo2.rst.txt deleted file mode 100644 index 2cb5a9e4ef8..00000000000 --- a/_sources/examples/pylab_examples/barchart_demo2.rst.txt +++ /dev/null @@ -1,177 +0,0 @@ -.. _pylab_examples-barchart_demo2: - -pylab_examples example code: barchart_demo2.py -============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/barchart_demo2.py - -:: - - """ - Thanks Josh Hemann for the example - - This examples comes from an application in which grade school gym - teachers wanted to be able to show parents how their child did across - a handful of fitness tests, and importantly, relative to how other - children did. To extract the plotting code for demo purposes, we'll - just make up some data for little Johnny Doe... - - """ - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.ticker import MaxNLocator - from collections import namedtuple - - Student = namedtuple('Student', ['name', 'grade', 'gender']) - Score = namedtuple('Score', ['score', 'percentile']) - - # GLOBAL CONSTANTS - testNames = ['Pacer Test', 'Flexed Arm\n Hang', 'Mile Run', 'Agility', - 'Push Ups'] - testMeta = dict(zip(testNames, ['laps', 'sec', 'min:sec', 'sec', ''])) - - - def attach_ordinal(num): - """helper function to add ordinal string to integers - - 1 -> 1st - 56 -> 56th - """ - suffixes = dict((str(i), v) for i, v in - enumerate(['th', 'st', 'nd', 'rd', 'th', - 'th', 'th', 'th', 'th', 'th'])) - - v = str(num) - # special case early teens - if v in {'11', '12', '13'}: - return v + 'th' - return v + suffixes[v[-1]] - - - def format_score(scr, test): - """ - Build up the score labels for the right Y-axis by first - appending a carriage return to each string and then tacking on - the appropriate meta information (i.e., 'laps' vs 'seconds'). We - want the labels centered on the ticks, so if there is no meta - info (like for pushups) then don't add the carriage return to - the string - """ - md = testMeta[test] - if md: - return '{0}\n{1}'.format(scr, md) - else: - return scr - - - def format_ycursor(y): - y = int(y) - if y < 0 or y >= len(testNames): - return '' - else: - return testNames[y] - - - def plot_student_results(student, scores, cohort_size): - # create the figure - fig, ax1 = plt.subplots(figsize=(9, 7)) - fig.subplots_adjust(left=0.115, right=0.88) - fig.canvas.set_window_title('Eldorado K-8 Fitness Chart') - - pos = np.arange(len(testNames)) - - rects = ax1.barh(pos, [scores[k].percentile for k in testNames], - align='center', - height=0.5, color='m', - tick_label=testNames) - - ax1.set_title(student.name) - - ax1.set_xlim([0, 100]) - ax1.xaxis.set_major_locator(MaxNLocator(11)) - ax1.xaxis.grid(True, linestyle='--', which='major', - color='grey', alpha=.25) - - # Plot a solid vertical gridline to highlight the median position - ax1.axvline(50, color='grey', alpha=0.25) - # set X-axis tick marks at the deciles - cohort_label = ax1.text(.5, -.07, 'Cohort Size: {0}'.format(cohort_size), - horizontalalignment='center', size='small', - transform=ax1.transAxes) - - # Set the right-hand Y-axis ticks and labels - ax2 = ax1.twinx() - - scoreLabels = [format_score(scores[k].score, k) for k in testNames] - - # set the tick locations - ax2.set_yticks(pos) - # make sure that the limits are set equally on both yaxis so the - # ticks line up - ax2.set_ylim(ax1.get_ylim()) - - # set the tick labels - ax2.set_yticklabels(scoreLabels) - - ax2.set_ylabel('Test Scores') - - ax2.set_xlabel(('Percentile Ranking Across ' - '{grade} Grade {gender}s').format( - grade=attach_ordinal(student.grade), - gender=student.gender.title())) - - rect_labels = [] - # Lastly, write in the ranking inside each bar to aid in interpretation - for rect in rects: - # Rectangle widths are already integer-valued but are floating - # type, so it helps to remove the trailing decimal point and 0 by - # converting width to int type - width = int(rect.get_width()) - - rankStr = attach_ordinal(width) - # The bars aren't wide enough to print the ranking inside - if (width < 5): - # Shift the text to the right side of the right edge - xloc = width + 1 - # Black against white background - clr = 'black' - align = 'left' - else: - # Shift the text to the left side of the right edge - xloc = 0.98*width - # White on magenta - clr = 'white' - align = 'right' - - # Center the text vertically in the bar - yloc = rect.get_y() + rect.get_height()/2.0 - label = ax1.text(xloc, yloc, rankStr, horizontalalignment=align, - verticalalignment='center', color=clr, weight='bold', - clip_on=True) - rect_labels.append(label) - - # make the interactive mouse over give the bar title - ax2.fmt_ydata = format_ycursor - # return all of the artists created - return {'fig': fig, - 'ax': ax1, - 'ax_right': ax2, - 'bars': rects, - 'perc_labels': rect_labels, - 'cohort_label': cohort_label} - - student = Student('Johnny Doe', 2, 'boy') - scores = dict(zip(testNames, - (Score(v, p) for v, p in - zip(['7', '48', '12:52', '17', '14'], - np.round(np.random.uniform(0, 1, - len(testNames))*100, 0))))) - cohort_size = 62 # The number of other 2nd grade boys - - arts = plot_student_results(student, scores, cohort_size) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/barchart_demo2.txt b/_sources/examples/pylab_examples/barchart_demo2.txt deleted file mode 100644 index 86bd8a88602..00000000000 --- a/_sources/examples/pylab_examples/barchart_demo2.txt +++ /dev/null @@ -1,176 +0,0 @@ -.. _pylab_examples-barchart_demo2: - -pylab_examples example code: barchart_demo2.py -============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/barchart_demo2.py - -:: - - """ - Thanks Josh Hemann for the example - - This examples comes from an application in which grade school gym - teachers wanted to be able to show parents how their child did across - a handful of fitness tests, and importantly, relative to how other - children did. To extract the plotting code for demo purposes, we'll - just make up some data for little Johnny Doe... - - """ - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.ticker import MaxNLocator - from collections import namedtuple - - Student = namedtuple('Student', ['name', 'grade', 'gender']) - Score = namedtuple('Score', ['score', 'percentile']) - - # GLOBAL CONSTANTS - testNames = ['Pacer Test', 'Flexed Arm\n Hang', 'Mile Run', 'Agility', - 'Push Ups'] - testMeta = dict(zip(testNames, ['laps', 'sec', 'min:sec', 'sec', ''])) - - - def attach_ordinal(num): - """helper function to add ordinal string to integers - - 1 -> 1st - 56 -> 56th - """ - suffixes = dict((str(i), v) for i, v in - enumerate(['th', 'st', 'nd', 'rd', 'th', - 'th', 'th', 'th', 'th', 'th'])) - - v = str(num) - # special case early teens - if v in {'11', '12', '13'}: - return v + 'th' - return v + suffixes[v[-1]] - - - def format_score(scr, test): - """ - Build up the score labels for the right Y-axis by first - appending a carriage return to each string and then tacking on - the appropriate meta information (i.e., 'laps' vs 'seconds'). We - want the labels centered on the ticks, so if there is no meta - info (like for pushups) then don't add the carriage return to - the string - """ - md = testMeta[test] - if md: - return '{0}\n{1}'.format(scr, md) - else: - return scr - - - def format_ycursor(y): - y = int(y) - if y < 0 or y >= len(testNames): - return '' - else: - return testNames[y] - - - def plot_student_results(student, scores, cohort_size): - # create the figure - fig, ax1 = plt.subplots(figsize=(9, 7)) - fig.subplots_adjust(left=0.115, right=0.88) - fig.canvas.set_window_title('Eldorado K-8 Fitness Chart') - - pos = np.arange(len(testNames)) + 0.5 # Center bars on the Y-axis ticks - - rects = ax1.barh(pos, [scores[k].percentile for k in testNames], - align='center', - height=0.5, color='m', - tick_label=testNames) - - ax1.set_title(student.name) - - ax1.set_xlim([0, 100]) - ax1.xaxis.set_major_locator(MaxNLocator(11)) - ax1.xaxis.grid(True, linestyle='--', which='major', - color='grey', alpha=.25) - - # Plot a solid vertical gridline to highlight the median position - ax1.axvline(50, color='grey', alpha=0.25) - # set X-axis tick marks at the deciles - cohort_label = ax1.text(.5, -.07, 'Cohort Size: {0}'.format(cohort_size), - horizontalalignment='center', size='small', - transform=ax1.transAxes) - - # Set the right-hand Y-axis ticks and labels - ax2 = ax1.twinx() - - scoreLabels = [format_score(scores[k].score, k) for k in testNames] - - # set the tick locations - ax2.set_yticks(pos) - # make sure that the limits are set equally on both yaxis so the - # ticks line up - ax2.set_ylim(ax1.get_ylim()) - - # set the tick labels - ax2.set_yticklabels(scoreLabels) - - ax2.set_ylabel('Test Scores') - - ax2.set_xlabel(('Percentile Ranking Across ' - '{grade} Grade {gender}s').format( - grade=attach_ordinal(student.grade), - gender=student.gender.title())) - - rect_labels = [] - # Lastly, write in the ranking inside each bar to aid in interpretation - for rect in rects: - # Rectangle widths are already integer-valued but are floating - # type, so it helps to remove the trailing decimal point and 0 by - # converting width to int type - width = int(rect.get_width()) - - rankStr = attach_ordinal(width) - # The bars aren't wide enough to print the ranking inside - if (width < 5): - # Shift the text to the right side of the right edge - xloc = width + 1 - # Black against white background - clr = 'black' - align = 'left' - else: - # Shift the text to the left side of the right edge - xloc = 0.98*width - # White on magenta - clr = 'white' - align = 'right' - - # Center the text vertically in the bar - yloc = rect.get_y() + rect.get_height()/2.0 - label = ax1.text(xloc, yloc, rankStr, horizontalalignment=align, - verticalalignment='center', color=clr, weight='bold', - clip_on=True) - rect_labels.append(label) - - # make the interactive mouse over give the bar title - ax2.fmt_ydata = format_ycursor - # return all of the artists created - return {'fig': fig, - 'ax': ax1, - 'ax_right': ax2, - 'bars': rects, - 'perc_labels': rect_labels, - 'cohort_label': cohort_label} - - student = Student('Johnny Doe', 2, 'boy') - scores = dict(zip(testNames, - (Score(v, p) for v, p in - zip(['7', '48', '12:52', '17', '14'], - np.round(np.random.uniform(0, 1, - len(testNames))*100, 0))))) - cohort_size = 62 # The number of other 2nd grade boys - - arts = plot_student_results(student, scores, cohort_size) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/barcode_demo.rst.txt b/_sources/examples/pylab_examples/barcode_demo.rst.txt deleted file mode 100644 index 5bbe06f8e94..00000000000 --- a/_sources/examples/pylab_examples/barcode_demo.rst.txt +++ /dev/null @@ -1,38 +0,0 @@ -.. _pylab_examples-barcode_demo: - -pylab_examples example code: barcode_demo.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/barcode_demo.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - # the bar - x = np.where(np.random.rand(500) > 0.7, 1.0, 0.0) - - axprops = dict(xticks=[], yticks=[]) - barprops = dict(aspect='auto', cmap=plt.cm.binary, interpolation='nearest') - - fig = plt.figure() - - # a vertical barcode -- this is broken at present - x.shape = len(x), 1 - ax = fig.add_axes([0.1, 0.3, 0.1, 0.6], **axprops) - ax.imshow(x, **barprops) - - x = x.copy() - # a horizontal barcode - x.shape = 1, len(x) - ax = fig.add_axes([0.3, 0.1, 0.6, 0.1], **axprops) - ax.imshow(x, **barprops) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/barcode_demo.txt b/_sources/examples/pylab_examples/barcode_demo.txt deleted file mode 100644 index f5c64864fba..00000000000 --- a/_sources/examples/pylab_examples/barcode_demo.txt +++ /dev/null @@ -1,38 +0,0 @@ -.. _pylab_examples-barcode_demo: - -pylab_examples example code: barcode_demo.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/barcode_demo.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - # the bar - x = np.where(np.random.rand(500) > 0.7, 1.0, 0.0) - - axprops = dict(xticks=[], yticks=[]) - barprops = dict(aspect='auto', cmap=plt.cm.binary, interpolation='nearest') - - fig = plt.figure() - - # a vertical barcode -- this is broken at present - x.shape = len(x), 1 - ax = fig.add_axes([0.1, 0.3, 0.1, 0.6], **axprops) - ax.imshow(x, **barprops) - - x = x.copy() - # a horizontal barcode - x.shape = 1, len(x) - ax = fig.add_axes([0.3, 0.1, 0.6, 0.1], **axprops) - ax.imshow(x, **barprops) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/barh_demo.txt b/_sources/examples/pylab_examples/barh_demo.txt deleted file mode 100644 index 10f0d3d8fcc..00000000000 --- a/_sources/examples/pylab_examples/barh_demo.txt +++ /dev/null @@ -1,34 +0,0 @@ -.. _pylab_examples-barh_demo: - -pylab_examples example code: barh_demo.py -========================================= - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/barh_demo.py - -:: - - #!/usr/bin/env python - # make a horizontal bar chart - - from pylab import * - val = 3+10*rand(5) # the bar lengths - pos = arange(5)+.5 # the bar centers on the y axis - - figure(1) - barh(pos,val, align='center') - yticks(pos, ('Tom', 'Dick', 'Harry', 'Slim', 'Jim')) - xlabel('Performance') - title('How fast do you want to go today?') - grid(True) - - figure(2) - barh(pos,val, xerr=rand(5), ecolor='r', align='center') - yticks(pos, ('Tom', 'Dick', 'Harry', 'Slim', 'Jim')) - xlabel('Performance') - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/boxplot_demo.rst.txt b/_sources/examples/pylab_examples/boxplot_demo.rst.txt deleted file mode 100644 index 81634b106a0..00000000000 --- a/_sources/examples/pylab_examples/boxplot_demo.rst.txt +++ /dev/null @@ -1,66 +0,0 @@ -.. _pylab_examples-boxplot_demo: - -pylab_examples example code: boxplot_demo.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/boxplot_demo.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - # fake up some data - spread = np.random.rand(50) * 100 - center = np.ones(25) * 50 - flier_high = np.random.rand(10) * 100 + 100 - flier_low = np.random.rand(10) * -100 - data = np.concatenate((spread, center, flier_high, flier_low), 0) - - # basic plot - plt.boxplot(data) - - # notched plot - plt.figure() - plt.boxplot(data, 1) - - # change outlier point symbols - plt.figure() - plt.boxplot(data, 0, 'gD') - - # don't show outlier points - plt.figure() - plt.boxplot(data, 0, '') - - # horizontal boxes - plt.figure() - plt.boxplot(data, 0, 'rs', 0) - - # change whisker length - plt.figure() - plt.boxplot(data, 0, 'rs', 0, 0.75) - - # fake up some more data - spread = np.random.rand(50) * 100 - center = np.ones(25) * 40 - flier_high = np.random.rand(10) * 100 + 100 - flier_low = np.random.rand(10) * -100 - d2 = np.concatenate((spread, center, flier_high, flier_low), 0) - data.shape = (-1, 1) - d2.shape = (-1, 1) - # data = concatenate( (data, d2), 1 ) - # Making a 2-D array only works if all the columns are the - # same length. If they are not, then use a list instead. - # This is actually more efficient because boxplot converts - # a 2-D array into a list of vectors internally anyway. - data = [data, d2, d2[::2, 0]] - # multiple box plots on one figure - plt.figure() - plt.boxplot(data) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/boxplot_demo.txt b/_sources/examples/pylab_examples/boxplot_demo.txt deleted file mode 100644 index 2478e1b6597..00000000000 --- a/_sources/examples/pylab_examples/boxplot_demo.txt +++ /dev/null @@ -1,66 +0,0 @@ -.. _pylab_examples-boxplot_demo: - -pylab_examples example code: boxplot_demo.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/boxplot_demo.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - # fake up some data - spread = np.random.rand(50) * 100 - center = np.ones(25) * 50 - flier_high = np.random.rand(10) * 100 + 100 - flier_low = np.random.rand(10) * -100 - data = np.concatenate((spread, center, flier_high, flier_low), 0) - - # basic plot - plt.boxplot(data) - - # notched plot - plt.figure() - plt.boxplot(data, 1) - - # change outlier point symbols - plt.figure() - plt.boxplot(data, 0, 'gD') - - # don't show outlier points - plt.figure() - plt.boxplot(data, 0, '') - - # horizontal boxes - plt.figure() - plt.boxplot(data, 0, 'rs', 0) - - # change whisker length - plt.figure() - plt.boxplot(data, 0, 'rs', 0, 0.75) - - # fake up some more data - spread = np.random.rand(50) * 100 - center = np.ones(25) * 40 - flier_high = np.random.rand(10) * 100 + 100 - flier_low = np.random.rand(10) * -100 - d2 = np.concatenate((spread, center, flier_high, flier_low), 0) - data.shape = (-1, 1) - d2.shape = (-1, 1) - # data = concatenate( (data, d2), 1 ) - # Making a 2-D array only works if all the columns are the - # same length. If they are not, then use a list instead. - # This is actually more efficient because boxplot converts - # a 2-D array into a list of vectors internally anyway. - data = [data, d2, d2[::2, 0]] - # multiple box plots on one figure - plt.figure() - plt.boxplot(data) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/boxplot_demo2.rst.txt b/_sources/examples/pylab_examples/boxplot_demo2.rst.txt deleted file mode 100644 index ce9631275b8..00000000000 --- a/_sources/examples/pylab_examples/boxplot_demo2.rst.txt +++ /dev/null @@ -1,135 +0,0 @@ -.. _pylab_examples-boxplot_demo2: - -pylab_examples example code: boxplot_demo2.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/boxplot_demo2.py - -:: - - """ - Thanks Josh Hemann for the example - """ - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.patches import Polygon - - - # Generate some data from five different probability distributions, - # each with different characteristics. We want to play with how an IID - # bootstrap resample of the data preserves the distributional - # properties of the original sample, and a boxplot is one visual tool - # to make this assessment - numDists = 5 - randomDists = ['Normal(1,1)', ' Lognormal(1,1)', 'Exp(1)', 'Gumbel(6,4)', - 'Triangular(2,9,11)'] - N = 500 - np.random.seed(0) - norm = np.random.normal(1, 1, N) - logn = np.random.lognormal(1, 1, N) - expo = np.random.exponential(1, N) - gumb = np.random.gumbel(6, 4, N) - tria = np.random.triangular(2, 9, 11, N) - - # Generate some random indices that we'll use to resample the original data - # arrays. For code brevity, just use the same random indices for each array - bootstrapIndices = np.random.random_integers(0, N - 1, N) - normBoot = norm[bootstrapIndices] - expoBoot = expo[bootstrapIndices] - gumbBoot = gumb[bootstrapIndices] - lognBoot = logn[bootstrapIndices] - triaBoot = tria[bootstrapIndices] - - data = [norm, normBoot, logn, lognBoot, expo, expoBoot, gumb, gumbBoot, - tria, triaBoot] - - fig, ax1 = plt.subplots(figsize=(10, 6)) - fig.canvas.set_window_title('A Boxplot Example') - plt.subplots_adjust(left=0.075, right=0.95, top=0.9, bottom=0.25) - - bp = plt.boxplot(data, notch=0, sym='+', vert=1, whis=1.5) - plt.setp(bp['boxes'], color='black') - plt.setp(bp['whiskers'], color='black') - plt.setp(bp['fliers'], color='red', marker='+') - - # Add a horizontal grid to the plot, but make it very light in color - # so we can use it for reading data values but not be distracting - ax1.yaxis.grid(True, linestyle='-', which='major', color='lightgrey', - alpha=0.5) - - # Hide these grid behind plot objects - ax1.set_axisbelow(True) - ax1.set_title('Comparison of IID Bootstrap Resampling Across Five Distributions') - ax1.set_xlabel('Distribution') - ax1.set_ylabel('Value') - - # Now fill the boxes with desired colors - boxColors = ['darkkhaki', 'royalblue'] - numBoxes = numDists*2 - medians = list(range(numBoxes)) - for i in range(numBoxes): - box = bp['boxes'][i] - boxX = [] - boxY = [] - for j in range(5): - boxX.append(box.get_xdata()[j]) - boxY.append(box.get_ydata()[j]) - boxCoords = list(zip(boxX, boxY)) - # Alternate between Dark Khaki and Royal Blue - k = i % 2 - boxPolygon = Polygon(boxCoords, facecolor=boxColors[k]) - ax1.add_patch(boxPolygon) - # Now draw the median lines back over what we just filled in - med = bp['medians'][i] - medianX = [] - medianY = [] - for j in range(2): - medianX.append(med.get_xdata()[j]) - medianY.append(med.get_ydata()[j]) - plt.plot(medianX, medianY, 'k') - medians[i] = medianY[0] - # Finally, overplot the sample averages, with horizontal alignment - # in the center of each box - plt.plot([np.average(med.get_xdata())], [np.average(data[i])], - color='w', marker='*', markeredgecolor='k') - - # Set the axes ranges and axes labels - ax1.set_xlim(0.5, numBoxes + 0.5) - top = 40 - bottom = -5 - ax1.set_ylim(bottom, top) - xtickNames = plt.setp(ax1, xticklabels=np.repeat(randomDists, 2)) - plt.setp(xtickNames, rotation=45, fontsize=8) - - # Due to the Y-axis scale being different across samples, it can be - # hard to compare differences in medians across the samples. Add upper - # X-axis tick labels with the sample medians to aid in comparison - # (just use two decimal places of precision) - pos = np.arange(numBoxes) + 1 - upperLabels = [str(np.round(s, 2)) for s in medians] - weights = ['bold', 'semibold'] - for tick, label in zip(range(numBoxes), ax1.get_xticklabels()): - k = tick % 2 - ax1.text(pos[tick], top - (top*0.05), upperLabels[tick], - horizontalalignment='center', size='x-small', weight=weights[k], - color=boxColors[k]) - - # Finally, add a basic legend - plt.figtext(0.80, 0.08, str(N) + ' Random Numbers', - backgroundcolor=boxColors[0], color='black', weight='roman', - size='x-small') - plt.figtext(0.80, 0.045, 'IID Bootstrap Resample', - backgroundcolor=boxColors[1], - color='white', weight='roman', size='x-small') - plt.figtext(0.80, 0.015, '*', color='white', backgroundcolor='silver', - weight='roman', size='medium') - plt.figtext(0.815, 0.013, ' Average Value', color='black', weight='roman', - size='x-small') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/boxplot_demo2.txt b/_sources/examples/pylab_examples/boxplot_demo2.txt deleted file mode 100644 index 9ba2ef2a21b..00000000000 --- a/_sources/examples/pylab_examples/boxplot_demo2.txt +++ /dev/null @@ -1,134 +0,0 @@ -.. _pylab_examples-boxplot_demo2: - -pylab_examples example code: boxplot_demo2.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/boxplot_demo2.py - -:: - - """ - Thanks Josh Hemann for the example - """ - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.patches import Polygon - - - # Generate some data from five different probability distributions, - # each with different characteristics. We want to play with how an IID - # bootstrap resample of the data preserves the distributional - # properties of the original sample, and a boxplot is one visual tool - # to make this assessment - numDists = 5 - randomDists = ['Normal(1,1)', ' Lognormal(1,1)', 'Exp(1)', 'Gumbel(6,4)', - 'Triangular(2,9,11)'] - N = 500 - norm = np.random.normal(1, 1, N) - logn = np.random.lognormal(1, 1, N) - expo = np.random.exponential(1, N) - gumb = np.random.gumbel(6, 4, N) - tria = np.random.triangular(2, 9, 11, N) - - # Generate some random indices that we'll use to resample the original data - # arrays. For code brevity, just use the same random indices for each array - bootstrapIndices = np.random.random_integers(0, N - 1, N) - normBoot = norm[bootstrapIndices] - expoBoot = expo[bootstrapIndices] - gumbBoot = gumb[bootstrapIndices] - lognBoot = logn[bootstrapIndices] - triaBoot = tria[bootstrapIndices] - - data = [norm, normBoot, logn, lognBoot, expo, expoBoot, gumb, gumbBoot, - tria, triaBoot] - - fig, ax1 = plt.subplots(figsize=(10, 6)) - fig.canvas.set_window_title('A Boxplot Example') - plt.subplots_adjust(left=0.075, right=0.95, top=0.9, bottom=0.25) - - bp = plt.boxplot(data, notch=0, sym='+', vert=1, whis=1.5) - plt.setp(bp['boxes'], color='black') - plt.setp(bp['whiskers'], color='black') - plt.setp(bp['fliers'], color='red', marker='+') - - # Add a horizontal grid to the plot, but make it very light in color - # so we can use it for reading data values but not be distracting - ax1.yaxis.grid(True, linestyle='-', which='major', color='lightgrey', - alpha=0.5) - - # Hide these grid behind plot objects - ax1.set_axisbelow(True) - ax1.set_title('Comparison of IID Bootstrap Resampling Across Five Distributions') - ax1.set_xlabel('Distribution') - ax1.set_ylabel('Value') - - # Now fill the boxes with desired colors - boxColors = ['darkkhaki', 'royalblue'] - numBoxes = numDists*2 - medians = list(range(numBoxes)) - for i in range(numBoxes): - box = bp['boxes'][i] - boxX = [] - boxY = [] - for j in range(5): - boxX.append(box.get_xdata()[j]) - boxY.append(box.get_ydata()[j]) - boxCoords = list(zip(boxX, boxY)) - # Alternate between Dark Khaki and Royal Blue - k = i % 2 - boxPolygon = Polygon(boxCoords, facecolor=boxColors[k]) - ax1.add_patch(boxPolygon) - # Now draw the median lines back over what we just filled in - med = bp['medians'][i] - medianX = [] - medianY = [] - for j in range(2): - medianX.append(med.get_xdata()[j]) - medianY.append(med.get_ydata()[j]) - plt.plot(medianX, medianY, 'k') - medians[i] = medianY[0] - # Finally, overplot the sample averages, with horizontal alignment - # in the center of each box - plt.plot([np.average(med.get_xdata())], [np.average(data[i])], - color='w', marker='*', markeredgecolor='k') - - # Set the axes ranges and axes labels - ax1.set_xlim(0.5, numBoxes + 0.5) - top = 40 - bottom = -5 - ax1.set_ylim(bottom, top) - xtickNames = plt.setp(ax1, xticklabels=np.repeat(randomDists, 2)) - plt.setp(xtickNames, rotation=45, fontsize=8) - - # Due to the Y-axis scale being different across samples, it can be - # hard to compare differences in medians across the samples. Add upper - # X-axis tick labels with the sample medians to aid in comparison - # (just use two decimal places of precision) - pos = np.arange(numBoxes) + 1 - upperLabels = [str(np.round(s, 2)) for s in medians] - weights = ['bold', 'semibold'] - for tick, label in zip(range(numBoxes), ax1.get_xticklabels()): - k = tick % 2 - ax1.text(pos[tick], top - (top*0.05), upperLabels[tick], - horizontalalignment='center', size='x-small', weight=weights[k], - color=boxColors[k]) - - # Finally, add a basic legend - plt.figtext(0.80, 0.08, str(N) + ' Random Numbers', - backgroundcolor=boxColors[0], color='black', weight='roman', - size='x-small') - plt.figtext(0.80, 0.045, 'IID Bootstrap Resample', - backgroundcolor=boxColors[1], - color='white', weight='roman', size='x-small') - plt.figtext(0.80, 0.015, '*', color='white', backgroundcolor='silver', - weight='roman', size='medium') - plt.figtext(0.815, 0.013, ' Average Value', color='black', weight='roman', - size='x-small') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/boxplot_demo3.rst.txt b/_sources/examples/pylab_examples/boxplot_demo3.rst.txt deleted file mode 100644 index ee9ffd8ce0f..00000000000 --- a/_sources/examples/pylab_examples/boxplot_demo3.rst.txt +++ /dev/null @@ -1,61 +0,0 @@ -.. _pylab_examples-boxplot_demo3: - -pylab_examples example code: boxplot_demo3.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/boxplot_demo3.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - - def fakeBootStrapper(n): - ''' - This is just a placeholder for the user's method of - bootstrapping the median and its confidence intervals. - - Returns an arbitrary median and confidence intervals - packed into a tuple - ''' - if n == 1: - med = 0.1 - CI = (-0.25, 0.25) - else: - med = 0.2 - CI = (-0.35, 0.50) - - return med, CI - - - np.random.seed(2) - inc = 0.1 - e1 = np.random.normal(0, 1, size=(500,)) - e2 = np.random.normal(0, 1, size=(500,)) - e3 = np.random.normal(0, 1 + inc, size=(500,)) - e4 = np.random.normal(0, 1 + 2*inc, size=(500,)) - - treatments = [e1, e2, e3, e4] - med1, CI1 = fakeBootStrapper(1) - med2, CI2 = fakeBootStrapper(2) - medians = [None, None, med1, med2] - conf_intervals = [None, None, CI1, CI2] - - fig, ax = plt.subplots() - pos = np.array(range(len(treatments))) + 1 - bp = ax.boxplot(treatments, sym='k+', positions=pos, - notch=1, bootstrap=5000, - usermedians=medians, - conf_intervals=conf_intervals) - - ax.set_xlabel('treatment') - ax.set_ylabel('response') - plt.setp(bp['whiskers'], color='k', linestyle='-') - plt.setp(bp['fliers'], markersize=3.0) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/boxplot_demo3.txt b/_sources/examples/pylab_examples/boxplot_demo3.txt deleted file mode 100644 index 8fc2b7a9c76..00000000000 --- a/_sources/examples/pylab_examples/boxplot_demo3.txt +++ /dev/null @@ -1,61 +0,0 @@ -.. _pylab_examples-boxplot_demo3: - -pylab_examples example code: boxplot_demo3.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/boxplot_demo3.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - - def fakeBootStrapper(n): - ''' - This is just a placeholder for the user's method of - bootstrapping the median and its confidence intervals. - - Returns an arbitrary median and confidence intervals - packed into a tuple - ''' - if n == 1: - med = 0.1 - CI = (-0.25, 0.25) - else: - med = 0.2 - CI = (-0.35, 0.50) - - return med, CI - - - np.random.seed(2) - inc = 0.1 - e1 = np.random.normal(0, 1, size=(500,)) - e2 = np.random.normal(0, 1, size=(500,)) - e3 = np.random.normal(0, 1 + inc, size=(500,)) - e4 = np.random.normal(0, 1 + 2*inc, size=(500,)) - - treatments = [e1, e2, e3, e4] - med1, CI1 = fakeBootStrapper(1) - med2, CI2 = fakeBootStrapper(2) - medians = [None, None, med1, med2] - conf_intervals = [None, None, CI1, CI2] - - fig, ax = plt.subplots() - pos = np.array(range(len(treatments))) + 1 - bp = ax.boxplot(treatments, sym='k+', positions=pos, - notch=1, bootstrap=5000, - usermedians=medians, - conf_intervals=conf_intervals) - - ax.set_xlabel('treatment') - ax.set_ylabel('response') - plt.setp(bp['whiskers'], color='k', linestyle='-') - plt.setp(bp['fliers'], markersize=3.0) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/break.txt b/_sources/examples/pylab_examples/break.txt deleted file mode 100644 index 75945f0f5fa..00000000000 --- a/_sources/examples/pylab_examples/break.txt +++ /dev/null @@ -1,20 +0,0 @@ -.. _pylab_examples-break: - -pylab_examples example code: break.py -===================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/break.py - -:: - - import matplotlib.pyplot as plt - - plt.gcf().text(0.5, 0.95, 'Distance Histograms by Category is \ - a really long title') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/broken_axis.rst.txt b/_sources/examples/pylab_examples/broken_axis.rst.txt deleted file mode 100644 index 9e6ce95e887..00000000000 --- a/_sources/examples/pylab_examples/broken_axis.rst.txt +++ /dev/null @@ -1,75 +0,0 @@ -.. _pylab_examples-broken_axis: - -pylab_examples example code: broken_axis.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/broken_axis.py - -:: - - """ - Broken axis example, where the y-axis will have a portion cut out. - """ - import matplotlib.pyplot as plt - import numpy as np - - - # 30 points between [0, 0.2) originally made using np.random.rand(30)*.2 - pts = np.array([ - 0.015, 0.166, 0.133, 0.159, 0.041, 0.024, 0.195, 0.039, 0.161, 0.018, - 0.143, 0.056, 0.125, 0.096, 0.094, 0.051, 0.043, 0.021, 0.138, 0.075, - 0.109, 0.195, 0.050, 0.074, 0.079, 0.155, 0.020, 0.010, 0.061, 0.008]) - - # Now let's make two outlier points which are far away from everything. - pts[[3, 14]] += .8 - - # If we were to simply plot pts, we'd lose most of the interesting - # details due to the outliers. So let's 'break' or 'cut-out' the y-axis - # into two portions - use the top (ax) for the outliers, and the bottom - # (ax2) for the details of the majority of our data - f, (ax, ax2) = plt.subplots(2, 1, sharex=True) - - # plot the same data on both axes - ax.plot(pts) - ax2.plot(pts) - - # zoom-in / limit the view to different portions of the data - ax.set_ylim(.78, 1.) # outliers only - ax2.set_ylim(0, .22) # most of the data - - # hide the spines between ax and ax2 - ax.spines['bottom'].set_visible(False) - ax2.spines['top'].set_visible(False) - ax.xaxis.tick_top() - ax.tick_params(labeltop='off') # don't put tick labels at the top - ax2.xaxis.tick_bottom() - - # This looks pretty good, and was fairly painless, but you can get that - # cut-out diagonal lines look with just a bit more work. The important - # thing to know here is that in axes coordinates, which are always - # between 0-1, spine endpoints are at these locations (0,0), (0,1), - # (1,0), and (1,1). Thus, we just need to put the diagonals in the - # appropriate corners of each of our axes, and so long as we use the - # right transform and disable clipping. - - d = .015 # how big to make the diagonal lines in axes coordinates - # arguments to pass to plot, just so we don't keep repeating them - kwargs = dict(transform=ax.transAxes, color='k', clip_on=False) - ax.plot((-d, +d), (-d, +d), **kwargs) # top-left diagonal - ax.plot((1 - d, 1 + d), (-d, +d), **kwargs) # top-right diagonal - - kwargs.update(transform=ax2.transAxes) # switch to the bottom axes - ax2.plot((-d, +d), (1 - d, 1 + d), **kwargs) # bottom-left diagonal - ax2.plot((1 - d, 1 + d), (1 - d, 1 + d), **kwargs) # bottom-right diagonal - - # What's cool about this is that now if we vary the distance between - # ax and ax2 via f.subplots_adjust(hspace=...) or plt.subplot_tool(), - # the diagonal lines will move accordingly, and stay right at the tips - # of the spines they are 'breaking' - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/broken_axis.txt b/_sources/examples/pylab_examples/broken_axis.txt deleted file mode 100644 index 54ab642c1c4..00000000000 --- a/_sources/examples/pylab_examples/broken_axis.txt +++ /dev/null @@ -1,75 +0,0 @@ -.. _pylab_examples-broken_axis: - -pylab_examples example code: broken_axis.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/broken_axis.py - -:: - - """ - Broken axis example, where the y-axis will have a portion cut out. - """ - import matplotlib.pyplot as plt - import numpy as np - - - # 30 points between 0 0.2] originally made using np.random.rand(30)*.2 - pts = np.array([ - 0.015, 0.166, 0.133, 0.159, 0.041, 0.024, 0.195, 0.039, 0.161, 0.018, - 0.143, 0.056, 0.125, 0.096, 0.094, 0.051, 0.043, 0.021, 0.138, 0.075, - 0.109, 0.195, 0.050, 0.074, 0.079, 0.155, 0.020, 0.010, 0.061, 0.008]) - - # Now let's make two outlier points which are far away from everything. - pts[[3, 14]] += .8 - - # If we were to simply plot pts, we'd lose most of the interesting - # details due to the outliers. So let's 'break' or 'cut-out' the y-axis - # into two portions - use the top (ax) for the outliers, and the bottom - # (ax2) for the details of the majority of our data - f, (ax, ax2) = plt.subplots(2, 1, sharex=True) - - # plot the same data on both axes - ax.plot(pts) - ax2.plot(pts) - - # zoom-in / limit the view to different portions of the data - ax.set_ylim(.78, 1.) # outliers only - ax2.set_ylim(0, .22) # most of the data - - # hide the spines between ax and ax2 - ax.spines['bottom'].set_visible(False) - ax2.spines['top'].set_visible(False) - ax.xaxis.tick_top() - ax.tick_params(labeltop='off') # don't put tick labels at the top - ax2.xaxis.tick_bottom() - - # This looks pretty good, and was fairly painless, but you can get that - # cut-out diagonal lines look with just a bit more work. The important - # thing to know here is that in axes coordinates, which are always - # between 0-1, spine endpoints are at these locations (0,0), (0,1), - # (1,0), and (1,1). Thus, we just need to put the diagonals in the - # appropriate corners of each of our axes, and so long as we use the - # right transform and disable clipping. - - d = .015 # how big to make the diagonal lines in axes coordinates - # arguments to pass plot, just so we don't keep repeating them - kwargs = dict(transform=ax.transAxes, color='k', clip_on=False) - ax.plot((-d, +d), (-d, +d), **kwargs) # top-left diagonal - ax.plot((1 - d, 1 + d), (-d, +d), **kwargs) # top-right diagonal - - kwargs.update(transform=ax2.transAxes) # switch to the bottom axes - ax2.plot((-d, +d), (1 - d, 1 + d), **kwargs) # bottom-left diagonal - ax2.plot((1 - d, 1 + d), (1 - d, 1 + d), **kwargs) # bottom-right diagonal - - # What's cool about this is that now if we vary the distance between - # ax and ax2 via f.subplots_adjust(hspace=...) or plt.subplot_tool(), - # the diagonal lines will move accordingly, and stay right at the tips - # of the spines they are 'breaking' - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/broken_barh.rst.txt b/_sources/examples/pylab_examples/broken_barh.rst.txt deleted file mode 100644 index 14e2aa96cdd..00000000000 --- a/_sources/examples/pylab_examples/broken_barh.rst.txt +++ /dev/null @@ -1,36 +0,0 @@ -.. _pylab_examples-broken_barh: - -pylab_examples example code: broken_barh.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/broken_barh.py - -:: - - """ - Make a "broken" horizontal bar plot, i.e., one with gaps - """ - import matplotlib.pyplot as plt - - fig, ax = plt.subplots() - ax.broken_barh([(110, 30), (150, 10)], (10, 9), facecolors='blue') - ax.broken_barh([(10, 50), (100, 20), (130, 10)], (20, 9), - facecolors=('red', 'yellow', 'green')) - ax.set_ylim(5, 35) - ax.set_xlim(0, 200) - ax.set_xlabel('seconds since start') - ax.set_yticks([15, 25]) - ax.set_yticklabels(['Bill', 'Jim']) - ax.grid(True) - ax.annotate('race interrupted', (61, 25), - xytext=(0.8, 0.9), textcoords='axes fraction', - arrowprops=dict(facecolor='black', shrink=0.05), - fontsize=16, - horizontalalignment='right', verticalalignment='top') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/broken_barh.txt b/_sources/examples/pylab_examples/broken_barh.txt deleted file mode 100644 index 09e13ef63ab..00000000000 --- a/_sources/examples/pylab_examples/broken_barh.txt +++ /dev/null @@ -1,36 +0,0 @@ -.. _pylab_examples-broken_barh: - -pylab_examples example code: broken_barh.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/broken_barh.py - -:: - - """ - Make a "broken" horizontal bar plot, i.e., one with gaps - """ - import matplotlib.pyplot as plt - - fig, ax = plt.subplots() - ax.broken_barh([(110, 30), (150, 10)], (10, 9), facecolors='blue') - ax.broken_barh([(10, 50), (100, 20), (130, 10)], (20, 9), - facecolors=('red', 'yellow', 'green')) - ax.set_ylim(5, 35) - ax.set_xlim(0, 200) - ax.set_xlabel('seconds since start') - ax.set_yticks([15, 25]) - ax.set_yticklabels(['Bill', 'Jim']) - ax.grid(True) - ax.annotate('race interrupted', (61, 25), - xytext=(0.8, 0.9), textcoords='axes fraction', - arrowprops=dict(facecolor='black', shrink=0.05), - fontsize=16, - horizontalalignment='right', verticalalignment='top') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/centered_ticklabels.rst.txt b/_sources/examples/pylab_examples/centered_ticklabels.rst.txt deleted file mode 100644 index 292879d6ab0..00000000000 --- a/_sources/examples/pylab_examples/centered_ticklabels.rst.txt +++ /dev/null @@ -1,64 +0,0 @@ -.. _pylab_examples-centered_ticklabels: - -pylab_examples example code: centered_ticklabels.py -=================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/centered_ticklabels.py - -:: - - # sometimes it is nice to have ticklabels centered. mpl currently - # associates a label with a tick, and the label can be aligned - # 'center', 'left', or 'right' using the horizontal alignment property: - # - # - # for label in ax.xaxis.get_xticklabels(): - # label.set_horizontalalignment('right') - # - # - # but this doesn't help center the label between ticks. One solution - # is to "face it". Use the minor ticks to place a tick centered - # between the major ticks. Here is an example that labels the months, - # centered between the ticks - - import numpy as np - import matplotlib.cbook as cbook - import matplotlib.dates as dates - import matplotlib.ticker as ticker - import matplotlib.pyplot as plt - - # load some financial data; apple's stock price - fh = cbook.get_sample_data('aapl.npy.gz') - try: - # Python3 cannot load python2 .npy files with datetime(object) arrays - # unless the encoding is set to bytes. However this option was - # not added until numpy 1.10 so this example will only work with - # python 2 or with numpy 1.10 and later. - r = np.load(fh, encoding='bytes') - except TypeError: - r = np.load(fh) - fh.close() - r = r[-250:] # get the last 250 days - - fig, ax = plt.subplots() - ax.plot(r.date, r.adj_close) - - ax.xaxis.set_major_locator(dates.MonthLocator()) - ax.xaxis.set_minor_locator(dates.MonthLocator(bymonthday=15)) - - ax.xaxis.set_major_formatter(ticker.NullFormatter()) - ax.xaxis.set_minor_formatter(dates.DateFormatter('%b')) - - for tick in ax.xaxis.get_minor_ticks(): - tick.tick1line.set_markersize(0) - tick.tick2line.set_markersize(0) - tick.label1.set_horizontalalignment('center') - - imid = len(r)//2 - ax.set_xlabel(str(r.date[imid].year)) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/centered_ticklabels.txt b/_sources/examples/pylab_examples/centered_ticklabels.txt deleted file mode 100644 index 4fb6f9f49b9..00000000000 --- a/_sources/examples/pylab_examples/centered_ticklabels.txt +++ /dev/null @@ -1,64 +0,0 @@ -.. _pylab_examples-centered_ticklabels: - -pylab_examples example code: centered_ticklabels.py -=================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/centered_ticklabels.py - -:: - - # sometimes it is nice to have ticklabels centered. mpl currently - # associates a label with a tick, and the label can be aligned - # 'center', 'left', or 'right' using the horizontal alignment property: - # - # - # for label in ax.xaxis.get_xticklabels(): - # label.set_horizontalalignment('right') - # - # - # but this doesn't help center the label between ticks. One solution - # is to "face it". Use the minor ticks to place a tick centered - # between the major ticks. Here is an example that labels the months, - # centered between the ticks - - import numpy as np - import matplotlib.cbook as cbook - import matplotlib.dates as dates - import matplotlib.ticker as ticker - import matplotlib.pyplot as plt - - # load some financial data; apple's stock price - fh = cbook.get_sample_data('aapl.npy.gz') - try: - # Python3 cannot load python2 .npy files with datetime(object) arrays - # unless the encoding is set to bytes. Hovever this option was - # not added until numpy 1.10 so this example will only work with - # python 2 or with numpy 1.10 and later. - r = np.load(fh, encoding='bytes') - except TypeError: - r = np.load(fh) - fh.close() - r = r[-250:] # get the last 250 days - - fig, ax = plt.subplots() - ax.plot(r.date, r.adj_close) - - ax.xaxis.set_major_locator(dates.MonthLocator()) - ax.xaxis.set_minor_locator(dates.MonthLocator(bymonthday=15)) - - ax.xaxis.set_major_formatter(ticker.NullFormatter()) - ax.xaxis.set_minor_formatter(dates.DateFormatter('%b')) - - for tick in ax.xaxis.get_minor_ticks(): - tick.tick1line.set_markersize(0) - tick.tick2line.set_markersize(0) - tick.label1.set_horizontalalignment('center') - - imid = len(r)//2 - ax.set_xlabel(str(r.date[imid].year)) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/clippedline.txt b/_sources/examples/pylab_examples/clippedline.txt deleted file mode 100644 index bb66f9da73c..00000000000 --- a/_sources/examples/pylab_examples/clippedline.txt +++ /dev/null @@ -1,72 +0,0 @@ -.. _pylab_examples-clippedline: - -pylab_examples example code: clippedline.py -=========================================== - - - -.. plot:: /home/tcaswell/source/my_source/matplotlib/doc/mpl_examples/pylab_examples/clippedline.py - -:: - - """ - Clip a line according to the current xlimits, and change the marker - style when zoomed in. - - It is not clear this example is still needed or valid; clipping - is now automatic for Line2D objects when x is sorted in - ascending order. - - """ - - from matplotlib.lines import Line2D - import matplotlib.pyplot as plt - import numpy as np - - - class ClippedLine(Line2D): - """ - Clip the xlimits to the axes view limits - this example assumes x is sorted - """ - - def __init__(self, ax, *args, **kwargs): - Line2D.__init__(self, *args, **kwargs) - self.ax = ax - - def set_data(self, *args, **kwargs): - Line2D.set_data(self, *args, **kwargs) - self.recache() - self.xorig = np.array(self._x) - self.yorig = np.array(self._y) - - def draw(self, renderer): - xlim = self.ax.get_xlim() - - ind0, ind1 = np.searchsorted(self.xorig, xlim) - self._x = self.xorig[ind0:ind1] - self._y = self.yorig[ind0:ind1] - N = len(self._x) - if N < 1000: - self._marker = 's' - self._linestyle = '-' - else: - self._marker = None - self._linestyle = '-' - - Line2D.draw(self, renderer) - - - fig = plt.figure() - ax = fig.add_subplot(111, autoscale_on=False) - - t = np.arange(0.0, 100.0, 0.01) - s = np.sin(2*np.pi*t) - line = ClippedLine(ax, t, s, color='g', ls='-', lw=2) - ax.add_line(line) - ax.set_xlim(10, 30) - ax.set_ylim(-1.1, 1.1) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/cohere_demo.rst.txt b/_sources/examples/pylab_examples/cohere_demo.rst.txt deleted file mode 100644 index 9636222c3b3..00000000000 --- a/_sources/examples/pylab_examples/cohere_demo.rst.txt +++ /dev/null @@ -1,47 +0,0 @@ -.. _pylab_examples-cohere_demo: - -pylab_examples example code: cohere_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/cohere_demo.py - -:: - - """ - Compute the coherence of two signals - """ - import numpy as np - import matplotlib.pyplot as plt - - # make a little extra space between the subplots - plt.subplots_adjust(wspace=0.5) - - dt = 0.01 - t = np.arange(0, 30, dt) - nse1 = np.random.randn(len(t)) # white noise 1 - nse2 = np.random.randn(len(t)) # white noise 2 - r = np.exp(-t/0.05) - - cnse1 = np.convolve(nse1, r, mode='same')*dt # colored noise 1 - cnse2 = np.convolve(nse2, r, mode='same')*dt # colored noise 2 - - # two signals with a coherent part and a random part - s1 = 0.01*np.sin(2*np.pi*10*t) + cnse1 - s2 = 0.01*np.sin(2*np.pi*10*t) + cnse2 - - plt.subplot(211) - plt.plot(t, s1, t, s2) - plt.xlim(0, 5) - plt.xlabel('time') - plt.ylabel('s1 and s2') - plt.grid(True) - - plt.subplot(212) - cxy, f = plt.cohere(s1, s2, 256, 1./dt) - plt.ylabel('coherence') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/cohere_demo.txt b/_sources/examples/pylab_examples/cohere_demo.txt deleted file mode 100644 index 1335b41c691..00000000000 --- a/_sources/examples/pylab_examples/cohere_demo.txt +++ /dev/null @@ -1,48 +0,0 @@ -.. _pylab_examples-cohere_demo: - -pylab_examples example code: cohere_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/cohere_demo.py - -:: - - #!/usr/bin/env python - """ - Compute the coherence of two signals - """ - import numpy as np - import matplotlib.pyplot as plt - - # make a little extra space between the subplots - plt.subplots_adjust(wspace=0.5) - - dt = 0.01 - t = np.arange(0, 30, dt) - nse1 = np.random.randn(len(t)) # white noise 1 - nse2 = np.random.randn(len(t)) # white noise 2 - r = np.exp(-t/0.05) - - cnse1 = np.convolve(nse1, r, mode='same')*dt # colored noise 1 - cnse2 = np.convolve(nse2, r, mode='same')*dt # colored noise 2 - - # two signals with a coherent part and a random part - s1 = 0.01*np.sin(2*np.pi*10*t) + cnse1 - s2 = 0.01*np.sin(2*np.pi*10*t) + cnse2 - - plt.subplot(211) - plt.plot(t, s1, 'b-', t, s2, 'g-') - plt.xlim(0, 5) - plt.xlabel('time') - plt.ylabel('s1 and s2') - plt.grid(True) - - plt.subplot(212) - cxy, f = plt.cohere(s1, s2, 256, 1./dt) - plt.ylabel('coherence') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/color_by_yvalue.rst.txt b/_sources/examples/pylab_examples/color_by_yvalue.rst.txt deleted file mode 100644 index 6f7911061e8..00000000000 --- a/_sources/examples/pylab_examples/color_by_yvalue.rst.txt +++ /dev/null @@ -1,31 +0,0 @@ -.. _pylab_examples-color_by_yvalue: - -pylab_examples example code: color_by_yvalue.py -=============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/color_by_yvalue.py - -:: - - # use masked arrays to plot a line with different colors by y-value - import numpy as np - import matplotlib.pyplot as plt - - t = np.arange(0.0, 2.0, 0.01) - s = np.sin(2*np.pi*t) - - upper = 0.77 - lower = -0.77 - - - supper = np.ma.masked_where(s < upper, s) - slower = np.ma.masked_where(s > lower, s) - smiddle = np.ma.masked_where(np.logical_or(s < lower, s > upper), s) - - plt.plot(t, smiddle, t, slower, t, supper) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/color_by_yvalue.txt b/_sources/examples/pylab_examples/color_by_yvalue.txt deleted file mode 100644 index 585246e07e7..00000000000 --- a/_sources/examples/pylab_examples/color_by_yvalue.txt +++ /dev/null @@ -1,31 +0,0 @@ -.. _pylab_examples-color_by_yvalue: - -pylab_examples example code: color_by_yvalue.py -=============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/color_by_yvalue.py - -:: - - # use masked arrays to plot a line with different colors by y-value - import numpy as np - import matplotlib.pyplot as plt - - t = np.arange(0.0, 2.0, 0.01) - s = np.sin(2*np.pi*t) - - upper = 0.77 - lower = -0.77 - - - supper = np.ma.masked_where(s < upper, s) - slower = np.ma.masked_where(s > lower, s) - smiddle = np.ma.masked_where(np.logical_or(s < lower, s > upper), s) - - plt.plot(t, slower, 'r', t, smiddle, 'b', t, supper, 'g') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/color_demo.rst.txt b/_sources/examples/pylab_examples/color_demo.rst.txt deleted file mode 100644 index 78c3cc2718f..00000000000 --- a/_sources/examples/pylab_examples/color_demo.rst.txt +++ /dev/null @@ -1,43 +0,0 @@ -.. _pylab_examples-color_demo: - -pylab_examples example code: color_demo.py -========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/color_demo.py - -:: - - """ - matplotlib gives you 5 ways to specify colors, - - 1) as a single letter string, ala MATLAB - - 2) as an html style hex string or html color name - - 3) as an R,G,B tuple, where R,G,B, range from 0-1 - - 4) as a string representing a floating point number - from 0 to 1, corresponding to shades of gray. - - 5) as a special color "Cn", where n is a number 0-9 specifying the - nth color in the currently active color cycle. - - See help(colors) for more info. - """ - import matplotlib.pyplot as plt - import numpy as np - - plt.subplot(111, facecolor='darkslategray') - #subplot(111, facecolor='#ababab') - t = np.arange(0.0, 2.0, 0.01) - s = np.sin(2*np.pi*t) - plt.plot(t, s, 'C1') - plt.xlabel('time (s)', color='C1') - plt.ylabel('voltage (mV)', color='0.5') # grayscale color - plt.title('About as silly as it gets, folks', color='#afeeee') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/color_demo.txt b/_sources/examples/pylab_examples/color_demo.txt deleted file mode 100644 index 99c3ae068ad..00000000000 --- a/_sources/examples/pylab_examples/color_demo.txt +++ /dev/null @@ -1,41 +0,0 @@ -.. _pylab_examples-color_demo: - -pylab_examples example code: color_demo.py -========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/color_demo.py - -:: - - #!/usr/bin/env python - """ - matplotlib gives you 4 ways to specify colors, - - 1) as a single letter string, ala MATLAB - - 2) as an html style hex string or html color name - - 3) as an R,G,B tuple, where R,G,B, range from 0-1 - - 4) as a string representing a floating point number - from 0 to 1, corresponding to shades of gray. - - See help(colors) for more info. - """ - import matplotlib.pyplot as plt - import numpy as np - - plt.subplot(111, axisbg='darkslategray') - #subplot(111, axisbg='#ababab') - t = np.arange(0.0, 2.0, 0.01) - s = np.sin(2*np.pi*t) - plt.plot(t, s, 'y') - plt.xlabel('time (s)', color='r') - plt.ylabel('voltage (mV)', color='0.5') # grayscale color - plt.title('About as silly as it gets, folks', color='#afeeee') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/colorbar_tick_labelling_demo.rst.txt b/_sources/examples/pylab_examples/colorbar_tick_labelling_demo.rst.txt deleted file mode 100644 index cd76d2c64c0..00000000000 --- a/_sources/examples/pylab_examples/colorbar_tick_labelling_demo.rst.txt +++ /dev/null @@ -1,48 +0,0 @@ -.. _pylab_examples-colorbar_tick_labelling_demo: - -pylab_examples example code: colorbar_tick_labelling_demo.py -============================================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/colorbar_tick_labelling_demo.py - -:: - - """Produce custom labelling for a colorbar. - - Contributed by Scott Sinclair - """ - - import matplotlib.pyplot as plt - import numpy as np - from matplotlib import cm - from numpy.random import randn - - # Make plot with vertical (default) colorbar - fig, ax = plt.subplots() - - data = np.clip(randn(250, 250), -1, 1) - - cax = ax.imshow(data, interpolation='nearest', cmap=cm.coolwarm) - ax.set_title('Gaussian noise with vertical colorbar') - - # Add colorbar, make sure to specify tick locations to match desired ticklabels - cbar = fig.colorbar(cax, ticks=[-1, 0, 1]) - cbar.ax.set_yticklabels(['< -1', '0', '> 1']) # vertically oriented colorbar - - # Make plot with horizontal colorbar - fig, ax = plt.subplots() - - data = np.clip(randn(250, 250), -1, 1) - - cax = ax.imshow(data, interpolation='nearest', cmap=cm.afmhot) - ax.set_title('Gaussian noise with horizontal colorbar') - - cbar = fig.colorbar(cax, ticks=[-1, 0, 1], orientation='horizontal') - cbar.ax.set_xticklabels(['Low', 'Medium', 'High']) # horizontal colorbar - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/colorbar_tick_labelling_demo.txt b/_sources/examples/pylab_examples/colorbar_tick_labelling_demo.txt deleted file mode 100644 index da7c234f65b..00000000000 --- a/_sources/examples/pylab_examples/colorbar_tick_labelling_demo.txt +++ /dev/null @@ -1,48 +0,0 @@ -.. _pylab_examples-colorbar_tick_labelling_demo: - -pylab_examples example code: colorbar_tick_labelling_demo.py -============================================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/colorbar_tick_labelling_demo.py - -:: - - """Produce custom labelling for a colorbar. - - Contributed by Scott Sinclair - """ - - import matplotlib.pyplot as plt - import numpy as np - from matplotlib import cm - from numpy.random import randn - - # Make plot with vertical (default) colorbar - fig, ax = plt.subplots() - - data = np.clip(randn(250, 250), -1, 1) - - cax = ax.imshow(data, interpolation='nearest', cmap=cm.coolwarm) - ax.set_title('Gaussian noise with vertical colorbar') - - # Add colorbar, make sure to specify tick locations to match desired ticklabels - cbar = fig.colorbar(cax, ticks=[-1, 0, 1]) - cbar.ax.set_yticklabels(['< -1', '0', '> 1']) # vertically oriented colorbar - - # Make plot with horizontal colorbar - fig, ax = plt.subplots() - - data = np.clip(randn(250, 250), -1, 1) - - cax = ax.imshow(data, interpolation='nearest', cmap=cm.afmhot) - ax.set_title('Gaussian noise with horizontal colorbar') - - cbar = fig.colorbar(cax, ticks=[-1, 0, 1], orientation='horizontal') - cbar.ax.set_xticklabels(['Low', 'Medium', 'High']) # horizontal colorbar - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/colours.rst.txt b/_sources/examples/pylab_examples/colours.rst.txt deleted file mode 100644 index 24edf96b047..00000000000 --- a/_sources/examples/pylab_examples/colours.rst.txt +++ /dev/null @@ -1,63 +0,0 @@ -.. _pylab_examples-colours: - -pylab_examples example code: colours.py -======================================= - -[`source code `_] - -:: - - # -*- noplot -*- - """ - Some simple functions to generate colours. - """ - import numpy as np - from matplotlib import colors as mcolors - - - def pastel(colour, weight=2.4): - """ Convert colour into a nice pastel shade""" - rgb = np.asarray(mcolors.to_rgba(colour)[:3]) - # scale colour - maxc = max(rgb) - if maxc < 1.0 and maxc > 0: - # scale colour - scale = 1.0 / maxc - rgb = rgb * scale - # now decrease saturation - total = rgb.sum() - slack = 0 - for x in rgb: - slack += 1.0 - x - - # want to increase weight from total to weight - # pick x s.t. slack * x == weight - total - # x = (weight - total) / slack - x = (weight - total) / slack - - rgb = [c + (x * (1.0 - c)) for c in rgb] - - return rgb - - - def get_colours(n): - """ Return n pastel colours. """ - base = np.asarray([[1, 0, 0], [0, 1, 0], [0, 0, 1]]) - - if n <= 3: - return base[0:n] - - # how many new colours to we need to insert between - # red and green and between green and blue? - needed = (((n - 3) + 1) / 2, (n - 3) / 2) - - colours = [] - for start in (0, 1): - for x in np.linspace(0, 1, needed[start] + 2): - colours.append((base[start] * (1.0 - x)) + - (base[start + 1] * x)) - - return [pastel(c) for c in colours[0:n]] - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/colours.txt b/_sources/examples/pylab_examples/colours.txt deleted file mode 100644 index 3ba7d1dd730..00000000000 --- a/_sources/examples/pylab_examples/colours.txt +++ /dev/null @@ -1,64 +0,0 @@ -.. _pylab_examples-colours: - -pylab_examples example code: colours.py -======================================= - -[`source code `_] - -:: - - #!/usr/bin/env python - # -*- noplot -*- - """ - Some simple functions to generate colours. - """ - import numpy as np - from matplotlib.colors import colorConverter - - - def pastel(colour, weight=2.4): - """ Convert colour into a nice pastel shade""" - rgb = np.asarray(colorConverter.to_rgb(colour)) - # scale colour - maxc = max(rgb) - if maxc < 1.0 and maxc > 0: - # scale colour - scale = 1.0 / maxc - rgb = rgb * scale - # now decrease saturation - total = rgb.sum() - slack = 0 - for x in rgb: - slack += 1.0 - x - - # want to increase weight from total to weight - # pick x s.t. slack * x == weight - total - # x = (weight - total) / slack - x = (weight - total) / slack - - rgb = [c + (x * (1.0 - c)) for c in rgb] - - return rgb - - - def get_colours(n): - """ Return n pastel colours. """ - base = np.asarray([[1, 0, 0], [0, 1, 0], [0, 0, 1]]) - - if n <= 3: - return base[0:n] - - # how many new colours to we need to insert between - # red and green and between green and blue? - needed = (((n - 3) + 1) / 2, (n - 3) / 2) - - colours = [] - for start in (0, 1): - for x in np.linspace(0, 1, needed[start] + 2): - colours.append((base[start] * (1.0 - x)) + - (base[start + 1] * x)) - - return [pastel(c) for c in colours[0:n]] - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/contour_corner_mask.rst.txt b/_sources/examples/pylab_examples/contour_corner_mask.rst.txt deleted file mode 100644 index 3bc731a9505..00000000000 --- a/_sources/examples/pylab_examples/contour_corner_mask.rst.txt +++ /dev/null @@ -1,48 +0,0 @@ -.. _pylab_examples-contour_corner_mask: - -pylab_examples example code: contour_corner_mask.py -=================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/contour_corner_mask.py - -:: - - """ - Illustrate the difference between corner_mask=False and corner_mask=True - for masked contour plots. - """ - import matplotlib.pyplot as plt - import numpy as np - - # Data to plot. - x, y = np.meshgrid(np.arange(7), np.arange(10)) - z = np.sin(0.5*x)*np.cos(0.52*y) - - # Mask various z values. - mask = np.zeros_like(z, dtype=np.bool) - mask[2, 3:5] = True - mask[3:5, 4] = True - mask[7, 2] = True - mask[5, 0] = True - mask[0, 6] = True - z = np.ma.array(z, mask=mask) - - corner_masks = [False, True] - for i, corner_mask in enumerate(corner_masks): - plt.subplot(1, 2, i+1) - cs = plt.contourf(x, y, z, corner_mask=corner_mask) - plt.contour(cs, colors='k') - plt.title('corner_mask = {0}'.format(corner_mask)) - - # Plot grid. - plt.grid(c='k', ls='-', alpha=0.3) - - # Indicate masked points with red circles. - plt.plot(np.ma.array(x, mask=~mask), y, 'ro') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/contour_corner_mask.txt b/_sources/examples/pylab_examples/contour_corner_mask.txt deleted file mode 100644 index b3431ea7004..00000000000 --- a/_sources/examples/pylab_examples/contour_corner_mask.txt +++ /dev/null @@ -1,49 +0,0 @@ -.. _pylab_examples-contour_corner_mask: - -pylab_examples example code: contour_corner_mask.py -=================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/contour_corner_mask.py - -:: - - #!/usr/bin/env python - """ - Illustrate the difference between corner_mask=False and corner_mask=True - for masked contour plots. - """ - import matplotlib.pyplot as plt - import numpy as np - - # Data to plot. - x, y = np.meshgrid(np.arange(7), np.arange(10)) - z = np.sin(0.5*x)*np.cos(0.52*y) - - # Mask various z values. - mask = np.zeros_like(z, dtype=np.bool) - mask[2, 3:5] = True - mask[3:5, 4] = True - mask[7, 2] = True - mask[5, 0] = True - mask[0, 6] = True - z = np.ma.array(z, mask=mask) - - corner_masks = [False, True] - for i, corner_mask in enumerate(corner_masks): - plt.subplot(1, 2, i+1) - cs = plt.contourf(x, y, z, corner_mask=corner_mask) - plt.contour(cs, colors='k') - plt.title('corner_mask = {0}'.format(corner_mask)) - - # Plot grid. - plt.grid(c='k', ls='-', alpha=0.3) - - # Indicate masked points with red circles. - plt.plot(np.ma.array(x, mask=~mask), y, 'ro') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/contour_demo.rst.txt b/_sources/examples/pylab_examples/contour_demo.rst.txt deleted file mode 100644 index 31ab52faac1..00000000000 --- a/_sources/examples/pylab_examples/contour_demo.rst.txt +++ /dev/null @@ -1,126 +0,0 @@ -.. _pylab_examples-contour_demo: - -pylab_examples example code: contour_demo.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/contour_demo.py - -:: - - """ - Illustrate simple contour plotting, contours on an image with - a colorbar for the contours, and labelled contours. - - See also contour_image.py. - """ - import matplotlib - import numpy as np - import matplotlib.cm as cm - import matplotlib.mlab as mlab - import matplotlib.pyplot as plt - - matplotlib.rcParams['xtick.direction'] = 'out' - matplotlib.rcParams['ytick.direction'] = 'out' - - delta = 0.025 - x = np.arange(-3.0, 3.0, delta) - y = np.arange(-2.0, 2.0, delta) - X, Y = np.meshgrid(x, y) - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - # difference of Gaussians - Z = 10.0 * (Z2 - Z1) - - - # Create a simple contour plot with labels using default colors. The - # inline argument to clabel will control whether the labels are draw - # over the line segments of the contour, removing the lines beneath - # the label - plt.figure() - CS = plt.contour(X, Y, Z) - plt.clabel(CS, inline=1, fontsize=10) - plt.title('Simplest default with labels') - - - # contour labels can be placed manually by providing list of positions - # (in data coordinate). See ginput_manual_clabel.py for interactive - # placement. - plt.figure() - CS = plt.contour(X, Y, Z) - manual_locations = [(-1, -1.4), (-0.62, -0.7), (-2, 0.5), (1.7, 1.2), (2.0, 1.4), (2.4, 1.7)] - plt.clabel(CS, inline=1, fontsize=10, manual=manual_locations) - plt.title('labels at selected locations') - - - # You can force all the contours to be the same color. - plt.figure() - CS = plt.contour(X, Y, Z, 6, - colors='k', # negative contours will be dashed by default - ) - plt.clabel(CS, fontsize=9, inline=1) - plt.title('Single color - negative contours dashed') - - # You can set negative contours to be solid instead of dashed: - matplotlib.rcParams['contour.negative_linestyle'] = 'solid' - plt.figure() - CS = plt.contour(X, Y, Z, 6, - colors='k', # negative contours will be dashed by default - ) - plt.clabel(CS, fontsize=9, inline=1) - plt.title('Single color - negative contours solid') - - - # And you can manually specify the colors of the contour - plt.figure() - CS = plt.contour(X, Y, Z, 6, - linewidths=np.arange(.5, 4, .5), - colors=('r', 'green', 'blue', (1, 1, 0), '#afeeee', '0.5') - ) - plt.clabel(CS, fontsize=9, inline=1) - plt.title('Crazy lines') - - - # Or you can use a colormap to specify the colors; the default - # colormap will be used for the contour lines - plt.figure() - im = plt.imshow(Z, interpolation='bilinear', origin='lower', - cmap=cm.gray, extent=(-3, 3, -2, 2)) - levels = np.arange(-1.2, 1.6, 0.2) - CS = plt.contour(Z, levels, - origin='lower', - linewidths=2, - extent=(-3, 3, -2, 2)) - - # Thicken the zero contour. - zc = CS.collections[6] - plt.setp(zc, linewidth=4) - - plt.clabel(CS, levels[1::2], # label every second level - inline=1, - fmt='%1.1f', - fontsize=14) - - # make a colorbar for the contour lines - CB = plt.colorbar(CS, shrink=0.8, extend='both') - - plt.title('Lines with colorbar') - #plt.hot() # Now change the colormap for the contour lines and colorbar - plt.flag() - - # We can still add a colorbar for the image, too. - CBI = plt.colorbar(im, orientation='horizontal', shrink=0.8) - - # This makes the original colorbar look a bit out of place, - # so let's improve its position. - - l, b, w, h = plt.gca().get_position().bounds - ll, bb, ww, hh = CB.ax.get_position().bounds - CB.ax.set_position([ll, b + 0.1*h, ww, h*0.8]) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/contour_demo.txt b/_sources/examples/pylab_examples/contour_demo.txt deleted file mode 100644 index 069fe534ff6..00000000000 --- a/_sources/examples/pylab_examples/contour_demo.txt +++ /dev/null @@ -1,127 +0,0 @@ -.. _pylab_examples-contour_demo: - -pylab_examples example code: contour_demo.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/contour_demo.py - -:: - - #!/usr/bin/env python - """ - Illustrate simple contour plotting, contours on an image with - a colorbar for the contours, and labelled contours. - - See also contour_image.py. - """ - import matplotlib - import numpy as np - import matplotlib.cm as cm - import matplotlib.mlab as mlab - import matplotlib.pyplot as plt - - matplotlib.rcParams['xtick.direction'] = 'out' - matplotlib.rcParams['ytick.direction'] = 'out' - - delta = 0.025 - x = np.arange(-3.0, 3.0, delta) - y = np.arange(-2.0, 2.0, delta) - X, Y = np.meshgrid(x, y) - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - # difference of Gaussians - Z = 10.0 * (Z2 - Z1) - - - # Create a simple contour plot with labels using default colors. The - # inline argument to clabel will control whether the labels are draw - # over the line segments of the contour, removing the lines beneath - # the label - plt.figure() - CS = plt.contour(X, Y, Z) - plt.clabel(CS, inline=1, fontsize=10) - plt.title('Simplest default with labels') - - - # contour labels can be placed manually by providing list of positions - # (in data coordinate). See ginput_manual_clabel.py for interactive - # placement. - plt.figure() - CS = plt.contour(X, Y, Z) - manual_locations = [(-1, -1.4), (-0.62, -0.7), (-2, 0.5), (1.7, 1.2), (2.0, 1.4), (2.4, 1.7)] - plt.clabel(CS, inline=1, fontsize=10, manual=manual_locations) - plt.title('labels at selected locations') - - - # You can force all the contours to be the same color. - plt.figure() - CS = plt.contour(X, Y, Z, 6, - colors='k', # negative contours will be dashed by default - ) - plt.clabel(CS, fontsize=9, inline=1) - plt.title('Single color - negative contours dashed') - - # You can set negative contours to be solid instead of dashed: - matplotlib.rcParams['contour.negative_linestyle'] = 'solid' - plt.figure() - CS = plt.contour(X, Y, Z, 6, - colors='k', # negative contours will be dashed by default - ) - plt.clabel(CS, fontsize=9, inline=1) - plt.title('Single color - negative contours solid') - - - # And you can manually specify the colors of the contour - plt.figure() - CS = plt.contour(X, Y, Z, 6, - linewidths=np.arange(.5, 4, .5), - colors=('r', 'green', 'blue', (1, 1, 0), '#afeeee', '0.5') - ) - plt.clabel(CS, fontsize=9, inline=1) - plt.title('Crazy lines') - - - # Or you can use a colormap to specify the colors; the default - # colormap will be used for the contour lines - plt.figure() - im = plt.imshow(Z, interpolation='bilinear', origin='lower', - cmap=cm.gray, extent=(-3, 3, -2, 2)) - levels = np.arange(-1.2, 1.6, 0.2) - CS = plt.contour(Z, levels, - origin='lower', - linewidths=2, - extent=(-3, 3, -2, 2)) - - # Thicken the zero contour. - zc = CS.collections[6] - plt.setp(zc, linewidth=4) - - plt.clabel(CS, levels[1::2], # label every second level - inline=1, - fmt='%1.1f', - fontsize=14) - - # make a colorbar for the contour lines - CB = plt.colorbar(CS, shrink=0.8, extend='both') - - plt.title('Lines with colorbar') - #plt.hot() # Now change the colormap for the contour lines and colorbar - plt.flag() - - # We can still add a colorbar for the image, too. - CBI = plt.colorbar(im, orientation='horizontal', shrink=0.8) - - # This makes the original colorbar look a bit out of place, - # so let's improve its position. - - l, b, w, h = plt.gca().get_position().bounds - ll, bb, ww, hh = CB.ax.get_position().bounds - CB.ax.set_position([ll, b + 0.1*h, ww, h*0.8]) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/contour_image.rst.txt b/_sources/examples/pylab_examples/contour_image.rst.txt deleted file mode 100644 index 7f6886c8b6b..00000000000 --- a/_sources/examples/pylab_examples/contour_image.rst.txt +++ /dev/null @@ -1,116 +0,0 @@ -.. _pylab_examples-contour_image: - -pylab_examples example code: contour_image.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/contour_image.py - -:: - - ''' - Test combinations of contouring, filled contouring, and image plotting. - For contour labelling, see contour_demo.py. - - The emphasis in this demo is on showing how to make contours register - correctly on images, and on how to get both of them oriented as - desired. In particular, note the usage of the "origin" and "extent" - keyword arguments to imshow and contour. - ''' - import matplotlib.pyplot as plt - import numpy as np - from matplotlib import mlab, cm - - # Default delta is large because that makes it fast, and it illustrates - # the correct registration between image and contours. - delta = 0.5 - - extent = (-3, 4, -4, 3) - - x = np.arange(-3.0, 4.001, delta) - y = np.arange(-4.0, 3.001, delta) - X, Y = np.meshgrid(x, y) - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - Z = (Z1 - Z2) * 10 - - levels = np.arange(-2.0, 1.601, 0.4) # Boost the upper limit to avoid truncation errors. - - norm = cm.colors.Normalize(vmax=abs(Z).max(), vmin=-abs(Z).max()) - cmap = cm.PRGn - - fig = plt.figure() - fig.subplots_adjust(hspace=0.3) - - - plt.subplot(2, 2, 1) - - cset1 = plt.contourf(X, Y, Z, levels, - cmap=cm.get_cmap(cmap, len(levels) - 1), - norm=norm, - ) - # It is not necessary, but for the colormap, we need only the - # number of levels minus 1. To avoid discretization error, use - # either this number or a large number such as the default (256). - - # If we want lines as well as filled regions, we need to call - # contour separately; don't try to change the edgecolor or edgewidth - # of the polygons in the collections returned by contourf. - # Use levels output from previous call to guarantee they are the same. - - cset2 = plt.contour(X, Y, Z, cset1.levels, colors='k') - - # We don't really need dashed contour lines to indicate negative - # regions, so let's turn them off. - - for c in cset2.collections: - c.set_linestyle('solid') - - # It is easier here to make a separate call to contour than - # to set up an array of colors and linewidths. - # We are making a thick green line as a zero contour. - # Specify the zero level as a tuple with only 0 in it. - - cset3 = plt.contour(X, Y, Z, (0,), colors='g', linewidths=2) - plt.title('Filled contours') - plt.colorbar(cset1) - - - plt.subplot(2, 2, 2) - - plt.imshow(Z, extent=extent, cmap=cmap, norm=norm) - v = plt.axis() - plt.contour(Z, levels, colors='k', origin='upper', extent=extent) - plt.axis(v) - plt.title("Image, origin 'upper'") - - plt.subplot(2, 2, 3) - - plt.imshow(Z, origin='lower', extent=extent, cmap=cmap, norm=norm) - v = plt.axis() - plt.contour(Z, levels, colors='k', origin='lower', extent=extent) - plt.axis(v) - plt.title("Image, origin 'lower'") - - plt.subplot(2, 2, 4) - - # We will use the interpolation "nearest" here to show the actual - # image pixels. - # Note that the contour lines don't extend to the edge of the box. - # This is intentional. The Z values are defined at the center of each - # image pixel (each color block on the following subplot), so the - # domain that is contoured does not extend beyond these pixel centers. - im = plt.imshow(Z, interpolation='nearest', extent=extent, cmap=cmap, norm=norm) - v = plt.axis() - plt.contour(Z, levels, colors='k', origin='image', extent=extent) - plt.axis(v) - ylim = plt.get(plt.gca(), 'ylim') - plt.setp(plt.gca(), ylim=ylim[::-1]) - plt.title("Origin from rc, reversed y-axis") - plt.colorbar(im) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/contour_image.txt b/_sources/examples/pylab_examples/contour_image.txt deleted file mode 100644 index aa07d86a7a4..00000000000 --- a/_sources/examples/pylab_examples/contour_image.txt +++ /dev/null @@ -1,121 +0,0 @@ -.. _pylab_examples-contour_image: - -pylab_examples example code: contour_image.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/contour_image.py - -:: - - #!/usr/bin/env python - ''' - Test combinations of contouring, filled contouring, and image plotting. - For contour labelling, see contour_demo.py. - - The emphasis in this demo is on showing how to make contours register - correctly on images, and on how to get both of them oriented as - desired. In particular, note the usage of the "origin" and "extent" - keyword arguments to imshow and contour. - ''' - import matplotlib.pyplot as plt - import numpy as np - from matplotlib import mlab, cm - - # Default delta is large because that makes it fast, and it illustrates - # the correct registration between image and contours. - delta = 0.5 - - extent = (-3, 4, -4, 3) - - x = np.arange(-3.0, 4.001, delta) - y = np.arange(-4.0, 3.001, delta) - X, Y = np.meshgrid(x, y) - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - Z = (Z1 - Z2) * 10 - - levels = np.arange(-2.0, 1.601, 0.4) # Boost the upper limit to avoid truncation errors. - - norm = cm.colors.Normalize(vmax=abs(Z).max(), vmin=-abs(Z).max()) - cmap = cm.PRGn - - plt.figure() - - - plt.subplot(2, 2, 1) - - cset1 = plt.contourf(X, Y, Z, levels, - cmap=cm.get_cmap(cmap, len(levels) - 1), - norm=norm, - ) - # It is not necessary, but for the colormap, we need only the - # number of levels minus 1. To avoid discretization error, use - # either this number or a large number such as the default (256). - - # If we want lines as well as filled regions, we need to call - # contour separately; don't try to change the edgecolor or edgewidth - # of the polygons in the collections returned by contourf. - # Use levels output from previous call to guarantee they are the same. - cset2 = plt.contour(X, Y, Z, cset1.levels, - colors='k', - hold='on') - # We don't really need dashed contour lines to indicate negative - # regions, so let's turn them off. - for c in cset2.collections: - c.set_linestyle('solid') - - # It is easier here to make a separate call to contour than - # to set up an array of colors and linewidths. - # We are making a thick green line as a zero contour. - # Specify the zero level as a tuple with only 0 in it. - cset3 = plt.contour(X, Y, Z, (0,), - colors='g', - linewidths=2, - hold='on') - plt.title('Filled contours') - plt.colorbar(cset1) - #hot() - - - plt.subplot(2, 2, 2) - - plt.imshow(Z, extent=extent, cmap=cmap, norm=norm) - v = plt.axis() - plt.contour(Z, levels, hold='on', colors='k', - origin='upper', extent=extent) - plt.axis(v) - plt.title("Image, origin 'upper'") - - plt.subplot(2, 2, 3) - - plt.imshow(Z, origin='lower', extent=extent, cmap=cmap, norm=norm) - v = plt.axis() - plt.contour(Z, levels, hold='on', colors='k', - origin='lower', extent=extent) - plt.axis(v) - plt.title("Image, origin 'lower'") - - plt.subplot(2, 2, 4) - - # We will use the interpolation "nearest" here to show the actual - # image pixels. - # Note that the contour lines don't extend to the edge of the box. - # This is intentional. The Z values are defined at the center of each - # image pixel (each color block on the following subplot), so the - # domain that is contoured does not extend beyond these pixel centers. - im = plt.imshow(Z, interpolation='nearest', extent=extent, cmap=cmap, norm=norm) - v = plt.axis() - plt.contour(Z, levels, hold='on', colors='k', - origin='image', extent=extent) - plt.axis(v) - ylim = plt.get(plt.gca(), 'ylim') - plt.setp(plt.gca(), ylim=ylim[::-1]) - plt.title("Image, origin from rc, reversed y-axis") - plt.colorbar(im) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/contour_label_demo.rst.txt b/_sources/examples/pylab_examples/contour_label_demo.rst.txt deleted file mode 100644 index 57b07227e94..00000000000 --- a/_sources/examples/pylab_examples/contour_label_demo.rst.txt +++ /dev/null @@ -1,100 +0,0 @@ -.. _pylab_examples-contour_label_demo: - -pylab_examples example code: contour_label_demo.py -================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/contour_label_demo.py - -:: - - """ - Illustrate some of the more advanced things that one can do with - contour labels. - - See also contour_demo.py. - """ - import matplotlib - import numpy as np - import matplotlib.cm as cm - import matplotlib.mlab as mlab - import matplotlib.ticker as ticker - import matplotlib.pyplot as plt - - matplotlib.rcParams['xtick.direction'] = 'out' - matplotlib.rcParams['ytick.direction'] = 'out' - - ################################################## - # Define our surface - ################################################## - delta = 0.025 - x = np.arange(-3.0, 3.0, delta) - y = np.arange(-2.0, 2.0, delta) - X, Y = np.meshgrid(x, y) - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - # difference of Gaussians - Z = 10.0 * (Z2 - Z1) - - ################################################## - # Make contour labels using creative float classes - # Follows suggestion of Manuel Metz - ################################################## - plt.figure() - - # Basic contour plot - CS = plt.contour(X, Y, Z) - - - # Define a class that forces representation of float to look a certain way - # This remove trailing zero so '1.0' becomes '1' - class nf(float): - def __repr__(self): - str = '%.1f' % (self.__float__(),) - if str[-1] == '0': - return '%.0f' % self.__float__() - else: - return '%.1f' % self.__float__() - - # Recast levels to new class - CS.levels = [nf(val) for val in CS.levels] - - # Label levels with specially formatted floats - if plt.rcParams["text.usetex"]: - fmt = r'%r \%%' - else: - fmt = '%r %%' - plt.clabel(CS, CS.levels, inline=True, fmt=fmt, fontsize=10) - - ################################################## - # Label contours with arbitrary strings using a - # dictionary - ################################################## - plt.figure() - - # Basic contour plot - CS = plt.contour(X, Y, Z) - - fmt = {} - strs = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh'] - for l, s in zip(CS.levels, strs): - fmt[l] = s - - # Label every other level using strings - plt.clabel(CS, CS.levels[::2], inline=True, fmt=fmt, fontsize=10) - - # Use a Formatter - - plt.figure() - - CS = plt.contour(X, Y, 100**Z, locator=plt.LogLocator()) - fmt = ticker.LogFormatterMathtext() - fmt.create_dummy_axis() - plt.clabel(CS, CS.levels, fmt=fmt) - plt.title("$100^Z$") - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/contour_label_demo.txt b/_sources/examples/pylab_examples/contour_label_demo.txt deleted file mode 100644 index 8defd1cb78b..00000000000 --- a/_sources/examples/pylab_examples/contour_label_demo.txt +++ /dev/null @@ -1,101 +0,0 @@ -.. _pylab_examples-contour_label_demo: - -pylab_examples example code: contour_label_demo.py -================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/contour_label_demo.py - -:: - - #!/usr/bin/env python - """ - Illustrate some of the more advanced things that one can do with - contour labels. - - See also contour_demo.py. - """ - import matplotlib - import numpy as np - import matplotlib.cm as cm - import matplotlib.mlab as mlab - import matplotlib.ticker as ticker - import matplotlib.pyplot as plt - - matplotlib.rcParams['xtick.direction'] = 'out' - matplotlib.rcParams['ytick.direction'] = 'out' - - ################################################## - # Define our surface - ################################################## - delta = 0.025 - x = np.arange(-3.0, 3.0, delta) - y = np.arange(-2.0, 2.0, delta) - X, Y = np.meshgrid(x, y) - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - # difference of Gaussians - Z = 10.0 * (Z2 - Z1) - - ################################################## - # Make contour labels using creative float classes - # Follows suggestion of Manuel Metz - ################################################## - plt.figure() - - # Basic contour plot - CS = plt.contour(X, Y, Z) - - - # Define a class that forces representation of float to look a certain way - # This remove trailing zero so '1.0' becomes '1' - class nf(float): - def __repr__(self): - str = '%.1f' % (self.__float__(),) - if str[-1] == '0': - return '%.0f' % self.__float__() - else: - return '%.1f' % self.__float__() - - # Recast levels to new class - CS.levels = [nf(val) for val in CS.levels] - - # Label levels with specially formatted floats - if plt.rcParams["text.usetex"]: - fmt = r'%r \%%' - else: - fmt = '%r %%' - plt.clabel(CS, CS.levels, inline=True, fmt=fmt, fontsize=10) - - ################################################## - # Label contours with arbitrary strings using a - # dictionary - ################################################## - plt.figure() - - # Basic contour plot - CS = plt.contour(X, Y, Z) - - fmt = {} - strs = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh'] - for l, s in zip(CS.levels, strs): - fmt[l] = s - - # Label every other level using strings - plt.clabel(CS, CS.levels[::2], inline=True, fmt=fmt, fontsize=10) - - # Use a Formatter - - plt.figure() - - CS = plt.contour(X, Y, 100**Z, locator=plt.LogLocator()) - fmt = ticker.LogFormatterMathtext() - fmt.create_dummy_axis() - plt.clabel(CS, CS.levels, fmt=fmt) - plt.title("$100^Z$") - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/contourf_demo.rst.txt b/_sources/examples/pylab_examples/contourf_demo.rst.txt deleted file mode 100644 index 9b9c104cf93..00000000000 --- a/_sources/examples/pylab_examples/contourf_demo.rst.txt +++ /dev/null @@ -1,120 +0,0 @@ -.. _pylab_examples-contourf_demo: - -pylab_examples example code: contourf_demo.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/contourf_demo.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - - origin = 'lower' - #origin = 'upper' - - delta = 0.025 - - x = y = np.arange(-3.0, 3.01, delta) - X, Y = np.meshgrid(x, y) - Z1 = plt.mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = plt.mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - Z = 10 * (Z1 - Z2) - - nr, nc = Z.shape - - # put NaNs in one corner: - Z[-nr//6:, -nc//6:] = np.nan - # contourf will convert these to masked - - - Z = np.ma.array(Z) - # mask another corner: - Z[:nr//6, :nc//6] = np.ma.masked - - # mask a circle in the middle: - interior = np.sqrt((X**2) + (Y**2)) < 0.5 - Z[interior] = np.ma.masked - - # We are using automatic selection of contour levels; - # this is usually not such a good idea, because they don't - # occur on nice boundaries, but we do it here for purposes - # of illustration. - CS = plt.contourf(X, Y, Z, 10, - #[-1, -0.1, 0, 0.1], - #alpha=0.5, - cmap=plt.cm.bone, - origin=origin) - - # Note that in the following, we explicitly pass in a subset of - # the contour levels used for the filled contours. Alternatively, - # We could pass in additional levels to provide extra resolution, - # or leave out the levels kwarg to use all of the original levels. - - CS2 = plt.contour(CS, levels=CS.levels[::2], - colors='r', - origin=origin) - - plt.title('Nonsense (3 masked regions)') - plt.xlabel('word length anomaly') - plt.ylabel('sentence length anomaly') - - # Make a colorbar for the ContourSet returned by the contourf call. - cbar = plt.colorbar(CS) - cbar.ax.set_ylabel('verbosity coefficient') - # Add the contour line levels to the colorbar - cbar.add_lines(CS2) - - plt.figure() - - # Now make a contour plot with the levels specified, - # and with the colormap generated automatically from a list - # of colors. - levels = [-1.5, -1, -0.5, 0, 0.5, 1] - CS3 = plt.contourf(X, Y, Z, levels, - colors=('r', 'g', 'b'), - origin=origin, - extend='both') - # Our data range extends outside the range of levels; make - # data below the lowest contour level yellow, and above the - # highest level cyan: - CS3.cmap.set_under('yellow') - CS3.cmap.set_over('cyan') - - CS4 = plt.contour(X, Y, Z, levels, - colors=('k',), - linewidths=(3,), - origin=origin) - plt.title('Listed colors (3 masked regions)') - plt.clabel(CS4, fmt='%2.1f', colors='w', fontsize=14) - - # Notice that the colorbar command gets all the information it - # needs from the ContourSet object, CS3. - plt.colorbar(CS3) - - # Illustrate all 4 possible "extend" settings: - extends = ["neither", "both", "min", "max"] - cmap = plt.cm.get_cmap("winter") - cmap.set_under("magenta") - cmap.set_over("yellow") - # Note: contouring simply excludes masked or nan regions, so - # instead of using the "bad" colormap value for them, it draws - # nothing at all in them. Therefore the following would have - # no effect: - # cmap.set_bad("red") - - fig, axs = plt.subplots(2, 2) - fig.subplots_adjust(hspace=0.3) - - for ax, extend in zip(axs.ravel(), extends): - cs = ax.contourf(X, Y, Z, levels, cmap=cmap, extend=extend, origin=origin) - fig.colorbar(cs, ax=ax, shrink=0.9) - ax.set_title("extend = %s" % extend) - ax.locator_params(nbins=4) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/contourf_demo.txt b/_sources/examples/pylab_examples/contourf_demo.txt deleted file mode 100644 index 6f81cc0a85e..00000000000 --- a/_sources/examples/pylab_examples/contourf_demo.txt +++ /dev/null @@ -1,121 +0,0 @@ -.. _pylab_examples-contourf_demo: - -pylab_examples example code: contourf_demo.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/contourf_demo.py - -:: - - #!/usr/bin/env python - import numpy as np - import matplotlib.pyplot as plt - - origin = 'lower' - #origin = 'upper' - - delta = 0.025 - - x = y = np.arange(-3.0, 3.01, delta) - X, Y = np.meshgrid(x, y) - Z1 = plt.mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = plt.mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - Z = 10 * (Z1 - Z2) - - nr, nc = Z.shape - - # put NaNs in one corner: - Z[-nr//6:, -nc//6:] = np.nan - # contourf will convert these to masked - - - Z = np.ma.array(Z) - # mask another corner: - Z[:nr//6, :nc//6] = np.ma.masked - - # mask a circle in the middle: - interior = np.sqrt((X**2) + (Y**2)) < 0.5 - Z[interior] = np.ma.masked - - - # We are using automatic selection of contour levels; - # this is usually not such a good idea, because they don't - # occur on nice boundaries, but we do it here for purposes - # of illustration. - CS = plt.contourf(X, Y, Z, 10, - #[-1, -0.1, 0, 0.1], - #alpha=0.5, - cmap=plt.cm.bone, - origin=origin) - - # Note that in the following, we explicitly pass in a subset of - # the contour levels used for the filled contours. Alternatively, - # We could pass in additional levels to provide extra resolution, - # or leave out the levels kwarg to use all of the original levels. - - CS2 = plt.contour(CS, levels=CS.levels[::2], - colors='r', - origin=origin, - hold='on') - - plt.title('Nonsense (3 masked regions)') - plt.xlabel('word length anomaly') - plt.ylabel('sentence length anomaly') - - # Make a colorbar for the ContourSet returned by the contourf call. - cbar = plt.colorbar(CS) - cbar.ax.set_ylabel('verbosity coefficient') - # Add the contour line levels to the colorbar - cbar.add_lines(CS2) - - plt.figure() - - # Now make a contour plot with the levels specified, - # and with the colormap generated automatically from a list - # of colors. - levels = [-1.5, -1, -0.5, 0, 0.5, 1] - CS3 = plt.contourf(X, Y, Z, levels, - colors=('r', 'g', 'b'), - origin=origin, - extend='both') - # Our data range extends outside the range of levels; make - # data below the lowest contour level yellow, and above the - # highest level cyan: - CS3.cmap.set_under('yellow') - CS3.cmap.set_over('cyan') - - CS4 = plt.contour(X, Y, Z, levels, - colors=('k',), - linewidths=(3,), - origin=origin) - plt.title('Listed colors (3 masked regions)') - plt.clabel(CS4, fmt='%2.1f', colors='w', fontsize=14) - - # Notice that the colorbar command gets all the information it - # needs from the ContourSet object, CS3. - plt.colorbar(CS3) - - # Illustrate all 4 possible "extend" settings: - extends = ["neither", "both", "min", "max"] - cmap = plt.cm.get_cmap("winter") - cmap.set_under("magenta") - cmap.set_over("yellow") - # Note: contouring simply excludes masked or nan regions, so - # instead of using the "bad" colormap value for them, it draws - # nothing at all in them. Therefore the following would have - # no effect: - # cmap.set_bad("red") - - fig, axs = plt.subplots(2, 2) - for ax, extend in zip(axs.ravel(), extends): - cs = ax.contourf(X, Y, Z, levels, cmap=cmap, extend=extend, origin=origin) - fig.colorbar(cs, ax=ax, shrink=0.9) - ax.set_title("extend = %s" % extend) - ax.locator_params(nbins=4) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/contourf_hatching.rst.txt b/_sources/examples/pylab_examples/contourf_hatching.rst.txt deleted file mode 100644 index e032e5eea68..00000000000 --- a/_sources/examples/pylab_examples/contourf_hatching.rst.txt +++ /dev/null @@ -1,58 +0,0 @@ -.. _pylab_examples-contourf_hatching: - -pylab_examples example code: contourf_hatching.py -================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/contourf_hatching.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - - # invent some numbers, turning the x and y arrays into simple - # 2d arrays, which make combining them together easier. - x = np.linspace(-3, 5, 150).reshape(1, -1) - y = np.linspace(-3, 5, 120).reshape(-1, 1) - z = np.cos(x) + np.sin(y) - - # we no longer need x and y to be 2 dimensional, so flatten them. - x, y = x.flatten(), y.flatten() - - - # --------------------------------------------- - # | Plot #1 | - # --------------------------------------------- - # the simplest hatched plot with a colorbar - fig = plt.figure() - cs = plt.contourf(x, y, z, hatches=['-', '/', '\\', '//'], - cmap=plt.get_cmap('gray'), - extend='both', alpha=0.5 - ) - plt.colorbar() - - - # --------------------------------------------- - # | Plot #2 | - # --------------------------------------------- - # a plot of hatches without color with a legend - plt.figure() - n_levels = 6 - plt.contour(x, y, z, n_levels, colors='black', linestyles='-') - cs = plt.contourf(x, y, z, n_levels, colors='none', - hatches=['.', '/', '\\', None, '\\\\', '*'], - extend='lower' - ) - - # create a legend for the contour set - artists, labels = cs.legend_elements() - plt.legend(artists, labels, handleheight=2) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/contourf_hatching.txt b/_sources/examples/pylab_examples/contourf_hatching.txt deleted file mode 100644 index 769d06f8947..00000000000 --- a/_sources/examples/pylab_examples/contourf_hatching.txt +++ /dev/null @@ -1,58 +0,0 @@ -.. _pylab_examples-contourf_hatching: - -pylab_examples example code: contourf_hatching.py -================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/contourf_hatching.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - - # invent some numbers, turning the x and y arrays into simple - # 2d arrays, which make combining them together easier. - x = np.linspace(-3, 5, 150).reshape(1, -1) - y = np.linspace(-3, 5, 120).reshape(-1, 1) - z = np.cos(x) + np.sin(y) - - # we no longer need x and y to be 2 dimensional, so flatten them. - x, y = x.flatten(), y.flatten() - - - # --------------------------------------------- - # | Plot #1 | - # --------------------------------------------- - # the simplest hatched plot with a colorbar - fig = plt.figure() - cs = plt.contourf(x, y, z, hatches=['-', '/', '\\', '//'], - cmap=plt.get_cmap('gray'), - extend='both', alpha=0.5 - ) - plt.colorbar() - - - # --------------------------------------------- - # | Plot #2 | - # --------------------------------------------- - # a plot of hatches without color with a legend - plt.figure() - n_levels = 6 - plt.contour(x, y, z, n_levels, colors='black', linestyles='-') - cs = plt.contourf(x, y, z, n_levels, colors='none', - hatches=['.', '/', '\\', None, '\\\\', '*'], - extend='lower' - ) - - # create a legend for the contour set - artists, labels = cs.legend_elements() - plt.legend(artists, labels, handleheight=2) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/contourf_log.txt b/_sources/examples/pylab_examples/contourf_log.txt deleted file mode 100644 index 1f4c629ba4b..00000000000 --- a/_sources/examples/pylab_examples/contourf_log.txt +++ /dev/null @@ -1,62 +0,0 @@ -.. _pylab_examples-contourf_log: - -pylab_examples example code: contourf_log.py -============================================ - - - -.. plot:: /home/tcaswell/other_source/matplotlib/doc/mpl_examples/pylab_examples/contourf_log.py - -:: - - ''' - Demonstrate use of a log color scale in contourf - ''' - - from matplotlib import pyplot as P - import numpy as np - from numpy import ma - from matplotlib import colors, ticker, cm - from matplotlib.mlab import bivariate_normal - - N = 100 - x = np.linspace(-3.0, 3.0, N) - y = np.linspace(-2.0, 2.0, N) - - X, Y = np.meshgrid(x, y) - - # A low hump with a spike coming out of the top right. - # Needs to have z/colour axis on a log scale so we see both hump and spike. - # linear scale only shows the spike. - z = (bivariate_normal(X, Y, 0.1, 0.2, 1.0, 1.0) - + 0.1 * bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)) - - # Put in some negative values (lower left corner) to cause trouble with logs: - z[:5, :5] = -1 - - # The following is not strictly essential, but it will eliminate - # a warning. Comment it out to see the warning. - z = ma.masked_where(z<= 0, z) - - - # Automatic selection of levels works; setting the - # log locator tells contourf to use a log scale: - cs = P.contourf(X, Y, z, locator=ticker.LogLocator(), cmap=cm.PuBu_r) - - # Alternatively, you can manually set the levels - # and the norm: - #lev_exp = np.arange(np.floor(np.log10(z.min())-1), - # np.ceil(np.log10(z.max())+1)) - #levs = np.power(10, lev_exp) - #cs = P.contourf(X, Y, z, levs, norm=colors.LogNorm()) - - #The 'extend' kwarg does not work yet with a log scale. - - cbar = P.colorbar() - - P.show() - - - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/coords_demo.rst.txt b/_sources/examples/pylab_examples/coords_demo.rst.txt deleted file mode 100644 index 75d0125ddb2..00000000000 --- a/_sources/examples/pylab_examples/coords_demo.rst.txt +++ /dev/null @@ -1,53 +0,0 @@ -.. _pylab_examples-coords_demo: - -pylab_examples example code: coords_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/coords_demo.py - -:: - - """ - An example of how to interact with the plotting canvas by connecting - to move and click events - """ - from __future__ import print_function - import sys - import matplotlib.pyplot as plt - import numpy as np - - t = np.arange(0.0, 1.0, 0.01) - s = np.sin(2*np.pi*t) - fig, ax = plt.subplots() - ax.plot(t, s) - - - def on_move(event): - # get the x and y pixel coords - x, y = event.x, event.y - - if event.inaxes: - ax = event.inaxes # the axes instance - print('data coords %f %f' % (event.xdata, event.ydata)) - - - def on_click(event): - # get the x and y coords, flip y from top to bottom - x, y = event.x, event.y - if event.button == 1: - if event.inaxes is not None: - print('data coords %f %f' % (event.xdata, event.ydata)) - - binding_id = plt.connect('motion_notify_event', on_move) - plt.connect('button_press_event', on_click) - - if "test_disconnect" in sys.argv: - print("disconnecting console coordinate printout...") - plt.disconnect(binding_id) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/coords_demo.txt b/_sources/examples/pylab_examples/coords_demo.txt deleted file mode 100644 index 1fcbb89cd81..00000000000 --- a/_sources/examples/pylab_examples/coords_demo.txt +++ /dev/null @@ -1,55 +0,0 @@ -.. _pylab_examples-coords_demo: - -pylab_examples example code: coords_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/coords_demo.py - -:: - - #!/usr/bin/env python - - """ - An example of how to interact with the plotting canvas by connecting - to move and click events - """ - from __future__ import print_function - import sys - import matplotlib.pyplot as plt - import numpy as np - - t = np.arange(0.0, 1.0, 0.01) - s = np.sin(2*np.pi*t) - fig, ax = plt.subplots() - ax.plot(t, s) - - - def on_move(event): - # get the x and y pixel coords - x, y = event.x, event.y - - if event.inaxes: - ax = event.inaxes # the axes instance - print('data coords %f %f' % (event.xdata, event.ydata)) - - - def on_click(event): - # get the x and y coords, flip y from top to bottom - x, y = event.x, event.y - if event.button == 1: - if event.inaxes is not None: - print('data coords %f %f' % (event.xdata, event.ydata)) - - binding_id = plt.connect('motion_notify_event', on_move) - plt.connect('button_press_event', on_click) - - if "test_disconnect" in sys.argv: - print("disconnecting console coordinate printout...") - plt.disconnect(binding_id) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/coords_report.rst.txt b/_sources/examples/pylab_examples/coords_report.rst.txt deleted file mode 100644 index 81c12d68ffb..00000000000 --- a/_sources/examples/pylab_examples/coords_report.rst.txt +++ /dev/null @@ -1,31 +0,0 @@ -.. _pylab_examples-coords_report: - -pylab_examples example code: coords_report.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/coords_report.py - -:: - - # override the default reporting of coords - - import matplotlib.pyplot as plt - import numpy as np - - - def millions(x): - return '$%1.1fM' % (x*1e-6) - - x = np.random.rand(20) - y = 1e7*np.random.rand(20) - - fig, ax = plt.subplots() - ax.fmt_ydata = millions - plt.plot(x, y, 'o') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/coords_report.txt b/_sources/examples/pylab_examples/coords_report.txt deleted file mode 100644 index 5e0f37c78f8..00000000000 --- a/_sources/examples/pylab_examples/coords_report.txt +++ /dev/null @@ -1,33 +0,0 @@ -.. _pylab_examples-coords_report: - -pylab_examples example code: coords_report.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/coords_report.py - -:: - - #!/usr/bin/env python - - # override the default reporting of coords - - import matplotlib.pyplot as plt - import numpy as np - - - def millions(x): - return '$%1.1fM' % (x*1e-6) - - x = np.random.rand(20) - y = 1e7*np.random.rand(20) - - fig, ax = plt.subplots() - ax.fmt_ydata = millions - plt.plot(x, y, 'o') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/csd_demo.rst.txt b/_sources/examples/pylab_examples/csd_demo.rst.txt deleted file mode 100644 index 3d0f03fe2b0..00000000000 --- a/_sources/examples/pylab_examples/csd_demo.rst.txt +++ /dev/null @@ -1,47 +0,0 @@ -.. _pylab_examples-csd_demo: - -pylab_examples example code: csd_demo.py -======================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/csd_demo.py - -:: - - """ - Compute the cross spectral density of two signals - """ - import numpy as np - import matplotlib.pyplot as plt - - - fig, (ax1, ax2) = plt.subplots(2, 1) - # make a little extra space between the subplots - fig.subplots_adjust(hspace=0.5) - - dt = 0.01 - t = np.arange(0, 30, dt) - nse1 = np.random.randn(len(t)) # white noise 1 - nse2 = np.random.randn(len(t)) # white noise 2 - r = np.exp(-t/0.05) - - cnse1 = np.convolve(nse1, r, mode='same')*dt # colored noise 1 - cnse2 = np.convolve(nse2, r, mode='same')*dt # colored noise 2 - - # two signals with a coherent part and a random part - s1 = 0.01*np.sin(2*np.pi*10*t) + cnse1 - s2 = 0.01*np.sin(2*np.pi*10*t) + cnse2 - - ax1.plot(t, s1, t, s2) - ax1.set_xlim(0, 5) - ax1.set_xlabel('time') - ax1.set_ylabel('s1 and s2') - ax1.grid(True) - - cxy, f = ax2.csd(s1, s2, 256, 1./dt) - ax2.set_ylabel('CSD (db)') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/csd_demo.txt b/_sources/examples/pylab_examples/csd_demo.txt deleted file mode 100644 index 3e95d15878b..00000000000 --- a/_sources/examples/pylab_examples/csd_demo.txt +++ /dev/null @@ -1,48 +0,0 @@ -.. _pylab_examples-csd_demo: - -pylab_examples example code: csd_demo.py -======================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/csd_demo.py - -:: - - #!/usr/bin/env python - """ - Compute the cross spectral density of two signals - """ - import numpy as np - import matplotlib.pyplot as plt - - # make a little extra space between the subplots - plt.subplots_adjust(wspace=0.5) - - dt = 0.01 - t = np.arange(0, 30, dt) - nse1 = np.random.randn(len(t)) # white noise 1 - nse2 = np.random.randn(len(t)) # white noise 2 - r = np.exp(-t/0.05) - - cnse1 = np.convolve(nse1, r, mode='same')*dt # colored noise 1 - cnse2 = np.convolve(nse2, r, mode='same')*dt # colored noise 2 - - # two signals with a coherent part and a random part - s1 = 0.01*np.sin(2*np.pi*10*t) + cnse1 - s2 = 0.01*np.sin(2*np.pi*10*t) + cnse2 - - plt.subplot(211) - plt.plot(t, s1, 'b-', t, s2, 'g-') - plt.xlim(0, 5) - plt.xlabel('time') - plt.ylabel('s1 and s2') - plt.grid(True) - - plt.subplot(212) - cxy, f = plt.csd(s1, s2, 256, 1./dt) - plt.ylabel('CSD (db)') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/cursor_demo.rst.txt b/_sources/examples/pylab_examples/cursor_demo.rst.txt deleted file mode 100644 index 1f789a54cf0..00000000000 --- a/_sources/examples/pylab_examples/cursor_demo.rst.txt +++ /dev/null @@ -1,98 +0,0 @@ -.. _pylab_examples-cursor_demo: - -pylab_examples example code: cursor_demo.py -=========================================== - -[`source code `_] - -:: - - # -*- noplot -*- - - """ - This example shows how to use matplotlib to provide a data cursor. It - uses matplotlib to draw the cursor and may be a slow since this - requires redrawing the figure with every mouse move. - - Faster cursoring is possible using native GUI drawing, as in - wxcursor_demo.py. - - The mpldatacursor and mplcursors third-party packages can be used to achieve a - similar effect. See - https://github.com/joferkington/mpldatacursor - https://github.com/anntzer/mplcursors - """ - from __future__ import print_function - import matplotlib.pyplot as plt - import numpy as np - - - class Cursor(object): - def __init__(self, ax): - self.ax = ax - self.lx = ax.axhline(color='k') # the horiz line - self.ly = ax.axvline(color='k') # the vert line - - # text location in axes coords - self.txt = ax.text(0.7, 0.9, '', transform=ax.transAxes) - - def mouse_move(self, event): - if not event.inaxes: - return - - x, y = event.xdata, event.ydata - # update the line positions - self.lx.set_ydata(y) - self.ly.set_xdata(x) - - self.txt.set_text('x=%1.2f, y=%1.2f' % (x, y)) - plt.draw() - - - class SnaptoCursor(object): - """ - Like Cursor but the crosshair snaps to the nearest x,y point - For simplicity, I'm assuming x is sorted - """ - - def __init__(self, ax, x, y): - self.ax = ax - self.lx = ax.axhline(color='k') # the horiz line - self.ly = ax.axvline(color='k') # the vert line - self.x = x - self.y = y - # text location in axes coords - self.txt = ax.text(0.7, 0.9, '', transform=ax.transAxes) - - def mouse_move(self, event): - - if not event.inaxes: - return - - x, y = event.xdata, event.ydata - - indx = np.searchsorted(self.x, [x])[0] - x = self.x[indx] - y = self.y[indx] - # update the line positions - self.lx.set_ydata(y) - self.ly.set_xdata(x) - - self.txt.set_text('x=%1.2f, y=%1.2f' % (x, y)) - print('x=%1.2f, y=%1.2f' % (x, y)) - plt.draw() - - t = np.arange(0.0, 1.0, 0.01) - s = np.sin(2*2*np.pi*t) - fig, ax = plt.subplots() - - #cursor = Cursor(ax) - cursor = SnaptoCursor(ax, t, s) - plt.connect('motion_notify_event', cursor.mouse_move) - - ax.plot(t, s, 'o') - plt.axis([0, 1, -1, 1]) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/cursor_demo.txt b/_sources/examples/pylab_examples/cursor_demo.txt deleted file mode 100644 index 1f789a54cf0..00000000000 --- a/_sources/examples/pylab_examples/cursor_demo.txt +++ /dev/null @@ -1,98 +0,0 @@ -.. _pylab_examples-cursor_demo: - -pylab_examples example code: cursor_demo.py -=========================================== - -[`source code `_] - -:: - - # -*- noplot -*- - - """ - This example shows how to use matplotlib to provide a data cursor. It - uses matplotlib to draw the cursor and may be a slow since this - requires redrawing the figure with every mouse move. - - Faster cursoring is possible using native GUI drawing, as in - wxcursor_demo.py. - - The mpldatacursor and mplcursors third-party packages can be used to achieve a - similar effect. See - https://github.com/joferkington/mpldatacursor - https://github.com/anntzer/mplcursors - """ - from __future__ import print_function - import matplotlib.pyplot as plt - import numpy as np - - - class Cursor(object): - def __init__(self, ax): - self.ax = ax - self.lx = ax.axhline(color='k') # the horiz line - self.ly = ax.axvline(color='k') # the vert line - - # text location in axes coords - self.txt = ax.text(0.7, 0.9, '', transform=ax.transAxes) - - def mouse_move(self, event): - if not event.inaxes: - return - - x, y = event.xdata, event.ydata - # update the line positions - self.lx.set_ydata(y) - self.ly.set_xdata(x) - - self.txt.set_text('x=%1.2f, y=%1.2f' % (x, y)) - plt.draw() - - - class SnaptoCursor(object): - """ - Like Cursor but the crosshair snaps to the nearest x,y point - For simplicity, I'm assuming x is sorted - """ - - def __init__(self, ax, x, y): - self.ax = ax - self.lx = ax.axhline(color='k') # the horiz line - self.ly = ax.axvline(color='k') # the vert line - self.x = x - self.y = y - # text location in axes coords - self.txt = ax.text(0.7, 0.9, '', transform=ax.transAxes) - - def mouse_move(self, event): - - if not event.inaxes: - return - - x, y = event.xdata, event.ydata - - indx = np.searchsorted(self.x, [x])[0] - x = self.x[indx] - y = self.y[indx] - # update the line positions - self.lx.set_ydata(y) - self.ly.set_xdata(x) - - self.txt.set_text('x=%1.2f, y=%1.2f' % (x, y)) - print('x=%1.2f, y=%1.2f' % (x, y)) - plt.draw() - - t = np.arange(0.0, 1.0, 0.01) - s = np.sin(2*2*np.pi*t) - fig, ax = plt.subplots() - - #cursor = Cursor(ax) - cursor = SnaptoCursor(ax, t, s) - plt.connect('motion_notify_event', cursor.mouse_move) - - ax.plot(t, s, 'o') - plt.axis([0, 1, -1, 1]) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/custom_cmap.rst.txt b/_sources/examples/pylab_examples/custom_cmap.rst.txt deleted file mode 100644 index 0dcd7ee6c33..00000000000 --- a/_sources/examples/pylab_examples/custom_cmap.rst.txt +++ /dev/null @@ -1,229 +0,0 @@ -.. _pylab_examples-custom_cmap: - -pylab_examples example code: custom_cmap.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/custom_cmap.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.colors import LinearSegmentedColormap - - """ - Creating a colormap from a list of colors - ----------------------------------------- - Creating a colormap from a list of colors can be done with the `from_list` - method of `LinearSegmentedColormap`. You must pass a list of RGB tuples that - define the mixture of colors from 0 to 1. - - - Creating custom colormaps - ------------------------- - It is also possible to create a custom mapping for a colormap. This is - accomplished by creating dictionary that specifies how the RGB channels - change from one end of the cmap to the other. - - Example: suppose you want red to increase from 0 to 1 over the bottom - half, green to do the same over the middle half, and blue over the top - half. Then you would use: - - cdict = {'red': ((0.0, 0.0, 0.0), - (0.5, 1.0, 1.0), - (1.0, 1.0, 1.0)), - - 'green': ((0.0, 0.0, 0.0), - (0.25, 0.0, 0.0), - (0.75, 1.0, 1.0), - (1.0, 1.0, 1.0)), - - 'blue': ((0.0, 0.0, 0.0), - (0.5, 0.0, 0.0), - (1.0, 1.0, 1.0))} - - If, as in this example, there are no discontinuities in the r, g, and b - components, then it is quite simple: the second and third element of - each tuple, above, is the same--call it "y". The first element ("x") - defines interpolation intervals over the full range of 0 to 1, and it - must span that whole range. In other words, the values of x divide the - 0-to-1 range into a set of segments, and y gives the end-point color - values for each segment. - - Now consider the green. cdict['green'] is saying that for - 0 <= x <= 0.25, y is zero; no green. - 0.25 < x <= 0.75, y varies linearly from 0 to 1. - x > 0.75, y remains at 1, full green. - - If there are discontinuities, then it is a little more complicated. - Label the 3 elements in each row in the cdict entry for a given color as - (x, y0, y1). Then for values of x between x[i] and x[i+1] the color - value is interpolated between y1[i] and y0[i+1]. - - Going back to the cookbook example, look at cdict['red']; because y0 != - y1, it is saying that for x from 0 to 0.5, red increases from 0 to 1, - but then it jumps down, so that for x from 0.5 to 1, red increases from - 0.7 to 1. Green ramps from 0 to 1 as x goes from 0 to 0.5, then jumps - back to 0, and ramps back to 1 as x goes from 0.5 to 1. - - row i: x y0 y1 - / - / - row i+1: x y0 y1 - - Above is an attempt to show that for x in the range x[i] to x[i+1], the - interpolation is between y1[i] and y0[i+1]. So, y0[0] and y1[-1] are - never used. - - """ - # Make some illustrative fake data: - - x = np.arange(0, np.pi, 0.1) - y = np.arange(0, 2*np.pi, 0.1) - X, Y = np.meshgrid(x, y) - Z = np.cos(X) * np.sin(Y) * 10 - - - # --- Colormaps from a list --- - - colors = [(1, 0, 0), (0, 1, 0), (0, 0, 1)] # R -> G -> B - n_bins = [3, 6, 10, 100] # Discretizes the interpolation into bins - cmap_name = 'my_list' - fig, axs = plt.subplots(2, 2, figsize=(6, 9)) - fig.subplots_adjust(left=0.02, bottom=0.06, right=0.95, top=0.94, wspace=0.05) - for n_bin, ax in zip(n_bins, axs.ravel()): - # Create the colormap - cm = LinearSegmentedColormap.from_list( - cmap_name, colors, N=n_bin) - # Fewer bins will result in "coarser" colomap interpolation - im = ax.imshow(Z, interpolation='nearest', origin='lower', cmap=cm) - ax.set_title("N bins: %s" % n_bin) - fig.colorbar(im, ax=ax) - - - # --- Custom colormaps --- - - cdict1 = {'red': ((0.0, 0.0, 0.0), - (0.5, 0.0, 0.1), - (1.0, 1.0, 1.0)), - - 'green': ((0.0, 0.0, 0.0), - (1.0, 0.0, 0.0)), - - 'blue': ((0.0, 0.0, 1.0), - (0.5, 0.1, 0.0), - (1.0, 0.0, 0.0)) - } - - cdict2 = {'red': ((0.0, 0.0, 0.0), - (0.5, 0.0, 1.0), - (1.0, 0.1, 1.0)), - - 'green': ((0.0, 0.0, 0.0), - (1.0, 0.0, 0.0)), - - 'blue': ((0.0, 0.0, 0.1), - (0.5, 1.0, 0.0), - (1.0, 0.0, 0.0)) - } - - cdict3 = {'red': ((0.0, 0.0, 0.0), - (0.25, 0.0, 0.0), - (0.5, 0.8, 1.0), - (0.75, 1.0, 1.0), - (1.0, 0.4, 1.0)), - - 'green': ((0.0, 0.0, 0.0), - (0.25, 0.0, 0.0), - (0.5, 0.9, 0.9), - (0.75, 0.0, 0.0), - (1.0, 0.0, 0.0)), - - 'blue': ((0.0, 0.0, 0.4), - (0.25, 1.0, 1.0), - (0.5, 1.0, 0.8), - (0.75, 0.0, 0.0), - (1.0, 0.0, 0.0)) - } - - # Make a modified version of cdict3 with some transparency - # in the middle of the range. - cdict4 = cdict3.copy() - cdict4['alpha'] = ((0.0, 1.0, 1.0), - # (0.25,1.0, 1.0), - (0.5, 0.3, 0.3), - # (0.75,1.0, 1.0), - (1.0, 1.0, 1.0)) - - - # Now we will use this example to illustrate 3 ways of - # handling custom colormaps. - # First, the most direct and explicit: - - blue_red1 = LinearSegmentedColormap('BlueRed1', cdict1) - - # Second, create the map explicitly and register it. - # Like the first method, this method works with any kind - # of Colormap, not just - # a LinearSegmentedColormap: - - blue_red2 = LinearSegmentedColormap('BlueRed2', cdict2) - plt.register_cmap(cmap=blue_red2) - - # Third, for LinearSegmentedColormap only, - # leave everything to register_cmap: - - plt.register_cmap(name='BlueRed3', data=cdict3) # optional lut kwarg - plt.register_cmap(name='BlueRedAlpha', data=cdict4) - - # Make the figure: - - fig, axs = plt.subplots(2, 2, figsize=(6, 9)) - fig.subplots_adjust(left=0.02, bottom=0.06, right=0.95, top=0.94, wspace=0.05) - - # Make 4 subplots: - - im1 = axs[0, 0].imshow(Z, interpolation='nearest', cmap=blue_red1) - fig.colorbar(im1, ax=axs[0, 0]) - - cmap = plt.get_cmap('BlueRed2') - im2 = axs[1, 0].imshow(Z, interpolation='nearest', cmap=cmap) - fig.colorbar(im2, ax=axs[1, 0]) - - # Now we will set the third cmap as the default. One would - # not normally do this in the middle of a script like this; - # it is done here just to illustrate the method. - - plt.rcParams['image.cmap'] = 'BlueRed3' - - im3 = axs[0, 1].imshow(Z, interpolation='nearest') - fig.colorbar(im3, ax=axs[0, 1]) - axs[0, 1].set_title("Alpha = 1") - - # Or as yet another variation, we can replace the rcParams - # specification *before* the imshow with the following *after* - # imshow. - # This sets the new default *and* sets the colormap of the last - # image-like item plotted via pyplot, if any. - # - - # Draw a line with low zorder so it will be behind the image. - axs[1, 1].plot([0, 10*np.pi], [0, 20*np.pi], color='c', lw=20, zorder=-1) - - im4 = axs[1, 1].imshow(Z, interpolation='nearest') - fig.colorbar(im4, ax=axs[1, 1]) - - # Here it is: changing the colormap for the current image and its - # colorbar after they have been plotted. - im4.set_cmap('BlueRedAlpha') - axs[1, 1].set_title("Varying alpha") - # - - fig.suptitle('Custom Blue-Red colormaps', fontsize=16) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/custom_cmap.txt b/_sources/examples/pylab_examples/custom_cmap.txt deleted file mode 100644 index c2458ba17a9..00000000000 --- a/_sources/examples/pylab_examples/custom_cmap.txt +++ /dev/null @@ -1,231 +0,0 @@ -.. _pylab_examples-custom_cmap: - -pylab_examples example code: custom_cmap.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/custom_cmap.py - -:: - - #!/usr/bin/env python - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.colors import LinearSegmentedColormap - - """ - Creating a colormap from a list of colors - ----------------------------------------- - Creating a colormap from a list of colors can be done with the `from_list` - method of `LinearSegmentedColormap`. You must pass a list of RGB tuples that - define the mixture of colors from 0 to 1. - - - Creating custom colormaps - ------------------------- - It is also possible to create a custom mapping for a colormap. This is - accomplished by creating dictionary that specifies how the RGB channels - change from one end of the cmap to the other. - - Example: suppose you want red to increase from 0 to 1 over the bottom - half, green to do the same over the middle half, and blue over the top - half. Then you would use: - - cdict = {'red': ((0.0, 0.0, 0.0), - (0.5, 1.0, 1.0), - (1.0, 1.0, 1.0)), - - 'green': ((0.0, 0.0, 0.0), - (0.25, 0.0, 0.0), - (0.75, 1.0, 1.0), - (1.0, 1.0, 1.0)), - - 'blue': ((0.0, 0.0, 0.0), - (0.5, 0.0, 0.0), - (1.0, 1.0, 1.0))} - - If, as in this example, there are no discontinuities in the r, g, and b - components, then it is quite simple: the second and third element of - each tuple, above, is the same--call it "y". The first element ("x") - defines interpolation intervals over the full range of 0 to 1, and it - must span that whole range. In other words, the values of x divide the - 0-to-1 range into a set of segments, and y gives the end-point color - values for each segment. - - Now consider the green. cdict['green'] is saying that for - 0 <= x <= 0.25, y is zero; no green. - 0.25 < x <= 0.75, y varies linearly from 0 to 1. - x > 0.75, y remains at 1, full green. - - If there are discontinuities, then it is a little more complicated. - Label the 3 elements in each row in the cdict entry for a given color as - (x, y0, y1). Then for values of x between x[i] and x[i+1] the color - value is interpolated between y1[i] and y0[i+1]. - - Going back to the cookbook example, look at cdict['red']; because y0 != - y1, it is saying that for x from 0 to 0.5, red increases from 0 to 1, - but then it jumps down, so that for x from 0.5 to 1, red increases from - 0.7 to 1. Green ramps from 0 to 1 as x goes from 0 to 0.5, then jumps - back to 0, and ramps back to 1 as x goes from 0.5 to 1. - - row i: x y0 y1 - / - / - row i+1: x y0 y1 - - Above is an attempt to show that for x in the range x[i] to x[i+1], the - interpolation is between y1[i] and y0[i+1]. So, y0[0] and y1[-1] are - never used. - - """ - # Make some illustrative fake data: - - x = np.arange(0, np.pi, 0.1) - y = np.arange(0, 2*np.pi, 0.1) - X, Y = np.meshgrid(x, y) - Z = np.cos(X) * np.sin(Y) * 10 - - - # --- Colormaps from a list --- - - colors = [(1, 0, 0), (0, 1, 0), (0, 0, 1)] # R -> G -> B - n_bins = [3, 6, 10, 100] # Discretizes the interpolation into bins - cmap_name = 'my_list' - fig, axs = plt.subplots(2, 2, figsize=(6, 9)) - fig.subplots_adjust(left=0.02, bottom=0.06, right=0.95, top=0.94, wspace=0.05) - for n_bin, ax in zip(n_bins, axs.ravel()): - # Create the colormap - cm = LinearSegmentedColormap.from_list( - cmap_name, colors, N=n_bin) - # Fewer bins will result in "coarser" colomap interpolation - im = ax.imshow(Z, interpolation='nearest', origin='lower', cmap=cm) - ax.set_title("N bins: %s" % n_bin) - fig.colorbar(im, ax=ax) - - - # --- Custom colormaps --- - - cdict1 = {'red': ((0.0, 0.0, 0.0), - (0.5, 0.0, 0.1), - (1.0, 1.0, 1.0)), - - 'green': ((0.0, 0.0, 0.0), - (1.0, 0.0, 0.0)), - - 'blue': ((0.0, 0.0, 1.0), - (0.5, 0.1, 0.0), - (1.0, 0.0, 0.0)) - } - - cdict2 = {'red': ((0.0, 0.0, 0.0), - (0.5, 0.0, 1.0), - (1.0, 0.1, 1.0)), - - 'green': ((0.0, 0.0, 0.0), - (1.0, 0.0, 0.0)), - - 'blue': ((0.0, 0.0, 0.1), - (0.5, 1.0, 0.0), - (1.0, 0.0, 0.0)) - } - - cdict3 = {'red': ((0.0, 0.0, 0.0), - (0.25, 0.0, 0.0), - (0.5, 0.8, 1.0), - (0.75, 1.0, 1.0), - (1.0, 0.4, 1.0)), - - 'green': ((0.0, 0.0, 0.0), - (0.25, 0.0, 0.0), - (0.5, 0.9, 0.9), - (0.75, 0.0, 0.0), - (1.0, 0.0, 0.0)), - - 'blue': ((0.0, 0.0, 0.4), - (0.25, 1.0, 1.0), - (0.5, 1.0, 0.8), - (0.75, 0.0, 0.0), - (1.0, 0.0, 0.0)) - } - - # Make a modified version of cdict3 with some transparency - # in the middle of the range. - cdict4 = cdict3.copy() - cdict4['alpha'] = ((0.0, 1.0, 1.0), - # (0.25,1.0, 1.0), - (0.5, 0.3, 0.3), - # (0.75,1.0, 1.0), - (1.0, 1.0, 1.0)) - - - # Now we will use this example to illustrate 3 ways of - # handling custom colormaps. - # First, the most direct and explicit: - - blue_red1 = LinearSegmentedColormap('BlueRed1', cdict1) - - # Second, create the map explicitly and register it. - # Like the first method, this method works with any kind - # of Colormap, not just - # a LinearSegmentedColormap: - - blue_red2 = LinearSegmentedColormap('BlueRed2', cdict2) - plt.register_cmap(cmap=blue_red2) - - # Third, for LinearSegmentedColormap only, - # leave everything to register_cmap: - - plt.register_cmap(name='BlueRed3', data=cdict3) # optional lut kwarg - plt.register_cmap(name='BlueRedAlpha', data=cdict4) - - # Make the figure: - - fig, axs = plt.subplots(2, 2, figsize=(6, 9)) - fig.subplots_adjust(left=0.02, bottom=0.06, right=0.95, top=0.94, wspace=0.05) - - # Make 4 subplots: - - im1 = axs[0, 0].imshow(Z, interpolation='nearest', cmap=blue_red1) - fig.colorbar(im1, ax=axs[0, 0]) - - cmap = plt.get_cmap('BlueRed2') - im2 = axs[1, 0].imshow(Z, interpolation='nearest', cmap=cmap) - fig.colorbar(im2, ax=axs[1, 0]) - - # Now we will set the third cmap as the default. One would - # not normally do this in the middle of a script like this; - # it is done here just to illustrate the method. - - plt.rcParams['image.cmap'] = 'BlueRed3' - - im3 = axs[0, 1].imshow(Z, interpolation='nearest') - fig.colorbar(im3, ax=axs[0, 1]) - axs[0, 1].set_title("Alpha = 1") - - # Or as yet another variation, we can replace the rcParams - # specification *before* the imshow with the following *after* - # imshow. - # This sets the new default *and* sets the colormap of the last - # image-like item plotted via pyplot, if any. - # - - # Draw a line with low zorder so it will be behind the image. - axs[1, 1].plot([0, 10*np.pi], [0, 20*np.pi], color='c', lw=20, zorder=-1) - - im4 = axs[1, 1].imshow(Z, interpolation='nearest') - fig.colorbar(im4, ax=axs[1, 1]) - - # Here it is: changing the colormap for the current image and its - # colorbar after they have been plotted. - im4.set_cmap('BlueRedAlpha') - axs[1, 1].set_title("Varying alpha") - # - - fig.suptitle('Custom Blue-Red colormaps', fontsize=16) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/custom_figure_class.rst.txt b/_sources/examples/pylab_examples/custom_figure_class.rst.txt deleted file mode 100644 index 5ec1ce824a0..00000000000 --- a/_sources/examples/pylab_examples/custom_figure_class.rst.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _pylab_examples-custom_figure_class: - -pylab_examples example code: custom_figure_class.py -=================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/custom_figure_class.py - -:: - - """ - You can pass a custom Figure constructor to figure if you want to derive from the default Figure. This simple example creates a figure with a figure title - """ - from matplotlib.pyplot import figure, show - from matplotlib.figure import Figure - - - class MyFigure(Figure): - def __init__(self, *args, **kwargs): - """ - custom kwarg figtitle is a figure title - """ - figtitle = kwargs.pop('figtitle', 'hi mom') - Figure.__init__(self, *args, **kwargs) - self.text(0.5, 0.95, figtitle, ha='center') - - fig = figure(FigureClass=MyFigure, figtitle='my title') - ax = fig.add_subplot(111) - ax.plot([1, 2, 3]) - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/custom_figure_class.txt b/_sources/examples/pylab_examples/custom_figure_class.txt deleted file mode 100644 index c5d7bfc296b..00000000000 --- a/_sources/examples/pylab_examples/custom_figure_class.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _pylab_examples-custom_figure_class: - -pylab_examples example code: custom_figure_class.py -=================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/custom_figure_class.py - -:: - - """ - You can pass a custom Figure constructor to figure if you want to derive from the default Figure. This simple example creates a figure with a figure title - """ - from matplotlib.pyplot import figure, show - from matplotlib.figure import Figure - - - class MyFigure(Figure): - def __init__(self, *args, **kwargs): - """ - custom kwarg figtitle is a figure title - """ - figtitle = kwargs.pop('figtitle', 'hi mom') - Figure.__init__(self, *args, **kwargs) - self.text(0.5, 0.95, figtitle, ha='center') - - fig = figure(FigureClass=MyFigure, figtitle='my title') - ax = fig.add_subplot(111) - ax.plot([1, 2, 3]) - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/custom_ticker1.rst.txt b/_sources/examples/pylab_examples/custom_ticker1.rst.txt deleted file mode 100644 index cf5afc523af..00000000000 --- a/_sources/examples/pylab_examples/custom_ticker1.rst.txt +++ /dev/null @@ -1,43 +0,0 @@ -.. _pylab_examples-custom_ticker1: - -pylab_examples example code: custom_ticker1.py -============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/custom_ticker1.py - -:: - - """ - The new ticker code was designed to explicitly support user customized - ticking. The documentation - http://matplotlib.org/matplotlib.ticker.html details this - process. That code defines a lot of preset tickers but was primarily - designed to be user extensible. - - In this example a user defined function is used to format the ticks in - millions of dollars on the y axis - """ - from matplotlib.ticker import FuncFormatter - import matplotlib.pyplot as plt - import numpy as np - - x = np.arange(4) - money = [1.5e5, 2.5e6, 5.5e6, 2.0e7] - - - def millions(x, pos): - 'The two args are the value and tick position' - return '$%1.1fM' % (x*1e-6) - - formatter = FuncFormatter(millions) - - fig, ax = plt.subplots() - ax.yaxis.set_major_formatter(formatter) - plt.bar(x, money) - plt.xticks(x, ('Bill', 'Fred', 'Mary', 'Sue')) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/custom_ticker1.txt b/_sources/examples/pylab_examples/custom_ticker1.txt deleted file mode 100644 index 10da6c495e0..00000000000 --- a/_sources/examples/pylab_examples/custom_ticker1.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _pylab_examples-custom_ticker1: - -pylab_examples example code: custom_ticker1.py -============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/custom_ticker1.py - -:: - - #!/usr/bin/env python - - """ - The new ticker code was designed to explicitly support user customized - ticking. The documentation - http://matplotlib.org/matplotlib.ticker.html details this - process. That code defines a lot of preset tickers but was primarily - designed to be user extensible. - - In this example a user defined function is used to format the ticks in - millions of dollars on the y axis - """ - from matplotlib.ticker import FuncFormatter - import matplotlib.pyplot as plt - import numpy as np - - x = np.arange(4) - money = [1.5e5, 2.5e6, 5.5e6, 2.0e7] - - - def millions(x, pos): - 'The two args are the value and tick position' - return '$%1.1fM' % (x*1e-6) - - formatter = FuncFormatter(millions) - - fig, ax = plt.subplots() - ax.yaxis.set_major_formatter(formatter) - plt.bar(x, money) - plt.xticks(x + 0.5, ('Bill', 'Fred', 'Mary', 'Sue')) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/customize_rc.rst.txt b/_sources/examples/pylab_examples/customize_rc.rst.txt deleted file mode 100644 index f0b08be5959..00000000000 --- a/_sources/examples/pylab_examples/customize_rc.rst.txt +++ /dev/null @@ -1,64 +0,0 @@ -.. _pylab_examples-customize_rc: - -pylab_examples example code: customize_rc.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/customize_rc.py - -:: - - """ - I'm not trying to make a good looking figure here, but just to show - some examples of customizing rc params on the fly - - If you like to work interactively, and need to create different sets - of defaults for figures (e.g., one set of defaults for publication, one - set for interactive exploration), you may want to define some - functions in a custom module that set the defaults, e.g., - - def set_pub(): - rc('font', weight='bold') # bold fonts are easier to see - 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 - - - - Then as you are working interactively, you just need to do - - >>> set_pub() - >>> subplot(111) - >>> plot([1,2,3]) - >>> savefig('myfig') - >>> rcdefaults() # restore the defaults - - """ - import matplotlib.pyplot as plt - - plt.subplot(311) - plt.plot([1, 2, 3]) - - # the axes attributes need to be set before the call to subplot - plt.rc('font', weight='bold') - plt.rc('xtick.major', size=5, pad=7) - plt.rc('xtick', labelsize=15) - - # using aliases for color, linestyle and linewidth; gray, solid, thick - plt.rc('grid', c='0.5', ls='-', lw=5) - plt.rc('lines', lw=2, color='g') - plt.subplot(312) - - plt.plot([1, 2, 3]) - plt.grid(True) - - plt.rcdefaults() - plt.subplot(313) - plt.plot([1, 2, 3]) - plt.grid(True) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/customize_rc.txt b/_sources/examples/pylab_examples/customize_rc.txt deleted file mode 100644 index f689e264604..00000000000 --- a/_sources/examples/pylab_examples/customize_rc.txt +++ /dev/null @@ -1,64 +0,0 @@ -.. _pylab_examples-customize_rc: - -pylab_examples example code: customize_rc.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/customize_rc.py - -:: - - """ - I'm not trying to make a good looking figure here, but just to show - some examples of customizing rc params on the fly - - If you like to work interactively, and need to create different sets - of defaults for figures (e.g., one set of defaults for publication, one - set for interactive exploration), you may want to define some - functions in a custom module that set the defaults, e.g., - - def set_pub(): - rc('font', weight='bold') # bold fonts are easier to see - 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 - - - - Then as you are working interactively, you just need to do - - >>> set_pub() - >>> subplot(111) - >>> plot([1,2,3]) - >>> savefig('myfig') - >>> rcdefaults() # restore the defaults - - """ - import matplotlib.pyplot as plt - - plt.subplot(311) - plt.plot([1, 2, 3]) - - # the axes attributes need to be set before the call to subplot - plt.rc('font', weight='bold') - plt.rc('xtick.major', size=5, pad=7) - plt.rc('xtick', labelsize=15) - - # using aliases for color, linestyle and linewidth; gray, solid, thick - plt.rc('grid', c='0.5', ls='-', lw=5) - plt.rc('lines', lw=2, color='g') - plt.subplot(312) - - plt.plot([1, 2, 3]) - plt.grid(True) - - plt.rcdefaults() - plt.subplot(313) - plt.plot([1, 2, 3]) - plt.grid(True) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/dannys_example.txt b/_sources/examples/pylab_examples/dannys_example.txt deleted file mode 100644 index 1052a1d7b50..00000000000 --- a/_sources/examples/pylab_examples/dannys_example.txt +++ /dev/null @@ -1,73 +0,0 @@ -.. _pylab_examples-dannys_example: - -pylab_examples example code: dannys_example.py -============================================== - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/dannys_example.py - -:: - - import matplotlib - matplotlib.rc('text', usetex = True) - import pylab - import numpy as np - - ## interface tracking profiles - N = 500 - delta = 0.6 - X = -1 + 2. * np.arange(N) / (N - 1) - pylab.plot(X, (1 - np.tanh(4. * X / delta)) / 2, ## phase field tanh profiles - X, (X + 1) / 2, ## level set distance function - X, (1.4 + np.tanh(4. * X / delta)) / 4, ## composition profile - X, X < 0, 'k--', ## sharp interface - linewidth = 5) - - ## legend - pylab.legend((r'phase field', r'level set', r'composition', r'sharp interface'), shadow = True, loc = (0.01, 0.55)) - ltext = pylab.gca().get_legend().get_texts() - pylab.setp(ltext[0], fontsize = 20, color = 'b') - pylab.setp(ltext[1], fontsize = 20, color = 'g') - pylab.setp(ltext[2], fontsize = 20, color = 'r') - pylab.setp(ltext[3], fontsize = 20, color = 'k') - - ## the arrow - height = 0.1 - offset = 0.02 - pylab.plot((-delta / 2., delta / 2), (height, height), 'k', linewidth = 2) - pylab.plot((-delta / 2, -delta / 2 + offset * 2), (height, height - offset), 'k', linewidth = 2) - pylab.plot((-delta / 2, -delta / 2 + offset * 2), (height, height + offset), 'k', linewidth = 2) - pylab.plot((delta / 2, delta / 2 - offset * 2), (height, height - offset), 'k', linewidth = 2) - pylab.plot((delta / 2, delta / 2 - offset * 2), (height, height + offset), 'k', linewidth = 2) - pylab.text(-0.06, height - 0.06, r'$\delta$', {'color' : 'k', 'fontsize' : 24}) - - ## X-axis label - pylab.xticks((-1, 0, 1), ('-1', '0', '1'), color = 'k', size = 20) - - ## Left Y-axis labels - pylab.ylabel(r'\bf{phase field} $\phi$', {'color' : 'b', - 'fontsize' : 20 }) - pylab.yticks((0, 0.5, 1), ('0', '.5', '1'), color = 'k', size = 20) - - ## Right Y-axis labels - pylab.text(1.05, 0.5, r"\bf{level set} $\phi$", {'color' : 'g', 'fontsize' : 20}, - horizontalalignment = 'left', - verticalalignment = 'center', - rotation = 90, - clip_on = False) - pylab.text(1.01, -0.02, "-1", {'color' : 'k', 'fontsize' : 20}) - pylab.text(1.01, 0.98, "1", {'color' : 'k', 'fontsize' : 20}) - pylab.text(1.01, 0.48, "0", {'color' : 'k', 'fontsize' : 20}) - - ## level set equations - pylab.text(0.1, 0.85, r'$|\nabla\phi| = 1,$ \newline $ \frac{\partial \phi}{\partial t} + U|\nabla \phi| = 0$', {'color' : 'g', 'fontsize' : 20}) - - ## phase field equations - 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.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/dash_control.txt b/_sources/examples/pylab_examples/dash_control.txt deleted file mode 100644 index 8707b6bfa2c..00000000000 --- a/_sources/examples/pylab_examples/dash_control.txt +++ /dev/null @@ -1,28 +0,0 @@ -.. _pylab_examples-dash_control: - -pylab_examples example code: dash_control.py -============================================ - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/dash_control.py - -:: - - #!/usr/bin/env python - - """ - You can precisely specify dashes with an on/off ink rect sequence in - points. - """ - from pylab import * - - dashes = [5,2,10,5] # 5 points on, 2 off, 3 on, 1 off - - l, = plot(arange(20), '--') - l.set_dashes(dashes) - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/dashpointlabel.rst.txt b/_sources/examples/pylab_examples/dashpointlabel.rst.txt deleted file mode 100644 index 9fd5fdc4c95..00000000000 --- a/_sources/examples/pylab_examples/dashpointlabel.rst.txt +++ /dev/null @@ -1,51 +0,0 @@ -.. _pylab_examples-dashpointlabel: - -pylab_examples example code: dashpointlabel.py -============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/dashpointlabel.py - -:: - - import matplotlib.pyplot as plt - - DATA = ((1, 3), - (2, 4), - (3, 1), - (4, 2)) - # dash_style = - # direction, length, (text)rotation, dashrotation, push - # (The parameters are varied to show their effects, - # not for visual appeal). - dash_style = ( - (0, 20, -15, 30, 10), - (1, 30, 0, 15, 10), - (0, 40, 15, 15, 10), - (1, 20, 30, 60, 10), - ) - - fig, ax = plt.subplots() - - (x, y) = zip(*DATA) - ax.plot(x, y, marker='o') - for i in range(len(DATA)): - (x, y) = DATA[i] - (dd, dl, r, dr, dp) = dash_style[i] - #print('dashlen call %d' % dl) - t = ax.text(x, y, str((x, y)), withdash=True, - dashdirection=dd, - dashlength=dl, - rotation=r, - dashrotation=dr, - dashpush=dp, - ) - - ax.set_xlim((0.0, 5.0)) - ax.set_ylim((0.0, 5.0)) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/dashpointlabel.txt b/_sources/examples/pylab_examples/dashpointlabel.txt deleted file mode 100644 index 47d17dfc686..00000000000 --- a/_sources/examples/pylab_examples/dashpointlabel.txt +++ /dev/null @@ -1,51 +0,0 @@ -.. _pylab_examples-dashpointlabel: - -pylab_examples example code: dashpointlabel.py -============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/dashpointlabel.py - -:: - - import matplotlib.pyplot as plt - - DATA = ((1, 3), - (2, 4), - (3, 1), - (4, 2)) - # dash_style = - # direction, length, (text)rotation, dashrotation, push - # (The parameters are varied to show their effects, - # not for visual appeal). - dash_style = ( - (0, 20, -15, 30, 10), - (1, 30, 0, 15, 10), - (0, 40, 15, 15, 10), - (1, 20, 30, 60, 10), - ) - - fig, ax = plt.subplots() - - (x, y) = zip(*DATA) - ax.plot(x, y, marker='o') - for i in range(len(DATA)): - (x, y) = DATA[i] - (dd, dl, r, dr, dp) = dash_style[i] - #print('dashlen call %d' % dl) - t = ax.text(x, y, str((x, y)), withdash=True, - dashdirection=dd, - dashlength=dl, - rotation=r, - dashrotation=dr, - dashpush=dp, - ) - - ax.set_xlim((0.0, 5.0)) - ax.set_ylim((0.0, 5.0)) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/data_helper.txt b/_sources/examples/pylab_examples/data_helper.txt deleted file mode 100644 index a63733b242b..00000000000 --- a/_sources/examples/pylab_examples/data_helper.txt +++ /dev/null @@ -1,75 +0,0 @@ -.. _pylab_examples-data_helper: - -pylab_examples example code: data_helper.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/data_helper.py - -:: - - #!/usr/bin/env python - # Some functions to load a return data for the plot demos - - from numpy import fromstring, argsort, take, array, resize - import matplotlib.cbook as cbook - - - def get_two_stock_data(): - """ - load stock time and price data for two stocks The return values - (d1,p1,d2,p2) are the trade time (in days) and prices for stocks 1 - and 2 (intc and aapl) - """ - ticker1, ticker2 = 'INTC', 'AAPL' - - file1 = cbook.get_sample_data('INTC.dat.gz') - file2 = cbook.get_sample_data('AAPL.dat.gz') - M1 = fromstring(file1.read(), '= len(self.dates) or ind < 0: - return '' - - return self.dates[ind].strftime(self.fmt) - - formatter = MyFormatter(r.date) - - fig, ax = plt.subplots() - ax.xaxis.set_major_formatter(formatter) - ax.plot(np.arange(len(r)), r.close, 'o-') - fig.autofmt_xdate() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/date_index_formatter.txt b/_sources/examples/pylab_examples/date_index_formatter.txt deleted file mode 100644 index 9f1c9dc2795..00000000000 --- a/_sources/examples/pylab_examples/date_index_formatter.txt +++ /dev/null @@ -1,56 +0,0 @@ -.. _pylab_examples-date_index_formatter: - -pylab_examples example code: date_index_formatter.py -==================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/date_index_formatter.py - -:: - - - """ - When plotting daily data, a frequent request is to plot the data - ignoring skips, e.g., no extra spaces for weekends. This is particularly - common in financial time series, when you may have data for M-F and - not Sat, Sun and you don't want gaps in the x axis. The approach is - to simply use the integer index for the xdata and a custom tick - Formatter to get the appropriate date string for a given index. - """ - - from __future__ import print_function - import numpy - from matplotlib.mlab import csv2rec - import matplotlib.pyplot as plt - import matplotlib.cbook as cbook - from matplotlib.ticker import Formatter - - datafile = cbook.get_sample_data('msft.csv', asfileobj=False) - print('loading %s' % datafile) - r = csv2rec(datafile)[-40:] - - - class MyFormatter(Formatter): - def __init__(self, dates, fmt='%Y-%m-%d'): - self.dates = dates - self.fmt = fmt - - def __call__(self, x, pos=0): - 'Return the label for time x at position pos' - ind = int(round(x)) - if ind >= len(self.dates) or ind < 0: - return '' - - return self.dates[ind].strftime(self.fmt) - - formatter = MyFormatter(r.date) - - fig, ax = plt.subplots() - ax.xaxis.set_major_formatter(formatter) - ax.plot(numpy.arange(len(r)), r.close, 'o-') - fig.autofmt_xdate() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/demo_agg_filter.rst.txt b/_sources/examples/pylab_examples/demo_agg_filter.rst.txt deleted file mode 100644 index 45b35b3194c..00000000000 --- a/_sources/examples/pylab_examples/demo_agg_filter.rst.txt +++ /dev/null @@ -1,344 +0,0 @@ -.. _pylab_examples-demo_agg_filter: - -pylab_examples example code: demo_agg_filter.py -=============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/demo_agg_filter.py - -:: - - import matplotlib.pyplot as plt - - import numpy as np - import matplotlib.cm as cm - import matplotlib.mlab as mlab - - - def smooth1d(x, window_len): - # copied from http://www.scipy.org/Cookbook/SignalSmooth - - s = np.r_[2*x[0] - x[window_len:1:-1], x, 2*x[-1] - x[-1:-window_len:-1]] - w = np.hanning(window_len) - y = np.convolve(w/w.sum(), s, mode='same') - return y[window_len-1:-window_len+1] - - - def smooth2d(A, sigma=3): - - window_len = max(int(sigma), 3)*2 + 1 - A1 = np.array([smooth1d(x, window_len) for x in np.asarray(A)]) - A2 = np.transpose(A1) - A3 = np.array([smooth1d(x, window_len) for x in A2]) - A4 = np.transpose(A3) - - return A4 - - - class BaseFilter(object): - def prepare_image(self, src_image, dpi, pad): - ny, nx, depth = src_image.shape - #tgt_image = np.zeros([pad*2+ny, pad*2+nx, depth], dtype="d") - padded_src = np.zeros([pad*2 + ny, pad*2 + nx, depth], dtype="d") - padded_src[pad:-pad, pad:-pad, :] = src_image[:, :, :] - - return padded_src # , tgt_image - - def get_pad(self, dpi): - return 0 - - def __call__(self, im, dpi): - pad = self.get_pad(dpi) - padded_src = self.prepare_image(im, dpi, pad) - tgt_image = self.process_image(padded_src, dpi) - return tgt_image, -pad, -pad - - - class OffsetFilter(BaseFilter): - def __init__(self, offsets=None): - if offsets is None: - self.offsets = (0, 0) - else: - self.offsets = offsets - - def get_pad(self, dpi): - return int(max(*self.offsets)/72.*dpi) - - def process_image(self, padded_src, dpi): - ox, oy = self.offsets - a1 = np.roll(padded_src, int(ox/72.*dpi), axis=1) - a2 = np.roll(a1, -int(oy/72.*dpi), axis=0) - return a2 - - - class GaussianFilter(BaseFilter): - "simple gauss filter" - - def __init__(self, sigma, alpha=0.5, color=None): - self.sigma = sigma - self.alpha = alpha - if color is None: - self.color = (0, 0, 0) - else: - self.color = color - - def get_pad(self, dpi): - return int(self.sigma*3/72.*dpi) - - def process_image(self, padded_src, dpi): - #offsetx, offsety = int(self.offsets[0]), int(self.offsets[1]) - tgt_image = np.zeros_like(padded_src) - aa = smooth2d(padded_src[:, :, -1]*self.alpha, - self.sigma/72.*dpi) - tgt_image[:, :, -1] = aa - tgt_image[:, :, :-1] = self.color - return tgt_image - - - class DropShadowFilter(BaseFilter): - def __init__(self, sigma, alpha=0.3, color=None, offsets=None): - self.gauss_filter = GaussianFilter(sigma, alpha, color) - self.offset_filter = OffsetFilter(offsets) - - def get_pad(self, dpi): - return max(self.gauss_filter.get_pad(dpi), - self.offset_filter.get_pad(dpi)) - - def process_image(self, padded_src, dpi): - t1 = self.gauss_filter.process_image(padded_src, dpi) - t2 = self.offset_filter.process_image(t1, dpi) - return t2 - - - from matplotlib.colors import LightSource - - - class LightFilter(BaseFilter): - "simple gauss filter" - - def __init__(self, sigma, fraction=0.5): - self.gauss_filter = GaussianFilter(sigma, alpha=1) - self.light_source = LightSource() - self.fraction = fraction - - def get_pad(self, dpi): - return self.gauss_filter.get_pad(dpi) - - def process_image(self, padded_src, dpi): - t1 = self.gauss_filter.process_image(padded_src, dpi) - elevation = t1[:, :, 3] - rgb = padded_src[:, :, :3] - - rgb2 = self.light_source.shade_rgb(rgb, elevation, - fraction=self.fraction) - - tgt = np.empty_like(padded_src) - tgt[:, :, :3] = rgb2 - tgt[:, :, 3] = padded_src[:, :, 3] - - return tgt - - - class GrowFilter(BaseFilter): - "enlarge the area" - - def __init__(self, pixels, color=None): - self.pixels = pixels - if color is None: - self.color = (1, 1, 1) - else: - self.color = color - - def __call__(self, im, dpi): - pad = self.pixels - ny, nx, depth = im.shape - new_im = np.empty([pad*2 + ny, pad*2 + nx, depth], dtype="d") - alpha = new_im[:, :, 3] - alpha.fill(0) - alpha[pad:-pad, pad:-pad] = im[:, :, -1] - alpha2 = np.clip(smooth2d(alpha, self.pixels/72.*dpi) * 5, 0, 1) - new_im[:, :, -1] = alpha2 - new_im[:, :, :-1] = self.color - offsetx, offsety = -pad, -pad - - return new_im, offsetx, offsety - - - from matplotlib.artist import Artist - - - class FilteredArtistList(Artist): - """ - A simple container to draw filtered artist. - """ - - def __init__(self, artist_list, filter): - self._artist_list = artist_list - self._filter = filter - Artist.__init__(self) - - def draw(self, renderer): - renderer.start_rasterizing() - renderer.start_filter() - for a in self._artist_list: - a.draw(renderer) - renderer.stop_filter(self._filter) - renderer.stop_rasterizing() - - - import matplotlib.transforms as mtransforms - - - def filtered_text(ax): - # mostly copied from contour_demo.py - - # prepare image - delta = 0.025 - x = np.arange(-3.0, 3.0, delta) - y = np.arange(-2.0, 2.0, delta) - X, Y = np.meshgrid(x, y) - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - # difference of Gaussians - Z = 10.0 * (Z2 - Z1) - - # draw - im = ax.imshow(Z, interpolation='bilinear', origin='lower', - cmap=cm.gray, extent=(-3, 3, -2, 2)) - levels = np.arange(-1.2, 1.6, 0.2) - CS = ax.contour(Z, levels, - origin='lower', - linewidths=2, - extent=(-3, 3, -2, 2)) - - ax.set_aspect("auto") - - # contour label - cl = ax.clabel(CS, levels[1::2], # label every second level - inline=1, - fmt='%1.1f', - fontsize=11) - - # change clable color to black - from matplotlib.patheffects import Normal - for t in cl: - t.set_color("k") - # to force TextPath (i.e., same font in all backends) - t.set_path_effects([Normal()]) - - # Add white glows to improve visibility of labels. - white_glows = FilteredArtistList(cl, GrowFilter(3)) - ax.add_artist(white_glows) - white_glows.set_zorder(cl[0].get_zorder() - 0.1) - - ax.xaxis.set_visible(False) - ax.yaxis.set_visible(False) - - - def drop_shadow_line(ax): - # copied from examples/misc/svg_filter_line.py - - # draw lines - l1, = ax.plot([0.1, 0.5, 0.9], [0.1, 0.9, 0.5], "bo-", - mec="b", mfc="w", lw=5, mew=3, ms=10, label="Line 1") - l2, = ax.plot([0.1, 0.5, 0.9], [0.5, 0.2, 0.7], "ro-", - mec="r", mfc="w", lw=5, mew=3, ms=10, label="Line 1") - - gauss = DropShadowFilter(4) - - for l in [l1, l2]: - - # draw shadows with same lines with slight offset. - - xx = l.get_xdata() - yy = l.get_ydata() - shadow, = ax.plot(xx, yy) - shadow.update_from(l) - - # offset transform - ot = mtransforms.offset_copy(l.get_transform(), ax.figure, - x=4.0, y=-6.0, units='points') - - shadow.set_transform(ot) - - # adjust zorder of the shadow lines so that it is drawn below the - # original lines - shadow.set_zorder(l.get_zorder() - 0.5) - shadow.set_agg_filter(gauss) - shadow.set_rasterized(True) # to support mixed-mode renderers - - ax.set_xlim(0., 1.) - ax.set_ylim(0., 1.) - - ax.xaxis.set_visible(False) - ax.yaxis.set_visible(False) - - - def drop_shadow_patches(ax): - # Copied from barchart_demo.py - N = 5 - menMeans = (20, 35, 30, 35, 27) - - ind = np.arange(N) # the x locations for the groups - width = 0.35 # the width of the bars - - rects1 = ax.bar(ind, menMeans, width, color='r', ec="w", lw=2) - - womenMeans = (25, 32, 34, 20, 25) - rects2 = ax.bar(ind + width + 0.1, womenMeans, width, color='y', ec="w", lw=2) - - #gauss = GaussianFilter(1.5, offsets=(1,1), ) - gauss = DropShadowFilter(5, offsets=(1, 1), ) - shadow = FilteredArtistList(rects1 + rects2, gauss) - ax.add_artist(shadow) - shadow.set_zorder(rects1[0].get_zorder() - 0.1) - - ax.set_ylim(0, 40) - - ax.xaxis.set_visible(False) - ax.yaxis.set_visible(False) - - - def light_filter_pie(ax): - fracs = [15, 30, 45, 10] - explode = (0, 0.05, 0, 0) - pies = ax.pie(fracs, explode=explode) - ax.patch.set_visible(True) - - light_filter = LightFilter(9) - for p in pies[0]: - p.set_agg_filter(light_filter) - p.set_rasterized(True) # to support mixed-mode renderers - p.set(ec="none", - lw=2) - - gauss = DropShadowFilter(9, offsets=(3, 4), alpha=0.7) - shadow = FilteredArtistList(pies[0], gauss) - ax.add_artist(shadow) - shadow.set_zorder(pies[0][0].get_zorder() - 0.1) - - - if 1: - - plt.figure(1, figsize=(6, 6)) - plt.subplots_adjust(left=0.05, right=0.95) - - ax = plt.subplot(221) - filtered_text(ax) - - ax = plt.subplot(222) - drop_shadow_line(ax) - - ax = plt.subplot(223) - drop_shadow_patches(ax) - - ax = plt.subplot(224) - ax.set_aspect(1) - light_filter_pie(ax) - ax.set_frame_on(True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/demo_agg_filter.txt b/_sources/examples/pylab_examples/demo_agg_filter.txt deleted file mode 100644 index be1a07ba022..00000000000 --- a/_sources/examples/pylab_examples/demo_agg_filter.txt +++ /dev/null @@ -1,345 +0,0 @@ -.. _pylab_examples-demo_agg_filter: - -pylab_examples example code: demo_agg_filter.py -=============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/demo_agg_filter.py - -:: - - import matplotlib.pyplot as plt - - import numpy as np - import matplotlib.cm as cm - import matplotlib.mlab as mlab - - - def smooth1d(x, window_len): - # copied from http://www.scipy.org/Cookbook/SignalSmooth - - s = np.r_[2*x[0] - x[window_len:1:-1], x, 2*x[-1] - x[-1:-window_len:-1]] - w = np.hanning(window_len) - y = np.convolve(w/w.sum(), s, mode='same') - return y[window_len-1:-window_len+1] - - - def smooth2d(A, sigma=3): - - window_len = max(int(sigma), 3)*2 + 1 - A1 = np.array([smooth1d(x, window_len) for x in np.asarray(A)]) - A2 = np.transpose(A1) - A3 = np.array([smooth1d(x, window_len) for x in A2]) - A4 = np.transpose(A3) - - return A4 - - - class BaseFilter(object): - def prepare_image(self, src_image, dpi, pad): - ny, nx, depth = src_image.shape - #tgt_image = np.zeros([pad*2+ny, pad*2+nx, depth], dtype="d") - padded_src = np.zeros([pad*2 + ny, pad*2 + nx, depth], dtype="d") - padded_src[pad:-pad, pad:-pad, :] = src_image[:, :, :] - - return padded_src # , tgt_image - - def get_pad(self, dpi): - return 0 - - def __call__(self, im, dpi): - pad = self.get_pad(dpi) - padded_src = self.prepare_image(im, dpi, pad) - tgt_image = self.process_image(padded_src, dpi) - return tgt_image, -pad, -pad - - - class OffsetFilter(BaseFilter): - def __init__(self, offsets=None): - if offsets is None: - self.offsets = (0, 0) - else: - self.offsets = offsets - - def get_pad(self, dpi): - return int(max(*self.offsets)/72.*dpi) - - def process_image(self, padded_src, dpi): - ox, oy = self.offsets - a1 = np.roll(padded_src, int(ox/72.*dpi), axis=1) - a2 = np.roll(a1, -int(oy/72.*dpi), axis=0) - return a2 - - - class GaussianFilter(BaseFilter): - "simple gauss filter" - - def __init__(self, sigma, alpha=0.5, color=None): - self.sigma = sigma - self.alpha = alpha - if color is None: - self.color = (0, 0, 0) - else: - self.color = color - - def get_pad(self, dpi): - return int(self.sigma*3/72.*dpi) - - def process_image(self, padded_src, dpi): - #offsetx, offsety = int(self.offsets[0]), int(self.offsets[1]) - tgt_image = np.zeros_like(padded_src) - aa = smooth2d(padded_src[:, :, -1]*self.alpha, - self.sigma/72.*dpi) - tgt_image[:, :, -1] = aa - tgt_image[:, :, :-1] = self.color - return tgt_image - - - class DropShadowFilter(BaseFilter): - def __init__(self, sigma, alpha=0.3, color=None, offsets=None): - self.gauss_filter = GaussianFilter(sigma, alpha, color) - self.offset_filter = OffsetFilter(offsets) - - def get_pad(self, dpi): - return max(self.gauss_filter.get_pad(dpi), - self.offset_filter.get_pad(dpi)) - - def process_image(self, padded_src, dpi): - t1 = self.gauss_filter.process_image(padded_src, dpi) - t2 = self.offset_filter.process_image(t1, dpi) - return t2 - - - from matplotlib.colors import LightSource - - - class LightFilter(BaseFilter): - "simple gauss filter" - - def __init__(self, sigma, fraction=0.5): - self.gauss_filter = GaussianFilter(sigma, alpha=1) - self.light_source = LightSource() - self.fraction = fraction - - def get_pad(self, dpi): - return self.gauss_filter.get_pad(dpi) - - def process_image(self, padded_src, dpi): - t1 = self.gauss_filter.process_image(padded_src, dpi) - elevation = t1[:, :, 3] - rgb = padded_src[:, :, :3] - - rgb2 = self.light_source.shade_rgb(rgb, elevation, - fraction=self.fraction) - - tgt = np.empty_like(padded_src) - tgt[:, :, :3] = rgb2 - tgt[:, :, 3] = padded_src[:, :, 3] - - return tgt - - - class GrowFilter(BaseFilter): - "enlarge the area" - - def __init__(self, pixels, color=None): - self.pixels = pixels - if color is None: - self.color = (1, 1, 1) - else: - self.color = color - - def __call__(self, im, dpi): - pad = self.pixels - ny, nx, depth = im.shape - new_im = np.empty([pad*2 + ny, pad*2 + nx, depth], dtype="d") - alpha = new_im[:, :, 3] - alpha.fill(0) - alpha[pad:-pad, pad:-pad] = im[:, :, -1] - alpha2 = np.clip(smooth2d(alpha, self.pixels/72.*dpi) * 5, 0, 1) - new_im[:, :, -1] = alpha2 - new_im[:, :, :-1] = self.color - offsetx, offsety = -pad, -pad - - return new_im, offsetx, offsety - - - from matplotlib.artist import Artist - - - class FilteredArtistList(Artist): - """ - A simple container to draw filtered artist. - """ - - def __init__(self, artist_list, filter): - self._artist_list = artist_list - self._filter = filter - Artist.__init__(self) - - def draw(self, renderer): - renderer.start_rasterizing() - renderer.start_filter() - for a in self._artist_list: - a.draw(renderer) - renderer.stop_filter(self._filter) - renderer.stop_rasterizing() - - - import matplotlib.transforms as mtransforms - - - def filtered_text(ax): - # mostly copied from contour_demo.py - - # prepare image - delta = 0.025 - x = np.arange(-3.0, 3.0, delta) - y = np.arange(-2.0, 2.0, delta) - X, Y = np.meshgrid(x, y) - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - # difference of Gaussians - Z = 10.0 * (Z2 - Z1) - - # draw - im = ax.imshow(Z, interpolation='bilinear', origin='lower', - cmap=cm.gray, extent=(-3, 3, -2, 2)) - levels = np.arange(-1.2, 1.6, 0.2) - CS = ax.contour(Z, levels, - origin='lower', - linewidths=2, - extent=(-3, 3, -2, 2)) - - ax.set_aspect("auto") - - # contour label - cl = ax.clabel(CS, levels[1::2], # label every second level - inline=1, - fmt='%1.1f', - fontsize=11) - - # change clable color to black - from matplotlib.patheffects import Normal - for t in cl: - t.set_color("k") - # to force TextPath (i.e., same font in all backends) - t.set_path_effects([Normal()]) - - # Add white glows to improve visibility of labels. - white_glows = FilteredArtistList(cl, GrowFilter(3)) - ax.add_artist(white_glows) - white_glows.set_zorder(cl[0].get_zorder() - 0.1) - - ax.xaxis.set_visible(False) - ax.yaxis.set_visible(False) - - - def drop_shadow_line(ax): - # copied from examples/misc/svg_filter_line.py - - # draw lines - l1, = ax.plot([0.1, 0.5, 0.9], [0.1, 0.9, 0.5], "bo-", - mec="b", mfc="w", lw=5, mew=3, ms=10, label="Line 1") - l2, = ax.plot([0.1, 0.5, 0.9], [0.5, 0.2, 0.7], "ro-", - mec="r", mfc="w", lw=5, mew=3, ms=10, label="Line 1") - - gauss = DropShadowFilter(4) - - for l in [l1, l2]: - - # draw shadows with same lines with slight offset. - - xx = l.get_xdata() - yy = l.get_ydata() - shadow, = ax.plot(xx, yy) - shadow.update_from(l) - - # offset transform - ot = mtransforms.offset_copy(l.get_transform(), ax.figure, - x=4.0, y=-6.0, units='points') - - shadow.set_transform(ot) - - # adjust zorder of the shadow lines so that it is drawn below the - # original lines - shadow.set_zorder(l.get_zorder() - 0.5) - shadow.set_agg_filter(gauss) - shadow.set_rasterized(True) # to support mixed-mode renderers - - ax.set_xlim(0., 1.) - ax.set_ylim(0., 1.) - - ax.xaxis.set_visible(False) - ax.yaxis.set_visible(False) - - - def drop_shadow_patches(ax): - # copyed from barchart_demo.py - N = 5 - menMeans = (20, 35, 30, 35, 27) - - ind = np.arange(N) # the x locations for the groups - width = 0.35 # the width of the bars - - rects1 = ax.bar(ind, menMeans, width, color='r', ec="w", lw=2) - - womenMeans = (25, 32, 34, 20, 25) - rects2 = ax.bar(ind + width + 0.1, womenMeans, width, color='y', ec="w", lw=2) - - #gauss = GaussianFilter(1.5, offsets=(1,1), ) - gauss = DropShadowFilter(5, offsets=(1, 1), ) - shadow = FilteredArtistList(rects1 + rects2, gauss) - ax.add_artist(shadow) - shadow.set_zorder(rects1[0].get_zorder() - 0.1) - - ax.set_xlim(ind[0] - 0.5, ind[-1] + 1.5) - ax.set_ylim(0, 40) - - ax.xaxis.set_visible(False) - ax.yaxis.set_visible(False) - - - def light_filter_pie(ax): - fracs = [15, 30, 45, 10] - explode = (0, 0.05, 0, 0) - pies = ax.pie(fracs, explode=explode) - ax.patch.set_visible(True) - - light_filter = LightFilter(9) - for p in pies[0]: - p.set_agg_filter(light_filter) - p.set_rasterized(True) # to support mixed-mode renderers - p.set(ec="none", - lw=2) - - gauss = DropShadowFilter(9, offsets=(3, 4), alpha=0.7) - shadow = FilteredArtistList(pies[0], gauss) - ax.add_artist(shadow) - shadow.set_zorder(pies[0][0].get_zorder() - 0.1) - - - if 1: - - plt.figure(1, figsize=(6, 6)) - plt.subplots_adjust(left=0.05, right=0.95) - - ax = plt.subplot(221) - filtered_text(ax) - - ax = plt.subplot(222) - drop_shadow_line(ax) - - ax = plt.subplot(223) - drop_shadow_patches(ax) - - ax = plt.subplot(224) - ax.set_aspect(1) - light_filter_pie(ax) - ax.set_frame_on(True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/demo_annotation_box.rst.txt b/_sources/examples/pylab_examples/demo_annotation_box.rst.txt deleted file mode 100644 index 8aa4fcc3e30..00000000000 --- a/_sources/examples/pylab_examples/demo_annotation_box.rst.txt +++ /dev/null @@ -1,106 +0,0 @@ -.. _pylab_examples-demo_annotation_box: - -pylab_examples example code: demo_annotation_box.py -=================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/demo_annotation_box.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - from matplotlib.patches import Circle - from matplotlib.offsetbox import (TextArea, DrawingArea, OffsetImage, - AnnotationBbox) - from matplotlib.cbook import get_sample_data - - - if 1: - fig, ax = plt.subplots() - - # Define a 1st position to annotate (display it with a marker) - xy = (0.5, 0.7) - ax.plot(xy[0], xy[1], ".r") - - # Annotate the 1st position with a text box ('Test 1') - offsetbox = TextArea("Test 1", minimumdescent=False) - - ab = AnnotationBbox(offsetbox, xy, - xybox=(-20, 40), - xycoords='data', - boxcoords="offset points", - arrowprops=dict(arrowstyle="->")) - ax.add_artist(ab) - - # Annotate the 1st position with another text box ('Test') - offsetbox = TextArea("Test", minimumdescent=False) - - ab = AnnotationBbox(offsetbox, xy, - xybox=(1.02, xy[1]), - xycoords='data', - boxcoords=("axes fraction", "data"), - box_alignment=(0., 0.5), - arrowprops=dict(arrowstyle="->")) - ax.add_artist(ab) - - # Define a 2nd position to annotate (don't display with a marker this time) - xy = [0.3, 0.55] - - # Annotate the 2nd position with a circle patch - da = DrawingArea(20, 20, 0, 0) - p = Circle((10, 10), 10) - da.add_artist(p) - - ab = AnnotationBbox(da, xy, - xybox=(1.02, xy[1]), - xycoords='data', - boxcoords=("axes fraction", "data"), - box_alignment=(0., 0.5), - arrowprops=dict(arrowstyle="->")) - - ax.add_artist(ab) - - # Annotate the 2nd position with an image (a generated array of pixels) - arr = np.arange(100).reshape((10, 10)) - im = OffsetImage(arr, zoom=2) - im.image.axes = ax - - ab = AnnotationBbox(im, xy, - xybox=(-50., 50.), - xycoords='data', - boxcoords="offset points", - pad=0.3, - arrowprops=dict(arrowstyle="->")) - - ax.add_artist(ab) - - # Annotate the 2nd position with another image (a Grace Hopper portrait) - fn = get_sample_data("grace_hopper.png", asfileobj=False) - arr_img = plt.imread(fn, format='png') - - imagebox = OffsetImage(arr_img, zoom=0.2) - imagebox.image.axes = ax - - ab = AnnotationBbox(imagebox, xy, - xybox=(120., -80.), - xycoords='data', - boxcoords="offset points", - pad=0.5, - arrowprops=dict( - arrowstyle="->", - connectionstyle="angle,angleA=0,angleB=90,rad=3") - ) - - ax.add_artist(ab) - - # Fix the display limits to see everything - ax.set_xlim(0, 1) - ax.set_ylim(0, 1) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/demo_annotation_box.txt b/_sources/examples/pylab_examples/demo_annotation_box.txt deleted file mode 100644 index 3ddf0cc67cc..00000000000 --- a/_sources/examples/pylab_examples/demo_annotation_box.txt +++ /dev/null @@ -1,98 +0,0 @@ -.. _pylab_examples-demo_annotation_box: - -pylab_examples example code: demo_annotation_box.py -=================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/demo_annotation_box.py - -:: - - import matplotlib.pyplot as plt - from matplotlib.offsetbox import TextArea, DrawingArea, OffsetImage, \ - AnnotationBbox - from matplotlib.cbook import get_sample_data - - import numpy as np - - if 1: - fig, ax = plt.subplots() - - offsetbox = TextArea("Test 1", minimumdescent=False) - - xy = (0.5, 0.7) - - ax.plot(xy[0], xy[1], ".r") - - ab = AnnotationBbox(offsetbox, xy, - xybox=(-20, 40), - xycoords='data', - boxcoords="offset points", - arrowprops=dict(arrowstyle="->")) - ax.add_artist(ab) - - offsetbox = TextArea("Test", minimumdescent=False) - - ab = AnnotationBbox(offsetbox, xy, - xybox=(1.02, xy[1]), - xycoords='data', - boxcoords=("axes fraction", "data"), - box_alignment=(0., 0.5), - arrowprops=dict(arrowstyle="->")) - ax.add_artist(ab) - - from matplotlib.patches import Circle - da = DrawingArea(20, 20, 0, 0) - p = Circle((10, 10), 10) - da.add_artist(p) - - xy = [0.3, 0.55] - ab = AnnotationBbox(da, xy, - xybox=(1.02, xy[1]), - xycoords='data', - boxcoords=("axes fraction", "data"), - box_alignment=(0., 0.5), - arrowprops=dict(arrowstyle="->")) - - ax.add_artist(ab) - - arr = np.arange(100).reshape((10, 10)) - im = OffsetImage(arr, zoom=2) - - ab = AnnotationBbox(im, xy, - xybox=(-50., 50.), - xycoords='data', - boxcoords="offset points", - pad=0.3, - arrowprops=dict(arrowstyle="->")) - - ax.add_artist(ab) - - # another image - - from matplotlib._png import read_png - fn = get_sample_data("grace_hopper.png", asfileobj=False) - arr_lena = read_png(fn) - - imagebox = OffsetImage(arr_lena, zoom=0.2) - - ab = AnnotationBbox(imagebox, xy, - xybox=(120., -80.), - xycoords='data', - boxcoords="offset points", - pad=0.5, - arrowprops=dict(arrowstyle="->", - connectionstyle="angle,angleA=0,angleB=90,rad=3") - ) - - ax.add_artist(ab) - - ax.set_xlim(0, 1) - ax.set_ylim(0, 1) - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/demo_bboximage.rst.txt b/_sources/examples/pylab_examples/demo_bboximage.rst.txt deleted file mode 100644 index ed6a4f85823..00000000000 --- a/_sources/examples/pylab_examples/demo_bboximage.rst.txt +++ /dev/null @@ -1,78 +0,0 @@ -.. _pylab_examples-demo_bboximage: - -pylab_examples example code: demo_bboximage.py -============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/demo_bboximage.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - from matplotlib.image import BboxImage - from matplotlib.transforms import Bbox, TransformedBbox - - if __name__ == "__main__": - - fig = plt.figure(1) - ax = plt.subplot(121) - - txt = ax.text(0.5, 0.5, "test", size=30, ha="center", color="w") - kwargs = dict() - - bbox_image = BboxImage(txt.get_window_extent, - norm=None, - origin=None, - clip_on=False, - **kwargs - ) - a = np.arange(256).reshape(1, 256)/256. - bbox_image.set_data(a) - ax.add_artist(bbox_image) - - ax = plt.subplot(122) - a = np.linspace(0, 1, 256).reshape(1, -1) - a = np.vstack((a, a)) - - maps = sorted( - m for m in plt.cm.cmap_d - if not m.endswith("_r") and # Skip reversed colormaps. - not m.startswith(('spectral', 'Vega')) # Skip deprecated colormaps. - ) - - #fig.subplots_adjust(top=0.99, bottom=0.01, left=0.2, right=0.99) - - ncol = 2 - nrow = len(maps)//ncol + 1 - - xpad_fraction = 0.3 - dx = 1./(ncol + xpad_fraction*(ncol - 1)) - - ypad_fraction = 0.3 - dy = 1./(nrow + ypad_fraction*(nrow - 1)) - - for i, m in enumerate(maps): - ix, iy = divmod(i, nrow) - #plt.figimage(a, 10, i*10, cmap=plt.get_cmap(m), origin='lower') - bbox0 = Bbox.from_bounds(ix*dx*(1 + xpad_fraction), - 1. - iy*dy*(1 + ypad_fraction) - dy, - dx, dy) - bbox = TransformedBbox(bbox0, ax.transAxes) - - bbox_image = BboxImage(bbox, - cmap=plt.get_cmap(m), - norm=None, - origin=None, - **kwargs - ) - - bbox_image.set_data(a) - ax.add_artist(bbox_image) - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/demo_bboximage.txt b/_sources/examples/pylab_examples/demo_bboximage.txt deleted file mode 100644 index 91b654fc504..00000000000 --- a/_sources/examples/pylab_examples/demo_bboximage.txt +++ /dev/null @@ -1,75 +0,0 @@ -.. _pylab_examples-demo_bboximage: - -pylab_examples example code: demo_bboximage.py -============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/demo_bboximage.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - from matplotlib.image import BboxImage - from matplotlib.transforms import Bbox, TransformedBbox - - if __name__ == "__main__": - - fig = plt.figure(1) - ax = plt.subplot(121) - - txt = ax.text(0.5, 0.5, "test", size=30, ha="center", color="w") - kwargs = dict() - - bbox_image = BboxImage(txt.get_window_extent, - norm=None, - origin=None, - clip_on=False, - **kwargs - ) - a = np.arange(256).reshape(1, 256)/256. - bbox_image.set_data(a) - ax.add_artist(bbox_image) - - ax = plt.subplot(122) - a = np.linspace(0, 1, 256).reshape(1, -1) - a = np.vstack((a, a)) - - maps = sorted(m for m in plt.cm.cmap_d if not m.endswith("_r")) - #nmaps = len(maps) + 1 - - #fig.subplots_adjust(top=0.99, bottom=0.01, left=0.2, right=0.99) - - ncol = 2 - nrow = len(maps)//ncol + 1 - - xpad_fraction = 0.3 - dx = 1./(ncol + xpad_fraction*(ncol - 1)) - - ypad_fraction = 0.3 - dy = 1./(nrow + ypad_fraction*(nrow - 1)) - - for i, m in enumerate(maps): - ix, iy = divmod(i, nrow) - #plt.figimage(a, 10, i*10, cmap=plt.get_cmap(m), origin='lower') - bbox0 = Bbox.from_bounds(ix*dx*(1 + xpad_fraction), - 1. - iy*dy*(1 + ypad_fraction) - dy, - dx, dy) - bbox = TransformedBbox(bbox0, ax.transAxes) - - bbox_image = BboxImage(bbox, - cmap=plt.get_cmap(m), - norm=None, - origin=None, - **kwargs - ) - - bbox_image.set_data(a) - ax.add_artist(bbox_image) - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/demo_ribbon_box.rst.txt b/_sources/examples/pylab_examples/demo_ribbon_box.rst.txt deleted file mode 100644 index 80613fe13ad..00000000000 --- a/_sources/examples/pylab_examples/demo_ribbon_box.rst.txt +++ /dev/null @@ -1,148 +0,0 @@ -.. _pylab_examples-demo_ribbon_box: - -pylab_examples example code: demo_ribbon_box.py -=============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/demo_ribbon_box.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - from matplotlib.image import BboxImage - - from matplotlib._png import read_png - import matplotlib.colors - from matplotlib.cbook import get_sample_data - - - class RibbonBox(object): - - original_image = read_png(get_sample_data("Minduka_Present_Blue_Pack.png", - asfileobj=False)) - cut_location = 70 - b_and_h = original_image[:, :, 2] - color = original_image[:, :, 2] - original_image[:, :, 0] - alpha = original_image[:, :, 3] - nx = original_image.shape[1] - - def __init__(self, color): - rgb = matplotlib.colors.to_rgba(color)[:3] - - im = np.empty(self.original_image.shape, - self.original_image.dtype) - - im[:, :, :3] = self.b_and_h[:, :, np.newaxis] - im[:, :, :3] -= self.color[:, :, np.newaxis]*(1. - np.array(rgb)) - im[:, :, 3] = self.alpha - - self.im = im - - def get_stretched_image(self, stretch_factor): - stretch_factor = max(stretch_factor, 1) - ny, nx, nch = self.im.shape - ny2 = int(ny*stretch_factor) - - stretched_image = np.empty((ny2, nx, nch), - self.im.dtype) - cut = self.im[self.cut_location, :, :] - stretched_image[:, :, :] = cut - stretched_image[:self.cut_location, :, :] = \ - self.im[:self.cut_location, :, :] - stretched_image[-(ny - self.cut_location):, :, :] = \ - self.im[-(ny - self.cut_location):, :, :] - - self._cached_im = stretched_image - return stretched_image - - - class RibbonBoxImage(BboxImage): - zorder = 1 - - def __init__(self, bbox, color, - cmap=None, - norm=None, - interpolation=None, - origin=None, - filternorm=1, - filterrad=4.0, - resample=False, - **kwargs - ): - - BboxImage.__init__(self, bbox, - cmap=cmap, - norm=norm, - interpolation=interpolation, - origin=origin, - filternorm=filternorm, - filterrad=filterrad, - resample=resample, - **kwargs - ) - - self._ribbonbox = RibbonBox(color) - self._cached_ny = None - - def draw(self, renderer, *args, **kwargs): - - bbox = self.get_window_extent(renderer) - stretch_factor = bbox.height / bbox.width - - ny = int(stretch_factor*self._ribbonbox.nx) - if self._cached_ny != ny: - arr = self._ribbonbox.get_stretched_image(stretch_factor) - self.set_array(arr) - self._cached_ny = ny - - BboxImage.draw(self, renderer, *args, **kwargs) - - - if 1: - from matplotlib.transforms import Bbox, TransformedBbox - from matplotlib.ticker import ScalarFormatter - - fig, ax = plt.subplots() - - years = np.arange(2004, 2009) - box_colors = [(0.8, 0.2, 0.2), - (0.2, 0.8, 0.2), - (0.2, 0.2, 0.8), - (0.7, 0.5, 0.8), - (0.3, 0.8, 0.7), - ] - heights = np.random.random(years.shape) * 7000 + 3000 - - fmt = ScalarFormatter(useOffset=False) - ax.xaxis.set_major_formatter(fmt) - - for year, h, bc in zip(years, heights, box_colors): - bbox0 = Bbox.from_extents(year - 0.4, 0., year + 0.4, h) - bbox = TransformedBbox(bbox0, ax.transData) - rb_patch = RibbonBoxImage(bbox, bc, interpolation="bicubic") - - ax.add_artist(rb_patch) - - ax.annotate(r"%d" % (int(h/100.)*100), - (year, h), va="bottom", ha="center") - - patch_gradient = BboxImage(ax.bbox, - interpolation="bicubic", - zorder=0.1, - ) - gradient = np.zeros((2, 2, 4), dtype=np.float) - gradient[:, :, :3] = [1, 1, 0.] - gradient[:, :, 3] = [[0.1, 0.3], [0.3, 0.5]] # alpha channel - patch_gradient.set_array(gradient) - ax.add_artist(patch_gradient) - - ax.set_xlim(years[0] - 0.5, years[-1] + 0.5) - ax.set_ylim(0, 10000) - - fig.savefig('ribbon_box.png') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/demo_ribbon_box.txt b/_sources/examples/pylab_examples/demo_ribbon_box.txt deleted file mode 100644 index 26777a5d1f6..00000000000 --- a/_sources/examples/pylab_examples/demo_ribbon_box.txt +++ /dev/null @@ -1,148 +0,0 @@ -.. _pylab_examples-demo_ribbon_box: - -pylab_examples example code: demo_ribbon_box.py -=============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/demo_ribbon_box.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - from matplotlib.image import BboxImage - - from matplotlib._png import read_png - import matplotlib.colors - from matplotlib.cbook import get_sample_data - - - class RibbonBox(object): - - original_image = read_png(get_sample_data("Minduka_Present_Blue_Pack.png", - asfileobj=False)) - cut_location = 70 - b_and_h = original_image[:, :, 2] - color = original_image[:, :, 2] - original_image[:, :, 0] - alpha = original_image[:, :, 3] - nx = original_image.shape[1] - - def __init__(self, color): - rgb = matplotlib.colors.colorConverter.to_rgb(color) - - im = np.empty(self.original_image.shape, - self.original_image.dtype) - - im[:, :, :3] = self.b_and_h[:, :, np.newaxis] - im[:, :, :3] -= self.color[:, :, np.newaxis]*(1. - np.array(rgb)) - im[:, :, 3] = self.alpha - - self.im = im - - def get_stretched_image(self, stretch_factor): - stretch_factor = max(stretch_factor, 1) - ny, nx, nch = self.im.shape - ny2 = int(ny*stretch_factor) - - stretched_image = np.empty((ny2, nx, nch), - self.im.dtype) - cut = self.im[self.cut_location, :, :] - stretched_image[:, :, :] = cut - stretched_image[:self.cut_location, :, :] = \ - self.im[:self.cut_location, :, :] - stretched_image[-(ny - self.cut_location):, :, :] = \ - self.im[-(ny - self.cut_location):, :, :] - - self._cached_im = stretched_image - return stretched_image - - - class RibbonBoxImage(BboxImage): - zorder = 1 - - def __init__(self, bbox, color, - cmap=None, - norm=None, - interpolation=None, - origin=None, - filternorm=1, - filterrad=4.0, - resample=False, - **kwargs - ): - - BboxImage.__init__(self, bbox, - cmap=cmap, - norm=norm, - interpolation=interpolation, - origin=origin, - filternorm=filternorm, - filterrad=filterrad, - resample=resample, - **kwargs - ) - - self._ribbonbox = RibbonBox(color) - self._cached_ny = None - - def draw(self, renderer, *args, **kwargs): - - bbox = self.get_window_extent(renderer) - stretch_factor = bbox.height / bbox.width - - ny = int(stretch_factor*self._ribbonbox.nx) - if self._cached_ny != ny: - arr = self._ribbonbox.get_stretched_image(stretch_factor) - self.set_array(arr) - self._cached_ny = ny - - BboxImage.draw(self, renderer, *args, **kwargs) - - - if 1: - from matplotlib.transforms import Bbox, TransformedBbox - from matplotlib.ticker import ScalarFormatter - - fig, ax = plt.subplots() - - years = np.arange(2004, 2009) - box_colors = [(0.8, 0.2, 0.2), - (0.2, 0.8, 0.2), - (0.2, 0.2, 0.8), - (0.7, 0.5, 0.8), - (0.3, 0.8, 0.7), - ] - heights = np.random.random(years.shape) * 7000 + 3000 - - fmt = ScalarFormatter(useOffset=False) - ax.xaxis.set_major_formatter(fmt) - - for year, h, bc in zip(years, heights, box_colors): - bbox0 = Bbox.from_extents(year - 0.4, 0., year + 0.4, h) - bbox = TransformedBbox(bbox0, ax.transData) - rb_patch = RibbonBoxImage(bbox, bc, interpolation="bicubic") - - ax.add_artist(rb_patch) - - ax.annotate(r"%d" % (int(h/100.)*100), - (year, h), va="bottom", ha="center") - - patch_gradient = BboxImage(ax.bbox, - interpolation="bicubic", - zorder=0.1, - ) - gradient = np.zeros((2, 2, 4), dtype=np.float) - gradient[:, :, :3] = [1, 1, 0.] - gradient[:, :, 3] = [[0.1, 0.3], [0.3, 0.5]] # alpha channel - patch_gradient.set_array(gradient) - ax.add_artist(patch_gradient) - - ax.set_xlim(years[0] - 0.5, years[-1] + 0.5) - ax.set_ylim(0, 10000) - - fig.savefig('ribbon_box.png') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/demo_text_path.rst.txt b/_sources/examples/pylab_examples/demo_text_path.rst.txt deleted file mode 100644 index 38eab104be4..00000000000 --- a/_sources/examples/pylab_examples/demo_text_path.rst.txt +++ /dev/null @@ -1,165 +0,0 @@ -.. _pylab_examples-demo_text_path: - -pylab_examples example code: demo_text_path.py -============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/demo_text_path.py - -:: - - - # -*- coding: utf-8 -*- - - import matplotlib.pyplot as plt - from matplotlib.image import BboxImage - import numpy as np - from matplotlib.transforms import IdentityTransform - - import matplotlib.patches as mpatches - - from matplotlib.offsetbox import AnnotationBbox,\ - AnchoredOffsetbox, AuxTransformBox - - from matplotlib.cbook import get_sample_data - - from matplotlib.text import TextPath - - - class PathClippedImagePatch(mpatches.PathPatch): - """ - The given image is used to draw the face of the patch. Internally, - it uses BboxImage whose clippath set to the path of the patch. - - FIXME : The result is currently dpi dependent. - """ - - def __init__(self, path, bbox_image, **kwargs): - mpatches.PathPatch.__init__(self, path, **kwargs) - self._init_bbox_image(bbox_image) - - def set_facecolor(self, color): - """simply ignore facecolor""" - mpatches.PathPatch.set_facecolor(self, "none") - - def _init_bbox_image(self, im): - - bbox_image = BboxImage(self.get_window_extent, - norm=None, - origin=None, - ) - bbox_image.set_transform(IdentityTransform()) - - bbox_image.set_data(im) - self.bbox_image = bbox_image - - def draw(self, renderer=None): - - # the clip path must be updated every draw. any solution? -JJ - self.bbox_image.set_clip_path(self._path, self.get_transform()) - self.bbox_image.draw(renderer) - - mpatches.PathPatch.draw(self, renderer) - - - if 1: - - usetex = plt.rcParams["text.usetex"] - - fig = plt.figure(1) - - # EXAMPLE 1 - - ax = plt.subplot(211) - - from matplotlib._png import read_png - fn = get_sample_data("grace_hopper.png", asfileobj=False) - arr = read_png(fn) - - text_path = TextPath((0, 0), "!?", size=150) - p = PathClippedImagePatch(text_path, arr, ec="k", - transform=IdentityTransform()) - - #p.set_clip_on(False) - - # make offset box - offsetbox = AuxTransformBox(IdentityTransform()) - offsetbox.add_artist(p) - - # make anchored offset box - ao = AnchoredOffsetbox(loc=2, child=offsetbox, frameon=True, borderpad=0.2) - ax.add_artist(ao) - - # another text - from matplotlib.patches import PathPatch - if usetex: - r = r"\mbox{textpath supports mathtext \& \TeX}" - else: - r = r"textpath supports mathtext & TeX" - - text_path = TextPath((0, 0), r, - size=20, usetex=usetex) - - p1 = PathPatch(text_path, ec="w", lw=3, fc="w", alpha=0.9, - transform=IdentityTransform()) - p2 = PathPatch(text_path, ec="none", fc="k", - transform=IdentityTransform()) - - offsetbox2 = AuxTransformBox(IdentityTransform()) - offsetbox2.add_artist(p1) - offsetbox2.add_artist(p2) - - ab = AnnotationBbox(offsetbox2, (0.95, 0.05), - xycoords='axes fraction', - boxcoords="offset points", - box_alignment=(1., 0.), - frameon=False - ) - ax.add_artist(ab) - - ax.imshow([[0, 1, 2], [1, 2, 3]], cmap=plt.cm.gist_gray_r, - interpolation="bilinear", - aspect="auto") - - # EXAMPLE 2 - - ax = plt.subplot(212) - - arr = np.arange(256).reshape(1, 256)/256. - - if usetex: - s = r"$\displaystyle\left[\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}\right]$!" - else: - s = r"$\left[\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}\right]$!" - text_path = TextPath((0, 0), s, size=40, usetex=usetex) - text_patch = PathClippedImagePatch(text_path, arr, ec="none", - transform=IdentityTransform()) - - shadow1 = mpatches.Shadow(text_patch, 1, -1, props=dict(fc="none", ec="0.6", lw=3)) - shadow2 = mpatches.Shadow(text_patch, 1, -1, props=dict(fc="0.3", ec="none")) - - # make offset box - offsetbox = AuxTransformBox(IdentityTransform()) - offsetbox.add_artist(shadow1) - offsetbox.add_artist(shadow2) - offsetbox.add_artist(text_patch) - - # place the anchored offset box using AnnotationBbox - ab = AnnotationBbox(offsetbox, (0.5, 0.5), - xycoords='data', - boxcoords="offset points", - box_alignment=(0.5, 0.5), - ) - #text_path.set_size(10) - - ax.add_artist(ab) - - ax.set_xlim(0, 1) - ax.set_ylim(0, 1) - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/demo_text_path.txt b/_sources/examples/pylab_examples/demo_text_path.txt deleted file mode 100644 index ad6210cd9f5..00000000000 --- a/_sources/examples/pylab_examples/demo_text_path.txt +++ /dev/null @@ -1,165 +0,0 @@ -.. _pylab_examples-demo_text_path: - -pylab_examples example code: demo_text_path.py -============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/demo_text_path.py - -:: - - - # -*- coding: utf-8 -*- - - import matplotlib.pyplot as plt - from matplotlib.image import BboxImage - import numpy as np - from matplotlib.transforms import IdentityTransform - - import matplotlib.patches as mpatches - - from matplotlib.offsetbox import AnnotationBbox,\ - AnchoredOffsetbox, AuxTransformBox - - from matplotlib.cbook import get_sample_data - - from matplotlib.text import TextPath - - - class PathClippedImagePatch(mpatches.PathPatch): - """ - The given image is used to draw the face of the patch. Internally, - it uses BboxImage whose clippath set to the path of the patch. - - FIXME : The result is currently dpi dependent. - """ - - def __init__(self, path, bbox_image, **kwargs): - mpatches.PathPatch.__init__(self, path, **kwargs) - self._init_bbox_image(bbox_image) - - def set_facecolor(self, color): - """simply ignore facecolor""" - mpatches.PathPatch.set_facecolor(self, "none") - - def _init_bbox_image(self, im): - - bbox_image = BboxImage(self.get_window_extent, - norm=None, - origin=None, - ) - bbox_image.set_transform(IdentityTransform()) - - bbox_image.set_data(im) - self.bbox_image = bbox_image - - def draw(self, renderer=None): - - # the clip path must be updated every draw. any solution? -JJ - self.bbox_image.set_clip_path(self._path, self.get_transform()) - self.bbox_image.draw(renderer) - - mpatches.PathPatch.draw(self, renderer) - - - if 1: - - usetex = plt.rcParams["text.usetex"] - - fig = plt.figure(1) - - # EXAMPLE 1 - - ax = plt.subplot(211) - - from matplotlib._png import read_png - fn = get_sample_data("grace_hopper.png", asfileobj=False) - arr = read_png(fn) - - text_path = TextPath((0, 0), "!?", size=150) - p = PathClippedImagePatch(text_path, arr, ec="k", - transform=IdentityTransform()) - - #p.set_clip_on(False) - - # make offset box - offsetbox = AuxTransformBox(IdentityTransform()) - offsetbox.add_artist(p) - - # make anchored offset box - ao = AnchoredOffsetbox(loc=2, child=offsetbox, frameon=True, borderpad=0.2) - ax.add_artist(ao) - - # another text - from matplotlib.patches import PathPatch - if usetex: - r = r"\mbox{textpath supports mathtext \& \TeX}" - else: - r = r"textpath supports mathtext & TeX" - - text_path = TextPath((0, 0), r, - size=20, usetex=usetex) - - p1 = PathPatch(text_path, ec="w", lw=3, fc="w", alpha=0.9, - transform=IdentityTransform()) - p2 = PathPatch(text_path, ec="none", fc="k", - transform=IdentityTransform()) - - offsetbox2 = AuxTransformBox(IdentityTransform()) - offsetbox2.add_artist(p1) - offsetbox2.add_artist(p2) - - ab = AnnotationBbox(offsetbox2, (0.95, 0.05), - xycoords='axes fraction', - boxcoords="offset points", - box_alignment=(1., 0.), - frameon=False - ) - ax.add_artist(ab) - - ax.imshow([[0, 1, 2], [1, 2, 3]], cmap=plt.cm.gist_gray_r, - interpolation="bilinear", - aspect="auto") - - # EXAMPLE 2 - - ax = plt.subplot(212) - - arr = np.arange(256).reshape(1, 256)/256. - - if usetex: - s = r"$\displaystyle\left[\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}\right]$!" - else: - s = r"$\left[\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}\right]$!" - text_path = TextPath((0, 0), s, size=40, usetex=usetex) - text_patch = PathClippedImagePatch(text_path, arr, ec="none", - transform=IdentityTransform()) - - shadow1 = mpatches.Shadow(text_patch, 1, -1, props=dict(fc="none", ec="0.6", lw=3)) - shadow2 = mpatches.Shadow(text_patch, 1, -1, props=dict(fc="0.3", ec="none")) - - # make offset box - offsetbox = AuxTransformBox(IdentityTransform()) - offsetbox.add_artist(shadow1) - offsetbox.add_artist(shadow2) - offsetbox.add_artist(text_patch) - - # place the anchored offset box using AnnotationBbox - ab = AnnotationBbox(offsetbox, (0.5, 0.5), - xycoords='data', - boxcoords="offset points", - box_alignment=(0.5, 0.5), - ) - #text_path.set_size(10) - - ax.add_artist(ab) - - ax.set_xlim(0, 1) - ax.set_ylim(0, 1) - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/demo_text_rotation_mode.rst.txt b/_sources/examples/pylab_examples/demo_text_rotation_mode.rst.txt deleted file mode 100644 index 37a354191b3..00000000000 --- a/_sources/examples/pylab_examples/demo_text_rotation_mode.rst.txt +++ /dev/null @@ -1,59 +0,0 @@ -.. _pylab_examples-demo_text_rotation_mode: - -pylab_examples example code: demo_text_rotation_mode.py -======================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/demo_text_rotation_mode.py - -:: - - from mpl_toolkits.axes_grid1.axes_grid import ImageGrid - - - def test_rotation_mode(fig, mode, subplot_location): - ha_list = "left center right".split() - va_list = "top center baseline bottom".split() - grid = ImageGrid(fig, subplot_location, - nrows_ncols=(len(va_list), len(ha_list)), - share_all=True, aspect=True, - #label_mode='1', - cbar_mode=None) - - for ha, ax in zip(ha_list, grid.axes_row[-1]): - ax.axis["bottom"].label.set_text(ha) - - grid.axes_row[0][1].set_title(mode, size="large") - - for va, ax in zip(va_list, grid.axes_column[0]): - ax.axis["left"].label.set_text(va) - - i = 0 - for va in va_list: - for ha in ha_list: - ax = grid[i] - for axis in ax.axis.values(): - axis.toggle(ticks=False, ticklabels=False) - - ax.text(0.5, 0.5, "Tpg", - size="large", rotation=40, - bbox=dict(boxstyle="square,pad=0.", - ec="none", fc="0.5", alpha=0.5), - ha=ha, va=va, - rotation_mode=mode) - ax.axvline(0.5) - ax.axhline(0.5) - i += 1 - - if 1: - import matplotlib.pyplot as plt - fig = plt.figure(1, figsize=(5.5, 4)) - fig.clf() - - test_rotation_mode(fig, "default", 121) - test_rotation_mode(fig, "anchor", 122) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/demo_text_rotation_mode.txt b/_sources/examples/pylab_examples/demo_text_rotation_mode.txt deleted file mode 100644 index fa206abc307..00000000000 --- a/_sources/examples/pylab_examples/demo_text_rotation_mode.txt +++ /dev/null @@ -1,59 +0,0 @@ -.. _pylab_examples-demo_text_rotation_mode: - -pylab_examples example code: demo_text_rotation_mode.py -======================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/demo_text_rotation_mode.py - -:: - - from mpl_toolkits.axes_grid1.axes_grid import ImageGrid - - - def test_rotation_mode(fig, mode, subplot_location): - ha_list = "left center right".split() - va_list = "top center baseline bottom".split() - grid = ImageGrid(fig, subplot_location, - nrows_ncols=(len(va_list), len(ha_list)), - share_all=True, aspect=True, - #label_mode='1', - cbar_mode=None) - - for ha, ax in zip(ha_list, grid.axes_row[-1]): - ax.axis["bottom"].label.set_text(ha) - - grid.axes_row[0][1].set_title(mode, size="large") - - for va, ax in zip(va_list, grid.axes_column[0]): - ax.axis["left"].label.set_text(va) - - i = 0 - for va in va_list: - for ha in ha_list: - ax = grid[i] - for axis in ax.axis.values(): - axis.toggle(ticks=False, ticklabels=False) - - ax.text(0.5, 0.5, "Tpg", - size="large", rotation=40, - bbox=dict(boxstyle="square,pad=0.", - ec="none", fc="0.5", alpha=0.5), - ha=ha, va=va, - rotation_mode=mode) - ax.axvline(0.5) - ax.axhline(0.5) - i += 1 - - if 1: - import matplotlib.pyplot as plt - fig = plt.figure(1, figsize=(5.5, 4)) - fig.clf() - - test_rotation_mode(fig, "default", 121) - test_rotation_mode(fig, "anchor", 122) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/demo_tight_layout.rst.txt b/_sources/examples/pylab_examples/demo_tight_layout.rst.txt deleted file mode 100644 index 7d54f77081c..00000000000 --- a/_sources/examples/pylab_examples/demo_tight_layout.rst.txt +++ /dev/null @@ -1,130 +0,0 @@ -.. _pylab_examples-demo_tight_layout: - -pylab_examples example code: demo_tight_layout.py -================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/demo_tight_layout.py - -:: - - - import matplotlib.pyplot as plt - import itertools - import warnings - - - fontsizes = itertools.cycle([8, 16, 24, 32]) - - - def example_plot(ax): - ax.plot([1, 2]) - ax.set_xlabel('x-label', fontsize=next(fontsizes)) - ax.set_ylabel('y-label', fontsize=next(fontsizes)) - ax.set_title('Title', fontsize=next(fontsizes)) - - - fig, ax = plt.subplots() - example_plot(ax) - plt.tight_layout() - - fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(nrows=2, ncols=2) - example_plot(ax1) - example_plot(ax2) - example_plot(ax3) - example_plot(ax4) - plt.tight_layout() - - fig, (ax1, ax2) = plt.subplots(nrows=2, ncols=1) - example_plot(ax1) - example_plot(ax2) - plt.tight_layout() - - fig, (ax1, ax2) = plt.subplots(nrows=1, ncols=2) - example_plot(ax1) - example_plot(ax2) - plt.tight_layout() - - fig, axes = plt.subplots(nrows=3, ncols=3) - for row in axes: - for ax in row: - example_plot(ax) - plt.tight_layout() - - - fig = plt.figure() - - ax1 = plt.subplot(221) - ax2 = plt.subplot(223) - ax3 = plt.subplot(122) - - example_plot(ax1) - example_plot(ax2) - example_plot(ax3) - - plt.tight_layout() - - - fig = plt.figure() - - ax1 = plt.subplot2grid((3, 3), (0, 0)) - ax2 = plt.subplot2grid((3, 3), (0, 1), colspan=2) - ax3 = plt.subplot2grid((3, 3), (1, 0), colspan=2, rowspan=2) - ax4 = plt.subplot2grid((3, 3), (1, 2), rowspan=2) - - example_plot(ax1) - example_plot(ax2) - example_plot(ax3) - example_plot(ax4) - - plt.tight_layout() - - plt.show() - - - fig = plt.figure() - - import matplotlib.gridspec as gridspec - - gs1 = gridspec.GridSpec(3, 1) - ax1 = fig.add_subplot(gs1[0]) - ax2 = fig.add_subplot(gs1[1]) - ax3 = fig.add_subplot(gs1[2]) - - example_plot(ax1) - example_plot(ax2) - example_plot(ax3) - - with warnings.catch_warnings(): - warnings.simplefilter("ignore", UserWarning) - # This raises warnings since tight layout cannot - # handle gridspec automatically. We are going to - # do that manually so we can filter the warning. - gs1.tight_layout(fig, rect=[None, None, 0.45, None]) - - gs2 = gridspec.GridSpec(2, 1) - ax4 = fig.add_subplot(gs2[0]) - ax5 = fig.add_subplot(gs2[1]) - - example_plot(ax4) - example_plot(ax5) - - with warnings.catch_warnings(): - # This raises warnings since tight layout cannot - # handle gridspec automatically. We are going to - # do that manually so we can filter the warning. - warnings.simplefilter("ignore", UserWarning) - gs2.tight_layout(fig, rect=[0.45, None, None, None]) - - # now match the top and bottom of two gridspecs. - top = min(gs1.top, gs2.top) - bottom = max(gs1.bottom, gs2.bottom) - - gs1.update(top=top, bottom=bottom) - gs2.update(top=top, bottom=bottom) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/demo_tight_layout.txt b/_sources/examples/pylab_examples/demo_tight_layout.txt deleted file mode 100644 index e425980fc23..00000000000 --- a/_sources/examples/pylab_examples/demo_tight_layout.txt +++ /dev/null @@ -1,128 +0,0 @@ -.. _pylab_examples-demo_tight_layout: - -pylab_examples example code: demo_tight_layout.py -================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/demo_tight_layout.py - -:: - - - import matplotlib.pyplot as plt - import warnings - - import random - fontsizes = [8, 16, 24, 32] - - - def example_plot(ax): - ax.plot([1, 2]) - ax.set_xlabel('x-label', fontsize=random.choice(fontsizes)) - ax.set_ylabel('y-label', fontsize=random.choice(fontsizes)) - ax.set_title('Title', fontsize=random.choice(fontsizes)) - - fig, ax = plt.subplots() - example_plot(ax) - plt.tight_layout() - - fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(nrows=2, ncols=2) - example_plot(ax1) - example_plot(ax2) - example_plot(ax3) - example_plot(ax4) - plt.tight_layout() - - fig, (ax1, ax2) = plt.subplots(nrows=2, ncols=1) - example_plot(ax1) - example_plot(ax2) - plt.tight_layout() - - fig, (ax1, ax2) = plt.subplots(nrows=1, ncols=2) - example_plot(ax1) - example_plot(ax2) - plt.tight_layout() - - fig, axes = plt.subplots(nrows=3, ncols=3) - for row in axes: - for ax in row: - example_plot(ax) - plt.tight_layout() - - - fig = plt.figure() - - ax1 = plt.subplot(221) - ax2 = plt.subplot(223) - ax3 = plt.subplot(122) - - example_plot(ax1) - example_plot(ax2) - example_plot(ax3) - - plt.tight_layout() - - - fig = plt.figure() - - ax1 = plt.subplot2grid((3, 3), (0, 0)) - ax2 = plt.subplot2grid((3, 3), (0, 1), colspan=2) - ax3 = plt.subplot2grid((3, 3), (1, 0), colspan=2, rowspan=2) - ax4 = plt.subplot2grid((3, 3), (1, 2), rowspan=2) - - example_plot(ax1) - example_plot(ax2) - example_plot(ax3) - example_plot(ax4) - - plt.tight_layout() - - plt.show() - - - fig = plt.figure() - - import matplotlib.gridspec as gridspec - - gs1 = gridspec.GridSpec(3, 1) - ax1 = fig.add_subplot(gs1[0]) - ax2 = fig.add_subplot(gs1[1]) - ax3 = fig.add_subplot(gs1[2]) - - example_plot(ax1) - example_plot(ax2) - example_plot(ax3) - - with warnings.catch_warnings(): - warnings.simplefilter("ignore", UserWarning) - # This raises warnings since tight layout cannot - # handle gridspec automatically. We are going to - # do that manually so we can filter the warning. - gs1.tight_layout(fig, rect=[None, None, 0.45, None]) - - gs2 = gridspec.GridSpec(2, 1) - ax4 = fig.add_subplot(gs2[0]) - ax5 = fig.add_subplot(gs2[1]) - - example_plot(ax4) - example_plot(ax5) - - with warnings.catch_warnings(): - # This raises warnings since tight layout cannot - # handle gridspec automatically. We are going to - # do that manually so we can filter the warning. - warnings.simplefilter("ignore", UserWarning) - gs2.tight_layout(fig, rect=[0.45, None, None, None]) - - # now match the top and bottom of two gridspecs. - top = min(gs1.top, gs2.top) - bottom = max(gs1.bottom, gs2.bottom) - - gs1.update(top=top, bottom=bottom) - gs2.update(top=top, bottom=bottom) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/dolphin.rst.txt b/_sources/examples/pylab_examples/dolphin.rst.txt deleted file mode 100644 index 7a45654fc78..00000000000 --- a/_sources/examples/pylab_examples/dolphin.rst.txt +++ /dev/null @@ -1,105 +0,0 @@ -.. _pylab_examples-dolphin: - -pylab_examples example code: dolphin.py -======================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/dolphin.py - -:: - - import matplotlib.cm as cm - import matplotlib.pyplot as plt - from matplotlib.patches import Circle, PathPatch - from matplotlib.path import Path - from matplotlib.transforms import Affine2D - import numpy as np - - - r = np.random.rand(50) - t = np.random.rand(50) * np.pi * 2.0 - x = r * np.cos(t) - y = r * np.sin(t) - - fig, ax = plt.subplots(figsize=(6, 6)) - circle = Circle((0, 0), 1, facecolor='none', - edgecolor=(0, 0.8, 0.8), linewidth=3, alpha=0.5) - ax.add_patch(circle) - - im = plt.imshow(np.random.random((100, 100)), - origin='lower', cmap=cm.winter, - interpolation='spline36', - extent=([-1, 1, -1, 1])) - im.set_clip_path(circle) - - plt.plot(x, y, 'o', color=(0.9, 0.9, 1.0), alpha=0.8) - - # Dolphin from OpenClipart library by Andy Fitzsimon - # - # - # - # - # - - dolphin = """ - M -0.59739425,160.18173 C -0.62740401,160.18885 -0.57867129,160.11183 - -0.57867129,160.11183 C -0.57867129,160.11183 -0.5438361,159.89315 - -0.39514638,159.81496 C -0.24645668,159.73678 -0.18316813,159.71981 - -0.18316813,159.71981 C -0.18316813,159.71981 -0.10322971,159.58124 - -0.057804323,159.58725 C -0.029723983,159.58913 -0.061841603,159.60356 - -0.071265813,159.62815 C -0.080250183,159.65325 -0.082918513,159.70554 - -0.061841203,159.71248 C -0.040763903,159.7194 -0.0066711426,159.71091 - 0.077336307,159.73612 C 0.16879567,159.76377 0.28380306,159.86448 - 0.31516668,159.91533 C 0.3465303,159.96618 0.5011127,160.1771 - 0.5011127,160.1771 C 0.63668998,160.19238 0.67763022,160.31259 - 0.66556395,160.32668 C 0.65339985,160.34212 0.66350443,160.33642 - 0.64907098,160.33088 C 0.63463742,160.32533 0.61309688,160.297 - 0.5789627,160.29339 C 0.54348657,160.28968 0.52329693,160.27674 - 0.50728856,160.27737 C 0.49060916,160.27795 0.48965803,160.31565 - 0.46114204,160.33673 C 0.43329696,160.35786 0.4570711,160.39871 - 0.43309565,160.40685 C 0.4105108,160.41442 0.39416631,160.33027 - 0.3954995,160.2935 C 0.39683269,160.25672 0.43807996,160.21522 - 0.44567915,160.19734 C 0.45327833,160.17946 0.27946869,159.9424 - -0.061852613,159.99845 C -0.083965233,160.0427 -0.26176109,160.06683 - -0.26176109,160.06683 C -0.30127962,160.07028 -0.21167141,160.09731 - -0.24649368,160.1011 C -0.32642366,160.11569 -0.34521187,160.06895 - -0.40622293,160.0819 C -0.467234,160.09485 -0.56738444,160.17461 - -0.59739425,160.18173 - """ - - vertices = [] - codes = [] - parts = dolphin.split() - i = 0 - code_map = { - 'M': (Path.MOVETO, 1), - 'C': (Path.CURVE4, 3), - 'L': (Path.LINETO, 1) - } - - while i < len(parts): - code = parts[i] - path_code, npoints = code_map[code] - codes.extend([path_code] * npoints) - vertices.extend([[float(x) for x in y.split(',')] for y in - parts[i + 1:i + npoints + 1]]) - i += npoints + 1 - vertices = np.array(vertices, np.float) - vertices[:, 1] -= 160 - - dolphin_path = Path(vertices, codes) - dolphin_patch = PathPatch(dolphin_path, facecolor=(0.6, 0.6, 0.6), - edgecolor=(0.0, 0.0, 0.0)) - ax.add_patch(dolphin_patch) - - vertices = Affine2D().rotate_deg(60).transform(vertices) - dolphin_path2 = Path(vertices, codes) - dolphin_patch2 = PathPatch(dolphin_path2, facecolor=(0.5, 0.5, 0.5), - edgecolor=(0.0, 0.0, 0.0)) - ax.add_patch(dolphin_patch2) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/dolphin.txt b/_sources/examples/pylab_examples/dolphin.txt deleted file mode 100644 index b4e991918df..00000000000 --- a/_sources/examples/pylab_examples/dolphin.txt +++ /dev/null @@ -1,105 +0,0 @@ -.. _pylab_examples-dolphin: - -pylab_examples example code: dolphin.py -======================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/dolphin.py - -:: - - import matplotlib.cm as cm - import matplotlib.pyplot as plt - from matplotlib.patches import Circle, PathPatch - from matplotlib.path import Path - from matplotlib.transforms import Affine2D - import numpy as np - - - r = np.random.rand(50) - t = np.random.rand(50) * np.pi * 2.0 - x = r * np.cos(t) - y = r * np.sin(t) - - fig, ax = plt.subplots(figsize=(6, 6)) - circle = Circle((0, 0), 1, facecolor='none', - edgecolor=(0, 0.8, 0.8), linewidth=3, alpha=0.5) - ax.add_patch(circle) - - im = plt.imshow(np.random.random((100, 100)), - origin='lower', cmap=cm.winter, - interpolation='spline36', - extent=([-1, 1, -1, 1])) - im.set_clip_path(circle) - - plt.plot(x, y, 'o', color=(0.9, 0.9, 1.0), alpha=0.8) - - # Dolphin from OpenClipart library by Andy Fitzsimon - # - # - # - # - # - - dolphin = """ - M -0.59739425,160.18173 C -0.62740401,160.18885 -0.57867129,160.11183 - -0.57867129,160.11183 C -0.57867129,160.11183 -0.5438361,159.89315 - -0.39514638,159.81496 C -0.24645668,159.73678 -0.18316813,159.71981 - -0.18316813,159.71981 C -0.18316813,159.71981 -0.10322971,159.58124 - -0.057804323,159.58725 C -0.029723983,159.58913 -0.061841603,159.60356 - -0.071265813,159.62815 C -0.080250183,159.65325 -0.082918513,159.70554 - -0.061841203,159.71248 C -0.040763903,159.7194 -0.0066711426,159.71091 - 0.077336307,159.73612 C 0.16879567,159.76377 0.28380306,159.86448 - 0.31516668,159.91533 C 0.3465303,159.96618 0.5011127,160.1771 - 0.5011127,160.1771 C 0.63668998,160.19238 0.67763022,160.31259 - 0.66556395,160.32668 C 0.65339985,160.34212 0.66350443,160.33642 - 0.64907098,160.33088 C 0.63463742,160.32533 0.61309688,160.297 - 0.5789627,160.29339 C 0.54348657,160.28968 0.52329693,160.27674 - 0.50728856,160.27737 C 0.49060916,160.27795 0.48965803,160.31565 - 0.46114204,160.33673 C 0.43329696,160.35786 0.4570711,160.39871 - 0.43309565,160.40685 C 0.4105108,160.41442 0.39416631,160.33027 - 0.3954995,160.2935 C 0.39683269,160.25672 0.43807996,160.21522 - 0.44567915,160.19734 C 0.45327833,160.17946 0.27946869,159.9424 - -0.061852613,159.99845 C -0.083965233,160.0427 -0.26176109,160.06683 - -0.26176109,160.06683 C -0.30127962,160.07028 -0.21167141,160.09731 - -0.24649368,160.1011 C -0.32642366,160.11569 -0.34521187,160.06895 - -0.40622293,160.0819 C -0.467234,160.09485 -0.56738444,160.17461 - -0.59739425,160.18173 - """ - - vertices = [] - codes = [] - parts = dolphin.split() - i = 0 - code_map = { - 'M': (Path.MOVETO, 1), - 'C': (Path.CURVE4, 3), - 'L': (Path.LINETO, 1) - } - - while i < len(parts): - code = parts[i] - path_code, npoints = code_map[code] - codes.extend([path_code] * npoints) - vertices.extend([[float(x) for x in y.split(',')] for y in - parts[i + 1:i + npoints + 1]]) - i += npoints + 1 - vertices = np.array(vertices, np.float) - vertices[:, 1] -= 160 - - dolphin_path = Path(vertices, codes) - dolphin_patch = PathPatch(dolphin_path, facecolor=(0.6, 0.6, 0.6), - edgecolor=(0.0, 0.0, 0.0)) - ax.add_patch(dolphin_patch) - - vertices = Affine2D().rotate_deg(60).transform(vertices) - dolphin_path2 = Path(vertices, codes) - dolphin_patch2 = PathPatch(dolphin_path2, facecolor=(0.5, 0.5, 0.5), - edgecolor=(0.0, 0.0, 0.0)) - ax.add_patch(dolphin_patch2) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/ellipse_collection.rst.txt b/_sources/examples/pylab_examples/ellipse_collection.rst.txt deleted file mode 100644 index caee26d9532..00000000000 --- a/_sources/examples/pylab_examples/ellipse_collection.rst.txt +++ /dev/null @@ -1,41 +0,0 @@ -.. _pylab_examples-ellipse_collection: - -pylab_examples example code: ellipse_collection.py -================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/ellipse_collection.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - from matplotlib.collections import EllipseCollection - - x = np.arange(10) - y = np.arange(15) - X, Y = np.meshgrid(x, y) - - XY = np.hstack((X.ravel()[:, np.newaxis], Y.ravel()[:, np.newaxis])) - - ww = X/10.0 - hh = Y/15.0 - aa = X*9 - - - fig, ax = plt.subplots() - - ec = EllipseCollection(ww, hh, aa, units='x', offsets=XY, - transOffset=ax.transData) - ec.set_array((X + Y).ravel()) - ax.add_collection(ec) - ax.autoscale_view() - ax.set_xlabel('X') - ax.set_ylabel('y') - cbar = plt.colorbar(ec) - cbar.set_label('X+Y') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/ellipse_collection.txt b/_sources/examples/pylab_examples/ellipse_collection.txt deleted file mode 100644 index c5b60e06aa2..00000000000 --- a/_sources/examples/pylab_examples/ellipse_collection.txt +++ /dev/null @@ -1,41 +0,0 @@ -.. _pylab_examples-ellipse_collection: - -pylab_examples example code: ellipse_collection.py -================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/ellipse_collection.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - from matplotlib.collections import EllipseCollection - - x = np.arange(10) - y = np.arange(15) - X, Y = np.meshgrid(x, y) - - XY = np.hstack((X.ravel()[:, np.newaxis], Y.ravel()[:, np.newaxis])) - - ww = X/10.0 - hh = Y/15.0 - aa = X*9 - - - fig, ax = plt.subplots() - - ec = EllipseCollection(ww, hh, aa, units='x', offsets=XY, - transOffset=ax.transData) - ec.set_array((X + Y).ravel()) - ax.add_collection(ec) - ax.autoscale_view() - ax.set_xlabel('X') - ax.set_ylabel('y') - cbar = plt.colorbar(ec) - cbar.set_label('X+Y') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/ellipse_demo.rst.txt b/_sources/examples/pylab_examples/ellipse_demo.rst.txt deleted file mode 100644 index dc6e0a8b113..00000000000 --- a/_sources/examples/pylab_examples/ellipse_demo.rst.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _pylab_examples-ellipse_demo: - -pylab_examples example code: ellipse_demo.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/ellipse_demo.py - -:: - - import matplotlib.pyplot as plt - import numpy.random as rnd - from matplotlib.patches import Ellipse - - NUM = 250 - - ells = [Ellipse(xy=rnd.rand(2)*10, width=rnd.rand(), height=rnd.rand(), angle=rnd.rand()*360) - for i in range(NUM)] - - fig = plt.figure(0) - ax = fig.add_subplot(111, aspect='equal') - for e in ells: - ax.add_artist(e) - e.set_clip_box(ax.bbox) - e.set_alpha(rnd.rand()) - e.set_facecolor(rnd.rand(3)) - - ax.set_xlim(0, 10) - ax.set_ylim(0, 10) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/ellipse_demo.txt b/_sources/examples/pylab_examples/ellipse_demo.txt deleted file mode 100644 index c16e72c6f75..00000000000 --- a/_sources/examples/pylab_examples/ellipse_demo.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _pylab_examples-ellipse_demo: - -pylab_examples example code: ellipse_demo.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/ellipse_demo.py - -:: - - import matplotlib.pyplot as plt - import numpy.random as rnd - from matplotlib.patches import Ellipse - - NUM = 250 - - ells = [Ellipse(xy=rnd.rand(2)*10, width=rnd.rand(), height=rnd.rand(), angle=rnd.rand()*360) - for i in range(NUM)] - - fig = plt.figure(0) - ax = fig.add_subplot(111, aspect='equal') - for e in ells: - ax.add_artist(e) - e.set_clip_box(ax.bbox) - e.set_alpha(rnd.rand()) - e.set_facecolor(rnd.rand(3)) - - ax.set_xlim(0, 10) - ax.set_ylim(0, 10) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/ellipse_rotated.rst.txt b/_sources/examples/pylab_examples/ellipse_rotated.rst.txt deleted file mode 100644 index f1485a7ea64..00000000000 --- a/_sources/examples/pylab_examples/ellipse_rotated.rst.txt +++ /dev/null @@ -1,34 +0,0 @@ -.. _pylab_examples-ellipse_rotated: - -pylab_examples example code: ellipse_rotated.py -=============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/ellipse_rotated.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - from matplotlib.patches import Ellipse - - delta = 45.0 # degrees - - angles = np.arange(0, 360 + delta, delta) - ells = [Ellipse((1, 1), 4, 2, a) for a in angles] - - a = plt.subplot(111, aspect='equal') - - for e in ells: - e.set_clip_box(a.bbox) - e.set_alpha(0.1) - a.add_artist(e) - - plt.xlim(-2, 4) - plt.ylim(-1, 3) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/ellipse_rotated.txt b/_sources/examples/pylab_examples/ellipse_rotated.txt deleted file mode 100644 index f81cde622c5..00000000000 --- a/_sources/examples/pylab_examples/ellipse_rotated.txt +++ /dev/null @@ -1,34 +0,0 @@ -.. _pylab_examples-ellipse_rotated: - -pylab_examples example code: ellipse_rotated.py -=============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/ellipse_rotated.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - from matplotlib.patches import Ellipse - - delta = 45.0 # degrees - - angles = np.arange(0, 360 + delta, delta) - ells = [Ellipse((1, 1), 4, 2, a) for a in angles] - - a = plt.subplot(111, aspect='equal') - - for e in ells: - e.set_clip_box(a.bbox) - e.set_alpha(0.1) - a.add_artist(e) - - plt.xlim(-2, 4) - plt.ylim(-1, 3) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/equal_aspect_ratio.rst.txt b/_sources/examples/pylab_examples/equal_aspect_ratio.rst.txt deleted file mode 100644 index 79648fe6a26..00000000000 --- a/_sources/examples/pylab_examples/equal_aspect_ratio.rst.txt +++ /dev/null @@ -1,34 +0,0 @@ -.. _pylab_examples-equal_aspect_ratio: - -pylab_examples example code: equal_aspect_ratio.py -================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/equal_aspect_ratio.py - -:: - - """ - Example: simple line plot. - Show how to make a plot that has equal aspect ratio - """ - import matplotlib.pyplot as plt - import numpy as np - - t = np.arange(0.0, 1.0 + 0.01, 0.01) - s = np.cos(2*2*np.pi*t) - plt.plot(t, s, '-', lw=2) - - plt.xlabel('time (s)') - plt.ylabel('voltage (mV)') - plt.title('About as simple as it gets, folks') - plt.grid(True) - - plt.axes().set_aspect('equal', 'datalim') - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/equal_aspect_ratio.txt b/_sources/examples/pylab_examples/equal_aspect_ratio.txt deleted file mode 100644 index 1b6627f5373..00000000000 --- a/_sources/examples/pylab_examples/equal_aspect_ratio.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _pylab_examples-equal_aspect_ratio: - -pylab_examples example code: equal_aspect_ratio.py -================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/equal_aspect_ratio.py - -:: - - #!/usr/bin/env python - """ - Example: simple line plot. - Show how to make a plot that has equal aspect ratio - """ - import matplotlib.pyplot as plt - import numpy as np - - t = np.arange(0.0, 1.0 + 0.01, 0.01) - s = np.cos(2*2*np.pi*t) - plt.plot(t, s, '-', lw=2) - - plt.xlabel('time (s)') - plt.ylabel('voltage (mV)') - plt.title('About as simple as it gets, folks') - plt.grid(True) - - plt.axes().set_aspect('equal', 'datalim') - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/errorbar_demo.txt b/_sources/examples/pylab_examples/errorbar_demo.txt deleted file mode 100644 index 17ae20fb3db..00000000000 --- a/_sources/examples/pylab_examples/errorbar_demo.txt +++ /dev/null @@ -1,62 +0,0 @@ -.. _pylab_examples-errorbar_demo: - -pylab_examples example code: errorbar_demo.py -============================================= - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/errorbar_demo.py - -:: - - #!/usr/bin/env python - import numpy as np - import matplotlib.pyplot as plt - - # example data - x = np.arange(0.1, 4, 0.5) - y = np.exp(-x) - - # example variable error bar values - yerr = 0.1 + 0.2*np.sqrt(x) - xerr = 0.1 + yerr - - # First illustrate basic pyplot interface, using defaults where possible. - plt.figure() - plt.errorbar(x, y, xerr=0.2, yerr=0.4) - plt.title("Simplest errorbars, 0.2 in x, 0.4 in y") - - # Now switch to a more OO interface to exercise more features. - fig, axs = plt.subplots(nrows=2, ncols=2, sharex=True) - ax = axs[0,0] - ax.errorbar(x, y, yerr=yerr, fmt='o') - ax.set_title('Vert. symmetric') - - # With 4 subplots, reduce the number of axis ticks to avoid crowding. - ax.locator_params(nbins=4) - - ax = axs[0,1] - ax.errorbar(x, y, xerr=xerr, fmt='o') - ax.set_title('Hor. symmetric') - - ax = axs[1,0] - ax.errorbar(x, y, yerr=[yerr, 2*yerr], xerr=[xerr, 2*xerr], fmt='--o') - ax.set_title('H, V asymmetric') - - ax = axs[1,1] - ax.set_yscale('log') - # Here we have to be careful to keep all y values positive: - ylower = np.maximum(1e-2, y - yerr) - yerr_lower = y - ylower - - ax.errorbar(x, y, yerr=[yerr_lower, 2*yerr], xerr=xerr, - fmt='o', ecolor='g', capthick=2) - ax.set_title('Mixed sym., log y') - - fig.suptitle('Variable errorbars') - - plt.show() - - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/errorbar_limits.rst.txt b/_sources/examples/pylab_examples/errorbar_limits.rst.txt deleted file mode 100644 index 5c836f4a5f0..00000000000 --- a/_sources/examples/pylab_examples/errorbar_limits.rst.txt +++ /dev/null @@ -1,53 +0,0 @@ -.. _pylab_examples-errorbar_limits: - -pylab_examples example code: errorbar_limits.py -=============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/errorbar_limits.py - -:: - - """ - Illustration of upper and lower limit symbols on errorbars - """ - - import numpy as np - import matplotlib.pyplot as plt - - fig = plt.figure(0) - x = np.arange(10.0) - y = np.sin(np.arange(10.0)/20.0*np.pi) - - plt.errorbar(x, y, yerr=0.1) - - y = np.sin(np.arange(10.0)/20.0*np.pi) + 1 - plt.errorbar(x, y, yerr=0.1, uplims=True) - - y = np.sin(np.arange(10.0)/20.0*np.pi) + 2 - upperlimits = np.array([1, 0]*5) - lowerlimits = np.array([0, 1]*5) - plt.errorbar(x, y, yerr=0.1, uplims=upperlimits, lolims=lowerlimits) - - plt.xlim(-1, 10) - - fig = plt.figure(1) - x = np.arange(10.0)/10.0 - y = (x + 0.1)**2 - - plt.errorbar(x, y, xerr=0.1, xlolims=True) - y = (x + 0.1)**3 - - plt.errorbar(x + 0.6, y, xerr=0.1, xuplims=upperlimits, xlolims=lowerlimits) - - y = (x + 0.1)**4 - plt.errorbar(x + 1.2, y, xerr=0.1, xuplims=True) - - plt.xlim(-0.2, 2.4) - plt.ylim(-0.1, 1.3) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/errorbar_limits.txt b/_sources/examples/pylab_examples/errorbar_limits.txt deleted file mode 100644 index df59ed0085f..00000000000 --- a/_sources/examples/pylab_examples/errorbar_limits.txt +++ /dev/null @@ -1,53 +0,0 @@ -.. _pylab_examples-errorbar_limits: - -pylab_examples example code: errorbar_limits.py -=============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/errorbar_limits.py - -:: - - """ - Illustration of upper and lower limit symbols on errorbars - """ - - import numpy as np - import matplotlib.pyplot as plt - - fig = plt.figure(0) - x = np.arange(10.0) - y = np.sin(np.arange(10.0)/20.0*np.pi) - - plt.errorbar(x, y, yerr=0.1, capsize=3) - - y = np.sin(np.arange(10.0)/20.0*np.pi) + 1 - plt.errorbar(x, y, yerr=0.1, uplims=True) - - y = np.sin(np.arange(10.0)/20.0*np.pi) + 2 - upperlimits = np.array([1, 0]*5) - lowerlimits = np.array([0, 1]*5) - plt.errorbar(x, y, yerr=0.1, uplims=upperlimits, lolims=lowerlimits) - - plt.xlim(-1, 10) - - fig = plt.figure(1) - x = np.arange(10.0)/10.0 - y = (x + 0.1)**2 - - plt.errorbar(x, y, xerr=0.1, xlolims=True) - y = (x + 0.1)**3 - - plt.errorbar(x + 0.6, y, xerr=0.1, xuplims=upperlimits, xlolims=lowerlimits) - - y = (x + 0.1)**4 - plt.errorbar(x + 1.2, y, xerr=0.1, xuplims=True) - - plt.xlim(-0.2, 2.4) - plt.ylim(-0.1, 1.3) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/errorbar_subsample.rst.txt b/_sources/examples/pylab_examples/errorbar_subsample.rst.txt deleted file mode 100644 index a614c0acd89..00000000000 --- a/_sources/examples/pylab_examples/errorbar_subsample.rst.txt +++ /dev/null @@ -1,44 +0,0 @@ -.. _pylab_examples-errorbar_subsample: - -pylab_examples example code: errorbar_subsample.py -================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/errorbar_subsample.py - -:: - - ''' - Demo for the errorevery keyword to show data full accuracy data plots with - few errorbars. - ''' - - import numpy as np - import matplotlib.pyplot as plt - - # example data - x = np.arange(0.1, 4, 0.1) - y = np.exp(-x) - - # example variable error bar values - yerr = 0.1 + 0.1*np.sqrt(x) - - - # Now switch to a more OO interface to exercise more features. - fig, axs = plt.subplots(nrows=1, ncols=2, sharex=True) - ax = axs[0] - ax.errorbar(x, y, yerr=yerr) - ax.set_title('all errorbars') - - ax = axs[1] - ax.errorbar(x, y, yerr=yerr, errorevery=5) - ax.set_title('only every 5th errorbar') - - - fig.suptitle('Errorbar subsampling for better appearance') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/errorbar_subsample.txt b/_sources/examples/pylab_examples/errorbar_subsample.txt deleted file mode 100644 index b94efb5d0fb..00000000000 --- a/_sources/examples/pylab_examples/errorbar_subsample.txt +++ /dev/null @@ -1,44 +0,0 @@ -.. _pylab_examples-errorbar_subsample: - -pylab_examples example code: errorbar_subsample.py -================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/errorbar_subsample.py - -:: - - ''' - Demo for the errorevery keyword to show data full accuracy data plots with - few errorbars. - ''' - - import numpy as np - import matplotlib.pyplot as plt - - # example data - x = np.arange(0.1, 4, 0.1) - y = np.exp(-x) - - # example variable error bar values - yerr = 0.1 + 0.1*np.sqrt(x) - - - # Now switch to a more OO interface to exercise more features. - fig, axs = plt.subplots(nrows=1, ncols=2, sharex=True) - ax = axs[0] - ax.errorbar(x, y, yerr=yerr) - ax.set_title('all errorbars') - - ax = axs[1] - ax.errorbar(x, y, yerr=yerr, errorevery=5) - ax.set_title('only every 5th errorbar') - - - fig.suptitle('Errorbar subsampling for better visualibility') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/eventcollection_demo.rst.txt b/_sources/examples/pylab_examples/eventcollection_demo.rst.txt deleted file mode 100644 index 78d1adbed9f..00000000000 --- a/_sources/examples/pylab_examples/eventcollection_demo.rst.txt +++ /dev/null @@ -1,68 +0,0 @@ -.. _pylab_examples-eventcollection_demo: - -pylab_examples example code: eventcollection_demo.py -==================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/eventcollection_demo.py - -:: - - ''' - Plot two curves, then use EventCollections to mark the locations of the x - and y data points on the respective axes for each curve - ''' - - import matplotlib.pyplot as plt - from matplotlib.collections import EventCollection - import numpy as np - - # create random data - np.random.seed(50) - xdata = np.random.random([2, 10]) - - # split the data into two parts - xdata1 = xdata[0, :] - xdata2 = xdata[1, :] - - # sort the data so it makes clean curves - xdata1.sort() - xdata2.sort() - - # create some y data points - ydata1 = xdata1 ** 2 - ydata2 = 1 - xdata2 ** 3 - - # plot the data - fig = plt.figure() - ax = fig.add_subplot(1, 1, 1) - ax.plot(xdata1, ydata1, 'r', xdata2, ydata2, 'b') - - # create the events marking the x data points - xevents1 = EventCollection(xdata1, color=[1, 0, 0], linelength=0.05) - xevents2 = EventCollection(xdata2, color=[0, 0, 1], linelength=0.05) - - # create the events marking the y data points - yevents1 = EventCollection(ydata1, color=[1, 0, 0], linelength=0.05, - orientation='vertical') - yevents2 = EventCollection(ydata2, color=[0, 0, 1], linelength=0.05, - orientation='vertical') - - # add the events to the axis - ax.add_collection(xevents1) - ax.add_collection(xevents2) - ax.add_collection(yevents1) - ax.add_collection(yevents2) - - # set the limits - ax.set_xlim([0, 1]) - ax.set_ylim([0, 1]) - - ax.set_title('line plot with data points') - - # display the plot - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/eventcollection_demo.txt b/_sources/examples/pylab_examples/eventcollection_demo.txt deleted file mode 100644 index 491e0c48a00..00000000000 --- a/_sources/examples/pylab_examples/eventcollection_demo.txt +++ /dev/null @@ -1,68 +0,0 @@ -.. _pylab_examples-eventcollection_demo: - -pylab_examples example code: eventcollection_demo.py -==================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/eventcollection_demo.py - -:: - - #!/usr/bin/env python - # -*- Coding:utf-8 -*- - '''Plot two curves, then use EventCollections to mark the locations of the x - and y data points on the respective axes for each curve''' - - import matplotlib.pyplot as plt - from matplotlib.collections import EventCollection - import numpy as np - - # create random data - np.random.seed(50) - xdata = np.random.random([2, 10]) - - # split the data into two parts - xdata1 = xdata[0, :] - xdata2 = xdata[1, :] - - # sort the data so it makes clean curves - xdata1.sort() - xdata2.sort() - - # create some y data points - ydata1 = xdata1 ** 2 - ydata2 = 1 - xdata2 ** 3 - - # plot the data - fig = plt.figure() - ax = fig.add_subplot(1, 1, 1) - ax.plot(xdata1, ydata1, 'r', xdata2, ydata2, 'b') - - # create the events marking the x data points - xevents1 = EventCollection(xdata1, color=[1, 0, 0], linelength=0.05) - xevents2 = EventCollection(xdata2, color=[0, 0, 1], linelength=0.05) - - # create the events marking the y data points - yevents1 = EventCollection(ydata1, color=[1, 0, 0], linelength=0.05, - orientation='vertical') - yevents2 = EventCollection(ydata2, color=[0, 0, 1], linelength=0.05, - orientation='vertical') - - # add the events to the axis - ax.add_collection(xevents1) - ax.add_collection(xevents2) - ax.add_collection(yevents1) - ax.add_collection(yevents2) - - # set the limits - ax.set_xlim([0, 1]) - ax.set_ylim([0, 1]) - - ax.set_title('line plot with data points') - - # display the plot - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/eventplot_demo.rst.txt b/_sources/examples/pylab_examples/eventplot_demo.rst.txt deleted file mode 100644 index 100adab0e04..00000000000 --- a/_sources/examples/pylab_examples/eventplot_demo.rst.txt +++ /dev/null @@ -1,79 +0,0 @@ -.. _pylab_examples-eventplot_demo: - -pylab_examples example code: eventplot_demo.py -============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/eventplot_demo.py - -:: - - ''' - An eventplot showing sequences of events with various line properties. - The plot is shown in both horizontal and vertical orientations. - ''' - - import matplotlib.pyplot as plt - import numpy as np - import matplotlib - matplotlib.rcParams['font.size'] = 8.0 - - # set the random seed - np.random.seed(0) - - # create random data - data1 = np.random.random([6, 50]) - - # set different colors for each set of positions - colors1 = np.array([[1, 0, 0], - [0, 1, 0], - [0, 0, 1], - [1, 1, 0], - [1, 0, 1], - [0, 1, 1]]) - - # set different line properties for each set of positions - # note that some overlap - lineoffsets1 = np.array([-15, -3, 1, 1.5, 6, 10]) - linelengths1 = [5, 2, 1, 1, 3, 1.5] - - fig = plt.figure() - - # create a horizontal plot - ax1 = fig.add_subplot(221) - ax1.eventplot(data1, colors=colors1, lineoffsets=lineoffsets1, - linelengths=linelengths1) - - - # create a vertical plot - ax2 = fig.add_subplot(223) - ax2.eventplot(data1, colors=colors1, lineoffsets=lineoffsets1, - linelengths=linelengths1, orientation='vertical') - - # create another set of random data. - # the gamma distribution is only used fo aesthetic purposes - data2 = np.random.gamma(4, size=[60, 50]) - - # use individual values for the parameters this time - # these values will be used for all data sets (except lineoffsets2, which - # sets the increment between each data set in this usage) - colors2 = [[0, 0, 0]] - lineoffsets2 = 1 - linelengths2 = 1 - - # create a horizontal plot - ax1 = fig.add_subplot(222) - ax1.eventplot(data2, colors=colors2, lineoffsets=lineoffsets2, - linelengths=linelengths2) - - - # create a vertical plot - ax2 = fig.add_subplot(224) - ax2.eventplot(data2, colors=colors2, lineoffsets=lineoffsets2, - linelengths=linelengths2, orientation='vertical') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/eventplot_demo.txt b/_sources/examples/pylab_examples/eventplot_demo.txt deleted file mode 100644 index c544c6592f3..00000000000 --- a/_sources/examples/pylab_examples/eventplot_demo.txt +++ /dev/null @@ -1,79 +0,0 @@ -.. _pylab_examples-eventplot_demo: - -pylab_examples example code: eventplot_demo.py -============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/eventplot_demo.py - -:: - - #!/usr/bin/env python - # -*- Coding:utf-8 -*- - '''an eventplot showing sequences of events with various line properties - the plot is shown in both horizontal and vertical orientations''' - - import matplotlib.pyplot as plt - import numpy as np - import matplotlib - matplotlib.rcParams['font.size'] = 8.0 - - # set the random seed - np.random.seed(0) - - # create random data - data1 = np.random.random([6, 50]) - - # set different colors for each set of positions - colors1 = np.array([[1, 0, 0], - [0, 1, 0], - [0, 0, 1], - [1, 1, 0], - [1, 0, 1], - [0, 1, 1]]) - - # set different line properties for each set of positions - # note that some overlap - lineoffsets1 = np.array([-15, -3, 1, 1.5, 6, 10]) - linelengths1 = [5, 2, 1, 1, 3, 1.5] - - fig = plt.figure() - - # create a horizontal plot - ax1 = fig.add_subplot(221) - ax1.eventplot(data1, colors=colors1, lineoffsets=lineoffsets1, - linelengths=linelengths1) - - - # create a vertical plot - ax2 = fig.add_subplot(223) - ax2.eventplot(data1, colors=colors1, lineoffsets=lineoffsets1, - linelengths=linelengths1, orientation='vertical') - - # create another set of random data. - # the gamma distribution is only used fo aesthetic purposes - data2 = np.random.gamma(4, size=[60, 50]) - - # use individual values for the parameters this time - # these values will be used for all data sets (except lineoffsets2, which - # sets the increment between each data set in this usage) - colors2 = [[0, 0, 0]] - lineoffsets2 = 1 - linelengths2 = 1 - - # create a horizontal plot - ax1 = fig.add_subplot(222) - ax1.eventplot(data2, colors=colors2, lineoffsets=lineoffsets2, - linelengths=linelengths2) - - - # create a vertical plot - ax2 = fig.add_subplot(224) - ax2.eventplot(data2, colors=colors2, lineoffsets=lineoffsets2, - linelengths=linelengths2, orientation='vertical') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/fancyarrow_demo.rst.txt b/_sources/examples/pylab_examples/fancyarrow_demo.rst.txt deleted file mode 100644 index 790964fd9a3..00000000000 --- a/_sources/examples/pylab_examples/fancyarrow_demo.rst.txt +++ /dev/null @@ -1,64 +0,0 @@ -.. _pylab_examples-fancyarrow_demo: - -pylab_examples example code: fancyarrow_demo.py -=============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/fancyarrow_demo.py - -:: - - import matplotlib.patches as mpatches - import matplotlib.pyplot as plt - - styles = mpatches.ArrowStyle.get_styles() - - ncol = 2 - nrow = (len(styles) + 1) // ncol - figheight = (nrow + 0.5) - fig1 = plt.figure(1, (4.*ncol/1.5, figheight/1.5)) - fontsize = 0.2 * 70 - - - ax = fig1.add_axes([0, 0, 1, 1], frameon=False, aspect=1.) - - ax.set_xlim(0, 4*ncol) - ax.set_ylim(0, figheight) - - - def to_texstring(s): - s = s.replace("<", r"$<$") - s = s.replace(">", r"$>$") - s = s.replace("|", r"$|$") - return s - - for i, (stylename, styleclass) in enumerate(sorted(styles.items())): - x = 3.2 + (i//nrow)*4 - y = (figheight - 0.7 - i % nrow) # /figheight - p = mpatches.Circle((x, y), 0.2) - ax.add_patch(p) - - ax.annotate(to_texstring(stylename), (x, y), - (x - 1.2, y), - #xycoords="figure fraction", textcoords="figure fraction", - ha="right", va="center", - size=fontsize, - arrowprops=dict(arrowstyle=stylename, - patchB=p, - shrinkA=5, - shrinkB=5, - fc="k", ec="k", - connectionstyle="arc3,rad=-0.05", - ), - bbox=dict(boxstyle="square", fc="w")) - - ax.xaxis.set_visible(False) - ax.yaxis.set_visible(False) - - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/fancyarrow_demo.txt b/_sources/examples/pylab_examples/fancyarrow_demo.txt deleted file mode 100644 index 994d7f3fc97..00000000000 --- a/_sources/examples/pylab_examples/fancyarrow_demo.txt +++ /dev/null @@ -1,64 +0,0 @@ -.. _pylab_examples-fancyarrow_demo: - -pylab_examples example code: fancyarrow_demo.py -=============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/fancyarrow_demo.py - -:: - - import matplotlib.patches as mpatches - import matplotlib.pyplot as plt - - styles = mpatches.ArrowStyle.get_styles() - - ncol = 2 - nrow = (len(styles) + 1) // ncol - figheight = (nrow + 0.5) - fig1 = plt.figure(1, (4.*ncol/1.5, figheight/1.5)) - fontsize = 0.2 * 70 - - - ax = fig1.add_axes([0, 0, 1, 1], frameon=False, aspect=1.) - - ax.set_xlim(0, 4*ncol) - ax.set_ylim(0, figheight) - - - def to_texstring(s): - s = s.replace("<", r"$<$") - s = s.replace(">", r"$>$") - s = s.replace("|", r"$|$") - return s - - for i, (stylename, styleclass) in enumerate(sorted(styles.items())): - x = 3.2 + (i//nrow)*4 - y = (figheight - 0.7 - i % nrow) # /figheight - p = mpatches.Circle((x, y), 0.2, fc="w") - ax.add_patch(p) - - ax.annotate(to_texstring(stylename), (x, y), - (x - 1.2, y), - #xycoords="figure fraction", textcoords="figure fraction", - ha="right", va="center", - size=fontsize, - arrowprops=dict(arrowstyle=stylename, - patchB=p, - shrinkA=5, - shrinkB=5, - fc="w", ec="k", - connectionstyle="arc3,rad=-0.05", - ), - bbox=dict(boxstyle="square", fc="w")) - - ax.xaxis.set_visible(False) - ax.yaxis.set_visible(False) - - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/fancybox_demo.rst.txt b/_sources/examples/pylab_examples/fancybox_demo.rst.txt deleted file mode 100644 index d67c014b9de..00000000000 --- a/_sources/examples/pylab_examples/fancybox_demo.rst.txt +++ /dev/null @@ -1,177 +0,0 @@ -.. _pylab_examples-fancybox_demo: - -pylab_examples example code: fancybox_demo.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/fancybox_demo.py - -:: - - import matplotlib.pyplot as plt - import matplotlib.transforms as mtransforms - from matplotlib.patches import FancyBboxPatch - - - # Bbox object around which the fancy box will be drawn. - bb = mtransforms.Bbox([[0.3, 0.4], [0.7, 0.6]]) - - - def draw_bbox(ax, bb): - # boxstyle=square with pad=0, i.e. bbox itself. - p_bbox = FancyBboxPatch((bb.xmin, bb.ymin), - abs(bb.width), abs(bb.height), - boxstyle="square,pad=0.", - ec="k", fc="none", zorder=10., - ) - ax.add_patch(p_bbox) - - - def test1(ax): - - # a fancy box with round corners. pad=0.1 - p_fancy = FancyBboxPatch((bb.xmin, bb.ymin), - abs(bb.width), abs(bb.height), - boxstyle="round,pad=0.1", - fc=(1., .8, 1.), - ec=(1., 0.5, 1.)) - - ax.add_patch(p_fancy) - - ax.text(0.1, 0.8, - r' boxstyle="round,pad=0.1"', - size=10, transform=ax.transAxes) - - # draws control points for the fancy box. - #l = p_fancy.get_path().vertices - #ax.plot(l[:,0], l[:,1], ".") - - # draw the original bbox in black - draw_bbox(ax, bb) - - - def test2(ax): - - # bbox=round has two optional argument. pad and rounding_size. - # They can be set during the initialization. - p_fancy = FancyBboxPatch((bb.xmin, bb.ymin), - abs(bb.width), abs(bb.height), - boxstyle="round,pad=0.1", - fc=(1., .8, 1.), - ec=(1., 0.5, 1.)) - - ax.add_patch(p_fancy) - - # boxstyle and its argument can be later modified with - # set_boxstyle method. Note that the old attributes are simply - # forgotten even if the boxstyle name is same. - - p_fancy.set_boxstyle("round,pad=0.1, rounding_size=0.2") - # or - #p_fancy.set_boxstyle("round", pad=0.1, rounding_size=0.2) - - ax.text(0.1, 0.8, - ' boxstyle="round,pad=0.1\n rounding\\_size=0.2"', - size=10, transform=ax.transAxes) - - # draws control points for the fancy box. - #l = p_fancy.get_path().vertices - #ax.plot(l[:,0], l[:,1], ".") - - draw_bbox(ax, bb) - - - def test3(ax): - - # mutation_scale determine overall scale of the mutation, - # i.e. both pad and rounding_size is scaled according to this - # value. - p_fancy = FancyBboxPatch((bb.xmin, bb.ymin), - abs(bb.width), abs(bb.height), - boxstyle="round,pad=0.1", - mutation_scale=2., - fc=(1., .8, 1.), - ec=(1., 0.5, 1.)) - - ax.add_patch(p_fancy) - - ax.text(0.1, 0.8, - ' boxstyle="round,pad=0.1"\n mutation\\_scale=2', - size=10, transform=ax.transAxes) - - # draws control points for the fancy box. - #l = p_fancy.get_path().vertices - #ax.plot(l[:,0], l[:,1], ".") - - draw_bbox(ax, bb) - - - def test4(ax): - - # When the aspect ratio of the axes is not 1, the fancy box may - # not be what you expected (green) - - p_fancy = FancyBboxPatch((bb.xmin, bb.ymin), - abs(bb.width), abs(bb.height), - boxstyle="round,pad=0.2", - fc="none", - ec=(0., .5, 0.), zorder=4) - - ax.add_patch(p_fancy) - - # You can compensate this by setting the mutation_aspect (pink). - p_fancy = FancyBboxPatch((bb.xmin, bb.ymin), - abs(bb.width), abs(bb.height), - boxstyle="round,pad=0.3", - mutation_aspect=.5, - fc=(1., 0.8, 1.), - ec=(1., 0.5, 1.)) - - ax.add_patch(p_fancy) - - ax.text(0.1, 0.8, - ' boxstyle="round,pad=0.3"\n mutation\\_aspect=.5', - size=10, transform=ax.transAxes) - - draw_bbox(ax, bb) - - - def test_all(): - plt.clf() - - ax = plt.subplot(2, 2, 1) - test1(ax) - ax.set_xlim(0., 1.) - ax.set_ylim(0., 1.) - ax.set_title("test1") - ax.set_aspect(1.) - - ax = plt.subplot(2, 2, 2) - ax.set_title("test2") - test2(ax) - ax.set_xlim(0., 1.) - ax.set_ylim(0., 1.) - ax.set_aspect(1.) - - ax = plt.subplot(2, 2, 3) - ax.set_title("test3") - test3(ax) - ax.set_xlim(0., 1.) - ax.set_ylim(0., 1.) - ax.set_aspect(1) - - ax = plt.subplot(2, 2, 4) - ax.set_title("test4") - test4(ax) - ax.set_xlim(-0.5, 1.5) - ax.set_ylim(0., 1.) - ax.set_aspect(2.) - - plt.draw() - plt.show() - - test_all() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/fancybox_demo.txt b/_sources/examples/pylab_examples/fancybox_demo.txt deleted file mode 100644 index 6e5dace35f0..00000000000 --- a/_sources/examples/pylab_examples/fancybox_demo.txt +++ /dev/null @@ -1,177 +0,0 @@ -.. _pylab_examples-fancybox_demo: - -pylab_examples example code: fancybox_demo.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/fancybox_demo.py - -:: - - import matplotlib.pyplot as plt - import matplotlib.transforms as mtransforms - from matplotlib.patches import FancyBboxPatch - - - # Bbox object around which the fancy box will be drawn. - bb = mtransforms.Bbox([[0.3, 0.4], [0.7, 0.6]]) - - - def draw_bbox(ax, bb): - # boxstyle=square with pad=0, i.e. bbox itself. - p_bbox = FancyBboxPatch((bb.xmin, bb.ymin), - abs(bb.width), abs(bb.height), - boxstyle="square,pad=0.", - ec="k", fc="none", zorder=10., - ) - ax.add_patch(p_bbox) - - - def test1(ax): - - # a fancy box with round corners. pad=0.1 - p_fancy = FancyBboxPatch((bb.xmin, bb.ymin), - abs(bb.width), abs(bb.height), - boxstyle="round,pad=0.1", - fc=(1., .8, 1.), - ec=(1., 0.5, 1.)) - - ax.add_patch(p_fancy) - - ax.text(0.1, 0.8, - r' boxstyle="round,pad=0.1"', - size=10, transform=ax.transAxes) - - # draws control points for the fancy box. - #l = p_fancy.get_path().vertices - #ax.plot(l[:,0], l[:,1], ".") - - # draw the original bbox in black - draw_bbox(ax, bb) - - - def test2(ax): - - # bbox=round has two optional argument. pad and rounding_size. - # They can be set during the initialization. - p_fancy = FancyBboxPatch((bb.xmin, bb.ymin), - abs(bb.width), abs(bb.height), - boxstyle="round,pad=0.1", - fc=(1., .8, 1.), - ec=(1., 0.5, 1.)) - - ax.add_patch(p_fancy) - - # boxstyle and its argument can be later modified with - # set_boxstyle method. Note that the old attributes are simply - # forgotten even if the boxstyle name is same. - - p_fancy.set_boxstyle("round,pad=0.1, rounding_size=0.2") - # or - #p_fancy.set_boxstyle("round", pad=0.1, rounding_size=0.2) - - ax.text(0.1, 0.8, - ' boxstyle="round,pad=0.1\n rounding\\_size=0.2"', - size=10, transform=ax.transAxes) - - # draws control points for the fancy box. - #l = p_fancy.get_path().vertices - #ax.plot(l[:,0], l[:,1], ".") - - draw_bbox(ax, bb) - - - def test3(ax): - - # mutation_scale determine overall scale of the mutation, - # i.e. both pad and rounding_size is scaled according to this - # value. - p_fancy = FancyBboxPatch((bb.xmin, bb.ymin), - abs(bb.width), abs(bb.height), - boxstyle="round,pad=0.1", - mutation_scale=2., - fc=(1., .8, 1.), - ec=(1., 0.5, 1.)) - - ax.add_patch(p_fancy) - - ax.text(0.1, 0.8, - ' boxstyle="round,pad=0.1"\n mutation\\_scale=2', - size=10, transform=ax.transAxes) - - # draws control points for the fancy box. - #l = p_fancy.get_path().vertices - #ax.plot(l[:,0], l[:,1], ".") - - draw_bbox(ax, bb) - - - def test4(ax): - - # When the aspect ratio of the axes is not 1, the fancy box may - # not be what you expected (green) - - p_fancy = FancyBboxPatch((bb.xmin, bb.ymin), - abs(bb.width), abs(bb.height), - boxstyle="round,pad=0.2", - fc="none", - ec=(0., .5, 0.), zorder=4) - - ax.add_patch(p_fancy) - - # You can compensate this by setting the mutation_aspect (pink). - p_fancy = FancyBboxPatch((bb.xmin, bb.ymin), - abs(bb.width), abs(bb.height), - boxstyle="round,pad=0.3", - mutation_aspect=.5, - fc=(1., 0.8, 1.), - ec=(1., 0.5, 1.)) - - ax.add_patch(p_fancy) - - ax.text(0.1, 0.8, - ' boxstyle="round,pad=0.3"\n mutation\\_aspect=.5', - size=10, transform=ax.transAxes) - - draw_bbox(ax, bb) - - - def test_all(): - plt.clf() - - ax = plt.subplot(2, 2, 1) - test1(ax) - ax.set_xlim(0., 1.) - ax.set_ylim(0., 1.) - ax.set_title("test1") - ax.set_aspect(1.) - - ax = plt.subplot(2, 2, 2) - ax.set_title("test2") - test2(ax) - ax.set_xlim(0., 1.) - ax.set_ylim(0., 1.) - ax.set_aspect(1.) - - ax = plt.subplot(2, 2, 3) - ax.set_title("test3") - test3(ax) - ax.set_xlim(0., 1.) - ax.set_ylim(0., 1.) - ax.set_aspect(1) - - ax = plt.subplot(2, 2, 4) - ax.set_title("test4") - test4(ax) - ax.set_xlim(-0.5, 1.5) - ax.set_ylim(0., 1.) - ax.set_aspect(2.) - - plt.draw() - plt.show() - - test_all() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/fancybox_demo2.rst.txt b/_sources/examples/pylab_examples/fancybox_demo2.rst.txt deleted file mode 100644 index 11570d37125..00000000000 --- a/_sources/examples/pylab_examples/fancybox_demo2.rst.txt +++ /dev/null @@ -1,32 +0,0 @@ -.. _pylab_examples-fancybox_demo2: - -pylab_examples example code: fancybox_demo2.py -============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/fancybox_demo2.py - -:: - - import matplotlib.patches as mpatch - import matplotlib.pyplot as plt - - styles = mpatch.BoxStyle.get_styles() - spacing = 1.2 - - figheight = (spacing * len(styles) + .5) - fig1 = plt.figure(1, (4/1.5, figheight/1.5)) - fontsize = 0.3 * 72 - - for i, stylename in enumerate(sorted(styles.keys())): - fig1.text(0.5, (spacing * (float(len(styles)) - i) - 0.5)/figheight, stylename, - ha="center", - size=fontsize, - transform=fig1.transFigure, - bbox=dict(boxstyle=stylename, fc="w", ec="k")) - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/fancybox_demo2.txt b/_sources/examples/pylab_examples/fancybox_demo2.txt deleted file mode 100644 index 116535acd3f..00000000000 --- a/_sources/examples/pylab_examples/fancybox_demo2.txt +++ /dev/null @@ -1,32 +0,0 @@ -.. _pylab_examples-fancybox_demo2: - -pylab_examples example code: fancybox_demo2.py -============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/fancybox_demo2.py - -:: - - import matplotlib.patches as mpatch - import matplotlib.pyplot as plt - - styles = mpatch.BoxStyle.get_styles() - spacing = 1.2 - - figheight = (spacing * len(styles) + .5) - fig1 = plt.figure(1, (4/1.5, figheight/1.5)) - fontsize = 0.3 * 72 - - for i, stylename in enumerate(sorted(styles.keys())): - fig1.text(0.5, (spacing * (float(len(styles)) - i) - 0.5)/figheight, stylename, - ha="center", - size=fontsize, - transform=fig1.transFigure, - bbox=dict(boxstyle=stylename, fc="w", ec="k")) - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/fancytextbox_demo.rst.txt b/_sources/examples/pylab_examples/fancytextbox_demo.rst.txt deleted file mode 100644 index 44215fbf372..00000000000 --- a/_sources/examples/pylab_examples/fancytextbox_demo.rst.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _pylab_examples-fancytextbox_demo: - -pylab_examples example code: fancytextbox_demo.py -================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/fancytextbox_demo.py - -:: - - import matplotlib.pyplot as plt - - plt.text(0.6, 0.5, "test", size=50, rotation=30., - ha="center", va="center", - bbox=dict(boxstyle="round", - ec=(1., 0.5, 0.5), - fc=(1., 0.8, 0.8), - ) - ) - - plt.text(0.5, 0.4, "test", size=50, rotation=-30., - ha="right", va="top", - bbox=dict(boxstyle="square", - ec=(1., 0.5, 0.5), - fc=(1., 0.8, 0.8), - ) - ) - - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/fancytextbox_demo.txt b/_sources/examples/pylab_examples/fancytextbox_demo.txt deleted file mode 100644 index 4986f500ad7..00000000000 --- a/_sources/examples/pylab_examples/fancytextbox_demo.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _pylab_examples-fancytextbox_demo: - -pylab_examples example code: fancytextbox_demo.py -================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/fancytextbox_demo.py - -:: - - import matplotlib.pyplot as plt - - plt.text(0.6, 0.5, "test", size=50, rotation=30., - ha="center", va="center", - bbox=dict(boxstyle="round", - ec=(1., 0.5, 0.5), - fc=(1., 0.8, 0.8), - ) - ) - - plt.text(0.5, 0.4, "test", size=50, rotation=-30., - ha="right", va="top", - bbox=dict(boxstyle="square", - ec=(1., 0.5, 0.5), - fc=(1., 0.8, 0.8), - ) - ) - - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/figimage_demo.rst.txt b/_sources/examples/pylab_examples/figimage_demo.rst.txt deleted file mode 100644 index 9eb1515dbd0..00000000000 --- a/_sources/examples/pylab_examples/figimage_demo.rst.txt +++ /dev/null @@ -1,33 +0,0 @@ -.. _pylab_examples-figimage_demo: - -pylab_examples example code: figimage_demo.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/figimage_demo.py - -:: - - """ - This illustrates placing images directly in the figure, with no axes. - - """ - import numpy as np - import matplotlib - import matplotlib.cm as cm - import matplotlib.pyplot as plt - - - fig = plt.figure() - Z = np.arange(10000.0) - Z.shape = 100, 100 - Z[:, 50:] = 1. - - im1 = plt.figimage(Z, xo=50, yo=0, origin='lower') - im2 = plt.figimage(Z, xo=100, yo=100, alpha=.8, origin='lower') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/figimage_demo.txt b/_sources/examples/pylab_examples/figimage_demo.txt deleted file mode 100644 index 70880a2860e..00000000000 --- a/_sources/examples/pylab_examples/figimage_demo.txt +++ /dev/null @@ -1,33 +0,0 @@ -.. _pylab_examples-figimage_demo: - -pylab_examples example code: figimage_demo.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/figimage_demo.py - -:: - - """ - This illustrates placing images directly in the figure, with no axes. - - """ - import numpy as np - import matplotlib - import matplotlib.cm as cm - import matplotlib.pyplot as plt - - - fig = plt.figure() - Z = np.arange(10000.0) - Z.shape = 100, 100 - Z[:, 50:] = 1. - - 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') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/figlegend_demo.rst.txt b/_sources/examples/pylab_examples/figlegend_demo.rst.txt deleted file mode 100644 index 9e807f99aff..00000000000 --- a/_sources/examples/pylab_examples/figlegend_demo.rst.txt +++ /dev/null @@ -1,33 +0,0 @@ -.. _pylab_examples-figlegend_demo: - -pylab_examples example code: figlegend_demo.py -============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/figlegend_demo.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - - fig = plt.figure() - ax1 = fig.add_axes([0.1, 0.1, 0.4, 0.7]) - ax2 = fig.add_axes([0.55, 0.1, 0.4, 0.7]) - - x = np.arange(0.0, 2.0, 0.02) - y1 = np.sin(2*np.pi*x) - y2 = np.exp(-x) - l1, l2 = ax1.plot(x, y1, 'rs-', x, y2, 'go') - - y3 = np.sin(4*np.pi*x) - y4 = np.exp(-2*x) - l3, l4 = ax2.plot(x, y3, 'yd-', x, y4, 'k^') - - fig.legend((l1, l2), ('Line 1', 'Line 2'), 'upper left') - fig.legend((l3, l4), ('Line 3', 'Line 4'), 'upper right') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/figlegend_demo.txt b/_sources/examples/pylab_examples/figlegend_demo.txt deleted file mode 100644 index c876a10ecad..00000000000 --- a/_sources/examples/pylab_examples/figlegend_demo.txt +++ /dev/null @@ -1,33 +0,0 @@ -.. _pylab_examples-figlegend_demo: - -pylab_examples example code: figlegend_demo.py -============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/figlegend_demo.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - - fig = plt.figure() - ax1 = fig.add_axes([0.1, 0.1, 0.4, 0.7]) - ax2 = fig.add_axes([0.55, 0.1, 0.4, 0.7]) - - x = np.arange(0.0, 2.0, 0.02) - y1 = np.sin(2*np.pi*x) - y2 = np.exp(-x) - l1, l2 = ax1.plot(x, y1, 'rs-', x, y2, 'go') - - y3 = np.sin(4*np.pi*x) - y4 = np.exp(-2*x) - l3, l4 = ax2.plot(x, y3, 'yd-', x, y4, 'k^') - - fig.legend((l1, l2), ('Line 1', 'Line 2'), 'upper left') - fig.legend((l3, l4), ('Line 3', 'Line 4'), 'upper right') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/figure_title.rst.txt b/_sources/examples/pylab_examples/figure_title.rst.txt deleted file mode 100644 index ba825ff4383..00000000000 --- a/_sources/examples/pylab_examples/figure_title.rst.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _pylab_examples-figure_title: - -pylab_examples example code: figure_title.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/figure_title.py - -:: - - from matplotlib.font_manager import FontProperties - import matplotlib.pyplot as plt - import numpy as np - - - def f(t): - s1 = np.cos(2*np.pi*t) - e1 = np.exp(-t) - return s1 * e1 - - t1 = np.arange(0.0, 5.0, 0.1) - t2 = np.arange(0.0, 5.0, 0.02) - t3 = np.arange(0.0, 2.0, 0.01) - - - plt.subplot(121) - plt.plot(t1, f(t1), 'o', t2, f(t2), '-') - plt.title('subplot 1') - plt.ylabel('Damped oscillation') - plt.suptitle('This is a somewhat long figure title', fontsize=16) - - - plt.subplot(122) - plt.plot(t3, np.cos(2*np.pi*t3), '--') - plt.xlabel('time (s)') - plt.title('subplot 2') - plt.ylabel('Undamped') - - plt.subplots_adjust(left=0.2, wspace=0.8, top=0.8) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/figure_title.txt b/_sources/examples/pylab_examples/figure_title.txt deleted file mode 100644 index 75c90e87fc0..00000000000 --- a/_sources/examples/pylab_examples/figure_title.txt +++ /dev/null @@ -1,43 +0,0 @@ -.. _pylab_examples-figure_title: - -pylab_examples example code: figure_title.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/figure_title.py - -:: - - from matplotlib.font_manager import FontProperties - import matplotlib.pyplot as plt - import numpy as np - - - def f(t): - s1 = np.cos(2*np.pi*t) - e1 = np.exp(-t) - return s1 * e1 - - t1 = np.arange(0.0, 5.0, 0.1) - t2 = np.arange(0.0, 5.0, 0.02) - t3 = np.arange(0.0, 2.0, 0.01) - - - plt.subplot(121) - plt.plot(t1, f(t1), 'bo', t2, f(t2), 'k') - plt.title('subplot 1') - plt.ylabel('Damped oscillation') - plt.suptitle('This is a somewhat long figure title', fontsize=16) - - - plt.subplot(122) - plt.plot(t3, np.cos(2*np.pi*t3), 'r--') - plt.xlabel('time (s)') - plt.title('subplot 2') - plt.ylabel('Undamped') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/fill_between_demo.rst.txt b/_sources/examples/pylab_examples/fill_between_demo.rst.txt deleted file mode 100644 index 3925067e5f2..00000000000 --- a/_sources/examples/pylab_examples/fill_between_demo.rst.txt +++ /dev/null @@ -1,71 +0,0 @@ -.. _pylab_examples-fill_between_demo: - -pylab_examples example code: fill_between_demo.py -================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/fill_between_demo.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - x = np.arange(0.0, 2, 0.01) - y1 = np.sin(2*np.pi*x) - y2 = 1.2*np.sin(4*np.pi*x) - - fig, (ax1, ax2, ax3) = plt.subplots(3, 1, sharex=True) - - ax1.fill_between(x, 0, y1) - ax1.set_ylabel('between y1 and 0') - - ax2.fill_between(x, y1, 1) - ax2.set_ylabel('between y1 and 1') - - ax3.fill_between(x, y1, y2) - ax3.set_ylabel('between y1 and y2') - ax3.set_xlabel('x') - - # now fill between y1 and y2 where a logical condition is met. Note - # this is different than calling - # fill_between(x[where], y1[where],y2[where] - # because of edge effects over multiple contiguous regions. - fig, (ax, ax1) = plt.subplots(2, 1, sharex=True) - ax.plot(x, y1, x, y2, color='black') - ax.fill_between(x, y1, y2, where=y2 >= y1, facecolor='green', interpolate=True) - ax.fill_between(x, y1, y2, where=y2 <= y1, facecolor='red', interpolate=True) - ax.set_title('fill between where') - - # Test support for masked arrays. - y2 = np.ma.masked_greater(y2, 1.0) - ax1.plot(x, y1, x, y2, color='black') - ax1.fill_between(x, y1, y2, where=y2 >= y1, facecolor='green', interpolate=True) - ax1.fill_between(x, y1, y2, where=y2 <= y1, facecolor='red', interpolate=True) - ax1.set_title('Now regions with y2>1 are masked') - - # This example illustrates a problem; because of the data - # gridding, there are undesired unfilled triangles at the crossover - # points. A brute-force solution would be to interpolate all - # arrays to a very fine grid before plotting. - - # show how to use transforms to create axes spans where a certain condition is satisfied - fig, ax = plt.subplots() - y = np.sin(4*np.pi*x) - ax.plot(x, y, color='black') - - # use the data coordinates for the x-axis and the axes coordinates for the y-axis - import matplotlib.transforms as mtransforms - trans = mtransforms.blended_transform_factory(ax.transData, ax.transAxes) - theta = 0.9 - ax.axhline(theta, color='green', lw=2, alpha=0.5) - ax.axhline(-theta, color='red', lw=2, alpha=0.5) - ax.fill_between(x, 0, 1, where=y > theta, facecolor='green', alpha=0.5, transform=trans) - ax.fill_between(x, 0, 1, where=y < -theta, facecolor='red', alpha=0.5, transform=trans) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/fill_between_demo.txt b/_sources/examples/pylab_examples/fill_between_demo.txt deleted file mode 100644 index 4546fd709ab..00000000000 --- a/_sources/examples/pylab_examples/fill_between_demo.txt +++ /dev/null @@ -1,72 +0,0 @@ -.. _pylab_examples-fill_between_demo: - -pylab_examples example code: fill_between_demo.py -================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/fill_between_demo.py - -:: - - #!/usr/bin/env python - import matplotlib.pyplot as plt - import numpy as np - - x = np.arange(0.0, 2, 0.01) - y1 = np.sin(2*np.pi*x) - y2 = 1.2*np.sin(4*np.pi*x) - - fig, (ax1, ax2, ax3) = plt.subplots(3, 1, sharex=True) - - ax1.fill_between(x, 0, y1) - ax1.set_ylabel('between y1 and 0') - - ax2.fill_between(x, y1, 1) - ax2.set_ylabel('between y1 and 1') - - ax3.fill_between(x, y1, y2) - ax3.set_ylabel('between y1 and y2') - ax3.set_xlabel('x') - - # now fill between y1 and y2 where a logical condition is met. Note - # this is different than calling - # fill_between(x[where], y1[where],y2[where] - # because of edge effects over multiple contiguous regions. - fig, (ax, ax1) = plt.subplots(2, 1, sharex=True) - ax.plot(x, y1, x, y2, color='black') - ax.fill_between(x, y1, y2, where=y2 >= y1, facecolor='green', interpolate=True) - ax.fill_between(x, y1, y2, where=y2 <= y1, facecolor='red', interpolate=True) - ax.set_title('fill between where') - - # Test support for masked arrays. - y2 = np.ma.masked_greater(y2, 1.0) - ax1.plot(x, y1, x, y2, color='black') - ax1.fill_between(x, y1, y2, where=y2 >= y1, facecolor='green', interpolate=True) - ax1.fill_between(x, y1, y2, where=y2 <= y1, facecolor='red', interpolate=True) - ax1.set_title('Now regions with y2>1 are masked') - - # This example illustrates a problem; because of the data - # gridding, there are undesired unfilled triangles at the crossover - # points. A brute-force solution would be to interpolate all - # arrays to a very fine grid before plotting. - - # show how to use transforms to create axes spans where a certain condition is satisfied - fig, ax = plt.subplots() - y = np.sin(4*np.pi*x) - ax.plot(x, y, color='black') - - # use the data coordinates for the x-axis and the axes coordinates for the y-axis - import matplotlib.transforms as mtransforms - trans = mtransforms.blended_transform_factory(ax.transData, ax.transAxes) - theta = 0.9 - ax.axhline(theta, color='green', lw=2, alpha=0.5) - ax.axhline(-theta, color='red', lw=2, alpha=0.5) - ax.fill_between(x, 0, 1, where=y > theta, facecolor='green', alpha=0.5, transform=trans) - ax.fill_between(x, 0, 1, where=y < -theta, facecolor='red', alpha=0.5, transform=trans) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/fill_betweenx_demo.rst.txt b/_sources/examples/pylab_examples/fill_betweenx_demo.rst.txt deleted file mode 100644 index 8cc05c44c68..00000000000 --- a/_sources/examples/pylab_examples/fill_betweenx_demo.rst.txt +++ /dev/null @@ -1,66 +0,0 @@ -.. _pylab_examples-fill_betweenx_demo: - -pylab_examples example code: fill_betweenx_demo.py -================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/fill_betweenx_demo.py - -:: - - """ - Copy of fill_between.py but using fill_betweenx() instead. - """ - import matplotlib.mlab as mlab - from matplotlib.pyplot import figure, show - import numpy as np - - - x = np.arange(0.0, 2, 0.01) - y1 = np.sin(2*np.pi*x) - y2 = 1.2*np.sin(4*np.pi*x) - - fig = figure() - ax1 = fig.add_subplot(311) - ax2 = fig.add_subplot(312, sharex=ax1) - ax3 = fig.add_subplot(313, sharex=ax1) - - ax1.fill_betweenx(x, 0, y1) - ax1.set_ylabel('(y1, 0)') - - ax2.fill_betweenx(x, y1, 1) - ax2.set_ylabel('(y1, 1)') - - ax3.fill_betweenx(x, y1, y2) - ax3.set_ylabel('(y1, y2)') - ax3.set_xlabel('x') - - # now fill between y1 and y2 where a logical condition is met. Note - # this is different than calling - # fill_between(x[where], y1[where],y2[where] - # because of edge effects over multiple contiguous regions. - fig = figure() - ax = fig.add_subplot(211) - ax.plot(y1, x, y2, x, color='black') - ax.fill_betweenx(x, y1, y2, where=y2 >= y1, facecolor='green') - ax.fill_betweenx(x, y1, y2, where=y2 <= y1, facecolor='red') - ax.set_title('fill between where') - - # Test support for masked arrays. - y2 = np.ma.masked_greater(y2, 1.0) - ax1 = fig.add_subplot(212, sharex=ax) - ax1.plot(y1, x, y2, x, color='black') - ax1.fill_betweenx(x, y1, y2, where=y2 >= y1, facecolor='green') - ax1.fill_betweenx(x, y1, y2, where=y2 <= y1, facecolor='red') - ax1.set_title('Now regions with y2 > 1 are masked') - - # This example illustrates a problem; because of the data - # gridding, there are undesired unfilled triangles at the crossover - # points. A brute-force solution would be to interpolate all - # arrays to a very fine grid before plotting. - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/fill_betweenx_demo.txt b/_sources/examples/pylab_examples/fill_betweenx_demo.txt deleted file mode 100644 index f2d5026fd5a..00000000000 --- a/_sources/examples/pylab_examples/fill_betweenx_demo.txt +++ /dev/null @@ -1,66 +0,0 @@ -.. _pylab_examples-fill_betweenx_demo: - -pylab_examples example code: fill_betweenx_demo.py -================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/fill_betweenx_demo.py - -:: - - """ - Copy of fill_between.py but using fill_betweenx() instead. - """ - import matplotlib.mlab as mlab - from matplotlib.pyplot import figure, show - import numpy as np - - - x = np.arange(0.0, 2, 0.01) - y1 = np.sin(2*np.pi*x) - y2 = 1.2*np.sin(4*np.pi*x) - - fig = figure() - ax1 = fig.add_subplot(311) - ax2 = fig.add_subplot(312, sharex=ax1) - ax3 = fig.add_subplot(313, sharex=ax1) - - ax1.fill_betweenx(x, 0, y1) - ax1.set_ylabel('between y1 and 0') - - ax2.fill_betweenx(x, y1, 1) - ax2.set_ylabel('between y1 and 1') - - ax3.fill_betweenx(x, y1, y2) - ax3.set_ylabel('between y1 and y2') - ax3.set_xlabel('x') - - # now fill between y1 and y2 where a logical condition is met. Note - # this is different than calling - # fill_between(x[where], y1[where],y2[where] - # because of edge effects over multiple contiguous regions. - fig = figure() - ax = fig.add_subplot(211) - ax.plot(y1, x, y2, x, color='black') - ax.fill_betweenx(x, y1, y2, where=y2 >= y1, facecolor='green') - ax.fill_betweenx(x, y1, y2, where=y2 <= y1, facecolor='red') - ax.set_title('fill between where') - - # Test support for masked arrays. - y2 = np.ma.masked_greater(y2, 1.0) - ax1 = fig.add_subplot(212, sharex=ax) - ax1.plot(y1, x, y2, x, color='black') - ax1.fill_betweenx(x, y1, y2, where=y2 >= y1, facecolor='green') - ax1.fill_betweenx(x, y1, y2, where=y2 <= y1, facecolor='red') - ax1.set_title('Now regions with y2 > 1 are masked') - - # This example illustrates a problem; because of the data - # gridding, there are undesired unfilled triangles at the crossover - # points. A brute-force solution would be to interpolate all - # arrays to a very fine grid before plotting. - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/fill_demo.txt b/_sources/examples/pylab_examples/fill_demo.txt deleted file mode 100644 index 15eb5b9af77..00000000000 --- a/_sources/examples/pylab_examples/fill_demo.txt +++ /dev/null @@ -1,24 +0,0 @@ -.. _pylab_examples-fill_demo: - -pylab_examples example code: fill_demo.py -========================================= - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/fill_demo.py - -:: - - #!/usr/bin/env python - import numpy as np - import matplotlib.pyplot as plt - - t = np.arange(0.0, 1.01, 0.01) - s = np.sin(2*2*np.pi*t) - - plt.fill(t, s*np.exp(-5*t), 'r') - plt.grid(True) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/fill_demo2.txt b/_sources/examples/pylab_examples/fill_demo2.txt deleted file mode 100644 index 3423fd8e94d..00000000000 --- a/_sources/examples/pylab_examples/fill_demo2.txt +++ /dev/null @@ -1,24 +0,0 @@ -.. _pylab_examples-fill_demo2: - -pylab_examples example code: fill_demo2.py -========================================== - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/fill_demo2.py - -:: - - from matplotlib.pyplot import figure, show - from numpy import arange, sin, pi - - fig = figure() - ax = fig.add_subplot(111) - t = arange(0.0,3.01,0.01) - s = sin(2*pi*t) - c = sin(4*pi*t) - ax.fill(t, s, 'b', t, c, 'g', alpha=0.2) - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/fill_spiral.rst.txt b/_sources/examples/pylab_examples/fill_spiral.rst.txt deleted file mode 100644 index 158364c88c9..00000000000 --- a/_sources/examples/pylab_examples/fill_spiral.rst.txt +++ /dev/null @@ -1,37 +0,0 @@ -.. _pylab_examples-fill_spiral: - -pylab_examples example code: fill_spiral.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/fill_spiral.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - theta = np.arange(0, 8*np.pi, 0.1) - a = 1 - b = .2 - - for dt in np.arange(0, 2*np.pi, np.pi/2.0): - - x = a*np.cos(theta + dt)*np.exp(b*theta) - y = a*np.sin(theta + dt)*np.exp(b*theta) - - dt = dt + np.pi/4.0 - - x2 = a*np.cos(theta + dt)*np.exp(b*theta) - y2 = a*np.sin(theta + dt)*np.exp(b*theta) - - xf = np.concatenate((x, x2[::-1])) - yf = np.concatenate((y, y2[::-1])) - - p1 = plt.fill(xf, yf) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/fill_spiral.txt b/_sources/examples/pylab_examples/fill_spiral.txt deleted file mode 100644 index a7c5b05fc4c..00000000000 --- a/_sources/examples/pylab_examples/fill_spiral.txt +++ /dev/null @@ -1,37 +0,0 @@ -.. _pylab_examples-fill_spiral: - -pylab_examples example code: fill_spiral.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/fill_spiral.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - theta = np.arange(0, 8*np.pi, 0.1) - a = 1 - b = .2 - - for dt in np.arange(0, 2*np.pi, np.pi/2.0): - - x = a*np.cos(theta + dt)*np.exp(b*theta) - y = a*np.sin(theta + dt)*np.exp(b*theta) - - dt = dt + np.pi/4.0 - - x2 = a*np.cos(theta + dt)*np.exp(b*theta) - y2 = a*np.sin(theta + dt)*np.exp(b*theta) - - xf = np.concatenate((x, x2[::-1])) - yf = np.concatenate((y, y2[::-1])) - - p1 = plt.fill(xf, yf) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/filledmarker_demo.txt b/_sources/examples/pylab_examples/filledmarker_demo.txt deleted file mode 100644 index 46544de090c..00000000000 --- a/_sources/examples/pylab_examples/filledmarker_demo.txt +++ /dev/null @@ -1,52 +0,0 @@ -.. _pylab_examples-filledmarker_demo: - -pylab_examples example code: filledmarker_demo.py -================================================= - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/filledmarker_demo.py - -:: - - import itertools - - import numpy as np - import matplotlib.lines as mlines - import matplotlib.pyplot as plt - - colors = itertools.cycle(['b', 'g', 'r', 'c', 'm', 'y', 'k']) - altcolor = 'lightgreen' - - plt.rcParams['text.usetex'] = False # otherwise, '^' will cause trouble - - y = np.arange(10) - for marker in mlines.Line2D.filled_markers: - f = plt.figure() - f.text(.5,.95, "marker = %r" % marker, ha='center') - for i,fs in enumerate(mlines.Line2D.fillStyles): - color = colors.next() - - ax = f.add_subplot(121) - ax.plot(2*(4-i)+y, c=color, - marker=marker, - markersize=20, - fillstyle=fs, - label=fs) - ax.legend(loc=2) - ax.set_title('fillstyle') - - ax = f.add_subplot(122) - ax.plot(2*(4-i)+y, c=color, - marker=marker, - markersize=20, - markerfacecoloralt=altcolor, - fillstyle=fs, - label=fs) - ax.legend(loc=2) - ax.set_title('fillstyle') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/finance_demo.txt b/_sources/examples/pylab_examples/finance_demo.txt deleted file mode 100644 index 3262dc179f2..00000000000 --- a/_sources/examples/pylab_examples/finance_demo.txt +++ /dev/null @@ -1,50 +0,0 @@ -.. _pylab_examples-finance_demo: - -pylab_examples example code: finance_demo.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/finance_demo.py - -:: - - #!/usr/bin/env python - import matplotlib.pyplot as plt - from matplotlib.dates import DateFormatter, WeekdayLocator,\ - DayLocator, MONDAY - from matplotlib.finance import quotes_historical_yahoo_ohlc, candlestick_ohlc - - - # (Year, month, day) tuples suffice as args for quotes_historical_yahoo - date1 = (2004, 2, 1) - date2 = (2004, 4, 12) - - - mondays = WeekdayLocator(MONDAY) # major ticks on the mondays - alldays = DayLocator() # minor ticks on the days - weekFormatter = DateFormatter('%b %d') # e.g., Jan 12 - dayFormatter = DateFormatter('%d') # e.g., 12 - - quotes = quotes_historical_yahoo_ohlc('INTC', date1, date2) - if len(quotes) == 0: - raise SystemExit - - fig, ax = plt.subplots() - fig.subplots_adjust(bottom=0.2) - ax.xaxis.set_major_locator(mondays) - ax.xaxis.set_minor_locator(alldays) - ax.xaxis.set_major_formatter(weekFormatter) - #ax.xaxis.set_minor_formatter(dayFormatter) - - #plot_day_summary(ax, quotes, ticksize=3) - candlestick_ohlc(ax, quotes, width=0.6) - - ax.xaxis_date() - ax.autoscale_view() - plt.setp(plt.gca().get_xticklabels(), rotation=45, horizontalalignment='right') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/finance_work2.txt b/_sources/examples/pylab_examples/finance_work2.txt deleted file mode 100644 index 0c6d8050f57..00000000000 --- a/_sources/examples/pylab_examples/finance_work2.txt +++ /dev/null @@ -1,221 +0,0 @@ -.. _pylab_examples-finance_work2: - -pylab_examples example code: finance_work2.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/finance_work2.py - -:: - - import datetime - import numpy as np - import matplotlib.colors as colors - import matplotlib.finance as finance - import matplotlib.dates as mdates - import matplotlib.ticker as mticker - import matplotlib.mlab as mlab - import matplotlib.pyplot as plt - import matplotlib.font_manager as font_manager - - - startdate = datetime.date(2006, 1, 1) - today = enddate = datetime.date.today() - ticker = 'SPY' - - - fh = finance.fetch_historical_yahoo(ticker, startdate, enddate) - # a numpy record array with fields: date, open, high, low, close, volume, adj_close) - - r = mlab.csv2rec(fh) - fh.close() - r.sort() - - - def moving_average(x, n, type='simple'): - """ - compute an n period moving average. - - type is 'simple' | 'exponential' - - """ - x = np.asarray(x) - if type == 'simple': - weights = np.ones(n) - else: - weights = np.exp(np.linspace(-1., 0., n)) - - weights /= weights.sum() - - a = np.convolve(x, weights, mode='full')[:len(x)] - a[:n] = a[n] - return a - - - def relative_strength(prices, n=14): - """ - compute the n period relative strength indicator - http://stockcharts.com/school/doku.php?id=chart_school:glossary_r#relativestrengthindex - http://www.investopedia.com/terms/r/rsi.asp - """ - - deltas = np.diff(prices) - seed = deltas[:n+1] - up = seed[seed >= 0].sum()/n - down = -seed[seed < 0].sum()/n - rs = up/down - rsi = np.zeros_like(prices) - rsi[:n] = 100. - 100./(1. + rs) - - for i in range(n, len(prices)): - delta = deltas[i - 1] # cause the diff is 1 shorter - - if delta > 0: - upval = delta - downval = 0. - else: - upval = 0. - downval = -delta - - up = (up*(n - 1) + upval)/n - down = (down*(n - 1) + downval)/n - - rs = up/down - rsi[i] = 100. - 100./(1. + rs) - - return rsi - - - def moving_average_convergence(x, nslow=26, nfast=12): - """ - compute the MACD (Moving Average Convergence/Divergence) using a fast and slow exponential moving avg' - return value is emaslow, emafast, macd which are len(x) arrays - """ - emaslow = moving_average(x, nslow, type='exponential') - emafast = moving_average(x, nfast, type='exponential') - return emaslow, emafast, emafast - emaslow - - - plt.rc('axes', grid=True) - plt.rc('grid', color='0.75', linestyle='-', linewidth=0.5) - - textsize = 9 - left, width = 0.1, 0.8 - rect1 = [left, 0.7, width, 0.2] - rect2 = [left, 0.3, width, 0.4] - rect3 = [left, 0.1, width, 0.2] - - - fig = plt.figure(facecolor='white') - axescolor = '#f6f6f6' # the axes background color - - ax1 = fig.add_axes(rect1, axisbg=axescolor) # left, bottom, width, height - ax2 = fig.add_axes(rect2, axisbg=axescolor, sharex=ax1) - ax2t = ax2.twinx() - ax3 = fig.add_axes(rect3, axisbg=axescolor, sharex=ax1) - - - # plot the relative strength indicator - prices = r.adj_close - rsi = relative_strength(prices) - fillcolor = 'darkgoldenrod' - - ax1.plot(r.date, rsi, color=fillcolor) - ax1.axhline(70, color=fillcolor) - ax1.axhline(30, color=fillcolor) - ax1.fill_between(r.date, rsi, 70, where=(rsi >= 70), facecolor=fillcolor, edgecolor=fillcolor) - ax1.fill_between(r.date, rsi, 30, where=(rsi <= 30), facecolor=fillcolor, edgecolor=fillcolor) - ax1.text(0.6, 0.9, '>70 = overbought', va='top', transform=ax1.transAxes, fontsize=textsize) - ax1.text(0.6, 0.1, '<30 = oversold', transform=ax1.transAxes, fontsize=textsize) - ax1.set_ylim(0, 100) - ax1.set_yticks([30, 70]) - ax1.text(0.025, 0.95, 'RSI (14)', va='top', transform=ax1.transAxes, fontsize=textsize) - ax1.set_title('%s daily' % ticker) - - # plot the price and volume data - dx = r.adj_close - r.close - low = r.low + dx - high = r.high + dx - - deltas = np.zeros_like(prices) - deltas[1:] = np.diff(prices) - up = deltas > 0 - ax2.vlines(r.date[up], low[up], high[up], color='black', label='_nolegend_') - ax2.vlines(r.date[~up], low[~up], high[~up], color='black', label='_nolegend_') - ma20 = moving_average(prices, 20, type='simple') - ma200 = moving_average(prices, 200, type='simple') - - linema20, = ax2.plot(r.date, ma20, color='blue', lw=2, label='MA (20)') - linema200, = ax2.plot(r.date, ma200, color='red', lw=2, label='MA (200)') - - - last = r[-1] - s = '%s O:%1.2f H:%1.2f L:%1.2f C:%1.2f, V:%1.1fM Chg:%+1.2f' % ( - today.strftime('%d-%b-%Y'), - last.open, last.high, - last.low, last.close, - last.volume*1e-6, - last.close - last.open) - t4 = ax2.text(0.3, 0.9, s, transform=ax2.transAxes, fontsize=textsize) - - props = font_manager.FontProperties(size=10) - leg = ax2.legend(loc='center left', shadow=True, fancybox=True, prop=props) - leg.get_frame().set_alpha(0.5) - - - volume = (r.close*r.volume)/1e6 # dollar volume in millions - vmax = volume.max() - poly = ax2t.fill_between(r.date, volume, 0, label='Volume', facecolor=fillcolor, edgecolor=fillcolor) - ax2t.set_ylim(0, 5*vmax) - ax2t.set_yticks([]) - - - # compute the MACD indicator - fillcolor = 'darkslategrey' - nslow = 26 - nfast = 12 - nema = 9 - emaslow, emafast, macd = moving_average_convergence(prices, nslow=nslow, nfast=nfast) - ema9 = moving_average(macd, nema, type='exponential') - ax3.plot(r.date, macd, color='black', lw=2) - ax3.plot(r.date, ema9, color='blue', lw=1) - ax3.fill_between(r.date, macd - ema9, 0, alpha=0.5, facecolor=fillcolor, edgecolor=fillcolor) - - - ax3.text(0.025, 0.95, 'MACD (%d, %d, %d)' % (nfast, nslow, nema), va='top', - transform=ax3.transAxes, fontsize=textsize) - - #ax3.set_yticks([]) - # turn off upper axis tick labels, rotate the lower ones, etc - for ax in ax1, ax2, ax2t, ax3: - if ax != ax3: - for label in ax.get_xticklabels(): - label.set_visible(False) - else: - for label in ax.get_xticklabels(): - label.set_rotation(30) - label.set_horizontalalignment('right') - - ax.fmt_xdata = mdates.DateFormatter('%Y-%m-%d') - - - class MyLocator(mticker.MaxNLocator): - def __init__(self, *args, **kwargs): - mticker.MaxNLocator.__init__(self, *args, **kwargs) - - def __call__(self, *args, **kwargs): - return mticker.MaxNLocator.__call__(self, *args, **kwargs) - - # at most 5 ticks, pruning the upper and lower so they don't overlap - # with other ticks - #ax2.yaxis.set_major_locator(mticker.MaxNLocator(5, prune='both')) - #ax3.yaxis.set_major_locator(mticker.MaxNLocator(5, prune='both')) - - ax2.yaxis.set_major_locator(MyLocator(5, prune='both')) - ax3.yaxis.set_major_locator(MyLocator(5, prune='both')) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/findobj_demo.rst.txt b/_sources/examples/pylab_examples/findobj_demo.rst.txt deleted file mode 100644 index bbc9ad1bf7b..00000000000 --- a/_sources/examples/pylab_examples/findobj_demo.rst.txt +++ /dev/null @@ -1,50 +0,0 @@ -.. _pylab_examples-findobj_demo: - -pylab_examples example code: findobj_demo.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/findobj_demo.py - -:: - - """ - Recursively find all objects that match some criteria - """ - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.text as text - - a = np.arange(0, 3, .02) - b = np.arange(0, 3, .02) - c = np.exp(a) - d = c[::-1] - - fig, ax = plt.subplots() - plt.plot(a, c, 'k--', a, d, 'k:', a, c + d, 'k') - plt.legend(('Model length', 'Data length', 'Total message length'), - loc='upper center', shadow=True) - plt.ylim([-1, 20]) - plt.grid(False) - plt.xlabel('Model complexity --->') - plt.ylabel('Message length --->') - plt.title('Minimum Message Length') - - - # match on arbitrary function - def myfunc(x): - return hasattr(x, 'set_color') and not hasattr(x, 'set_facecolor') - - for o in fig.findobj(myfunc): - o.set_color('blue') - - # match on class instances - for o in fig.findobj(text.Text): - o.set_fontstyle('italic') - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/findobj_demo.txt b/_sources/examples/pylab_examples/findobj_demo.txt deleted file mode 100644 index 82718a3d7b4..00000000000 --- a/_sources/examples/pylab_examples/findobj_demo.txt +++ /dev/null @@ -1,50 +0,0 @@ -.. _pylab_examples-findobj_demo: - -pylab_examples example code: findobj_demo.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/findobj_demo.py - -:: - - """ - Recursively find all objects that match some criteria - """ - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.text as text - - a = np.arange(0, 3, .02) - b = np.arange(0, 3, .02) - c = np.exp(a) - d = c[::-1] - - fig, ax = plt.subplots() - plt.plot(a, c, 'k--', a, d, 'k:', a, c + d, 'k') - plt.legend(('Model length', 'Data length', 'Total message length'), - loc='upper center', shadow=True) - plt.ylim([-1, 20]) - plt.grid(False) - plt.xlabel('Model complexity --->') - plt.ylabel('Message length --->') - plt.title('Minimum Message Length') - - - # match on arbitrary function - def myfunc(x): - return hasattr(x, 'set_color') and not hasattr(x, 'set_facecolor') - - for o in fig.findobj(myfunc): - o.set_color('blue') - - # match on class instances - for o in fig.findobj(text.Text): - o.set_fontstyle('italic') - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/font_table_ttf.rst.txt b/_sources/examples/pylab_examples/font_table_ttf.rst.txt deleted file mode 100644 index d1bfd6981e8..00000000000 --- a/_sources/examples/pylab_examples/font_table_ttf.rst.txt +++ /dev/null @@ -1,78 +0,0 @@ -.. _pylab_examples-font_table_ttf: - -pylab_examples example code: font_table_ttf.py -============================================== - -[`source code `_] - -:: - - # -*- noplot -*- - """ - matplotlib has support for FreeType fonts. Here's a little example - using the 'table' command to build a font table that shows the glyphs - by character code. - - Usage python font_table_ttf.py somefile.ttf - """ - - import sys - import os - - import matplotlib - from matplotlib.ft2font import FT2Font - from matplotlib.font_manager import FontProperties - import matplotlib.pyplot as plt - - import six - from six import unichr - - # the font table grid - - labelc = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - 'A', 'B', 'C', 'D', 'E', 'F'] - labelr = ['00', '10', '20', '30', '40', '50', '60', '70', '80', '90', - 'A0', 'B0', 'C0', 'D0', 'E0', 'F0'] - - if len(sys.argv) > 1: - fontname = sys.argv[1] - else: - fontname = os.path.join(matplotlib.get_data_path(), - 'fonts', 'ttf', 'DejaVuSans.ttf') - - font = FT2Font(fontname) - codes = list(font.get_charmap().items()) - codes.sort() - - # a 16,16 array of character strings - chars = [['' for c in range(16)] for r in range(16)] - colors = [[(0.95, 0.95, 0.95) for c in range(16)] for r in range(16)] - - plt.figure(figsize=(8, 4), dpi=120) - for ccode, glyphind in codes: - if ccode >= 256: - continue - r, c = divmod(ccode, 16) - s = unichr(ccode) - chars[r][c] = s - - lightgrn = (0.5, 0.8, 0.5) - plt.title(fontname) - tab = plt.table(cellText=chars, - rowLabels=labelr, - colLabels=labelc, - rowColours=[lightgrn]*16, - colColours=[lightgrn]*16, - cellColours=colors, - cellLoc='center', - loc='upper left') - - for key, cell in tab.get_celld().items(): - row, col = key - if row > 0 and col > 0: - cell.set_text_props(fontproperties=FontProperties(fname=fontname)) - plt.axis('off') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/font_table_ttf.txt b/_sources/examples/pylab_examples/font_table_ttf.txt deleted file mode 100644 index 77d279f3c75..00000000000 --- a/_sources/examples/pylab_examples/font_table_ttf.txt +++ /dev/null @@ -1,78 +0,0 @@ -.. _pylab_examples-font_table_ttf: - -pylab_examples example code: font_table_ttf.py -============================================== - -[`source code `_] - -:: - - # -*- noplot -*- - """ - matplotlib has support for freetype fonts. Here's a little example - using the 'table' command to build a font table that shows the glyphs - by character code. - - Usage python font_table_ttf.py somefile.ttf - """ - - import sys - import os - - import matplotlib - from matplotlib.ft2font import FT2Font - from matplotlib.font_manager import FontProperties - import matplotlib.pyplot as plt - - import six - from six import unichr - - # the font table grid - - labelc = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - 'A', 'B', 'C', 'D', 'E', 'F'] - labelr = ['00', '10', '20', '30', '40', '50', '60', '70', '80', '90', - 'A0', 'B0', 'C0', 'D0', 'E0', 'F0'] - - if len(sys.argv) > 1: - fontname = sys.argv[1] - else: - fontname = os.path.join(matplotlib.get_data_path(), - 'fonts', 'ttf', 'Vera.ttf') - - font = FT2Font(fontname) - codes = list(font.get_charmap().items()) - codes.sort() - - # a 16,16 array of character strings - chars = [['' for c in range(16)] for r in range(16)] - colors = [[(0.95, 0.95, 0.95) for c in range(16)] for r in range(16)] - - plt.figure(figsize=(8, 4), dpi=120) - for ccode, glyphind in codes: - if ccode >= 256: - continue - r, c = divmod(ccode, 16) - s = unichr(ccode) - chars[r][c] = s - - lightgrn = (0.5, 0.8, 0.5) - plt.title(fontname) - tab = plt.table(cellText=chars, - rowLabels=labelr, - colLabels=labelc, - rowColours=[lightgrn]*16, - colColours=[lightgrn]*16, - cellColours=colors, - cellLoc='center', - loc='upper left') - - for key, cell in tab.get_celld().items(): - row, col = key - if row > 0 and col > 0: - cell.set_text_props(fontproperties=FontProperties(fname=fontname)) - plt.axis('off') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/fonts_demo.rst.txt b/_sources/examples/pylab_examples/fonts_demo.rst.txt deleted file mode 100644 index a71c383c494..00000000000 --- a/_sources/examples/pylab_examples/fonts_demo.rst.txt +++ /dev/null @@ -1,126 +0,0 @@ -.. _pylab_examples-fonts_demo: - -pylab_examples example code: fonts_demo.py -========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/fonts_demo.py - -:: - - """ - Show how to set custom font properties. - - For interactive users, you can also use kwargs to the text command, - which requires less typing. See examples/fonts_demo_kw.py - """ - from matplotlib.font_manager import FontProperties - import matplotlib.pyplot as plt - - plt.subplot(111, facecolor='w') - - font0 = FontProperties() - alignment = {'horizontalalignment': 'center', 'verticalalignment': 'baseline'} - # Show family options - - families = ['serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'] - - font1 = font0.copy() - font1.set_size('large') - - t = plt.text(-0.8, 0.9, 'family', fontproperties=font1, - **alignment) - - yp = [0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2] - - for k, family in enumerate(families): - font = font0.copy() - font.set_family(family) - t = plt.text(-0.8, yp[k], family, fontproperties=font, - **alignment) - - # Show style options - - styles = ['normal', 'italic', 'oblique'] - - t = plt.text(-0.4, 0.9, 'style', fontproperties=font1, - **alignment) - - for k, style in enumerate(styles): - font = font0.copy() - font.set_family('sans-serif') - font.set_style(style) - t = plt.text(-0.4, yp[k], style, fontproperties=font, - **alignment) - - # Show variant options - - variants = ['normal', 'small-caps'] - - t = plt.text(0.0, 0.9, 'variant', fontproperties=font1, - **alignment) - - for k, variant in enumerate(variants): - font = font0.copy() - font.set_family('serif') - font.set_variant(variant) - t = plt.text(0.0, yp[k], variant, fontproperties=font, - **alignment) - - # Show weight options - - weights = ['light', 'normal', 'medium', 'semibold', 'bold', 'heavy', 'black'] - - t = plt.text(0.4, 0.9, 'weight', fontproperties=font1, - **alignment) - - for k, weight in enumerate(weights): - font = font0.copy() - font.set_weight(weight) - t = plt.text(0.4, yp[k], weight, fontproperties=font, - **alignment) - - # Show size options - - sizes = ['xx-small', 'x-small', 'small', 'medium', 'large', - 'x-large', 'xx-large'] - - t = plt.text(0.8, 0.9, 'size', fontproperties=font1, - **alignment) - - for k, size in enumerate(sizes): - font = font0.copy() - font.set_size(size) - t = plt.text(0.8, yp[k], size, fontproperties=font, - **alignment) - - # Show bold italic - - font = font0.copy() - font.set_style('italic') - font.set_weight('bold') - font.set_size('x-small') - t = plt.text(-0.4, 0.1, 'bold italic', fontproperties=font, - **alignment) - - font = font0.copy() - font.set_style('italic') - font.set_weight('bold') - font.set_size('medium') - t = plt.text(-0.4, 0.2, 'bold italic', fontproperties=font, - **alignment) - - font = font0.copy() - font.set_style('italic') - font.set_weight('bold') - font.set_size('x-large') - t = plt.text(-0.4, 0.3, 'bold italic', fontproperties=font, - **alignment) - - plt.axis([-1, 1, 0, 1]) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/fonts_demo.txt b/_sources/examples/pylab_examples/fonts_demo.txt deleted file mode 100644 index 50488d99dac..00000000000 --- a/_sources/examples/pylab_examples/fonts_demo.txt +++ /dev/null @@ -1,126 +0,0 @@ -.. _pylab_examples-fonts_demo: - -pylab_examples example code: fonts_demo.py -========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/fonts_demo.py - -:: - - """ - Show how to set custom font properties. - - For interactive users, you can also use kwargs to the text command, - which requires less typing. See examples/fonts_demo_kw.py - """ - from matplotlib.font_manager import FontProperties - import matplotlib.pyplot as plt - - plt.subplot(111, axisbg='w') - - font0 = FontProperties() - alignment = {'horizontalalignment': 'center', 'verticalalignment': 'baseline'} - # Show family options - - families = ['serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'] - - font1 = font0.copy() - font1.set_size('large') - - t = plt.text(-0.8, 0.9, 'family', fontproperties=font1, - **alignment) - - yp = [0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2] - - for k, family in enumerate(families): - font = font0.copy() - font.set_family(family) - t = plt.text(-0.8, yp[k], family, fontproperties=font, - **alignment) - - # Show style options - - styles = ['normal', 'italic', 'oblique'] - - t = plt.text(-0.4, 0.9, 'style', fontproperties=font1, - **alignment) - - for k, style in enumerate(styles): - font = font0.copy() - font.set_family('sans-serif') - font.set_style(style) - t = plt.text(-0.4, yp[k], style, fontproperties=font, - **alignment) - - # Show variant options - - variants = ['normal', 'small-caps'] - - t = plt.text(0.0, 0.9, 'variant', fontproperties=font1, - **alignment) - - for k, variant in enumerate(variants): - font = font0.copy() - font.set_family('serif') - font.set_variant(variant) - t = plt.text(0.0, yp[k], variant, fontproperties=font, - **alignment) - - # Show weight options - - weights = ['light', 'normal', 'medium', 'semibold', 'bold', 'heavy', 'black'] - - t = plt.text(0.4, 0.9, 'weight', fontproperties=font1, - **alignment) - - for k, weight in enumerate(weights): - font = font0.copy() - font.set_weight(weight) - t = plt.text(0.4, yp[k], weight, fontproperties=font, - **alignment) - - # Show size options - - sizes = ['xx-small', 'x-small', 'small', 'medium', 'large', - 'x-large', 'xx-large'] - - t = plt.text(0.8, 0.9, 'size', fontproperties=font1, - **alignment) - - for k, size in enumerate(sizes): - font = font0.copy() - font.set_size(size) - t = plt.text(0.8, yp[k], size, fontproperties=font, - **alignment) - - # Show bold italic - - font = font0.copy() - font.set_style('italic') - font.set_weight('bold') - font.set_size('x-small') - t = plt.text(-0.4, 0.1, 'bold italic', fontproperties=font, - **alignment) - - font = font0.copy() - font.set_style('italic') - font.set_weight('bold') - font.set_size('medium') - t = plt.text(-0.4, 0.2, 'bold italic', fontproperties=font, - **alignment) - - font = font0.copy() - font.set_style('italic') - font.set_weight('bold') - font.set_size('x-large') - t = plt.text(-0.4, 0.3, 'bold italic', fontproperties=font, - **alignment) - - plt.axis([-1, 1, 0, 1]) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/fonts_demo_kw.rst.txt b/_sources/examples/pylab_examples/fonts_demo_kw.rst.txt deleted file mode 100644 index 104d547a539..00000000000 --- a/_sources/examples/pylab_examples/fonts_demo_kw.rst.txt +++ /dev/null @@ -1,95 +0,0 @@ -.. _pylab_examples-fonts_demo_kw: - -pylab_examples example code: fonts_demo_kw.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/fonts_demo_kw.py - -:: - - """ - Same as fonts_demo using kwargs. If you prefer a more pythonic, OO - style of coding, see examples/fonts_demo.py. - - """ - from matplotlib.font_manager import FontProperties - import matplotlib.pyplot as plt - import numpy as np - - plt.subplot(111, facecolor='w') - alignment = {'horizontalalignment': 'center', 'verticalalignment': 'baseline'} - - # Show family options - - families = ['serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'] - - t = plt.text(-0.8, 0.9, 'family', size='large', **alignment) - - yp = [0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2] - - for k, family in enumerate(families): - t = plt.text(-0.8, yp[k], family, family=family, **alignment) - - # Show style options - - styles = ['normal', 'italic', 'oblique'] - - t = plt.text(-0.4, 0.9, 'style', **alignment) - - for k, style in enumerate(styles): - t = plt.text(-0.4, yp[k], style, family='sans-serif', style=style, - **alignment) - - # Show variant options - - variants = ['normal', 'small-caps'] - - t = plt.text(0.0, 0.9, 'variant', **alignment) - - for k, variant in enumerate(variants): - t = plt.text(0.0, yp[k], variant, family='serif', variant=variant, - **alignment) - - # Show weight options - - weights = ['light', 'normal', 'medium', 'semibold', 'bold', 'heavy', 'black'] - - t = plt.text(0.4, 0.9, 'weight', **alignment) - - for k, weight in enumerate(weights): - t = plt.text(0.4, yp[k], weight, weight=weight, - **alignment) - - # Show size options - - sizes = ['xx-small', 'x-small', 'small', 'medium', 'large', - 'x-large', 'xx-large'] - - t = plt.text(0.8, 0.9, 'size', **alignment) - - for k, size in enumerate(sizes): - t = plt.text(0.8, yp[k], size, size=size, - **alignment) - - x = -0.4 - # Show bold italic - t = plt.text(x, 0.1, 'bold italic', style='italic', - weight='bold', size='x-small', - **alignment) - - t = plt.text(x, 0.2, 'bold italic', - style='italic', weight='bold', size='medium', - **alignment) - - t = plt.text(x, 0.3, 'bold italic', - style='italic', weight='bold', size='x-large', - **alignment) - - plt.axis([-1, 1, 0, 1]) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/fonts_demo_kw.txt b/_sources/examples/pylab_examples/fonts_demo_kw.txt deleted file mode 100644 index dfc1d423751..00000000000 --- a/_sources/examples/pylab_examples/fonts_demo_kw.txt +++ /dev/null @@ -1,95 +0,0 @@ -.. _pylab_examples-fonts_demo_kw: - -pylab_examples example code: fonts_demo_kw.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/fonts_demo_kw.py - -:: - - """ - Same as fonts_demo using kwargs. If you prefer a more pythonic, OO - style of coding, see examples/fonts_demo.py. - - """ - from matplotlib.font_manager import FontProperties - import matplotlib.pyplot as plt - import numpy as np - - plt.subplot(111, axisbg='w') - alignment = {'horizontalalignment': 'center', 'verticalalignment': 'baseline'} - - # Show family options - - families = ['serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'] - - t = plt.text(-0.8, 0.9, 'family', size='large', **alignment) - - yp = [0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2] - - for k, family in enumerate(families): - t = plt.text(-0.8, yp[k], family, family=family, **alignment) - - # Show style options - - styles = ['normal', 'italic', 'oblique'] - - t = plt.text(-0.4, 0.9, 'style', **alignment) - - for k, style in enumerate(styles): - t = plt.text(-0.4, yp[k], style, family='sans-serif', style=style, - **alignment) - - # Show variant options - - variants = ['normal', 'small-caps'] - - t = plt.text(0.0, 0.9, 'variant', **alignment) - - for k, variant in enumerate(variants): - t = plt.text(0.0, yp[k], variant, family='serif', variant=variant, - **alignment) - - # Show weight options - - weights = ['light', 'normal', 'medium', 'semibold', 'bold', 'heavy', 'black'] - - t = plt.text(0.4, 0.9, 'weight', **alignment) - - for k, weight in enumerate(weights): - t = plt.text(0.4, yp[k], weight, weight=weight, - **alignment) - - # Show size options - - sizes = ['xx-small', 'x-small', 'small', 'medium', 'large', - 'x-large', 'xx-large'] - - t = plt.text(0.8, 0.9, 'size', **alignment) - - for k, size in enumerate(sizes): - t = plt.text(0.8, yp[k], size, size=size, - **alignment) - - x = -0.4 - # Show bold italic - t = plt.text(x, 0.1, 'bold italic', style='italic', - weight='bold', size='x-small', - **alignment) - - t = plt.text(x, 0.2, 'bold italic', - style='italic', weight='bold', size='medium', - **alignment) - - t = plt.text(x, 0.3, 'bold italic', - style='italic', weight='bold', size='x-large', - **alignment) - - plt.axis([-1, 1, 0, 1]) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/ganged_plots.rst.txt b/_sources/examples/pylab_examples/ganged_plots.rst.txt deleted file mode 100644 index e073ac5c475..00000000000 --- a/_sources/examples/pylab_examples/ganged_plots.rst.txt +++ /dev/null @@ -1,59 +0,0 @@ -.. _pylab_examples-ganged_plots: - -pylab_examples example code: ganged_plots.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/ganged_plots.py - -:: - - """ - To create plots that share a common axes (visually) you can set the - hspace between the subplots close to zero (do not use zero itself). - Normally you'll want to turn off the tick labels on all but one of the - axes. - - In this example the plots share a common xaxis but you can follow the - same logic to supply a common y axis. - """ - import matplotlib.pyplot as plt - import numpy as np - - t = np.arange(0.0, 2.0, 0.01) - - s1 = np.sin(2*np.pi*t) - s2 = np.exp(-t) - s3 = s1*s2 - - # axes rect in relative 0,1 coords left, bottom, width, height. Turn - # off xtick labels on all but the lower plot - - - f = plt.figure() - plt.subplots_adjust(hspace=0.001) - - - ax1 = plt.subplot(311) - ax1.plot(t, s1) - plt.yticks(np.arange(-0.9, 1.0, 0.4)) - plt.ylim(-1, 1) - - ax2 = plt.subplot(312, sharex=ax1) - ax2.plot(t, s2) - plt.yticks(np.arange(0.1, 1.0, 0.2)) - plt.ylim(0, 1) - - ax3 = plt.subplot(313, sharex=ax1) - ax3.plot(t, s3) - plt.yticks(np.arange(-0.9, 1.0, 0.4)) - plt.ylim(-1, 1) - - xticklabels = ax1.get_xticklabels() + ax2.get_xticklabels() - plt.setp(xticklabels, visible=False) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/ganged_plots.txt b/_sources/examples/pylab_examples/ganged_plots.txt deleted file mode 100644 index f8ed7735de3..00000000000 --- a/_sources/examples/pylab_examples/ganged_plots.txt +++ /dev/null @@ -1,59 +0,0 @@ -.. _pylab_examples-ganged_plots: - -pylab_examples example code: ganged_plots.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/ganged_plots.py - -:: - - """ - To create plots that share a common axes (visually) you can set the - hspace between the subplots close to zero (do not use zero itself). - Normally you'll want to turn off the tick labels on all but one of the - axes. - - In this example the plots share a common xaxis but you can follow the - same logic to supply a common y axis. - """ - import matplotlib.pyplot as plt - import numpy as np - - t = np.arange(0.0, 2.0, 0.01) - - s1 = np.sin(2*np.pi*t) - s2 = np.exp(-t) - s3 = s1*s2 - - # axes rect in relative 0,1 coords left, bottom, width, height. Turn - # off xtick labels on all but the lower plot - - - f = plt.figure() - plt.subplots_adjust(hspace=0.001) - - - ax1 = plt.subplot(311) - ax1.plot(t, s1) - plt.yticks(np.arange(-0.9, 1.0, 0.4)) - plt.ylim(-1, 1) - - ax2 = plt.subplot(312, sharex=ax1) - ax2.plot(t, s2) - plt.yticks(np.arange(0.1, 1.0, 0.2)) - plt.ylim(0, 1) - - ax3 = plt.subplot(313, sharex=ax1) - ax3.plot(t, s3) - plt.yticks(np.arange(-0.9, 1.0, 0.4)) - plt.ylim(-1, 1) - - xticklabels = ax1.get_xticklabels() + ax2.get_xticklabels() - plt.setp(xticklabels, visible=False) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/geo_demo.rst.txt b/_sources/examples/pylab_examples/geo_demo.rst.txt deleted file mode 100644 index 3b67f76211c..00000000000 --- a/_sources/examples/pylab_examples/geo_demo.rst.txt +++ /dev/null @@ -1,37 +0,0 @@ -.. _pylab_examples-geo_demo: - -pylab_examples example code: geo_demo.py -======================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/geo_demo.py - -:: - - import matplotlib.pyplot as plt - - plt.figure() - plt.subplot(111, projection="aitoff") - plt.title("Aitoff") - plt.grid(True) - - plt.figure() - plt.subplot(111, projection="hammer") - plt.title("Hammer") - plt.grid(True) - - plt.figure() - plt.subplot(111, projection="lambert") - plt.title("Lambert") - plt.grid(True) - - plt.figure() - plt.subplot(111, projection="mollweide") - plt.title("Mollweide") - plt.grid(True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/geo_demo.txt b/_sources/examples/pylab_examples/geo_demo.txt deleted file mode 100644 index 5165c157559..00000000000 --- a/_sources/examples/pylab_examples/geo_demo.txt +++ /dev/null @@ -1,33 +0,0 @@ -.. _pylab_examples-geo_demo: - -pylab_examples example code: geo_demo.py -======================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/geo_demo.py - -:: - - import matplotlib.pyplot as plt - - plt.subplot(221, projection="aitoff") - plt.title("Aitoff") - plt.grid(True) - - plt.subplot(222, projection="hammer") - plt.title("Hammer") - plt.grid(True) - - plt.subplot(223, projection="lambert") - plt.title("Lambert") - plt.grid(True) - - plt.subplot(224, projection="mollweide") - plt.title("Mollweide") - plt.grid(True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/ginput_demo.rst.txt b/_sources/examples/pylab_examples/ginput_demo.rst.txt deleted file mode 100644 index 47765a1e32b..00000000000 --- a/_sources/examples/pylab_examples/ginput_demo.rst.txt +++ /dev/null @@ -1,24 +0,0 @@ -.. _pylab_examples-ginput_demo: - -pylab_examples example code: ginput_demo.py -=========================================== - -[`source code `_] - -:: - - # -*- noplot -*- - - from __future__ import print_function - - import matplotlib.pyplot as plt - import numpy as np - t = np.arange(10) - plt.plot(t, np.sin(t)) - print("Please click") - x = plt.ginput(3) - print("clicked", x) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/ginput_demo.txt b/_sources/examples/pylab_examples/ginput_demo.txt deleted file mode 100644 index 47765a1e32b..00000000000 --- a/_sources/examples/pylab_examples/ginput_demo.txt +++ /dev/null @@ -1,24 +0,0 @@ -.. _pylab_examples-ginput_demo: - -pylab_examples example code: ginput_demo.py -=========================================== - -[`source code `_] - -:: - - # -*- noplot -*- - - from __future__ import print_function - - import matplotlib.pyplot as plt - import numpy as np - t = np.arange(10) - plt.plot(t, np.sin(t)) - print("Please click") - x = plt.ginput(3) - print("clicked", x) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/ginput_manual_clabel.rst.txt b/_sources/examples/pylab_examples/ginput_manual_clabel.rst.txt deleted file mode 100644 index 2ac16d86f25..00000000000 --- a/_sources/examples/pylab_examples/ginput_manual_clabel.rst.txt +++ /dev/null @@ -1,111 +0,0 @@ -.. _pylab_examples-ginput_manual_clabel: - -pylab_examples example code: ginput_manual_clabel.py -==================================================== - -[`source code `_] - -:: - - # -*- noplot -*- - - from __future__ import print_function - """ - This provides examples of uses of interactive functions, such as ginput, - waitforbuttonpress and manual clabel placement. - - This script must be run interactively using a backend that has a - graphical user interface (for example, using GTKAgg backend, but not - PS backend). - - See also ginput_demo.py - """ - import time - import matplotlib - import numpy as np - import matplotlib.cm as cm - import matplotlib.mlab as mlab - import matplotlib.pyplot as plt - - - def tellme(s): - print(s) - plt.title(s, fontsize=16) - plt.draw() - - ################################################## - # Define a triangle by clicking three points - ################################################## - plt.clf() - plt.axis([-1., 1., -1., 1.]) - plt.setp(plt.gca(), autoscale_on=False) - - tellme('You will define a triangle, click to begin') - - plt.waitforbuttonpress() - - happy = False - while not happy: - pts = [] - while len(pts) < 3: - tellme('Select 3 corners with mouse') - pts = np.asarray(plt.ginput(3, timeout=-1)) - if len(pts) < 3: - tellme('Too few points, starting over') - time.sleep(1) # Wait a second - - ph = plt.fill(pts[:, 0], pts[:, 1], 'r', lw=2) - - tellme('Happy? Key click for yes, mouse click for no') - - happy = plt.waitforbuttonpress() - - # Get rid of fill - if not happy: - for p in ph: - p.remove() - - ################################################## - # Now contour according to distance from triangle - # corners - just an example - ################################################## - - - # Define a nice function of distance from individual pts - def f(x, y, pts): - z = np.zeros_like(x) - for p in pts: - z = z + 1/(np.sqrt((x - p[0])**2 + (y - p[1])**2)) - return 1/z - - X, Y = np.meshgrid(np.linspace(-1, 1, 51), np.linspace(-1, 1, 51)) - Z = f(X, Y, pts) - - CS = plt.contour(X, Y, Z, 20) - - tellme('Use mouse to select contour label locations, middle button to finish') - CL = plt.clabel(CS, manual=True) - - ################################################## - # Now do a zoom - ################################################## - tellme('Now do a nested zoom, click to begin') - plt.waitforbuttonpress() - - happy = False - while not happy: - tellme('Select two corners of zoom, middle mouse button to finish') - pts = np.asarray(plt.ginput(2, timeout=-1)) - - happy = len(pts) < 2 - if happy: - break - - pts = np.sort(pts, axis=0) - plt.axis(pts.T.ravel()) - - tellme('All Done!') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/ginput_manual_clabel.txt b/_sources/examples/pylab_examples/ginput_manual_clabel.txt deleted file mode 100644 index d73dd91f792..00000000000 --- a/_sources/examples/pylab_examples/ginput_manual_clabel.txt +++ /dev/null @@ -1,112 +0,0 @@ -.. _pylab_examples-ginput_manual_clabel: - -pylab_examples example code: ginput_manual_clabel.py -==================================================== - -[`source code `_] - -:: - - #!/usr/bin/env python - # -*- noplot -*- - - from __future__ import print_function - """ - This provides examples of uses of interactive functions, such as ginput, - waitforbuttonpress and manual clabel placement. - - This script must be run interactively using a backend that has a - graphical user interface (for example, using GTKAgg backend, but not - PS backend). - - See also ginput_demo.py - """ - import time - import matplotlib - import numpy as np - import matplotlib.cm as cm - import matplotlib.mlab as mlab - import matplotlib.pyplot as plt - - - def tellme(s): - print(s) - plt.title(s, fontsize=16) - plt.draw() - - ################################################## - # Define a triangle by clicking three points - ################################################## - plt.clf() - plt.axis([-1., 1., -1., 1.]) - plt.setp(plt.gca(), autoscale_on=False) - - tellme('You will define a triangle, click to begin') - - plt.waitforbuttonpress() - - happy = False - while not happy: - pts = [] - while len(pts) < 3: - tellme('Select 3 corners with mouse') - pts = np.asarray(plt.ginput(3, timeout=-1)) - if len(pts) < 3: - tellme('Too few points, starting over') - time.sleep(1) # Wait a second - - ph = plt.fill(pts[:, 0], pts[:, 1], 'r', lw=2) - - tellme('Happy? Key click for yes, mouse click for no') - - happy = plt.waitforbuttonpress() - - # Get rid of fill - if not happy: - for p in ph: - p.remove() - - ################################################## - # Now contour according to distance from triangle - # corners - just an example - ################################################## - - - # Define a nice function of distance from individual pts - def f(x, y, pts): - z = np.zeros_like(x) - for p in pts: - z = z + 1/(np.sqrt((x - p[0])**2 + (y - p[1])**2)) - return 1/z - - X, Y = np.meshgrid(np.linspace(-1, 1, 51), np.linspace(-1, 1, 51)) - Z = f(X, Y, pts) - - CS = plt.contour(X, Y, Z, 20) - - tellme('Use mouse to select contour label locations, middle button to finish') - CL = plt.clabel(CS, manual=True) - - ################################################## - # Now do a zoom - ################################################## - tellme('Now do a nested zoom, click to begin') - plt.waitforbuttonpress() - - happy = False - while not happy: - tellme('Select two corners of zoom, middle mouse button to finish') - pts = np.asarray(plt.ginput(2, timeout=-1)) - - happy = len(pts) < 2 - if happy: - break - - pts = np.sort(pts, axis=0) - plt.axis(pts.T.ravel()) - - tellme('All Done!') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/gradient_bar.rst.txt b/_sources/examples/pylab_examples/gradient_bar.rst.txt deleted file mode 100644 index 31c81ac0ecb..00000000000 --- a/_sources/examples/pylab_examples/gradient_bar.rst.txt +++ /dev/null @@ -1,43 +0,0 @@ -.. _pylab_examples-gradient_bar: - -pylab_examples example code: gradient_bar.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/gradient_bar.py - -:: - - from matplotlib.pyplot import figure, show, cm - from numpy import arange - from numpy.random import rand - - - def gbar(ax, x, y, width=0.5, bottom=0): - X = [[.6, .6], [.7, .7]] - for left, top in zip(x, y): - right = left + width - ax.imshow(X, interpolation='bicubic', cmap=cm.Blues, - extent=(left, right, bottom, top), alpha=1) - - fig = figure() - - xmin, xmax = xlim = 0, 10 - ymin, ymax = ylim = 0, 1 - ax = fig.add_subplot(111, xlim=xlim, ylim=ylim, - autoscale_on=False) - X = [[.6, .6], [.7, .7]] - - ax.imshow(X, interpolation='bicubic', cmap=cm.copper, - extent=(xmin, xmax, ymin, ymax), alpha=1) - - N = 10 - x = arange(N) + 0.25 - y = rand(N) - gbar(ax, x, y, width=0.7) - ax.set_aspect('auto') - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/gradient_bar.txt b/_sources/examples/pylab_examples/gradient_bar.txt deleted file mode 100644 index 32b0a03c586..00000000000 --- a/_sources/examples/pylab_examples/gradient_bar.txt +++ /dev/null @@ -1,43 +0,0 @@ -.. _pylab_examples-gradient_bar: - -pylab_examples example code: gradient_bar.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/gradient_bar.py - -:: - - from matplotlib.pyplot import figure, show, cm - from numpy import arange - from numpy.random import rand - - - def gbar(ax, x, y, width=0.5, bottom=0): - X = [[.6, .6], [.7, .7]] - for left, top in zip(x, y): - right = left + width - ax.imshow(X, interpolation='bicubic', cmap=cm.Blues, - extent=(left, right, bottom, top), alpha=1) - - fig = figure() - - xmin, xmax = xlim = 0, 10 - ymin, ymax = ylim = 0, 1 - ax = fig.add_subplot(111, xlim=xlim, ylim=ylim, - autoscale_on=False) - X = [[.6, .6], [.7, .7]] - - ax.imshow(X, interpolation='bicubic', cmap=cm.copper, - extent=(xmin, xmax, ymin, ymax), alpha=1) - - N = 10 - x = arange(N) + 0.25 - y = rand(N) - gbar(ax, x, y, width=0.7) - ax.set_aspect('auto') - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/griddata_demo.rst.txt b/_sources/examples/pylab_examples/griddata_demo.rst.txt deleted file mode 100644 index e40469cbe4c..00000000000 --- a/_sources/examples/pylab_examples/griddata_demo.rst.txt +++ /dev/null @@ -1,41 +0,0 @@ -.. _pylab_examples-griddata_demo: - -pylab_examples example code: griddata_demo.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/griddata_demo.py - -:: - - from numpy.random import uniform, seed - from matplotlib.mlab import griddata - import matplotlib.pyplot as plt - import numpy as np - # make up data. - #npts = int(raw_input('enter # of random points to plot:')) - seed(0) - npts = 200 - x = uniform(-2, 2, npts) - y = uniform(-2, 2, npts) - z = x*np.exp(-x**2 - y**2) - # define grid. - xi = np.linspace(-2.1, 2.1, 100) - yi = np.linspace(-2.1, 2.1, 200) - # grid the data. - zi = griddata(x, y, z, xi, yi, interp='linear') - # contour the gridded data, plotting dots at the nonuniform data points. - CS = plt.contour(xi, yi, zi, 15, linewidths=0.5, colors='k') - CS = plt.contourf(xi, yi, zi, 15, - vmax=abs(zi).max(), vmin=-abs(zi).max()) - plt.colorbar() # draw colorbar - # plot data points. - plt.scatter(x, y, marker='o', s=5, zorder=10) - plt.xlim(-2, 2) - plt.ylim(-2, 2) - plt.title('griddata test (%d points)' % npts) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/griddata_demo.txt b/_sources/examples/pylab_examples/griddata_demo.txt deleted file mode 100644 index a7b72829882..00000000000 --- a/_sources/examples/pylab_examples/griddata_demo.txt +++ /dev/null @@ -1,41 +0,0 @@ -.. _pylab_examples-griddata_demo: - -pylab_examples example code: griddata_demo.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/griddata_demo.py - -:: - - from numpy.random import uniform, seed - from matplotlib.mlab import griddata - import matplotlib.pyplot as plt - import numpy as np - # make up data. - #npts = int(raw_input('enter # of random points to plot:')) - seed(0) - npts = 200 - x = uniform(-2, 2, npts) - y = uniform(-2, 2, npts) - z = x*np.exp(-x**2 - y**2) - # define grid. - xi = np.linspace(-2.1, 2.1, 100) - yi = np.linspace(-2.1, 2.1, 200) - # grid the data. - zi = griddata(x, y, z, xi, yi, interp='linear') - # contour the gridded data, plotting dots at the nonuniform data points. - CS = plt.contour(xi, yi, zi, 15, linewidths=0.5, colors='k') - CS = plt.contourf(xi, yi, zi, 15, cmap=plt.cm.rainbow, - vmax=abs(zi).max(), vmin=-abs(zi).max()) - plt.colorbar() # draw colorbar - # plot data points. - plt.scatter(x, y, marker='o', c='b', s=5, zorder=10) - plt.xlim(-2, 2) - plt.ylim(-2, 2) - plt.title('griddata test (%d points)' % npts) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/hatch_demo.rst.txt b/_sources/examples/pylab_examples/hatch_demo.rst.txt deleted file mode 100644 index 0dd785978dd..00000000000 --- a/_sources/examples/pylab_examples/hatch_demo.rst.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _pylab_examples-hatch_demo: - -pylab_examples example code: hatch_demo.py -========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/hatch_demo.py - -:: - - """ - Hatching (pattern filled polygons) is supported currently in the PS, - PDF, SVG and Agg backends only. - """ - import matplotlib.pyplot as plt - from matplotlib.patches import Ellipse, Polygon - - fig = plt.figure() - ax1 = fig.add_subplot(131) - ax1.bar(range(1, 5), range(1, 5), color='red', edgecolor='black', hatch="/") - ax1.bar(range(1, 5), [6] * 4, bottom=range(1, 5), color='blue', edgecolor='black', hatch='//') - ax1.set_xticks([1.5, 2.5, 3.5, 4.5]) - - ax2 = fig.add_subplot(132) - bars = ax2.bar(range(1, 5), range(1, 5), color='yellow', ecolor='black') + \ - ax2.bar(range(1, 5), [6] * 4, bottom=range(1, 5), color='green', ecolor='black') - ax2.set_xticks([1.5, 2.5, 3.5, 4.5]) - - patterns = ('-', '+', 'x', '\\', '*', 'o', 'O', '.') - for bar, pattern in zip(bars, patterns): - bar.set_hatch(pattern) - - ax3 = fig.add_subplot(133) - ax3.fill([1, 3, 3, 1], [1, 1, 2, 2], fill=False, hatch='\\') - ax3.add_patch(Ellipse((4, 1.5), 4, 0.5, fill=False, hatch='*')) - ax3.add_patch(Polygon([[0, 0], [4, 1.1], [6, 2.5], [2, 1.4]], closed=True, - fill=False, hatch='/')) - ax3.set_xlim((0, 6)) - ax3.set_ylim((0, 2.5)) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/hatch_demo.txt b/_sources/examples/pylab_examples/hatch_demo.txt deleted file mode 100644 index 129630153f4..00000000000 --- a/_sources/examples/pylab_examples/hatch_demo.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _pylab_examples-hatch_demo: - -pylab_examples example code: hatch_demo.py -========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/hatch_demo.py - -:: - - """ - Hatching (pattern filled polygons) is supported currently in the PS, - PDF, SVG and Agg backends only. - """ - import matplotlib.pyplot as plt - from matplotlib.patches import Ellipse, Polygon - - fig = plt.figure() - ax1 = fig.add_subplot(131) - ax1.bar(range(1, 5), range(1, 5), color='red', edgecolor='black', hatch="/") - ax1.bar(range(1, 5), [6] * 4, bottom=range(1, 5), color='blue', edgecolor='black', hatch='//') - ax1.set_xticks([1.5, 2.5, 3.5, 4.5]) - - ax2 = fig.add_subplot(132) - bars = ax2.bar(range(1, 5), range(1, 5), color='yellow', ecolor='black') + \ - ax2.bar(range(1, 5), [6] * 4, bottom=range(1, 5), color='green', ecolor='black') - ax2.set_xticks([1.5, 2.5, 3.5, 4.5]) - - patterns = ('-', '+', 'x', '\\', '*', 'o', 'O', '.') - for bar, pattern in zip(bars, patterns): - bar.set_hatch(pattern) - - ax3 = fig.add_subplot(133) - ax3.fill([1, 3, 3, 1], [1, 1, 2, 2], fill=False, hatch='\\') - ax3.add_patch(Ellipse((4, 1.5), 4, 0.5, fill=False, hatch='*')) - ax3.add_patch(Polygon([[0, 0], [4, 1.1], [6, 2.5], [2, 1.4]], closed=True, - fill=False, hatch='/')) - ax3.set_xlim((0, 6)) - ax3.set_ylim((0, 2.5)) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/hexbin_demo.rst.txt b/_sources/examples/pylab_examples/hexbin_demo.rst.txt deleted file mode 100644 index 2c8ecadb03c..00000000000 --- a/_sources/examples/pylab_examples/hexbin_demo.rst.txt +++ /dev/null @@ -1,50 +0,0 @@ -.. _pylab_examples-hexbin_demo: - -pylab_examples example code: hexbin_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/hexbin_demo.py - -:: - - """ - hexbin is an axes method or pyplot function that is essentially - a pcolor of a 2-D histogram with hexagonal cells. It can be - much more informative than a scatter plot; in the first subplot - below, try substituting 'scatter' for 'hexbin'. - """ - - import numpy as np - import matplotlib.pyplot as plt - - np.random.seed(0) - n = 100000 - x = np.random.standard_normal(n) - y = 2.0 + 3.0 * x + 4.0 * np.random.standard_normal(n) - xmin = x.min() - xmax = x.max() - ymin = y.min() - ymax = y.max() - - fig, axs = plt.subplots(ncols=2, sharey=True, figsize=(7, 4)) - fig.subplots_adjust(hspace=0.5, left=0.07, right=0.93) - ax = axs[0] - hb = ax.hexbin(x, y, gridsize=50, cmap='inferno') - ax.axis([xmin, xmax, ymin, ymax]) - ax.set_title("Hexagon binning") - cb = fig.colorbar(hb, ax=ax) - cb.set_label('counts') - - ax = axs[1] - hb = ax.hexbin(x, y, gridsize=50, bins='log', cmap='inferno') - ax.axis([xmin, xmax, ymin, ymax]) - ax.set_title("With a log color scale") - cb = fig.colorbar(hb, ax=ax) - cb.set_label('log10(N)') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/hexbin_demo.txt b/_sources/examples/pylab_examples/hexbin_demo.txt deleted file mode 100644 index b926303fec4..00000000000 --- a/_sources/examples/pylab_examples/hexbin_demo.txt +++ /dev/null @@ -1,49 +0,0 @@ -.. _pylab_examples-hexbin_demo: - -pylab_examples example code: hexbin_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/hexbin_demo.py - -:: - - """ - hexbin is an axes method or pyplot function that is essentially - a pcolor of a 2-D histogram with hexagonal cells. It can be - much more informative than a scatter plot; in the first subplot - below, try substituting 'scatter' for 'hexbin'. - """ - - import numpy as np - import matplotlib.pyplot as plt - - np.random.seed(0) - n = 100000 - x = np.random.standard_normal(n) - y = 2.0 + 3.0 * x + 4.0 * np.random.standard_normal(n) - xmin = x.min() - xmax = x.max() - ymin = y.min() - ymax = y.max() - - plt.subplots_adjust(hspace=0.5) - plt.subplot(121) - plt.hexbin(x, y, cmap=plt.cm.YlOrRd_r) - plt.axis([xmin, xmax, ymin, ymax]) - plt.title("Hexagon binning") - cb = plt.colorbar() - cb.set_label('counts') - - plt.subplot(122) - plt.hexbin(x, y, bins='log', cmap=plt.cm.YlOrRd_r) - plt.axis([xmin, xmax, ymin, ymax]) - plt.title("With a log color scale") - cb = plt.colorbar() - cb.set_label('log10(N)') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/hexbin_demo2.rst.txt b/_sources/examples/pylab_examples/hexbin_demo2.rst.txt deleted file mode 100644 index b7fbf4865fb..00000000000 --- a/_sources/examples/pylab_examples/hexbin_demo2.rst.txt +++ /dev/null @@ -1,69 +0,0 @@ -.. _pylab_examples-hexbin_demo2: - -pylab_examples example code: hexbin_demo2.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/hexbin_demo2.py - -:: - - """ - hexbin is an axes method or pyplot function that is essentially a - pcolor of a 2-D histogram with hexagonal cells. - """ - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.mlab as mlab - - delta = 0.025 - x = y = np.arange(-3.0, 3.0, delta) - X, Y = np.meshgrid(x, y) - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - Z = Z2 - Z1 # difference of Gaussians - - x = X.ravel() - y = Y.ravel() - z = Z.ravel() - - if 1: - # make some points 20 times more common than others, but same mean - xcond = (-1 < x) & (x < 1) - ycond = (-2 < y) & (y < 0) - cond = xcond & ycond - xnew = x[cond] - ynew = y[cond] - znew = z[cond] - for i in range(20): - x = np.hstack((x, xnew)) - y = np.hstack((y, ynew)) - z = np.hstack((z, znew)) - - xmin = x.min() - xmax = x.max() - ymin = y.min() - ymax = y.max() - - gridsize = 30 - - plt.subplot(211) - plt.hexbin(x, y, C=z, gridsize=gridsize, marginals=True, cmap=plt.cm.RdBu, - vmax=abs(z).max(), vmin=-abs(z).max()) - plt.axis([xmin, xmax, ymin, ymax]) - cb = plt.colorbar() - cb.set_label('mean value') - - - plt.subplot(212) - plt.hexbin(x, y, gridsize=gridsize, cmap=plt.cm.Blues_r) - plt.axis([xmin, xmax, ymin, ymax]) - cb = plt.colorbar() - cb.set_label('N observations') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/hexbin_demo2.txt b/_sources/examples/pylab_examples/hexbin_demo2.txt deleted file mode 100644 index 6a942d5470c..00000000000 --- a/_sources/examples/pylab_examples/hexbin_demo2.txt +++ /dev/null @@ -1,69 +0,0 @@ -.. _pylab_examples-hexbin_demo2: - -pylab_examples example code: hexbin_demo2.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/hexbin_demo2.py - -:: - - """ - hexbin is an axes method or pyplot function that is essentially a - pcolor of a 2-D histogram with hexagonal cells. - """ - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.mlab as mlab - - delta = 0.025 - x = y = np.arange(-3.0, 3.0, delta) - X, Y = np.meshgrid(x, y) - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - Z = Z2 - Z1 # difference of Gaussians - - x = X.ravel() - y = Y.ravel() - z = Z.ravel() - - if 1: - # make some points 20 times more common than others, but same mean - xcond = (-1 < x) & (x < 1) - ycond = (-2 < y) & (y < 0) - cond = xcond & ycond - xnew = x[cond] - ynew = y[cond] - znew = z[cond] - for i in range(20): - x = np.hstack((x, xnew)) - y = np.hstack((y, ynew)) - z = np.hstack((z, znew)) - - xmin = x.min() - xmax = x.max() - ymin = y.min() - ymax = y.max() - - gridsize = 30 - - plt.subplot(211) - plt.hexbin(x, y, C=z, gridsize=gridsize, marginals=True, cmap=plt.cm.RdBu, - vmax=abs(z).max(), vmin=-abs(z).max()) - plt.axis([xmin, xmax, ymin, ymax]) - cb = plt.colorbar() - cb.set_label('mean value') - - - plt.subplot(212) - plt.hexbin(x, y, gridsize=gridsize, cmap=plt.cm.Blues_r) - plt.axis([xmin, xmax, ymin, ymax]) - cb = plt.colorbar() - cb.set_label('N observations') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/hist2d_demo.rst.txt b/_sources/examples/pylab_examples/hist2d_demo.rst.txt deleted file mode 100644 index 08f714ad10e..00000000000 --- a/_sources/examples/pylab_examples/hist2d_demo.rst.txt +++ /dev/null @@ -1,22 +0,0 @@ -.. _pylab_examples-hist2d_demo: - -pylab_examples example code: hist2d_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/hist2d_demo.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - x = np.random.randn(1000) - y = np.random.randn(1000) + 5 - - # normal distribution center at x=0 and y=5 - plt.hist2d(x, y, bins=40) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/hist2d_demo.txt b/_sources/examples/pylab_examples/hist2d_demo.txt deleted file mode 100644 index e9af68c82d4..00000000000 --- a/_sources/examples/pylab_examples/hist2d_demo.txt +++ /dev/null @@ -1,22 +0,0 @@ -.. _pylab_examples-hist2d_demo: - -pylab_examples example code: hist2d_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/hist2d_demo.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - x = np.random.randn(1000) - y = np.random.randn(1000) + 5 - - # normal distribution center at x=0 and y=5 - plt.hist2d(x, y, bins=40) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/hist2d_log_demo.rst.txt b/_sources/examples/pylab_examples/hist2d_log_demo.rst.txt deleted file mode 100644 index a61417f9bb2..00000000000 --- a/_sources/examples/pylab_examples/hist2d_log_demo.rst.txt +++ /dev/null @@ -1,25 +0,0 @@ -.. _pylab_examples-hist2d_log_demo: - -pylab_examples example code: hist2d_log_demo.py -=============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/hist2d_log_demo.py - -:: - - from matplotlib.colors import LogNorm - import matplotlib.pyplot as plt - import numpy as np - - # normal distribution center at x=0 and y=5 - x = np.random.randn(100000) - y = np.random.randn(100000) + 5 - - plt.hist2d(x, y, bins=40, norm=LogNorm()) - plt.colorbar() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/hist2d_log_demo.txt b/_sources/examples/pylab_examples/hist2d_log_demo.txt deleted file mode 100644 index 2b069084108..00000000000 --- a/_sources/examples/pylab_examples/hist2d_log_demo.txt +++ /dev/null @@ -1,25 +0,0 @@ -.. _pylab_examples-hist2d_log_demo: - -pylab_examples example code: hist2d_log_demo.py -=============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/hist2d_log_demo.py - -:: - - from matplotlib.colors import LogNorm - import matplotlib.pyplot as plt - import numpy as np - - # normal distribution center at x=0 and y=5 - x = np.random.randn(100000) - y = np.random.randn(100000) + 5 - - plt.hist2d(x, y, bins=40, norm=LogNorm()) - plt.colorbar() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/hist_colormapped.rst.txt b/_sources/examples/pylab_examples/hist_colormapped.rst.txt deleted file mode 100644 index c94e21c507f..00000000000 --- a/_sources/examples/pylab_examples/hist_colormapped.rst.txt +++ /dev/null @@ -1,37 +0,0 @@ -.. _pylab_examples-hist_colormapped: - -pylab_examples example code: hist_colormapped.py -================================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/hist_colormapped.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.cm as cm - import matplotlib.colors as colors - - fig, ax = plt.subplots() - Ntotal = 1000 - N, bins, patches = ax.hist(np.random.rand(Ntotal), 20) - - # I'll color code by height, but you could use any scalar - - - # we need to normalize the data to 0..1 for the full - # range of the colormap - fracs = N.astype(float)/N.max() - norm = colors.Normalize(fracs.min(), fracs.max()) - - for thisfrac, thispatch in zip(fracs, patches): - color = cm.viridis(norm(thisfrac)) - thispatch.set_facecolor(color) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/hist_colormapped.txt b/_sources/examples/pylab_examples/hist_colormapped.txt deleted file mode 100644 index 1ca158288a7..00000000000 --- a/_sources/examples/pylab_examples/hist_colormapped.txt +++ /dev/null @@ -1,37 +0,0 @@ -.. _pylab_examples-hist_colormapped: - -pylab_examples example code: hist_colormapped.py -================================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/hist_colormapped.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.cm as cm - import matplotlib.colors as colors - - fig, ax = plt.subplots() - Ntotal = 1000 - N, bins, patches = ax.hist(np.random.rand(Ntotal), 20) - - # I'll color code by height, but you could use any scalar - - - # we need to normalize the data to 0..1 for the full - # range of the colormap - fracs = N.astype(float)/N.max() - norm = colors.Normalize(fracs.min(), fracs.max()) - - for thisfrac, thispatch in zip(fracs, patches): - color = cm.jet(norm(thisfrac)) - thispatch.set_facecolor(color) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/histogram_demo.txt b/_sources/examples/pylab_examples/histogram_demo.txt deleted file mode 100644 index 6d5948ed8a0..00000000000 --- a/_sources/examples/pylab_examples/histogram_demo.txt +++ /dev/null @@ -1,36 +0,0 @@ -.. _pylab_examples-histogram_demo: - -pylab_examples example code: histogram_demo.py -============================================== - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/histogram_demo.py - -:: - - #!/usr/bin/env python - import numpy as np - import matplotlib.mlab as mlab - import matplotlib.pyplot as plt - - mu, sigma = 100, 15 - x = mu + sigma*np.random.randn(10000) - - # the histogram of the data - n, bins, patches = plt.hist(x, 50, normed=1, facecolor='green', alpha=0.75) - - # add a 'best fit' line - y = mlab.normpdf( bins, mu, sigma) - l = plt.plot(bins, y, 'r--', linewidth=1) - - plt.xlabel('Smarts') - plt.ylabel('Probability') - plt.title(r'$\mathrm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$') - plt.axis([40, 160, 0, 0.03]) - plt.grid(True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/histogram_demo_extended.txt b/_sources/examples/pylab_examples/histogram_demo_extended.txt deleted file mode 100644 index f1fb7587554..00000000000 --- a/_sources/examples/pylab_examples/histogram_demo_extended.txt +++ /dev/null @@ -1,136 +0,0 @@ -.. _pylab_examples-histogram_demo_extended: - -pylab_examples example code: histogram_demo_extended.py -======================================================= - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/histogram_demo_extended.py - -:: - - #!/usr/bin/env python - import numpy as np - import pylab as P - - # - # The hist() function now has a lot more options - # - - # - # first create a single histogram - # - mu, sigma = 200, 25 - x = mu + sigma*P.randn(10000) - - # the histogram of the data with histtype='step' - n, bins, patches = P.hist(x, 50, normed=1, histtype='stepfilled') - P.setp(patches, 'facecolor', 'g', 'alpha', 0.75) - - # add a line showing the expected distribution - y = P.normpdf( bins, mu, sigma) - l = P.plot(bins, y, 'k--', linewidth=1.5) - - - # - # create a histogram by providing the bin edges (unequally spaced) - # - P.figure() - - bins = [100,125,150,160,170,180,190,200,210,220,230,240,250,275,300] - # the histogram of the data with histtype='step' - n, bins, patches = P.hist(x, bins, normed=1, histtype='bar', rwidth=0.8) - - # - # now we create a cumulative histogram of the data - # - P.figure() - - n, bins, patches = P.hist(x, 50, normed=1, histtype='step', cumulative=True) - - # add a line showing the expected distribution - y = P.normpdf( bins, mu, sigma).cumsum() - y /= y[-1] - l = P.plot(bins, y, 'k--', linewidth=1.5) - - # create a second data-set with a smaller standard deviation - sigma2 = 15. - x = mu + sigma2*P.randn(10000) - - n, bins, patches = P.hist(x, bins=bins, normed=1, histtype='step', cumulative=True) - - # add a line showing the expected distribution - y = P.normpdf( bins, mu, sigma2).cumsum() - y /= y[-1] - l = P.plot(bins, y, 'r--', linewidth=1.5) - - # finally overplot a reverted cumulative histogram - n, bins, patches = P.hist(x, bins=bins, normed=1, - histtype='step', cumulative=-1) - - - P.grid(True) - P.ylim(0, 1.05) - - - # - # histogram has the ability to plot multiple data in parallel ... - # Note the new color kwarg, used to override the default, which - # uses the line color cycle. - # - P.figure() - - # create a new data-set - x = mu + sigma*P.randn(1000,3) - - n, bins, patches = P.hist(x, 10, normed=1, histtype='bar', - color=['crimson', 'burlywood', 'chartreuse'], - label=['Crimson', 'Burlywood', 'Chartreuse']) - P.legend() - - # - # ... or we can stack the data - # - P.figure() - - n, bins, patches = P.hist(x, 10, normed=1, histtype='bar', stacked=True) - - P.show() - - # - # we can also stack using the step histtype - # - - P.figure() - - n, bins, patches = P.hist(x, 10, histtype='step', stacked=True, fill=True) - - P.show() - - # - # finally: make a multiple-histogram of data-sets with different length - # - x0 = mu + sigma*P.randn(10000) - x1 = mu + sigma*P.randn(7000) - x2 = mu + sigma*P.randn(3000) - - # and exercise the weights option by arbitrarily giving the first half - # of each series only half the weight of the others: - - w0 = np.ones_like(x0) - w0[:len(x0)/2] = 0.5 - w1 = np.ones_like(x1) - w1[:len(x1)/2] = 0.5 - w2 = np.ones_like(x2) - w2[:len(x2)/2] = 0.5 - - - - P.figure() - - n, bins, patches = P.hist( [x0,x1,x2], 10, weights=[w0, w1, w2], histtype='bar') - - P.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/histogram_percent_demo.rst.txt b/_sources/examples/pylab_examples/histogram_percent_demo.rst.txt deleted file mode 100644 index 0b4bc1a5320..00000000000 --- a/_sources/examples/pylab_examples/histogram_percent_demo.rst.txt +++ /dev/null @@ -1,44 +0,0 @@ -.. _pylab_examples-histogram_percent_demo: - -pylab_examples example code: histogram_percent_demo.py -====================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/histogram_percent_demo.py - -:: - - import matplotlib - from numpy.random import randn - import matplotlib.pyplot as plt - from matplotlib.ticker import FuncFormatter - - - def to_percent(y, position): - # Ignore the passed in position. This has the effect of scaling the default - # tick locations. - s = str(100 * y) - - # The percent symbol needs escaping in latex - if matplotlib.rcParams['text.usetex'] is True: - return s + r'$\%$' - else: - return s + '%' - - x = randn(5000) - - # Make a normed histogram. It'll be multiplied by 100 later. - plt.hist(x, bins=50, normed=True) - - # Create the formatter using the function to_percent. This multiplies all the - # default labels by 100, making them all percentages - formatter = FuncFormatter(to_percent) - - # Set the formatter - plt.gca().yaxis.set_major_formatter(formatter) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/histogram_percent_demo.txt b/_sources/examples/pylab_examples/histogram_percent_demo.txt deleted file mode 100644 index bc399999fde..00000000000 --- a/_sources/examples/pylab_examples/histogram_percent_demo.txt +++ /dev/null @@ -1,44 +0,0 @@ -.. _pylab_examples-histogram_percent_demo: - -pylab_examples example code: histogram_percent_demo.py -====================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/histogram_percent_demo.py - -:: - - import matplotlib - from numpy.random import randn - import matplotlib.pyplot as plt - from matplotlib.ticker import FuncFormatter - - - def to_percent(y, position): - # Ignore the passed in position. This has the effect of scaling the default - # tick locations. - s = str(100 * y) - - # The percent symbol needs escaping in latex - if matplotlib.rcParams['text.usetex'] is True: - return s + r'$\%$' - else: - return s + '%' - - x = randn(5000) - - # Make a normed histogram. It'll be multiplied by 100 later. - plt.hist(x, bins=50, normed=True) - - # Create the formatter using the function to_percent. This multiplies all the - # default labels by 100, making them all percentages - formatter = FuncFormatter(to_percent) - - # Set the formatter - plt.gca().yaxis.set_major_formatter(formatter) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/hline_demo.txt b/_sources/examples/pylab_examples/hline_demo.txt deleted file mode 100644 index b05bb4667e9..00000000000 --- a/_sources/examples/pylab_examples/hline_demo.txt +++ /dev/null @@ -1,37 +0,0 @@ -.. _pylab_examples-hline_demo: - -pylab_examples example code: hline_demo.py -========================================== - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/hline_demo.py - -:: - - #!/usr/bin/env python - import numpy as np - import matplotlib.pyplot as plt - - def f(t): - s1 = np.sin(2*np.pi*t) - e1 = np.exp(-t) - return np.absolute((s1*e1))+.05 - - - t = np.arange(0.0, 5.0, 0.1) - s = f(t) - nse = np.random.normal(0.0, 0.3, t.shape) * s - - - plt.plot(s+nse, t, 'b^') - plt.hlines(t, [0], s, lw=2) - plt.xlabel('time (s)') - plt.title('Comparison of model with data') - - plt.xlim(xmin=0) - plt.show() - - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/hyperlinks.rst.txt b/_sources/examples/pylab_examples/hyperlinks.rst.txt deleted file mode 100644 index 33bb31082c2..00000000000 --- a/_sources/examples/pylab_examples/hyperlinks.rst.txt +++ /dev/null @@ -1,43 +0,0 @@ -.. _pylab_examples-hyperlinks: - -pylab_examples example code: hyperlinks.py -========================================== - -[`source code `_] - -:: - - # -*- noplot -*- - - """ - This example demonstrates how to set a hyperlinks on various kinds of elements. - - This currently only works with the SVG backend. - """ - - import numpy as np - import matplotlib.cm as cm - import matplotlib.mlab as mlab - import matplotlib.pyplot as plt - - f = plt.figure() - s = plt.scatter([1, 2, 3], [4, 5, 6]) - s.set_urls(['http://www.bbc.co.uk/news', 'http://www.google.com', None]) - f.canvas.print_figure('scatter.svg') - - f = plt.figure() - delta = 0.025 - x = y = np.arange(-3.0, 3.0, delta) - X, Y = np.meshgrid(x, y) - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - Z = Z2 - Z1 # difference of Gaussians - - im = plt.imshow(Z, interpolation='bilinear', cmap=cm.gray, - origin='lower', extent=[-3, 3, -3, 3]) - - im.set_url('http://www.google.com') - f.canvas.print_figure('image.svg') - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/hyperlinks.txt b/_sources/examples/pylab_examples/hyperlinks.txt deleted file mode 100644 index 0eb3c7a5932..00000000000 --- a/_sources/examples/pylab_examples/hyperlinks.txt +++ /dev/null @@ -1,44 +0,0 @@ -.. _pylab_examples-hyperlinks: - -pylab_examples example code: hyperlinks.py -========================================== - -[`source code `_] - -:: - - #!/usr/bin/env python - # -*- noplot -*- - - """ - This example demonstrates how to set a hyperlinks on various kinds of elements. - - This currently only works with the SVG backend. - """ - - import numpy as np - import matplotlib.cm as cm - import matplotlib.mlab as mlab - import matplotlib.pyplot as plt - - f = plt.figure() - s = plt.scatter([1, 2, 3], [4, 5, 6]) - s.set_urls(['http://www.bbc.co.uk/news', 'http://www.google.com', None]) - f.canvas.print_figure('scatter.svg') - - f = plt.figure() - delta = 0.025 - x = y = np.arange(-3.0, 3.0, delta) - X, Y = np.meshgrid(x, y) - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - Z = Z2 - Z1 # difference of Gaussians - - im = plt.imshow(Z, interpolation='bilinear', cmap=cm.gray, - origin='lower', extent=[-3, 3, -3, 3]) - - im.set_url('http://www.google.com') - f.canvas.print_figure('image.svg') - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/image_clip_path.rst.txt b/_sources/examples/pylab_examples/image_clip_path.rst.txt deleted file mode 100644 index eb8dfaa7699..00000000000 --- a/_sources/examples/pylab_examples/image_clip_path.rst.txt +++ /dev/null @@ -1,38 +0,0 @@ -.. _pylab_examples-image_clip_path: - -pylab_examples example code: image_clip_path.py -=============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/image_clip_path.py - -:: - - import numpy as np - import matplotlib.cm as cm - import matplotlib.mlab as mlab - import matplotlib.pyplot as plt - from matplotlib.path import Path - from matplotlib.patches import PathPatch - - delta = 0.025 - x = y = np.arange(-3.0, 3.0, delta) - X, Y = np.meshgrid(x, y) - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - Z = Z2 - Z1 # difference of Gaussians - - path = Path([[0, 1], [1, 0], [0, -1], [-1, 0], [0, 1]]) - patch = PathPatch(path, facecolor='none') - plt.gca().add_patch(patch) - - im = plt.imshow(Z, interpolation='bilinear', cmap=cm.gray, - origin='lower', extent=[-3, 3, -3, 3], - clip_path=patch, clip_on=True) - im.set_clip_path(patch) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/image_clip_path.txt b/_sources/examples/pylab_examples/image_clip_path.txt deleted file mode 100644 index ad3f7d2a6c8..00000000000 --- a/_sources/examples/pylab_examples/image_clip_path.txt +++ /dev/null @@ -1,39 +0,0 @@ -.. _pylab_examples-image_clip_path: - -pylab_examples example code: image_clip_path.py -=============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/image_clip_path.py - -:: - - #!/usr/bin/env python - import numpy as np - import matplotlib.cm as cm - import matplotlib.mlab as mlab - import matplotlib.pyplot as plt - from matplotlib.path import Path - from matplotlib.patches import PathPatch - - delta = 0.025 - x = y = np.arange(-3.0, 3.0, delta) - X, Y = np.meshgrid(x, y) - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - Z = Z2 - Z1 # difference of Gaussians - - path = Path([[0, 1], [1, 0], [0, -1], [-1, 0], [0, 1]]) - patch = PathPatch(path, facecolor='none') - plt.gca().add_patch(patch) - - im = plt.imshow(Z, interpolation='bilinear', cmap=cm.gray, - origin='lower', extent=[-3, 3, -3, 3], - clip_path=patch, clip_on=True) - im.set_clip_path(patch) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/image_demo.rst.txt b/_sources/examples/pylab_examples/image_demo.rst.txt deleted file mode 100644 index 5addb34868e..00000000000 --- a/_sources/examples/pylab_examples/image_demo.rst.txt +++ /dev/null @@ -1,31 +0,0 @@ -.. _pylab_examples-image_demo: - -pylab_examples example code: image_demo.py -========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/image_demo.py - -:: - - import numpy as np - import matplotlib.cm as cm - import matplotlib.mlab as mlab - import matplotlib.pyplot as plt - - delta = 0.025 - x = y = np.arange(-3.0, 3.0, delta) - X, Y = np.meshgrid(x, y) - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - Z = Z2 - Z1 # difference of Gaussians - - im = plt.imshow(Z, interpolation='bilinear', cmap=cm.RdYlGn, - origin='lower', extent=[-3, 3, -3, 3], - vmax=abs(Z).max(), vmin=-abs(Z).max()) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/image_demo.txt b/_sources/examples/pylab_examples/image_demo.txt deleted file mode 100644 index 9953fb8720b..00000000000 --- a/_sources/examples/pylab_examples/image_demo.txt +++ /dev/null @@ -1,32 +0,0 @@ -.. _pylab_examples-image_demo: - -pylab_examples example code: image_demo.py -========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/image_demo.py - -:: - - #!/usr/bin/env python - import numpy as np - import matplotlib.cm as cm - import matplotlib.mlab as mlab - import matplotlib.pyplot as plt - - delta = 0.025 - x = y = np.arange(-3.0, 3.0, delta) - X, Y = np.meshgrid(x, y) - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - Z = Z2 - Z1 # difference of Gaussians - - im = plt.imshow(Z, interpolation='bilinear', cmap=cm.RdYlGn, - origin='lower', extent=[-3, 3, -3, 3], - vmax=abs(Z).max(), vmin=-abs(Z).max()) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/image_demo2.rst.txt b/_sources/examples/pylab_examples/image_demo2.rst.txt deleted file mode 100644 index 30820edc8bb..00000000000 --- a/_sources/examples/pylab_examples/image_demo2.rst.txt +++ /dev/null @@ -1,37 +0,0 @@ -.. _pylab_examples-image_demo2: - -pylab_examples example code: image_demo2.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/image_demo2.py - -:: - - from __future__ import print_function - import matplotlib.pyplot as plt - import numpy as np - import matplotlib.cbook as cbook - - w, h = 512, 512 - - datafile = cbook.get_sample_data('ct.raw.gz', asfileobj=True) - s = datafile.read() - A = np.fromstring(s, np.uint16).astype(float) - A *= 1.0 / max(A) - A.shape = w, h - - extent = (0, 25, 0, 25) - im = plt.imshow(A, cmap=plt.cm.hot, origin='upper', extent=extent) - - markers = [(15.9, 14.5), (16.8, 15)] - x, y = zip(*markers) - plt.plot(x, y, 'o') - - plt.title('CT density') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/image_demo2.txt b/_sources/examples/pylab_examples/image_demo2.txt deleted file mode 100644 index 9e35f901d6f..00000000000 --- a/_sources/examples/pylab_examples/image_demo2.txt +++ /dev/null @@ -1,37 +0,0 @@ -.. _pylab_examples-image_demo2: - -pylab_examples example code: image_demo2.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/image_demo2.py - -:: - - from __future__ import print_function - import matplotlib.pyplot as plt - import numpy as np - import matplotlib.cbook as cbook - - w, h = 512, 512 - - datafile = cbook.get_sample_data('ct.raw.gz', asfileobj=True) - s = datafile.read() - A = np.fromstring(s, np.uint16).astype(float) - A *= 1.0 / max(A) - A.shape = w, h - - extent = (0, 25, 0, 25) - im = plt.imshow(A, cmap=plt.cm.hot, origin='upper', extent=extent) - - markers = [(15.9, 14.5), (16.8, 15)] - x, y = zip(*markers) - plt.plot(x, y, 'o') - - plt.title('CT density') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/image_demo3.txt b/_sources/examples/pylab_examples/image_demo3.txt deleted file mode 100644 index 20a61a636ed..00000000000 --- a/_sources/examples/pylab_examples/image_demo3.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _pylab_examples-image_demo3: - -pylab_examples example code: image_demo3.py -=========================================== - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/image_demo3.py - -:: - - #!/usr/bin/env python - from pylab import * - try: - from PIL import Image - except ImportError: - raise SystemExit("PIL must be installed to run this example") - - import matplotlib.cbook as cbook - - datafile = cbook.get_sample_data('grace_hopper.jpg') - lena = Image.open(datafile) - dpi = rcParams['figure.dpi'] - figsize = lena.size[0]/dpi, lena.size[1]/dpi - - figure(figsize=figsize) - ax = axes([0,0,1,1], frameon=False) - ax.set_axis_off() - im = imshow(lena) - - show() - - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/image_interp.rst.txt b/_sources/examples/pylab_examples/image_interp.rst.txt deleted file mode 100644 index f50a6b64633..00000000000 --- a/_sources/examples/pylab_examples/image_interp.rst.txt +++ /dev/null @@ -1,78 +0,0 @@ -.. _pylab_examples-image_interp: - -pylab_examples example code: image_interp.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/image_interp.py - -:: - - """ - The same (small) array, interpolated with three different - interpolation methods. - - The center of the pixel at A[i,j] is plotted at i+0.5, i+0.5. If you - are using interpolation='nearest', the region bounded by (i,j) and - (i+1,j+1) will have the same color. If you are using interpolation, - the pixel center will have the same color as it does with nearest, but - other pixels will be interpolated between the neighboring pixels. - - Earlier versions of matplotlib (<0.63) tried to hide the edge effects - from you by setting the view limits so that they would not be visible. - A recent bugfix in antigrain, and a new implementation in the - matplotlib._image module which takes advantage of this fix, no longer - makes this necessary. To prevent edge effects, when doing - interpolation, the matplotlib._image module now pads the input array - with identical pixels around the edge. e.g., if you have a 5x5 array - with colors a-y as below - - - a b c d e - f g h i j - k l m n o - p q r s t - u v w x y - - the _image module creates the padded array, - - a a b c d e e - a a b c d e e - f f g h i j j - k k l m n o o - p p q r s t t - o u v w x y y - o u v w x y y - - does the interpolation/resizing, and then extracts the central region. - This allows you to plot the full range of your array w/o edge effects, - and for example to layer multiple images of different sizes over one - another with different interpolation methods - see - examples/layer_images.py. It also implies a performance hit, as this - new temporary, padded array must be created. Sophisticated - interpolation also implies a performance hit, so if you need maximal - performance or have very large images, interpolation='nearest' is - suggested. - - """ - import matplotlib.pyplot as plt - import numpy as np - - A = np.random.rand(5, 5) - plt.figure(1) - plt.imshow(A, interpolation='nearest') - plt.grid(True) - - plt.figure(2) - plt.imshow(A, interpolation='bilinear') - plt.grid(True) - - plt.figure(3) - plt.imshow(A, interpolation='bicubic') - plt.grid(True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/image_interp.txt b/_sources/examples/pylab_examples/image_interp.txt deleted file mode 100644 index 3570c77b8e4..00000000000 --- a/_sources/examples/pylab_examples/image_interp.txt +++ /dev/null @@ -1,78 +0,0 @@ -.. _pylab_examples-image_interp: - -pylab_examples example code: image_interp.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/image_interp.py - -:: - - """ - The same (small) array, interpolated with three different - interpolation methods. - - The center of the pixel at A[i,j] is plotted at i+0.5, i+0.5. If you - are using interpolation='nearest', the region bounded by (i,j) and - (i+1,j+1) will have the same color. If you are using interpolation, - the pixel center will have the same color as it does with nearest, but - other pixels will be interpolated between the neighboring pixels. - - Earlier versions of matplotlib (<0.63) tried to hide the edge effects - from you by setting the view limits so that they would not be visible. - A recent bugfix in antigrain, and a new implementation in the - matplotlib._image module which takes advantage of this fix, no longer - makes this necessary. To prevent edge effects, when doing - interpolation, the matplotlib._image module now pads the input array - with identical pixels around the edge. e.g., if you have a 5x5 array - with colors a-y as below - - - a b c d e - f g h i j - k l m n o - p q r s t - u v w x y - - the _image module creates the padded array, - - a a b c d e e - a a b c d e e - f f g h i j j - k k l m n o o - p p q r s t t - o u v w x y y - o u v w x y y - - does the interpolation/resizing, and then extracts the central region. - This allows you to plot the full range of your array w/o edge effects, - and for example to layer multiple images of different sizes over one - another with different interpolation methods - see - examples/layer_images.py. It also implies a performance hit, as this - new temporary, padded array must be created. Sophisticated - interpolation also implies a performance hit, so if you need maximal - performance or have very large images, interpolation='nearest' is - suggested. - - """ - import matplotlib.pyplot as plt - import numpy as np - - A = np.random.rand(5, 5) - plt.figure(1) - plt.imshow(A, interpolation='nearest') - plt.grid(True) - - plt.figure(2) - plt.imshow(A, interpolation='bilinear') - plt.grid(True) - - plt.figure(3) - plt.imshow(A, interpolation='bicubic') - plt.grid(True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/image_masked.rst.txt b/_sources/examples/pylab_examples/image_masked.rst.txt deleted file mode 100644 index 8e40c323ad9..00000000000 --- a/_sources/examples/pylab_examples/image_masked.rst.txt +++ /dev/null @@ -1,86 +0,0 @@ -.. _pylab_examples-image_masked: - -pylab_examples example code: image_masked.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/image_masked.py - -:: - - """ - imshow with masked array input and out-of-range colors. - - The second subplot illustrates the use of BoundaryNorm to - get a filled contour effect. - """ - from copy import copy - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.colors as colors - import matplotlib.mlab as mlab - - # compute some interesting data - x0, x1 = -5, 5 - y0, y1 = -3, 3 - x = np.linspace(x0, x1, 500) - y = np.linspace(y0, y1, 500) - X, Y = np.meshgrid(x, y) - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - Z = 10*(Z2 - Z1) # difference of Gaussians - - # Set up a colormap: - # use copy so that we do not mutate the global colormap instance - palette = copy(plt.cm.gray) - palette.set_over('r', 1.0) - palette.set_under('g', 1.0) - palette.set_bad('b', 1.0) - # Alternatively, we could use - # palette.set_bad(alpha = 0.0) - # to make the bad region transparent. This is the default. - # If you comment out all the palette.set* lines, you will see - # all the defaults; under and over will be colored with the - # first and last colors in the palette, respectively. - Zm = np.ma.masked_where(Z > 1.2, Z) - - # By setting vmin and vmax in the norm, we establish the - # range to which the regular palette color scale is applied. - # Anything above that range is colored based on palette.set_over, etc. - - # set up the axes - fig, (ax1, ax2) = plt.subplots(nrows=2, figsize=(6, 5.4)) - - # plot using 'continuous' color map - im = ax1.imshow(Zm, interpolation='bilinear', - cmap=palette, - norm=colors.Normalize(vmin=-1.0, vmax=1.0), - aspect='auto', - origin='lower', - extent=[x0, x1, y0, y1]) - ax1.set_title('Green=low, Red=high, Blue=masked') - cbar = fig.colorbar(im, extend='both', shrink=0.9, ax=ax1) - cbar.set_label('uniform') - for ticklabel in ax1.xaxis.get_ticklabels(): - ticklabel.set_visible(False) - - # Plot using a small number of colors, with unevenly spaced boundaries. - im = ax2.imshow(Zm, interpolation='nearest', - cmap=palette, - norm=colors.BoundaryNorm([-1, -0.5, -0.2, 0, 0.2, 0.5, 1], - ncolors=palette.N), - aspect='auto', - origin='lower', - extent=[x0, x1, y0, y1]) - ax2.set_title('With BoundaryNorm') - cbar = fig.colorbar(im, extend='both', spacing='proportional', - shrink=0.9, ax=ax2) - cbar.set_label('proportional') - - fig.suptitle('imshow, with out-of-range and masked data') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/image_masked.txt b/_sources/examples/pylab_examples/image_masked.txt deleted file mode 100644 index 9becfc5400f..00000000000 --- a/_sources/examples/pylab_examples/image_masked.txt +++ /dev/null @@ -1,70 +0,0 @@ -.. _pylab_examples-image_masked: - -pylab_examples example code: image_masked.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/image_masked.py - -:: - - """ - imshow with masked array input and out-of-range colors. - - The second subplot illustrates the use of BoundaryNorm to - get a filled contour effect. - """ - - from numpy import ma - import matplotlib.colors as colors - import matplotlib.pyplot as plt - import matplotlib.mlab as mlab - import numpy as np - - delta = 0.025 - x = y = np.arange(-3.0, 3.0, delta) - X, Y = np.meshgrid(x, y) - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - Z = 10*(Z2 - Z1) # difference of Gaussians - - # Set up a colormap: - palette = plt.cm.gray - palette.set_over('r', 1.0) - palette.set_under('g', 1.0) - palette.set_bad('b', 1.0) - # Alternatively, we could use - # palette.set_bad(alpha = 0.0) - # to make the bad region transparent. This is the default. - # If you comment out all the palette.set* lines, you will see - # all the defaults; under and over will be colored with the - # first and last colors in the palette, respectively. - Zm = ma.masked_where(Z > 1.2, Z) - - # By setting vmin and vmax in the norm, we establish the - # range to which the regular palette color scale is applied. - # Anything above that range is colored based on palette.set_over, etc. - - plt.subplot(1, 2, 1) - im = plt.imshow(Zm, interpolation='bilinear', - cmap=palette, - norm=colors.Normalize(vmin=-1.0, vmax=1.0, clip=False), - origin='lower', extent=[-3, 3, -3, 3]) - plt.title('Green=low, Red=high, Blue=bad') - plt.colorbar(im, extend='both', orientation='horizontal', shrink=0.8) - - plt.subplot(1, 2, 2) - im = plt.imshow(Zm, interpolation='nearest', - cmap=palette, - norm=colors.BoundaryNorm([-1, -0.5, -0.2, 0, 0.2, 0.5, 1], - ncolors=256, clip=False), - origin='lower', extent=[-3, 3, -3, 3]) - plt.title('With BoundaryNorm') - plt.colorbar(im, extend='both', spacing='proportional', - orientation='horizontal', shrink=0.8) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/image_nonuniform.rst.txt b/_sources/examples/pylab_examples/image_nonuniform.rst.txt deleted file mode 100644 index c798276c851..00000000000 --- a/_sources/examples/pylab_examples/image_nonuniform.rst.txt +++ /dev/null @@ -1,79 +0,0 @@ -.. _pylab_examples-image_nonuniform: - -pylab_examples example code: image_nonuniform.py -================================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/image_nonuniform.py - -:: - - ''' - This illustrates the NonUniformImage class. It is not - available via an Axes method but it is easily added to an - Axes instance as shown here. - ''' - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.image import NonUniformImage - from matplotlib import cm - - interp = 'nearest' - - # Linear x array for cell centers: - x = np.linspace(-4, 4, 9) - - # Highly nonlinear x array: - x2 = x**3 - - y = np.linspace(-4, 4, 9) - - z = np.sqrt(x[np.newaxis, :]**2 + y[:, np.newaxis]**2) - - fig, axs = plt.subplots(nrows=2, ncols=2) - fig.subplots_adjust(bottom=0.07, hspace=0.3) - fig.suptitle('NonUniformImage class', fontsize='large') - ax = axs[0, 0] - im = NonUniformImage(ax, interpolation=interp, extent=(-4, 4, -4, 4), - cmap=cm.Purples) - im.set_data(x, y, z) - ax.images.append(im) - ax.set_xlim(-4, 4) - ax.set_ylim(-4, 4) - ax.set_title(interp) - - ax = axs[0, 1] - im = NonUniformImage(ax, interpolation=interp, extent=(-64, 64, -4, 4), - cmap=cm.Purples) - im.set_data(x2, y, z) - ax.images.append(im) - ax.set_xlim(-64, 64) - ax.set_ylim(-4, 4) - ax.set_title(interp) - - interp = 'bilinear' - - ax = axs[1, 0] - im = NonUniformImage(ax, interpolation=interp, extent=(-4, 4, -4, 4), - cmap=cm.Purples) - im.set_data(x, y, z) - ax.images.append(im) - ax.set_xlim(-4, 4) - ax.set_ylim(-4, 4) - ax.set_title(interp) - - ax = axs[1, 1] - im = NonUniformImage(ax, interpolation=interp, extent=(-64, 64, -4, 4), - cmap=cm.Purples) - im.set_data(x2, y, z) - ax.images.append(im) - ax.set_xlim(-64, 64) - ax.set_ylim(-4, 4) - ax.set_title(interp) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/image_nonuniform.txt b/_sources/examples/pylab_examples/image_nonuniform.txt deleted file mode 100644 index 37a961575e5..00000000000 --- a/_sources/examples/pylab_examples/image_nonuniform.txt +++ /dev/null @@ -1,74 +0,0 @@ -.. _pylab_examples-image_nonuniform: - -pylab_examples example code: image_nonuniform.py -================================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/image_nonuniform.py - -:: - - ''' - This illustrates the NonUniformImage class, which still needs - an axes method interface; either a separate interface, or a - generalization of imshow. - ''' - - from matplotlib.pyplot import figure, show - import numpy as np - from matplotlib.image import NonUniformImage - from matplotlib import cm - - interp = 'nearest' - - x = np.linspace(-4, 4, 9) - x2 = x**3 - y = np.linspace(-4, 4, 9) - #print('Size %d points' % (len(x) * len(y))) - z = np.sqrt(x[np.newaxis, :]**2 + y[:, np.newaxis]**2) - - fig = figure() - fig.suptitle('NonUniformImage class') - ax = fig.add_subplot(221) - im = NonUniformImage(ax, interpolation=interp, extent=(-4, 4, -4, 4), - cmap=cm.Purples) - im.set_data(x, y, z) - ax.images.append(im) - ax.set_xlim(-4, 4) - ax.set_ylim(-4, 4) - ax.set_title(interp) - - ax = fig.add_subplot(222) - im = NonUniformImage(ax, interpolation=interp, extent=(-64, 64, -4, 4), - cmap=cm.Purples) - im.set_data(x2, y, z) - ax.images.append(im) - ax.set_xlim(-64, 64) - ax.set_ylim(-4, 4) - ax.set_title(interp) - - interp = 'bilinear' - - ax = fig.add_subplot(223) - im = NonUniformImage(ax, interpolation=interp, extent=(-4, 4, -4, 4), - cmap=cm.Purples) - im.set_data(x, y, z) - ax.images.append(im) - ax.set_xlim(-4, 4) - ax.set_ylim(-4, 4) - ax.set_title(interp) - - ax = fig.add_subplot(224) - im = NonUniformImage(ax, interpolation=interp, extent=(-64, 64, -4, 4), - cmap=cm.Purples) - im.set_data(x2, y, z) - ax.images.append(im) - ax.set_xlim(-64, 64) - ax.set_ylim(-4, 4) - ax.set_title(interp) - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/image_origin.rst.txt b/_sources/examples/pylab_examples/image_origin.rst.txt deleted file mode 100644 index e3bf4314cb9..00000000000 --- a/_sources/examples/pylab_examples/image_origin.rst.txt +++ /dev/null @@ -1,34 +0,0 @@ -.. _pylab_examples-image_origin: - -pylab_examples example code: image_origin.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/image_origin.py - -:: - - """ - You can specify whether images should be plotted with the array origin - x[0,0] in the upper left or upper right by using the origin parameter. - You can also control the default be setting image.origin in your - matplotlibrc file; see http://matplotlib.org/matplotlibrc - """ - import matplotlib.pyplot as plt - import numpy as np - - x = np.arange(120) - x.shape = (10, 12) - - interp = 'bilinear' - fig, axs = plt.subplots(nrows=2, sharex=True, figsize=(3, 5)) - axs[0].set_title('blue should be up') - axs[0].imshow(x, origin='upper', interpolation=interp) - - axs[1].set_title('blue should be down') - axs[1].imshow(x, origin='lower', interpolation=interp) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/image_origin.txt b/_sources/examples/pylab_examples/image_origin.txt deleted file mode 100644 index 9b2b6ba8316..00000000000 --- a/_sources/examples/pylab_examples/image_origin.txt +++ /dev/null @@ -1,39 +0,0 @@ -.. _pylab_examples-image_origin: - -pylab_examples example code: image_origin.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/image_origin.py - -:: - - """ - You can specify whether images should be plotted with the array origin - x[0,0] in the upper left or upper right by using the origin parameter. - You can also control the default be setting image.origin in your - matplotlibrc file; see http://matplotlib.org/matplotlibrc - """ - import matplotlib.pyplot as plt - import numpy as np - - x = np.arange(100.0) - x.shape = (10, 10) - - interp = 'bilinear' - #interp = 'nearest' - lim = -2, 11, -2, 6 - plt.subplot(211, axisbg='g') - plt.title('blue should be up') - plt.imshow(x, origin='upper', interpolation=interp, cmap='jet') - #plt.axis(lim) - - plt.subplot(212, axisbg='y') - plt.title('blue should be down') - plt.imshow(x, origin='lower', interpolation=interp, cmap='jet') - #plt.axis(lim) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/image_slices_viewer.rst.txt b/_sources/examples/pylab_examples/image_slices_viewer.rst.txt deleted file mode 100644 index dc527aeeb35..00000000000 --- a/_sources/examples/pylab_examples/image_slices_viewer.rst.txt +++ /dev/null @@ -1,54 +0,0 @@ -.. _pylab_examples-image_slices_viewer: - -pylab_examples example code: image_slices_viewer.py -=================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/image_slices_viewer.py - -:: - - from __future__ import print_function - import numpy - import matplotlib.pyplot as plt - - - class IndexTracker(object): - def __init__(self, ax, X): - self.ax = ax - ax.set_title('use scroll wheel to navigate images') - - self.X = X - rows, cols, self.slices = X.shape - self.ind = self.slices//2 - - self.im = ax.imshow(self.X[:, :, self.ind]) - self.update() - - def onscroll(self, event): - print("%s %s" % (event.button, event.step)) - if event.button == 'up': - self.ind = numpy.clip(self.ind + 1, 0, self.slices - 1) - else: - self.ind = numpy.clip(self.ind - 1, 0, self.slices - 1) - self.update() - - def update(self): - self.im.set_data(self.X[:, :, self.ind]) - ax.set_ylabel('slice %s' % self.ind) - self.im.axes.figure.canvas.draw() - - - fig, ax = plt.subplots(1, 1) - - X = numpy.random.rand(20, 20, 40) - - tracker = IndexTracker(ax, X) - - - fig.canvas.mpl_connect('scroll_event', tracker.onscroll) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/image_slices_viewer.txt b/_sources/examples/pylab_examples/image_slices_viewer.txt deleted file mode 100644 index 87d5d1e18c9..00000000000 --- a/_sources/examples/pylab_examples/image_slices_viewer.txt +++ /dev/null @@ -1,56 +0,0 @@ -.. _pylab_examples-image_slices_viewer: - -pylab_examples example code: image_slices_viewer.py -=================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/image_slices_viewer.py - -:: - - from __future__ import print_function - import numpy - from matplotlib.pyplot import figure, show - - - class IndexTracker(object): - def __init__(self, ax, X): - self.ax = ax - ax.set_title('use scroll wheel to navigate images') - - self.X = X - rows, cols, self.slices = X.shape - self.ind = self.slices//2 - - self.im = ax.imshow(self.X[:, :, self.ind]) - self.update() - - def onscroll(self, event): - print("%s %s" % (event.button, event.step)) - if event.button == 'up': - self.ind = numpy.clip(self.ind + 1, 0, self.slices - 1) - else: - self.ind = numpy.clip(self.ind - 1, 0, self.slices - 1) - - self.update() - - def update(self): - self.im.set_data(self.X[:, :, self.ind]) - ax.set_ylabel('slice %s' % self.ind) - self.im.axes.figure.canvas.draw() - - - fig = figure() - ax = fig.add_subplot(111) - - X = numpy.random.rand(20, 20, 40) - - tracker = IndexTracker(ax, X) - - - fig.canvas.mpl_connect('scroll_event', tracker.onscroll) - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/index.rst.txt b/_sources/examples/pylab_examples/index.rst.txt deleted file mode 100644 index 5c12dbb72fa..00000000000 --- a/_sources/examples/pylab_examples/index.rst.txt +++ /dev/null @@ -1,222 +0,0 @@ -.. _pylab_examples-examples-index: - -############################################## -pylab_examples Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - accented_text - agg_buffer - agg_buffer_to_array - alignment_test - anchored_artists - animation_demo - annotation_demo - annotation_demo2 - annotation_demo3 - anscombe - arctest - arrow_demo - arrow_simple_demo - aspect_loglog - axes_demo - axes_props - axes_zoom_effect - axhspan_demo - axis_equal_demo - bar_stacked - barb_demo - barchart_demo - barchart_demo2 - barcode_demo - boxplot_demo - boxplot_demo2 - boxplot_demo3 - broken_axis - broken_barh - centered_ticklabels - cohere_demo - color_by_yvalue - color_demo - colorbar_tick_labelling_demo - colours - contour_corner_mask - contour_demo - contour_image - contour_label_demo - contourf_demo - contourf_hatching - coords_demo - coords_report - csd_demo - cursor_demo - custom_cmap - custom_figure_class - custom_ticker1 - customize_rc - dashpointlabel - date_demo_convert - date_demo_rrule - date_index_formatter - demo_agg_filter - demo_annotation_box - demo_bboximage - demo_ribbon_box - demo_text_path - demo_text_rotation_mode - demo_tight_layout - dolphin - ellipse_collection - ellipse_demo - ellipse_rotated - equal_aspect_ratio - errorbar_limits - errorbar_subsample - eventcollection_demo - eventplot_demo - fancyarrow_demo - fancybox_demo - fancybox_demo2 - fancytextbox_demo - figimage_demo - figlegend_demo - figure_title - fill_between_demo - fill_betweenx_demo - fill_spiral - findobj_demo - font_table_ttf - fonts_demo - fonts_demo_kw - ganged_plots - geo_demo - ginput_demo - ginput_manual_clabel - gradient_bar - griddata_demo - hatch_demo - hexbin_demo - hexbin_demo2 - hist2d_demo - hist2d_log_demo - hist_colormapped - histogram_percent_demo - hyperlinks - image_clip_path - image_demo - image_demo2 - image_interp - image_masked - image_nonuniform - image_origin - image_slices_viewer - interp_demo - invert_axes - layer_images - leftventricle_bulleye - legend_demo2 - legend_demo3 - legend_demo4 - legend_demo5 - line_collection - line_collection2 - load_converter - loadrec - log_bar - log_demo - log_test - logo - major_minor_demo1 - major_minor_demo2 - manual_axis - marker_path - markevery_demo - masked_demo - mathtext_demo - mathtext_examples - matshow - mri_demo - mri_with_eeg - multi_image - multicolored_line - multiline - multipage_pdf - multiple_figs_demo - multiple_yaxis_with_spines - nan_test - newscalarformatter_demo - patheffect_demo - pcolor_demo - pcolor_log - pcolor_small - pie_demo2 - plotfile_demo - polar_demo - polar_legend - print_stdout - psd_demo - psd_demo2 - psd_demo3 - psd_demo_complex - pythonic_matplotlib - quadmesh_demo - quiver_demo - quiver_simple_demo - scatter_custom_symbol - scatter_demo2 - scatter_hist - scatter_masked - scatter_profile - scatter_star_poly - scatter_symbol - set_and_get - shading_example - shared_axis_across_figures - shared_axis_demo - simple_plot - specgram_demo - spectrum_demo - spine_placement_demo - spy_demos - stackplot_demo - stackplot_demo2 - stem_plot - step_demo - stix_fonts_demo - subplot_demo - subplot_toolbar - subplots_adjust - subplots_demo - symlog_demo - system_monitor - table_demo - tex_demo - tex_unicode_demo - text_handles - text_rotation - text_rotation_relative_to_line - titles_demo - toggle_images - transoffset - tricontour_demo - tricontour_smooth_delaunay - tricontour_smooth_user - tricontour_vs_griddata - trigradient_demo - triinterp_demo - tripcolor_demo - triplot_demo - usetex_baseline_test - usetex_demo - usetex_fonteffects - vline_hline_demo - webapp_demo - xcorr_demo - zorder_demo diff --git a/_sources/examples/pylab_examples/index.txt b/_sources/examples/pylab_examples/index.txt deleted file mode 100644 index 4c27e11ab59..00000000000 --- a/_sources/examples/pylab_examples/index.txt +++ /dev/null @@ -1,230 +0,0 @@ -.. _pylab_examples-examples-index: - -############################################## -pylab_examples Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - accented_text - agg_buffer - agg_buffer_to_array - alignment_test - anchored_artists - animation_demo - annotation_demo - annotation_demo2 - annotation_demo3 - anscombe - arctest - arrow_demo - arrow_simple_demo - aspect_loglog - axes_demo - axes_props - axes_zoom_effect - axhspan_demo - axis_equal_demo - bar_stacked - barb_demo - barchart_demo - barchart_demo2 - barcode_demo - boxplot_demo - boxplot_demo2 - boxplot_demo3 - break - broken_axis - broken_barh - centered_ticklabels - cohere_demo - color_by_yvalue - color_demo - colorbar_tick_labelling_demo - colours - contour_corner_mask - contour_demo - contour_image - contour_label_demo - contourf_demo - contourf_hatching - coords_demo - coords_report - csd_demo - cursor_demo - custom_cmap - custom_figure_class - custom_ticker1 - customize_rc - dashpointlabel - data_helper - date_demo1 - date_demo2 - date_demo_convert - date_demo_rrule - date_index_formatter - demo_agg_filter - demo_annotation_box - demo_bboximage - demo_ribbon_box - demo_text_path - demo_text_rotation_mode - demo_tight_layout - dolphin - ellipse_collection - ellipse_demo - ellipse_rotated - equal_aspect_ratio - errorbar_limits - errorbar_subsample - eventcollection_demo - eventplot_demo - fancyarrow_demo - fancybox_demo - fancybox_demo2 - fancytextbox_demo - figimage_demo - figlegend_demo - figure_title - fill_between_demo - fill_betweenx_demo - fill_spiral - finance_demo - finance_work2 - findobj_demo - font_table_ttf - fonts_demo - fonts_demo_kw - ganged_plots - geo_demo - ginput_demo - ginput_manual_clabel - gradient_bar - griddata_demo - hatch_demo - hexbin_demo - hexbin_demo2 - hist2d_demo - hist2d_log_demo - hist_colormapped - histogram_percent_demo - hyperlinks - image_clip_path - image_demo - image_demo2 - image_interp - image_masked - image_nonuniform - image_origin - image_slices_viewer - interp_demo - invert_axes - layer_images - leftventricle_bulleye - legend_demo2 - legend_demo3 - legend_demo4 - legend_demo5 - line_collection - line_collection2 - load_converter - loadrec - log_bar - log_demo - log_test - logo - major_minor_demo1 - major_minor_demo2 - manual_axis - marker_path - markevery_demo - masked_demo - mathtext_demo - mathtext_examples - matplotlib_icon - matshow - movie_demo - mri_demo - mri_with_eeg - multi_image - multicolored_line - multiline - multipage_pdf - multiple_figs_demo - multiple_yaxis_with_spines - nan_test - newscalarformatter_demo - patheffect_demo - pcolor_demo - pcolor_log - pcolor_small - pie_demo2 - plotfile_demo - polar_demo - polar_legend - print_stdout - psd_demo - psd_demo2 - psd_demo3 - psd_demo_complex - pythonic_matplotlib - quadmesh_demo - quiver_demo - scatter_custom_symbol - scatter_demo2 - scatter_hist - scatter_masked - scatter_profile - scatter_star_poly - scatter_symbol - set_and_get - shading_example - shared_axis_across_figures - shared_axis_demo - simple_plot - specgram_demo - spectrum_demo - spine_placement_demo - spy_demos - stackplot_demo - stackplot_demo2 - stem_plot - step_demo - stix_fonts_demo - stock_demo - subplot_demo - subplot_toolbar - subplots_adjust - subplots_demo - symlog_demo - system_monitor - table_demo - tex_demo - tex_unicode_demo - text_handles - text_rotation - text_rotation_relative_to_line - titles_demo - toggle_images - transoffset - tricontour_demo - tricontour_smooth_delaunay - tricontour_smooth_user - tricontour_vs_griddata - trigradient_demo - triinterp_demo - tripcolor_demo - triplot_demo - usetex_baseline_test - usetex_demo - usetex_fonteffects - vline_hline_demo - webapp_demo - xcorr_demo - zorder_demo diff --git a/_sources/examples/pylab_examples/integral_demo.txt b/_sources/examples/pylab_examples/integral_demo.txt deleted file mode 100644 index 0607e7458c0..00000000000 --- a/_sources/examples/pylab_examples/integral_demo.txt +++ /dev/null @@ -1,48 +0,0 @@ -.. _pylab_examples-integral_demo: - -pylab_examples example code: integral_demo.py -============================================= - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/integral_demo.py - -:: - - #!/usr/bin/env python - - # implement the example graphs/integral from pyx - from pylab import * - from matplotlib.patches import Polygon - - def func(x): - return (x-3)*(x-5)*(x-7)+85 - - ax = subplot(111) - - a, b = 2, 9 # integral area - x = arange(0, 10, 0.01) - y = func(x) - plot(x, y, linewidth=1) - - # make the shaded region - ix = arange(a, b, 0.01) - iy = func(ix) - verts = [(a,0)] + list(zip(ix,iy)) + [(b,0)] - poly = Polygon(verts, facecolor='0.8', edgecolor='k') - ax.add_patch(poly) - - text(0.5 * (a + b), 30, - r"$\int_a^b f(x)\mathrm{d}x$", horizontalalignment='center', - fontsize=20) - - axis([0,10, 0, 180]) - figtext(0.9, 0.05, 'x') - figtext(0.1, 0.9, 'y') - ax.set_xticks((a,b)) - ax.set_xticklabels(('a','b')) - ax.set_yticks([]) - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/interp_demo.rst.txt b/_sources/examples/pylab_examples/interp_demo.rst.txt deleted file mode 100644 index 761c3856f6a..00000000000 --- a/_sources/examples/pylab_examples/interp_demo.rst.txt +++ /dev/null @@ -1,27 +0,0 @@ -.. _pylab_examples-interp_demo: - -pylab_examples example code: interp_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/interp_demo.py - -:: - - import matplotlib.pyplot as plt - from numpy import pi, sin, linspace - from matplotlib.mlab import stineman_interp - - x = linspace(0, 2*pi, 20) - y = sin(x) - yp = None - xi = linspace(x[0], x[-1], 100) - yi = stineman_interp(xi, x, y, yp) - - fig, ax = plt.subplots() - ax.plot(x, y, 'o', xi, yi, '.') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/interp_demo.txt b/_sources/examples/pylab_examples/interp_demo.txt deleted file mode 100644 index 61f86dad41a..00000000000 --- a/_sources/examples/pylab_examples/interp_demo.txt +++ /dev/null @@ -1,27 +0,0 @@ -.. _pylab_examples-interp_demo: - -pylab_examples example code: interp_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/interp_demo.py - -:: - - import matplotlib.pyplot as plt - from numpy import pi, sin, linspace - from matplotlib.mlab import stineman_interp - - x = linspace(0, 2*pi, 20) - y = sin(x) - yp = None - xi = linspace(x[0], x[-1], 100) - yi = stineman_interp(xi, x, y, yp) - - fig, ax = plt.subplots() - ax.plot(x, y, 'ro', xi, yi, '-b.') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/invert_axes.rst.txt b/_sources/examples/pylab_examples/invert_axes.rst.txt deleted file mode 100644 index c180b2ef0c6..00000000000 --- a/_sources/examples/pylab_examples/invert_axes.rst.txt +++ /dev/null @@ -1,34 +0,0 @@ -.. _pylab_examples-invert_axes: - -pylab_examples example code: invert_axes.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/invert_axes.py - -:: - - """ - You can use decreasing axes by flipping the normal order of the axis - limits - """ - - import matplotlib.pyplot as plt - import numpy as np - - t = np.arange(0.01, 5.0, 0.01) - s = np.exp(-t) - plt.plot(t, s) - - plt.xlim(5, 0) # decreasing time - - plt.xlabel('decreasing time (s)') - plt.ylabel('voltage (mV)') - plt.title('Should be growing...') - plt.grid(True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/invert_axes.txt b/_sources/examples/pylab_examples/invert_axes.txt deleted file mode 100644 index d5f670aaf48..00000000000 --- a/_sources/examples/pylab_examples/invert_axes.txt +++ /dev/null @@ -1,34 +0,0 @@ -.. _pylab_examples-invert_axes: - -pylab_examples example code: invert_axes.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/invert_axes.py - -:: - - """ - You can use decreasing axes by flipping the normal order of the axis - limits - """ - - import matplotlib.pyplot as plt - import numpy as np - - t = np.arange(0.01, 5.0, 0.01) - s = np.exp(-t) - plt.plot(t, s) - - plt.xlim(5, 0) # decreasing time - - plt.xlabel('decreasing time (s)') - plt.ylabel('voltage (mV)') - plt.title('Should be growing...') - plt.grid(True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/layer_images.rst.txt b/_sources/examples/pylab_examples/layer_images.rst.txt deleted file mode 100644 index 8638c4cd2c1..00000000000 --- a/_sources/examples/pylab_examples/layer_images.rst.txt +++ /dev/null @@ -1,55 +0,0 @@ -.. _pylab_examples-layer_images: - -pylab_examples example code: layer_images.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/layer_images.py - -:: - - """ - Layer images above one another using alpha blending - """ - from __future__ import division - import matplotlib.pyplot as plt - import numpy as np - - - def func3(x, y): - return (1 - x/2 + x**5 + y**3)*np.exp(-(x**2 + y**2)) - - # make these smaller to increase the resolution - dx, dy = 0.05, 0.05 - - x = np.arange(-3.0, 3.0, dx) - y = np.arange(-3.0, 3.0, dy) - X, Y = np.meshgrid(x, y) - - # when layering multiple images, the images need to have the same - # extent. This does not mean they need to have the same shape, but - # they both need to render to the same coordinate system determined by - # xmin, xmax, ymin, ymax. Note if you use different interpolations - # for the images their apparent extent could be different due to - # interpolation edge effects - - - xmin, xmax, ymin, ymax = np.amin(x), np.amax(x), np.amin(y), np.amax(y) - extent = xmin, xmax, ymin, ymax - fig = plt.figure(frameon=False) - - Z1 = np.array(([0, 1]*4 + [1, 0]*4)*4) - Z1.shape = (8, 8) # chessboard - im1 = plt.imshow(Z1, cmap=plt.cm.gray, interpolation='nearest', - extent=extent) - - Z2 = func3(X, Y) - - im2 = plt.imshow(Z2, cmap=plt.cm.viridis, alpha=.9, interpolation='bilinear', - extent=extent) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/layer_images.txt b/_sources/examples/pylab_examples/layer_images.txt deleted file mode 100644 index 7d5cef78a89..00000000000 --- a/_sources/examples/pylab_examples/layer_images.txt +++ /dev/null @@ -1,56 +0,0 @@ -.. _pylab_examples-layer_images: - -pylab_examples example code: layer_images.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/layer_images.py - -:: - - """ - Layer images above one another using alpha blending - """ - from __future__ import division - import matplotlib.pyplot as plt - import numpy as np - - - def func3(x, y): - return (1 - x/2 + x**5 + y**3)*np.exp(-(x**2 + y**2)) - - # make these smaller to increase the resolution - dx, dy = 0.05, 0.05 - - x = np.arange(-3.0, 3.0, dx) - y = np.arange(-3.0, 3.0, dy) - X, Y = np.meshgrid(x, y) - - # when layering multiple images, the images need to have the same - # extent. This does not mean they need to have the same shape, but - # they both need to render to the same coordinate system determined by - # xmin, xmax, ymin, ymax. Note if you use different interpolations - # for the images their apparent extent could be different due to - # interpolation edge effects - - - xmin, xmax, ymin, ymax = np.amin(x), np.amax(x), np.amin(y), np.amax(y) - extent = xmin, xmax, ymin, ymax - fig = plt.figure(frameon=False) - - Z1 = np.array(([0, 1]*4 + [1, 0]*4)*4) - Z1.shape = (8, 8) # chessboard - im1 = plt.imshow(Z1, cmap=plt.cm.gray, interpolation='nearest', - extent=extent) - plt.hold(True) - - Z2 = func3(X, Y) - - im2 = plt.imshow(Z2, cmap=plt.cm.jet, alpha=.9, interpolation='bilinear', - extent=extent) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/leftventricle_bulleye.rst.txt b/_sources/examples/pylab_examples/leftventricle_bulleye.rst.txt deleted file mode 100644 index f37e232cbc2..00000000000 --- a/_sources/examples/pylab_examples/leftventricle_bulleye.rst.txt +++ /dev/null @@ -1,220 +0,0 @@ -.. _pylab_examples-leftventricle_bulleye: - -pylab_examples example code: leftventricle_bulleye.py -===================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/leftventricle_bulleye.py - -:: - - """ - This example demonstrates how to create the 17 segment model for the left - ventricle recommended by the American Heart Association (AHA). - """ - - import numpy as np - import matplotlib as mpl - import matplotlib.pyplot as plt - - - def bullseye_plot(ax, data, segBold=None, cmap=None, norm=None): - """ - Bullseye representation for the left ventricle. - - Parameters - ---------- - ax : axes - data : list of int and float - The intensity values for each of the 17 segments - segBold: list of int, optional - A list with the segments to highlight - cmap : ColorMap or None, optional - Optional argument to set the desired colormap - norm : Normalize or None, optional - Optional argument to normalize data into the [0.0, 1.0] range - - - Notes - ----- - This function create the 17 segment model for the left ventricle according - to the American Heart Association (AHA) [1]_ - - References - ---------- - .. [1] M. D. Cerqueira, N. J. Weissman, V. Dilsizian, A. K. Jacobs, - S. Kaul, W. K. Laskey, D. J. Pennell, J. A. Rumberger, T. Ryan, - and M. S. Verani, "Standardized myocardial segmentation and - nomenclature for tomographic imaging of the heart", - Circulation, vol. 105, no. 4, pp. 539-542, 2002. - """ - if segBold is None: - segBold = [] - - linewidth = 2 - data = np.array(data).ravel() - - if cmap is None: - cmap = plt.cm.viridis - - if norm is None: - norm = mpl.colors.Normalize(vmin=data.min(), vmax=data.max()) - - theta = np.linspace(0, 2*np.pi, 768) - r = np.linspace(0.2, 1, 4) - - # Create the bound for the segment 17 - for i in range(r.shape[0]): - ax.plot(theta, np.repeat(r[i], theta.shape), '-k', lw=linewidth) - - # Create the bounds for the segments 1-12 - for i in range(6): - theta_i = i*60*np.pi/180 - ax.plot([theta_i, theta_i], [r[1], 1], '-k', lw=linewidth) - - # Create the bounds for the segments 13-16 - for i in range(4): - theta_i = i*90*np.pi/180 - 45*np.pi/180 - ax.plot([theta_i, theta_i], [r[0], r[1]], '-k', lw=linewidth) - - # Fill the segments 1-6 - r0 = r[2:4] - r0 = np.repeat(r0[:, np.newaxis], 128, axis=1).T - for i in range(6): - # First segment start at 60 degrees - theta0 = theta[i*128:i*128+128] + 60*np.pi/180 - theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1) - z = np.ones((128, 2))*data[i] - ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm) - if i+1 in segBold: - ax.plot(theta0, r0, '-k', lw=linewidth+2) - ax.plot(theta0[0], [r[2], r[3]], '-k', lw=linewidth+1) - ax.plot(theta0[-1], [r[2], r[3]], '-k', lw=linewidth+1) - - # Fill the segments 7-12 - r0 = r[1:3] - r0 = np.repeat(r0[:, np.newaxis], 128, axis=1).T - for i in range(6): - # First segment start at 60 degrees - theta0 = theta[i*128:i*128+128] + 60*np.pi/180 - theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1) - z = np.ones((128, 2))*data[i+6] - ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm) - if i+7 in segBold: - ax.plot(theta0, r0, '-k', lw=linewidth+2) - ax.plot(theta0[0], [r[1], r[2]], '-k', lw=linewidth+1) - ax.plot(theta0[-1], [r[1], r[2]], '-k', lw=linewidth+1) - - # Fill the segments 13-16 - r0 = r[0:2] - r0 = np.repeat(r0[:, np.newaxis], 192, axis=1).T - for i in range(4): - # First segment start at 45 degrees - theta0 = theta[i*192:i*192+192] + 45*np.pi/180 - theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1) - z = np.ones((192, 2))*data[i+12] - ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm) - if i+13 in segBold: - ax.plot(theta0, r0, '-k', lw=linewidth+2) - ax.plot(theta0[0], [r[0], r[1]], '-k', lw=linewidth+1) - ax.plot(theta0[-1], [r[0], r[1]], '-k', lw=linewidth+1) - - # Fill the segments 17 - if data.size == 17: - r0 = np.array([0, r[0]]) - r0 = np.repeat(r0[:, np.newaxis], theta.size, axis=1).T - theta0 = np.repeat(theta[:, np.newaxis], 2, axis=1) - z = np.ones((theta.size, 2))*data[16] - ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm) - if 17 in segBold: - ax.plot(theta0, r0, '-k', lw=linewidth+2) - - ax.set_ylim([0, 1]) - ax.set_yticklabels([]) - ax.set_xticklabels([]) - - - # Create the fake data - data = np.array(range(17)) + 1 - - - # Make a figure and axes with dimensions as desired. - fig, ax = plt.subplots(figsize=(12, 8), nrows=1, ncols=3, - subplot_kw=dict(projection='polar')) - fig.canvas.set_window_title('Left Ventricle Bulls Eyes (AHA)') - - # Create the axis for the colorbars - axl = fig.add_axes([0.14, 0.15, 0.2, 0.05]) - axl2 = fig.add_axes([0.41, 0.15, 0.2, 0.05]) - axl3 = fig.add_axes([0.69, 0.15, 0.2, 0.05]) - - - # Set the colormap and norm to correspond to the data for which - # the colorbar will be used. - cmap = mpl.cm.viridis - norm = mpl.colors.Normalize(vmin=1, vmax=17) - - # ColorbarBase derives from ScalarMappable and puts a colorbar - # in a specified axes, so it has everything needed for a - # standalone colorbar. There are many more kwargs, but the - # following gives a basic continuous colorbar with ticks - # and labels. - cb1 = mpl.colorbar.ColorbarBase(axl, cmap=cmap, norm=norm, - orientation='horizontal') - cb1.set_label('Some Units') - - - # Set the colormap and norm to correspond to the data for which - # the colorbar will be used. - cmap2 = mpl.cm.cool - norm2 = mpl.colors.Normalize(vmin=1, vmax=17) - - # ColorbarBase derives from ScalarMappable and puts a colorbar - # in a specified axes, so it has everything needed for a - # standalone colorbar. There are many more kwargs, but the - # following gives a basic continuous colorbar with ticks - # and labels. - cb2 = mpl.colorbar.ColorbarBase(axl2, cmap=cmap2, norm=norm2, - orientation='horizontal') - cb2.set_label('Some other units') - - - # The second example illustrates the use of a ListedColormap, a - # BoundaryNorm, and extended ends to show the "over" and "under" - # value colors. - cmap3 = mpl.colors.ListedColormap(['r', 'g', 'b', 'c']) - cmap3.set_over('0.35') - cmap3.set_under('0.75') - - # If a ListedColormap is used, the length of the bounds array must be - # one greater than the length of the color list. The bounds must be - # monotonically increasing. - bounds = [2, 3, 7, 9, 15] - norm3 = mpl.colors.BoundaryNorm(bounds, cmap3.N) - cb3 = mpl.colorbar.ColorbarBase(axl3, cmap=cmap3, norm=norm3, - # to use 'extend', you must - # specify two extra boundaries: - boundaries=[0]+bounds+[18], - extend='both', - ticks=bounds, # optional - spacing='proportional', - orientation='horizontal') - cb3.set_label('Discrete intervals, some other units') - - - # Create the 17 segment model - bullseye_plot(ax[0], data, cmap=cmap, norm=norm) - ax[0].set_title('Bulls Eye (AHA)') - - bullseye_plot(ax[1], data, cmap=cmap2, norm=norm2) - ax[1].set_title('Bulls Eye (AHA)') - - bullseye_plot(ax[2], data, segBold=[3, 5, 6, 11, 12, 16], - cmap=cmap3, norm=norm3) - ax[2].set_title('Segments [3,5,6,11,12,16] in bold') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/leftventricle_bulleye.txt b/_sources/examples/pylab_examples/leftventricle_bulleye.txt deleted file mode 100644 index 64311c20c56..00000000000 --- a/_sources/examples/pylab_examples/leftventricle_bulleye.txt +++ /dev/null @@ -1,221 +0,0 @@ -.. _pylab_examples-leftventricle_bulleye: - -pylab_examples example code: leftventricle_bulleye.py -===================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/leftventricle_bulleye.py - -:: - - #!/usr/bin/env python - """ - This example demonstrates how to create the 17 segment model for the left - ventricle recommended by the American Heart Association (AHA). - """ - - import numpy as np - import matplotlib as mpl - import matplotlib.pyplot as plt - - - def bullseye_plot(ax, data, segBold=None, cmap=None, norm=None): - """ - Bullseye representation for the left ventricle. - - Parameters - ---------- - ax : axes - data : list of int and float - The intensity values for each of the 17 segments - segBold: list of int, optional - A list with the segments to highlight - cmap : ColorMap or None, optional - Optional argument to set the desired colormap - norm : Normalize or None, optional - Optional argument to normalize data into the [0.0, 1.0] range - - - Notes - ----- - This function create the 17 segment model for the left ventricle according - to the American Heart Association (AHA) [1]_ - - References - ---------- - .. [1] M. D. Cerqueira, N. J. Weissman, V. Dilsizian, A. K. Jacobs, - S. Kaul, W. K. Laskey, D. J. Pennell, J. A. Rumberger, T. Ryan, - and M. S. Verani, "Standardized myocardial segmentation and - nomenclature for tomographic imaging of the heart", - Circulation, vol. 105, no. 4, pp. 539-542, 2002. - """ - if segBold is None: - segBold = [] - - linewidth = 2 - data = np.array(data).ravel() - - if cmap is None: - cmap = plt.cm.jet - - if norm is None: - norm = mpl.colors.Normalize(vmin=data.min(), vmax=data.max()) - - theta = np.linspace(0, 2*np.pi, 768) - r = np.linspace(0.2, 1, 4) - - # Create the bound for the segment 17 - for i in range(r.shape[0]): - ax.plot(theta, np.repeat(r[i], theta.shape), '-k', lw=linewidth) - - # Create the bounds for the segments 1-12 - for i in range(6): - theta_i = i*60*np.pi/180 - ax.plot([theta_i, theta_i], [r[1], 1], '-k', lw=linewidth) - - # Create the bounds for the segmentss 13-16 - for i in range(4): - theta_i = i*90*np.pi/180 - 45*np.pi/180 - ax.plot([theta_i, theta_i], [r[0], r[1]], '-k', lw=linewidth) - - # Fill the segments 1-6 - r0 = r[2:4] - r0 = np.repeat(r0[:, np.newaxis], 128, axis=1).T - for i in range(6): - # First segment start at 60 degrees - theta0 = theta[i*128:i*128+128] + 60*np.pi/180 - theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1) - z = np.ones((128, 2))*data[i] - ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm) - if i+1 in segBold: - ax.plot(theta0, r0, '-k', lw=linewidth+2) - ax.plot(theta0[0], [r[2], r[3]], '-k', lw=linewidth+1) - ax.plot(theta0[-1], [r[2], r[3]], '-k', lw=linewidth+1) - - # Fill the segments 7-12 - r0 = r[1:3] - r0 = np.repeat(r0[:, np.newaxis], 128, axis=1).T - for i in range(6): - # First segment start at 60 degrees - theta0 = theta[i*128:i*128+128] + 60*np.pi/180 - theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1) - z = np.ones((128, 2))*data[i+6] - ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm) - if i+7 in segBold: - ax.plot(theta0, r0, '-k', lw=linewidth+2) - ax.plot(theta0[0], [r[1], r[2]], '-k', lw=linewidth+1) - ax.plot(theta0[-1], [r[1], r[2]], '-k', lw=linewidth+1) - - # Fill the segments 13-16 - r0 = r[0:2] - r0 = np.repeat(r0[:, np.newaxis], 192, axis=1).T - for i in range(4): - # First segment start at 45 degrees - theta0 = theta[i*192:i*192+192] + 45*np.pi/180 - theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1) - z = np.ones((192, 2))*data[i+12] - ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm) - if i+13 in segBold: - ax.plot(theta0, r0, '-k', lw=linewidth+2) - ax.plot(theta0[0], [r[0], r[1]], '-k', lw=linewidth+1) - ax.plot(theta0[-1], [r[0], r[1]], '-k', lw=linewidth+1) - - # Fill the segments 17 - if data.size == 17: - r0 = np.array([0, r[0]]) - r0 = np.repeat(r0[:, np.newaxis], theta.size, axis=1).T - theta0 = np.repeat(theta[:, np.newaxis], 2, axis=1) - z = np.ones((theta.size, 2))*data[16] - ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm) - if 17 in segBold: - ax.plot(theta0, r0, '-k', lw=linewidth+2) - - ax.set_ylim([0, 1]) - ax.set_yticklabels([]) - ax.set_xticklabels([]) - - - # Create the fake data - data = np.array(range(17)) + 1 - - - # Make a figure and axes with dimensions as desired. - fig, ax = plt.subplots(figsize=(12, 8), nrows=1, ncols=3, - subplot_kw=dict(projection='polar')) - fig.canvas.set_window_title('Left Ventricle Bulls Eyes (AHA)') - - # Create the axis for the colorbars - axl = fig.add_axes([0.14, 0.15, 0.2, 0.05]) - axl2 = fig.add_axes([0.41, 0.15, 0.2, 0.05]) - axl3 = fig.add_axes([0.69, 0.15, 0.2, 0.05]) - - - # Set the colormap and norm to correspond to the data for which - # the colorbar will be used. - cmap = mpl.cm.jet - norm = mpl.colors.Normalize(vmin=1, vmax=17) - - # ColorbarBase derives from ScalarMappable and puts a colorbar - # in a specified axes, so it has everything needed for a - # standalone colorbar. There are many more kwargs, but the - # following gives a basic continuous colorbar with ticks - # and labels. - cb1 = mpl.colorbar.ColorbarBase(axl, cmap=cmap, norm=norm, - orientation='horizontal') - cb1.set_label('Some Units') - - - # Set the colormap and norm to correspond to the data for which - # the colorbar will be used. - cmap2 = mpl.cm.cool - norm2 = mpl.colors.Normalize(vmin=1, vmax=17) - - # ColorbarBase derives from ScalarMappable and puts a colorbar - # in a specified axes, so it has everything needed for a - # standalone colorbar. There are many more kwargs, but the - # following gives a basic continuous colorbar with ticks - # and labels. - cb2 = mpl.colorbar.ColorbarBase(axl2, cmap=cmap2, norm=norm2, - orientation='horizontal') - cb2.set_label('Some other units') - - - # The second example illustrates the use of a ListedColormap, a - # BoundaryNorm, and extended ends to show the "over" and "under" - # value colors. - cmap3 = mpl.colors.ListedColormap(['r', 'g', 'b', 'c']) - cmap3.set_over('0.35') - cmap3.set_under('0.75') - - # If a ListedColormap is used, the length of the bounds array must be - # one greater than the length of the color list. The bounds must be - # monotonically increasing. - bounds = [2, 3, 7, 9, 15] - norm3 = mpl.colors.BoundaryNorm(bounds, cmap3.N) - cb3 = mpl.colorbar.ColorbarBase(axl3, cmap=cmap3, norm=norm3, - # to use 'extend', you must - # specify two extra boundaries: - boundaries=[0]+bounds+[18], - extend='both', - ticks=bounds, # optional - spacing='proportional', - orientation='horizontal') - cb3.set_label('Discrete intervals, some other units') - - - # Create the 17 segment model - bullseye_plot(ax[0], data, cmap=cmap, norm=norm) - ax[0].set_title('Bulls Eye (AHA)') - - bullseye_plot(ax[1], data, cmap=cmap2, norm=norm2) - ax[1].set_title('Bulls Eye (AHA)') - - bullseye_plot(ax[2], data, segBold=[3, 5, 6, 11, 12, 16], - cmap=cmap3, norm=norm3) - ax[2].set_title('Segments [3,5,6,11,12,16] in bold') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/legend_auto.txt b/_sources/examples/pylab_examples/legend_auto.txt deleted file mode 100644 index 5327b414c9b..00000000000 --- a/_sources/examples/pylab_examples/legend_auto.txt +++ /dev/null @@ -1,110 +0,0 @@ -.. _pylab_examples-legend_auto: - -pylab_examples example code: legend_auto.py -=========================================== - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/legend_auto.py - -:: - - """ - This file was written to test matplotlib's autolegend placement - algorithm, but shows lots of different ways to create legends so is - useful as a general examples - - Thanks to John Gill and Phil ?? for help at the matplotlib sprint at - pycon 2005 where the auto-legend support was written. - """ - from pylab import * - import sys - - rcParams['legend.loc'] = 'best' - - N = 100 - x = arange(N) - - def fig_1(): - figure(1) - t = arange(0, 40.0 * pi, 0.1) - l, = plot(t, 100*sin(t), 'r', label='sine') - legend(framealpha=0.5) - - def fig_2(): - figure(2) - plot(x, 'o', label='x=y') - legend() - - def fig_3(): - figure(3) - plot(x, -x, 'o', label='x= -y') - legend() - - def fig_4(): - figure(4) - plot(x, ones(len(x)), 'o', label='y=1') - plot(x, -ones(len(x)), 'o', label='y=-1') - legend() - - def fig_5(): - figure(5) - n, bins, patches = hist(randn(1000), 40, normed=1) - l, = plot(bins, normpdf(bins, 0.0, 1.0), 'r--', label='fit', linewidth=3) - legend([l, patches[0]], ['fit', 'hist']) - - def fig_6(): - figure(6) - plot(x, 50-x, 'o', label='y=1') - plot(x, x-50, 'o', label='y=-1') - legend() - - def fig_7(): - figure(7) - xx = x - (N/2.0) - plot(xx, (xx*xx)-1225, 'bo', label='$y=x^2$') - plot(xx, 25*xx, 'go', label='$y=25x$') - plot(xx, -25*xx, 'mo', label='$y=-25x$') - legend() - - def fig_8(): - figure(8) - b1 = bar(x, x, color='m') - b2 = bar(x, x[::-1], color='g') - legend([b1[0], b2[0]], ['up', 'down']) - - def fig_9(): - figure(9) - b1 = bar(x, -x) - b2 = bar(x, -x[::-1], color='r') - legend([b1[0], b2[0]], ['down', 'up']) - - def fig_10(): - figure(10) - b1 = bar(x, x, bottom=-100, color='m') - b2 = bar(x, x[::-1], bottom=-100, color='g') - b3 = bar(x, -x, bottom=100) - b4 = bar(x, -x[::-1], bottom=100, color='r') - legend([b1[0], b2[0], b3[0], b4[0]], ['bottom right', 'bottom left', - 'top left', 'top right']) - - if __name__ == '__main__': - nfigs = 10 - figures = [] - for f in sys.argv[1:]: - try: - figures.append(int(f)) - except ValueError: - pass - if len(figures) == 0: - figures = range(1, nfigs+1) - - for fig in figures: - fn_name = "fig_%d" % fig - fn = globals()[fn_name] - fn() - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/legend_demo.txt b/_sources/examples/pylab_examples/legend_demo.txt deleted file mode 100644 index ba8dda5fea4..00000000000 --- a/_sources/examples/pylab_examples/legend_demo.txt +++ /dev/null @@ -1,56 +0,0 @@ -.. _pylab_examples-legend_demo: - -pylab_examples example code: legend_demo.py -=========================================== - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/legend_demo.py - -:: - - """ - Demo of the legend function with a few features. - - In addition to the basic legend, this demo shows a few optional features: - - * Custom legend placement. - * A keyword argument to a drop-shadow. - * Setting the background color. - * Setting the font size. - * Setting the line width. - """ - import numpy as np - import matplotlib.pyplot as plt - - - # Example data - a = np.arange(0,3, .02) - b = np.arange(0,3, .02) - c = np.exp(a) - d = c[::-1] - - # Create plots with pre-defined labels. - # Alternatively, you can pass labels explicitly when calling `legend`. - fig, ax = plt.subplots() - ax.plot(a, c, 'k--', label='Model length') - ax.plot(a, d, 'k:', label='Data length') - ax.plot(a, c+d, 'k', label='Total message length') - - # Now add the legend with some customizations. - legend = ax.legend(loc='upper center', shadow=True) - - # The frame is matplotlib.patches.Rectangle instance surrounding the legend. - frame = legend.get_frame() - frame.set_facecolor('0.90') - - # Set the fontsize - for label in legend.get_texts(): - label.set_fontsize('large') - - for label in legend.get_lines(): - label.set_linewidth(1.5) # the legend line width - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/legend_demo2.rst.txt b/_sources/examples/pylab_examples/legend_demo2.rst.txt deleted file mode 100644 index ca878222b0d..00000000000 --- a/_sources/examples/pylab_examples/legend_demo2.rst.txt +++ /dev/null @@ -1,34 +0,0 @@ -.. _pylab_examples-legend_demo2: - -pylab_examples example code: legend_demo2.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/legend_demo2.py - -:: - - # Make a legend for specific lines. - import matplotlib.pyplot as plt - import numpy as np - - - t1 = np.arange(0.0, 2.0, 0.1) - t2 = np.arange(0.0, 2.0, 0.01) - - # note that plot returns a list of lines. The "l1, = plot" usage - # extracts the first element of the list into l1 using tuple - # unpacking. So l1 is a Line2D instance, not a sequence of lines - l1, = plt.plot(t2, np.exp(-t2)) - l2, l3 = plt.plot(t2, np.sin(2 * np.pi * t2), '--o', t1, np.log(1 + t1), '.') - l4, = plt.plot(t2, np.exp(-t2) * np.sin(2 * np.pi * t2), 's-.') - - plt.legend((l2, l4), ('oscillatory', 'damped'), loc='upper right', shadow=True) - plt.xlabel('time') - plt.ylabel('volts') - plt.title('Damped oscillation') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/legend_demo2.txt b/_sources/examples/pylab_examples/legend_demo2.txt deleted file mode 100644 index d8ce0706999..00000000000 --- a/_sources/examples/pylab_examples/legend_demo2.txt +++ /dev/null @@ -1,34 +0,0 @@ -.. _pylab_examples-legend_demo2: - -pylab_examples example code: legend_demo2.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/legend_demo2.py - -:: - - # Make a legend for specific lines. - import matplotlib.pyplot as plt - import numpy as np - - - t1 = np.arange(0.0, 2.0, 0.1) - t2 = np.arange(0.0, 2.0, 0.01) - - # note that plot returns a list of lines. The "l1, = plot" usage - # extracts the first element of the list into l1 using tuple - # unpacking. So l1 is a Line2D instance, not a sequence of lines - l1, = plt.plot(t2, np.exp(-t2)) - l2, l3 = plt.plot(t2, np.sin(2 * np.pi * t2), '--go', t1, np.log(1 + t1), '.') - l4, = plt.plot(t2, np.exp(-t2) * np.sin(2 * np.pi * t2), 'rs-.') - - plt.legend((l2, l4), ('oscillatory', 'damped'), loc='upper right', shadow=True) - plt.xlabel('time') - plt.ylabel('volts') - plt.title('Damped oscillation') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/legend_demo3.rst.txt b/_sources/examples/pylab_examples/legend_demo3.rst.txt deleted file mode 100644 index 2c28937d513..00000000000 --- a/_sources/examples/pylab_examples/legend_demo3.rst.txt +++ /dev/null @@ -1,36 +0,0 @@ -.. _pylab_examples-legend_demo3: - -pylab_examples example code: legend_demo3.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/legend_demo3.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - x = np.linspace(0, 1) - - # Plot the lines y=x**n for n=1..4. - ax = plt.subplot(2, 1, 1) - for n in range(1, 5): - plt.plot(x, x**n, label="n={0}".format(n)) - plt.legend(loc="upper left", bbox_to_anchor=[0, 1], - ncol=2, shadow=True, title="Legend", fancybox=True) - ax.get_legend().get_title().set_color("red") - - # Demonstrate some more complex labels. - ax = plt.subplot(2, 1, 2) - plt.plot(x, x**2, label="multi\nline") - half_pi = np.linspace(0, np.pi / 2) - plt.plot(np.sin(half_pi), np.cos(half_pi), label=r"$\frac{1}{2}\pi$") - plt.plot(x, 2**(x**2), label="$2^{x^2}$") - plt.legend(shadow=True, fancybox=True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/legend_demo3.txt b/_sources/examples/pylab_examples/legend_demo3.txt deleted file mode 100644 index a3f609adba8..00000000000 --- a/_sources/examples/pylab_examples/legend_demo3.txt +++ /dev/null @@ -1,36 +0,0 @@ -.. _pylab_examples-legend_demo3: - -pylab_examples example code: legend_demo3.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/legend_demo3.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - x = np.linspace(0, 1) - - # Plot the lines y=x**n for n=1..4. - ax = plt.subplot(2, 1, 1) - for n in range(1, 5): - plt.plot(x, x**n, label="n={0}".format(n)) - plt.legend(loc="upper left", bbox_to_anchor=[0, 1], - ncol=2, shadow=True, title="Legend", fancybox=True) - ax.get_legend().get_title().set_color("red") - - # Demonstrate some more complex labels. - ax = plt.subplot(2, 1, 2) - plt.plot(x, x**2, label="multi\nline") - half_pi = np.linspace(0, np.pi / 2) - plt.plot(np.sin(half_pi), np.cos(half_pi), label=r"$\frac{1}{2}\pi$") - plt.plot(x, 2**(x**2), label="$2^{x^2}$") - plt.legend(shadow=True, fancybox=True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/legend_demo4.rst.txt b/_sources/examples/pylab_examples/legend_demo4.rst.txt deleted file mode 100644 index 62f1eca54ad..00000000000 --- a/_sources/examples/pylab_examples/legend_demo4.rst.txt +++ /dev/null @@ -1,36 +0,0 @@ -.. _pylab_examples-legend_demo4: - -pylab_examples example code: legend_demo4.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/legend_demo4.py - -:: - - import matplotlib.pyplot as plt - - fig, axes = plt.subplots(3, 1) - top_ax, middle_ax, bottom_ax = axes - - top_ax.bar([0, 1, 2], [0.2, 0.3, 0.1], width=0.4, label="Bar 1", - align="center") - top_ax.bar([0.5, 1.5, 2.5], [0.3, 0.2, 0.2], color="red", width=0.4, - label="Bar 2", align="center") - top_ax.legend() - - middle_ax.errorbar([0, 1, 2], [2, 3, 1], xerr=0.4, fmt="s", label="test 1") - middle_ax.errorbar([0, 1, 2], [3, 2, 4], yerr=0.3, fmt="o", label="test 2") - middle_ax.errorbar([0, 1, 2], [1, 1, 3], xerr=0.4, yerr=0.3, fmt="^", - label="test 3") - middle_ax.legend() - - bottom_ax.stem([0.3, 1.5, 2.7], [1, 3.6, 2.7], label="stem test") - bottom_ax.legend() - - plt.subplots_adjust(hspace=0.7) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/legend_demo4.txt b/_sources/examples/pylab_examples/legend_demo4.txt deleted file mode 100644 index e9d7fa2a75e..00000000000 --- a/_sources/examples/pylab_examples/legend_demo4.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _pylab_examples-legend_demo4: - -pylab_examples example code: legend_demo4.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/legend_demo4.py - -:: - - import matplotlib.pyplot as plt - - fig, axes = plt.subplots(3, 1) - top_ax, middle_ax, bottom_ax = axes - - top_ax.bar([0, 1, 2], [0.2, 0.3, 0.1], width=0.4, label="Bar 1", - align="center") - top_ax.bar([0.5, 1.5, 2.5], [0.3, 0.2, 0.2], color="red", width=0.4, - label="Bar 2", align="center") - top_ax.legend() - - middle_ax.errorbar([0, 1, 2], [2, 3, 1], xerr=0.4, fmt="s", label="test 1") - middle_ax.errorbar([0, 1, 2], [3, 2, 4], yerr=0.3, fmt="o", label="test 2") - middle_ax.errorbar([0, 1, 2], [1, 1, 3], xerr=0.4, yerr=0.3, fmt="^", - label="test 3") - middle_ax.legend() - - bottom_ax.stem([0.3, 1.5, 2.7], [1, 3.6, 2.7], label="stem test") - bottom_ax.legend() - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/legend_demo5.rst.txt b/_sources/examples/pylab_examples/legend_demo5.rst.txt deleted file mode 100644 index 1584c6afca8..00000000000 --- a/_sources/examples/pylab_examples/legend_demo5.rst.txt +++ /dev/null @@ -1,85 +0,0 @@ -.. _pylab_examples-legend_demo5: - -pylab_examples example code: legend_demo5.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/legend_demo5.py - -:: - - from __future__ import (absolute_import, division, - print_function, unicode_literals) - import six - from matplotlib import pyplot as plt - import numpy as np - from matplotlib.legend_handler import HandlerLineCollection - import matplotlib.collections as mcol - from matplotlib.lines import Line2D - - - class HandlerDashedLines(HandlerLineCollection): - """ - Custom Handler for LineCollection instances. - """ - def create_artists(self, legend, orig_handle, - xdescent, ydescent, width, height, fontsize, trans): - # figure out how many lines there are - numlines = len(orig_handle.get_segments()) - xdata, xdata_marker = self.get_xdata(legend, xdescent, ydescent, - width, height, fontsize) - leglines = [] - # divide the vertical space where the lines will go - # into equal parts based on the number of lines - ydata = ((height) / (numlines + 1)) * np.ones(xdata.shape, float) - # for each line, create the line at the proper location - # and set the dash pattern - for i in range(numlines): - legline = Line2D(xdata, ydata * (numlines - i) - ydescent) - self.update_prop(legline, orig_handle, legend) - # set color, dash pattern, and linewidth to that - # of the lines in linecollection - try: - color = orig_handle.get_colors()[i] - except IndexError: - color = orig_handle.get_colors()[0] - try: - dashes = orig_handle.get_dashes()[i] - except IndexError: - dashes = orig_handle.get_dashes()[0] - try: - lw = orig_handle.get_linewidths()[i] - except IndexError: - lw = orig_handle.get_linewidths()[0] - if dashes[0] is not None: - legline.set_dashes(dashes[1]) - legline.set_color(color) - legline.set_transform(trans) - legline.set_linewidth(lw) - leglines.append(legline) - return leglines - - x = np.linspace(0, 5, 100) - - plt.figure() - colors = plt.rcParams['axes.prop_cycle'].by_key()['color'][:5] - styles = ['solid', 'dashed', 'dashed', 'dashed', 'solid'] - lines = [] - for i, color, style in zip(range(5), colors, styles): - plt.plot(x, np.sin(x) - .1 * i, c=color, ls=style) - - - # make proxy artists - # make list of one line -- doesn't matter what the coordinates are - line = [[(0, 0)]] - # set up the proxy artist - lc = mcol.LineCollection(5 * line, linestyles=styles, colors=colors) - # create the legend - plt.legend([lc], ['multi-line'], handler_map={type(lc): HandlerDashedLines()}, - handlelength=2.5, handleheight=3) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/legend_demo5.txt b/_sources/examples/pylab_examples/legend_demo5.txt deleted file mode 100644 index 97a9c372c0a..00000000000 --- a/_sources/examples/pylab_examples/legend_demo5.txt +++ /dev/null @@ -1,85 +0,0 @@ -.. _pylab_examples-legend_demo5: - -pylab_examples example code: legend_demo5.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/legend_demo5.py - -:: - - from __future__ import (absolute_import, division, - print_function, unicode_literals) - import six - from matplotlib import pyplot as plt - import numpy as np - from matplotlib.legend_handler import HandlerLineCollection - import matplotlib.collections as mcol - from matplotlib.lines import Line2D - - - class HandlerDashedLines(HandlerLineCollection): - """ - Custom Handler for LineCollection instances. - """ - def create_artists(self, legend, orig_handle, - xdescent, ydescent, width, height, fontsize, trans): - # figure out how many lines there are - numlines = len(orig_handle.get_segments()) - xdata, xdata_marker = self.get_xdata(legend, xdescent, ydescent, - width, height, fontsize) - leglines = [] - # divide the vertical space where the lines will go - # into equal parts based on the number of lines - ydata = ((height) / (numlines + 1)) * np.ones(xdata.shape, float) - # for each line, create the line at the proper location - # and set the dash pattern - for i in range(numlines): - legline = Line2D(xdata, ydata * (numlines - i) - ydescent) - self.update_prop(legline, orig_handle, legend) - # set color, dash pattern, and linewidth to that - # of the lines in linecollection - try: - color = orig_handle.get_colors()[i] - except IndexError: - color = orig_handle.get_colors()[0] - try: - dashes = orig_handle.get_dashes()[i] - except IndexError: - dashes = orig_handle.get_dashes()[0] - try: - lw = orig_handle.get_linewidths()[i] - except IndexError: - lw = orig_handle.get_linewidths()[0] - if dashes[0] is not None: - legline.set_dashes(dashes[1]) - legline.set_color(color) - legline.set_transform(trans) - legline.set_linewidth(lw) - leglines.append(legline) - return leglines - - x = np.linspace(0, 5, 100) - - plt.figure() - colors = ['red', 'orange', 'yellow', 'green', 'blue'] - styles = ['solid', 'dashed', 'dashed', 'dashed', 'solid'] - lines = [] - for i, color, style in zip(range(5), colors, styles): - plt.plot(x, np.sin(x) - .1 * i, c=color, ls=style) - - - # make proxy artists - # make list of one line -- doesn't matter what the coordinates are - line = [[(0, 0)]] - # set up the proxy artist - lc = mcol.LineCollection(5 * line, linestyles=styles, colors=colors) - # create the legend - plt.legend([lc], ['multi-line'], handler_map={type(lc): HandlerDashedLines()}, - handlelength=2.5, handleheight=3) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/legend_demo_custom_handler.txt b/_sources/examples/pylab_examples/legend_demo_custom_handler.txt deleted file mode 100644 index 946c9cc19cd..00000000000 --- a/_sources/examples/pylab_examples/legend_demo_custom_handler.txt +++ /dev/null @@ -1,44 +0,0 @@ -.. _pylab_examples-legend_demo_custom_handler: - -pylab_examples example code: legend_demo_custom_handler.py -========================================================== - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/legend_demo_custom_handler.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - ax = plt.subplot(111, aspect=1) - x, y = np.random.randn(2, 20) - #[1.1, 2, 2.8], [1.1, 2, 1.8] - l1, = ax.plot(x,y, "k+", mew=3, ms=12) - l2, = ax.plot(x,y, "w+", mew=1, ms=10) - - import matplotlib.patches as mpatches - c = mpatches.Circle((0, 0), 1, fc="g", ec="r", lw=3) - ax.add_patch(c) - - - - from matplotlib.legend_handler import HandlerPatch - - def make_legend_ellipse(legend, orig_handle, - xdescent, ydescent, - width, height, fontsize): - p = mpatches.Ellipse(xy=(0.5*width-0.5*xdescent, 0.5*height-0.5*ydescent), - width = width+xdescent, height=(height+ydescent)) - - return p - - plt.legend([c, (l1, l2)], ["Label 1", "Label 2"], - handler_map={mpatches.Circle:HandlerPatch(patch_func=make_legend_ellipse), - }) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/legend_scatter.txt b/_sources/examples/pylab_examples/legend_scatter.txt deleted file mode 100644 index 461564e631f..00000000000 --- a/_sources/examples/pylab_examples/legend_scatter.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _pylab_examples-legend_scatter: - -pylab_examples example code: legend_scatter.py -============================================== - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/legend_scatter.py - -:: - - #!/usr/bin/env python - from pylab import * - - N=1000 - - props = dict( alpha=0.5, edgecolors='none' ) - - handles = [] - colours = ['red', 'green', 'blue', 'magenta', 'cyan', 'yellow'] - colours = ['red', 'green', 'blue'] - for colour in colours: - x, y = rand(2,N) - s = 400.0 * rand(N) - handles.append(scatter(x, y, c=colour, s=s, **props)) - - legend(handles, colours) - grid(True) - - show() - - - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/legend_translucent.txt b/_sources/examples/pylab_examples/legend_translucent.txt deleted file mode 100644 index 488009c7e39..00000000000 --- a/_sources/examples/pylab_examples/legend_translucent.txt +++ /dev/null @@ -1,32 +0,0 @@ -.. _pylab_examples-legend_translucent: - -pylab_examples example code: legend_translucent.py -================================================== - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/legend_translucent.py - -:: - - #!/usr/bin/python - # - # Show how to add a translucent legend - - # import pyplot module - import matplotlib.pyplot as plt - - # draw 2 crossing lines - plt.plot([0,1], label='going up') - plt.plot([1,0], label='going down') - - # add the legend in the middle of the plot - leg = plt.legend(fancybox=True, loc='center') - # set the alpha value of the legend: it will be translucent - leg.get_frame().set_alpha(0.5) - - # show the plot - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/line_collection.rst.txt b/_sources/examples/pylab_examples/line_collection.rst.txt deleted file mode 100644 index 417e6d9cc35..00000000000 --- a/_sources/examples/pylab_examples/line_collection.rst.txt +++ /dev/null @@ -1,54 +0,0 @@ -.. _pylab_examples-line_collection: - -pylab_examples example code: line_collection.py -=============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/line_collection.py - -:: - - import matplotlib.pyplot as plt - from matplotlib.collections import LineCollection - from matplotlib import colors as mcolors - - import numpy as np - - # In order to efficiently plot many lines in a single set of axes, - # Matplotlib has the ability to add the lines all at once. Here is a - # simple example showing how it is done. - - x = np.arange(100) - # Here are many sets of y to plot vs x - ys = x[:50, np.newaxis] + x[np.newaxis, :] - - segs = np.zeros((50, 100, 2), float) - segs[:, :, 1] = ys - segs[:, :, 0] = x - - # Mask some values to test masked array support: - segs = np.ma.masked_where((segs > 50) & (segs < 60), segs) - - # We need to set the plot limits. - ax = plt.axes() - ax.set_xlim(x.min(), x.max()) - ax.set_ylim(ys.min(), ys.max()) - - # colors is sequence of rgba tuples - # linestyle is a string or dash tuple. Legal string values are - # solid|dashed|dashdot|dotted. The dash tuple is (offset, onoffseq) - # where onoffseq is an even length tuple of on and off ink in points. - # If linestyle is omitted, 'solid' is used - # See matplotlib.collections.LineCollection for more information - colors = [mcolors.to_rgba(c) - for c in plt.rcParams['axes.prop_cycle'].by_key()['color']] - - line_segments = LineCollection(segs, linewidths=(0.5, 1, 1.5, 2), - colors=colors, linestyle='solid') - ax.add_collection(line_segments) - ax.set_title('Line collection with masked arrays') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/line_collection.txt b/_sources/examples/pylab_examples/line_collection.txt deleted file mode 100644 index 54985f4c350..00000000000 --- a/_sources/examples/pylab_examples/line_collection.txt +++ /dev/null @@ -1,53 +0,0 @@ -.. _pylab_examples-line_collection: - -pylab_examples example code: line_collection.py -=============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/line_collection.py - -:: - - import matplotlib.pyplot as plt - from matplotlib.collections import LineCollection - from matplotlib.colors import colorConverter - - import numpy as np - - # In order to efficiently plot many lines in a single set of axes, - # Matplotlib has the ability to add the lines all at once. Here is a - # simple example showing how it is done. - - x = np.arange(100) - # Here are many sets of y to plot vs x - ys = x[:50, np.newaxis] + x[np.newaxis, :] - - segs = np.zeros((50, 100, 2), float) - segs[:, :, 1] = ys - segs[:, :, 0] = x - - # Mask some values to test masked array support: - segs = np.ma.masked_where((segs > 50) & (segs < 60), segs) - - # We need to set the plot limits. - ax = plt.axes() - ax.set_xlim(x.min(), x.max()) - ax.set_ylim(ys.min(), ys.max()) - - # colors is sequence of rgba tuples - # linestyle is a string or dash tuple. Legal string values are - # solid|dashed|dashdot|dotted. The dash tuple is (offset, onoffseq) - # where onoffseq is an even length tuple of on and off ink in points. - # If linestyle is omitted, 'solid' is used - # See matplotlib.collections.LineCollection for more information - colors = [colorConverter.to_rgba(i) for i in 'bgrcmyk'] - - line_segments = LineCollection(segs, linewidths=(0.5, 1, 1.5, 2), - colors=colors, linestyle='solid') - ax.add_collection(line_segments) - ax.set_title('Line collection with masked arrays') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/line_collection2.rst.txt b/_sources/examples/pylab_examples/line_collection2.rst.txt deleted file mode 100644 index 38c3f5daa81..00000000000 --- a/_sources/examples/pylab_examples/line_collection2.rst.txt +++ /dev/null @@ -1,51 +0,0 @@ -.. _pylab_examples-line_collection2: - -pylab_examples example code: line_collection2.py -================================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/line_collection2.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - from matplotlib.collections import LineCollection - - # In order to efficiently plot many lines in a single set of axes, - # Matplotlib has the ability to add the lines all at once. Here is a - # simple example showing how it is done. - - N = 50 - x = np.arange(N) - # Here are many sets of y to plot vs x - ys = [x + i for i in x] - - # We need to set the plot limits, they will not autoscale - ax = plt.axes() - ax.set_xlim((np.amin(x), np.amax(x))) - ax.set_ylim((np.amin(np.amin(ys)), np.amax(np.amax(ys)))) - - # colors is sequence of rgba tuples - # linestyle is a string or dash tuple. Legal string values are - # solid|dashed|dashdot|dotted. The dash tuple is (offset, onoffseq) - # where onoffseq is an even length tuple of on and off ink in points. - # If linestyle is omitted, 'solid' is used - # See matplotlib.collections.LineCollection for more information - - # Make a sequence of x,y pairs - line_segments = LineCollection([list(zip(x, y)) for y in ys], - linewidths=(0.5, 1, 1.5, 2), - linestyles='solid') - line_segments.set_array(x) - ax.add_collection(line_segments) - fig = plt.gcf() - axcb = fig.colorbar(line_segments) - axcb.set_label('Line Number') - ax.set_title('Line Collection with mapped colors') - plt.sci(line_segments) # This allows interactive changing of the colormap. - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/line_collection2.txt b/_sources/examples/pylab_examples/line_collection2.txt deleted file mode 100644 index d992e0b9759..00000000000 --- a/_sources/examples/pylab_examples/line_collection2.txt +++ /dev/null @@ -1,51 +0,0 @@ -.. _pylab_examples-line_collection2: - -pylab_examples example code: line_collection2.py -================================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/line_collection2.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - from matplotlib.collections import LineCollection - - # In order to efficiently plot many lines in a single set of axes, - # Matplotlib has the ability to add the lines all at once. Here is a - # simple example showing how it is done. - - N = 50 - x = np.arange(N) - # Here are many sets of y to plot vs x - ys = [x + i for i in x] - - # We need to set the plot limits, they will not autoscale - ax = plt.axes() - ax.set_xlim((np.amin(x), np.amax(x))) - ax.set_ylim((np.amin(np.amin(ys)), np.amax(np.amax(ys)))) - - # colors is sequence of rgba tuples - # linestyle is a string or dash tuple. Legal string values are - # solid|dashed|dashdot|dotted. The dash tuple is (offset, onoffseq) - # where onoffseq is an even length tuple of on and off ink in points. - # If linestyle is omitted, 'solid' is used - # See matplotlib.collections.LineCollection for more information - - # Make a sequence of x,y pairs - line_segments = LineCollection([list(zip(x, y)) for y in ys], - linewidths=(0.5, 1, 1.5, 2), - linestyles='solid') - line_segments.set_array(x) - ax.add_collection(line_segments) - fig = plt.gcf() - axcb = fig.colorbar(line_segments) - axcb.set_label('Line Number') - ax.set_title('Line Collection with mapped colors') - plt.sci(line_segments) # This allows interactive changing of the colormap. - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/line_styles.txt b/_sources/examples/pylab_examples/line_styles.txt deleted file mode 100644 index 62473ad10a6..00000000000 --- a/_sources/examples/pylab_examples/line_styles.txt +++ /dev/null @@ -1,59 +0,0 @@ -.. _pylab_examples-line_styles: - -pylab_examples example code: line_styles.py -=========================================== - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/line_styles.py - -:: - - #!/usr/bin/env python - # This should probably be replaced with a demo that shows all - # line and marker types in a single panel, with labels. - - import matplotlib.pyplot as plt - from matplotlib.lines import Line2D - import numpy as np - - t = np.arange(0.0, 1.0, 0.1) - s = np.sin(2*np.pi*t) - linestyles = ['_', '-', '--', ':'] - markers = [] - for m in Line2D.markers: - try: - if len(m) == 1 and m != ' ': - markers.append(m) - except TypeError: - pass - - styles = markers + [ - r'$\lambda$', - r'$\bowtie$', - r'$\circlearrowleft$', - r'$\clubsuit$', - r'$\checkmark$'] - - colors = ('b', 'g', 'r', 'c', 'm', 'y', 'k') - - plt.figure(figsize=(8,8)) - - axisNum = 0 - for row in range(6): - for col in range(5): - axisNum += 1 - ax = plt.subplot(6, 5, axisNum) - color = colors[axisNum % len(colors)] - if axisNum < len(linestyles): - plt.plot(t, s, linestyles[axisNum], color=color, markersize=10) - else: - style = styles[(axisNum - len(linestyles)) % len(styles)] - plt.plot(t, s, linestyle='None', marker=style, color=color, markersize=10) - ax.set_yticklabels([]) - ax.set_xticklabels([]) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/load_converter.rst.txt b/_sources/examples/pylab_examples/load_converter.rst.txt deleted file mode 100644 index 8fc61035604..00000000000 --- a/_sources/examples/pylab_examples/load_converter.rst.txt +++ /dev/null @@ -1,33 +0,0 @@ -.. _pylab_examples-load_converter: - -pylab_examples example code: load_converter.py -============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/load_converter.py - -:: - - from __future__ import print_function - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.cbook as cbook - import matplotlib.dates as mdates - from matplotlib.dates import bytespdate2num - - datafile = cbook.get_sample_data('msft.csv', asfileobj=False) - print('loading', datafile) - - dates, closes = np.loadtxt(datafile, delimiter=',', - converters={0: bytespdate2num('%d-%b-%y')}, - skiprows=1, usecols=(0, 2), unpack=True) - - fig = plt.figure() - ax = fig.add_subplot(111) - ax.plot_date(dates, closes, '-') - fig.autofmt_xdate() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/load_converter.txt b/_sources/examples/pylab_examples/load_converter.txt deleted file mode 100644 index be12971d2d3..00000000000 --- a/_sources/examples/pylab_examples/load_converter.txt +++ /dev/null @@ -1,33 +0,0 @@ -.. _pylab_examples-load_converter: - -pylab_examples example code: load_converter.py -============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/load_converter.py - -:: - - from __future__ import print_function - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.cbook as cbook - import matplotlib.dates as mdates - from matplotlib.dates import bytespdate2num - - datafile = cbook.get_sample_data('msft.csv', asfileobj=False) - print('loading', datafile) - - dates, closes = np.loadtxt(datafile, delimiter=',', - converters={0: bytespdate2num('%d-%b-%y')}, - skiprows=1, usecols=(0, 2), unpack=True) - - fig = plt.figure() - ax = fig.add_subplot(111) - ax.plot_date(dates, closes, '-') - fig.autofmt_xdate() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/loadrec.rst.txt b/_sources/examples/pylab_examples/loadrec.rst.txt deleted file mode 100644 index 71fb902adac..00000000000 --- a/_sources/examples/pylab_examples/loadrec.rst.txt +++ /dev/null @@ -1,37 +0,0 @@ -.. _pylab_examples-loadrec: - -pylab_examples example code: loadrec.py -======================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/loadrec.py - -:: - - from __future__ import print_function - from matplotlib import mlab - import matplotlib.pyplot as plt - import matplotlib.cbook as cbook - - datafile = cbook.get_sample_data('msft.csv', asfileobj=False) - print('loading', datafile) - a = mlab.csv2rec(datafile) - a.sort() - print(a.dtype) - - fig = plt.figure() - ax = fig.add_subplot(111) - ax.plot(a.date, a.adj_close, '-') - fig.autofmt_xdate() - - # if you have xlwt installed, you can output excel - try: - import mpl_toolkits.exceltools as exceltools - exceltools.rec2excel(a, 'test.xls') - except ImportError: - pass - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/loadrec.txt b/_sources/examples/pylab_examples/loadrec.txt deleted file mode 100644 index 03cdc0a8477..00000000000 --- a/_sources/examples/pylab_examples/loadrec.txt +++ /dev/null @@ -1,37 +0,0 @@ -.. _pylab_examples-loadrec: - -pylab_examples example code: loadrec.py -======================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/loadrec.py - -:: - - from __future__ import print_function - from matplotlib import mlab - import matplotlib.pyplot as plt - import matplotlib.cbook as cbook - - datafile = cbook.get_sample_data('msft.csv', asfileobj=False) - print('loading', datafile) - a = mlab.csv2rec(datafile) - a.sort() - print(a.dtype) - - fig = plt.figure() - ax = fig.add_subplot(111) - ax.plot(a.date, a.adj_close, '-') - fig.autofmt_xdate() - - # if you have xlwt installed, you can output excel - try: - import mpl_toolkits.exceltools as exceltools - exceltools.rec2excel(a, 'test.xls') - except ImportError: - pass - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/log_bar.rst.txt b/_sources/examples/pylab_examples/log_bar.rst.txt deleted file mode 100644 index 89f3a07e985..00000000000 --- a/_sources/examples/pylab_examples/log_bar.rst.txt +++ /dev/null @@ -1,36 +0,0 @@ -.. _pylab_examples-log_bar: - -pylab_examples example code: log_bar.py -======================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/log_bar.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - data = ((3, 1000), (10, 3), (100, 30), (500, 800), (50, 1)) - - plt.xlabel("FOO") - plt.ylabel("FOO") - plt.title("Testing") - plt.yscale('log') - - dim = len(data[0]) - w = 0.75 - dimw = w / dim - - x = np.arange(len(data)) - for i in range(len(data[0])): - y = [d[i] for d in data] - b = plt.bar(x + i * dimw, y, dimw, bottom=0.001) - - plt.xticks(x + dimw / 2, map(str, x)) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/log_bar.txt b/_sources/examples/pylab_examples/log_bar.txt deleted file mode 100644 index 4ab8fb781e3..00000000000 --- a/_sources/examples/pylab_examples/log_bar.txt +++ /dev/null @@ -1,36 +0,0 @@ -.. _pylab_examples-log_bar: - -pylab_examples example code: log_bar.py -======================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/log_bar.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - data = ((3, 1000), (10, 3), (100, 30), (500, 800), (50, 1)) - - plt.xlabel("FOO") - plt.ylabel("FOO") - plt.title("Testing") - plt.yscale('log') - - dim = len(data[0]) - w = 0.75 - dimw = w / dim - - x = np.arange(len(data)) - for i in range(len(data[0])): - y = [d[i] for d in data] - b = plt.bar(x + i * dimw, y, dimw, bottom=0.001) - plt.xticks(x + w / 2) - plt.ylim((0.001, 1000)) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/log_demo.rst.txt b/_sources/examples/pylab_examples/log_demo.rst.txt deleted file mode 100644 index b5ebd1bd6cd..00000000000 --- a/_sources/examples/pylab_examples/log_demo.rst.txt +++ /dev/null @@ -1,52 +0,0 @@ -.. _pylab_examples-log_demo: - -pylab_examples example code: log_demo.py -======================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/log_demo.py - -:: - - - import numpy as np - import matplotlib.pyplot as plt - - plt.subplots_adjust(hspace=0.4) - t = np.arange(0.01, 20.0, 0.01) - - # log y axis - plt.subplot(221) - plt.semilogy(t, np.exp(-t/5.0)) - plt.title('semilogy') - plt.grid(True) - - # log x axis - plt.subplot(222) - plt.semilogx(t, np.sin(2*np.pi*t)) - plt.title('semilogx') - plt.grid(True) - - # log x and y axis - plt.subplot(223) - plt.loglog(t, 20*np.exp(-t/10.0), basex=2) - plt.grid(True) - plt.title('loglog base 2 on x') - - # with errorbars: clip non-positive values - ax = plt.subplot(224) - ax.set_xscale("log", nonposx='clip') - ax.set_yscale("log", nonposy='clip') - - x = 10.0**np.linspace(0.0, 2.0, 20) - y = x**2.0 - plt.errorbar(x, y, xerr=0.1*x, yerr=5.0 + 0.75*y) - ax.set_ylim(ymin=0.1) - ax.set_title('Errorbars go negative') - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/log_demo.txt b/_sources/examples/pylab_examples/log_demo.txt deleted file mode 100644 index f66afbf3aca..00000000000 --- a/_sources/examples/pylab_examples/log_demo.txt +++ /dev/null @@ -1,52 +0,0 @@ -.. _pylab_examples-log_demo: - -pylab_examples example code: log_demo.py -======================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/log_demo.py - -:: - - - import numpy as np - import matplotlib.pyplot as plt - - plt.subplots_adjust(hspace=0.4) - t = np.arange(0.01, 20.0, 0.01) - - # log y axis - plt.subplot(221) - plt.semilogy(t, np.exp(-t/5.0)) - plt.title('semilogy') - plt.grid(True) - - # log x axis - plt.subplot(222) - plt.semilogx(t, np.sin(2*np.pi*t)) - plt.title('semilogx') - plt.grid(True) - - # log x and y axis - plt.subplot(223) - plt.loglog(t, 20*np.exp(-t/10.0), basex=2) - plt.grid(True) - plt.title('loglog base 4 on x') - - # with errorbars: clip non-positive values - ax = plt.subplot(224) - ax.set_xscale("log", nonposx='clip') - ax.set_yscale("log", nonposy='clip') - - x = 10.0**np.linspace(0.0, 2.0, 20) - y = x**2.0 - plt.errorbar(x, y, xerr=0.1*x, yerr=5.0 + 0.75*y) - ax.set_ylim(ymin=0.1) - ax.set_title('Errorbars go negative') - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/log_test.rst.txt b/_sources/examples/pylab_examples/log_test.rst.txt deleted file mode 100644 index 87057245f79..00000000000 --- a/_sources/examples/pylab_examples/log_test.rst.txt +++ /dev/null @@ -1,24 +0,0 @@ -.. _pylab_examples-log_test: - -pylab_examples example code: log_test.py -======================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/log_test.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - dt = 0.01 - t = np.arange(dt, 20.0, dt) - - plt.semilogx(t, np.exp(-t/5.0)) - plt.grid(True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/log_test.txt b/_sources/examples/pylab_examples/log_test.txt deleted file mode 100644 index f4c7146cf2e..00000000000 --- a/_sources/examples/pylab_examples/log_test.txt +++ /dev/null @@ -1,24 +0,0 @@ -.. _pylab_examples-log_test: - -pylab_examples example code: log_test.py -======================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/log_test.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - dt = 0.01 - t = np.arange(dt, 20.0, dt) - - plt.semilogx(t, np.exp(-t/5.0)) - plt.grid(True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/logo.rst.txt b/_sources/examples/pylab_examples/logo.rst.txt deleted file mode 100644 index 86f94aa1268..00000000000 --- a/_sources/examples/pylab_examples/logo.rst.txt +++ /dev/null @@ -1,44 +0,0 @@ -.. _pylab_examples-logo: - -pylab_examples example code: logo.py -==================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/logo.py - -:: - - # This file generates an old version of the matplotlib logo - - from __future__ import print_function - # Above import not necessary for Python 3 onwards. Recommend taking this - # out in examples in the future, since we should all move to Python 3. - import matplotlib.pyplot as plt - import numpy as np - import matplotlib.cbook as cbook - - # convert data to mV - datafile = cbook.get_sample_data('membrane.dat', asfileobj=False) - print('loading', datafile) - - x = 1000 * 0.1 * np.fromstring(open(datafile, 'rb').read(), np.float32) - # 0.0005 is the sample interval - t = 0.0005 * np.arange(len(x)) - plt.figure(1, figsize=(7, 1), dpi=100) - ax = plt.subplot(111, facecolor='y') - plt.plot(t, x) - plt.text(0.5, 0.5, 'matplotlib', color='r', - fontsize=40, fontname=['Courier', 'DejaVu Sans Mono'], - horizontalalignment='center', - verticalalignment='center', - transform=ax.transAxes, - ) - plt.axis([1, 1.72, -60, 10]) - plt.gca().set_xticklabels([]) - plt.gca().set_yticklabels([]) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/logo.txt b/_sources/examples/pylab_examples/logo.txt deleted file mode 100644 index 58c9701f2b4..00000000000 --- a/_sources/examples/pylab_examples/logo.txt +++ /dev/null @@ -1,44 +0,0 @@ -.. _pylab_examples-logo: - -pylab_examples example code: logo.py -==================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/logo.py - -:: - - # This file generates an old version of the matplotlib logo - - from __future__ import print_function - # Above import not necessary for Python 3 onwards. Recommend taking this - # out in examples in the future, since we should all move to Python 3. - import matplotlib.pyplot as plt - import numpy as np - import matplotlib.cbook as cbook - - # convert data to mV - datafile = cbook.get_sample_data('membrane.dat', asfileobj=False) - print('loading', datafile) - - x = 1000 * 0.1 * np.fromstring(open(datafile, 'rb').read(), np.float32) - # 0.0005 is the sample interval - t = 0.0005 * np.arange(len(x)) - plt.figure(1, figsize=(7, 1), dpi=100) - ax = plt.subplot(111, axisbg='y') - plt.plot(t, x) - plt.text(0.5, 0.5, 'matplotlib', color='r', - fontsize=40, fontname=['Courier', 'Bitstream Vera Sans Mono'], - horizontalalignment='center', - verticalalignment='center', - transform=ax.transAxes, - ) - plt.axis([1, 1.72, -60, 10]) - plt.gca().set_xticklabels([]) - plt.gca().set_yticklabels([]) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/major_minor_demo1.rst.txt b/_sources/examples/pylab_examples/major_minor_demo1.rst.txt deleted file mode 100644 index f853af10cc0..00000000000 --- a/_sources/examples/pylab_examples/major_minor_demo1.rst.txt +++ /dev/null @@ -1,67 +0,0 @@ -.. _pylab_examples-major_minor_demo1: - -pylab_examples example code: major_minor_demo1.py -================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/major_minor_demo1.py - -:: - - """ - Demonstrate how to use major and minor tickers. - - The two relevant userland classes are Locators and Formatters. - Locators determine where the ticks are and formatters control the - formatting of ticks. - - Minor ticks are off by default (NullLocator and NullFormatter). You - can turn minor ticks on w/o labels by setting the minor locator. You - can also turn labeling on for the minor ticker by setting the minor - formatter - - Make a plot with major ticks that are multiples of 20 and minor ticks - that are multiples of 5. Label major ticks with %d formatting but - don't label minor ticks - - The MultipleLocator ticker class is used to place ticks on multiples of - some base. The FormatStrFormatter uses a string format string (e.g., - '%d' or '%1.2f' or '%1.1f cm' ) to format the tick - - The pyplot interface grid command changes the grid settings of the - major ticks of the y and y axis together. If you want to control the - grid of the minor ticks for a given axis, use for example - - ax.xaxis.grid(True, which='minor') - - Note, you should not use the same locator between different Axis - because the locator stores references to the Axis data and view limits - - """ - - import matplotlib.pyplot as plt - import numpy as np - from matplotlib.ticker import MultipleLocator, FormatStrFormatter - - majorLocator = MultipleLocator(20) - majorFormatter = FormatStrFormatter('%d') - minorLocator = MultipleLocator(5) - - - t = np.arange(0.0, 100.0, 0.1) - s = np.sin(0.1*np.pi*t)*np.exp(-t*0.01) - - fig, ax = plt.subplots() - plt.plot(t, s) - - ax.xaxis.set_major_locator(majorLocator) - ax.xaxis.set_major_formatter(majorFormatter) - - # for the minor ticks, use no labels; default NullFormatter - ax.xaxis.set_minor_locator(minorLocator) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/major_minor_demo1.txt b/_sources/examples/pylab_examples/major_minor_demo1.txt deleted file mode 100644 index 6e91fe86541..00000000000 --- a/_sources/examples/pylab_examples/major_minor_demo1.txt +++ /dev/null @@ -1,67 +0,0 @@ -.. _pylab_examples-major_minor_demo1: - -pylab_examples example code: major_minor_demo1.py -================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/major_minor_demo1.py - -:: - - """ - Demonstrate how to use major and minor tickers. - - The two relevant userland classes are Locators and Formatters. - Locators determine where the ticks are and formatters control the - formatting of ticks. - - Minor ticks are off by default (NullLocator and NullFormatter). You - can turn minor ticks on w/o labels by setting the minor locator. You - can also turn labeling on for the minor ticker by setting the minor - formatter - - Make a plot with major ticks that are multiples of 20 and minor ticks - that are multiples of 5. Label major ticks with %d formatting but - don't label minor ticks - - The MultipleLocator ticker class is used to place ticks on multiples of - some base. The FormatStrFormatter uses a string format string (e.g., - '%d' or '%1.2f' or '%1.1f cm' ) to format the tick - - The pyplot interface grid command changes the grid settings of the - major ticks of the y and y axis together. If you want to control the - grid of the minor ticks for a given axis, use for example - - ax.xaxis.grid(True, which='minor') - - Note, you should not use the same locator between different Axis - because the locator stores references to the Axis data and view limits - - """ - - import matplotlib.pyplot as plt - import numpy as np - from matplotlib.ticker import MultipleLocator, FormatStrFormatter - - majorLocator = MultipleLocator(20) - majorFormatter = FormatStrFormatter('%d') - minorLocator = MultipleLocator(5) - - - t = np.arange(0.0, 100.0, 0.1) - s = np.sin(0.1*np.pi*t)*np.exp(-t*0.01) - - fig, ax = plt.subplots() - plt.plot(t, s) - - ax.xaxis.set_major_locator(majorLocator) - ax.xaxis.set_major_formatter(majorFormatter) - - # for the minor ticks, use no labels; default NullFormatter - ax.xaxis.set_minor_locator(minorLocator) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/major_minor_demo2.rst.txt b/_sources/examples/pylab_examples/major_minor_demo2.rst.txt deleted file mode 100644 index d02d436ab8d..00000000000 --- a/_sources/examples/pylab_examples/major_minor_demo2.rst.txt +++ /dev/null @@ -1,47 +0,0 @@ -.. _pylab_examples-major_minor_demo2: - -pylab_examples example code: major_minor_demo2.py -================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/major_minor_demo2.py - -:: - - """ - Automatic tick selection for major and minor ticks. - - Use interactive pan and zoom to see how the tick intervals - change. There will be either 4 or 5 minor tick intervals - per major interval, depending on the major interval. - """ - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.ticker import AutoMinorLocator - - # One can supply an argument to AutoMinorLocator to - # specify a fixed number of minor intervals per major interval, e.g.: - # minorLocator = AutoMinorLocator(2) - # would lead to a single minor tick between major ticks. - - minorLocator = AutoMinorLocator() - - - t = np.arange(0.0, 100.0, 0.01) - s = np.sin(2*np.pi*t)*np.exp(-t*0.01) - - fig, ax = plt.subplots() - plt.plot(t, s) - - ax.xaxis.set_minor_locator(minorLocator) - - plt.tick_params(which='both', width=2) - plt.tick_params(which='major', length=7) - plt.tick_params(which='minor', length=4, color='r') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/major_minor_demo2.txt b/_sources/examples/pylab_examples/major_minor_demo2.txt deleted file mode 100644 index 06a31b5cf01..00000000000 --- a/_sources/examples/pylab_examples/major_minor_demo2.txt +++ /dev/null @@ -1,48 +0,0 @@ -.. _pylab_examples-major_minor_demo2: - -pylab_examples example code: major_minor_demo2.py -================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/major_minor_demo2.py - -:: - - #!/usr/bin/env python - """ - Automatic tick selection for major and minor ticks. - - Use interactive pan and zoom to see how the tick intervals - change. There will be either 4 or 5 minor tick intervals - per major interval, depending on the major interval. - """ - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.ticker import AutoMinorLocator - - # One can supply an argument to AutoMinorLocator to - # specify a fixed number of minor intervals per major interval, e.g.: - # minorLocator = AutoMinorLocator(2) - # would lead to a single minor tick between major ticks. - - minorLocator = AutoMinorLocator() - - - t = np.arange(0.0, 100.0, 0.01) - s = np.sin(2*np.pi*t)*np.exp(-t*0.01) - - fig, ax = plt.subplots() - plt.plot(t, s) - - ax.xaxis.set_minor_locator(minorLocator) - - plt.tick_params(which='both', width=2) - plt.tick_params(which='major', length=7) - plt.tick_params(which='minor', length=4, color='r') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/manual_axis.rst.txt b/_sources/examples/pylab_examples/manual_axis.rst.txt deleted file mode 100644 index 3585ef05860..00000000000 --- a/_sources/examples/pylab_examples/manual_axis.rst.txt +++ /dev/null @@ -1,72 +0,0 @@ -.. _pylab_examples-manual_axis: - -pylab_examples example code: manual_axis.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/manual_axis.py - -:: - - """ - The techniques here are no longer required with the new support for - spines in matplotlib -- see - http://matplotlib.org/examples/pylab_examples/spine_placement_demo.html. - - This example should be considered deprecated and is left just for demo - purposes for folks wanting to make a pseudo-axis - """ - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.lines as lines - - - def make_xaxis(ax, yloc, offset=0.05, **props): - xmin, xmax = ax.get_xlim() - locs = [loc for loc in ax.xaxis.get_majorticklocs() - if loc >= xmin and loc <= xmax] - tickline, = ax.plot(locs, [yloc]*len(locs), linestyle='', - marker=lines.TICKDOWN, **props) - axline, = ax.plot([xmin, xmax], [yloc, yloc], **props) - tickline.set_clip_on(False) - axline.set_clip_on(False) - for loc in locs: - ax.text(loc, yloc - offset, '%1.1f' % loc, - horizontalalignment='center', - verticalalignment='top') - - - def make_yaxis(ax, xloc=0, offset=0.05, **props): - ymin, ymax = ax.get_ylim() - locs = [loc for loc in ax.yaxis.get_majorticklocs() - if loc >= ymin and loc <= ymax] - tickline, = ax.plot([xloc]*len(locs), locs, linestyle='', - marker=lines.TICKLEFT, **props) - axline, = ax.plot([xloc, xloc], [ymin, ymax], **props) - tickline.set_clip_on(False) - axline.set_clip_on(False) - - for loc in locs: - ax.text(xloc - offset, loc, '%1.1f' % loc, - verticalalignment='center', - horizontalalignment='right') - - - props = dict(color='black', linewidth=2, markeredgewidth=2) - x = np.arange(200.) - y = np.sin(2*np.pi*x/200.) + np.random.rand(200) - 0.5 - fig = plt.figure(facecolor='white') - ax = fig.add_subplot(111, frame_on=False) - ax.axison = False - ax.plot(x, y, 'd', markersize=8, markerfacecolor='blue') - ax.set_xlim(0, 200) - ax.set_ylim(-1.5, 1.5) - make_xaxis(ax, 0, offset=0.1, **props) - make_yaxis(ax, 0, offset=5, **props) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/manual_axis.txt b/_sources/examples/pylab_examples/manual_axis.txt deleted file mode 100644 index 349795cc069..00000000000 --- a/_sources/examples/pylab_examples/manual_axis.txt +++ /dev/null @@ -1,72 +0,0 @@ -.. _pylab_examples-manual_axis: - -pylab_examples example code: manual_axis.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/manual_axis.py - -:: - - """ - The techniques here are no longer required with the new support for - spines in matplotlib -- see - http://matplotlib.org/examples/pylab_examples/spine_placement_demo.html. - - This example should be considered deprecated and is left just for demo - purposes for folks wanting to make a pseudo-axis - """ - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.lines as lines - - - def make_xaxis(ax, yloc, offset=0.05, **props): - xmin, xmax = ax.get_xlim() - locs = [loc for loc in ax.xaxis.get_majorticklocs() - if loc >= xmin and loc <= xmax] - tickline, = ax.plot(locs, [yloc]*len(locs), linestyle='', - marker=lines.TICKDOWN, **props) - axline, = ax.plot([xmin, xmax], [yloc, yloc], **props) - tickline.set_clip_on(False) - axline.set_clip_on(False) - for loc in locs: - ax.text(loc, yloc - offset, '%1.1f' % loc, - horizontalalignment='center', - verticalalignment='top') - - - def make_yaxis(ax, xloc=0, offset=0.05, **props): - ymin, ymax = ax.get_ylim() - locs = [loc for loc in ax.yaxis.get_majorticklocs() - if loc >= ymin and loc <= ymax] - tickline, = ax.plot([xloc]*len(locs), locs, linestyle='', - marker=lines.TICKLEFT, **props) - axline, = ax.plot([xloc, xloc], [ymin, ymax], **props) - tickline.set_clip_on(False) - axline.set_clip_on(False) - - for loc in locs: - ax.text(xloc - offset, loc, '%1.1f' % loc, - verticalalignment='center', - horizontalalignment='right') - - - props = dict(color='black', linewidth=2, markeredgewidth=2) - x = np.arange(200.) - y = np.sin(2*np.pi*x/200.) + np.random.rand(200) - 0.5 - fig = plt.figure(facecolor='white') - ax = fig.add_subplot(111, frame_on=False) - ax.axison = False - ax.plot(x, y, 'd', markersize=8, markerfacecolor='blue') - ax.set_xlim(0, 200) - ax.set_ylim(-1.5, 1.5) - make_xaxis(ax, 0, offset=0.1, **props) - make_yaxis(ax, 0, offset=5, **props) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/marker_path.rst.txt b/_sources/examples/pylab_examples/marker_path.rst.txt deleted file mode 100644 index ef863f66058..00000000000 --- a/_sources/examples/pylab_examples/marker_path.rst.txt +++ /dev/null @@ -1,30 +0,0 @@ -.. _pylab_examples-marker_path: - -pylab_examples example code: marker_path.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/marker_path.py - -:: - - import matplotlib.pyplot as plt - import matplotlib.path as mpath - import numpy as np - - - star = mpath.Path.unit_regular_star(6) - circle = mpath.Path.unit_circle() - # concatenate the circle with an internal cutout of the star - verts = np.concatenate([circle.vertices, star.vertices[::-1, ...]]) - codes = np.concatenate([circle.codes, star.codes]) - cut_star = mpath.Path(verts, codes) - - - plt.plot(np.arange(10)**2, '--r', marker=cut_star, markersize=15) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/marker_path.txt b/_sources/examples/pylab_examples/marker_path.txt deleted file mode 100644 index 97ed05dc257..00000000000 --- a/_sources/examples/pylab_examples/marker_path.txt +++ /dev/null @@ -1,30 +0,0 @@ -.. _pylab_examples-marker_path: - -pylab_examples example code: marker_path.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/marker_path.py - -:: - - import matplotlib.pyplot as plt - import matplotlib.path as mpath - import numpy as np - - - star = mpath.Path.unit_regular_star(6) - circle = mpath.Path.unit_circle() - # concatenate the circle with an internal cutout of the star - verts = np.concatenate([circle.vertices, star.vertices[::-1, ...]]) - codes = np.concatenate([circle.codes, star.codes]) - cut_star = mpath.Path(verts, codes) - - - plt.plot(np.arange(10)**2, '--r', marker=cut_star, markersize=15) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/markevery_demo.rst.txt b/_sources/examples/pylab_examples/markevery_demo.rst.txt deleted file mode 100644 index 5b11937e0b5..00000000000 --- a/_sources/examples/pylab_examples/markevery_demo.rst.txt +++ /dev/null @@ -1,112 +0,0 @@ -.. _pylab_examples-markevery_demo: - -pylab_examples example code: markevery_demo.py -============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/markevery_demo.py - -:: - - """ - This example demonstrates the various options for showing a marker at a - subset of data points using the `markevery` property of a Line2D object. - - Integer arguments are fairly intuitive. e.g. `markevery`=5 will plot every - 5th marker starting from the first data point. - - Float arguments allow markers to be spaced at approximately equal distances - along the line. The theoretical distance along the line between markers is - determined by multiplying the display-coordinate distance of the axes - bounding-box diagonal by the value of `markevery`. The data points closest - to the theoretical distances will be shown. - - A slice or list/array can also be used with `markevery` to specify the markers - to show. - - """ - - from __future__ import division - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.gridspec as gridspec - - # define a list of markevery cases to plot - cases = [None, - 8, - (30, 8), - [16, 24, 30], [0, -1], - slice(100, 200, 3), - 0.1, 0.3, 1.5, - (0.0, 0.1), (0.45, 0.1)] - - # define the figure size and grid layout properties - figsize = (10, 8) - cols = 3 - gs = gridspec.GridSpec(len(cases) // cols + 1, cols) - - # define the data for cartesian plots - delta = 0.11 - x = np.linspace(0, 10 - 2 * delta, 200) + delta - y = np.sin(x) + 1.0 + delta - - # plot each markevery case for linear x and y scales - fig1 = plt.figure(num=1, figsize=figsize) - ax = [] - for i, case in enumerate(cases): - row = (i // cols) - col = i % cols - ax.append(fig1.add_subplot(gs[row, col])) - ax[-1].set_title('markevery=%s' % str(case)) - ax[-1].plot(x, y, 'o', ls='-', ms=4, markevery=case) - #fig1.tight_layout() - - # plot each markevery case for log x and y scales - fig2 = plt.figure(num=2, figsize=figsize) - axlog = [] - for i, case in enumerate(cases): - row = (i // cols) - col = i % cols - axlog.append(fig2.add_subplot(gs[row, col])) - axlog[-1].set_title('markevery=%s' % str(case)) - axlog[-1].set_xscale('log') - axlog[-1].set_yscale('log') - axlog[-1].plot(x, y, 'o', ls='-', ms=4, markevery=case) - fig2.tight_layout() - - # plot each markevery case for linear x and y scales but zoomed in - # note the behaviour when zoomed in. When a start marker offset is specified - # it is always interpreted with respect to the first data point which might be - # different to the first visible data point. - fig3 = plt.figure(num=3, figsize=figsize) - axzoom = [] - for i, case in enumerate(cases): - row = (i // cols) - col = i % cols - axzoom.append(fig3.add_subplot(gs[row, col])) - axzoom[-1].set_title('markevery=%s' % str(case)) - axzoom[-1].plot(x, y, 'o', ls='-', ms=4, markevery=case) - axzoom[-1].set_xlim((6, 6.7)) - axzoom[-1].set_ylim((1.1, 1.7)) - fig3.tight_layout() - - # define data for polar plots - r = np.linspace(0, 3.0, 200) - theta = 2 * np.pi * r - - # plot each markevery case for polar plots - fig4 = plt.figure(num=4, figsize=figsize) - axpolar = [] - for i, case in enumerate(cases): - row = (i // cols) - col = i % cols - axpolar.append(fig4.add_subplot(gs[row, col], projection='polar')) - axpolar[-1].set_title('markevery=%s' % str(case)) - axpolar[-1].plot(theta, r, 'o', ls='-', ms=4, markevery=case) - fig4.tight_layout() - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/markevery_demo.txt b/_sources/examples/pylab_examples/markevery_demo.txt deleted file mode 100644 index 7cf392efd4b..00000000000 --- a/_sources/examples/pylab_examples/markevery_demo.txt +++ /dev/null @@ -1,112 +0,0 @@ -.. _pylab_examples-markevery_demo: - -pylab_examples example code: markevery_demo.py -============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/markevery_demo.py - -:: - - """ - This example demonstrates the various options for showing a marker at a - subset of data points using the `markevery` property of a Line2D object. - - Integer arguments are fairly intuitive. e.g. `markevery`=5 will plot every - 5th marker starting from the first data point. - - Float arguments allow markers to be spaced at approximately equal distances - along the line. The theoretical distance along the line between markers is - determined by multiplying the display-coordinate distance of the axes - bounding-box diagonal by the value of `markevery`. The data points closest - to the theoretical distances will be shown. - - A slice or list/array can also be used with `markevery` to specify the markers - to show. - - """ - - from __future__ import division - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.gridspec as gridspec - - # define a list of markevery cases to plot - cases = [None, - 8, - (30, 8), - [16, 24, 30], [0, -1], - slice(100, 200, 3), - 0.1, 0.3, 1.5, - (0.0, 0.1), (0.45, 0.1)] - - # define the figure size and grid layout properties - figsize = (10, 8) - cols = 3 - gs = gridspec.GridSpec(len(cases) // cols + 1, cols) - - # define the data for cartesian plots - delta = 0.11 - x = np.linspace(0, 10 - 2 * delta, 200) + delta - y = np.sin(x) + 1.0 + delta - - # plot each markevery case for linear x and y scales - fig1 = plt.figure(num=1, figsize=figsize) - ax = [] - for i, case in enumerate(cases): - row = (i // cols) - col = i % cols - ax.append(fig1.add_subplot(gs[row, col])) - ax[-1].set_title('markevery=%s' % str(case)) - ax[-1].plot(x, y, 'o', ls='-', ms=4, markevery=case) - #fig1.tight_layout() - - # plot each markevery case for log x and y scales - fig2 = plt.figure(num=2, figsize=figsize) - axlog = [] - for i, case in enumerate(cases): - row = (i // cols) - col = i % cols - axlog.append(fig2.add_subplot(gs[row, col])) - axlog[-1].set_title('markevery=%s' % str(case)) - axlog[-1].set_xscale('log') - axlog[-1].set_yscale('log') - axlog[-1].plot(x, y, 'o', ls='-', ms=4, markevery=case) - fig2.tight_layout() - - # plot each markevery case for linear x and y scales but zoomed in - # note the behaviour when zoomed in. When a start marker offset is specified - # it is always interpreted with respect to the first data point which might be - # different to the first visible data point. - fig3 = plt.figure(num=3, figsize=figsize) - axzoom = [] - for i, case in enumerate(cases): - row = (i // cols) - col = i % cols - axzoom.append(fig3.add_subplot(gs[row, col])) - axzoom[-1].set_title('markevery=%s' % str(case)) - axzoom[-1].plot(x, y, 'o', ls='-', ms=4, markevery=case) - axzoom[-1].set_xlim((6, 6.7)) - axzoom[-1].set_ylim((1.1, 1.7)) - fig3.tight_layout() - - # define data for polar plots - r = np.linspace(0, 3.0, 200) - theta = 2 * np.pi * r - - # plot each markevery case for polar plots - fig4 = plt.figure(num=4, figsize=figsize) - axpolar = [] - for i, case in enumerate(cases): - row = (i // cols) - col = i % cols - axpolar.append(fig4.add_subplot(gs[row, col], projection='polar')) - axpolar[-1].set_title('markevery=%s' % str(case)) - axpolar[-1].plot(theta, r, 'o', ls='-', ms=4, markevery=case) - fig4.tight_layout() - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/masked_demo.rst.txt b/_sources/examples/pylab_examples/masked_demo.rst.txt deleted file mode 100644 index 66e29a4e8c2..00000000000 --- a/_sources/examples/pylab_examples/masked_demo.rst.txt +++ /dev/null @@ -1,40 +0,0 @@ -.. _pylab_examples-masked_demo: - -pylab_examples example code: masked_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/masked_demo.py - -:: - - ''' - Plot lines with points masked out. - - This would typically be used with gappy data, to - break the line at the data gaps. - ''' - - import matplotlib.pyplot as plt - import numpy as np - - x = np.arange(0, 2*np.pi, 0.02) - y = np.sin(x) - y1 = np.sin(2*x) - y2 = np.sin(3*x) - ym1 = np.ma.masked_where(y1 > 0.5, y1) - ym2 = np.ma.masked_where(y2 < -0.5, y2) - - lines = plt.plot(x, y, x, ym1, x, ym2, 'o') - plt.setp(lines[0], linewidth=4) - plt.setp(lines[1], linewidth=2) - plt.setp(lines[2], markersize=10) - - plt.legend(('No mask', 'Masked if > 0.5', 'Masked if < -0.5'), - loc='upper right') - plt.title('Masked line demo') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/masked_demo.txt b/_sources/examples/pylab_examples/masked_demo.txt deleted file mode 100644 index 798ed298d26..00000000000 --- a/_sources/examples/pylab_examples/masked_demo.txt +++ /dev/null @@ -1,40 +0,0 @@ -.. _pylab_examples-masked_demo: - -pylab_examples example code: masked_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/masked_demo.py - -:: - - ''' - Plot lines with points masked out. - - This would typically be used with gappy data, to - break the line at the data gaps. - ''' - - import matplotlib.pyplot as plt - import numpy as np - - x = np.arange(0, 2*np.pi, 0.02) - y = np.sin(x) - y1 = np.sin(2*x) - y2 = np.sin(3*x) - ym1 = np.ma.masked_where(y1 > 0.5, y1) - ym2 = np.ma.masked_where(y2 < -0.5, y2) - - lines = plt.plot(x, y, 'r', x, ym1, 'g', x, ym2, 'bo') - plt.setp(lines[0], linewidth=4) - plt.setp(lines[1], linewidth=2) - plt.setp(lines[2], markersize=10) - - plt.legend(('No mask', 'Masked if > 0.5', 'Masked if < -0.5'), - loc='upper right') - plt.title('Masked line demo') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/mathtext_demo.rst.txt b/_sources/examples/pylab_examples/mathtext_demo.rst.txt deleted file mode 100644 index a412470dad5..00000000000 --- a/_sources/examples/pylab_examples/mathtext_demo.rst.txt +++ /dev/null @@ -1,40 +0,0 @@ -.. _pylab_examples-mathtext_demo: - -pylab_examples example code: mathtext_demo.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/mathtext_demo.py - -:: - - """ - Use matplotlib's internal LaTeX parser and layout engine. For true - latex rendering, see the text.usetex option - """ - import numpy as np - from matplotlib.pyplot import figure, show - - fig = figure() - fig.subplots_adjust(bottom=0.2) - - ax = fig.add_subplot(111) - ax.plot([1, 2, 3], 'r') - x = np.arange(0.0, 3.0, 0.1) - - ax.grid(True) - ax.set_xlabel(r'$\Delta_i^j$', fontsize=20) - ax.set_ylabel(r'$\Delta_{i+1}^j$', fontsize=20) - tex = r'$\mathcal{R}\prod_{i=\alpha_{i+1}}^\infty a_i\sin(2 \pi f x_i)$' - - ax.text(1, 1.6, tex, fontsize=20, va='bottom') - - 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) - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/mathtext_demo.txt b/_sources/examples/pylab_examples/mathtext_demo.txt deleted file mode 100644 index d3fdf2fbca9..00000000000 --- a/_sources/examples/pylab_examples/mathtext_demo.txt +++ /dev/null @@ -1,41 +0,0 @@ -.. _pylab_examples-mathtext_demo: - -pylab_examples example code: mathtext_demo.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/mathtext_demo.py - -:: - - #!/usr/bin/env python - """ - Use matplotlib's internal LaTeX parser and layout engine. For true - latex rendering, see the text.usetex option - """ - import numpy as np - from matplotlib.pyplot import figure, show - - fig = figure() - fig.subplots_adjust(bottom=0.2) - - ax = fig.add_subplot(111, axisbg='y') - ax.plot([1, 2, 3], 'r') - x = np.arange(0.0, 3.0, 0.1) - - ax.grid(True) - ax.set_xlabel(r'$\Delta_i^j$', fontsize=20) - ax.set_ylabel(r'$\Delta_{i+1}^j$', fontsize=20) - tex = r'$\mathcal{R}\prod_{i=\alpha_{i+1}}^\infty a_i\sin(2 \pi f x_i)$' - - ax.text(1, 1.6, tex, fontsize=20, va='bottom') - - 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) - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/mathtext_examples.rst.txt b/_sources/examples/pylab_examples/mathtext_examples.rst.txt deleted file mode 100644 index b497be7401a..00000000000 --- a/_sources/examples/pylab_examples/mathtext_examples.rst.txt +++ /dev/null @@ -1,139 +0,0 @@ -.. _pylab_examples-mathtext_examples: - -pylab_examples example code: mathtext_examples.py -================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/mathtext_examples.py - -:: - - """ - Selected features of Matplotlib's math rendering engine. - """ - from __future__ import print_function - import matplotlib.pyplot as plt - import os - import sys - import re - import gc - - # Selection of features following "Writing mathematical expressions" tutorial - mathtext_titles = { - 0: "Header demo", - 1: "Subscripts and superscripts", - 2: "Fractions, binomials and stacked numbers", - 3: "Radicals", - 4: "Fonts", - 5: "Accents", - 6: "Greek, Hebrew", - 7: "Delimiters, functions and Symbols"} - n_lines = len(mathtext_titles) - - # Randomly picked examples - mathext_demos = { - 0: r"$W^{3\beta}_{\delta_1 \rho_1 \sigma_2} = " - r"U^{3\beta}_{\delta_1 \rho_1} + \frac{1}{8 \pi 2} " - r"\int^{\alpha_2}_{\alpha_2} d \alpha^\prime_2 \left[\frac{ " - r"U^{2\beta}_{\delta_1 \rho_1} - \alpha^\prime_2U^{1\beta}_" - r"{\rho_1 \sigma_2} }{U^{0\beta}_{\rho_1 \sigma_2}}\right]$", - - 1: r"$\alpha_i > \beta_i,\ " - r"\alpha_{i+1}^j = {\rm sin}(2\pi f_j t_i) e^{-5 t_i/\tau},\ " - r"\ldots$", - - 2: r"$\frac{3}{4},\ \binom{3}{4},\ \stackrel{3}{4},\ " - r"\left(\frac{5 - \frac{1}{x}}{4}\right),\ \ldots$", - - 3: r"$\sqrt{2},\ \sqrt[3]{x},\ \ldots$", - - 4: r"$\mathrm{Roman}\ , \ \mathit{Italic}\ , \ \mathtt{Typewriter} \ " - r"\mathrm{or}\ \mathcal{CALLIGRAPHY}$", - - 5: r"$\acute a,\ \bar a,\ \breve a,\ \dot a,\ \ddot a, \ \grave a, \ " - r"\hat a,\ \tilde a,\ \vec a,\ \widehat{xyz},\ \widetilde{xyz},\ " - r"\ldots$", - - 6: r"$\alpha,\ \beta,\ \chi,\ \delta,\ \lambda,\ \mu,\ " - r"\Delta,\ \Gamma,\ \Omega,\ \Phi,\ \Pi,\ \Upsilon,\ \nabla,\ " - r"\aleph,\ \beth,\ \daleth,\ \gimel,\ \ldots$", - - 7: r"$\coprod,\ \int,\ \oint,\ \prod,\ \sum,\ " - r"\log,\ \sin,\ \approx,\ \oplus,\ \star,\ \varpropto,\ " - r"\infty,\ \partial,\ \Re,\ \leftrightsquigarrow, \ \ldots$"} - - - def doall(): - # Colors used in mpl online documentation. - mpl_blue_rvb = (191./255., 209./256., 212./255.) - mpl_orange_rvb = (202/255., 121/256., 0./255.) - mpl_grey_rvb = (51./255., 51./255., 51./255.) - - # Creating figure and axis. - plt.figure(figsize=(6, 7)) - plt.axes([0.01, 0.01, 0.98, 0.90], facecolor="white", frameon=True) - plt.gca().set_xlim(0., 1.) - plt.gca().set_ylim(0., 1.) - plt.gca().set_title("Matplotlib's math rendering engine", - color=mpl_grey_rvb, fontsize=14, weight='bold') - plt.gca().set_xticklabels("", visible=False) - plt.gca().set_yticklabels("", visible=False) - - # Gap between lines in axes coords - line_axesfrac = (1. / (n_lines)) - - # Plotting header demonstration formula - full_demo = mathext_demos[0] - plt.annotate(full_demo, - xy=(0.5, 1. - 0.59*line_axesfrac), - xycoords='data', color=mpl_orange_rvb, ha='center', - fontsize=20) - - # Plotting features demonstration formulae - for i_line in range(1, n_lines): - baseline = 1. - (i_line)*line_axesfrac - baseline_next = baseline - line_axesfrac*1. - title = mathtext_titles[i_line] + ":" - fill_color = ['white', mpl_blue_rvb][i_line % 2] - plt.fill_between([0., 1.], [baseline, baseline], - [baseline_next, baseline_next], - color=fill_color, alpha=0.5) - plt.annotate(title, - xy=(0.07, baseline - 0.3*line_axesfrac), - xycoords='data', color=mpl_grey_rvb, weight='bold') - demo = mathext_demos[i_line] - plt.annotate(demo, - xy=(0.05, baseline - 0.75*line_axesfrac), - xycoords='data', color=mpl_grey_rvb, - fontsize=16) - - for i in range(n_lines): - s = mathext_demos[i] - print(i, s) - plt.show() - - if '--latex' in sys.argv: - # Run: python mathtext_examples.py --latex - # Need amsmath and amssymb packages. - fd = open("mathtext_examples.ltx", "w") - fd.write("\\documentclass{article}\n") - fd.write("\\usepackage{amsmath, amssymb}\n") - fd.write("\\begin{document}\n") - fd.write("\\begin{enumerate}\n") - - for i in range(n_lines): - s = mathext_demos[i] - s = re.sub(r"(? \beta_i,\ " - r"\alpha_{i+1}^j = {\rm sin}(2\pi f_j t_i) e^{-5 t_i/\tau},\ " - r"\ldots$", - - 2: r"$\frac{3}{4},\ \binom{3}{4},\ \stackrel{3}{4},\ " - r"\left(\frac{5 - \frac{1}{x}}{4}\right),\ \ldots$", - - 3: r"$\sqrt{2},\ \sqrt[3]{x},\ \ldots$", - - 4: r"$\mathrm{Roman}\ , \ \mathit{Italic}\ , \ \mathtt{Typewriter} \ " - r"\mathrm{or}\ \mathcal{CALLIGRAPHY}$", - - 5: r"$\acute a,\ \bar a,\ \breve a,\ \dot a,\ \ddot a, \ \grave a, \ " - r"\hat a,\ \tilde a,\ \vec a,\ \widehat{xyz},\ \widetilde{xyz},\ " - r"\ldots$", - - 6: r"$\alpha,\ \beta,\ \chi,\ \delta,\ \lambda,\ \mu,\ " - r"\Delta,\ \Gamma,\ \Omega,\ \Phi,\ \Pi,\ \Upsilon,\ \nabla,\ " - r"\aleph,\ \beth,\ \daleth,\ \gimel,\ \ldots$", - - 7: r"$\coprod,\ \int,\ \oint,\ \prod,\ \sum,\ " - r"\log,\ \sin,\ \approx,\ \oplus,\ \star,\ \varpropto,\ " - r"\infty,\ \partial,\ \Re,\ \leftrightsquigarrow, \ \ldots$"} - - - def doall(): - # Colors used in mpl online documentation. - mpl_blue_rvb = (191./255., 209./256., 212./255.) - mpl_orange_rvb = (202/255., 121/256., 0./255.) - mpl_grey_rvb = (51./255., 51./255., 51./255.) - - # Creating figure and axis. - plt.figure(figsize=(6, 7)) - plt.axes([0.01, 0.01, 0.98, 0.90], axisbg="white", frameon=True) - plt.gca().set_xlim(0., 1.) - plt.gca().set_ylim(0., 1.) - plt.gca().set_title("Matplotlib's math rendering engine", - color=mpl_grey_rvb, fontsize=14, weight='bold') - plt.gca().set_xticklabels("", visible=False) - plt.gca().set_yticklabels("", visible=False) - - # Gap between lines in axes coords - line_axesfrac = (1. / (n_lines)) - - # Plotting header demonstration formula - full_demo = mathext_demos[0] - plt.annotate(full_demo, - xy=(0.5, 1. - 0.59*line_axesfrac), - xycoords='data', color=mpl_orange_rvb, ha='center', - fontsize=20) - - # Plotting features demonstration formulae - for i_line in range(1, n_lines): - baseline = 1. - (i_line)*line_axesfrac - baseline_next = baseline - line_axesfrac*1. - title = mathtext_titles[i_line] + ":" - fill_color = ['white', mpl_blue_rvb][i_line % 2] - plt.fill_between([0., 1.], [baseline, baseline], - [baseline_next, baseline_next], - color=fill_color, alpha=0.5) - plt.annotate(title, - xy=(0.07, baseline - 0.3*line_axesfrac), - xycoords='data', color=mpl_grey_rvb, weight='bold') - demo = mathext_demos[i_line] - plt.annotate(demo, - xy=(0.05, baseline - 0.75*line_axesfrac), - xycoords='data', color=mpl_grey_rvb, - fontsize=16) - - for i in range(n_lines): - s = mathext_demos[i] - print(i, s) - plt.show() - - if '--latex' in sys.argv: - # Run: python mathtext_examples.py --latex - # Need amsmath and amssymb packages. - fd = open("mathtext_examples.ltx", "w") - fd.write("\\documentclass{article}\n") - fd.write("\\usepackage{amsmath, amssymb}\n") - fd.write("\\begin{document}\n") - fd.write("\\begin{enumerate}\n") - - for i in range(n_lines): - s = mathext_demos[i] - s = re.sub(r"(?`_] - -:: - - #!/usr/bin/env python - # -*- noplot -*- - - from __future__ import print_function - - import os - import matplotlib.pyplot as plt - import numpy as np - - files = [] - - fig, ax = plt.subplots(figsize=(5, 5)) - for i in range(50): # 50 frames - plt.cla() - plt.imshow(np.random.rand(5, 5), interpolation='nearest') - fname = '_tmp%03d.png' % i - print('Saving frame', fname) - plt.savefig(fname) - files.append(fname) - - print('Making movie animation.mpg - this make take a while') - os.system("mencoder 'mf://_tmp*.png' -mf type=png:fps=10 -ovc lavc -lavcopts vcodec=wmv2 -oac copy -o animation.mpg") - #os.system("convert _tmp*.png animation.mng") - - # cleanup - for fname in files: - os.remove(fname) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/mri_demo.rst.txt b/_sources/examples/pylab_examples/mri_demo.rst.txt deleted file mode 100644 index ef9e1bc8b38..00000000000 --- a/_sources/examples/pylab_examples/mri_demo.rst.txt +++ /dev/null @@ -1,33 +0,0 @@ -.. _pylab_examples-mri_demo: - -pylab_examples example code: mri_demo.py -======================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/mri_demo.py - -:: - - """Displays an MRI image.""" - - import matplotlib.pyplot as plt - import matplotlib.cbook as cbook - import matplotlib.cm as cm - import numpy as np - - fig, ax = plt.subplots(num="MRI_demo") - - # Data are 256x256 16 bit integers - dfile = cbook.get_sample_data('s1045.ima.gz') - im = np.fromstring(dfile.read(), np.uint16).astype(float) - im.shape = (256, 256) - dfile.close() - - ax.imshow(im, cmap=cm.gray) - ax.axis('off') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/mri_demo.txt b/_sources/examples/pylab_examples/mri_demo.txt deleted file mode 100644 index bfa26d84890..00000000000 --- a/_sources/examples/pylab_examples/mri_demo.txt +++ /dev/null @@ -1,27 +0,0 @@ -.. _pylab_examples-mri_demo: - -pylab_examples example code: mri_demo.py -======================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/mri_demo.py - -:: - - from __future__ import print_function - import matplotlib.pyplot as plt - import matplotlib.cbook as cbook - import numpy as np - # data are 256x256 16 bit integers - dfile = cbook.get_sample_data('s1045.ima.gz') - im = np.fromstring(dfile.read(), np.uint16).astype(float) - im.shape = 256, 256 - - plt.imshow(im, cmap=plt.cm.gray) - plt.axis('off') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/mri_with_eeg.rst.txt b/_sources/examples/pylab_examples/mri_with_eeg.rst.txt deleted file mode 100644 index a3e437a400c..00000000000 --- a/_sources/examples/pylab_examples/mri_with_eeg.rst.txt +++ /dev/null @@ -1,93 +0,0 @@ -.. _pylab_examples-mri_with_eeg: - -pylab_examples example code: mri_with_eeg.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/mri_with_eeg.py - -:: - - """Displays a set of subplots with an MRI image, its intensity histogram and - some EEG traces. - """ - - from __future__ import division, print_function - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.cbook as cbook - import matplotlib.cm as cm - - from matplotlib.collections import LineCollection - from matplotlib.ticker import MultipleLocator - - fig = plt.figure("MRI_with_EEG") - - # Load the MRI data (256x256 16 bit integers) - dfile = cbook.get_sample_data('s1045.ima.gz') - im = np.fromstring(dfile.read(), np.uint16).astype(float) - im.shape = (256, 256) - dfile.close() - - # Plot the MRI image - ax0 = fig.add_subplot(2, 2, 1) - ax0.imshow(im, cmap=cm.gray) - ax0.axis('off') - - # Plot the histogram of MRI intensity - ax1 = fig.add_subplot(2, 2, 2) - im = np.ravel(im) - im = im[np.nonzero(im)] # Ignore the background - im = im / (2**16 - 1) # Normalize - ax1.hist(im, bins=100) - ax1.xaxis.set_major_locator(MultipleLocator(0.4)) - ax1.minorticks_on() - ax1.set_yticks([]) - ax1.set_xlabel('Intensity (a.u.)') - ax1.set_ylabel('MRI density') - - # Load the EEG data - numSamples, numRows = 800, 4 - eegfile = cbook.get_sample_data('eeg.dat', asfileobj=False) - print('Loading EEG %s' % eegfile) - data = np.fromfile(eegfile, dtype=float) - data.shape = (numSamples, numRows) - t = 10.0 * np.arange(numSamples) / numSamples - - # Plot the EEG - ticklocs = [] - ax2 = fig.add_subplot(2, 1, 2) - ax2.set_xlim(0, 10) - ax2.set_xticks(np.arange(10)) - dmin = data.min() - dmax = data.max() - dr = (dmax - dmin) * 0.7 # Crowd them a bit. - y0 = dmin - y1 = (numRows - 1) * dr + dmax - ax2.set_ylim(y0, y1) - - segs = [] - for i in range(numRows): - segs.append(np.hstack((t[:, np.newaxis], data[:, i, np.newaxis]))) - ticklocs.append(i * dr) - - offsets = np.zeros((numRows, 2), dtype=float) - offsets[:, 1] = ticklocs - - lines = LineCollection(segs, offsets=offsets, transOffset=None) - ax2.add_collection(lines) - - # Set the yticks to use axes coordinates on the y axis - ax2.set_yticks(ticklocs) - ax2.set_yticklabels(['PG3', 'PG5', 'PG7', 'PG9']) - - ax2.set_xlabel('Time (s)') - - - plt.tight_layout() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/mri_with_eeg.txt b/_sources/examples/pylab_examples/mri_with_eeg.txt deleted file mode 100644 index aa9eeefcce3..00000000000 --- a/_sources/examples/pylab_examples/mri_with_eeg.txt +++ /dev/null @@ -1,92 +0,0 @@ -.. _pylab_examples-mri_with_eeg: - -pylab_examples example code: mri_with_eeg.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/mri_with_eeg.py - -:: - - #!/usr/bin/env python - - """ - This now uses the imshow command instead of pcolor which *is much - faster* - """ - from __future__ import division, print_function - - import numpy as np - - from matplotlib.pyplot import * - from matplotlib.collections import LineCollection - import matplotlib.cbook as cbook - # I use if 1 to break up the different regions of code visually - - if 1: # load the data - # data are 256x256 16 bit integers - dfile = cbook.get_sample_data('s1045.ima.gz') - im = np.fromstring(dfile.read(), np.uint16).astype(float) - im.shape = 256, 256 - - if 1: # plot the MRI in pcolor - subplot(221) - imshow(im, cmap=cm.gray) - axis('off') - - if 1: # plot the histogram of MRI intensity - subplot(222) - im = np.ravel(im) - im = im[np.nonzero(im)] # ignore the background - im = im/(2.0**15) # normalize - hist(im, 100) - xticks([-1, -.5, 0, .5, 1]) - yticks([]) - xlabel('intensity') - ylabel('MRI density') - - if 1: # plot the EEG - # load the data - - numSamples, numRows = 800, 4 - eegfile = cbook.get_sample_data('eeg.dat', asfileobj=False) - print('loading eeg %s' % eegfile) - data = np.fromstring(open(eegfile, 'rb').read(), float) - data.shape = numSamples, numRows - t = 10.0 * np.arange(numSamples, dtype=float)/numSamples - ticklocs = [] - ax = subplot(212) - xlim(0, 10) - xticks(np.arange(10)) - dmin = data.min() - dmax = data.max() - dr = (dmax - dmin)*0.7 # Crowd them a bit. - y0 = dmin - y1 = (numRows - 1) * dr + dmax - ylim(y0, y1) - - segs = [] - for i in range(numRows): - segs.append(np.hstack((t[:, np.newaxis], data[:, i, np.newaxis]))) - ticklocs.append(i*dr) - - offsets = np.zeros((numRows, 2), dtype=float) - offsets[:, 1] = ticklocs - - lines = LineCollection(segs, offsets=offsets, - transOffset=None, - ) - - ax.add_collection(lines) - - # set the yticks to use axes coords on the y axis - ax.set_yticks(ticklocs) - ax.set_yticklabels(['PG3', 'PG5', 'PG7', 'PG9']) - - xlabel('time (s)') - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/multi_image.rst.txt b/_sources/examples/pylab_examples/multi_image.rst.txt deleted file mode 100644 index 818747c5356..00000000000 --- a/_sources/examples/pylab_examples/multi_image.rst.txt +++ /dev/null @@ -1,93 +0,0 @@ -.. _pylab_examples-multi_image: - -pylab_examples example code: multi_image.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/multi_image.py - -:: - - ''' - Make a set of images with a single colormap, norm, and colorbar. - - It also illustrates colorbar tick labelling with a multiplier. - ''' - - from matplotlib.pyplot import figure, show, axes, sci - from matplotlib import cm, colors - from matplotlib.font_manager import FontProperties - from numpy import amin, amax, ravel - from numpy.random import rand - - Nr = 3 - Nc = 2 - - fig = figure() - cmap = cm.cool - - figtitle = 'Multiple images' - t = fig.text(0.5, 0.95, figtitle, - horizontalalignment='center', - fontproperties=FontProperties(size=16)) - - cax = fig.add_axes([0.2, 0.08, 0.6, 0.04]) - - w = 0.4 - h = 0.22 - ax = [] - images = [] - vmin = 1e40 - vmax = -1e40 - for i in range(Nr): - for j in range(Nc): - pos = [0.075 + j*1.1*w, 0.18 + i*1.2*h, w, h] - a = fig.add_axes(pos) - if i > 0: - a.set_xticklabels([]) - # Make some fake data with a range that varies - # somewhat from one plot to the next. - data = ((1 + i + j)/10.0)*rand(10, 20)*1e-6 - dd = ravel(data) - # Manually find the min and max of all colors for - # use in setting the color scale. - vmin = min(vmin, amin(dd)) - vmax = max(vmax, amax(dd)) - images.append(a.imshow(data, cmap=cmap)) - - ax.append(a) - - # Set the first image as the master, with all the others - # observing it for changes in cmap or norm. - - - class ImageFollower(object): - 'update image in response to changes in clim or cmap on another image' - - def __init__(self, follower): - self.follower = follower - - def __call__(self, leader): - self.follower.set_cmap(leader.get_cmap()) - self.follower.set_clim(leader.get_clim()) - - norm = colors.Normalize(vmin=vmin, vmax=vmax) - for i, im in enumerate(images): - im.set_norm(norm) - if i > 0: - images[0].callbacksSM.connect('changed', ImageFollower(im)) - - # The colorbar is also based on this master image. - fig.colorbar(images[0], cax, orientation='horizontal') - - # We need the following only if we want to run this interactively and - # modify the colormap: - - axes(ax[0]) # Return the current axes to the first one, - sci(images[0]) # because the current image must be in current axes. - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/multi_image.txt b/_sources/examples/pylab_examples/multi_image.txt deleted file mode 100644 index 5ca32496c70..00000000000 --- a/_sources/examples/pylab_examples/multi_image.txt +++ /dev/null @@ -1,94 +0,0 @@ -.. _pylab_examples-multi_image: - -pylab_examples example code: multi_image.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/multi_image.py - -:: - - #!/usr/bin/env python - ''' - Make a set of images with a single colormap, norm, and colorbar. - - It also illustrates colorbar tick labelling with a multiplier. - ''' - - from matplotlib.pyplot import figure, show, axes, sci - from matplotlib import cm, colors - from matplotlib.font_manager import FontProperties - from numpy import amin, amax, ravel - from numpy.random import rand - - Nr = 3 - Nc = 2 - - fig = figure() - cmap = cm.cool - - figtitle = 'Multiple images' - t = fig.text(0.5, 0.95, figtitle, - horizontalalignment='center', - fontproperties=FontProperties(size=16)) - - cax = fig.add_axes([0.2, 0.08, 0.6, 0.04]) - - w = 0.4 - h = 0.22 - ax = [] - images = [] - vmin = 1e40 - vmax = -1e40 - for i in range(Nr): - for j in range(Nc): - pos = [0.075 + j*1.1*w, 0.18 + i*1.2*h, w, h] - a = fig.add_axes(pos) - if i > 0: - a.set_xticklabels([]) - # Make some fake data with a range that varies - # somewhat from one plot to the next. - data = ((1 + i + j)/10.0)*rand(10, 20)*1e-6 - dd = ravel(data) - # Manually find the min and max of all colors for - # use in setting the color scale. - vmin = min(vmin, amin(dd)) - vmax = max(vmax, amax(dd)) - images.append(a.imshow(data, cmap=cmap)) - - ax.append(a) - - # Set the first image as the master, with all the others - # observing it for changes in cmap or norm. - - - class ImageFollower(object): - 'update image in response to changes in clim or cmap on another image' - - def __init__(self, follower): - self.follower = follower - - def __call__(self, leader): - self.follower.set_cmap(leader.get_cmap()) - self.follower.set_clim(leader.get_clim()) - - norm = colors.Normalize(vmin=vmin, vmax=vmax) - for i, im in enumerate(images): - im.set_norm(norm) - if i > 0: - images[0].callbacksSM.connect('changed', ImageFollower(im)) - - # The colorbar is also based on this master image. - fig.colorbar(images[0], cax, orientation='horizontal') - - # We need the following only if we want to run this interactively and - # modify the colormap: - - axes(ax[0]) # Return the current axes to the first one, - sci(images[0]) # because the current image must be in current axes. - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/multicolored_line.rst.txt b/_sources/examples/pylab_examples/multicolored_line.rst.txt deleted file mode 100644 index 5056fc5d690..00000000000 --- a/_sources/examples/pylab_examples/multicolored_line.rst.txt +++ /dev/null @@ -1,67 +0,0 @@ -.. _pylab_examples-multicolored_line: - -pylab_examples example code: multicolored_line.py -================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/multicolored_line.py - -:: - - ''' - Color parts of a line based on its properties, e.g., slope. - ''' - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.collections import LineCollection - from matplotlib.colors import ListedColormap, BoundaryNorm - - x = np.linspace(0, 3 * np.pi, 500) - y = np.sin(x) - z = np.cos(0.5 * (x[:-1] + x[1:])) # first derivative - - # Create a colormap for red, green and blue and a norm to color - # f' < -0.5 red, f' > 0.5 blue, and the rest green - cmap = ListedColormap(['r', 'g', 'b']) - norm = BoundaryNorm([-1, -0.5, 0.5, 1], cmap.N) - - # Create a set of line segments so that we can color them individually - # This creates the points as a N x 1 x 2 array so that we can stack points - # together easily to get the segments. The segments array for line collection - # needs to be numlines x points per line x 2 (x and y) - points = np.array([x, y]).T.reshape(-1, 1, 2) - segments = np.concatenate([points[:-1], points[1:]], axis=1) - - # Create the line collection object, setting the colormapping parameters. - # Have to set the actual values used for colormapping separately. - lc = LineCollection(segments, cmap=cmap, norm=norm) - lc.set_array(z) - lc.set_linewidth(3) - - fig1 = plt.figure() - plt.gca().add_collection(lc) - plt.xlim(x.min(), x.max()) - plt.ylim(-1.1, 1.1) - - # Now do a second plot coloring the curve using a continuous colormap - t = np.linspace(0, 10, 200) - x = np.cos(np.pi * t) - y = np.sin(t) - points = np.array([x, y]).T.reshape(-1, 1, 2) - segments = np.concatenate([points[:-1], points[1:]], axis=1) - - lc = LineCollection(segments, cmap=plt.get_cmap('copper'), - norm=plt.Normalize(0, 10)) - lc.set_array(t) - lc.set_linewidth(3) - - fig2 = plt.figure() - plt.gca().add_collection(lc) - plt.xlim(-1, 1) - plt.ylim(-1, 1) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/multicolored_line.txt b/_sources/examples/pylab_examples/multicolored_line.txt deleted file mode 100644 index 0ec766cef22..00000000000 --- a/_sources/examples/pylab_examples/multicolored_line.txt +++ /dev/null @@ -1,67 +0,0 @@ -.. _pylab_examples-multicolored_line: - -pylab_examples example code: multicolored_line.py -================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/multicolored_line.py - -:: - - #!/usr/bin/env python - ''' - Color parts of a line based on its properties, e.g., slope. - ''' - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.collections import LineCollection - from matplotlib.colors import ListedColormap, BoundaryNorm - - x = np.linspace(0, 3 * np.pi, 500) - y = np.sin(x) - z = np.cos(0.5 * (x[:-1] + x[1:])) # first derivative - - # Create a colormap for red, green and blue and a norm to color - # f' < -0.5 red, f' > 0.5 blue, and the rest green - cmap = ListedColormap(['r', 'g', 'b']) - norm = BoundaryNorm([-1, -0.5, 0.5, 1], cmap.N) - - # Create a set of line segments so that we can color them individually - # This creates the points as a N x 1 x 2 array so that we can stack points - # together easily to get the segments. The segments array for line collection - # needs to be numlines x points per line x 2 (x and y) - points = np.array([x, y]).T.reshape(-1, 1, 2) - segments = np.concatenate([points[:-1], points[1:]], axis=1) - - # Create the line collection object, setting the colormapping parameters. - # Have to set the actual values used for colormapping separately. - lc = LineCollection(segments, cmap=cmap, norm=norm) - lc.set_array(z) - lc.set_linewidth(3) - - fig1 = plt.figure() - plt.gca().add_collection(lc) - plt.xlim(x.min(), x.max()) - plt.ylim(-1.1, 1.1) - - # Now do a second plot coloring the curve using a continuous colormap - t = np.linspace(0, 10, 200) - x = np.cos(np.pi * t) - y = np.sin(t) - points = np.array([x, y]).T.reshape(-1, 1, 2) - segments = np.concatenate([points[:-1], points[1:]], axis=1) - - lc = LineCollection(segments, cmap=plt.get_cmap('copper'), - norm=plt.Normalize(0, 10)) - lc.set_array(t) - lc.set_linewidth(3) - - fig2 = plt.figure() - plt.gca().add_collection(lc) - plt.xlim(-1, 1) - plt.ylim(-1, 1) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/multiline.rst.txt b/_sources/examples/pylab_examples/multiline.rst.txt deleted file mode 100644 index 0699e40196d..00000000000 --- a/_sources/examples/pylab_examples/multiline.rst.txt +++ /dev/null @@ -1,54 +0,0 @@ -.. _pylab_examples-multiline: - -pylab_examples example code: multiline.py -========================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/multiline.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - plt.figure(figsize=(7, 4)) - ax = plt.subplot(121) - ax.set_aspect(1) - plt.plot(np.arange(10)) - plt.xlabel('this is a xlabel\n(with newlines!)') - plt.ylabel('this is vertical\ntest', multialignment='center') - plt.text(2, 7, 'this is\nyet another test', - rotation=45, - horizontalalignment='center', - verticalalignment='top', - multialignment='center') - - plt.grid(True) - - plt.subplot(122) - - plt.text(0.29, 0.4, "Mat\nTTp\n123", size=18, - va="baseline", ha="right", multialignment="left", - bbox=dict(fc="none")) - - plt.text(0.34, 0.4, "Mag\nTTT\n123", size=18, - va="baseline", ha="left", multialignment="left", - bbox=dict(fc="none")) - - plt.text(0.95, 0.4, "Mag\nTTT$^{A^A}$\n123", size=18, - va="baseline", ha="right", multialignment="left", - bbox=dict(fc="none")) - - plt.xticks([0.2, 0.4, 0.6, 0.8, 1.], - ["Jan\n2009", "Feb\n2009", "Mar\n2009", "Apr\n2009", "May\n2009"]) - - plt.axhline(0.4) - plt.title("test line spacing for multiline text") - - plt.subplots_adjust(bottom=0.25, top=0.75) - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/multiline.txt b/_sources/examples/pylab_examples/multiline.txt deleted file mode 100644 index f206beaf735..00000000000 --- a/_sources/examples/pylab_examples/multiline.txt +++ /dev/null @@ -1,54 +0,0 @@ -.. _pylab_examples-multiline: - -pylab_examples example code: multiline.py -========================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/multiline.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - plt.figure(figsize=(7, 4)) - ax = plt.subplot(121) - ax.set_aspect(1) - plt.plot(np.arange(10)) - plt.xlabel('this is a xlabel\n(with newlines!)') - plt.ylabel('this is vertical\ntest', multialignment='center') - plt.text(2, 7, 'this is\nyet another test', - rotation=45, - horizontalalignment='center', - verticalalignment='top', - multialignment='center') - - plt.grid(True) - - plt.subplot(122) - - plt.text(0.29, 0.7, "Mat\nTTp\n123", size=18, - va="baseline", ha="right", multialignment="left", - bbox=dict(fc="none")) - - plt.text(0.34, 0.7, "Mag\nTTT\n123", size=18, - va="baseline", ha="left", multialignment="left", - bbox=dict(fc="none")) - - plt.text(0.95, 0.7, "Mag\nTTT$^{A^A}$\n123", size=18, - va="baseline", ha="right", multialignment="left", - bbox=dict(fc="none")) - - plt.xticks([0.2, 0.4, 0.6, 0.8, 1.], - ["Jan\n2009", "Feb\n2009", "Mar\n2009", "Apr\n2009", "May\n2009"]) - - plt.axhline(0.7) - plt.title("test line spacing for multiline text") - - plt.subplots_adjust(bottom=0.25, top=0.8) - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/multipage_pdf.rst.txt b/_sources/examples/pylab_examples/multipage_pdf.rst.txt deleted file mode 100644 index fb39ef89004..00000000000 --- a/_sources/examples/pylab_examples/multipage_pdf.rst.txt +++ /dev/null @@ -1,59 +0,0 @@ -.. _pylab_examples-multipage_pdf: - -pylab_examples example code: multipage_pdf.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/multipage_pdf.py - -:: - - """ - This is a demo of creating a pdf file with several pages, - as well as adding metadata and annotations to pdf files. - """ - - import datetime - import numpy as np - from matplotlib.backends.backend_pdf import PdfPages - import matplotlib.pyplot as plt - - # Create the PdfPages object to which we will save the pages: - # The with statement makes sure that the PdfPages object is closed properly at - # the end of the block, even if an Exception occurs. - with PdfPages('multipage_pdf.pdf') as pdf: - plt.figure(figsize=(3, 3)) - plt.plot(range(7), [3, 1, 4, 1, 5, 9, 2], 'r-o') - plt.title('Page One') - pdf.savefig() # saves the current figure into a pdf page - plt.close() - - plt.rc('text', usetex=True) - plt.figure(figsize=(8, 6)) - x = np.arange(0, 5, 0.1) - plt.plot(x, np.sin(x), 'b-') - plt.title('Page Two') - pdf.attach_note("plot of sin(x)") # you can add a pdf note to - # attach metadata to a page - pdf.savefig() - plt.close() - - plt.rc('text', usetex=False) - fig = plt.figure(figsize=(4, 5)) - plt.plot(x, x*x, 'ko') - plt.title('Page Three') - pdf.savefig(fig) # or you can pass a Figure object to pdf.savefig - plt.close() - - # We can also set the file's metadata via the PdfPages object: - d = pdf.infodict() - d['Title'] = 'Multipage PDF Example' - d['Author'] = u'Jouni K. Sepp\xe4nen' - d['Subject'] = 'How to create a multipage pdf file and set its metadata' - d['Keywords'] = 'PdfPages multipage keywords author title subject' - d['CreationDate'] = datetime.datetime(2009, 11, 13) - d['ModDate'] = datetime.datetime.today() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/multipage_pdf.txt b/_sources/examples/pylab_examples/multipage_pdf.txt deleted file mode 100644 index 2d0a1ccb1ae..00000000000 --- a/_sources/examples/pylab_examples/multipage_pdf.txt +++ /dev/null @@ -1,59 +0,0 @@ -.. _pylab_examples-multipage_pdf: - -pylab_examples example code: multipage_pdf.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/multipage_pdf.py - -:: - - """ - This is a demo of creating a pdf file with several pages, - as well as adding metadata and annotations to pdf files. - """ - - import datetime - import numpy as np - from matplotlib.backends.backend_pdf import PdfPages - import matplotlib.pyplot as plt - - # Create the PdfPages object to which we will save the pages: - # The with statement makes sure that the PdfPages object is closed properly at - # the end of the block, even if an Exception occurs. - with PdfPages('multipage_pdf.pdf') as pdf: - plt.figure(figsize=(3, 3)) - plt.plot(range(7), [3, 1, 4, 1, 5, 9, 2], 'r-o') - plt.title('Page One') - pdf.savefig() # saves the current figure into a pdf page - plt.close() - - plt.rc('text', usetex=True) - plt.figure(figsize=(8, 6)) - x = np.arange(0, 5, 0.1) - plt.plot(x, np.sin(x), 'b-') - plt.title('Page Two') - pdf.attach_note("plot of sin(x)") # you can add a pdf note to - # attach metadata to a page - pdf.savefig() - plt.close() - - plt.rc('text', usetex=False) - fig = plt.figure(figsize=(4, 5)) - plt.plot(x, x*x, 'ko') - plt.title('Page Three') - pdf.savefig(fig) # or you can pass a Figure object to pdf.savefig - plt.close() - - # We can also set the file's metadata via the PdfPages object: - d = pdf.infodict() - d['Title'] = 'Multipage PDF Example' - d['Author'] = u'Jouni K. Sepp\xe4nen' - d['Subject'] = 'How to create a multipage pdf file and set its metadata' - d['Keywords'] = 'PdfPages multipage keywords author title subject' - d['CreationDate'] = datetime.datetime(2009, 11, 13) - d['ModDate'] = datetime.datetime.today() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/multiple_figs_demo.rst.txt b/_sources/examples/pylab_examples/multiple_figs_demo.rst.txt deleted file mode 100644 index 904c897b918..00000000000 --- a/_sources/examples/pylab_examples/multiple_figs_demo.rst.txt +++ /dev/null @@ -1,39 +0,0 @@ -.. _pylab_examples-multiple_figs_demo: - -pylab_examples example code: multiple_figs_demo.py -================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/multiple_figs_demo.py - -:: - - # Working with multiple figure windows and subplots - import matplotlib.pyplot as plt - import numpy as np - - t = np.arange(0.0, 2.0, 0.01) - s1 = np.sin(2*np.pi*t) - s2 = np.sin(4*np.pi*t) - - plt.figure(1) - plt.subplot(211) - plt.plot(t, s1) - plt.subplot(212) - plt.plot(t, 2*s1) - - plt.figure(2) - plt.plot(t, s2) - - # now switch back to figure 1 and make some changes - plt.figure(1) - plt.subplot(211) - plt.plot(t, s2, 's') - ax = plt.gca() - ax.set_xticklabels([]) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/multiple_figs_demo.txt b/_sources/examples/pylab_examples/multiple_figs_demo.txt deleted file mode 100644 index ee157152d4c..00000000000 --- a/_sources/examples/pylab_examples/multiple_figs_demo.txt +++ /dev/null @@ -1,39 +0,0 @@ -.. _pylab_examples-multiple_figs_demo: - -pylab_examples example code: multiple_figs_demo.py -================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/multiple_figs_demo.py - -:: - - # Working with multiple figure windows and subplots - import matplotlib.pyplot as plt - import numpy as np - - t = np.arange(0.0, 2.0, 0.01) - s1 = np.sin(2*np.pi*t) - s2 = np.sin(4*np.pi*t) - - plt.figure(1) - plt.subplot(211) - plt.plot(t, s1) - plt.subplot(212) - plt.plot(t, 2*s1) - - plt.figure(2) - plt.plot(t, s2) - - # now switch back to figure 1 and make some changes - plt.figure(1) - plt.subplot(211) - plt.plot(t, s2, 'gs') - ax = plt.gca() - ax.set_xticklabels([]) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/multiple_yaxis_with_spines.rst.txt b/_sources/examples/pylab_examples/multiple_yaxis_with_spines.rst.txt deleted file mode 100644 index 855d11d91d1..00000000000 --- a/_sources/examples/pylab_examples/multiple_yaxis_with_spines.rst.txt +++ /dev/null @@ -1,68 +0,0 @@ -.. _pylab_examples-multiple_yaxis_with_spines: - -pylab_examples example code: multiple_yaxis_with_spines.py -========================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/multiple_yaxis_with_spines.py - -:: - - import matplotlib.pyplot as plt - - - def make_patch_spines_invisible(ax): - ax.set_frame_on(True) - ax.patch.set_visible(False) - for sp in ax.spines.values(): - sp.set_visible(False) - - fig, host = plt.subplots() - fig.subplots_adjust(right=0.75) - - par1 = host.twinx() - par2 = host.twinx() - - # Offset the right spine of par2. The ticks and label have already been - # placed on the right by twinx above. - par2.spines["right"].set_position(("axes", 1.2)) - # Having been created by twinx, par2 has its frame off, so the line of its - # detached spine is invisible. First, activate the frame but make the patch - # and spines invisible. - make_patch_spines_invisible(par2) - # Second, show the right spine. - par2.spines["right"].set_visible(True) - - p1, = host.plot([0, 1, 2], [0, 1, 2], "b-", label="Density") - p2, = par1.plot([0, 1, 2], [0, 3, 2], "r-", label="Temperature") - p3, = par2.plot([0, 1, 2], [50, 30, 15], "g-", label="Velocity") - - host.set_xlim(0, 2) - host.set_ylim(0, 2) - par1.set_ylim(0, 4) - par2.set_ylim(1, 65) - - host.set_xlabel("Distance") - host.set_ylabel("Density") - par1.set_ylabel("Temperature") - par2.set_ylabel("Velocity") - - host.yaxis.label.set_color(p1.get_color()) - par1.yaxis.label.set_color(p2.get_color()) - par2.yaxis.label.set_color(p3.get_color()) - - tkw = dict(size=4, width=1.5) - host.tick_params(axis='y', colors=p1.get_color(), **tkw) - par1.tick_params(axis='y', colors=p2.get_color(), **tkw) - par2.tick_params(axis='y', colors=p3.get_color(), **tkw) - host.tick_params(axis='x', **tkw) - - lines = [p1, p2, p3] - - host.legend(lines, [l.get_label() for l in lines]) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/multiple_yaxis_with_spines.txt b/_sources/examples/pylab_examples/multiple_yaxis_with_spines.txt deleted file mode 100644 index 87f79bef47c..00000000000 --- a/_sources/examples/pylab_examples/multiple_yaxis_with_spines.txt +++ /dev/null @@ -1,68 +0,0 @@ -.. _pylab_examples-multiple_yaxis_with_spines: - -pylab_examples example code: multiple_yaxis_with_spines.py -========================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/multiple_yaxis_with_spines.py - -:: - - import matplotlib.pyplot as plt - - - def make_patch_spines_invisible(ax): - ax.set_frame_on(True) - ax.patch.set_visible(False) - for sp in ax.spines.values(): - sp.set_visible(False) - - fig, host = plt.subplots() - fig.subplots_adjust(right=0.75) - - par1 = host.twinx() - par2 = host.twinx() - - # Offset the right spine of par2. The ticks and label have already been - # placed on the right by twinx above. - par2.spines["right"].set_position(("axes", 1.2)) - # Having been created by twinx, par2 has its frame off, so the line of its - # detached spine is invisible. First, activate the frame but make the patch - # and spines invisible. - make_patch_spines_invisible(par2) - # Second, show the right spine. - par2.spines["right"].set_visible(True) - - p1, = host.plot([0, 1, 2], [0, 1, 2], "b-", label="Density") - p2, = par1.plot([0, 1, 2], [0, 3, 2], "r-", label="Temperature") - p3, = par2.plot([0, 1, 2], [50, 30, 15], "g-", label="Velocity") - - host.set_xlim(0, 2) - host.set_ylim(0, 2) - par1.set_ylim(0, 4) - par2.set_ylim(1, 65) - - host.set_xlabel("Distance") - host.set_ylabel("Density") - par1.set_ylabel("Temperature") - par2.set_ylabel("Velocity") - - host.yaxis.label.set_color(p1.get_color()) - par1.yaxis.label.set_color(p2.get_color()) - par2.yaxis.label.set_color(p3.get_color()) - - tkw = dict(size=4, width=1.5) - host.tick_params(axis='y', colors=p1.get_color(), **tkw) - par1.tick_params(axis='y', colors=p2.get_color(), **tkw) - par2.tick_params(axis='y', colors=p3.get_color(), **tkw) - host.tick_params(axis='x', **tkw) - - lines = [p1, p2, p3] - - host.legend(lines, [l.get_label() for l in lines]) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/nan_test.rst.txt b/_sources/examples/pylab_examples/nan_test.rst.txt deleted file mode 100644 index b0ea54b6306..00000000000 --- a/_sources/examples/pylab_examples/nan_test.rst.txt +++ /dev/null @@ -1,43 +0,0 @@ -.. _pylab_examples-nan_test: - -pylab_examples example code: nan_test.py -======================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/nan_test.py - -:: - - """ - Example: simple line plots with NaNs inserted. - """ - import numpy as np - import matplotlib.pyplot as plt - - t = np.arange(0.0, 1.0 + 0.01, 0.01) - s = np.cos(2 * 2 * np.pi * t) - t[41:60] = np.nan - - plt.subplot(2, 1, 1) - plt.plot(t, s, '-', lw=2) - - plt.xlabel('time (s)') - plt.ylabel('voltage (mV)') - plt.title('A sine wave with a gap of NaNs between 0.4 and 0.6') - plt.grid(True) - - plt.subplot(2, 1, 2) - t[0] = np.nan - t[-1] = np.nan - plt.plot(t, s, '-', lw=2) - plt.title('Also with NaN in first and last point') - - plt.xlabel('time (s)') - plt.ylabel('more nans') - plt.grid(True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/nan_test.txt b/_sources/examples/pylab_examples/nan_test.txt deleted file mode 100644 index e294ae543e5..00000000000 --- a/_sources/examples/pylab_examples/nan_test.txt +++ /dev/null @@ -1,43 +0,0 @@ -.. _pylab_examples-nan_test: - -pylab_examples example code: nan_test.py -======================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/nan_test.py - -:: - - """ - Example: simple line plots with NaNs inserted. - """ - import numpy as np - import matplotlib.pyplot as plt - - t = np.arange(0.0, 1.0 + 0.01, 0.01) - s = np.cos(2 * 2 * np.pi * t) - t[41:60] = np.nan - - plt.subplot(2, 1, 1) - plt.plot(t, s, '-', lw=2) - - plt.xlabel('time (s)') - plt.ylabel('voltage (mV)') - plt.title('A sine wave with a gap of NaNs between 0.4 and 0.6') - plt.grid(True) - - plt.subplot(2, 1, 2) - t[0] = np.nan - t[-1] = np.nan - plt.plot(t, s, '-', lw=2) - plt.title('Also with NaN in first and last point') - - plt.xlabel('time (s)') - plt.ylabel('more nans') - plt.grid(True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/newscalarformatter_demo.rst.txt b/_sources/examples/pylab_examples/newscalarformatter_demo.rst.txt deleted file mode 100644 index aaa80dcbc3c..00000000000 --- a/_sources/examples/pylab_examples/newscalarformatter_demo.rst.txt +++ /dev/null @@ -1,117 +0,0 @@ -.. _pylab_examples-newscalarformatter_demo: - -pylab_examples example code: newscalarformatter_demo.py -======================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/newscalarformatter_demo.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - from matplotlib.ticker import OldScalarFormatter, ScalarFormatter - - # Example 1 - x = np.arange(0, 1, .01) - fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6)) - fig.text(0.5, 0.975, 'The old formatter', - horizontalalignment='center', verticalalignment='top') - ax1.plot(x * 1e5 + 1e10, x * 1e-10 + 1e-5) - ax1.xaxis.set_major_formatter(OldScalarFormatter()) - ax1.yaxis.set_major_formatter(OldScalarFormatter()) - - ax2.plot(x * 1e5, x * 1e-4) - ax2.xaxis.set_major_formatter(OldScalarFormatter()) - ax2.yaxis.set_major_formatter(OldScalarFormatter()) - - ax3.plot(-x * 1e5 - 1e10, -x * 1e-5 - 1e-10) - ax3.xaxis.set_major_formatter(OldScalarFormatter()) - ax3.yaxis.set_major_formatter(OldScalarFormatter()) - - ax4.plot(-x * 1e5, -x * 1e-4) - ax4.xaxis.set_major_formatter(OldScalarFormatter()) - ax4.yaxis.set_major_formatter(OldScalarFormatter()) - - fig.subplots_adjust(wspace=0.7, hspace=0.6) - - # Example 2 - x = np.arange(0, 1, .01) - fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6)) - fig.text(0.5, 0.975, 'The new formatter, default settings', - horizontalalignment='center', - verticalalignment='top') - - ax1.plot(x * 1e5 + 1e10, x * 1e-10 + 1e-5) - ax1.xaxis.set_major_formatter(ScalarFormatter()) - ax1.yaxis.set_major_formatter(ScalarFormatter()) - - ax2.plot(x * 1e5, x * 1e-4) - ax2.xaxis.set_major_formatter(ScalarFormatter()) - ax2.yaxis.set_major_formatter(ScalarFormatter()) - - ax3.plot(-x * 1e5 - 1e10, -x * 1e-5 - 1e-10) - ax3.xaxis.set_major_formatter(ScalarFormatter()) - ax3.yaxis.set_major_formatter(ScalarFormatter()) - - ax4.plot(-x * 1e5, -x * 1e-4) - ax4.xaxis.set_major_formatter(ScalarFormatter()) - ax4.yaxis.set_major_formatter(ScalarFormatter()) - - fig.subplots_adjust(wspace=0.7, hspace=0.6) - - # Example 3 - x = np.arange(0, 1, .01) - fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6)) - fig.text(0.5, 0.975, 'The new formatter, no numerical offset', - horizontalalignment='center', - verticalalignment='top') - - ax1.plot(x * 1e5 + 1e10, x * 1e-10 + 1e-5) - ax1.xaxis.set_major_formatter(ScalarFormatter(useOffset=False)) - ax1.yaxis.set_major_formatter(ScalarFormatter(useOffset=False)) - - ax2.plot(x * 1e5, x * 1e-4) - ax2.xaxis.set_major_formatter(ScalarFormatter(useOffset=False)) - ax2.yaxis.set_major_formatter(ScalarFormatter(useOffset=False)) - - ax3.plot(-x * 1e5 - 1e10, -x * 1e-5 - 1e-10) - ax3.xaxis.set_major_formatter(ScalarFormatter(useOffset=False)) - ax3.yaxis.set_major_formatter(ScalarFormatter(useOffset=False)) - - ax4.plot(-x * 1e5, -x * 1e-4) - ax4.xaxis.set_major_formatter(ScalarFormatter(useOffset=False)) - ax4.yaxis.set_major_formatter(ScalarFormatter(useOffset=False)) - - fig.subplots_adjust(wspace=0.7, hspace=0.6) - - # Example 4 - x = np.arange(0, 1, .01) - fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6)) - fig.text(0.5, 0.975, 'The new formatter, with mathtext', - horizontalalignment='center', - verticalalignment='top') - - ax1.plot(x * 1e5 + 1e10, x * 1e-10 + 1e-5) - ax1.xaxis.set_major_formatter(ScalarFormatter(useMathText=True)) - ax1.yaxis.set_major_formatter(ScalarFormatter(useMathText=True)) - - ax2.plot(x * 1e5, x * 1e-4) - ax2.xaxis.set_major_formatter(ScalarFormatter(useMathText=True)) - ax2.yaxis.set_major_formatter(ScalarFormatter(useMathText=True)) - - ax3.plot(-x * 1e5 - 1e10, -x * 1e-5 - 1e-10) - ax3.xaxis.set_major_formatter(ScalarFormatter(useMathText=True)) - ax3.yaxis.set_major_formatter(ScalarFormatter(useMathText=True)) - - ax4.plot(-x * 1e5, -x * 1e-4) - ax4.xaxis.set_major_formatter(ScalarFormatter(useMathText=True)) - ax4.yaxis.set_major_formatter(ScalarFormatter(useMathText=True)) - - fig.subplots_adjust(wspace=0.7, hspace=0.6) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/newscalarformatter_demo.txt b/_sources/examples/pylab_examples/newscalarformatter_demo.txt deleted file mode 100644 index 2eece2bc212..00000000000 --- a/_sources/examples/pylab_examples/newscalarformatter_demo.txt +++ /dev/null @@ -1,108 +0,0 @@ -.. _pylab_examples-newscalarformatter_demo: - -pylab_examples example code: newscalarformatter_demo.py -======================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/newscalarformatter_demo.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - from matplotlib.ticker import OldScalarFormatter, ScalarFormatter - - # Example 1 - x = np.arange(0, 1, .01) - fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6)) - fig.text(0.5, 0.975, 'The old formatter', - horizontalalignment='center', verticalalignment='top') - ax1.plot(x * 1e5 + 1e10, x * 1e-10 + 1e-5) - ax1.xaxis.set_major_formatter(OldScalarFormatter()) - ax1.yaxis.set_major_formatter(OldScalarFormatter()) - - ax2.plot(x * 1e5, x * 1e-4) - ax2.xaxis.set_major_formatter(OldScalarFormatter()) - ax2.yaxis.set_major_formatter(OldScalarFormatter()) - - ax3.plot(-x * 1e5 - 1e10, -x * 1e-5 - 1e-10) - ax3.xaxis.set_major_formatter(OldScalarFormatter()) - ax3.yaxis.set_major_formatter(OldScalarFormatter()) - - ax4.plot(-x * 1e5, -x * 1e-4) - ax4.xaxis.set_major_formatter(OldScalarFormatter()) - ax4.yaxis.set_major_formatter(OldScalarFormatter()) - - # Example 2 - x = np.arange(0, 1, .01) - fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6)) - fig.text(0.5, 0.975, 'The new formatter, default settings', - horizontalalignment='center', - verticalalignment='top') - - ax1.plot(x * 1e5 + 1e10, x * 1e-10 + 1e-5) - ax1.xaxis.set_major_formatter(ScalarFormatter()) - ax1.yaxis.set_major_formatter(ScalarFormatter()) - - ax2.plot(x * 1e5, x * 1e-4) - ax2.xaxis.set_major_formatter(ScalarFormatter()) - ax2.yaxis.set_major_formatter(ScalarFormatter()) - - ax3.plot(-x * 1e5 - 1e10, -x * 1e-5 - 1e-10) - ax3.xaxis.set_major_formatter(ScalarFormatter()) - ax3.yaxis.set_major_formatter(ScalarFormatter()) - - ax4.plot(-x * 1e5, -x * 1e-4) - ax4.xaxis.set_major_formatter(ScalarFormatter()) - ax4.yaxis.set_major_formatter(ScalarFormatter()) - - # Example 3 - x = np.arange(0, 1, .01) - fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6)) - fig.text(0.5, 0.975, 'The new formatter, no numerical offset', - horizontalalignment='center', - verticalalignment='top') - - ax1.plot(x * 1e5 + 1e10, x * 1e-10 + 1e-5) - ax1.xaxis.set_major_formatter(ScalarFormatter(useOffset=False)) - ax1.yaxis.set_major_formatter(ScalarFormatter(useOffset=False)) - - ax2.plot(x * 1e5, x * 1e-4) - ax2.xaxis.set_major_formatter(ScalarFormatter(useOffset=False)) - ax2.yaxis.set_major_formatter(ScalarFormatter(useOffset=False)) - - ax3.plot(-x * 1e5 - 1e10, -x * 1e-5 - 1e-10) - ax3.xaxis.set_major_formatter(ScalarFormatter(useOffset=False)) - ax3.yaxis.set_major_formatter(ScalarFormatter(useOffset=False)) - - ax4.plot(-x * 1e5, -x * 1e-4) - ax4.xaxis.set_major_formatter(ScalarFormatter(useOffset=False)) - ax4.yaxis.set_major_formatter(ScalarFormatter(useOffset=False)) - - # Example 4 - x = np.arange(0, 1, .01) - fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6)) - fig.text(0.5, 0.975, 'The new formatter, with mathtext', - horizontalalignment='center', - verticalalignment='top') - - ax1.plot(x * 1e5 + 1e10, x * 1e-10 + 1e-5) - ax1.xaxis.set_major_formatter(ScalarFormatter(useMathText=True)) - ax1.yaxis.set_major_formatter(ScalarFormatter(useMathText=True)) - - ax2.plot(x * 1e5, x * 1e-4) - ax2.xaxis.set_major_formatter(ScalarFormatter(useMathText=True)) - ax2.yaxis.set_major_formatter(ScalarFormatter(useMathText=True)) - - ax3.plot(-x * 1e5 - 1e10, -x * 1e-5 - 1e-10) - ax3.xaxis.set_major_formatter(ScalarFormatter(useMathText=True)) - ax3.yaxis.set_major_formatter(ScalarFormatter(useMathText=True)) - - ax4.plot(-x * 1e5, -x * 1e-4) - ax4.xaxis.set_major_formatter(ScalarFormatter(useMathText=True)) - ax4.yaxis.set_major_formatter(ScalarFormatter(useMathText=True)) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/patheffect_demo.rst.txt b/_sources/examples/pylab_examples/patheffect_demo.rst.txt deleted file mode 100644 index 920943592a3..00000000000 --- a/_sources/examples/pylab_examples/patheffect_demo.rst.txt +++ /dev/null @@ -1,57 +0,0 @@ -.. _pylab_examples-patheffect_demo: - -pylab_examples example code: patheffect_demo.py -=============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/patheffect_demo.py - -:: - - import matplotlib.pyplot as plt - import matplotlib.patheffects as PathEffects - import numpy as np - - if 1: - plt.figure(1, figsize=(8, 3)) - ax1 = plt.subplot(131) - ax1.imshow([[1, 2], [2, 3]]) - txt = ax1.annotate("test", (1., 1.), (0., 0), - arrowprops=dict(arrowstyle="->", - connectionstyle="angle3", lw=2), - size=20, ha="center", path_effects=[PathEffects.withStroke(linewidth=3, - foreground="w")]) - txt.arrow_patch.set_path_effects([ - PathEffects.Stroke(linewidth=5, foreground="w"), - PathEffects.Normal()]) - - ax1.grid(True, linestyle="-") - - pe = [PathEffects.withStroke(linewidth=3, - foreground="w")] - for l in ax1.get_xgridlines() + ax1.get_ygridlines(): - l.set_path_effects(pe) - - ax2 = plt.subplot(132) - arr = np.arange(25).reshape((5, 5)) - ax2.imshow(arr) - cntr = ax2.contour(arr, colors="k") - - plt.setp(cntr.collections, path_effects=[ - PathEffects.withStroke(linewidth=3, foreground="w")]) - - clbls = ax2.clabel(cntr, fmt="%2.0f", use_clabeltext=True) - plt.setp(clbls, path_effects=[ - PathEffects.withStroke(linewidth=3, foreground="w")]) - - # shadow as a path effect - ax3 = plt.subplot(133) - p1, = ax3.plot([0, 1], [0, 1]) - leg = ax3.legend([p1], ["Line 1"], fancybox=True, loc=2) - leg.legendPatch.set_path_effects([PathEffects.withSimplePatchShadow()]) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/patheffect_demo.txt b/_sources/examples/pylab_examples/patheffect_demo.txt deleted file mode 100644 index 0cec0b1b24a..00000000000 --- a/_sources/examples/pylab_examples/patheffect_demo.txt +++ /dev/null @@ -1,57 +0,0 @@ -.. _pylab_examples-patheffect_demo: - -pylab_examples example code: patheffect_demo.py -=============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/patheffect_demo.py - -:: - - import matplotlib.pyplot as plt - import matplotlib.patheffects as PathEffects - import numpy as np - - if 1: - plt.figure(1, figsize=(8, 3)) - ax1 = plt.subplot(131) - ax1.imshow([[1, 2], [2, 3]]) - txt = ax1.annotate("test", (1., 1.), (0., 0), - arrowprops=dict(arrowstyle="->", - connectionstyle="angle3", lw=2), - size=20, ha="center", path_effects=[PathEffects.withStroke(linewidth=3, - foreground="w")]) - txt.arrow_patch.set_path_effects([ - PathEffects.Stroke(linewidth=5, foreground="w"), - PathEffects.Normal()]) - - ax1.grid(True, linestyle="-") - - pe = [PathEffects.withStroke(linewidth=3, - foreground="w")] - for l in ax1.get_xgridlines() + ax1.get_ygridlines(): - l.set_path_effects(pe) - - ax2 = plt.subplot(132) - arr = np.arange(25).reshape((5, 5)) - ax2.imshow(arr) - cntr = ax2.contour(arr, colors="k") - - plt.setp(cntr.collections, path_effects=[ - PathEffects.withStroke(linewidth=3, foreground="w")]) - - clbls = ax2.clabel(cntr, fmt="%2.0f", use_clabeltext=True) - plt.setp(clbls, path_effects=[ - PathEffects.withStroke(linewidth=3, foreground="w")]) - - # shadow as a path effect - ax3 = plt.subplot(133) - p1, = ax3.plot([0, 1], [0, 1]) - leg = ax3.legend([p1], ["Line 1"], fancybox=True, loc=2) - leg.legendPatch.set_path_effects([PathEffects.withSimplePatchShadow()]) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/pcolor_demo.rst.txt b/_sources/examples/pylab_examples/pcolor_demo.rst.txt deleted file mode 100644 index 41840c480f6..00000000000 --- a/_sources/examples/pylab_examples/pcolor_demo.rst.txt +++ /dev/null @@ -1,67 +0,0 @@ -.. _pylab_examples-pcolor_demo: - -pylab_examples example code: pcolor_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/pcolor_demo.py - -:: - - """ - Demonstrates similarities between pcolor, pcolormesh, imshow and pcolorfast - for drawing quadrilateral grids. - - """ - import matplotlib.pyplot as plt - import numpy as np - - # make these smaller to increase the resolution - dx, dy = 0.15, 0.05 - - # generate 2 2d grids for the x & y bounds - y, x = np.mgrid[slice(-3, 3 + dy, dy), - slice(-3, 3 + dx, dx)] - z = (1 - x / 2. + x ** 5 + y ** 3) * np.exp(-x ** 2 - y ** 2) - # x and y are bounds, so z should be the value *inside* those bounds. - # Therefore, remove the last value from the z array. - z = z[:-1, :-1] - z_min, z_max = -np.abs(z).max(), np.abs(z).max() - - - plt.subplot(2, 2, 1) - plt.pcolor(x, y, z, cmap='RdBu', vmin=z_min, vmax=z_max) - plt.title('pcolor') - # set the limits of the plot to the limits of the data - plt.axis([x.min(), x.max(), y.min(), y.max()]) - plt.colorbar() - - - plt.subplot(2, 2, 2) - plt.pcolormesh(x, y, z, cmap='RdBu', vmin=z_min, vmax=z_max) - plt.title('pcolormesh') - # set the limits of the plot to the limits of the data - plt.axis([x.min(), x.max(), y.min(), y.max()]) - plt.colorbar() - - - plt.subplot(2, 2, 3) - plt.imshow(z, cmap='RdBu', vmin=z_min, vmax=z_max, - extent=[x.min(), x.max(), y.min(), y.max()], - interpolation='nearest', origin='lower') - plt.title('image (nearest)') - plt.colorbar() - - - ax = plt.subplot(2, 2, 4) - ax.pcolorfast(x, y, z, cmap='RdBu', vmin=z_min, vmax=z_max) - plt.title('pcolorfast') - plt.colorbar() - - plt.subplots_adjust(wspace=0.5, hspace=0.5) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/pcolor_demo.txt b/_sources/examples/pylab_examples/pcolor_demo.txt deleted file mode 100644 index 6cb2faae873..00000000000 --- a/_sources/examples/pylab_examples/pcolor_demo.txt +++ /dev/null @@ -1,66 +0,0 @@ -.. _pylab_examples-pcolor_demo: - -pylab_examples example code: pcolor_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/pcolor_demo.py - -:: - - """ - Demonstrates similarities between pcolor, pcolormesh, imshow and pcolorfast - for drawing quadrilateral grids. - - """ - import matplotlib.pyplot as plt - import numpy as np - - # make these smaller to increase the resolution - dx, dy = 0.15, 0.05 - - # generate 2 2d grids for the x & y bounds - y, x = np.mgrid[slice(-3, 3 + dy, dy), - slice(-3, 3 + dx, dx)] - z = (1 - x / 2. + x ** 5 + y ** 3) * np.exp(-x ** 2 - y ** 2) - # x and y are bounds, so z should be the value *inside* those bounds. - # Therefore, remove the last value from the z array. - z = z[:-1, :-1] - z_min, z_max = -np.abs(z).max(), np.abs(z).max() - - - plt.subplot(2, 2, 1) - plt.pcolor(x, y, z, cmap='RdBu', vmin=z_min, vmax=z_max) - plt.title('pcolor') - # set the limits of the plot to the limits of the data - plt.axis([x.min(), x.max(), y.min(), y.max()]) - plt.colorbar() - - - plt.subplot(2, 2, 2) - plt.pcolormesh(x, y, z, cmap='RdBu', vmin=z_min, vmax=z_max) - plt.title('pcolormesh') - # set the limits of the plot to the limits of the data - plt.axis([x.min(), x.max(), y.min(), y.max()]) - plt.colorbar() - - - plt.subplot(2, 2, 3) - plt.imshow(z, cmap='RdBu', vmin=z_min, vmax=z_max, - extent=[x.min(), x.max(), y.min(), y.max()], - interpolation='nearest', origin='lower') - plt.title('image (interp. nearest)') - plt.colorbar() - - - ax = plt.subplot(2, 2, 4) - ax.pcolorfast(x, y, z, cmap='RdBu', vmin=z_min, vmax=z_max) - plt.title('pcolorfast') - plt.colorbar() - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/pcolor_demo2.txt b/_sources/examples/pylab_examples/pcolor_demo2.txt deleted file mode 100644 index e159dd5f093..00000000000 --- a/_sources/examples/pylab_examples/pcolor_demo2.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _pylab_examples-pcolor_demo2: - -pylab_examples example code: pcolor_demo2.py -============================================ - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/pcolor_demo2.py - -:: - - #!/usr/bin/env python - """ - See pcolor_demo2 for a much faster way of generating pcolor plots - """ - from __future__ import division - from pylab import * - - def func3(x,y): - return (1- x/2 + x**5 + y**3)*exp(-x**2-y**2) - - - # make these smaller to increase the resolution - dx, dy = 0.05, 0.05 - - x = arange(-3.0, 3.0, dx) - y = arange(-3.0, 3.0, dy) - X,Y = meshgrid(x, y) - - Z = func3(X, Y) - - - ax = subplot(111) - im = imshow(Z, cmap=cm.RdBu, vmax=abs(Z).max(), vmin=-abs(Z).max()) - #im.set_interpolation('nearest') - #im.set_interpolation('bicubic') - im.set_interpolation('bilinear') - #ax.set_image_extent(-3, 3, -3, 3) - - show() - - - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/pcolor_log.rst.txt b/_sources/examples/pylab_examples/pcolor_log.rst.txt deleted file mode 100644 index 86808f6a910..00000000000 --- a/_sources/examples/pylab_examples/pcolor_log.rst.txt +++ /dev/null @@ -1,38 +0,0 @@ -.. _pylab_examples-pcolor_log: - -pylab_examples example code: pcolor_log.py -========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/pcolor_log.py - -:: - - import matplotlib.pyplot as plt - from matplotlib.colors import LogNorm - import numpy as np - from matplotlib.mlab import bivariate_normal - - - N = 100 - X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)] - - # A low hump with a spike coming out of the top right. - # Needs to have z/colour axis on a log scale so we see both hump and spike. - # linear scale only shows the spike. - Z1 = bivariate_normal(X, Y, 0.1, 0.2, 1.0, 1.0) + 0.1 * bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - - plt.subplot(2, 1, 1) - plt.pcolor(X, Y, Z1, norm=LogNorm(vmin=Z1.min(), vmax=Z1.max()), cmap='PuBu_r') - plt.colorbar() - - plt.subplot(2, 1, 2) - plt.pcolor(X, Y, Z1, cmap='PuBu_r') - plt.colorbar() - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/pcolor_log.txt b/_sources/examples/pylab_examples/pcolor_log.txt deleted file mode 100644 index 88830006f05..00000000000 --- a/_sources/examples/pylab_examples/pcolor_log.txt +++ /dev/null @@ -1,38 +0,0 @@ -.. _pylab_examples-pcolor_log: - -pylab_examples example code: pcolor_log.py -========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/pcolor_log.py - -:: - - import matplotlib.pyplot as plt - from matplotlib.colors import LogNorm - import numpy as np - from matplotlib.mlab import bivariate_normal - - - N = 100 - X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)] - - # A low hump with a spike coming out of the top right. - # Needs to have z/colour axis on a log scale so we see both hump and spike. - # linear scale only shows the spike. - Z1 = bivariate_normal(X, Y, 0.1, 0.2, 1.0, 1.0) + 0.1 * bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - - plt.subplot(2, 1, 1) - plt.pcolor(X, Y, Z1, norm=LogNorm(vmin=Z1.min(), vmax=Z1.max()), cmap='PuBu_r') - plt.colorbar() - - plt.subplot(2, 1, 2) - plt.pcolor(X, Y, Z1, cmap='PuBu_r') - plt.colorbar() - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/pcolor_small.rst.txt b/_sources/examples/pylab_examples/pcolor_small.rst.txt deleted file mode 100644 index 28e831028ea..00000000000 --- a/_sources/examples/pylab_examples/pcolor_small.rst.txt +++ /dev/null @@ -1,28 +0,0 @@ -.. _pylab_examples-pcolor_small: - -pylab_examples example code: pcolor_small.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/pcolor_small.py - -:: - - import matplotlib.pyplot as plt - from numpy.random import rand - - Z = rand(6, 10) - - plt.subplot(2, 1, 1) - c = plt.pcolor(Z) - plt.title('default: no edges') - - plt.subplot(2, 1, 2) - c = plt.pcolor(Z, edgecolors='k', linewidths=4) - plt.title('thick edges') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/pcolor_small.txt b/_sources/examples/pylab_examples/pcolor_small.txt deleted file mode 100644 index 2a3c65da4da..00000000000 --- a/_sources/examples/pylab_examples/pcolor_small.txt +++ /dev/null @@ -1,28 +0,0 @@ -.. _pylab_examples-pcolor_small: - -pylab_examples example code: pcolor_small.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/pcolor_small.py - -:: - - import matplotlib.pyplot as plt - from numpy.random import rand - - Z = rand(6, 10) - - plt.subplot(2, 1, 1) - c = plt.pcolor(Z) - plt.title('default: no edges') - - plt.subplot(2, 1, 2) - c = plt.pcolor(Z, edgecolors='k', linewidths=4) - plt.title('thick edges') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/pie_demo.txt b/_sources/examples/pylab_examples/pie_demo.txt deleted file mode 100644 index 95085723332..00000000000 --- a/_sources/examples/pylab_examples/pie_demo.txt +++ /dev/null @@ -1,44 +0,0 @@ -.. _pylab_examples-pie_demo: - -pylab_examples example code: pie_demo.py -======================================== - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/pie_demo.py - -:: - - """ - Make a pie chart - see - http://matplotlib.sf.net/matplotlib.pylab.html#-pie for the docstring. - - This example shows a basic pie chart with labels optional features, - like autolabeling the percentage, offsetting a slice with "explode", - adding a shadow, and changing the starting angle. - - """ - from pylab import * - - # make a square figure and axes - figure(1, figsize=(6,6)) - ax = axes([0.1, 0.1, 0.8, 0.8]) - - # The slices will be ordered and plotted counter-clockwise. - labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' - fracs = [15, 30, 45, 10] - explode=(0, 0.05, 0, 0) - - pie(fracs, explode=explode, labels=labels, - autopct='%1.1f%%', shadow=True, startangle=90) - # The default startangle is 0, which would start - # the Frogs slice on the x-axis. With startangle=90, - # everything is rotated counter-clockwise by 90 degrees, - # so the plotting starts on the positive y-axis. - - title('Raining Hogs and Dogs', bbox={'facecolor':'0.8', 'pad':5}) - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/pie_demo2.rst.txt b/_sources/examples/pylab_examples/pie_demo2.rst.txt deleted file mode 100644 index 4552fbea085..00000000000 --- a/_sources/examples/pylab_examples/pie_demo2.rst.txt +++ /dev/null @@ -1,71 +0,0 @@ -.. _pylab_examples-pie_demo2: - -pylab_examples example code: pie_demo2.py -========================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/pie_demo2.py - -:: - - """ - Make a pie charts of varying size - see - http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.pie for the docstring. - - This example shows a basic pie charts with labels optional features, - like autolabeling the percentage, offsetting a slice with "explode" - and adding a shadow, in different sizes. - - """ - import matplotlib.pyplot as plt - from matplotlib.gridspec import GridSpec - - # Some data - - labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' - fracs = [15, 30, 45, 10] - - explode = (0, 0.05, 0, 0) - - # Make square figures and axes - - the_grid = GridSpec(2, 2) - - plt.subplot(the_grid[0, 0], aspect=1) - - plt.pie(fracs, labels=labels, autopct='%1.1f%%', shadow=True) - - plt.subplot(the_grid[0, 1], aspect=1) - - plt.pie(fracs, explode=explode, labels=labels, autopct='%.0f%%', shadow=True) - - plt.subplot(the_grid[1, 0], aspect=1) - - patches, texts, autotexts = plt.pie(fracs, labels=labels, - autopct='%.0f%%', - shadow=True, radius=0.5) - - # Make the labels on the small plot easier to read. - for t in texts: - t.set_size('smaller') - for t in autotexts: - t.set_size('x-small') - autotexts[0].set_color('y') - - plt.subplot(the_grid[1, 1], aspect=1) - - # Turn off shadow for tiny plot with exploded slice. - patches, texts, autotexts = plt.pie(fracs, explode=explode, - labels=labels, autopct='%.0f%%', - shadow=False, radius=0.5) - for t in texts: - t.set_size('smaller') - for t in autotexts: - t.set_size('x-small') - autotexts[0].set_color('y') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/pie_demo2.txt b/_sources/examples/pylab_examples/pie_demo2.txt deleted file mode 100644 index ff0330dade8..00000000000 --- a/_sources/examples/pylab_examples/pie_demo2.txt +++ /dev/null @@ -1,71 +0,0 @@ -.. _pylab_examples-pie_demo2: - -pylab_examples example code: pie_demo2.py -========================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/pie_demo2.py - -:: - - """ - Make a pie charts of varying size - see - http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.pie for the docstring. - - This example shows a basic pie charts with labels optional features, - like autolabeling the percentage, offsetting a slice with "explode" - and adding a shadow, in different sizes. - - """ - import matplotlib.pyplot as plt - from matplotlib.gridspec import GridSpec - - # Some data - - labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' - fracs = [15, 30, 45, 10] - - explode = (0, 0.05, 0, 0) - - # Make square figures and axes - - the_grid = GridSpec(2, 2) - - plt.subplot(the_grid[0, 0], aspect=1) - - plt.pie(fracs, labels=labels, autopct='%1.1f%%', shadow=True) - - plt.subplot(the_grid[0, 1], aspect=1) - - plt.pie(fracs, explode=explode, labels=labels, autopct='%.0f%%', shadow=True) - - plt.subplot(the_grid[1, 0], aspect=1) - - patches, texts, autotexts = plt.pie(fracs, labels=labels, - autopct='%.0f%%', - shadow=True, radius=0.5) - - # Make the labels on the small plot easier to read. - for t in texts: - t.set_size('smaller') - for t in autotexts: - t.set_size('x-small') - autotexts[0].set_color('y') - - plt.subplot(the_grid[1, 1], aspect=1) - - # Turn off shadow for tiny plot with exploded slice. - patches, texts, autotexts = plt.pie(fracs, explode=explode, - labels=labels, autopct='%.0f%%', - shadow=False, radius=0.5) - for t in texts: - t.set_size('smaller') - for t in autotexts: - t.set_size('x-small') - autotexts[0].set_color('y') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/plotfile_demo.rst.txt b/_sources/examples/pylab_examples/plotfile_demo.rst.txt deleted file mode 100644 index 0ee5c2c748e..00000000000 --- a/_sources/examples/pylab_examples/plotfile_demo.rst.txt +++ /dev/null @@ -1,53 +0,0 @@ -.. _pylab_examples-plotfile_demo: - -pylab_examples example code: plotfile_demo.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/plotfile_demo.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - import matplotlib.cbook as cbook - - fname = cbook.get_sample_data('msft.csv', asfileobj=False) - fname2 = cbook.get_sample_data('data_x_x2_x3.csv', asfileobj=False) - - # test 1; use ints - plt.plotfile(fname, (0, 5, 6)) - - # test 2; use names - plt.plotfile(fname, ('date', 'volume', 'adj_close')) - - # test 3; use semilogy for volume - plt.plotfile(fname, ('date', 'volume', 'adj_close'), - plotfuncs={'volume': 'semilogy'}) - - # test 4; use semilogy for volume - plt.plotfile(fname, (0, 5, 6), plotfuncs={5: 'semilogy'}) - - # test 5; single subplot - plt.plotfile(fname, ('date', 'open', 'high', 'low', 'close'), subplots=False) - - # test 6; labeling, if no names in csv-file - plt.plotfile(fname2, cols=(0, 1, 2), delimiter=' ', - names=['$x$', '$f(x)=x^2$', '$f(x)=x^3$']) - - # test 7; more than one file per figure--illustrated here with a single file - plt.plotfile(fname2, cols=(0, 1), delimiter=' ') - plt.plotfile(fname2, cols=(0, 2), newfig=False, - delimiter=' ') # use current figure - plt.xlabel(r'$x$') - plt.ylabel(r'$f(x) = x^2, x^3$') - - # test 8; use bar for volume - plt.plotfile(fname, (0, 5, 6), plotfuncs={5: 'bar'}) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/plotfile_demo.txt b/_sources/examples/pylab_examples/plotfile_demo.txt deleted file mode 100644 index 20db8c75adc..00000000000 --- a/_sources/examples/pylab_examples/plotfile_demo.txt +++ /dev/null @@ -1,53 +0,0 @@ -.. _pylab_examples-plotfile_demo: - -pylab_examples example code: plotfile_demo.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/plotfile_demo.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - import matplotlib.cbook as cbook - - fname = cbook.get_sample_data('msft.csv', asfileobj=False) - fname2 = cbook.get_sample_data('data_x_x2_x3.csv', asfileobj=False) - - # test 1; use ints - plt.plotfile(fname, (0, 5, 6)) - - # test 2; use names - plt.plotfile(fname, ('date', 'volume', 'adj_close')) - - # test 3; use semilogy for volume - plt.plotfile(fname, ('date', 'volume', 'adj_close'), - plotfuncs={'volume': 'semilogy'}) - - # test 4; use semilogy for volume - plt.plotfile(fname, (0, 5, 6), plotfuncs={5: 'semilogy'}) - - # test 5; single subplot - plt.plotfile(fname, ('date', 'open', 'high', 'low', 'close'), subplots=False) - - # test 6; labeling, if no names in csv-file - plt.plotfile(fname2, cols=(0, 1, 2), delimiter=' ', - names=['$x$', '$f(x)=x^2$', '$f(x)=x^3$']) - - # test 7; more than one file per figure--illustrated here with a single file - plt.plotfile(fname2, cols=(0, 1), delimiter=' ') - plt.plotfile(fname2, cols=(0, 2), newfig=False, - delimiter=' ') # use current figure - plt.xlabel(r'$x$') - plt.ylabel(r'$f(x) = x^2, x^3$') - - # test 8; use bar for volume - plt.plotfile(fname, (0, 5, 6), plotfuncs={5: 'bar'}) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/polar_bar.txt b/_sources/examples/pylab_examples/polar_bar.txt deleted file mode 100644 index 7af03e4bd94..00000000000 --- a/_sources/examples/pylab_examples/polar_bar.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _pylab_examples-polar_bar: - -pylab_examples example code: polar_bar.py -========================================= - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/polar_bar.py - -:: - - #!/usr/bin/env python - - import numpy as np - import matplotlib.cm as cm - from matplotlib.pyplot import figure, show, rc - - - # force square figure and square axes looks better for polar, IMO - fig = figure(figsize=(8,8)) - ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True) - - N = 20 - theta = np.arange(0.0, 2*np.pi, 2*np.pi/N) - radii = 10*np.random.rand(N) - width = np.pi/4*np.random.rand(N) - bars = ax.bar(theta, radii, width=width, bottom=0.0) - for r,bar in zip(radii, bars): - bar.set_facecolor( cm.jet(r/10.)) - bar.set_alpha(0.5) - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/polar_demo.rst.txt b/_sources/examples/pylab_examples/polar_demo.rst.txt deleted file mode 100644 index 159918bb2da..00000000000 --- a/_sources/examples/pylab_examples/polar_demo.rst.txt +++ /dev/null @@ -1,33 +0,0 @@ -.. _pylab_examples-polar_demo: - -pylab_examples example code: polar_demo.py -========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/polar_demo.py - -:: - - """ - Demo of a line plot on a polar axis. - """ - import numpy as np - import matplotlib.pyplot as plt - - - r = np.arange(0, 2, 0.01) - theta = 2 * np.pi * r - - ax = plt.subplot(111, projection='polar') - ax.plot(theta, r) - ax.set_rmax(2) - ax.set_rticks([0.5, 1, 1.5, 2]) # less radial ticks - ax.set_rlabel_position(-22.5) # get radial labels away from plotted line - ax.grid(True) - - ax.set_title("A line plot on a polar axis", va='bottom') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/polar_demo.txt b/_sources/examples/pylab_examples/polar_demo.txt deleted file mode 100644 index 0616b2aa259..00000000000 --- a/_sources/examples/pylab_examples/polar_demo.txt +++ /dev/null @@ -1,31 +0,0 @@ -.. _pylab_examples-polar_demo: - -pylab_examples example code: polar_demo.py -========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/polar_demo.py - -:: - - """ - Demo of a line plot on a polar axis. - """ - import numpy as np - import matplotlib.pyplot as plt - - - r = np.arange(0, 3.0, 0.01) - theta = 2 * np.pi * r - - ax = plt.subplot(111, projection='polar') - ax.plot(theta, r, color='r', linewidth=3) - ax.set_rmax(2.0) - ax.grid(True) - - ax.set_title("A line plot on a polar axis", va='bottom') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/polar_legend.rst.txt b/_sources/examples/pylab_examples/polar_legend.rst.txt deleted file mode 100644 index eccef6d8e00..00000000000 --- a/_sources/examples/pylab_examples/polar_legend.rst.txt +++ /dev/null @@ -1,34 +0,0 @@ -.. _pylab_examples-polar_legend: - -pylab_examples example code: polar_legend.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/polar_legend.py - -:: - - import numpy as np - from matplotlib.pyplot import figure, show, rc - - # radar green, solid grid lines - rc('grid', color='#316931', linewidth=1, linestyle='-') - rc('xtick', labelsize=15) - rc('ytick', labelsize=15) - - # force square figure and square axes looks better for polar, IMO - fig = figure(figsize=(8, 8)) - ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], - projection='polar', facecolor='#d5de9c') - - r = np.arange(0, 3.0, 0.01) - theta = 2*np.pi*r - 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() - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/polar_legend.txt b/_sources/examples/pylab_examples/polar_legend.txt deleted file mode 100644 index 6aa0a2cb69c..00000000000 --- a/_sources/examples/pylab_examples/polar_legend.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _pylab_examples-polar_legend: - -pylab_examples example code: polar_legend.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/polar_legend.py - -:: - - #!/usr/bin/env python - - import numpy as np - from matplotlib.pyplot import figure, show, rc - - # radar green, solid grid lines - rc('grid', color='#316931', linewidth=1, linestyle='-') - rc('xtick', labelsize=15) - rc('ytick', labelsize=15) - - # force square figure and square axes looks better for polar, IMO - fig = figure(figsize=(8, 8)) - ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], projection='polar', axisbg='#d5de9c') - - r = np.arange(0, 3.0, 0.01) - theta = 2*np.pi*r - 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() - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/polar_scatter.txt b/_sources/examples/pylab_examples/polar_scatter.txt deleted file mode 100644 index f2af4ddd7f1..00000000000 --- a/_sources/examples/pylab_examples/polar_scatter.txt +++ /dev/null @@ -1,31 +0,0 @@ -.. _pylab_examples-polar_scatter: - -pylab_examples example code: polar_scatter.py -============================================= - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/polar_scatter.py - -:: - - #!/usr/bin/env python - # a polar scatter plot; size increases radially in this example and - # color increases with angle (just to verify the symbols are being - # scattered correctly). In a real example, this would be wasting - # dimensionality of the plot - from pylab import * - - N = 150 - r = 2*rand(N) - theta = 2*pi*rand(N) - area = 200*r**2*rand(N) - colors = theta - ax = subplot(111, polar=True) - c = scatter(theta, r, c=colors, s=area, cmap=cm.hsv) - c.set_alpha(0.75) - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/poormans_contour.txt b/_sources/examples/pylab_examples/poormans_contour.txt deleted file mode 100644 index f27024b53c9..00000000000 --- a/_sources/examples/pylab_examples/poormans_contour.txt +++ /dev/null @@ -1,43 +0,0 @@ -.. _pylab_examples-poormans_contour: - -pylab_examples example code: poormans_contour.py -================================================ - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/poormans_contour.py - -:: - - #!/usr/bin/env python - """ - Use a pcolor or imshow with a custom colormap to make a contour plot. - - Since this example was initially written, a proper contour routine was - added to matplotlib - see contour_demo.py and - http://matplotlib.sf.net/matplotlib.pylab.html#-contour. - """ - - from pylab import * - - - delta = 0.01 - x = arange(-3.0, 3.0, delta) - y = arange(-3.0, 3.0, delta) - X,Y = meshgrid(x, y) - Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - Z = Z2 - Z1 # difference of Gaussians - - cmap = cm.get_cmap('PiYG', 11) # 11 discrete colors - - im = imshow(Z, cmap=cmap, interpolation='bilinear', - vmax=abs(Z).max(), vmin=-abs(Z).max()) - axis('off') - colorbar() - - show() - - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/print_stdout.rst.txt b/_sources/examples/pylab_examples/print_stdout.rst.txt deleted file mode 100644 index d0562ad9253..00000000000 --- a/_sources/examples/pylab_examples/print_stdout.rst.txt +++ /dev/null @@ -1,27 +0,0 @@ -.. _pylab_examples-print_stdout: - -pylab_examples example code: print_stdout.py -============================================ - -[`source code `_] - -:: - - # -*- noplot -*- - # print png to standard out - # usage: python print_stdout.py > somefile.png - - import sys - import matplotlib - matplotlib.use('Agg') - import matplotlib.pyplot as plt - - plt.plot([1, 2, 3]) - - if sys.version_info[0] >= 3: - plt.savefig(sys.stdout.buffer) - else: - plt.savefig(sys.stdout) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/print_stdout.txt b/_sources/examples/pylab_examples/print_stdout.txt deleted file mode 100644 index 0cc95aa5d8a..00000000000 --- a/_sources/examples/pylab_examples/print_stdout.txt +++ /dev/null @@ -1,25 +0,0 @@ -.. _pylab_examples-print_stdout: - -pylab_examples example code: print_stdout.py -============================================ - -[`source code `_] - -:: - - # -*- noplot -*- - # print png to standard out - # usage: python print_stdout.py > somefile.png - - import sys - import matplotlib - matplotlib.use('Agg') - import matplotlib.pyplot as plt - - plt.plot([1, 2, 3]) - - plt.savefig(sys.stdout) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/psd_demo.rst.txt b/_sources/examples/pylab_examples/psd_demo.rst.txt deleted file mode 100644 index 064862abca3..00000000000 --- a/_sources/examples/pylab_examples/psd_demo.rst.txt +++ /dev/null @@ -1,49 +0,0 @@ -.. _pylab_examples-psd_demo: - -pylab_examples example code: psd_demo.py -======================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/psd_demo.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - dt = 0.01 - t = np.arange(0, 10, dt) - nse = np.random.randn(len(t)) - r = np.exp(-t/0.05) - - cnse = np.convolve(nse, r)*dt - cnse = cnse[:len(t)] - s = 0.1*np.sin(2*np.pi*t) + cnse - - plt.subplot(211) - plt.plot(t, s) - plt.subplot(212) - plt.psd(s, 512, 1/dt) - - plt.show() - - """ - % compare with MATLAB - dt = 0.01; - t = [0:dt:10]; - nse = randn(size(t)); - r = exp(-t/0.05); - cnse = conv(nse, r)*dt; - cnse = cnse(1:length(t)); - s = 0.1*sin(2*pi*t) + cnse; - - subplot(211) - plot(t,s) - subplot(212) - psd(s, 512, 1/dt) - - """ - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/psd_demo.txt b/_sources/examples/pylab_examples/psd_demo.txt deleted file mode 100644 index 57ef2077543..00000000000 --- a/_sources/examples/pylab_examples/psd_demo.txt +++ /dev/null @@ -1,49 +0,0 @@ -.. _pylab_examples-psd_demo: - -pylab_examples example code: psd_demo.py -======================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/psd_demo.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - dt = 0.01 - t = np.arange(0, 10, dt) - nse = np.random.randn(len(t)) - r = np.exp(-t/0.05) - - cnse = np.convolve(nse, r)*dt - cnse = cnse[:len(t)] - s = 0.1*np.sin(2*np.pi*t) + cnse - - plt.subplot(211) - plt.plot(t, s) - plt.subplot(212) - plt.psd(s, 512, 1/dt) - - plt.show() - - """ - % compare with MATLAB - dt = 0.01; - t = [0:dt:10]; - nse = randn(size(t)); - r = exp(-t/0.05); - cnse = conv(nse, r)*dt; - cnse = cnse(1:length(t)); - s = 0.1*sin(2*pi*t) + cnse; - - subplot(211) - plot(t,s) - subplot(212) - psd(s, 512, 1/dt) - - """ - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/psd_demo2.rst.txt b/_sources/examples/pylab_examples/psd_demo2.rst.txt deleted file mode 100644 index 545cbbc0ee1..00000000000 --- a/_sources/examples/pylab_examples/psd_demo2.rst.txt +++ /dev/null @@ -1,56 +0,0 @@ -.. _pylab_examples-psd_demo2: - -pylab_examples example code: psd_demo2.py -========================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/psd_demo2.py - -:: - - # This example shows the effects of some of the different PSD parameters - import numpy as np - import matplotlib.pyplot as plt - - dt = np.pi / 100. - fs = 1. / dt - t = np.arange(0, 8, dt) - y = 10. * np.sin(2 * np.pi * 4 * t) + 5. * np.sin(2 * np.pi * 4.25 * t) - y = y + np.random.randn(*t.shape) - - # Plot the raw time series - fig = plt.figure() - fig.subplots_adjust(hspace=0.45, wspace=0.3) - ax = fig.add_subplot(2, 1, 1) - ax.plot(t, y) - - # Plot the PSD with different amounts of zero padding. This uses the entire - # time series at once - ax2 = fig.add_subplot(2, 3, 4) - ax2.psd(y, NFFT=len(t), pad_to=len(t), Fs=fs) - ax2.psd(y, NFFT=len(t), pad_to=len(t)*2, Fs=fs) - ax2.psd(y, NFFT=len(t), pad_to=len(t)*4, Fs=fs) - plt.title('zero padding') - - # Plot the PSD with different block sizes, Zero pad to the length of the - # original data sequence. - ax3 = fig.add_subplot(2, 3, 5, sharex=ax2, sharey=ax2) - ax3.psd(y, NFFT=len(t), pad_to=len(t), Fs=fs) - ax3.psd(y, NFFT=len(t)//2, pad_to=len(t), Fs=fs) - ax3.psd(y, NFFT=len(t)//4, pad_to=len(t), Fs=fs) - ax3.set_ylabel('') - plt.title('block size') - - # Plot the PSD with different amounts of overlap between blocks - ax4 = fig.add_subplot(2, 3, 6, sharex=ax2, sharey=ax2) - ax4.psd(y, NFFT=len(t)//2, pad_to=len(t), noverlap=0, Fs=fs) - ax4.psd(y, NFFT=len(t)//2, pad_to=len(t), noverlap=int(0.05*len(t)/2.), Fs=fs) - ax4.psd(y, NFFT=len(t)//2, pad_to=len(t), noverlap=int(0.2*len(t)/2.), Fs=fs) - ax4.set_ylabel('') - plt.title('overlap') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/psd_demo2.txt b/_sources/examples/pylab_examples/psd_demo2.txt deleted file mode 100644 index c12547ce2d4..00000000000 --- a/_sources/examples/pylab_examples/psd_demo2.txt +++ /dev/null @@ -1,56 +0,0 @@ -.. _pylab_examples-psd_demo2: - -pylab_examples example code: psd_demo2.py -========================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/psd_demo2.py - -:: - - # This example shows the effects of some of the different PSD parameters - import numpy as np - import matplotlib.pyplot as plt - - dt = np.pi / 100. - fs = 1. / dt - t = np.arange(0, 8, dt) - y = 10. * np.sin(2 * np.pi * 4 * t) + 5. * np.sin(2 * np.pi * 4.25 * t) - y = y + np.random.randn(*t.shape) - - # Plot the raw time series - fig = plt.figure() - fig.subplots_adjust(hspace=0.45, wspace=0.3) - ax = fig.add_subplot(2, 1, 1) - ax.plot(t, y) - - # Plot the PSD with different amounts of zero padding. This uses the entire - # time series at once - ax2 = fig.add_subplot(2, 3, 4) - ax2.psd(y, NFFT=len(t), pad_to=len(t), Fs=fs) - ax2.psd(y, NFFT=len(t), pad_to=len(t)*2, Fs=fs) - ax2.psd(y, NFFT=len(t), pad_to=len(t)*4, Fs=fs) - plt.title('zero padding') - - # Plot the PSD with different block sizes, Zero pad to the length of the - # original data sequence. - ax3 = fig.add_subplot(2, 3, 5, sharex=ax2, sharey=ax2) - ax3.psd(y, NFFT=len(t), pad_to=len(t), Fs=fs) - ax3.psd(y, NFFT=len(t)//2, pad_to=len(t), Fs=fs) - ax3.psd(y, NFFT=len(t)//4, pad_to=len(t), Fs=fs) - ax3.set_ylabel('') - plt.title('block size') - - # Plot the PSD with different amounts of overlap between blocks - ax4 = fig.add_subplot(2, 3, 6, sharex=ax2, sharey=ax2) - ax4.psd(y, NFFT=len(t)//2, pad_to=len(t), noverlap=0, Fs=fs) - ax4.psd(y, NFFT=len(t)//2, pad_to=len(t), noverlap=int(0.05*len(t)/2.), Fs=fs) - ax4.psd(y, NFFT=len(t)//2, pad_to=len(t), noverlap=int(0.2*len(t)/2.), Fs=fs) - ax4.set_ylabel('') - plt.title('overlap') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/psd_demo3.rst.txt b/_sources/examples/pylab_examples/psd_demo3.rst.txt deleted file mode 100644 index 489514778b0..00000000000 --- a/_sources/examples/pylab_examples/psd_demo3.rst.txt +++ /dev/null @@ -1,57 +0,0 @@ -.. _pylab_examples-psd_demo3: - -pylab_examples example code: psd_demo3.py -========================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/psd_demo3.py - -:: - - """This is a ported version of a MATLAB example from the signal - processing toolbox that showed some difference at one time between - Matplotlib's and MATLAB's scaling of the PSD. - - """ - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.mlab as mlab - - prng = np.random.RandomState(123456) # to ensure reproducibility - - fs = 1000 - t = np.linspace(0, 0.3, 301) - A = np.array([2, 8]).reshape(-1, 1) - f = np.array([150, 140]).reshape(-1, 1) - xn = (A * np.sin(2 * np.pi * f * t)).sum(axis=0) + 5 * prng.randn(*t.shape) - - fig, (ax0, ax1) = plt.subplots(ncols=2) - - fig.subplots_adjust(hspace=0.45, wspace=0.3) - yticks = np.arange(-50, 30, 10) - yrange = (yticks[0], yticks[-1]) - xticks = np.arange(0, 550, 100) - - ax0.psd(xn, NFFT=301, Fs=fs, window=mlab.window_none, pad_to=1024, - scale_by_freq=True) - ax0.set_title('Periodogram') - ax0.set_yticks(yticks) - ax0.set_xticks(xticks) - ax0.grid(True) - ax0.set_ylim(yrange) - - ax1.psd(xn, NFFT=150, Fs=fs, window=mlab.window_none, pad_to=512, noverlap=75, - scale_by_freq=True) - ax1.set_title('Welch') - ax1.set_xticks(xticks) - ax1.set_yticks(yticks) - ax1.set_ylabel('') # overwrite the y-label added by `psd` - ax1.grid(True) - ax1.set_ylim(yrange) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/psd_demo3.txt b/_sources/examples/pylab_examples/psd_demo3.txt deleted file mode 100644 index d1a086cd49b..00000000000 --- a/_sources/examples/pylab_examples/psd_demo3.txt +++ /dev/null @@ -1,50 +0,0 @@ -.. _pylab_examples-psd_demo3: - -pylab_examples example code: psd_demo3.py -========================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/psd_demo3.py - -:: - - # This is a ported version of a MATLAB example from the signal processing - # toolbox that showed some difference at one time between Matplotlib's and - # MATLAB's scaling of the PSD. - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.mlab as mlab - - fs = 1000 - t = np.linspace(0, 0.3, 301) - A = np.array([2, 8]).reshape(-1, 1) - f = np.array([150, 140]).reshape(-1, 1) - xn = (A * np.sin(2 * np.pi * f * t)).sum(axis=0) + 5 * np.random.randn(*t.shape) - - yticks = np.arange(-50, 30, 10) - xticks = np.arange(0, 550, 100) - plt.subplots_adjust(hspace=0.45, wspace=0.3) - plt.subplot(1, 2, 1) - - plt.psd(xn, NFFT=301, Fs=fs, window=mlab.window_none, pad_to=1024, - scale_by_freq=True) - plt.title('Periodogram') - plt.yticks(yticks) - plt.xticks(xticks) - plt.grid(True) - - plt.subplot(1, 2, 2) - plt.psd(xn, NFFT=150, Fs=fs, window=mlab.window_none, noverlap=75, pad_to=512, - scale_by_freq=True) - plt.title('Welch') - plt.xticks(xticks) - plt.yticks(yticks) - plt.ylabel('') - plt.grid(True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/psd_demo_complex.rst.txt b/_sources/examples/pylab_examples/psd_demo_complex.rst.txt deleted file mode 100644 index 4ae938033a7..00000000000 --- a/_sources/examples/pylab_examples/psd_demo_complex.rst.txt +++ /dev/null @@ -1,60 +0,0 @@ -.. _pylab_examples-psd_demo_complex: - -pylab_examples example code: psd_demo_complex.py -================================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/psd_demo_complex.py - -:: - - """This is a ported version of a MATLAB example from the signal - processing toolbox that showed some difference at one time between - Matplotlib's and MATLAB's scaling of the PSD. - - This differs from psd_demo3.py in that this uses a complex signal, - so we can see that complex PSD's work properly - - """ - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.mlab as mlab - - prng = np.random.RandomState(123456) # to ensure reproducibility - - fs = 1000 - t = np.linspace(0, 0.3, 301) - A = np.array([2, 8]).reshape(-1, 1) - f = np.array([150, 140]).reshape(-1, 1) - xn = (A * np.exp(2j * np.pi * f * t)).sum(axis=0) + 5 * prng.randn(*t.shape) - - fig, (ax0, ax1) = plt.subplots(ncols=2) - - fig.subplots_adjust(hspace=0.45, wspace=0.3) - yticks = np.arange(-50, 30, 10) - yrange = (yticks[0], yticks[-1]) - xticks = np.arange(-500, 550, 200) - - ax0.psd(xn, NFFT=301, Fs=fs, window=mlab.window_none, pad_to=1024, - scale_by_freq=True) - ax0.set_title('Periodogram') - ax0.set_yticks(yticks) - ax0.set_xticks(xticks) - ax0.grid(True) - ax0.set_ylim(yrange) - - ax1.psd(xn, NFFT=150, Fs=fs, window=mlab.window_none, pad_to=512, noverlap=75, - scale_by_freq=True) - ax1.set_title('Welch') - ax1.set_xticks(xticks) - ax1.set_yticks(yticks) - ax1.set_ylabel('') # overwrite the y-label added by `psd` - ax1.grid(True) - ax1.set_ylim(yrange) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/psd_demo_complex.txt b/_sources/examples/pylab_examples/psd_demo_complex.txt deleted file mode 100644 index 5a8418607ba..00000000000 --- a/_sources/examples/pylab_examples/psd_demo_complex.txt +++ /dev/null @@ -1,52 +0,0 @@ -.. _pylab_examples-psd_demo_complex: - -pylab_examples example code: psd_demo_complex.py -================================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/psd_demo_complex.py - -:: - - # This is a ported version of a MATLAB example from the signal processing - # toolbox that showed some difference at one time between Matplotlib's and - # MATLAB's scaling of the PSD. This differs from psd_demo3.py in that - # this uses a complex signal, so we can see that complex PSD's work properly - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.mlab as mlab - - fs = 1000 - t = np.linspace(0, 0.3, 301) - A = np.array([2, 8]).reshape(-1, 1) - f = np.array([150, 140]).reshape(-1, 1) - xn = (A * np.exp(2j * np.pi * f * t)).sum(axis=0) + 5 * np.random.randn(*t.shape) - - yticks = np.arange(-50, 30, 10) - xticks = np.arange(-500, 550, 100) - plt.subplots_adjust(hspace=0.45, wspace=0.3) - ax = plt.subplot(1, 2, 1) - - plt.psd(xn, NFFT=301, Fs=fs, window=mlab.window_none, pad_to=1024, - scale_by_freq=True) - plt.title('Periodogram') - plt.yticks(yticks) - plt.xticks(xticks) - plt.grid(True) - plt.xlim(-500, 500) - - plt.subplot(1, 2, 2, sharex=ax, sharey=ax) - plt.psd(xn, NFFT=150, Fs=fs, window=mlab.window_none, noverlap=75, pad_to=512, - scale_by_freq=True) - plt.title('Welch') - plt.xticks(xticks) - plt.yticks(yticks) - plt.ylabel('') - plt.grid(True) - plt.xlim(-500, 500) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/pstest.txt b/_sources/examples/pylab_examples/pstest.txt deleted file mode 100644 index 9bfa815166a..00000000000 --- a/_sources/examples/pylab_examples/pstest.txt +++ /dev/null @@ -1,42 +0,0 @@ -.. _pylab_examples-pstest: - -pylab_examples example code: pstest.py -====================================== - -[`source code `_] - -:: - - #!/usr/bin/env python - # -*- noplot -*- - import matplotlib - matplotlib.use('PS') - from pylab import * - - def f(t): - s1 = cos(2*pi*t) - e1 = exp(-t) - return multiply(s1,e1) - - t1 = arange(0.0, 5.0, .1) - t2 = arange(0.0, 5.0, 0.02) - t3 = arange(0.0, 2.0, 0.01) - - figure(1) - subplot(211) - l = plot(t1, f(t1), 'k^') - setp(l, markerfacecolor='k', markeredgecolor='r') - title('A tale of 2 subplots', fontsize=14, fontname='Courier') - ylabel('Signal 1', fontsize=12) - subplot(212) - l = plot(t1, f(t1), 'k>') - - - ylabel('Signal 2', fontsize=12) - xlabel('time (s)', fontsize=12) - - show() - - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/pythonic_matplotlib.rst.txt b/_sources/examples/pylab_examples/pythonic_matplotlib.rst.txt deleted file mode 100644 index 4b9539f84ce..00000000000 --- a/_sources/examples/pylab_examples/pythonic_matplotlib.rst.txt +++ /dev/null @@ -1,95 +0,0 @@ -.. _pylab_examples-pythonic_matplotlib: - -pylab_examples example code: pythonic_matplotlib.py -=================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/pythonic_matplotlib.py - -:: - - """ - Some people prefer to write more pythonic, object-oriented code - rather than use the pyplot interface to matplotlib. This example shows - you how. - - Unless you are an application developer, I recommend using part of the - pyplot interface, particularly the figure, close, subplot, axes, and - show commands. These hide a lot of complexity from you that you don't - need to see in normal figure creation, like instantiating DPI - instances, managing the bounding boxes of the figure elements, - creating and realizing GUI windows and embedding figures in them. - - - If you are an application developer and want to embed matplotlib in - your application, follow the lead of examples/embedding_in_wx.py, - examples/embedding_in_gtk.py or examples/embedding_in_tk.py. In this - case you will want to control the creation of all your figures, - embedding them in application windows, etc. - - If you are a web application developer, you may want to use the - example in webapp_demo.py, which shows how to use the backend agg - figure canvas directly, with none of the globals (current figure, - current axes) that are present in the pyplot interface. Note that - there is no reason why the pyplot interface won't work for web - application developers, however. - - If you see an example in the examples dir written in pyplot interface, - and you want to emulate that using the true python method calls, there - is an easy mapping. Many of those examples use 'set' to control - figure properties. Here's how to map those commands onto instance - methods - - The syntax of set is - - plt.setp(object or sequence, somestring, attribute) - - if called with an object, set calls - - object.set_somestring(attribute) - - if called with a sequence, set does - - for object in sequence: - object.set_somestring(attribute) - - So for your example, if a is your axes object, you can do - - a.set_xticklabels([]) - a.set_yticklabels([]) - a.set_xticks([]) - a.set_yticks([]) - """ - - - from matplotlib.pyplot import figure, show - from numpy import arange, sin, pi - - t = arange(0.0, 1.0, 0.01) - - fig = figure(1) - - ax1 = fig.add_subplot(211) - ax1.plot(t, sin(2*pi*t)) - ax1.grid(True) - ax1.set_ylim((-2, 2)) - ax1.set_ylabel('1 Hz') - ax1.set_title('A sine wave or two') - - for label in ax1.get_xticklabels(): - label.set_color('r') - - - ax2 = fig.add_subplot(212) - ax2.plot(t, sin(2*2*pi*t)) - ax2.grid(True) - ax2.set_ylim((-2, 2)) - l = ax2.set_xlabel('Hi mom') - l.set_color('g') - l.set_fontsize('large') - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/pythonic_matplotlib.txt b/_sources/examples/pylab_examples/pythonic_matplotlib.txt deleted file mode 100644 index e14f20a4418..00000000000 --- a/_sources/examples/pylab_examples/pythonic_matplotlib.txt +++ /dev/null @@ -1,95 +0,0 @@ -.. _pylab_examples-pythonic_matplotlib: - -pylab_examples example code: pythonic_matplotlib.py -=================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/pythonic_matplotlib.py - -:: - - """ - Some people prefer to write more pythonic, object-oriented code - rather than use the pyplot interface to matplotlib. This example shows - you how. - - Unless you are an application developer, I recommend using part of the - pyplot interface, particularly the figure, close, subplot, axes, and - show commands. These hide a lot of complexity from you that you don't - need to see in normal figure creation, like instantiating DPI - instances, managing the bounding boxes of the figure elements, - creating and reaslizing GUI windows and embedding figures in them. - - - If you are an application developer and want to embed matplotlib in - your application, follow the lead of examples/embedding_in_wx.py, - examples/embedding_in_gtk.py or examples/embedding_in_tk.py. In this - case you will want to control the creation of all your figures, - embedding them in application windows, etc. - - If you are a web application developer, you may want to use the - example in webapp_demo.py, which shows how to use the backend agg - figure canvase directly, with none of the globals (current figure, - current axes) that are present in the pyplot interface. Note that - there is no reason why the pyplot interface won't work for web - application developers, however. - - If you see an example in the examples dir written in pyplot interface, - and you want to emulate that using the true python method calls, there - is an easy mapping. Many of those examples use 'set' to control - figure properties. Here's how to map those commands onto instance - methods - - The syntax of set is - - plt.setp(object or sequence, somestring, attribute) - - if called with an object, set calls - - object.set_somestring(attribute) - - if called with a sequence, set does - - for object in sequence: - object.set_somestring(attribute) - - So for your example, if a is your axes object, you can do - - a.set_xticklabels([]) - a.set_yticklabels([]) - a.set_xticks([]) - a.set_yticks([]) - """ - - - from matplotlib.pyplot import figure, show - from numpy import arange, sin, pi - - t = arange(0.0, 1.0, 0.01) - - fig = figure(1) - - ax1 = fig.add_subplot(211) - ax1.plot(t, sin(2*pi*t)) - ax1.grid(True) - ax1.set_ylim((-2, 2)) - ax1.set_ylabel('1 Hz') - ax1.set_title('A sine wave or two') - - for label in ax1.get_xticklabels(): - label.set_color('r') - - - ax2 = fig.add_subplot(212) - ax2.plot(t, sin(2*2*pi*t)) - ax2.grid(True) - ax2.set_ylim((-2, 2)) - l = ax2.set_xlabel('Hi mom') - l.set_color('g') - l.set_fontsize('large') - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/quadmesh_demo.rst.txt b/_sources/examples/pylab_examples/quadmesh_demo.rst.txt deleted file mode 100644 index 0b6de86d6fe..00000000000 --- a/_sources/examples/pylab_examples/quadmesh_demo.rst.txt +++ /dev/null @@ -1,56 +0,0 @@ -.. _pylab_examples-quadmesh_demo: - -pylab_examples example code: quadmesh_demo.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/quadmesh_demo.py - -:: - - """ - pcolormesh uses a QuadMesh, a faster generalization of pcolor, but - with some restrictions. - - This demo illustrates a bug in quadmesh with masked data. - """ - - import numpy as np - from matplotlib.pyplot import figure, show, savefig - from matplotlib import cm, colors - from numpy import ma - - n = 12 - x = np.linspace(-1.5, 1.5, n) - y = np.linspace(-1.5, 1.5, n*2) - X, Y = np.meshgrid(x, y) - Qx = np.cos(Y) - np.cos(X) - Qz = np.sin(Y) + np.sin(X) - Qx = (Qx + 1.1) - Z = np.sqrt(X**2 + Y**2)/5 - Z = (Z - Z.min()) / (Z.max() - Z.min()) - - # The color array can include masked values: - Zm = ma.masked_where(np.fabs(Qz) < 0.5*np.amax(Qz), Z) - - - fig = figure() - ax = fig.add_subplot(121) - ax.pcolormesh(Qx, Qz, Z, shading='gouraud') - ax.set_title('Without masked values') - - ax = fig.add_subplot(122) - # You can control the color of the masked region: - # cmap = cm.RdBu - # cmap.set_bad('y', 1.0) - # ax.pcolormesh(Qx, Qz, Zm, cmap=cmap) - # Or use the default, which is transparent: - col = ax.pcolormesh(Qx, Qz, Zm, shading='gouraud') - ax.set_title('With masked values') - - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/quadmesh_demo.txt b/_sources/examples/pylab_examples/quadmesh_demo.txt deleted file mode 100644 index c4ad7a04944..00000000000 --- a/_sources/examples/pylab_examples/quadmesh_demo.txt +++ /dev/null @@ -1,59 +0,0 @@ -.. _pylab_examples-quadmesh_demo: - -pylab_examples example code: quadmesh_demo.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/quadmesh_demo.py - -:: - - #!/usr/bin/env python - """ - pcolormesh uses a QuadMesh, a faster generalization of pcolor, but - with some restrictions. - - This demo illustrates a bug in quadmesh with masked data. - """ - - import numpy as np - from matplotlib.pyplot import figure, show, savefig - from matplotlib import cm, colors - from numpy import ma - - n = 12 - x = np.linspace(-1.5, 1.5, n) - y = np.linspace(-1.5, 1.5, n*2) - X, Y = np.meshgrid(x, y) - Qx = np.cos(Y) - np.cos(X) - Qz = np.sin(Y) + np.sin(X) - Qx = (Qx + 1.1) - Z = np.sqrt(X**2 + Y**2)/5 - Z = (Z - Z.min()) / (Z.max() - Z.min()) - - # The color array can include masked values: - Zm = ma.masked_where(np.fabs(Qz) < 0.5*np.amax(Qz), Z) - - - fig = figure() - ax = fig.add_subplot(121) - ax.set_axis_bgcolor("#bdb76b") - ax.pcolormesh(Qx, Qz, Z, shading='gouraud') - ax.set_title('Without masked values') - - ax = fig.add_subplot(122) - ax.set_axis_bgcolor("#bdb76b") - # You can control the color of the masked region: - #cmap = cm.jet - #cmap.set_bad('r', 1.0) - #ax.pcolormesh(Qx,Qz,Zm, cmap=cmap) - # Or use the default, which is transparent: - col = ax.pcolormesh(Qx, Qz, Zm, shading='gouraud') - ax.set_title('With masked values') - - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/quiver_demo.rst.txt b/_sources/examples/pylab_examples/quiver_demo.rst.txt deleted file mode 100644 index 41ea4dc5b98..00000000000 --- a/_sources/examples/pylab_examples/quiver_demo.rst.txt +++ /dev/null @@ -1,56 +0,0 @@ -.. _pylab_examples-quiver_demo: - -pylab_examples example code: quiver_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/quiver_demo.py - -:: - - ''' - ======================================================== - Demonstration of advanced quiver and quiverkey functions - ======================================================== - - Known problem: the plot autoscaling does not take into account - the arrows, so those on the boundaries are often out of the picture. - This is *not* an easy problem to solve in a perfectly general way. - The workaround is to manually expand the axes. - ''' - import matplotlib.pyplot as plt - import numpy as np - from numpy import ma - - X, Y = np.meshgrid(np.arange(0, 2 * np.pi, .2), np.arange(0, 2 * np.pi, .2)) - U = np.cos(X) - V = np.sin(Y) - - plt.figure() - plt.title('Arrows scale with plot width, not view') - Q = plt.quiver(X, Y, U, V, units='width') - qk = plt.quiverkey(Q, 0.9, 0.9, 2, r'$2 \frac{m}{s}$', labelpos='E', - coordinates='figure') - - plt.figure() - plt.title("pivot='mid'; every third arrow; units='inches'") - Q = plt.quiver(X[::3, ::3], Y[::3, ::3], U[::3, ::3], V[::3, ::3], - pivot='mid', units='inches') - qk = plt.quiverkey(Q, 0.9, 0.9, 1, r'$1 \frac{m}{s}$', labelpos='E', - coordinates='figure') - plt.scatter(X[::3, ::3], Y[::3, ::3], color='r', s=5) - - plt.figure() - plt.title("pivot='tip'; scales with x view") - M = np.hypot(U, V) - Q = plt.quiver(X, Y, U, V, M, units='x', pivot='tip', width=0.022, - scale=1 / 0.15) - qk = plt.quiverkey(Q, 0.9, 0.9, 1, r'$1 \frac{m}{s}$', labelpos='E', - coordinates='figure') - plt.scatter(X, Y, color='k', s=5) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/quiver_demo.txt b/_sources/examples/pylab_examples/quiver_demo.txt deleted file mode 100644 index 72d1185d759..00000000000 --- a/_sources/examples/pylab_examples/quiver_demo.txt +++ /dev/null @@ -1,105 +0,0 @@ -.. _pylab_examples-quiver_demo: - -pylab_examples example code: quiver_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/quiver_demo.py - -:: - - ''' - Demonstration of quiver and quiverkey functions. This is using the - new version coming from the code in quiver.py. - - Known problem: the plot autoscaling does not take into account - the arrows, so those on the boundaries are often out of the picture. - This is *not* an easy problem to solve in a perfectly general way. - The workaround is to manually expand the axes. - - ''' - import matplotlib.pyplot as plt - import numpy as np - from numpy import ma - - X, Y = np.meshgrid(np.arange(0, 2 * np.pi, .2), np.arange(0, 2 * np.pi, .2)) - U = np.cos(X) - V = np.sin(Y) - - # 1 - plt.figure() - Q = plt.quiver(U, V) - qk = plt.quiverkey(Q, 0.5, 0.92, 2, r'$2 \frac{m}{s}$', labelpos='W', - fontproperties={'weight': 'bold'}) - l, r, b, t = plt.axis() - dx, dy = r - l, t - b - plt.axis([l - 0.05*dx, r + 0.05*dx, b - 0.05*dy, t + 0.05*dy]) - - plt.title('Minimal arguments, no kwargs') - - # 2 - plt.figure() - Q = plt.quiver(X, Y, U, V, units='width') - qk = plt.quiverkey(Q, 0.9, 0.95, 2, r'$2 \frac{m}{s}$', - labelpos='E', - coordinates='figure', - fontproperties={'weight': 'bold'}) - plt.axis([-1, 7, -1, 7]) - plt.title('scales with plot width, not view') - - # 3 - plt.figure() - Q = plt.quiver(X[::3, ::3], Y[::3, ::3], U[::3, ::3], V[::3, ::3], - pivot='mid', color='r', units='inches') - qk = plt.quiverkey(Q, 0.5, 0.03, 1, r'$1 \frac{m}{s}$', - fontproperties={'weight': 'bold'}) - plt.plot(X[::3, ::3], Y[::3, ::3], 'k.') - plt.axis([-1, 7, -1, 7]) - plt.title("pivot='mid'; every third arrow; units='inches'") - - # 4 - plt.figure() - M = np.hypot(U, V) - Q = plt.quiver(X, Y, U, V, M, - units='x', - pivot='tip', - width=0.022, - scale=1 / 0.15) - qk = plt.quiverkey(Q, 0.9, 1.05, 1, r'$1 \frac{m}{s}$', - labelpos='E', - fontproperties={'weight': 'bold'}) - plt.plot(X, Y, 'k.') - plt.axis([-1, 7, -1, 7]) - plt.title("scales with x view; pivot='tip'") - - # 5 - plt.figure() - Q = plt.quiver(X[::3, ::3], Y[::3, ::3], U[::3, ::3], V[::3, ::3], - color='r', units='x', - linewidths=(2,), edgecolors=('k'), headaxislength=5) - qk = plt.quiverkey(Q, 0.5, 0.03, 1, r'$1 \frac{m}{s}$', - fontproperties={'weight': 'bold'}) - plt.axis([-1, 7, -1, 7]) - plt.title("triangular head; scale with x view; black edges") - - # 6 - plt.figure() - M = np.zeros(U.shape, dtype='bool') - M[U.shape[0]//3:2*U.shape[0]//3, - U.shape[1]//3:2*U.shape[1]//3] = True - U = ma.masked_array(U, mask=M) - V = ma.masked_array(V, mask=M) - Q = plt.quiver(U, V) - qk = plt.quiverkey(Q, 0.5, 0.92, 2, r'$2 \frac{m}{s}$', labelpos='W', - fontproperties={'weight': 'bold'}) - l, r, b, t = plt.axis() - dx, dy = r - l, t - b - plt.axis([l - 0.05 * dx, r + 0.05 * dx, b - 0.05 * dy, t + 0.05 * dy]) - plt.title('Minimal arguments, no kwargs - masked values') - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/quiver_simple_demo.rst.txt b/_sources/examples/pylab_examples/quiver_simple_demo.rst.txt deleted file mode 100644 index 7478871a870..00000000000 --- a/_sources/examples/pylab_examples/quiver_simple_demo.rst.txt +++ /dev/null @@ -1,32 +0,0 @@ -.. _pylab_examples-quiver_simple_demo: - -pylab_examples example code: quiver_simple_demo.py -================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/quiver_simple_demo.py - -:: - - ''' - ================================================== - A simple example of a quiver plot with a quiverkey - ================================================== - ''' - import matplotlib.pyplot as plt - import numpy as np - - X = np.arange(-10, 10, 1) - Y = np.arange(-10, 10, 1) - U, V = np.meshgrid(X, Y) - - fig, ax = plt.subplots() - q = ax.quiver(X, Y, U, V) - ax.quiverkey(q, X=0.3, Y=1.1, U=10, - label='Quiver key, length = 10', labelpos='E') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/scatter_custom_symbol.rst.txt b/_sources/examples/pylab_examples/scatter_custom_symbol.rst.txt deleted file mode 100644 index db973280b63..00000000000 --- a/_sources/examples/pylab_examples/scatter_custom_symbol.rst.txt +++ /dev/null @@ -1,31 +0,0 @@ -.. _pylab_examples-scatter_custom_symbol: - -pylab_examples example code: scatter_custom_symbol.py -===================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/scatter_custom_symbol.py - -:: - - import matplotlib.pyplot as plt - from numpy import arange, pi, cos, sin - from numpy.random import rand - - # unit area ellipse - rx, ry = 3., 1. - area = rx * ry * pi - theta = arange(0, 2*pi + 0.01, 0.1) - verts = list(zip(rx/area*cos(theta), ry/area*sin(theta))) - - x, y, s, c = rand(4, 30) - s *= 10**2. - - fig, ax = plt.subplots() - ax.scatter(x, y, s, c, marker=None, verts=verts) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/scatter_custom_symbol.txt b/_sources/examples/pylab_examples/scatter_custom_symbol.txt deleted file mode 100644 index 538396c20ab..00000000000 --- a/_sources/examples/pylab_examples/scatter_custom_symbol.txt +++ /dev/null @@ -1,31 +0,0 @@ -.. _pylab_examples-scatter_custom_symbol: - -pylab_examples example code: scatter_custom_symbol.py -===================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/scatter_custom_symbol.py - -:: - - import matplotlib.pyplot as plt - from numpy import arange, pi, cos, sin - from numpy.random import rand - - # unit area ellipse - rx, ry = 3., 1. - area = rx * ry * pi - theta = arange(0, 2*pi + 0.01, 0.1) - verts = list(zip(rx/area*cos(theta), ry/area*sin(theta))) - - x, y, s, c = rand(4, 30) - s *= 10**2. - - fig, ax = plt.subplots() - ax.scatter(x, y, s, c, marker=None, verts=verts) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/scatter_demo.txt b/_sources/examples/pylab_examples/scatter_demo.txt deleted file mode 100644 index 721831b08b7..00000000000 --- a/_sources/examples/pylab_examples/scatter_demo.txt +++ /dev/null @@ -1,24 +0,0 @@ -.. _pylab_examples-scatter_demo: - -pylab_examples example code: scatter_demo.py -============================================ - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/scatter_demo.py - -:: - - #!/usr/bin/env python - from pylab import * - - N = 30 - x = 0.9*rand(N) - y = 0.9*rand(N) - area = pi*(10 * rand(N))**2 # 0 to 10 point radiuses - scatter(x,y,s=area, marker='^', c='r') - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/scatter_demo2.rst.txt b/_sources/examples/pylab_examples/scatter_demo2.rst.txt deleted file mode 100644 index c07e162c38f..00000000000 --- a/_sources/examples/pylab_examples/scatter_demo2.rst.txt +++ /dev/null @@ -1,53 +0,0 @@ -.. _pylab_examples-scatter_demo2: - -pylab_examples example code: scatter_demo2.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/scatter_demo2.py - -:: - - """ - Demo of scatter plot with varying marker colors and sizes. - """ - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.cbook as cbook - - # Load a numpy record array from yahoo csv data with fields date, - # open, close, volume, adj_close from the mpl-data/example directory. - # The record array stores python datetime.date as an object array in - # the date column - datafile = cbook.get_sample_data('goog.npy') - try: - # Python3 cannot load python2 .npy files with datetime(object) arrays - # unless the encoding is set to bytes. However this option was - # not added until numpy 1.10 so this example will only work with - # python 2 or with numpy 1.10 and later - price_data = np.load(datafile, encoding='bytes').view(np.recarray) - except TypeError: - price_data = np.load(datafile).view(np.recarray) - price_data = price_data[-250:] # get the most recent 250 trading days - - delta1 = np.diff(price_data.adj_close)/price_data.adj_close[:-1] - - # Marker size in units of points^2 - volume = (15 * price_data.volume[:-2] / price_data.volume[0])**2 - close = 0.003 * price_data.close[:-2] / 0.003 * price_data.open[:-2] - - fig, ax = plt.subplots() - ax.scatter(delta1[:-1], delta1[1:], c=close, s=volume, alpha=0.5) - - ax.set_xlabel(r'$\Delta_i$', fontsize=15) - ax.set_ylabel(r'$\Delta_{i+1}$', fontsize=15) - ax.set_title('Volume and percent change') - - ax.grid(True) - fig.tight_layout() - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/scatter_demo2.txt b/_sources/examples/pylab_examples/scatter_demo2.txt deleted file mode 100644 index 53fe7db93b7..00000000000 --- a/_sources/examples/pylab_examples/scatter_demo2.txt +++ /dev/null @@ -1,53 +0,0 @@ -.. _pylab_examples-scatter_demo2: - -pylab_examples example code: scatter_demo2.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/scatter_demo2.py - -:: - - """ - Demo of scatter plot with varying marker colors and sizes. - """ - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.cbook as cbook - - # Load a numpy record array from yahoo csv data with fields date, - # open, close, volume, adj_close from the mpl-data/example directory. - # The record array stores python datetime.date as an object array in - # the date column - datafile = cbook.get_sample_data('goog.npy') - try: - # Python3 cannot load python2 .npy files with datetime(object) arrays - # unless the encoding is set to bytes. Hovever this option was - # not added until numpy 1.10 so this example will only work with - # python 2 or with numpy 1.10 and later - price_data = np.load(datafile, encoding='bytes').view(np.recarray) - except TypeError: - price_data = np.load(datafile).view(np.recarray) - price_data = price_data[-250:] # get the most recent 250 trading days - - delta1 = np.diff(price_data.adj_close)/price_data.adj_close[:-1] - - # Marker size in units of points^2 - volume = (15 * price_data.volume[:-2] / price_data.volume[0])**2 - close = 0.003 * price_data.close[:-2] / 0.003 * price_data.open[:-2] - - fig, ax = plt.subplots() - ax.scatter(delta1[:-1], delta1[1:], c=close, s=volume, alpha=0.5) - - ax.set_xlabel(r'$\Delta_i$', fontsize=20) - ax.set_ylabel(r'$\Delta_{i+1}$', fontsize=20) - ax.set_title('Volume and percent change') - - ax.grid(True) - fig.tight_layout() - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/scatter_hist.rst.txt b/_sources/examples/pylab_examples/scatter_hist.rst.txt deleted file mode 100644 index e041fc95e2b..00000000000 --- a/_sources/examples/pylab_examples/scatter_hist.rst.txt +++ /dev/null @@ -1,63 +0,0 @@ -.. _pylab_examples-scatter_hist: - -pylab_examples example code: scatter_hist.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/scatter_hist.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.ticker import NullFormatter - - # the random data - x = np.random.randn(1000) - y = np.random.randn(1000) - - nullfmt = NullFormatter() # no labels - - # definitions for the axes - left, width = 0.1, 0.65 - bottom, height = 0.1, 0.65 - bottom_h = left_h = left + width + 0.02 - - rect_scatter = [left, bottom, width, height] - rect_histx = [left, bottom_h, width, 0.2] - rect_histy = [left_h, bottom, 0.2, height] - - # start with a rectangular Figure - plt.figure(1, figsize=(8, 8)) - - axScatter = plt.axes(rect_scatter) - axHistx = plt.axes(rect_histx) - axHisty = plt.axes(rect_histy) - - # no labels - axHistx.xaxis.set_major_formatter(nullfmt) - axHisty.yaxis.set_major_formatter(nullfmt) - - # the scatter plot: - axScatter.scatter(x, y) - - # now determine nice limits by hand: - binwidth = 0.25 - xymax = np.max([np.max(np.fabs(x)), np.max(np.fabs(y))]) - lim = (int(xymax/binwidth) + 1) * binwidth - - axScatter.set_xlim((-lim, lim)) - axScatter.set_ylim((-lim, lim)) - - bins = np.arange(-lim, lim + binwidth, binwidth) - axHistx.hist(x, bins=bins) - axHisty.hist(y, bins=bins, orientation='horizontal') - - axHistx.set_xlim(axScatter.get_xlim()) - axHisty.set_ylim(axScatter.get_ylim()) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/scatter_hist.txt b/_sources/examples/pylab_examples/scatter_hist.txt deleted file mode 100644 index 5707ef0fe56..00000000000 --- a/_sources/examples/pylab_examples/scatter_hist.txt +++ /dev/null @@ -1,63 +0,0 @@ -.. _pylab_examples-scatter_hist: - -pylab_examples example code: scatter_hist.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/scatter_hist.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.ticker import NullFormatter - - # the random data - x = np.random.randn(1000) - y = np.random.randn(1000) - - nullfmt = NullFormatter() # no labels - - # definitions for the axes - left, width = 0.1, 0.65 - bottom, height = 0.1, 0.65 - bottom_h = left_h = left + width + 0.02 - - rect_scatter = [left, bottom, width, height] - rect_histx = [left, bottom_h, width, 0.2] - rect_histy = [left_h, bottom, 0.2, height] - - # start with a rectangular Figure - plt.figure(1, figsize=(8, 8)) - - axScatter = plt.axes(rect_scatter) - axHistx = plt.axes(rect_histx) - axHisty = plt.axes(rect_histy) - - # no labels - axHistx.xaxis.set_major_formatter(nullfmt) - axHisty.yaxis.set_major_formatter(nullfmt) - - # the scatter plot: - axScatter.scatter(x, y) - - # now determine nice limits by hand: - binwidth = 0.25 - xymax = np.max([np.max(np.fabs(x)), np.max(np.fabs(y))]) - lim = (int(xymax/binwidth) + 1) * binwidth - - axScatter.set_xlim((-lim, lim)) - axScatter.set_ylim((-lim, lim)) - - bins = np.arange(-lim, lim + binwidth, binwidth) - axHistx.hist(x, bins=bins) - axHisty.hist(y, bins=bins, orientation='horizontal') - - axHistx.set_xlim(axScatter.get_xlim()) - axHisty.set_ylim(axScatter.get_ylim()) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/scatter_masked.rst.txt b/_sources/examples/pylab_examples/scatter_masked.rst.txt deleted file mode 100644 index ba361cc352c..00000000000 --- a/_sources/examples/pylab_examples/scatter_masked.rst.txt +++ /dev/null @@ -1,33 +0,0 @@ -.. _pylab_examples-scatter_masked: - -pylab_examples example code: scatter_masked.py -============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/scatter_masked.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - N = 100 - r0 = 0.6 - x = 0.9*np.random.rand(N) - y = 0.9*np.random.rand(N) - area = np.pi*(10 * np.random.rand(N))**2 # 0 to 10 point radii - c = np.sqrt(area) - r = np.sqrt(x*x + y*y) - area1 = np.ma.masked_where(r < r0, area) - area2 = np.ma.masked_where(r >= r0, area) - plt.scatter(x, y, s=area1, marker='^', c=c) - plt.scatter(x, y, s=area2, marker='o', c=c) - # Show the boundary between the regions: - theta = np.arange(0, np.pi/2, 0.01) - plt.plot(r0*np.cos(theta), r0*np.sin(theta)) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/scatter_masked.txt b/_sources/examples/pylab_examples/scatter_masked.txt deleted file mode 100644 index caeed4c847f..00000000000 --- a/_sources/examples/pylab_examples/scatter_masked.txt +++ /dev/null @@ -1,33 +0,0 @@ -.. _pylab_examples-scatter_masked: - -pylab_examples example code: scatter_masked.py -============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/scatter_masked.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - N = 100 - r0 = 0.6 - x = 0.9*np.random.rand(N) - y = 0.9*np.random.rand(N) - area = np.pi*(10 * np.random.rand(N))**2 # 0 to 10 point radiuses - c = np.sqrt(area) - r = np.sqrt(x*x + y*y) - area1 = np.ma.masked_where(r < r0, area) - area2 = np.ma.masked_where(r >= r0, area) - plt.scatter(x, y, s=area1, marker='^', c=c, hold='on') - plt.scatter(x, y, s=area2, marker='o', c=c) - # Show the boundary between the regions: - theta = np.arange(0, np.pi/2, 0.01) - plt.plot(r0*np.cos(theta), r0*np.sin(theta)) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/scatter_profile.rst.txt b/_sources/examples/pylab_examples/scatter_profile.rst.txt deleted file mode 100644 index a779dfa0878..00000000000 --- a/_sources/examples/pylab_examples/scatter_profile.rst.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _pylab_examples-scatter_profile: - -pylab_examples example code: scatter_profile.py -=============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/scatter_profile.py - -:: - - """ - N Classic Base renderer Ext renderer - 20 0.22 0.14 0.14 - 100 0.16 0.14 0.13 - 1000 0.45 0.26 0.17 - 10000 3.30 1.31 0.53 - 50000 19.30 6.53 1.98 - """ - from __future__ import print_function # only needed for python 2.x - import matplotlib.pyplot as plt - import numpy as np - - import time - - for N in (20, 100, 1000, 10000, 50000): - tstart = time.time() - x = 0.9*np.random.rand(N) - y = 0.9*np.random.rand(N) - s = 20*np.random.rand(N) - plt.scatter(x, y, s) - print('%d symbols in %1.2f s' % (N, time.time() - tstart)) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/scatter_profile.txt b/_sources/examples/pylab_examples/scatter_profile.txt deleted file mode 100644 index a88bb67095c..00000000000 --- a/_sources/examples/pylab_examples/scatter_profile.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _pylab_examples-scatter_profile: - -pylab_examples example code: scatter_profile.py -=============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/scatter_profile.py - -:: - - """ - N Classic Base renderer Ext renderer - 20 0.22 0.14 0.14 - 100 0.16 0.14 0.13 - 1000 0.45 0.26 0.17 - 10000 3.30 1.31 0.53 - 50000 19.30 6.53 1.98 - """ - from __future__ import print_function # only needed for python 2.x - import matplotlib.pyplot as plt - import numpy as np - - import time - - for N in (20, 100, 1000, 10000, 50000): - tstart = time.time() - x = 0.9*np.random.rand(N) - y = 0.9*np.random.rand(N) - s = 20*np.random.rand(N) - plt.scatter(x, y, s) - print('%d symbols in %1.2f s' % (N, time.time() - tstart)) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/scatter_star_poly.rst.txt b/_sources/examples/pylab_examples/scatter_star_poly.rst.txt deleted file mode 100644 index be2801dc872..00000000000 --- a/_sources/examples/pylab_examples/scatter_star_poly.rst.txt +++ /dev/null @@ -1,44 +0,0 @@ -.. _pylab_examples-scatter_star_poly: - -pylab_examples example code: scatter_star_poly.py -================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/scatter_star_poly.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - - - x = np.random.rand(10) - y = np.random.rand(10) - z = np.sqrt(x**2 + y**2) - - plt.subplot(321) - plt.scatter(x, y, s=80, c=z, marker=">") - - plt.subplot(322) - plt.scatter(x, y, s=80, c=z, marker=(5, 0)) - - verts = list(zip([-1., 1., 1., -1.], [-1., -1., 1., -1.])) - plt.subplot(323) - plt.scatter(x, y, s=80, c=z, marker=(verts, 0)) - # equivalent: - #plt.scatter(x,y,s=80, c=z, marker=None, verts=verts) - - plt.subplot(324) - plt.scatter(x, y, s=80, c=z, marker=(5, 1)) - - plt.subplot(325) - plt.scatter(x, y, s=80, c=z, marker='+') - - plt.subplot(326) - plt.scatter(x, y, s=80, c=z, marker=(5, 2)) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/scatter_star_poly.txt b/_sources/examples/pylab_examples/scatter_star_poly.txt deleted file mode 100644 index e737a539621..00000000000 --- a/_sources/examples/pylab_examples/scatter_star_poly.txt +++ /dev/null @@ -1,44 +0,0 @@ -.. _pylab_examples-scatter_star_poly: - -pylab_examples example code: scatter_star_poly.py -================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/scatter_star_poly.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - - - x = np.random.rand(10) - y = np.random.rand(10) - z = np.sqrt(x**2 + y**2) - - plt.subplot(321) - plt.scatter(x, y, s=80, c=z, marker=">") - - plt.subplot(322) - plt.scatter(x, y, s=80, c=z, marker=(5, 0)) - - verts = list(zip([-1., 1., 1., -1.], [-1., -1., 1., -1.])) - plt.subplot(323) - plt.scatter(x, y, s=80, c=z, marker=(verts, 0)) - # equivalent: - #plt.scatter(x,y,s=80, c=z, marker=None, verts=verts) - - plt.subplot(324) - plt.scatter(x, y, s=80, c=z, marker=(5, 1)) - - plt.subplot(325) - plt.scatter(x, y, s=80, c=z, marker='+') - - plt.subplot(326) - plt.scatter(x, y, s=80, c=z, marker=(5, 2)) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/scatter_symbol.rst.txt b/_sources/examples/pylab_examples/scatter_symbol.rst.txt deleted file mode 100644 index 778f0ab8f37..00000000000 --- a/_sources/examples/pylab_examples/scatter_symbol.rst.txt +++ /dev/null @@ -1,28 +0,0 @@ -.. _pylab_examples-scatter_symbol: - -pylab_examples example code: scatter_symbol.py -============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/scatter_symbol.py - -:: - - from matplotlib import pyplot as plt - import numpy as np - import matplotlib - - x = np.arange(0.0, 50.0, 2.0) - y = x ** 1.3 + np.random.rand(*x.shape) * 30.0 - s = np.random.rand(*x.shape) * 800 + 500 - - plt.scatter(x, y, s, c="g", alpha=0.5, marker=r'$\clubsuit$', - label="Luck") - plt.xlabel("Leprechauns") - plt.ylabel("Gold") - plt.legend(loc=2) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/scatter_symbol.txt b/_sources/examples/pylab_examples/scatter_symbol.txt deleted file mode 100644 index b8a1973c018..00000000000 --- a/_sources/examples/pylab_examples/scatter_symbol.txt +++ /dev/null @@ -1,28 +0,0 @@ -.. _pylab_examples-scatter_symbol: - -pylab_examples example code: scatter_symbol.py -============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/scatter_symbol.py - -:: - - from matplotlib import pyplot as plt - import numpy as np - import matplotlib - - x = np.arange(0.0, 50.0, 2.0) - y = x ** 1.3 + np.random.rand(*x.shape) * 30.0 - s = np.random.rand(*x.shape) * 800 + 500 - - plt.scatter(x, y, s, c="g", alpha=0.5, marker=r'$\clubsuit$', - label="Luck") - plt.xlabel("Leprechauns") - plt.ylabel("Gold") - plt.legend(loc=2) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/set_and_get.rst.txt b/_sources/examples/pylab_examples/set_and_get.rst.txt deleted file mode 100644 index eb14f83d9d3..00000000000 --- a/_sources/examples/pylab_examples/set_and_get.rst.txt +++ /dev/null @@ -1,113 +0,0 @@ -.. _pylab_examples-set_and_get: - -pylab_examples example code: set_and_get.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/set_and_get.py - -:: - - """ - - The pyplot interface allows you to use setp and getp to set and get - object properties, as well as to do introspection on the object - - set: - To set the linestyle of a line to be dashed, you can do - - >>> line, = plt.plot([1,2,3]) - >>> plt.setp(line, linestyle='--') - - If you want to know the valid types of arguments, you can provide the - name of the property you want to set without a value - - >>> plt.setp(line, 'linestyle') - linestyle: [ '-' | '--' | '-.' | ':' | 'steps' | 'None' ] - - If you want to see all the properties that can be set, and their - possible values, you can do - - >>> plt.setp(line) - - set operates on a single instance or a list of instances. If you are - in query mode introspecting the possible values, only the first - instance in the sequence is used. When actually setting values, all - the instances will be set. e.g., suppose you have a list of two lines, - the following will make both lines thicker and red - - >>> x = np.arange(0,1.0,0.01) - >>> y1 = np.sin(2*np.pi*x) - >>> y2 = np.sin(4*np.pi*x) - >>> lines = plt.plot(x, y1, x, y2) - >>> plt.setp(lines, linewidth=2, color='r') - - - get: - - get returns the value of a given attribute. You can use get to query - the value of a single attribute - - >>> plt.getp(line, 'linewidth') - 0.5 - - or all the attribute/value pairs - - >>> plt.getp(line) - aa = True - alpha = 1.0 - antialiased = True - c = b - clip_on = True - color = b - ... long listing skipped ... - - Aliases: - - To reduce keystrokes in interactive mode, a number of properties - have short aliases, e.g., 'lw' for 'linewidth' and 'mec' for - 'markeredgecolor'. When calling set or get in introspection mode, - these properties will be listed as 'fullname or aliasname', as in - - - - - """ - - from __future__ import print_function - - import matplotlib.pyplot as plt - import numpy as np - - - x = np.arange(0, 1.0, 0.01) - y1 = np.sin(2*np.pi*x) - y2 = np.sin(4*np.pi*x) - lines = plt.plot(x, y1, x, y2) - l1, l2 = lines - plt.setp(lines, linestyle='--') # set both to dashed - plt.setp(l1, linewidth=2, color='r') # line1 is thick and red - plt.setp(l2, linewidth=1, color='g') # line2 is thinner and green - - - print('Line setters') - plt.setp(l1) - print('Line getters') - plt.getp(l1) - - print('Rectangle setters') - plt.setp(plt.gca().patch) - print('Rectangle getters') - plt.getp(plt.gca().patch) - - t = plt.title('Hi mom') - print('Text setters') - plt.setp(t) - print('Text getters') - plt.getp(t) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/set_and_get.txt b/_sources/examples/pylab_examples/set_and_get.txt deleted file mode 100644 index a13441547fe..00000000000 --- a/_sources/examples/pylab_examples/set_and_get.txt +++ /dev/null @@ -1,113 +0,0 @@ -.. _pylab_examples-set_and_get: - -pylab_examples example code: set_and_get.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/set_and_get.py - -:: - - """ - - The pyplot interface allows you to use setp and getp to set and get - object properties, as well as to do introspection on the object - - set: - To set the linestyle of a line to be dashed, you can do - - >>> line, = plt.plot([1,2,3]) - >>> plt.setp(line, linestyle='--') - - If you want to know the valid types of arguments, you can provide the - name of the property you want to set without a value - - >>> plt.setp(line, 'linestyle') - linestyle: [ '-' | '--' | '-.' | ':' | 'steps' | 'None' ] - - If you want to see all the properties that can be set, and their - possible values, you can do - - >>> plt.setp(line) - - set operates on a single instance or a list of instances. If you are - in query mode introspecting the possible values, only the first - instance in the sequence is used. When actually setting values, all - the instances will be set. e.g., suppose you have a list of two lines, - the following will make both lines thicker and red - - >>> x = np.arange(0,1.0,0.01) - >>> y1 = np.sin(2*np.pi*x) - >>> y2 = np.sin(4*np.pi*x) - >>> lines = plt.plot(x, y1, x, y2) - >>> plt.setp(lines, linewidth=2, color='r') - - - get: - - get returns the value of a given attribute. You can use get to query - the value of a single attribute - - >>> plt.getp(line, 'linewidth') - 0.5 - - or all the attribute/value pairs - - >>> plt.getp(line) - aa = True - alpha = 1.0 - antialiased = True - c = b - clip_on = True - color = b - ... long listing skipped ... - - Aliases: - - To reduce keystrokes in interactive mode, a number of properties - have short aliases, e.g., 'lw' for 'linewidth' and 'mec' for - 'markeredgecolor'. When calling set or get in introspection mode, - these properties will be listed as 'fullname or aliasname', as in - - - - - """ - - from __future__ import print_function - - import matplotlib.pyplot as plt - import numpy as np - - - x = np.arange(0, 1.0, 0.01) - y1 = np.sin(2*np.pi*x) - y2 = np.sin(4*np.pi*x) - lines = plt.plot(x, y1, x, y2) - l1, l2 = lines - plt.setp(lines, linestyle='--') # set both to dashed - plt.setp(l1, linewidth=2, color='r') # line1 is thick and red - plt.setp(l2, linewidth=1, color='g') # line2 is thicker and green - - - print('Line setters') - plt.setp(l1) - print('Line getters') - plt.getp(l1) - - print('Rectangle setters') - plt.setp(plt.gca().patch) - print('Rectangle getters') - plt.getp(plt.gca().patch) - - t = plt.title('Hi mom') - print('Text setters') - plt.setp(t) - print('Text getters') - plt.getp(t) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/shading_example.rst.txt b/_sources/examples/pylab_examples/shading_example.rst.txt deleted file mode 100644 index 9fa36098c54..00000000000 --- a/_sources/examples/pylab_examples/shading_example.rst.txt +++ /dev/null @@ -1,71 +0,0 @@ -.. _pylab_examples-shading_example: - -pylab_examples example code: shading_example.py -=============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/shading_example.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.colors import LightSource - from matplotlib.cbook import get_sample_data - - # Example showing how to make shaded relief plots - # like Mathematica - # (http://reference.wolfram.com/mathematica/ref/ReliefPlot.html) - # or Generic Mapping Tools - # (http://gmt.soest.hawaii.edu/gmt/doc/gmt/html/GMT_Docs/node145.html) - - - def main(): - # Test data - x, y = np.mgrid[-5:5:0.05, -5:5:0.05] - z = 5 * (np.sqrt(x**2 + y**2) + np.sin(x**2 + y**2)) - - filename = get_sample_data('jacksboro_fault_dem.npz', asfileobj=False) - with np.load(filename) as dem: - elev = dem['elevation'] - - fig = compare(z, plt.cm.copper) - fig.suptitle('HSV Blending Looks Best with Smooth Surfaces', y=0.95) - - fig = compare(elev, plt.cm.gist_earth, ve=0.05) - fig.suptitle('Overlay Blending Looks Best with Rough Surfaces', y=0.95) - - plt.show() - - - def compare(z, cmap, ve=1): - # Create subplots and hide ticks - fig, axes = plt.subplots(ncols=2, nrows=2) - for ax in axes.flat: - ax.set(xticks=[], yticks=[]) - - # Illuminate the scene from the northwest - ls = LightSource(azdeg=315, altdeg=45) - - axes[0, 0].imshow(z, cmap=cmap) - axes[0, 0].set(xlabel='Colormapped Data') - - axes[0, 1].imshow(ls.hillshade(z, vert_exag=ve), cmap='gray') - axes[0, 1].set(xlabel='Illumination Intensity') - - rgb = ls.shade(z, cmap=cmap, vert_exag=ve, blend_mode='hsv') - axes[1, 0].imshow(rgb) - axes[1, 0].set(xlabel='Blend Mode: "hsv" (default)') - - rgb = ls.shade(z, cmap=cmap, vert_exag=ve, blend_mode='overlay') - axes[1, 1].imshow(rgb) - axes[1, 1].set(xlabel='Blend Mode: "overlay"') - - return fig - - if __name__ == '__main__': - main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/shading_example.txt b/_sources/examples/pylab_examples/shading_example.txt deleted file mode 100644 index 8ce5a212c47..00000000000 --- a/_sources/examples/pylab_examples/shading_example.txt +++ /dev/null @@ -1,71 +0,0 @@ -.. _pylab_examples-shading_example: - -pylab_examples example code: shading_example.py -=============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/shading_example.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.colors import LightSource - from matplotlib.cbook import get_sample_data - - # Example showing how to make shaded relief plots - # like Mathematica - # (http://reference.wolfram.com/mathematica/ref/ReliefPlot.html) - # or Generic Mapping Tools - # (http://gmt.soest.hawaii.edu/gmt/doc/gmt/html/GMT_Docs/node145.html) - - - def main(): - # Test data - x, y = np.mgrid[-5:5:0.05, -5:5:0.05] - z = 5 * (np.sqrt(x**2 + y**2) + np.sin(x**2 + y**2)) - - filename = get_sample_data('jacksboro_fault_dem.npz', asfileobj=False) - with np.load(filename) as dem: - elev = dem['elevation'] - - fig = compare(z, plt.cm.copper) - fig.suptitle('HSV Blending Looks Best with Smooth Surfaces', y=0.95) - - fig = compare(elev, plt.cm.gist_earth, ve=0.05) - fig.suptitle('Overlay Blending Looks Best with Rough Surfaces', y=0.95) - - plt.show() - - - def compare(z, cmap, ve=1): - # Create subplots and hide ticks - fig, axes = plt.subplots(ncols=2, nrows=2) - for ax in axes.flat: - ax.set(xticks=[], yticks=[]) - - # Illuminate the scene from the northwest - ls = LightSource(azdeg=315, altdeg=45) - - axes[0, 0].imshow(z, cmap=cmap) - axes[0, 0].set(xlabel='Colormapped Data') - - axes[0, 1].imshow(ls.hillshade(z, vert_exag=ve), cmap='gray') - axes[0, 1].set(xlabel='Illumination Intensity') - - rgb = ls.shade(z, cmap=cmap, vert_exag=ve, blend_mode='hsv') - axes[1, 0].imshow(rgb) - axes[1, 0].set(xlabel='Blend Mode: "hsv" (default)') - - rgb = ls.shade(z, cmap=cmap, vert_exag=ve, blend_mode='overlay') - axes[1, 1].imshow(rgb) - axes[1, 1].set(xlabel='Blend Mode: "overlay"') - - return fig - - if __name__ == '__main__': - main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/shared_axis_across_figures.rst.txt b/_sources/examples/pylab_examples/shared_axis_across_figures.rst.txt deleted file mode 100644 index 3b9bcab8190..00000000000 --- a/_sources/examples/pylab_examples/shared_axis_across_figures.rst.txt +++ /dev/null @@ -1,41 +0,0 @@ -.. _pylab_examples-shared_axis_across_figures: - -pylab_examples example code: shared_axis_across_figures.py -========================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/shared_axis_across_figures.py - -:: - - """ - connect the data limits on the axes in one figure with the axes in - another. This is not the right way to do this for two axes in the - same figure -- use the sharex and sharey property in that case - """ - import numpy as np - import matplotlib.pyplot as plt - - fig1 = plt.figure() - fig2 = plt.figure() - - ax1 = fig1.add_subplot(111) - ax2 = fig2.add_subplot(111, sharex=ax1, sharey=ax1) - - ax1.plot(np.random.rand(100), 'o') - ax2.plot(np.random.rand(100), 'o') - - # In the latest release, it is no longer necessary to do anything - # special to share axes across figures: - - # ax1.sharex_foreign(ax2) - # ax2.sharex_foreign(ax1) - - # ax1.sharey_foreign(ax2) - # ax2.sharey_foreign(ax1) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/shared_axis_across_figures.txt b/_sources/examples/pylab_examples/shared_axis_across_figures.txt deleted file mode 100644 index fd4a299e7b1..00000000000 --- a/_sources/examples/pylab_examples/shared_axis_across_figures.txt +++ /dev/null @@ -1,41 +0,0 @@ -.. _pylab_examples-shared_axis_across_figures: - -pylab_examples example code: shared_axis_across_figures.py -========================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/shared_axis_across_figures.py - -:: - - """ - connect the data limits on the axes in one figure with the axes in - another. This is not the right way to do this for two axes in the - same figure -- use the sharex and sharey property in that case - """ - import numpy as np - import matplotlib.pyplot as plt - - fig1 = plt.figure() - fig2 = plt.figure() - - ax1 = fig1.add_subplot(111) - ax2 = fig2.add_subplot(111, sharex=ax1, sharey=ax1) - - ax1.plot(np.random.rand(100), 'o') - ax2.plot(np.random.rand(100), 'o') - - # In the latest release, it is no longer necessary to do anything - # special to share axes across figures: - - # ax1.sharex_foreign(ax2) - # ax2.sharex_foreign(ax1) - - # ax1.sharey_foreign(ax2) - # ax2.sharey_foreign(ax1) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/shared_axis_demo.rst.txt b/_sources/examples/pylab_examples/shared_axis_demo.rst.txt deleted file mode 100644 index 470f3ceef28..00000000000 --- a/_sources/examples/pylab_examples/shared_axis_demo.rst.txt +++ /dev/null @@ -1,67 +0,0 @@ -.. _pylab_examples-shared_axis_demo: - -pylab_examples example code: shared_axis_demo.py -================================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/shared_axis_demo.py - -:: - - """ - You can share the x or y axis limits for one axis with another by - passing an axes instance as a sharex or sharey kwarg. - - Changing the axis limits on one axes will be reflected automatically - in the other, and vice-versa, so when you navigate with the toolbar - the axes will follow each other on their shared axes. Ditto for - changes in the axis scaling (e.g., log vs linear). However, it is - possible to have differences in tick labeling, e.g., you can selectively - turn off the tick labels on one axes. - - The example below shows how to customize the tick labels on the - various axes. Shared axes share the tick locator, tick formatter, - view limits, and transformation (e.g., log, linear). But the ticklabels - themselves do not share properties. This is a feature and not a bug, - because you may want to make the tick labels smaller on the upper - axes, e.g., in the example below. - - If you want to turn off the ticklabels for a given axes (e.g., on - subplot(211) or subplot(212), you cannot do the standard trick - - setp(ax2, xticklabels=[]) - - because this changes the tick Formatter, which is shared among all - axes. But you can alter the visibility of the labels, which is a - property - - setp( ax2.get_xticklabels(), visible=False) - - """ - import matplotlib.pyplot as plt - import numpy as np - - t = np.arange(0.01, 5.0, 0.01) - s1 = np.sin(2*np.pi*t) - s2 = np.exp(-t) - s3 = np.sin(4*np.pi*t) - - ax1 = plt.subplot(311) - plt.plot(t, s1) - plt.setp(ax1.get_xticklabels(), fontsize=6) - - # share x only - ax2 = plt.subplot(312, sharex=ax1) - plt.plot(t, s2) - # make these tick labels invisible - plt.setp(ax2.get_xticklabels(), visible=False) - - # share x and y - ax3 = plt.subplot(313, sharex=ax1, sharey=ax1) - plt.plot(t, s3) - plt.xlim(0.01, 5.0) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/shared_axis_demo.txt b/_sources/examples/pylab_examples/shared_axis_demo.txt deleted file mode 100644 index 83d4840c3e9..00000000000 --- a/_sources/examples/pylab_examples/shared_axis_demo.txt +++ /dev/null @@ -1,67 +0,0 @@ -.. _pylab_examples-shared_axis_demo: - -pylab_examples example code: shared_axis_demo.py -================================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/shared_axis_demo.py - -:: - - """ - You can share the x or y axis limits for one axis with another by - passing an axes instance as a sharex or sharey kwarg. - - Changing the axis limits on one axes will be reflected automatically - in the other, and vice-versa, so when you navigate with the toolbar - the axes will follow each other on their shared axes. Ditto for - changes in the axis scaling (e.g., log vs linear). However, it is - possible to have differences in tick labeling, e.g., you can selectively - turn off the tick labels on one axes. - - The example below shows how to customize the tick labels on the - various axes. Shared axes share the tick locator, tick formatter, - view limits, and transformation (e.g., log, linear). But the ticklabels - themselves do not share properties. This is a feature and not a bug, - because you may want to make the tick labels smaller on the upper - axes, e.g., in the example below. - - If you want to turn off the ticklabels for a given axes (e.g., on - subplot(211) or subplot(212), you cannot do the standard trick - - setp(ax2, xticklabels=[]) - - because this changes the tick Formatter, which is shared among all - axes. But you can alter the visibility of the labels, which is a - property - - setp( ax2.get_xticklabels(), visible=False) - - """ - import matplotlib.pyplot as plt - import numpy as np - - t = np.arange(0.01, 5.0, 0.01) - s1 = np.sin(2*np.pi*t) - s2 = np.exp(-t) - s3 = np.sin(4*np.pi*t) - - ax1 = plt.subplot(311) - plt.plot(t, s1) - plt.setp(ax1.get_xticklabels(), fontsize=6) - - # share x only - ax2 = plt.subplot(312, sharex=ax1) - plt.plot(t, s2) - # make these tick labels invisible - plt.setp(ax2.get_xticklabels(), visible=False) - - # share x and y - ax3 = plt.subplot(313, sharex=ax1, sharey=ax1) - plt.plot(t, s3) - plt.xlim(0.01, 5.0) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/show_colormaps.txt b/_sources/examples/pylab_examples/show_colormaps.txt deleted file mode 100644 index 1f04c50a5ed..00000000000 --- a/_sources/examples/pylab_examples/show_colormaps.txt +++ /dev/null @@ -1,39 +0,0 @@ -.. _pylab_examples-show_colormaps: - -pylab_examples example code: show_colormaps.py -============================================== - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/show_colormaps.py - -:: - - # This example comes from the Cookbook on www.scipy.org. According to the - # history, Andrew Straw did the conversion from an old page, but it is - # unclear who the original author is. - import numpy as np - import matplotlib.pyplot as plt - - a = np.linspace(0, 1, 256).reshape(1,-1) - a = np.vstack((a,a)) - - # Get a list of the colormaps in matplotlib. Ignore the ones that end with - # '_r' because these are simply reversed versions of ones that don't end - # with '_r' - maps = sorted(m for m in plt.cm.datad if not m.endswith("_r")) - nmaps = len(maps) + 1 - - fig = plt.figure(figsize=(5,10)) - fig.subplots_adjust(top=0.99, bottom=0.01, left=0.2, right=0.99) - for i,m in enumerate(maps): - ax = plt.subplot(nmaps, 1, i+1) - plt.axis("off") - plt.imshow(a, aspect='auto', cmap=plt.get_cmap(m), origin='lower') - pos = list(ax.get_position().bounds) - fig.text(pos[0] - 0.01, pos[1], m, fontsize=10, horizontalalignment='right') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/simple_plot.rst.txt b/_sources/examples/pylab_examples/simple_plot.rst.txt deleted file mode 100644 index db6512ef9fa..00000000000 --- a/_sources/examples/pylab_examples/simple_plot.rst.txt +++ /dev/null @@ -1,27 +0,0 @@ -.. _pylab_examples-simple_plot: - -pylab_examples example code: simple_plot.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/simple_plot.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - t = np.arange(0.0, 2.0, 0.01) - s = 1 + np.sin(2*np.pi*t) - plt.plot(t, s) - - plt.xlabel('time (s)') - plt.ylabel('voltage (mV)') - plt.title('About as simple as it gets, folks') - plt.grid(True) - plt.savefig("test.png") - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/simple_plot.txt b/_sources/examples/pylab_examples/simple_plot.txt deleted file mode 100644 index 661b64ba51f..00000000000 --- a/_sources/examples/pylab_examples/simple_plot.txt +++ /dev/null @@ -1,27 +0,0 @@ -.. _pylab_examples-simple_plot: - -pylab_examples example code: simple_plot.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/simple_plot.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - t = np.arange(0.0, 2.0, 0.01) - s = np.sin(2*np.pi*t) - plt.plot(t, s) - - plt.xlabel('time (s)') - plt.ylabel('voltage (mV)') - plt.title('About as simple as it gets, folks') - plt.grid(True) - plt.savefig("test.png") - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/simple_plot_fps.txt b/_sources/examples/pylab_examples/simple_plot_fps.txt deleted file mode 100644 index ce8ba50898f..00000000000 --- a/_sources/examples/pylab_examples/simple_plot_fps.txt +++ /dev/null @@ -1,46 +0,0 @@ -.. _pylab_examples-simple_plot_fps: - -pylab_examples example code: simple_plot_fps.py -=============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/simple_plot_fps.py - -:: - - """ - Example: simple line plot. - Show how to make and save a simple line plot with labels, title and grid - """ - from __future__ import print_function # not necessary in Python 3.x - import matplotlib.pyplot as plt - import numpy as np - import time - - - plt.ion() - - t = np.arange(0.0, 1.0 + 0.001, 0.001) - s = np.cos(2*2*np.pi*t) - plt.plot(t, s, '-', lw=2) - - plt.xlabel('time (s)') - plt.ylabel('voltage (mV)') - plt.title('About as simple as it gets, folks') - plt.grid(True) - - frames = 100.0 - t = time.time() - c = time.clock() - for i in range(int(frames)): - part = i / frames - plt.axis([0.0, 1.0 - part, -1.0 + part, 1.0 - part]) - wallclock = time.time() - t - user = time.clock() - c - print("wallclock:", wallclock) - print("user:", user) - print("fps:", frames / wallclock) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/specgram_demo.rst.txt b/_sources/examples/pylab_examples/specgram_demo.rst.txt deleted file mode 100644 index e3df046005f..00000000000 --- a/_sources/examples/pylab_examples/specgram_demo.rst.txt +++ /dev/null @@ -1,43 +0,0 @@ -.. _pylab_examples-specgram_demo: - -pylab_examples example code: specgram_demo.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/specgram_demo.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - dt = 0.0005 - t = np.arange(0.0, 20.0, dt) - s1 = np.sin(2*np.pi*100*t) - s2 = 2*np.sin(2*np.pi*400*t) - - # create a transient "chirp" - mask = np.where(np.logical_and(t > 10, t < 12), 1.0, 0.0) - s2 = s2 * mask - - # add some noise into the mix - nse = 0.01*np.random.random(size=len(t)) - - x = s1 + s2 + nse # the signal - NFFT = 1024 # the length of the windowing segments - Fs = int(1.0/dt) # the sampling frequency - - # Pxx is the segments x freqs array of instantaneous power, freqs is - # the frequency vector, bins are the centers of the time bins in which - # the power is computed, and im is the matplotlib.image.AxesImage - # instance - - ax1 = plt.subplot(211) - plt.plot(t, x) - plt.subplot(212, sharex=ax1) - Pxx, freqs, bins, im = plt.specgram(x, NFFT=NFFT, Fs=Fs, noverlap=900) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/specgram_demo.txt b/_sources/examples/pylab_examples/specgram_demo.txt deleted file mode 100644 index 6a05923aaaf..00000000000 --- a/_sources/examples/pylab_examples/specgram_demo.txt +++ /dev/null @@ -1,44 +0,0 @@ -.. _pylab_examples-specgram_demo: - -pylab_examples example code: specgram_demo.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/specgram_demo.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - dt = 0.0005 - t = np.arange(0.0, 20.0, dt) - s1 = np.sin(2*np.pi*100*t) - s2 = 2*np.sin(2*np.pi*400*t) - - # create a transient "chirp" - mask = np.where(np.logical_and(t > 10, t < 12), 1.0, 0.0) - s2 = s2 * mask - - # add some noise into the mix - nse = 0.01*np.random.random(size=len(t)) - - x = s1 + s2 + nse # the signal - NFFT = 1024 # the length of the windowing segments - Fs = int(1.0/dt) # the sampling frequency - - # Pxx is the segments x freqs array of instantaneous power, freqs is - # the frequency vector, bins are the centers of the time bins in which - # the power is computed, and im is the matplotlib.image.AxesImage - # instance - - ax1 = plt.subplot(211) - plt.plot(t, x) - plt.subplot(212, sharex=ax1) - Pxx, freqs, bins, im = plt.specgram(x, NFFT=NFFT, Fs=Fs, noverlap=900, - cmap=plt.cm.gist_heat) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/spectrum_demo.rst.txt b/_sources/examples/pylab_examples/spectrum_demo.rst.txt deleted file mode 100644 index 09734d1e787..00000000000 --- a/_sources/examples/pylab_examples/spectrum_demo.rst.txt +++ /dev/null @@ -1,46 +0,0 @@ -.. _pylab_examples-spectrum_demo: - -pylab_examples example code: spectrum_demo.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/spectrum_demo.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - - np.random.seed(0) - - dt = 0.01 - Fs = 1/dt - t = np.arange(0, 10, dt) - nse = np.random.randn(len(t)) - r = np.exp(-t/0.05) - - cnse = np.convolve(nse, r)*dt - cnse = cnse[:len(t)] - s = 0.1*np.sin(2*np.pi*t) + cnse - - plt.subplot(3, 2, 1) - plt.plot(t, s) - - plt.subplot(3, 2, 3) - plt.magnitude_spectrum(s, Fs=Fs) - - plt.subplot(3, 2, 4) - plt.magnitude_spectrum(s, Fs=Fs, scale='dB') - - plt.subplot(3, 2, 5) - plt.angle_spectrum(s, Fs=Fs) - - plt.subplot(3, 2, 6) - plt.phase_spectrum(s, Fs=Fs) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/spectrum_demo.txt b/_sources/examples/pylab_examples/spectrum_demo.txt deleted file mode 100644 index e62e6b7604e..00000000000 --- a/_sources/examples/pylab_examples/spectrum_demo.txt +++ /dev/null @@ -1,43 +0,0 @@ -.. _pylab_examples-spectrum_demo: - -pylab_examples example code: spectrum_demo.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/spectrum_demo.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - dt = 0.01 - Fs = 1/dt - t = np.arange(0, 10, dt) - nse = np.random.randn(len(t)) - r = np.exp(-t/0.05) - - cnse = np.convolve(nse, r)*dt - cnse = cnse[:len(t)] - s = 0.1*np.sin(2*np.pi*t) + cnse - - plt.subplot(3, 2, 1) - plt.plot(t, s) - - plt.subplot(3, 2, 3) - plt.magnitude_spectrum(s, Fs=Fs) - - plt.subplot(3, 2, 4) - plt.magnitude_spectrum(s, Fs=Fs, scale='dB') - - plt.subplot(3, 2, 5) - plt.angle_spectrum(s, Fs=Fs) - - plt.subplot(3, 2, 6) - plt.phase_spectrum(s, Fs=Fs) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/spine_placement_demo.rst.txt b/_sources/examples/pylab_examples/spine_placement_demo.rst.txt deleted file mode 100644 index d7b8bb5cc20..00000000000 --- a/_sources/examples/pylab_examples/spine_placement_demo.rst.txt +++ /dev/null @@ -1,115 +0,0 @@ -.. _pylab_examples-spine_placement_demo: - -pylab_examples example code: spine_placement_demo.py -==================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/spine_placement_demo.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - - - fig = plt.figure() - x = np.linspace(-np.pi, np.pi, 100) - y = 2*np.sin(x) - - ax = fig.add_subplot(2, 2, 1) - ax.set_title('centered spines') - ax.plot(x, y) - ax.spines['left'].set_position('center') - ax.spines['right'].set_color('none') - ax.spines['bottom'].set_position('center') - ax.spines['top'].set_color('none') - ax.spines['left'].set_smart_bounds(True) - ax.spines['bottom'].set_smart_bounds(True) - ax.xaxis.set_ticks_position('bottom') - ax.yaxis.set_ticks_position('left') - - ax = fig.add_subplot(2, 2, 2) - ax.set_title('zeroed spines') - ax.plot(x, y) - ax.spines['left'].set_position('zero') - ax.spines['right'].set_color('none') - ax.spines['bottom'].set_position('zero') - ax.spines['top'].set_color('none') - ax.spines['left'].set_smart_bounds(True) - ax.spines['bottom'].set_smart_bounds(True) - ax.xaxis.set_ticks_position('bottom') - ax.yaxis.set_ticks_position('left') - - ax = fig.add_subplot(2, 2, 3) - ax.set_title('spines at axes (0.6, 0.1)') - ax.plot(x, y) - ax.spines['left'].set_position(('axes', 0.6)) - ax.spines['right'].set_color('none') - ax.spines['bottom'].set_position(('axes', 0.1)) - ax.spines['top'].set_color('none') - ax.spines['left'].set_smart_bounds(True) - ax.spines['bottom'].set_smart_bounds(True) - ax.xaxis.set_ticks_position('bottom') - ax.yaxis.set_ticks_position('left') - - ax = fig.add_subplot(2, 2, 4) - ax.set_title('spines at data (1, 2)') - ax.plot(x, y) - ax.spines['left'].set_position(('data', 1)) - ax.spines['right'].set_color('none') - ax.spines['bottom'].set_position(('data', 2)) - ax.spines['top'].set_color('none') - ax.spines['left'].set_smart_bounds(True) - ax.spines['bottom'].set_smart_bounds(True) - ax.xaxis.set_ticks_position('bottom') - ax.yaxis.set_ticks_position('left') - # ---------------------------------------------------- - - - def adjust_spines(ax, spines): - for loc, spine in ax.spines.items(): - if loc in spines: - spine.set_position(('outward', 10)) # outward by 10 points - spine.set_smart_bounds(True) - else: - spine.set_color('none') # don't draw spine - - # turn off ticks where there is no spine - if 'left' in spines: - ax.yaxis.set_ticks_position('left') - else: - # no yaxis ticks - ax.yaxis.set_ticks([]) - - if 'bottom' in spines: - ax.xaxis.set_ticks_position('bottom') - else: - # no xaxis ticks - ax.xaxis.set_ticks([]) - - fig = plt.figure() - - x = np.linspace(0, 2*np.pi, 100) - y = 2*np.sin(x) - - ax = fig.add_subplot(2, 2, 1) - ax.plot(x, y, clip_on=False) - adjust_spines(ax, ['left']) - - ax = fig.add_subplot(2, 2, 2) - ax.plot(x, y, clip_on=False) - adjust_spines(ax, []) - - ax = fig.add_subplot(2, 2, 3) - ax.plot(x, y, clip_on=False) - adjust_spines(ax, ['left', 'bottom']) - - ax = fig.add_subplot(2, 2, 4) - ax.plot(x, y, clip_on=False) - adjust_spines(ax, ['bottom']) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/spine_placement_demo.txt b/_sources/examples/pylab_examples/spine_placement_demo.txt deleted file mode 100644 index 99d8832b1c7..00000000000 --- a/_sources/examples/pylab_examples/spine_placement_demo.txt +++ /dev/null @@ -1,115 +0,0 @@ -.. _pylab_examples-spine_placement_demo: - -pylab_examples example code: spine_placement_demo.py -==================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/spine_placement_demo.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - - - fig = plt.figure() - x = np.linspace(-np.pi, np.pi, 100) - y = 2*np.sin(x) - - ax = fig.add_subplot(2, 2, 1) - ax.set_title('centered spines') - ax.plot(x, y) - ax.spines['left'].set_position('center') - ax.spines['right'].set_color('none') - ax.spines['bottom'].set_position('center') - ax.spines['top'].set_color('none') - ax.spines['left'].set_smart_bounds(True) - ax.spines['bottom'].set_smart_bounds(True) - ax.xaxis.set_ticks_position('bottom') - ax.yaxis.set_ticks_position('left') - - ax = fig.add_subplot(2, 2, 2) - ax.set_title('zeroed spines') - ax.plot(x, y) - ax.spines['left'].set_position('zero') - ax.spines['right'].set_color('none') - ax.spines['bottom'].set_position('zero') - ax.spines['top'].set_color('none') - ax.spines['left'].set_smart_bounds(True) - ax.spines['bottom'].set_smart_bounds(True) - ax.xaxis.set_ticks_position('bottom') - ax.yaxis.set_ticks_position('left') - - ax = fig.add_subplot(2, 2, 3) - ax.set_title('spines at axes (0.6, 0.1)') - ax.plot(x, y) - ax.spines['left'].set_position(('axes', 0.6)) - ax.spines['right'].set_color('none') - ax.spines['bottom'].set_position(('axes', 0.1)) - ax.spines['top'].set_color('none') - ax.spines['left'].set_smart_bounds(True) - ax.spines['bottom'].set_smart_bounds(True) - ax.xaxis.set_ticks_position('bottom') - ax.yaxis.set_ticks_position('left') - - ax = fig.add_subplot(2, 2, 4) - ax.set_title('spines at data (1, 2)') - ax.plot(x, y) - ax.spines['left'].set_position(('data', 1)) - ax.spines['right'].set_color('none') - ax.spines['bottom'].set_position(('data', 2)) - ax.spines['top'].set_color('none') - ax.spines['left'].set_smart_bounds(True) - ax.spines['bottom'].set_smart_bounds(True) - ax.xaxis.set_ticks_position('bottom') - ax.yaxis.set_ticks_position('left') - # ---------------------------------------------------- - - - def adjust_spines(ax, spines): - for loc, spine in ax.spines.items(): - if loc in spines: - spine.set_position(('outward', 10)) # outward by 10 points - spine.set_smart_bounds(True) - else: - spine.set_color('none') # don't draw spine - - # turn off ticks where there is no spine - if 'left' in spines: - ax.yaxis.set_ticks_position('left') - else: - # no yaxis ticks - ax.yaxis.set_ticks([]) - - if 'bottom' in spines: - ax.xaxis.set_ticks_position('bottom') - else: - # no xaxis ticks - ax.xaxis.set_ticks([]) - - fig = plt.figure() - - x = np.linspace(0, 2*np.pi, 100) - y = 2*np.sin(x) - - ax = fig.add_subplot(2, 2, 1) - ax.plot(x, y, clip_on=False) - adjust_spines(ax, ['left']) - - ax = fig.add_subplot(2, 2, 2) - ax.plot(x, y, clip_on=False) - adjust_spines(ax, []) - - ax = fig.add_subplot(2, 2, 3) - ax.plot(x, y, clip_on=False) - adjust_spines(ax, ['left', 'bottom']) - - ax = fig.add_subplot(2, 2, 4) - ax.plot(x, y, clip_on=False) - adjust_spines(ax, ['bottom']) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/spy_demos.rst.txt b/_sources/examples/pylab_examples/spy_demos.rst.txt deleted file mode 100644 index c66f89d65c1..00000000000 --- a/_sources/examples/pylab_examples/spy_demos.rst.txt +++ /dev/null @@ -1,38 +0,0 @@ -.. _pylab_examples-spy_demos: - -pylab_examples example code: spy_demos.py -========================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/spy_demos.py - -:: - - """ - Plot the sparsity pattern of arrays - """ - - from matplotlib.pyplot import figure, show - import numpy - - fig = figure() - ax1 = fig.add_subplot(221) - ax2 = fig.add_subplot(222) - ax3 = fig.add_subplot(223) - ax4 = fig.add_subplot(224) - - x = numpy.random.randn(20, 20) - x[5] = 0. - x[:, 12] = 0. - - ax1.spy(x, markersize=5) - ax2.spy(x, precision=0.1, markersize=5) - - ax3.spy(x) - ax4.spy(x, precision=0.1) - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/spy_demos.txt b/_sources/examples/pylab_examples/spy_demos.txt deleted file mode 100644 index 29e5ca66bb7..00000000000 --- a/_sources/examples/pylab_examples/spy_demos.txt +++ /dev/null @@ -1,38 +0,0 @@ -.. _pylab_examples-spy_demos: - -pylab_examples example code: spy_demos.py -========================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/spy_demos.py - -:: - - """ - Plot the sparsity pattern of arrays - """ - - from matplotlib.pyplot import figure, show - import numpy - - fig = figure() - ax1 = fig.add_subplot(221) - ax2 = fig.add_subplot(222) - ax3 = fig.add_subplot(223) - ax4 = fig.add_subplot(224) - - x = numpy.random.randn(20, 20) - x[5] = 0. - x[:, 12] = 0. - - ax1.spy(x, markersize=5) - ax2.spy(x, precision=0.1, markersize=5) - - ax3.spy(x) - ax4.spy(x, precision=0.1) - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/stackplot_demo.rst.txt b/_sources/examples/pylab_examples/stackplot_demo.rst.txt deleted file mode 100644 index a73fb2ea042..00000000000 --- a/_sources/examples/pylab_examples/stackplot_demo.rst.txt +++ /dev/null @@ -1,33 +0,0 @@ -.. _pylab_examples-stackplot_demo: - -pylab_examples example code: stackplot_demo.py -============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/stackplot_demo.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - - - def fnx(): - return np.random.randint(5, 50, 10) - - y = np.row_stack((fnx(), fnx(), fnx())) - x = np.arange(10) - - y1, y2, y3 = fnx(), fnx(), fnx() - - fig, ax = plt.subplots() - ax.stackplot(x, y) - plt.show() - - fig, ax = plt.subplots() - ax.stackplot(x, y1, y2, y3) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/stackplot_demo.txt b/_sources/examples/pylab_examples/stackplot_demo.txt deleted file mode 100644 index 416f880e002..00000000000 --- a/_sources/examples/pylab_examples/stackplot_demo.txt +++ /dev/null @@ -1,33 +0,0 @@ -.. _pylab_examples-stackplot_demo: - -pylab_examples example code: stackplot_demo.py -============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/stackplot_demo.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - - - def fnx(): - return np.random.randint(5, 50, 10) - - y = np.row_stack((fnx(), fnx(), fnx())) - x = np.arange(10) - - y1, y2, y3 = fnx(), fnx(), fnx() - - fig, ax = plt.subplots() - ax.stackplot(x, y) - plt.show() - - fig, ax = plt.subplots() - ax.stackplot(x, y1, y2, y3) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/stackplot_demo2.rst.txt b/_sources/examples/pylab_examples/stackplot_demo2.rst.txt deleted file mode 100644 index 912c2c0a838..00000000000 --- a/_sources/examples/pylab_examples/stackplot_demo2.rst.txt +++ /dev/null @@ -1,42 +0,0 @@ -.. _pylab_examples-stackplot_demo2: - -pylab_examples example code: stackplot_demo2.py -=============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/stackplot_demo2.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - - np.random.seed(0) - - - def layers(n, m): - """ - Return *n* random Gaussian mixtures, each of length *m*. - """ - def bump(a): - x = 1 / (.1 + np.random.random()) - y = 2 * np.random.random() - .5 - z = 10 / (.1 + np.random.random()) - for i in range(m): - w = (i / float(m) - y) * z - a[i] += x * np.exp(-w * w) - a = np.zeros((m, n)) - for i in range(n): - for j in range(5): - bump(a[:, i]) - return a - - d = layers(3, 100) - - plt.subplots() - plt.stackplot(range(100), d.T, baseline='wiggle') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/stackplot_demo2.txt b/_sources/examples/pylab_examples/stackplot_demo2.txt deleted file mode 100644 index 3d26826acbf..00000000000 --- a/_sources/examples/pylab_examples/stackplot_demo2.txt +++ /dev/null @@ -1,42 +0,0 @@ -.. _pylab_examples-stackplot_demo2: - -pylab_examples example code: stackplot_demo2.py -=============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/stackplot_demo2.py - -:: - - import numpy as np - import matplotlib.pyplot as plt - - np.random.seed(0) - - - def layers(n, m): - """ - Return *n* random Gaussian mixtures, each of length *m*. - """ - def bump(a): - x = 1 / (.1 + np.random.random()) - y = 2 * np.random.random() - .5 - z = 10 / (.1 + np.random.random()) - for i in range(m): - w = (i / float(m) - y) * z - a[i] += x * np.exp(-w * w) - a = np.zeros((m, n)) - for i in range(n): - for j in range(5): - bump(a[:, i]) - return a - - d = layers(3, 100) - - plt.subplots() - plt.stackplot(range(100), d.T, baseline='wiggle') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/stem_plot.rst.txt b/_sources/examples/pylab_examples/stem_plot.rst.txt deleted file mode 100644 index 84a273a6372..00000000000 --- a/_sources/examples/pylab_examples/stem_plot.rst.txt +++ /dev/null @@ -1,22 +0,0 @@ -.. _pylab_examples-stem_plot: - -pylab_examples example code: stem_plot.py -========================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/stem_plot.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - x = np.linspace(0.1, 2*np.pi, 10) - markerline, stemlines, baseline = plt.stem(x, np.cos(x), '-.') - plt.setp(baseline, 'color', 'r', 'linewidth', 2) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/stem_plot.txt b/_sources/examples/pylab_examples/stem_plot.txt deleted file mode 100644 index 049b6525bae..00000000000 --- a/_sources/examples/pylab_examples/stem_plot.txt +++ /dev/null @@ -1,23 +0,0 @@ -.. _pylab_examples-stem_plot: - -pylab_examples example code: stem_plot.py -========================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/stem_plot.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - x = np.linspace(0.1, 2*np.pi, 10) - markerline, stemlines, baseline = plt.stem(x, np.cos(x), '-.') - plt.setp(markerline, 'markerfacecolor', 'b') - plt.setp(baseline, 'color', 'r', 'linewidth', 2) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/step_demo.rst.txt b/_sources/examples/pylab_examples/step_demo.rst.txt deleted file mode 100644 index 5d6c2c7edf6..00000000000 --- a/_sources/examples/pylab_examples/step_demo.rst.txt +++ /dev/null @@ -1,39 +0,0 @@ -.. _pylab_examples-step_demo: - -pylab_examples example code: step_demo.py -========================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/step_demo.py - -:: - - import numpy as np - from numpy import ma - import matplotlib.pyplot as plt - - x = np.arange(1, 7, 0.4) - y0 = np.sin(x) - y = y0.copy() + 2.5 - - plt.step(x, y, label='pre (default)') - - y -= 0.5 - plt.step(x, y, where='mid', label='mid') - - y -= 0.5 - plt.step(x, y, where='post', label='post') - - y = ma.masked_where((y0 > -0.15) & (y0 < 0.15), y - 0.5) - plt.step(x, y, label='masked (pre)') - - plt.legend() - - plt.xlim(0, 7) - plt.ylim(-0.5, 4) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/step_demo.txt b/_sources/examples/pylab_examples/step_demo.txt deleted file mode 100644 index eece5f42e01..00000000000 --- a/_sources/examples/pylab_examples/step_demo.txt +++ /dev/null @@ -1,39 +0,0 @@ -.. _pylab_examples-step_demo: - -pylab_examples example code: step_demo.py -========================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/step_demo.py - -:: - - import numpy as np - from numpy import ma - import matplotlib.pyplot as plt - - x = np.arange(1, 7, 0.4) - y0 = np.sin(x) - y = y0.copy() + 2.5 - - plt.step(x, y, label='pre (default)') - - y -= 0.5 - plt.step(x, y, where='mid', label='mid') - - y -= 0.5 - plt.step(x, y, where='post', label='post') - - y = ma.masked_where((y0 > -0.15) & (y0 < 0.15), y - 0.5) - plt.step(x, y, label='masked (pre)') - - plt.legend() - - plt.xlim(0, 7) - plt.ylim(-0.5, 4) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/stix_fonts_demo.rst.txt b/_sources/examples/pylab_examples/stix_fonts_demo.rst.txt deleted file mode 100644 index 19d7bec8eaa..00000000000 --- a/_sources/examples/pylab_examples/stix_fonts_demo.rst.txt +++ /dev/null @@ -1,72 +0,0 @@ -.. _pylab_examples-stix_fonts_demo: - -pylab_examples example code: stix_fonts_demo.py -=============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/stix_fonts_demo.py - -:: - - from __future__ import unicode_literals - - import os - import sys - import re - import gc - import matplotlib.pyplot as plt - import numpy as np - - stests = [ - r'$\mathcircled{123} \mathrm{\mathcircled{123}}' - r' \mathbf{\mathcircled{123}}$', - r'$\mathsf{Sans \Omega} \mathrm{\mathsf{Sans \Omega}}' - r' \mathbf{\mathsf{Sans \Omega}}$', - r'$\mathtt{Monospace}$', - r'$\mathcal{CALLIGRAPHIC}$', - r'$\mathbb{Blackboard \pi}$', - r'$\mathrm{\mathbb{Blackboard \pi}}$', - r'$\mathbf{\mathbb{Blackboard \pi}}$', - r'$\mathfrak{Fraktur} \mathbf{\mathfrak{Fraktur}}$', - r'$\mathscr{Script}$'] - - if sys.maxunicode > 0xffff: - s = r'Direct Unicode: $\u23ce \mathrm{\ue0f2 \U0001D538}$' - - - def doall(): - tests = stests - - plt.figure(figsize=(8, (len(tests) * 1) + 2)) - plt.plot([0, 0], 'r') - plt.grid(False) - plt.axis([0, 3, -len(tests), 0]) - plt.yticks(np.arange(len(tests)) * -1) - for i, s in enumerate(tests): - plt.text(0.1, -i, s, fontsize=32) - - plt.savefig('stix_fonts_example') - plt.show() - - - if '--latex' in sys.argv: - fd = open("stix_fonts_examples.ltx", "w") - fd.write("\\documentclass{article}\n") - fd.write("\\begin{document}\n") - fd.write("\\begin{enumerate}\n") - - for i, s in enumerate(stests): - s = re.sub(r"(? 0xffff: - s = r'Direct Unicode: $\u23ce \mathrm{\ue0f2 \U0001D538}$' - - - def doall(): - tests = stests - - plt.figure(figsize=(8, (len(tests) * 1) + 2)) - plt.plot([0, 0], 'r') - plt.grid(False) - plt.axis([0, 3, -len(tests), 0]) - plt.yticks(np.arange(len(tests)) * -1) - for i, s in enumerate(tests): - plt.text(0.1, -i, s, fontsize=32) - - plt.savefig('stix_fonts_example') - plt.show() - - - if '--latex' in sys.argv: - fd = open("stix_fonts_examples.ltx", "w") - fd.write("\\documentclass{article}\n") - fd.write("\\begin{document}\n") - fd.write("\\begin{enumerate}\n") - - for i, s in enumerate(stests): - s = re.sub(r"(?3 might result in a very high number of triangles - # for the refine mesh: new triangles numbering = (4**subdiv)*ntri - - init_mask_frac = 0.0 # Float > 0. adjusting the proportion of - # (invalid) initial triangles which will be masked - # out. Enter 0 for no mask. - - min_circle_ratio = .01 # Minimum circle ratio - border triangles with circle - # ratio below this will be masked if they touch a - # border. Suggested value 0.01 ; Use -1 to keep - # all triangles. - - # Random points - random_gen = np.random.mtrand.RandomState(seed=127260) - x_test = random_gen.uniform(-1., 1., size=n_test) - y_test = random_gen.uniform(-1., 1., size=n_test) - z_test = experiment_res(x_test, y_test) - - # meshing with Delaunay triangulation - tri = Triangulation(x_test, y_test) - ntri = tri.triangles.shape[0] - - # Some invalid data are masked out - mask_init = np.zeros(ntri, dtype=np.bool) - masked_tri = random_gen.randint(0, ntri, int(ntri*init_mask_frac)) - mask_init[masked_tri] = True - tri.set_mask(mask_init) - - - #----------------------------------------------------------------------------- - # Improving the triangulation before high-res plots: removing flat triangles - #----------------------------------------------------------------------------- - # masking badly shaped triangles at the border of the triangular mesh. - mask = TriAnalyzer(tri).get_flat_tri_mask(min_circle_ratio) - tri.set_mask(mask) - - # refining the data - refiner = UniformTriRefiner(tri) - tri_refi, z_test_refi = refiner.refine_field(z_test, subdiv=subdiv) - - # analytical 'results' for comparison - z_expected = experiment_res(tri_refi.x, tri_refi.y) - - # for the demo: loading the 'flat' triangles for plot - flat_tri = Triangulation(x_test, y_test) - flat_tri.set_mask(~mask) - - - #----------------------------------------------------------------------------- - # Now the plots - #----------------------------------------------------------------------------- - # User options for plots - plot_tri = True # plot of base triangulation - plot_masked_tri = True # plot of excessively flat excluded triangles - plot_refi_tri = False # plot of refined triangulation - plot_expected = False # plot of analytical function values for comparison - - - # Graphical options for tricontouring - levels = np.arange(0., 1., 0.025) - cmap = cm.get_cmap(name='Blues', lut=None) - - plt.figure() - plt.gca().set_aspect('equal') - plt.title("Filtering a Delaunay mesh\n" + - "(application to high-resolution tricontouring)") - - # 1) plot of the refined (computed) data contours: - plt.tricontour(tri_refi, z_test_refi, levels=levels, cmap=cmap, - linewidths=[2.0, 0.5, 1.0, 0.5]) - # 2) plot of the expected (analytical) data contours (dashed): - if plot_expected: - plt.tricontour(tri_refi, z_expected, levels=levels, cmap=cmap, - linestyles='--') - # 3) plot of the fine mesh on which interpolation was done: - if plot_refi_tri: - plt.triplot(tri_refi, color='0.97') - # 4) plot of the initial 'coarse' mesh: - if plot_tri: - plt.triplot(tri, color='0.7') - # 4) plot of the unvalidated triangles from naive Delaunay Triangulation: - if plot_masked_tri: - plt.triplot(flat_tri, color='red') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/tricontour_smooth_delaunay.txt b/_sources/examples/pylab_examples/tricontour_smooth_delaunay.txt deleted file mode 100644 index 43117b31ffd..00000000000 --- a/_sources/examples/pylab_examples/tricontour_smooth_delaunay.txt +++ /dev/null @@ -1,147 +0,0 @@ -.. _pylab_examples-tricontour_smooth_delaunay: - -pylab_examples example code: tricontour_smooth_delaunay.py -========================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/tricontour_smooth_delaunay.py - -:: - - """ - Demonstrates high-resolution tricontouring of a random set of points ; - a matplotlib.tri.TriAnalyzer is used to improve the plot quality. - - The initial data points and triangular grid for this demo are: - - a set of random points is instantiated, inside [-1, 1] x [-1, 1] square - - A Delaunay triangulation of these points is then computed, of which a - random subset of triangles is masked out by the user (based on - *init_mask_frac* parameter). This simulates invalidated data. - - The proposed generic procedure to obtain a high resolution contouring of such - a data set is the following: - 1) Compute an extended mask with a matplotlib.tri.TriAnalyzer, which will - exclude badly shaped (flat) triangles from the border of the - triangulation. Apply the mask to the triangulation (using set_mask). - 2) Refine and interpolate the data using a - matplotlib.tri.UniformTriRefiner. - 3) Plot the refined data with tricontour. - - """ - from matplotlib.tri import Triangulation, TriAnalyzer, UniformTriRefiner - import matplotlib.pyplot as plt - import matplotlib.cm as cm - import numpy as np - - - #----------------------------------------------------------------------------- - # Analytical test function - #----------------------------------------------------------------------------- - def experiment_res(x, y): - """ An analytic function representing experiment results """ - x = 2.*x - r1 = np.sqrt((0.5 - x)**2 + (0.5 - y)**2) - theta1 = np.arctan2(0.5 - x, 0.5 - y) - r2 = np.sqrt((-x - 0.2)**2 + (-y - 0.2)**2) - theta2 = np.arctan2(-x - 0.2, -y - 0.2) - z = (4*(np.exp((r1/10)**2) - 1)*30. * np.cos(3*theta1) + - (np.exp((r2/10)**2) - 1)*30. * np.cos(5*theta2) + - 2*(x**2 + y**2)) - return (np.max(z) - z)/(np.max(z) - np.min(z)) - - #----------------------------------------------------------------------------- - # Generating the initial data test points and triangulation for the demo - #----------------------------------------------------------------------------- - # User parameters for data test points - n_test = 200 # Number of test data points, tested from 3 to 5000 for subdiv=3 - - subdiv = 3 # Number of recursive subdivisions of the initial mesh for smooth - # plots. Values >3 might result in a very high number of triangles - # for the refine mesh: new triangles numbering = (4**subdiv)*ntri - - init_mask_frac = 0.0 # Float > 0. adjusting the proportion of - # (invalid) initial triangles which will be masked - # out. Enter 0 for no mask. - - min_circle_ratio = .01 # Minimum circle ratio - border triangles with circle - # ratio below this will be masked if they touch a - # border. Suggested value 0.01 ; Use -1 to keep - # all triangles. - - # Random points - random_gen = np.random.mtrand.RandomState(seed=127260) - x_test = random_gen.uniform(-1., 1., size=n_test) - y_test = random_gen.uniform(-1., 1., size=n_test) - z_test = experiment_res(x_test, y_test) - - # meshing with Delaunay triangulation - tri = Triangulation(x_test, y_test) - ntri = tri.triangles.shape[0] - - # Some invalid data are masked out - mask_init = np.zeros(ntri, dtype=np.bool) - masked_tri = random_gen.randint(0, ntri, int(ntri*init_mask_frac)) - mask_init[masked_tri] = True - tri.set_mask(mask_init) - - - #----------------------------------------------------------------------------- - # Improving the triangulation before high-res plots: removing flat triangles - #----------------------------------------------------------------------------- - # masking badly shaped triangles at the border of the triangular mesh. - mask = TriAnalyzer(tri).get_flat_tri_mask(min_circle_ratio) - tri.set_mask(mask) - - # refining the data - refiner = UniformTriRefiner(tri) - tri_refi, z_test_refi = refiner.refine_field(z_test, subdiv=subdiv) - - # analytical 'results' for comparison - z_expected = experiment_res(tri_refi.x, tri_refi.y) - - # for the demo: loading the 'flat' triangles for plot - flat_tri = Triangulation(x_test, y_test) - flat_tri.set_mask(~mask) - - - #----------------------------------------------------------------------------- - # Now the plots - #----------------------------------------------------------------------------- - # User options for plots - plot_tri = True # plot of base triangulation - plot_masked_tri = True # plot of excessively flat excluded triangles - plot_refi_tri = False # plot of refined triangulation - plot_expected = False # plot of analytical function values for comparison - - - # Graphical options for tricontouring - levels = np.arange(0., 1., 0.025) - cmap = cm.get_cmap(name='Blues', lut=None) - - plt.figure() - plt.gca().set_aspect('equal') - plt.title("Filtering a Delaunay mesh\n" + - "(application to high-resolution tricontouring)") - - # 1) plot of the refined (computed) data countours: - plt.tricontour(tri_refi, z_test_refi, levels=levels, cmap=cmap, - linewidths=[2.0, 0.5, 1.0, 0.5]) - # 2) plot of the expected (analytical) data countours (dashed): - if plot_expected: - plt.tricontour(tri_refi, z_expected, levels=levels, cmap=cmap, - linestyles='--') - # 3) plot of the fine mesh on which interpolation was done: - if plot_refi_tri: - plt.triplot(tri_refi, color='0.97') - # 4) plot of the initial 'coarse' mesh: - if plot_tri: - plt.triplot(tri, color='0.7') - # 4) plot of the unvalidated triangles from naive Delaunay Triangulation: - if plot_masked_tri: - plt.triplot(flat_tri, color='red') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/tricontour_smooth_user.rst.txt b/_sources/examples/pylab_examples/tricontour_smooth_user.rst.txt deleted file mode 100644 index d2d6d46bc48..00000000000 --- a/_sources/examples/pylab_examples/tricontour_smooth_user.rst.txt +++ /dev/null @@ -1,90 +0,0 @@ -.. _pylab_examples-tricontour_smooth_user: - -pylab_examples example code: tricontour_smooth_user.py -====================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/tricontour_smooth_user.py - -:: - - """ - Demonstrates high-resolution tricontouring on user-defined triangular grids - with matplotlib.tri.UniformTriRefiner - """ - import matplotlib.tri as tri - import matplotlib.pyplot as plt - import matplotlib.cm as cm - import numpy as np - import math - - - #----------------------------------------------------------------------------- - # Analytical test function - #----------------------------------------------------------------------------- - def function_z(x, y): - """ A function of 2 variables """ - r1 = np.sqrt((0.5 - x)**2 + (0.5 - y)**2) - theta1 = np.arctan2(0.5 - x, 0.5 - y) - r2 = np.sqrt((-x - 0.2)**2 + (-y - 0.2)**2) - theta2 = np.arctan2(-x - 0.2, -y - 0.2) - z = -(2*(np.exp((r1/10)**2) - 1)*30. * np.cos(7.*theta1) + - (np.exp((r2/10)**2) - 1)*30. * np.cos(11.*theta2) + - 0.7*(x**2 + y**2)) - return (np.max(z) - z)/(np.max(z) - np.min(z)) - - #----------------------------------------------------------------------------- - # Creating a Triangulation - #----------------------------------------------------------------------------- - # First create the x and y coordinates of the points. - n_angles = 20 - n_radii = 10 - min_radius = 0.15 - radii = np.linspace(min_radius, 0.95, n_radii) - - angles = np.linspace(0, 2*math.pi, n_angles, endpoint=False) - angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) - angles[:, 1::2] += math.pi/n_angles - - x = (radii*np.cos(angles)).flatten() - y = (radii*np.sin(angles)).flatten() - z = function_z(x, y) - - # Now create the Triangulation. - # (Creating a Triangulation without specifying the triangles results in the - # Delaunay triangulation of the points.) - triang = tri.Triangulation(x, y) - - # Mask off unwanted triangles. - xmid = x[triang.triangles].mean(axis=1) - ymid = y[triang.triangles].mean(axis=1) - mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0) - triang.set_mask(mask) - - #----------------------------------------------------------------------------- - # Refine data - #----------------------------------------------------------------------------- - refiner = tri.UniformTriRefiner(triang) - tri_refi, z_test_refi = refiner.refine_field(z, subdiv=3) - - #----------------------------------------------------------------------------- - # Plot the triangulation and the high-res iso-contours - #----------------------------------------------------------------------------- - plt.figure() - plt.gca().set_aspect('equal') - plt.triplot(triang, lw=0.5, color='white') - - levels = np.arange(0., 1., 0.025) - cmap = cm.get_cmap(name='terrain', lut=None) - plt.tricontourf(tri_refi, z_test_refi, levels=levels, cmap=cmap) - plt.tricontour(tri_refi, z_test_refi, levels=levels, - colors=['0.25', '0.5', '0.5', '0.5', '0.5'], - linewidths=[1.0, 0.5, 0.5, 0.5, 0.5]) - - plt.title("High-resolution tricontouring") - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/tricontour_smooth_user.txt b/_sources/examples/pylab_examples/tricontour_smooth_user.txt deleted file mode 100644 index 45038716b70..00000000000 --- a/_sources/examples/pylab_examples/tricontour_smooth_user.txt +++ /dev/null @@ -1,90 +0,0 @@ -.. _pylab_examples-tricontour_smooth_user: - -pylab_examples example code: tricontour_smooth_user.py -====================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/tricontour_smooth_user.py - -:: - - """ - Demonstrates high-resolution tricontouring on user-defined triangular grids - with matplotlib.tri.UniformTriRefiner - """ - import matplotlib.tri as tri - import matplotlib.pyplot as plt - import matplotlib.cm as cm - import numpy as np - import math - - - #----------------------------------------------------------------------------- - # Analytical test function - #----------------------------------------------------------------------------- - def function_z(x, y): - """ A function of 2 variables """ - r1 = np.sqrt((0.5 - x)**2 + (0.5 - y)**2) - theta1 = np.arctan2(0.5 - x, 0.5 - y) - r2 = np.sqrt((-x - 0.2)**2 + (-y - 0.2)**2) - theta2 = np.arctan2(-x - 0.2, -y - 0.2) - z = -(2*(np.exp((r1/10)**2) - 1)*30. * np.cos(7.*theta1) + - (np.exp((r2/10)**2) - 1)*30. * np.cos(11.*theta2) + - 0.7*(x**2 + y**2)) - return (np.max(z) - z)/(np.max(z) - np.min(z)) - - #----------------------------------------------------------------------------- - # Creating a Triangulation - #----------------------------------------------------------------------------- - # First create the x and y coordinates of the points. - n_angles = 20 - n_radii = 10 - min_radius = 0.15 - radii = np.linspace(min_radius, 0.95, n_radii) - - angles = np.linspace(0, 2*math.pi, n_angles, endpoint=False) - angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) - angles[:, 1::2] += math.pi/n_angles - - x = (radii*np.cos(angles)).flatten() - y = (radii*np.sin(angles)).flatten() - z = function_z(x, y) - - # Now create the Triangulation. - # (Creating a Triangulation without specifying the triangles results in the - # Delaunay triangulation of the points.) - triang = tri.Triangulation(x, y) - - # Mask off unwanted triangles. - xmid = x[triang.triangles].mean(axis=1) - ymid = y[triang.triangles].mean(axis=1) - mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0) - triang.set_mask(mask) - - #----------------------------------------------------------------------------- - # Refine data - #----------------------------------------------------------------------------- - refiner = tri.UniformTriRefiner(triang) - tri_refi, z_test_refi = refiner.refine_field(z, subdiv=3) - - #----------------------------------------------------------------------------- - # Plot the triangulation and the high-res iso-contours - #----------------------------------------------------------------------------- - plt.figure() - plt.gca().set_aspect('equal') - plt.triplot(triang, lw=0.5, color='white') - - levels = np.arange(0., 1., 0.025) - cmap = cm.get_cmap(name='terrain', lut=None) - plt.tricontourf(tri_refi, z_test_refi, levels=levels, cmap=cmap) - plt.tricontour(tri_refi, z_test_refi, levels=levels, - colors=['0.25', '0.5', '0.5', '0.5', '0.5'], - linewidths=[1.0, 0.5, 0.5, 0.5, 0.5]) - - plt.title("High-resolution tricontouring") - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/tricontour_vs_griddata.rst.txt b/_sources/examples/pylab_examples/tricontour_vs_griddata.rst.txt deleted file mode 100644 index 022c72b8807..00000000000 --- a/_sources/examples/pylab_examples/tricontour_vs_griddata.rst.txt +++ /dev/null @@ -1,67 +0,0 @@ -.. _pylab_examples-tricontour_vs_griddata: - -pylab_examples example code: tricontour_vs_griddata.py -====================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/tricontour_vs_griddata.py - -:: - - """ - Comparison of griddata and tricontour for an unstructured triangular grid. - """ - from __future__ import print_function - import matplotlib.pyplot as plt - import matplotlib.tri as tri - import numpy as np - import numpy.random as rnd - import matplotlib.mlab as mlab - import time - - rnd.seed(0) - npts = 200 - ngridx = 100 - ngridy = 200 - x = rnd.uniform(-2, 2, npts) - y = rnd.uniform(-2, 2, npts) - z = x*np.exp(-x**2 - y**2) - - # griddata and contour. - start = time.clock() - plt.subplot(211) - xi = np.linspace(-2.1, 2.1, ngridx) - yi = np.linspace(-2.1, 2.1, ngridy) - zi = mlab.griddata(x, y, z, xi, yi, interp='linear') - plt.contour(xi, yi, zi, 15, linewidths=0.5, colors='k') - plt.contourf(xi, yi, zi, 15, - norm=plt.Normalize(vmax=abs(zi).max(), vmin=-abs(zi).max())) - plt.colorbar() # draw colorbar - plt.plot(x, y, 'ko', ms=3) - plt.xlim(-2, 2) - plt.ylim(-2, 2) - plt.title('griddata and contour (%d points, %d grid points)' % - (npts, ngridx*ngridy)) - print('griddata and contour seconds: %f' % (time.clock() - start)) - - # tricontour. - start = time.clock() - plt.subplot(212) - triang = tri.Triangulation(x, y) - plt.tricontour(x, y, z, 15, linewidths=0.5, colors='k') - plt.tricontourf(x, y, z, 15, - norm=plt.Normalize(vmax=abs(zi).max(), vmin=-abs(zi).max())) - plt.colorbar() - plt.plot(x, y, 'ko', ms=3) - plt.xlim(-2, 2) - plt.ylim(-2, 2) - plt.title('tricontour (%d points)' % npts) - print('tricontour seconds: %f' % (time.clock() - start)) - - plt.subplots_adjust(hspace=0.5) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/tricontour_vs_griddata.txt b/_sources/examples/pylab_examples/tricontour_vs_griddata.txt deleted file mode 100644 index ecbdaf998a2..00000000000 --- a/_sources/examples/pylab_examples/tricontour_vs_griddata.txt +++ /dev/null @@ -1,65 +0,0 @@ -.. _pylab_examples-tricontour_vs_griddata: - -pylab_examples example code: tricontour_vs_griddata.py -====================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/tricontour_vs_griddata.py - -:: - - """ - Comparison of griddata and tricontour for an unstructured triangular grid. - """ - from __future__ import print_function - import matplotlib.pyplot as plt - import matplotlib.tri as tri - import numpy as np - import numpy.random as rnd - import matplotlib.mlab as mlab - import time - - rnd.seed(0) - npts = 200 - ngridx = 100 - ngridy = 200 - x = rnd.uniform(-2, 2, npts) - y = rnd.uniform(-2, 2, npts) - z = x*np.exp(-x**2 - y**2) - - # griddata and contour. - start = time.clock() - plt.subplot(211) - xi = np.linspace(-2.1, 2.1, ngridx) - yi = np.linspace(-2.1, 2.1, ngridy) - zi = mlab.griddata(x, y, z, xi, yi, interp='linear') - plt.contour(xi, yi, zi, 15, linewidths=0.5, colors='k') - plt.contourf(xi, yi, zi, 15, cmap=plt.cm.rainbow, - norm=plt.Normalize(vmax=abs(zi).max(), vmin=-abs(zi).max())) - plt.colorbar() # draw colorbar - plt.plot(x, y, 'ko', ms=3) - plt.xlim(-2, 2) - plt.ylim(-2, 2) - plt.title('griddata and contour (%d points, %d grid points)' % - (npts, ngridx*ngridy)) - print('griddata and contour seconds: %f' % (time.clock() - start)) - - # tricontour. - start = time.clock() - plt.subplot(212) - triang = tri.Triangulation(x, y) - plt.tricontour(x, y, z, 15, linewidths=0.5, colors='k') - plt.tricontourf(x, y, z, 15, cmap=plt.cm.rainbow, - norm=plt.Normalize(vmax=abs(zi).max(), vmin=-abs(zi).max())) - plt.colorbar() - plt.plot(x, y, 'ko', ms=3) - plt.xlim(-2, 2) - plt.ylim(-2, 2) - plt.title('tricontour (%d points)' % npts) - print('tricontour seconds: %f' % (time.clock() - start)) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/trigradient_demo.rst.txt b/_sources/examples/pylab_examples/trigradient_demo.rst.txt deleted file mode 100644 index 50a44eb3e95..00000000000 --- a/_sources/examples/pylab_examples/trigradient_demo.rst.txt +++ /dev/null @@ -1,99 +0,0 @@ -.. _pylab_examples-trigradient_demo: - -pylab_examples example code: trigradient_demo.py -================================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/trigradient_demo.py - -:: - - """ - Demonstrates computation of gradient with matplotlib.tri.CubicTriInterpolator. - """ - from matplotlib.tri import Triangulation, UniformTriRefiner,\ - CubicTriInterpolator - import matplotlib.pyplot as plt - import matplotlib.cm as cm - import numpy as np - import math - - - #----------------------------------------------------------------------------- - # Electrical potential of a dipole - #----------------------------------------------------------------------------- - def dipole_potential(x, y): - """ The electric dipole potential V """ - r_sq = x**2 + y**2 - theta = np.arctan2(y, x) - z = np.cos(theta)/r_sq - return (np.max(z) - z) / (np.max(z) - np.min(z)) - - - #----------------------------------------------------------------------------- - # Creating a Triangulation - #----------------------------------------------------------------------------- - # First create the x and y coordinates of the points. - n_angles = 30 - n_radii = 10 - min_radius = 0.2 - radii = np.linspace(min_radius, 0.95, n_radii) - - angles = np.linspace(0, 2*math.pi, n_angles, endpoint=False) - angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) - angles[:, 1::2] += math.pi/n_angles - - x = (radii*np.cos(angles)).flatten() - y = (radii*np.sin(angles)).flatten() - V = dipole_potential(x, y) - - # Create the Triangulation; no triangles specified so Delaunay triangulation - # created. - triang = Triangulation(x, y) - - # Mask off unwanted triangles. - xmid = x[triang.triangles].mean(axis=1) - ymid = y[triang.triangles].mean(axis=1) - mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0) - triang.set_mask(mask) - - #----------------------------------------------------------------------------- - # Refine data - interpolates the electrical potential V - #----------------------------------------------------------------------------- - refiner = UniformTriRefiner(triang) - tri_refi, z_test_refi = refiner.refine_field(V, subdiv=3) - - #----------------------------------------------------------------------------- - # Computes the electrical field (Ex, Ey) as gradient of electrical potential - #----------------------------------------------------------------------------- - tci = CubicTriInterpolator(triang, -V) - # Gradient requested here at the mesh nodes but could be anywhere else: - (Ex, Ey) = tci.gradient(triang.x, triang.y) - E_norm = np.sqrt(Ex**2 + Ey**2) - - #----------------------------------------------------------------------------- - # Plot the triangulation, the potential iso-contours and the vector field - #----------------------------------------------------------------------------- - fig, ax = plt.subplots() - ax.set_aspect('equal') - # Enforce the margins, and enlarge them to give room for the vectors. - ax.use_sticky_edges = False - ax.margins(0.07) - - ax.triplot(triang, color='0.8') - - levels = np.arange(0., 1., 0.01) - cmap = cm.get_cmap(name='hot', lut=None) - ax.tricontour(tri_refi, z_test_refi, levels=levels, cmap=cmap, - linewidths=[2.0, 1.0, 1.0, 1.0]) - # Plots direction of the electrical vector field - ax.quiver(triang.x, triang.y, Ex/E_norm, Ey/E_norm, - units='xy', scale=10., zorder=3, color='blue', - width=0.007, headwidth=3., headlength=4.) - - ax.set_title('Gradient plot: an electrical dipole') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/trigradient_demo.txt b/_sources/examples/pylab_examples/trigradient_demo.txt deleted file mode 100644 index 3d1c12085ff..00000000000 --- a/_sources/examples/pylab_examples/trigradient_demo.txt +++ /dev/null @@ -1,95 +0,0 @@ -.. _pylab_examples-trigradient_demo: - -pylab_examples example code: trigradient_demo.py -================================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/trigradient_demo.py - -:: - - """ - Demonstrates computation of gradient with matplotlib.tri.CubicTriInterpolator. - """ - from matplotlib.tri import Triangulation, UniformTriRefiner,\ - CubicTriInterpolator - import matplotlib.pyplot as plt - import matplotlib.cm as cm - import numpy as np - import math - - - #----------------------------------------------------------------------------- - # Electrical potential of a dipole - #----------------------------------------------------------------------------- - def dipole_potential(x, y): - """ The electric dipole potential V """ - r_sq = x**2 + y**2 - theta = np.arctan2(y, x) - z = np.cos(theta)/r_sq - return (np.max(z) - z) / (np.max(z) - np.min(z)) - - - #----------------------------------------------------------------------------- - # Creating a Triangulation - #----------------------------------------------------------------------------- - # First create the x and y coordinates of the points. - n_angles = 30 - n_radii = 10 - min_radius = 0.2 - radii = np.linspace(min_radius, 0.95, n_radii) - - angles = np.linspace(0, 2*math.pi, n_angles, endpoint=False) - angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) - angles[:, 1::2] += math.pi/n_angles - - x = (radii*np.cos(angles)).flatten() - y = (radii*np.sin(angles)).flatten() - V = dipole_potential(x, y) - - # Create the Triangulation; no triangles specified so Delaunay triangulation - # created. - triang = Triangulation(x, y) - - # Mask off unwanted triangles. - xmid = x[triang.triangles].mean(axis=1) - ymid = y[triang.triangles].mean(axis=1) - mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0) - triang.set_mask(mask) - - #----------------------------------------------------------------------------- - # Refine data - interpolates the electrical potential V - #----------------------------------------------------------------------------- - refiner = UniformTriRefiner(triang) - tri_refi, z_test_refi = refiner.refine_field(V, subdiv=3) - - #----------------------------------------------------------------------------- - # Computes the electrical field (Ex, Ey) as gradient of electrical potential - #----------------------------------------------------------------------------- - tci = CubicTriInterpolator(triang, -V) - # Gradient requested here at the mesh nodes but could be anywhere else: - (Ex, Ey) = tci.gradient(triang.x, triang.y) - E_norm = np.sqrt(Ex**2 + Ey**2) - - #----------------------------------------------------------------------------- - # Plot the triangulation, the potential iso-contours and the vector field - #----------------------------------------------------------------------------- - plt.figure() - plt.gca().set_aspect('equal') - plt.triplot(triang, color='0.8') - - levels = np.arange(0., 1., 0.01) - cmap = cm.get_cmap(name='hot', lut=None) - plt.tricontour(tri_refi, z_test_refi, levels=levels, cmap=cmap, - linewidths=[2.0, 1.0, 1.0, 1.0]) - # Plots direction of the electrical vector field - plt.quiver(triang.x, triang.y, Ex/E_norm, Ey/E_norm, - units='xy', scale=10., zorder=3, color='blue', - width=0.007, headwidth=3., headlength=4.) - - plt.title('Gradient plot: an electrical dipole') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/triinterp_demo.rst.txt b/_sources/examples/pylab_examples/triinterp_demo.rst.txt deleted file mode 100644 index f7e7edc6144..00000000000 --- a/_sources/examples/pylab_examples/triinterp_demo.rst.txt +++ /dev/null @@ -1,71 +0,0 @@ -.. _pylab_examples-triinterp_demo: - -pylab_examples example code: triinterp_demo.py -============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/triinterp_demo.py - -:: - - """ - Interpolation from triangular grid to quad grid. - """ - import matplotlib.pyplot as plt - import matplotlib.tri as mtri - import numpy as np - - # Create triangulation. - x = np.asarray([0, 1, 2, 3, 0.5, 1.5, 2.5, 1, 2, 1.5]) - y = np.asarray([0, 0, 0, 0, 1.0, 1.0, 1.0, 2, 2, 3.0]) - triangles = [[0, 1, 4], [1, 2, 5], [2, 3, 6], [1, 5, 4], [2, 6, 5], [4, 5, 7], - [5, 6, 8], [5, 8, 7], [7, 8, 9]] - triang = mtri.Triangulation(x, y, triangles) - - # Interpolate to regularly-spaced quad grid. - z = np.cos(1.5*x)*np.cos(1.5*y) - xi, yi = np.meshgrid(np.linspace(0, 3, 20), np.linspace(0, 3, 20)) - - interp_lin = mtri.LinearTriInterpolator(triang, z) - zi_lin = interp_lin(xi, yi) - - interp_cubic_geom = mtri.CubicTriInterpolator(triang, z, kind='geom') - zi_cubic_geom = interp_cubic_geom(xi, yi) - - interp_cubic_min_E = mtri.CubicTriInterpolator(triang, z, kind='min_E') - zi_cubic_min_E = interp_cubic_min_E(xi, yi) - - - # Plot the triangulation. - plt.subplot(221) - plt.tricontourf(triang, z) - plt.triplot(triang, 'ko-') - plt.title('Triangular grid') - - # Plot linear interpolation to quad grid. - plt.subplot(222) - plt.contourf(xi, yi, zi_lin) - plt.plot(xi, yi, 'k-', lw=0.5, alpha=0.5) - plt.plot(xi.T, yi.T, 'k-', lw=0.5, alpha=0.5) - plt.title("Linear interpolation") - - # Plot cubic interpolation to quad grid, kind=geom - plt.subplot(223) - plt.contourf(xi, yi, zi_cubic_geom) - plt.plot(xi, yi, 'k-', lw=0.5, alpha=0.5) - plt.plot(xi.T, yi.T, 'k-', lw=0.5, alpha=0.5) - plt.title("Cubic interpolation,\nkind='geom'") - - # Plot cubic interpolation to quad grid, kind=min_E - plt.subplot(224) - plt.contourf(xi, yi, zi_cubic_min_E) - plt.plot(xi, yi, 'k-', lw=0.5, alpha=0.5) - plt.plot(xi.T, yi.T, 'k-', lw=0.5, alpha=0.5) - plt.title("Cubic interpolation,\nkind='min_E'") - - plt.tight_layout() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/triinterp_demo.txt b/_sources/examples/pylab_examples/triinterp_demo.txt deleted file mode 100644 index 07fade91c8a..00000000000 --- a/_sources/examples/pylab_examples/triinterp_demo.txt +++ /dev/null @@ -1,71 +0,0 @@ -.. _pylab_examples-triinterp_demo: - -pylab_examples example code: triinterp_demo.py -============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/triinterp_demo.py - -:: - - """ - Interpolation from triangular grid to quad grid. - """ - import matplotlib.pyplot as plt - import matplotlib.tri as mtri - import numpy as np - - # Create triangulation. - x = np.asarray([0, 1, 2, 3, 0.5, 1.5, 2.5, 1, 2, 1.5]) - y = np.asarray([0, 0, 0, 0, 1.0, 1.0, 1.0, 2, 2, 3.0]) - triangles = [[0, 1, 4], [1, 2, 5], [2, 3, 6], [1, 5, 4], [2, 6, 5], [4, 5, 7], - [5, 6, 8], [5, 8, 7], [7, 8, 9]] - triang = mtri.Triangulation(x, y, triangles) - - # Interpolate to regularly-spaced quad grid. - z = np.cos(1.5*x)*np.cos(1.5*y) - xi, yi = np.meshgrid(np.linspace(0, 3, 20), np.linspace(0, 3, 20)) - - interp_lin = mtri.LinearTriInterpolator(triang, z) - zi_lin = interp_lin(xi, yi) - - interp_cubic_geom = mtri.CubicTriInterpolator(triang, z, kind='geom') - zi_cubic_geom = interp_cubic_geom(xi, yi) - - interp_cubic_min_E = mtri.CubicTriInterpolator(triang, z, kind='min_E') - zi_cubic_min_E = interp_cubic_min_E(xi, yi) - - - # Plot the triangulation. - plt.subplot(221) - plt.tricontourf(triang, z) - plt.triplot(triang, 'ko-') - plt.title('Triangular grid') - - # Plot linear interpolation to quad grid. - plt.subplot(222) - plt.contourf(xi, yi, zi_lin) - plt.plot(xi, yi, 'k-', alpha=0.5) - plt.plot(xi.T, yi.T, 'k-', alpha=0.5) - plt.title("Linear interpolation") - - # Plot cubic interpolation to quad grid, kind=geom - plt.subplot(223) - plt.contourf(xi, yi, zi_cubic_geom) - plt.plot(xi, yi, 'k-', alpha=0.5) - plt.plot(xi.T, yi.T, 'k-', alpha=0.5) - plt.title("Cubic interpolation,\nkind='geom'") - - # Plot cubic interpolation to quad grid, kind=min_E - plt.subplot(224) - plt.contourf(xi, yi, zi_cubic_min_E) - plt.plot(xi, yi, 'k-', alpha=0.5) - plt.plot(xi.T, yi.T, 'k-', alpha=0.5) - plt.title("Cubic interpolation,\nkind='min_E'") - - plt.tight_layout() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/tripcolor_demo.rst.txt b/_sources/examples/pylab_examples/tripcolor_demo.rst.txt deleted file mode 100644 index 44bb872eb81..00000000000 --- a/_sources/examples/pylab_examples/tripcolor_demo.rst.txt +++ /dev/null @@ -1,130 +0,0 @@ -.. _pylab_examples-tripcolor_demo: - -pylab_examples example code: tripcolor_demo.py -============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/tripcolor_demo.py - -:: - - """ - Pseudocolor plots of unstructured triangular grids. - """ - import matplotlib.pyplot as plt - import matplotlib.tri as tri - import numpy as np - import math - - # Creating a Triangulation without specifying the triangles results in the - # Delaunay triangulation of the points. - - # First create the x and y coordinates of the points. - n_angles = 36 - n_radii = 8 - min_radius = 0.25 - radii = np.linspace(min_radius, 0.95, n_radii) - - angles = np.linspace(0, 2*math.pi, n_angles, endpoint=False) - angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) - angles[:, 1::2] += math.pi/n_angles - - x = (radii*np.cos(angles)).flatten() - y = (radii*np.sin(angles)).flatten() - z = (np.cos(radii)*np.cos(angles*3.0)).flatten() - - # Create the Triangulation; no triangles so Delaunay triangulation created. - triang = tri.Triangulation(x, y) - - # Mask off unwanted triangles. - xmid = x[triang.triangles].mean(axis=1) - ymid = y[triang.triangles].mean(axis=1) - mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0) - triang.set_mask(mask) - - # tripcolor plot. - plt.figure() - plt.gca().set_aspect('equal') - plt.tripcolor(triang, z, shading='flat') - plt.colorbar() - plt.title('tripcolor of Delaunay triangulation, flat shading') - - # Illustrate Gouraud shading. - plt.figure() - plt.gca().set_aspect('equal') - plt.tripcolor(triang, z, shading='gouraud') - plt.colorbar() - plt.title('tripcolor of Delaunay triangulation, gouraud shading') - - - # You can specify your own triangulation rather than perform a Delaunay - # triangulation of the points, where each triangle is given by the indices of - # the three points that make up the triangle, ordered in either a clockwise or - # anticlockwise manner. - - xy = np.asarray([ - [-0.101, 0.872], [-0.080, 0.883], [-0.069, 0.888], [-0.054, 0.890], - [-0.045, 0.897], [-0.057, 0.895], [-0.073, 0.900], [-0.087, 0.898], - [-0.090, 0.904], [-0.069, 0.907], [-0.069, 0.921], [-0.080, 0.919], - [-0.073, 0.928], [-0.052, 0.930], [-0.048, 0.942], [-0.062, 0.949], - [-0.054, 0.958], [-0.069, 0.954], [-0.087, 0.952], [-0.087, 0.959], - [-0.080, 0.966], [-0.085, 0.973], [-0.087, 0.965], [-0.097, 0.965], - [-0.097, 0.975], [-0.092, 0.984], [-0.101, 0.980], [-0.108, 0.980], - [-0.104, 0.987], [-0.102, 0.993], [-0.115, 1.001], [-0.099, 0.996], - [-0.101, 1.007], [-0.090, 1.010], [-0.087, 1.021], [-0.069, 1.021], - [-0.052, 1.022], [-0.052, 1.017], [-0.069, 1.010], [-0.064, 1.005], - [-0.048, 1.005], [-0.031, 1.005], [-0.031, 0.996], [-0.040, 0.987], - [-0.045, 0.980], [-0.052, 0.975], [-0.040, 0.973], [-0.026, 0.968], - [-0.020, 0.954], [-0.006, 0.947], [ 0.003, 0.935], [ 0.006, 0.926], - [ 0.005, 0.921], [ 0.022, 0.923], [ 0.033, 0.912], [ 0.029, 0.905], - [ 0.017, 0.900], [ 0.012, 0.895], [ 0.027, 0.893], [ 0.019, 0.886], - [ 0.001, 0.883], [-0.012, 0.884], [-0.029, 0.883], [-0.038, 0.879], - [-0.057, 0.881], [-0.062, 0.876], [-0.078, 0.876], [-0.087, 0.872], - [-0.030, 0.907], [-0.007, 0.905], [-0.057, 0.916], [-0.025, 0.933], - [-0.077, 0.990], [-0.059, 0.993]]) - x = xy[:, 0]*180/3.14159 - y = xy[:, 1]*180/3.14159 - - triangles = np.asarray([ - [67, 66, 1], [65, 2, 66], [ 1, 66, 2], [64, 2, 65], [63, 3, 64], - [60, 59, 57], [ 2, 64, 3], [ 3, 63, 4], [ 0, 67, 1], [62, 4, 63], - [57, 59, 56], [59, 58, 56], [61, 60, 69], [57, 69, 60], [ 4, 62, 68], - [ 6, 5, 9], [61, 68, 62], [69, 68, 61], [ 9, 5, 70], [ 6, 8, 7], - [ 4, 70, 5], [ 8, 6, 9], [56, 69, 57], [69, 56, 52], [70, 10, 9], - [54, 53, 55], [56, 55, 53], [68, 70, 4], [52, 56, 53], [11, 10, 12], - [69, 71, 68], [68, 13, 70], [10, 70, 13], [51, 50, 52], [13, 68, 71], - [52, 71, 69], [12, 10, 13], [71, 52, 50], [71, 14, 13], [50, 49, 71], - [49, 48, 71], [14, 16, 15], [14, 71, 48], [17, 19, 18], [17, 20, 19], - [48, 16, 14], [48, 47, 16], [47, 46, 16], [16, 46, 45], [23, 22, 24], - [21, 24, 22], [17, 16, 45], [20, 17, 45], [21, 25, 24], [27, 26, 28], - [20, 72, 21], [25, 21, 72], [45, 72, 20], [25, 28, 26], [44, 73, 45], - [72, 45, 73], [28, 25, 29], [29, 25, 31], [43, 73, 44], [73, 43, 40], - [72, 73, 39], [72, 31, 25], [42, 40, 43], [31, 30, 29], [39, 73, 40], - [42, 41, 40], [72, 33, 31], [32, 31, 33], [39, 38, 72], [33, 72, 38], - [33, 38, 34], [37, 35, 38], [34, 38, 35], [35, 37, 36]]) - - xmid = x[triangles].mean(axis=1) - ymid = y[triangles].mean(axis=1) - x0 = -5 - y0 = 52 - zfaces = np.exp(-0.01*((xmid - x0)*(xmid - x0) + (ymid - y0)*(ymid - y0))) - - # Rather than create a Triangulation object, can simply pass x, y and triangles - # arrays to tripcolor directly. It would be better to use a Triangulation - # object if the same triangulation was to be used more than once to save - # duplicated calculations. - # Can specify one color value per face rather than one per point by using the - # facecolors kwarg. - plt.figure() - plt.gca().set_aspect('equal') - plt.tripcolor(x, y, triangles, facecolors=zfaces, edgecolors='k') - plt.colorbar() - plt.title('tripcolor of user-specified triangulation') - plt.xlabel('Longitude (degrees)') - plt.ylabel('Latitude (degrees)') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/tripcolor_demo.txt b/_sources/examples/pylab_examples/tripcolor_demo.txt deleted file mode 100644 index 8241c4a0952..00000000000 --- a/_sources/examples/pylab_examples/tripcolor_demo.txt +++ /dev/null @@ -1,130 +0,0 @@ -.. _pylab_examples-tripcolor_demo: - -pylab_examples example code: tripcolor_demo.py -============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/tripcolor_demo.py - -:: - - """ - Pseudocolor plots of unstructured triangular grids. - """ - import matplotlib.pyplot as plt - import matplotlib.tri as tri - import numpy as np - import math - - # Creating a Triangulation without specifying the triangles results in the - # Delaunay triangulation of the points. - - # First create the x and y coordinates of the points. - n_angles = 36 - n_radii = 8 - min_radius = 0.25 - radii = np.linspace(min_radius, 0.95, n_radii) - - angles = np.linspace(0, 2*math.pi, n_angles, endpoint=False) - angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) - angles[:, 1::2] += math.pi/n_angles - - x = (radii*np.cos(angles)).flatten() - y = (radii*np.sin(angles)).flatten() - z = (np.cos(radii)*np.cos(angles*3.0)).flatten() - - # Create the Triangulation; no triangles so Delaunay triangulation created. - triang = tri.Triangulation(x, y) - - # Mask off unwanted triangles. - xmid = x[triang.triangles].mean(axis=1) - ymid = y[triang.triangles].mean(axis=1) - mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0) - triang.set_mask(mask) - - # tripcolor plot. - plt.figure() - plt.gca().set_aspect('equal') - plt.tripcolor(triang, z, shading='flat', cmap=plt.cm.rainbow) - plt.colorbar() - plt.title('tripcolor of Delaunay triangulation, flat shading') - - # Illustrate Gouraud shading. - plt.figure() - plt.gca().set_aspect('equal') - plt.tripcolor(triang, z, shading='gouraud', cmap=plt.cm.rainbow) - plt.colorbar() - plt.title('tripcolor of Delaunay triangulation, gouraud shading') - - - # You can specify your own triangulation rather than perform a Delaunay - # triangulation of the points, where each triangle is given by the indices of - # the three points that make up the triangle, ordered in either a clockwise or - # anticlockwise manner. - - xy = np.asarray([ - [-0.101, 0.872], [-0.080, 0.883], [-0.069, 0.888], [-0.054, 0.890], - [-0.045, 0.897], [-0.057, 0.895], [-0.073, 0.900], [-0.087, 0.898], - [-0.090, 0.904], [-0.069, 0.907], [-0.069, 0.921], [-0.080, 0.919], - [-0.073, 0.928], [-0.052, 0.930], [-0.048, 0.942], [-0.062, 0.949], - [-0.054, 0.958], [-0.069, 0.954], [-0.087, 0.952], [-0.087, 0.959], - [-0.080, 0.966], [-0.085, 0.973], [-0.087, 0.965], [-0.097, 0.965], - [-0.097, 0.975], [-0.092, 0.984], [-0.101, 0.980], [-0.108, 0.980], - [-0.104, 0.987], [-0.102, 0.993], [-0.115, 1.001], [-0.099, 0.996], - [-0.101, 1.007], [-0.090, 1.010], [-0.087, 1.021], [-0.069, 1.021], - [-0.052, 1.022], [-0.052, 1.017], [-0.069, 1.010], [-0.064, 1.005], - [-0.048, 1.005], [-0.031, 1.005], [-0.031, 0.996], [-0.040, 0.987], - [-0.045, 0.980], [-0.052, 0.975], [-0.040, 0.973], [-0.026, 0.968], - [-0.020, 0.954], [-0.006, 0.947], [ 0.003, 0.935], [ 0.006, 0.926], - [ 0.005, 0.921], [ 0.022, 0.923], [ 0.033, 0.912], [ 0.029, 0.905], - [ 0.017, 0.900], [ 0.012, 0.895], [ 0.027, 0.893], [ 0.019, 0.886], - [ 0.001, 0.883], [-0.012, 0.884], [-0.029, 0.883], [-0.038, 0.879], - [-0.057, 0.881], [-0.062, 0.876], [-0.078, 0.876], [-0.087, 0.872], - [-0.030, 0.907], [-0.007, 0.905], [-0.057, 0.916], [-0.025, 0.933], - [-0.077, 0.990], [-0.059, 0.993]]) - x = xy[:, 0]*180/3.14159 - y = xy[:, 1]*180/3.14159 - - triangles = np.asarray([ - [67, 66, 1], [65, 2, 66], [ 1, 66, 2], [64, 2, 65], [63, 3, 64], - [60, 59, 57], [ 2, 64, 3], [ 3, 63, 4], [ 0, 67, 1], [62, 4, 63], - [57, 59, 56], [59, 58, 56], [61, 60, 69], [57, 69, 60], [ 4, 62, 68], - [ 6, 5, 9], [61, 68, 62], [69, 68, 61], [ 9, 5, 70], [ 6, 8, 7], - [ 4, 70, 5], [ 8, 6, 9], [56, 69, 57], [69, 56, 52], [70, 10, 9], - [54, 53, 55], [56, 55, 53], [68, 70, 4], [52, 56, 53], [11, 10, 12], - [69, 71, 68], [68, 13, 70], [10, 70, 13], [51, 50, 52], [13, 68, 71], - [52, 71, 69], [12, 10, 13], [71, 52, 50], [71, 14, 13], [50, 49, 71], - [49, 48, 71], [14, 16, 15], [14, 71, 48], [17, 19, 18], [17, 20, 19], - [48, 16, 14], [48, 47, 16], [47, 46, 16], [16, 46, 45], [23, 22, 24], - [21, 24, 22], [17, 16, 45], [20, 17, 45], [21, 25, 24], [27, 26, 28], - [20, 72, 21], [25, 21, 72], [45, 72, 20], [25, 28, 26], [44, 73, 45], - [72, 45, 73], [28, 25, 29], [29, 25, 31], [43, 73, 44], [73, 43, 40], - [72, 73, 39], [72, 31, 25], [42, 40, 43], [31, 30, 29], [39, 73, 40], - [42, 41, 40], [72, 33, 31], [32, 31, 33], [39, 38, 72], [33, 72, 38], - [33, 38, 34], [37, 35, 38], [34, 38, 35], [35, 37, 36]]) - - xmid = x[triangles].mean(axis=1) - ymid = y[triangles].mean(axis=1) - x0 = -5 - y0 = 52 - zfaces = np.exp(-0.01*((xmid - x0)*(xmid - x0) + (ymid - y0)*(ymid - y0))) - - # Rather than create a Triangulation object, can simply pass x, y and triangles - # arrays to tripcolor directly. It would be better to use a Triangulation - # object if the same triangulation was to be used more than once to save - # duplicated calculations. - # Can specify one color value per face rather than one per point by using the - # facecolors kwarg. - plt.figure() - plt.gca().set_aspect('equal') - plt.tripcolor(x, y, triangles, facecolors=zfaces, edgecolors='k') - plt.colorbar() - plt.title('tripcolor of user-specified triangulation') - plt.xlabel('Longitude (degrees)') - plt.ylabel('Latitude (degrees)') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/triplot_demo.rst.txt b/_sources/examples/pylab_examples/triplot_demo.rst.txt deleted file mode 100644 index 8fdca018d61..00000000000 --- a/_sources/examples/pylab_examples/triplot_demo.rst.txt +++ /dev/null @@ -1,112 +0,0 @@ -.. _pylab_examples-triplot_demo: - -pylab_examples example code: triplot_demo.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/triplot_demo.py - -:: - - """ - Creating and plotting unstructured triangular grids. - """ - import matplotlib.pyplot as plt - import matplotlib.tri as tri - import numpy as np - import math - - # Creating a Triangulation without specifying the triangles results in the - # Delaunay triangulation of the points. - - # First create the x and y coordinates of the points. - n_angles = 36 - n_radii = 8 - min_radius = 0.25 - radii = np.linspace(min_radius, 0.95, n_radii) - - angles = np.linspace(0, 2*math.pi, n_angles, endpoint=False) - angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) - angles[:, 1::2] += math.pi/n_angles - - x = (radii*np.cos(angles)).flatten() - y = (radii*np.sin(angles)).flatten() - - # Create the Triangulation; no triangles so Delaunay triangulation created. - triang = tri.Triangulation(x, y) - - # Mask off unwanted triangles. - xmid = x[triang.triangles].mean(axis=1) - ymid = y[triang.triangles].mean(axis=1) - mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0) - triang.set_mask(mask) - - # Plot the triangulation. - plt.figure() - plt.gca().set_aspect('equal') - plt.triplot(triang, 'bo-', lw=1) - plt.title('triplot of Delaunay triangulation') - - - # You can specify your own triangulation rather than perform a Delaunay - # triangulation of the points, where each triangle is given by the indices of - # the three points that make up the triangle, ordered in either a clockwise or - # anticlockwise manner. - - xy = np.asarray([ - [-0.101, 0.872], [-0.080, 0.883], [-0.069, 0.888], [-0.054, 0.890], - [-0.045, 0.897], [-0.057, 0.895], [-0.073, 0.900], [-0.087, 0.898], - [-0.090, 0.904], [-0.069, 0.907], [-0.069, 0.921], [-0.080, 0.919], - [-0.073, 0.928], [-0.052, 0.930], [-0.048, 0.942], [-0.062, 0.949], - [-0.054, 0.958], [-0.069, 0.954], [-0.087, 0.952], [-0.087, 0.959], - [-0.080, 0.966], [-0.085, 0.973], [-0.087, 0.965], [-0.097, 0.965], - [-0.097, 0.975], [-0.092, 0.984], [-0.101, 0.980], [-0.108, 0.980], - [-0.104, 0.987], [-0.102, 0.993], [-0.115, 1.001], [-0.099, 0.996], - [-0.101, 1.007], [-0.090, 1.010], [-0.087, 1.021], [-0.069, 1.021], - [-0.052, 1.022], [-0.052, 1.017], [-0.069, 1.010], [-0.064, 1.005], - [-0.048, 1.005], [-0.031, 1.005], [-0.031, 0.996], [-0.040, 0.987], - [-0.045, 0.980], [-0.052, 0.975], [-0.040, 0.973], [-0.026, 0.968], - [-0.020, 0.954], [-0.006, 0.947], [ 0.003, 0.935], [ 0.006, 0.926], - [ 0.005, 0.921], [ 0.022, 0.923], [ 0.033, 0.912], [ 0.029, 0.905], - [ 0.017, 0.900], [ 0.012, 0.895], [ 0.027, 0.893], [ 0.019, 0.886], - [ 0.001, 0.883], [-0.012, 0.884], [-0.029, 0.883], [-0.038, 0.879], - [-0.057, 0.881], [-0.062, 0.876], [-0.078, 0.876], [-0.087, 0.872], - [-0.030, 0.907], [-0.007, 0.905], [-0.057, 0.916], [-0.025, 0.933], - [-0.077, 0.990], [-0.059, 0.993]]) - x = np.degrees(xy[:, 0]) - y = np.degrees(xy[:, 1]) - - triangles = np.asarray([ - [67, 66, 1], [65, 2, 66], [ 1, 66, 2], [64, 2, 65], [63, 3, 64], - [60, 59, 57], [ 2, 64, 3], [ 3, 63, 4], [ 0, 67, 1], [62, 4, 63], - [57, 59, 56], [59, 58, 56], [61, 60, 69], [57, 69, 60], [ 4, 62, 68], - [ 6, 5, 9], [61, 68, 62], [69, 68, 61], [ 9, 5, 70], [ 6, 8, 7], - [ 4, 70, 5], [ 8, 6, 9], [56, 69, 57], [69, 56, 52], [70, 10, 9], - [54, 53, 55], [56, 55, 53], [68, 70, 4], [52, 56, 53], [11, 10, 12], - [69, 71, 68], [68, 13, 70], [10, 70, 13], [51, 50, 52], [13, 68, 71], - [52, 71, 69], [12, 10, 13], [71, 52, 50], [71, 14, 13], [50, 49, 71], - [49, 48, 71], [14, 16, 15], [14, 71, 48], [17, 19, 18], [17, 20, 19], - [48, 16, 14], [48, 47, 16], [47, 46, 16], [16, 46, 45], [23, 22, 24], - [21, 24, 22], [17, 16, 45], [20, 17, 45], [21, 25, 24], [27, 26, 28], - [20, 72, 21], [25, 21, 72], [45, 72, 20], [25, 28, 26], [44, 73, 45], - [72, 45, 73], [28, 25, 29], [29, 25, 31], [43, 73, 44], [73, 43, 40], - [72, 73, 39], [72, 31, 25], [42, 40, 43], [31, 30, 29], [39, 73, 40], - [42, 41, 40], [72, 33, 31], [32, 31, 33], [39, 38, 72], [33, 72, 38], - [33, 38, 34], [37, 35, 38], [34, 38, 35], [35, 37, 36]]) - - # Rather than create a Triangulation object, can simply pass x, y and triangles - # arrays to triplot directly. It would be better to use a Triangulation object - # if the same triangulation was to be used more than once to save duplicated - # calculations. - plt.figure() - plt.gca().set_aspect('equal') - plt.triplot(x, y, triangles, 'go-', lw=1.0) - plt.title('triplot of user-specified triangulation') - plt.xlabel('Longitude (degrees)') - plt.ylabel('Latitude (degrees)') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/triplot_demo.txt b/_sources/examples/pylab_examples/triplot_demo.txt deleted file mode 100644 index 985da257b00..00000000000 --- a/_sources/examples/pylab_examples/triplot_demo.txt +++ /dev/null @@ -1,112 +0,0 @@ -.. _pylab_examples-triplot_demo: - -pylab_examples example code: triplot_demo.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/triplot_demo.py - -:: - - """ - Creating and plotting unstructured triangular grids. - """ - import matplotlib.pyplot as plt - import matplotlib.tri as tri - import numpy as np - import math - - # Creating a Triangulation without specifying the triangles results in the - # Delaunay triangulation of the points. - - # First create the x and y coordinates of the points. - n_angles = 36 - n_radii = 8 - min_radius = 0.25 - radii = np.linspace(min_radius, 0.95, n_radii) - - angles = np.linspace(0, 2*math.pi, n_angles, endpoint=False) - angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) - angles[:, 1::2] += math.pi/n_angles - - x = (radii*np.cos(angles)).flatten() - y = (radii*np.sin(angles)).flatten() - - # Create the Triangulation; no triangles so Delaunay triangulation created. - triang = tri.Triangulation(x, y) - - # Mask off unwanted triangles. - xmid = x[triang.triangles].mean(axis=1) - ymid = y[triang.triangles].mean(axis=1) - mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0) - triang.set_mask(mask) - - # Plot the triangulation. - plt.figure() - plt.gca().set_aspect('equal') - plt.triplot(triang, 'bo-') - plt.title('triplot of Delaunay triangulation') - - - # You can specify your own triangulation rather than perform a Delaunay - # triangulation of the points, where each triangle is given by the indices of - # the three points that make up the triangle, ordered in either a clockwise or - # anticlockwise manner. - - xy = np.asarray([ - [-0.101, 0.872], [-0.080, 0.883], [-0.069, 0.888], [-0.054, 0.890], - [-0.045, 0.897], [-0.057, 0.895], [-0.073, 0.900], [-0.087, 0.898], - [-0.090, 0.904], [-0.069, 0.907], [-0.069, 0.921], [-0.080, 0.919], - [-0.073, 0.928], [-0.052, 0.930], [-0.048, 0.942], [-0.062, 0.949], - [-0.054, 0.958], [-0.069, 0.954], [-0.087, 0.952], [-0.087, 0.959], - [-0.080, 0.966], [-0.085, 0.973], [-0.087, 0.965], [-0.097, 0.965], - [-0.097, 0.975], [-0.092, 0.984], [-0.101, 0.980], [-0.108, 0.980], - [-0.104, 0.987], [-0.102, 0.993], [-0.115, 1.001], [-0.099, 0.996], - [-0.101, 1.007], [-0.090, 1.010], [-0.087, 1.021], [-0.069, 1.021], - [-0.052, 1.022], [-0.052, 1.017], [-0.069, 1.010], [-0.064, 1.005], - [-0.048, 1.005], [-0.031, 1.005], [-0.031, 0.996], [-0.040, 0.987], - [-0.045, 0.980], [-0.052, 0.975], [-0.040, 0.973], [-0.026, 0.968], - [-0.020, 0.954], [-0.006, 0.947], [ 0.003, 0.935], [ 0.006, 0.926], - [ 0.005, 0.921], [ 0.022, 0.923], [ 0.033, 0.912], [ 0.029, 0.905], - [ 0.017, 0.900], [ 0.012, 0.895], [ 0.027, 0.893], [ 0.019, 0.886], - [ 0.001, 0.883], [-0.012, 0.884], [-0.029, 0.883], [-0.038, 0.879], - [-0.057, 0.881], [-0.062, 0.876], [-0.078, 0.876], [-0.087, 0.872], - [-0.030, 0.907], [-0.007, 0.905], [-0.057, 0.916], [-0.025, 0.933], - [-0.077, 0.990], [-0.059, 0.993]]) - x = np.degrees(xy[:, 0]) - y = np.degrees(xy[:, 1]) - - triangles = np.asarray([ - [67, 66, 1], [65, 2, 66], [ 1, 66, 2], [64, 2, 65], [63, 3, 64], - [60, 59, 57], [ 2, 64, 3], [ 3, 63, 4], [ 0, 67, 1], [62, 4, 63], - [57, 59, 56], [59, 58, 56], [61, 60, 69], [57, 69, 60], [ 4, 62, 68], - [ 6, 5, 9], [61, 68, 62], [69, 68, 61], [ 9, 5, 70], [ 6, 8, 7], - [ 4, 70, 5], [ 8, 6, 9], [56, 69, 57], [69, 56, 52], [70, 10, 9], - [54, 53, 55], [56, 55, 53], [68, 70, 4], [52, 56, 53], [11, 10, 12], - [69, 71, 68], [68, 13, 70], [10, 70, 13], [51, 50, 52], [13, 68, 71], - [52, 71, 69], [12, 10, 13], [71, 52, 50], [71, 14, 13], [50, 49, 71], - [49, 48, 71], [14, 16, 15], [14, 71, 48], [17, 19, 18], [17, 20, 19], - [48, 16, 14], [48, 47, 16], [47, 46, 16], [16, 46, 45], [23, 22, 24], - [21, 24, 22], [17, 16, 45], [20, 17, 45], [21, 25, 24], [27, 26, 28], - [20, 72, 21], [25, 21, 72], [45, 72, 20], [25, 28, 26], [44, 73, 45], - [72, 45, 73], [28, 25, 29], [29, 25, 31], [43, 73, 44], [73, 43, 40], - [72, 73, 39], [72, 31, 25], [42, 40, 43], [31, 30, 29], [39, 73, 40], - [42, 41, 40], [72, 33, 31], [32, 31, 33], [39, 38, 72], [33, 72, 38], - [33, 38, 34], [37, 35, 38], [34, 38, 35], [35, 37, 36]]) - - # Rather than create a Triangulation object, can simply pass x, y and triangles - # arrays to triplot directly. It would be better to use a Triangulation object - # if the same triangulation was to be used more than once to save duplicated - # calculations. - plt.figure() - plt.gca().set_aspect('equal') - plt.triplot(x, y, triangles, 'go-') - plt.title('triplot of user-specified triangulation') - plt.xlabel('Longitude (degrees)') - plt.ylabel('Latitude (degrees)') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/unicode_demo.txt b/_sources/examples/pylab_examples/unicode_demo.txt deleted file mode 100644 index e17f4a4a837..00000000000 --- a/_sources/examples/pylab_examples/unicode_demo.txt +++ /dev/null @@ -1,29 +0,0 @@ -.. _pylab_examples-unicode_demo: - -pylab_examples example code: unicode_demo.py -============================================ - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/unicode_demo.py - -:: - - #!/usr/bin/python - # -*- coding: utf-8 -*- - - from __future__ import unicode_literals - - import pylab - - pylab.plot([1, 2, 4]) - pylab.title('Développés et fabriqués') - pylab.xlabel("réactivité nous permettent d'être sélectionnés et adoptés") - pylab.ylabel('André was here!') - pylab.text( 0.5, 2.5, 'Institut für Festkörperphysik', rotation=45) - pylab.text( 1, 1.5, 'AVA (check kerning)') - - pylab.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/usetex_baseline_test.rst.txt b/_sources/examples/pylab_examples/usetex_baseline_test.rst.txt deleted file mode 100644 index 98be8624554..00000000000 --- a/_sources/examples/pylab_examples/usetex_baseline_test.rst.txt +++ /dev/null @@ -1,91 +0,0 @@ -.. _pylab_examples-usetex_baseline_test: - -pylab_examples example code: usetex_baseline_test.py -==================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/usetex_baseline_test.py - -:: - - - import matplotlib - import matplotlib.pyplot as plt - import matplotlib.axes as maxes - - from matplotlib import rcParams - rcParams['text.usetex'] = True - rcParams['text.latex.unicode'] = True - - - class Axes(maxes.Axes): - """ - A hackish way to simultaneously draw texts w/ usetex=True and - usetex=False in the same figure. It does not work in the ps backend. - """ - - def __init__(self, *kl, **kw): - self.usetex = kw.pop("usetex", "False") - self.preview = kw.pop("preview", "False") - - maxes.Axes.__init__(self, *kl, **kw) - - def draw(self, renderer): - usetex = plt.rcParams["text.usetex"] - preview = plt.rcParams["text.latex.preview"] - plt.rcParams["text.usetex"] = self.usetex - plt.rcParams["text.latex.preview"] = self.preview - - maxes.Axes.draw(self, renderer) - - plt.rcParams["text.usetex"] = usetex - plt.rcParams["text.latex.preview"] = preview - - subplot = maxes.subplot_class_factory(Axes) - - - def test_window_extent(ax, usetex, preview): - - va = "baseline" - ax.xaxis.set_visible(False) - ax.yaxis.set_visible(False) - - #t = ax.text(0., 0., r"mlp", va="baseline", size=150) - text_kw = dict(va=va, - size=50, - bbox=dict(pad=0., ec="k", fc="none")) - - test_strings = ["lg", r"$\frac{1}{2}\pi$", - r"$p^{3^A}$", r"$p_{3_2}$"] - - ax.axvline(0, color="r") - - for i, s in enumerate(test_strings): - - ax.axhline(i, color="r") - ax.text(0., 3 - i, s, **text_kw) - - ax.set_xlim(-0.1, 1.1) - ax.set_ylim(-.8, 3.9) - - ax.set_title("usetex=%s\npreview=%s" % (str(usetex), str(preview))) - - - fig = plt.figure(figsize=(2.*3, 6.5)) - - for i, usetex, preview in [[0, False, False], - [1, True, False], - [2, True, True]]: - ax = subplot(fig, 1, 3, i + 1, usetex=usetex, preview=preview) - fig.add_subplot(ax) - fig.subplots_adjust(top=0.85) - - test_window_extent(ax, usetex=usetex, preview=preview) - - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/usetex_baseline_test.txt b/_sources/examples/pylab_examples/usetex_baseline_test.txt deleted file mode 100644 index b7a5bdddad0..00000000000 --- a/_sources/examples/pylab_examples/usetex_baseline_test.txt +++ /dev/null @@ -1,91 +0,0 @@ -.. _pylab_examples-usetex_baseline_test: - -pylab_examples example code: usetex_baseline_test.py -==================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/usetex_baseline_test.py - -:: - - - import matplotlib - import matplotlib.pyplot as plt - import matplotlib.axes as maxes - - from matplotlib import rcParams - rcParams['text.usetex'] = True - rcParams['text.latex.unicode'] = True - - - class Axes(maxes.Axes): - """ - A hackish way to simultaneously draw texts w/ usetex=True and - usetex=False in the same figure. It does not work in the ps backend. - """ - - def __init__(self, *kl, **kw): - self.usetex = kw.pop("usetex", "False") - self.preview = kw.pop("preview", "False") - - maxes.Axes.__init__(self, *kl, **kw) - - def draw(self, renderer): - usetex = plt.rcParams["text.usetex"] - preview = plt.rcParams["text.latex.preview"] - plt.rcParams["text.usetex"] = self.usetex - plt.rcParams["text.latex.preview"] = self.preview - - maxes.Axes.draw(self, renderer) - - plt.rcParams["text.usetex"] = usetex - plt.rcParams["text.latex.preview"] = preview - - subplot = maxes.subplot_class_factory(Axes) - - - def test_window_extent(ax, usetex, preview): - - va = "baseline" - ax.xaxis.set_visible(False) - ax.yaxis.set_visible(False) - - #t = ax.text(0., 0., r"mlp", va="baseline", size=150) - text_kw = dict(va=va, - size=50, - bbox=dict(pad=0., ec="k", fc="none")) - - test_strings = ["lg", r"$\frac{1}{2}\pi$", - r"$p^{3^A}$", r"$p_{3_2}$"] - - ax.axvline(0, color="r") - - for i, s in enumerate(test_strings): - - ax.axhline(i, color="r") - ax.text(0., 3 - i, s, **text_kw) - - ax.set_xlim(-0.1, 1.1) - ax.set_ylim(-.8, 3.9) - - ax.set_title("usetex=%s\npreview=%s" % (str(usetex), str(preview))) - - - fig = plt.figure(figsize=(2.*3, 6.5)) - - for i, usetex, preview in [[0, False, False], - [1, True, False], - [2, True, True]]: - ax = subplot(fig, 1, 3, i + 1, usetex=usetex, preview=preview) - fig.add_subplot(ax) - fig.subplots_adjust(top=0.85) - - test_window_extent(ax, usetex=usetex, preview=preview) - - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/usetex_demo.rst.txt b/_sources/examples/pylab_examples/usetex_demo.rst.txt deleted file mode 100644 index 62044a7b204..00000000000 --- a/_sources/examples/pylab_examples/usetex_demo.rst.txt +++ /dev/null @@ -1,84 +0,0 @@ -.. _pylab_examples-usetex_demo: - -pylab_examples example code: usetex_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/usetex_demo.py - -:: - - import matplotlib - matplotlib.rc('text', usetex=True) - import matplotlib.pyplot as plt - import numpy as np - - # interface tracking profiles - N = 500 - delta = 0.6 - X = np.linspace(-1, 1, N) - plt.plot(X, (1 - np.tanh(4.*X/delta))/2, # phase field tanh profiles - X, (X + 1)/2, # level set distance function - X, (1.4 + np.tanh(4.*X/delta))/4, # composition profile - X, X < 0, 'k--', # sharp interface - ) - - # legend - plt.legend(('phase field', 'level set', 'composition', 'sharp interface'), shadow=True, loc=(0.01, 0.55)) - - ltext = plt.gca().get_legend().get_texts() - plt.setp(ltext[0], fontsize=20) - plt.setp(ltext[1], fontsize=20) - plt.setp(ltext[2], fontsize=20) - plt.setp(ltext[3], fontsize=20) - - # the arrow - height = 0.1 - offset = 0.02 - plt.plot((-delta / 2., delta / 2), (height, height), 'k', linewidth=2) - plt.plot((-delta / 2, -delta / 2 + offset * 2), (height, height - offset), 'k', linewidth=2) - plt.plot((-delta / 2, -delta / 2 + offset * 2), (height, height + offset), 'k', linewidth=2) - plt.plot((delta / 2, delta / 2 - offset * 2), (height, height - offset), 'k', linewidth=2) - plt.plot((delta / 2, delta / 2 - offset * 2), (height, height + offset), 'k', linewidth=2) - plt.text(-0.06, height - 0.06, r'$\delta$', {'color': 'k', 'fontsize': 24}) - - # X-axis label - plt.xticks((-1, 0, 1), ('-1', '0', '1'), color='k', size=20) - - # Left Y-axis labels - plt.ylabel(r'\bf{phase field} $\phi$', {'color': 'b', - 'fontsize': 20}) - plt.yticks((0, 0.5, 1), ('0', '.5', '1'), color='k', size=20) - - # Right Y-axis labels - plt.text(1.05, 0.5, r"\bf{level set} $\phi$", {'color': 'g', 'fontsize': 20}, - horizontalalignment='left', - verticalalignment='center', - rotation=90, - clip_on=False) - plt.text(1.01, -0.02, "-1", {'color': 'k', 'fontsize': 20}) - plt.text(1.01, 0.98, "1", {'color': 'k', 'fontsize': 20}) - plt.text(1.01, 0.48, "0", {'color': 'k', 'fontsize': 20}) - - # level set equations - plt.text(0.1, 0.85, - r'$|\nabla\phi| = 1,$ \newline $ \frac{\partial \phi}{\partial t}' - r'+ U|\nabla \phi| = 0$', - {'color': 'g', 'fontsize': 20}) - - # phase field equations - plt.text(0.2, 0.15, - r'$\mathcal{F} = \int f\left( \phi, c \right) dV,$ \newline ' - r'$ \frac{ \partial \phi } { \partial t } = -M_{ \phi } ' - r'\frac{ \delta \mathcal{F} } { \delta \phi }$', - {'color': 'b', 'fontsize': 20}) - - # these went wrong in pdf in a previous version - plt.text(-.9, .42, r'gamma: $\gamma$', {'color': 'r', 'fontsize': 20}) - plt.text(-.9, .36, r'Omega: $\Omega$', {'color': 'b', 'fontsize': 20}) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/usetex_demo.txt b/_sources/examples/pylab_examples/usetex_demo.txt deleted file mode 100644 index 22c3a258857..00000000000 --- a/_sources/examples/pylab_examples/usetex_demo.txt +++ /dev/null @@ -1,84 +0,0 @@ -.. _pylab_examples-usetex_demo: - -pylab_examples example code: usetex_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/usetex_demo.py - -:: - - import matplotlib - matplotlib.rc('text', usetex=True) - import matplotlib.pyplot as plt - import numpy as np - - # interface tracking profiles - N = 500 - delta = 0.6 - X = np.linspace(-1, 1, N) - plt.plot(X, (1 - np.tanh(4.*X/delta))/2, # phase field tanh profiles - X, (X + 1)/2, # level set distance function - X, (1.4 + np.tanh(4.*X/delta))/4, # composition profile - X, X < 0, 'k--', # sharp interface - linewidth=5) - - # legend - plt.legend(('phase field', 'level set', 'composition', 'sharp interface'), shadow=True, loc=(0.01, 0.55)) - - ltext = plt.gca().get_legend().get_texts() - plt.setp(ltext[0], fontsize=20, color='b') - plt.setp(ltext[1], fontsize=20, color='g') - plt.setp(ltext[2], fontsize=20, color='r') - plt.setp(ltext[3], fontsize=20, color='k') - - # the arrow - height = 0.1 - offset = 0.02 - plt.plot((-delta / 2., delta / 2), (height, height), 'k', linewidth=2) - plt.plot((-delta / 2, -delta / 2 + offset * 2), (height, height - offset), 'k', linewidth=2) - plt.plot((-delta / 2, -delta / 2 + offset * 2), (height, height + offset), 'k', linewidth=2) - plt.plot((delta / 2, delta / 2 - offset * 2), (height, height - offset), 'k', linewidth=2) - plt.plot((delta / 2, delta / 2 - offset * 2), (height, height + offset), 'k', linewidth=2) - plt.text(-0.06, height - 0.06, r'$\delta$', {'color': 'k', 'fontsize': 24}) - - # X-axis label - plt.xticks((-1, 0, 1), ('-1', '0', '1'), color='k', size=20) - - # Left Y-axis labels - plt.ylabel(r'\bf{phase field} $\phi$', {'color': 'b', - 'fontsize': 20}) - plt.yticks((0, 0.5, 1), ('0', '.5', '1'), color='k', size=20) - - # Right Y-axis labels - plt.text(1.05, 0.5, r"\bf{level set} $\phi$", {'color': 'g', 'fontsize': 20}, - horizontalalignment='left', - verticalalignment='center', - rotation=90, - clip_on=False) - plt.text(1.01, -0.02, "-1", {'color': 'k', 'fontsize': 20}) - plt.text(1.01, 0.98, "1", {'color': 'k', 'fontsize': 20}) - plt.text(1.01, 0.48, "0", {'color': 'k', 'fontsize': 20}) - - # level set equations - plt.text(0.1, 0.85, - r'$|\nabla\phi| = 1,$ \newline $ \frac{\partial \phi}{\partial t}' - r'+ U|\nabla \phi| = 0$', - {'color': 'g', 'fontsize': 20}) - - # phase field equations - plt.text(0.2, 0.15, - r'$\mathcal{F} = \int f\left( \phi, c \right) dV,$ \newline ' - r'$ \frac{ \partial \phi } { \partial t } = -M_{ \phi } ' - r'\frac{ \delta \mathcal{F} } { \delta \phi }$', - {'color': 'b', 'fontsize': 20}) - - # these went wrong in pdf in a previous version - plt.text(-.9, .42, r'gamma: $\gamma$', {'color': 'r', 'fontsize': 20}) - plt.text(-.9, .36, r'Omega: $\Omega$', {'color': 'b', 'fontsize': 20}) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/usetex_fonteffects.rst.txt b/_sources/examples/pylab_examples/usetex_fonteffects.rst.txt deleted file mode 100644 index 105700531e4..00000000000 --- a/_sources/examples/pylab_examples/usetex_fonteffects.rst.txt +++ /dev/null @@ -1,37 +0,0 @@ -.. _pylab_examples-usetex_fonteffects: - -pylab_examples example code: usetex_fonteffects.py -================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/usetex_fonteffects.py - -:: - - # This script demonstrates that font effects specified in your pdftex.map - # are now supported in pdf usetex. - - import matplotlib - import matplotlib.pyplot as plt - matplotlib.rc('text', usetex=True) - - - def setfont(font): - return r'\font\a %s at 14pt\a ' % font - - for y, font, text in zip(range(5), - ['ptmr8r', 'ptmri8r', 'ptmro8r', 'ptmr8rn', 'ptmrr8re'], - ['Nimbus Roman No9 L ' + x for x in - ['', 'Italics (real italics for comparison)', - '(slanted)', '(condensed)', '(extended)']]): - plt.text(0, y, setfont(font) + text) - - plt.ylim(-1, 5) - plt.xlim(-0.2, 0.6) - plt.setp(plt.gca(), frame_on=False, xticks=(), yticks=()) - plt.title('Usetex font effects') - plt.savefig('usetex_fonteffects.pdf') - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/usetex_fonteffects.txt b/_sources/examples/pylab_examples/usetex_fonteffects.txt deleted file mode 100644 index 632fe06f167..00000000000 --- a/_sources/examples/pylab_examples/usetex_fonteffects.txt +++ /dev/null @@ -1,37 +0,0 @@ -.. _pylab_examples-usetex_fonteffects: - -pylab_examples example code: usetex_fonteffects.py -================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/usetex_fonteffects.py - -:: - - # This script demonstrates that font effects specified in your pdftex.map - # are now supported in pdf usetex. - - import matplotlib - import matplotlib.pyplot as plt - matplotlib.rc('text', usetex=True) - - - def setfont(font): - return r'\font\a %s at 14pt\a ' % font - - for y, font, text in zip(range(5), - ['ptmr8r', 'ptmri8r', 'ptmro8r', 'ptmr8rn', 'ptmrr8re'], - ['Nimbus Roman No9 L ' + x for x in - ['', 'Italics (real italics for comparison)', - '(slanted)', '(condensed)', '(extended)']]): - plt.text(0, y, setfont(font) + text) - - plt.ylim(-1, 5) - plt.xlim(-0.2, 0.6) - plt.setp(plt.gca(), frame_on=False, xticks=(), yticks=()) - plt.title('Usetex font effects') - plt.savefig('usetex_fonteffects.pdf') - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/vertical_ticklabels.txt b/_sources/examples/pylab_examples/vertical_ticklabels.txt deleted file mode 100644 index efad60b4bcf..00000000000 --- a/_sources/examples/pylab_examples/vertical_ticklabels.txt +++ /dev/null @@ -1,21 +0,0 @@ -.. _pylab_examples-vertical_ticklabels: - -pylab_examples example code: vertical_ticklabels.py -=================================================== - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/vertical_ticklabels.py - -:: - - #!/usr/bin/env python - from pylab import * - - plot([1,2,3,4], [1,4,9,16]) - locs, labels = xticks([1,2,3,4], ['Frogs', 'Hogs', 'Bogs', 'Slogs']) - setp(labels, 'rotation', 'vertical') - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/vline_demo.txt b/_sources/examples/pylab_examples/vline_demo.txt deleted file mode 100644 index d4060880da3..00000000000 --- a/_sources/examples/pylab_examples/vline_demo.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _pylab_examples-vline_demo: - -pylab_examples example code: vline_demo.py -========================================== - - - -.. plot:: /home/mdboom/Work/builds/matplotlib/doc/mpl_examples/pylab_examples/vline_demo.py - -:: - - #!/usr/bin/env python - from matplotlib.pyplot import * - from numpy import sin, exp, absolute, pi, arange - from numpy.random import normal - - def f(t): - s1 = sin(2*pi*t) - e1 = exp(-t) - return absolute((s1*e1))+.05 - - - t = arange(0.0, 5.0, 0.1) - s = f(t) - nse = normal(0.0, 0.3, t.shape) * s - - plot(t, s+nse, 'b^') - vlines(t, [0], s) - xlabel('time (s)') - title('Comparison of model with data') - show() - - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/vline_hline_demo.rst.txt b/_sources/examples/pylab_examples/vline_hline_demo.rst.txt deleted file mode 100644 index da730c5e8ae..00000000000 --- a/_sources/examples/pylab_examples/vline_hline_demo.rst.txt +++ /dev/null @@ -1,47 +0,0 @@ -.. _pylab_examples-vline_hline_demo: - -pylab_examples example code: vline_hline_demo.py -================================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/vline_hline_demo.py - -:: - - """ - Small demonstration of the hlines and vlines plots. - """ - - import matplotlib.pyplot as plt - import numpy as np - import numpy.random as rnd - - - def f(t): - s1 = np.sin(2 * np.pi * t) - e1 = np.exp(-t) - return np.absolute((s1 * e1)) + .05 - - t = np.arange(0.0, 5.0, 0.1) - s = f(t) - nse = rnd.normal(0.0, 0.3, t.shape) * s - - fig = plt.figure(figsize=(12, 6)) - vax = fig.add_subplot(121) - hax = fig.add_subplot(122) - - vax.plot(t, s + nse, '^') - vax.vlines(t, [0], s) - vax.set_xlabel('time (s)') - vax.set_title('Vertical lines demo') - - hax.plot(s + nse, t, '^') - hax.hlines(t, [0], s, lw=2) - hax.set_xlabel('time (s)') - hax.set_title('Horizontal lines demo') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/vline_hline_demo.txt b/_sources/examples/pylab_examples/vline_hline_demo.txt deleted file mode 100644 index b427b93eb89..00000000000 --- a/_sources/examples/pylab_examples/vline_hline_demo.txt +++ /dev/null @@ -1,47 +0,0 @@ -.. _pylab_examples-vline_hline_demo: - -pylab_examples example code: vline_hline_demo.py -================================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/vline_hline_demo.py - -:: - - """ - Small demonstration of the hlines and vlines plots. - """ - - import matplotlib.pyplot as plt - import numpy as np - import numpy.random as rnd - - - def f(t): - s1 = np.sin(2 * np.pi * t) - e1 = np.exp(-t) - return np.absolute((s1 * e1)) + .05 - - t = np.arange(0.0, 5.0, 0.1) - s = f(t) - nse = rnd.normal(0.0, 0.3, t.shape) * s - - fig = plt.figure(figsize=(12, 6)) - vax = fig.add_subplot(121) - hax = fig.add_subplot(122) - - vax.plot(t, s + nse, 'b^') - vax.vlines(t, [0], s) - vax.set_xlabel('time (s)') - vax.set_title('Vertical lines demo') - - hax.plot(s + nse, t, 'b^') - hax.hlines(t, [0], s, lw=2) - hax.set_xlabel('time (s)') - hax.set_title('Horizontal lines demo') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/webapp_demo.rst.txt b/_sources/examples/pylab_examples/webapp_demo.rst.txt deleted file mode 100644 index 15a4cfdb355..00000000000 --- a/_sources/examples/pylab_examples/webapp_demo.rst.txt +++ /dev/null @@ -1,70 +0,0 @@ -.. _pylab_examples-webapp_demo: - -pylab_examples example code: webapp_demo.py -=========================================== - -[`source code `_] - -:: - - # -*- noplot -*- - """ - This example shows how to use the agg backend directly to create - images, which may be of use to web application developers who want - full control over their code without using the pyplot interface to - manage figures, figure closing etc. - - .. note:: - - It is not necessary to avoid using the pyplot interface in order to - create figures without a graphical front-end - simply setting - the backend to "Agg" would be sufficient. - - - It is also worth noting that, because matplotlib can save figures to file-like - object, matplotlib can also be used inside a cgi-script *without* needing to - write a figure to disk. - - """ - - from matplotlib.backends.backend_agg import FigureCanvasAgg - from matplotlib.figure import Figure - import numpy as np - - - def make_fig(): - """ - Make a figure and save it to "webagg.png". - - """ - fig = Figure() - ax = fig.add_subplot(1, 1, 1) - - ax.plot([1, 2, 3], 'ro--', markersize=12, markerfacecolor='g') - - # make a translucent scatter collection - x = np.random.rand(100) - y = np.random.rand(100) - area = np.pi * (10 * np.random.rand(100)) ** 2 # 0 to 10 point radii - c = ax.scatter(x, y, area) - c.set_alpha(0.5) - - # add some text decoration - ax.set_title('My first image') - ax.set_ylabel('Some numbers') - ax.set_xticks((.2, .4, .6, .8)) - labels = ax.set_xticklabels(('Bill', 'Fred', 'Ted', 'Ed')) - - # To set object properties, you can either iterate over the - # objects manually, or define you own set command, as in setapi - # above. - for label in labels: - label.set_rotation(45) - label.set_fontsize(12) - - FigureCanvasAgg(fig).print_png('webapp.png', dpi=150) - - make_fig() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/webapp_demo.txt b/_sources/examples/pylab_examples/webapp_demo.txt deleted file mode 100644 index 987d4406e2a..00000000000 --- a/_sources/examples/pylab_examples/webapp_demo.txt +++ /dev/null @@ -1,71 +0,0 @@ -.. _pylab_examples-webapp_demo: - -pylab_examples example code: webapp_demo.py -=========================================== - -[`source code `_] - -:: - - #!/usr/bin/env python - # -*- noplot -*- - """ - This example shows how to use the agg backend directly to create - images, which may be of use to web application developers who want - full control over their code without using the pyplot interface to - manage figures, figure closing etc. - - .. note:: - - It is not necessary to avoid using the pyplot interface in order to - create figures without a graphical front-end - simply setting - the backend to "Agg" would be sufficient. - - - It is also worth noting that, because matplotlib can save figures to file-like - object, matplotlib can also be used inside a cgi-script *without* needing to - write a figure to disk. - - """ - - from matplotlib.backends.backend_agg import FigureCanvasAgg - from matplotlib.figure import Figure - import numpy as np - - - def make_fig(): - """ - Make a figure and save it to "webagg.png". - - """ - fig = Figure() - ax = fig.add_subplot(1, 1, 1) - - ax.plot([1, 2, 3], 'ro--', markersize=12, markerfacecolor='g') - - # make a translucent scatter collection - x = np.random.rand(100) - y = np.random.rand(100) - area = np.pi * (10 * np.random.rand(100)) ** 2 # 0 to 10 point radiuses - c = ax.scatter(x, y, area) - c.set_alpha(0.5) - - # add some text decoration - ax.set_title('My first image') - ax.set_ylabel('Some numbers') - ax.set_xticks((.2, .4, .6, .8)) - labels = ax.set_xticklabels(('Bill', 'Fred', 'Ted', 'Ed')) - - # To set object properties, you can either iterate over the - # objects manually, or define you own set command, as in setapi - # above. - for label in labels: - label.set_rotation(45) - label.set_fontsize(12) - - FigureCanvasAgg(fig).print_png('webapp.png', dpi=150) - - make_fig() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/xcorr_demo.rst.txt b/_sources/examples/pylab_examples/xcorr_demo.rst.txt deleted file mode 100644 index 3abc000fd3e..00000000000 --- a/_sources/examples/pylab_examples/xcorr_demo.rst.txt +++ /dev/null @@ -1,33 +0,0 @@ -.. _pylab_examples-xcorr_demo: - -pylab_examples example code: xcorr_demo.py -========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/xcorr_demo.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - - np.random.seed(0) - - x, y = np.random.randn(2, 100) - fig = plt.figure() - ax1 = fig.add_subplot(211) - ax1.xcorr(x, y, usevlines=True, maxlags=50, normed=True, lw=2) - ax1.grid(True) - ax1.axhline(0, color='black', lw=2) - - ax2 = fig.add_subplot(212, sharex=ax1) - ax2.acorr(x, usevlines=True, normed=True, maxlags=50, lw=2) - ax2.grid(True) - ax2.axhline(0, color='black', lw=2) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/xcorr_demo.txt b/_sources/examples/pylab_examples/xcorr_demo.txt deleted file mode 100644 index d5c811d0641..00000000000 --- a/_sources/examples/pylab_examples/xcorr_demo.txt +++ /dev/null @@ -1,30 +0,0 @@ -.. _pylab_examples-xcorr_demo: - -pylab_examples example code: xcorr_demo.py -========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/xcorr_demo.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - x, y = np.random.randn(2, 100) - fig = plt.figure() - ax1 = fig.add_subplot(211) - ax1.xcorr(x, y, usevlines=True, maxlags=50, normed=True, lw=2) - ax1.grid(True) - ax1.axhline(0, color='black', lw=2) - - ax2 = fig.add_subplot(212, sharex=ax1) - ax2.acorr(x, usevlines=True, normed=True, maxlags=50, lw=2) - ax2.grid(True) - ax2.axhline(0, color='black', lw=2) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/zorder_demo.rst.txt b/_sources/examples/pylab_examples/zorder_demo.rst.txt deleted file mode 100644 index 53b6d9a0ed1..00000000000 --- a/_sources/examples/pylab_examples/zorder_demo.rst.txt +++ /dev/null @@ -1,65 +0,0 @@ -.. _pylab_examples-zorder_demo: - -pylab_examples example code: zorder_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/pylab_examples/zorder_demo.py - -:: - - """ - The default drawing order for axes is patches, lines, text. This - order is determined by the zorder attribute. The following defaults - are set - - Artist Z-order - Patch / PatchCollection 1 - Line2D / LineCollection 2 - Text 3 - - You can change the order for individual artists by setting the zorder. Any - individual plot() call can set a value for the zorder of that particular item. - - In the fist subplot below, the lines are drawn above the patch - collection from the scatter, which is the default. - - In the subplot below, the order is reversed. - - The second figure shows how to control the zorder of individual lines. - """ - - import matplotlib.pyplot as plt - import numpy as np - - x = np.random.random(20) - y = np.random.random(20) - - # Lines on top of scatter - plt.figure() - plt.subplot(211) - plt.plot(x, y, 'r', lw=3) - plt.scatter(x, y, s=120) - plt.title('Lines on top of dots') - - # Scatter plot on top of lines - plt.subplot(212) - plt.plot(x, y, 'r', zorder=1, lw=3) - plt.scatter(x, y, s=120, zorder=2) - plt.title('Dots on top of lines') - - # A new figure, with individually ordered items - x = np.linspace(0, 2*np.pi, 100) - plt.figure() - plt.plot(x, np.sin(x), linewidth=10, color='black', label='zorder=10', zorder=10) # on top - plt.plot(x, np.cos(1.3*x), linewidth=10, color='red', label='zorder=1', zorder=1) # bottom - plt.plot(x, np.sin(2.1*x), linewidth=10, color='green', label='zorder=3', zorder=3) - plt.axhline(0, linewidth=10, color='blue', label='zorder=2', zorder=2) - plt.title('Custom order of elements') - l = plt.legend() - l.set_zorder(20) # put the legend on top - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pylab_examples/zorder_demo.txt b/_sources/examples/pylab_examples/zorder_demo.txt deleted file mode 100644 index f1fb3c330c0..00000000000 --- a/_sources/examples/pylab_examples/zorder_demo.txt +++ /dev/null @@ -1,66 +0,0 @@ -.. _pylab_examples-zorder_demo: - -pylab_examples example code: zorder_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/pylab_examples/zorder_demo.py - -:: - - #!/usr/bin/env python - """ - The default drawing order for axes is patches, lines, text. This - order is determined by the zorder attribute. The following defaults - are set - - Artist Z-order - Patch / PatchCollection 1 - Line2D / LineCollection 2 - Text 3 - - You can change the order for individual artists by setting the zorder. Any - individual plot() call can set a value for the zorder of that particular item. - - In the fist subplot below, the lines are drawn above the patch - collection from the scatter, which is the default. - - In the subplot below, the order is reversed. - - The second figure shows how to control the zorder of individual lines. - """ - - import matplotlib.pyplot as plt - import numpy as np - - x = np.random.random(20) - y = np.random.random(20) - - # Lines on top of scatter - plt.figure() - plt.subplot(211) - plt.plot(x, y, 'r', lw=3) - plt.scatter(x, y, s=120) - plt.title('Lines on top of dots') - - # Scatter plot on top of lines - plt.subplot(212) - plt.plot(x, y, 'r', zorder=1, lw=3) - plt.scatter(x, y, s=120, zorder=2) - plt.title('Dots on top of lines') - - # A new figure, with individually ordered items - x = np.linspace(0, 2*np.pi, 100) - plt.figure() - plt.plot(x, np.sin(x), linewidth=10, color='black', label='zorder=10', zorder=10) # on top - plt.plot(x, np.cos(1.3*x), linewidth=10, color='red', label='zorder=1', zorder=1) # bottom - plt.plot(x, np.sin(2.1*x), linewidth=10, color='green', label='zorder=3', zorder=3) - plt.axhline(0, linewidth=10, color='blue', label='zorder=2', zorder=2) - plt.title('Custom order of elements') - l = plt.legend() - l.set_zorder(20) # put the legend on top - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/align_ylabels.rst.txt b/_sources/examples/pyplots/align_ylabels.rst.txt deleted file mode 100644 index b1d7f35fe92..00000000000 --- a/_sources/examples/pyplots/align_ylabels.rst.txt +++ /dev/null @@ -1,49 +0,0 @@ -.. _pyplots-align_ylabels: - -pyplots example code: align_ylabels.py -====================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - - box = dict(facecolor='yellow', pad=5, alpha=0.2) - - fig = plt.figure() - fig.subplots_adjust(left=0.2, wspace=0.6) - - # Fixing random state for reproducibility - np.random.seed(19680801) - - ax1 = fig.add_subplot(221) - ax1.plot(2000*np.random.rand(10)) - ax1.set_title('ylabels not aligned') - ax1.set_ylabel('misaligned 1', bbox=box) - ax1.set_ylim(0, 2000) - ax3 = fig.add_subplot(223) - ax3.set_ylabel('misaligned 2',bbox=box) - ax3.plot(np.random.rand(10)) - - - labelx = -0.3 # axes coords - - ax2 = fig.add_subplot(222) - ax2.set_title('ylabels aligned') - ax2.plot(2000*np.random.rand(10)) - ax2.set_ylabel('aligned 1', bbox=box) - ax2.yaxis.set_label_coords(labelx, 0.5) - ax2.set_ylim(0, 2000) - - ax4 = fig.add_subplot(224) - ax4.plot(np.random.rand(10)) - ax4.set_ylabel('aligned 2', bbox=box) - ax4.yaxis.set_label_coords(labelx, 0.5) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/annotate_transform.rst.txt b/_sources/examples/pyplots/annotate_transform.rst.txt deleted file mode 100644 index 3981cd7591c..00000000000 --- a/_sources/examples/pyplots/annotate_transform.rst.txt +++ /dev/null @@ -1,46 +0,0 @@ -.. _pyplots-annotate_transform: - -pyplots example code: annotate_transform.py -=========================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - - x = np.arange(0, 10, 0.005) - y = np.exp(-x/2.) * np.sin(2*np.pi*x) - - fig = plt.figure() - ax = fig.add_subplot(111) - ax.plot(x, y) - ax.set_xlim(0, 10) - ax.set_ylim(-1, 1) - - xdata, ydata = 5, 0 - xdisplay, ydisplay = ax.transData.transform_point((xdata, ydata)) - - bbox = dict(boxstyle="round", fc="0.8") - arrowprops = dict( - arrowstyle = "->", - connectionstyle = "angle,angleA=0,angleB=90,rad=10") - - offset = 72 - ax.annotate('data = (%.1f, %.1f)'%(xdata, ydata), - (xdata, ydata), xytext=(-2*offset, offset), textcoords='offset points', - bbox=bbox, arrowprops=arrowprops) - - - disp = ax.annotate('display = (%.1f, %.1f)'%(xdisplay, ydisplay), - (xdisplay, ydisplay), xytext=(0.5*offset, -offset), - xycoords='figure pixels', - textcoords='offset points', - bbox=bbox, arrowprops=arrowprops) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/annotation_basic.rst.txt b/_sources/examples/pyplots/annotation_basic.rst.txt deleted file mode 100644 index b6f1b63aebe..00000000000 --- a/_sources/examples/pyplots/annotation_basic.rst.txt +++ /dev/null @@ -1,28 +0,0 @@ -.. _pyplots-annotation_basic: - -pyplots example code: annotation_basic.py -========================================= - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - - fig = plt.figure() - ax = fig.add_subplot(111) - - t = np.arange(0.0, 5.0, 0.01) - s = np.cos(2*np.pi*t) - line, = ax.plot(t, s, lw=2) - - ax.annotate('local max', xy=(2, 1), xytext=(3, 1.5), - arrowprops=dict(facecolor='black', shrink=0.05), - ) - - ax.set_ylim(-2,2) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/annotation_polar.rst.txt b/_sources/examples/pyplots/annotation_polar.rst.txt deleted file mode 100644 index 0e68c02e67e..00000000000 --- a/_sources/examples/pyplots/annotation_polar.rst.txt +++ /dev/null @@ -1,33 +0,0 @@ -.. _pyplots-annotation_polar: - -pyplots example code: annotation_polar.py -========================================= - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - - fig = plt.figure() - ax = fig.add_subplot(111, polar=True) - r = np.arange(0,1,0.001) - theta = 2*2*np.pi*r - line, = ax.plot(theta, r, color='#ee8d18', lw=3) - - ind = 800 - thisr, thistheta = r[ind], theta[ind] - ax.plot([thistheta], [thisr], 'o') - ax.annotate('a polar annotation', - xy=(thistheta, thisr), # theta, radius - xytext=(0.05, 0.05), # fraction, fraction - textcoords='figure fraction', - arrowprops=dict(facecolor='black', shrink=0.05), - horizontalalignment='left', - verticalalignment='bottom', - ) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/auto_subplots_adjust.rst.txt b/_sources/examples/pyplots/auto_subplots_adjust.rst.txt deleted file mode 100644 index 60baf59539c..00000000000 --- a/_sources/examples/pyplots/auto_subplots_adjust.rst.txt +++ /dev/null @@ -1,42 +0,0 @@ -.. _pyplots-auto_subplots_adjust: - -pyplots example code: auto_subplots_adjust.py -============================================= - -[`source code `_] - -:: - - import matplotlib.pyplot as plt - import matplotlib.transforms as mtransforms - fig = plt.figure() - ax = fig.add_subplot(111) - ax.plot(range(10)) - ax.set_yticks((2,5,7)) - labels = ax.set_yticklabels(('really, really, really', 'long', 'labels')) - - def on_draw(event): - bboxes = [] - for label in labels: - bbox = label.get_window_extent() - # the figure transform goes from relative coords->pixels and we - # want the inverse of that - bboxi = bbox.inverse_transformed(fig.transFigure) - bboxes.append(bboxi) - - # this is the bbox that bounds all the bboxes, again in relative - # figure coords - bbox = mtransforms.Bbox.union(bboxes) - if fig.subplotpars.left < bbox.width: - # we need to move it over - fig.subplots_adjust(left=1.1*bbox.width) # pad a little - fig.canvas.draw() - return False - - fig.canvas.mpl_connect('draw_event', on_draw) - - plt.show() - - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/boxplot_demo.rst.txt b/_sources/examples/pyplots/boxplot_demo.rst.txt deleted file mode 100644 index e0bd2769fed..00000000000 --- a/_sources/examples/pyplots/boxplot_demo.rst.txt +++ /dev/null @@ -1,76 +0,0 @@ -.. _pyplots-boxplot_demo: - -pyplots example code: boxplot_demo.py -===================================== - -[`source code `_] - -:: - - #!/usr/bin/python - - # - # Example boxplot code - # - - import numpy as np - import matplotlib.pyplot as plt - - # Fixing random state for reproducibility - np.random.seed(19680801) - - # fake up some data - spread = np.random.rand(50) * 100 - center = np.ones(25) * 50 - flier_high = np.random.rand(10) * 100 + 100 - flier_low = np.random.rand(10) * -100 - data = np.concatenate((spread, center, flier_high, flier_low), 0) - - fig1, ax1 = plt.subplots() - ax1.set_title('Basic Plot') - ax1.boxplot(data) - - fig2, ax2 = plt.subplots() - ax2.set_title('Notched boxes') - ax2.boxplot(data, notch=True) - - green_diamond = dict(markerfacecolor='g', marker='D') - fig3, ax3 = plt.subplots() - ax3.set_title('Changed Outlier Symbols') - ax3.boxplot(data, flierprops=green_diamond) - - fig4, ax4 = plt.subplots() - ax4.set_title('Hide Outlier Points') - ax4.boxplot(data, showfliers=False) - - red_square = dict(markerfacecolor='r', marker='s') - fig5, ax5 = plt.subplots() - ax5.set_title('Horizontal Boxes') - ax5.boxplot(data, vert=False, flierprops=red_square) - - fig6, ax6 = plt.subplots() - ax6.set_title('Shorter Whisker Length') - ax6.boxplot(data, flierprops=red_square, vert=False, whis=0.75) - - # fake up some more data - spread = np.random.rand(50) * 100 - center = np.ones(25) * 40 - flier_high = np.random.rand(10) * 100 + 100 - flier_low = np.random.rand(10) * -100 - d2 = np.concatenate((spread, center, flier_high, flier_low), 0) - data.shape = (-1, 1) - d2.shape = (-1, 1) - - # Making a 2-D array only works if all the columns are the - # same length. If they are not, then use a list instead. - # This is actually more efficient because boxplot converts - # a 2-D array into a list of vectors internally anyway. - data = [data, d2, d2[::2,0]] - fig7, ax7 = plt.subplots() - ax7.set_title('Multiple Samples with Different sizes') - ax7.boxplot(data) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/compound_path_demo.rst.txt b/_sources/examples/pyplots/compound_path_demo.rst.txt deleted file mode 100644 index 1eed7810b28..00000000000 --- a/_sources/examples/pyplots/compound_path_demo.rst.txt +++ /dev/null @@ -1,57 +0,0 @@ -.. _pyplots-compound_path_demo: - -pyplots example code: compound_path_demo.py -=========================================== - -[`source code `_] - -:: - - import numpy as np - - import matplotlib.pyplot as plt - import matplotlib.patches as patches - import matplotlib.path as path - - fig = plt.figure() - ax = fig.add_subplot(111) - - # Fixing random state for reproducibility - np.random.seed(19680801) - - # histogram our data with numpy - data = np.random.randn(1000) - n, bins = np.histogram(data, 100) - - # get the corners of the rectangles for the histogram - left = np.array(bins[:-1]) - right = np.array(bins[1:]) - bottom = np.zeros(len(left)) - top = bottom + n - nrects = len(left) - - nverts = nrects*(1+3+1) - verts = np.zeros((nverts, 2)) - codes = np.ones(nverts, int) * path.Path.LINETO - codes[0::5] = path.Path.MOVETO - codes[4::5] = path.Path.CLOSEPOLY - verts[0::5,0] = left - verts[0::5,1] = bottom - verts[1::5,0] = left - verts[1::5,1] = top - verts[2::5,0] = right - verts[2::5,1] = top - verts[3::5,0] = right - verts[3::5,1] = bottom - - barpath = path.Path(verts, codes) - patch = patches.PathPatch(barpath, facecolor='green', edgecolor='yellow', alpha=0.5) - ax.add_patch(patch) - - ax.set_xlim(left[0], right[-1]) - ax.set_ylim(bottom.min(), top.max()) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/dollar_ticks.rst.txt b/_sources/examples/pyplots/dollar_ticks.rst.txt deleted file mode 100644 index 1ef75aa52b4..00000000000 --- a/_sources/examples/pyplots/dollar_ticks.rst.txt +++ /dev/null @@ -1,32 +0,0 @@ -.. _pyplots-dollar_ticks: - -pyplots example code: dollar_ticks.py -===================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.ticker as ticker - - # Fixing random state for reproducibility - np.random.seed(19680801) - - fig = plt.figure() - ax = fig.add_subplot(111) - ax.plot(100*np.random.rand(20)) - - formatter = ticker.FormatStrFormatter('$%1.2f') - ax.yaxis.set_major_formatter(formatter) - - for tick in ax.yaxis.get_major_ticks(): - tick.label1On = False - tick.label2On = True - tick.label2.set_color('green') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/fig_axes_customize_simple.rst.txt b/_sources/examples/pyplots/fig_axes_customize_simple.rst.txt deleted file mode 100644 index d7924ad1cbc..00000000000 --- a/_sources/examples/pyplots/fig_axes_customize_simple.rst.txt +++ /dev/null @@ -1,38 +0,0 @@ -.. _pyplots-fig_axes_customize_simple: - -pyplots example code: fig_axes_customize_simple.py -================================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - - # plt.figure creates a matplotlib.figure.Figure instance - fig = plt.figure() - rect = fig.patch # a rectangle instance - rect.set_facecolor('lightgoldenrodyellow') - - ax1 = fig.add_axes([0.1, 0.3, 0.4, 0.4]) - rect = ax1.patch - rect.set_facecolor('lightslategray') - - - for label in ax1.xaxis.get_ticklabels(): - # label is a Text instance - label.set_color('red') - label.set_rotation(45) - label.set_fontsize(16) - - for line in ax1.yaxis.get_ticklines(): - # line is a Line2D instance - line.set_color('green') - line.set_markersize(25) - line.set_markeredgewidth(3) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/fig_axes_labels_simple.rst.txt b/_sources/examples/pyplots/fig_axes_labels_simple.rst.txt deleted file mode 100644 index 46382698476..00000000000 --- a/_sources/examples/pyplots/fig_axes_labels_simple.rst.txt +++ /dev/null @@ -1,34 +0,0 @@ -.. _pyplots-fig_axes_labels_simple: - -pyplots example code: fig_axes_labels_simple.py -=============================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - - fig = plt.figure() - fig.subplots_adjust(top=0.8) - ax1 = fig.add_subplot(211) - ax1.set_ylabel('volts') - ax1.set_title('a sine wave') - - t = np.arange(0.0, 1.0, 0.01) - s = np.sin(2*np.pi*t) - line, = ax1.plot(t, s, color='blue', lw=2) - - # Fixing random state for reproducibility - np.random.seed(19680801) - - ax2 = fig.add_axes([0.15, 0.1, 0.7, 0.3]) - n, bins, patches = ax2.hist(np.random.randn(1000), 50, - facecolor='yellow', edgecolor='yellow') - ax2.set_xlabel('time (s)') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/fig_x.rst.txt b/_sources/examples/pyplots/fig_x.rst.txt deleted file mode 100644 index 53d01126827..00000000000 --- a/_sources/examples/pyplots/fig_x.rst.txt +++ /dev/null @@ -1,26 +0,0 @@ -.. _pyplots-fig_x: - -pyplots example code: fig_x.py -============================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.lines as lines - - - fig = plt.figure() - - l1 = lines.Line2D([0, 1], [0, 1], transform=fig.transFigure, figure=fig) - - l2 = lines.Line2D([0, 1], [1, 0], transform=fig.transFigure, figure=fig) - - fig.lines.extend([l1, l2]) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/index.rst.txt b/_sources/examples/pyplots/index.rst.txt deleted file mode 100644 index a19c26e5d58..00000000000 --- a/_sources/examples/pyplots/index.rst.txt +++ /dev/null @@ -1,43 +0,0 @@ -.. _pyplots-examples-index: - -############################################## -pyplots Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - align_ylabels - annotate_transform - annotation_basic - annotation_polar - auto_subplots_adjust - boxplot_demo - compound_path_demo - dollar_ticks - fig_axes_customize_simple - fig_axes_labels_simple - fig_x - pyplot_annotate - pyplot_formatstr - pyplot_mathtext - pyplot_scales - pyplot_simple - pyplot_text - pyplot_three - pyplot_two_subplots - tex_demo - text_commands - text_layout - whats_new_1_subplot3d - whats_new_98_4_fancy - whats_new_98_4_fill_between - whats_new_98_4_legend - whats_new_99_axes_grid - whats_new_99_mplot3d - whats_new_99_spines diff --git a/_sources/examples/pyplots/pyplot_annotate.rst.txt b/_sources/examples/pyplots/pyplot_annotate.rst.txt deleted file mode 100644 index 0b5b4c45384..00000000000 --- a/_sources/examples/pyplots/pyplot_annotate.rst.txt +++ /dev/null @@ -1,27 +0,0 @@ -.. _pyplots-pyplot_annotate: - -pyplots example code: pyplot_annotate.py -======================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - - ax = plt.subplot(111) - - t = np.arange(0.0, 5.0, 0.01) - s = np.cos(2*np.pi*t) - line, = plt.plot(t, s, lw=2) - - plt.annotate('local max', xy=(2, 1), xytext=(3, 1.5), - arrowprops=dict(facecolor='black', shrink=0.05), - ) - - plt.ylim(-2,2) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/pyplot_formatstr.rst.txt b/_sources/examples/pyplots/pyplot_formatstr.rst.txt deleted file mode 100644 index 69f114928aa..00000000000 --- a/_sources/examples/pyplots/pyplot_formatstr.rst.txt +++ /dev/null @@ -1,16 +0,0 @@ -.. _pyplots-pyplot_formatstr: - -pyplots example code: pyplot_formatstr.py -========================================= - -[`source code `_] - -:: - - import matplotlib.pyplot as plt - plt.plot([1,2,3,4], [1,4,9,16], 'ro') - plt.axis([0, 6, 0, 20]) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/pyplot_mathtext.rst.txt b/_sources/examples/pyplots/pyplot_mathtext.rst.txt deleted file mode 100644 index 293c1b5add5..00000000000 --- a/_sources/examples/pyplots/pyplot_mathtext.rst.txt +++ /dev/null @@ -1,25 +0,0 @@ -.. _pyplots-pyplot_mathtext: - -pyplots example code: pyplot_mathtext.py -======================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - t = np.arange(0.0, 2.0, 0.01) - s = np.sin(2*np.pi*t) - - plt.plot(t,s) - plt.title(r'$\alpha_i > \beta_i$', fontsize=20) - plt.text(1, -0.6, r'$\sum_{i=0}^\infty x_i$', fontsize=20) - plt.text(0.6, 0.6, r'$\mathcal{A}\mathrm{sin}(2 \omega t)$', - fontsize=20) - plt.xlabel('time (s)') - plt.ylabel('volts (mV)') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/pyplot_scales.rst.txt b/_sources/examples/pyplots/pyplot_scales.rst.txt deleted file mode 100644 index eec150589aa..00000000000 --- a/_sources/examples/pyplots/pyplot_scales.rst.txt +++ /dev/null @@ -1,67 +0,0 @@ -.. _pyplots-pyplot_scales: - -pyplots example code: pyplot_scales.py -====================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - - from matplotlib.ticker import NullFormatter # useful for `logit` scale - - # Fixing random state for reproducibility - np.random.seed(19680801) - - # make up some data in the interval ]0, 1[ - y = np.random.normal(loc=0.5, scale=0.4, size=1000) - y = y[(y > 0) & (y < 1)] - y.sort() - x = np.arange(len(y)) - - # plot with various axes scales - plt.figure(1) - - # linear - plt.subplot(221) - plt.plot(x, y) - plt.yscale('linear') - plt.title('linear') - plt.grid(True) - - - # log - plt.subplot(222) - plt.plot(x, y) - plt.yscale('log') - plt.title('log') - plt.grid(True) - - - # symmetric log - plt.subplot(223) - plt.plot(x, y - y.mean()) - plt.yscale('symlog', linthreshy=0.01) - plt.title('symlog') - plt.grid(True) - - # logit - plt.subplot(224) - plt.plot(x, y) - plt.yscale('logit') - plt.title('logit') - plt.grid(True) - # Format the minor tick labels of the y-axis into empty strings with - # `NullFormatter`, to avoid cumbering the axis with too many labels. - plt.gca().yaxis.set_minor_formatter(NullFormatter()) - # Adjust the subplot layout, because the logit one may take more space - # than usual, due to y-tick labels like "1 - 10^{-3}" - plt.subplots_adjust(top=0.92, bottom=0.08, left=0.10, right=0.95, hspace=0.25, - wspace=0.35) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/pyplot_simple.rst.txt b/_sources/examples/pyplots/pyplot_simple.rst.txt deleted file mode 100644 index 994edd9c9e4..00000000000 --- a/_sources/examples/pyplots/pyplot_simple.rst.txt +++ /dev/null @@ -1,16 +0,0 @@ -.. _pyplots-pyplot_simple: - -pyplots example code: pyplot_simple.py -====================================== - -[`source code `_] - -:: - - import matplotlib.pyplot as plt - plt.plot([1,2,3,4]) - plt.ylabel('some numbers') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/pyplot_text.rst.txt b/_sources/examples/pyplots/pyplot_text.rst.txt deleted file mode 100644 index 24c3536be8c..00000000000 --- a/_sources/examples/pyplots/pyplot_text.rst.txt +++ /dev/null @@ -1,32 +0,0 @@ -.. _pyplots-pyplot_text: - -pyplots example code: pyplot_text.py -==================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - - # Fixing random state for reproducibility - np.random.seed(19680801) - - mu, sigma = 100, 15 - x = mu + sigma * np.random.randn(10000) - - # the histogram of the data - n, bins, patches = plt.hist(x, 50, normed=1, facecolor='g', alpha=0.75) - - - plt.xlabel('Smarts') - plt.ylabel('Probability') - plt.title('Histogram of IQ') - plt.text(60, .025, r'$\mu=100,\ \sigma=15$') - plt.axis([40, 160, 0, 0.03]) - plt.grid(True) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/pyplot_three.rst.txt b/_sources/examples/pyplots/pyplot_three.rst.txt deleted file mode 100644 index 9410ebf4c18..00000000000 --- a/_sources/examples/pyplots/pyplot_three.rst.txt +++ /dev/null @@ -1,21 +0,0 @@ -.. _pyplots-pyplot_three: - -pyplots example code: pyplot_three.py -===================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - - # evenly sampled time at 200ms intervals - t = np.arange(0., 5., 0.2) - - # red dashes, blue squares and green triangles - plt.plot(t, t, 'r--', t, t**2, 'bs', t, t**3, 'g^') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/pyplot_two_subplots.rst.txt b/_sources/examples/pyplots/pyplot_two_subplots.rst.txt deleted file mode 100644 index 8439b3706d7..00000000000 --- a/_sources/examples/pyplots/pyplot_two_subplots.rst.txt +++ /dev/null @@ -1,28 +0,0 @@ -.. _pyplots-pyplot_two_subplots: - -pyplots example code: pyplot_two_subplots.py -============================================ - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - - def f(t): - return np.exp(-t) * np.cos(2*np.pi*t) - - t1 = np.arange(0.0, 5.0, 0.1) - t2 = np.arange(0.0, 5.0, 0.02) - - plt.figure(1) - plt.subplot(211) - plt.plot(t1, f(t1), 'bo', t2, f(t2), 'k') - - plt.subplot(212) - plt.plot(t2, np.cos(2*np.pi*t2), 'r--') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/tex_demo.rst.txt b/_sources/examples/pyplots/tex_demo.rst.txt deleted file mode 100644 index b3ec82a6c4a..00000000000 --- a/_sources/examples/pyplots/tex_demo.rst.txt +++ /dev/null @@ -1,47 +0,0 @@ -.. _pyplots-tex_demo: - -pyplots example code: tex_demo.py -================================= - -[`source code `_] - -:: - - """ - Demo of TeX rendering. - - You can use TeX to render all of your matplotlib text if the rc - parameter text.usetex is set. This works currently on the agg and ps - backends, and requires that you have tex and the other dependencies - described at http://matplotlib.org/users/usetex.html - properly installed on your system. The first time you run a script - you will see a lot of output from tex and associated tools. The next - time, the run may be silent, as a lot of the information is cached in - ~/.tex.cache - - """ - import numpy as np - import matplotlib.pyplot as plt - - - # Example data - t = np.arange(0.0, 1.0 + 0.01, 0.01) - s = np.cos(4 * np.pi * t) + 2 - - plt.rc('text', usetex=True) - plt.rc('font', family='serif') - plt.plot(t, s) - - plt.xlabel(r'\textbf{time} (s)') - plt.ylabel(r'\textit{voltage} (mV)',fontsize=16) - plt.title(r"\TeX\ is Number " - r"$\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!", - fontsize=16, color='gray') - # Make room for the ridiculously large title. - plt.subplots_adjust(top=0.8) - - plt.savefig('tex_demo') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/text_commands.rst.txt b/_sources/examples/pyplots/text_commands.rst.txt deleted file mode 100644 index 0cbaadd3feb..00000000000 --- a/_sources/examples/pyplots/text_commands.rst.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _pyplots-text_commands: - -pyplots example code: text_commands.py -====================================== - -[`source code `_] - -:: - - # -*- coding: utf-8 -*- - import matplotlib.pyplot as plt - - fig = plt.figure() - fig.suptitle('bold figure suptitle', fontsize=14, fontweight='bold') - - ax = fig.add_subplot(111) - fig.subplots_adjust(top=0.85) - ax.set_title('axes title') - - ax.set_xlabel('xlabel') - ax.set_ylabel('ylabel') - - ax.text(3, 8, 'boxed italics text in data coords', style='italic', - bbox={'facecolor':'red', 'alpha':0.5, 'pad':10}) - - ax.text(2, 6, r'an equation: $E=mc^2$', fontsize=15) - - ax.text(3, 2, u'unicode: Institut f\374r Festk\366rperphysik') - - ax.text(0.95, 0.01, 'colored text in axes coords', - verticalalignment='bottom', horizontalalignment='right', - transform=ax.transAxes, - color='green', fontsize=15) - - - ax.plot([2], [1], 'o') - ax.annotate('annotate', xy=(2, 1), xytext=(3, 4), - arrowprops=dict(facecolor='black', shrink=0.05)) - - ax.axis([0, 10, 0, 10]) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/text_layout.rst.txt b/_sources/examples/pyplots/text_layout.rst.txt deleted file mode 100644 index d61066eb1e3..00000000000 --- a/_sources/examples/pyplots/text_layout.rst.txt +++ /dev/null @@ -1,89 +0,0 @@ -.. _pyplots-text_layout: - -pyplots example code: text_layout.py -==================================== - -[`source code `_] - -:: - - import matplotlib.pyplot as plt - import matplotlib.patches as patches - - # build a rectangle in axes coords - left, width = .25, .5 - bottom, height = .25, .5 - right = left + width - top = bottom + height - - fig = plt.figure() - ax = fig.add_axes([0,0,1,1]) - - # axes coordinates are 0,0 is bottom left and 1,1 is upper right - p = patches.Rectangle( - (left, bottom), width, height, - fill=False, transform=ax.transAxes, clip_on=False - ) - - ax.add_patch(p) - - ax.text(left, bottom, 'left top', - horizontalalignment='left', - verticalalignment='top', - transform=ax.transAxes) - - ax.text(left, bottom, 'left bottom', - horizontalalignment='left', - verticalalignment='bottom', - transform=ax.transAxes) - - ax.text(right, top, 'right bottom', - horizontalalignment='right', - verticalalignment='bottom', - transform=ax.transAxes) - - ax.text(right, top, 'right top', - horizontalalignment='right', - verticalalignment='top', - transform=ax.transAxes) - - ax.text(right, bottom, 'center top', - horizontalalignment='center', - verticalalignment='top', - transform=ax.transAxes) - - ax.text(left, 0.5*(bottom+top), 'right center', - horizontalalignment='right', - verticalalignment='center', - rotation='vertical', - transform=ax.transAxes) - - ax.text(left, 0.5*(bottom+top), 'left center', - horizontalalignment='left', - verticalalignment='center', - rotation='vertical', - transform=ax.transAxes) - - ax.text(0.5*(left+right), 0.5*(bottom+top), 'middle', - horizontalalignment='center', - verticalalignment='center', - fontsize=20, color='red', - transform=ax.transAxes) - - ax.text(right, 0.5*(bottom+top), 'centered', - horizontalalignment='center', - verticalalignment='center', - rotation='vertical', - transform=ax.transAxes) - - ax.text(left, top, 'rotated\nwith newlines', - horizontalalignment='center', - verticalalignment='center', - rotation=45, - transform=ax.transAxes) - - ax.set_axis_off() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/whats_new_1_subplot3d.rst.txt b/_sources/examples/pyplots/whats_new_1_subplot3d.rst.txt deleted file mode 100644 index afdc042426b..00000000000 --- a/_sources/examples/pyplots/whats_new_1_subplot3d.rst.txt +++ /dev/null @@ -1,42 +0,0 @@ -.. _pyplots-whats_new_1_subplot3d: - -pyplots example code: whats_new_1_subplot3d.py -============================================== - -[`source code `_] - -:: - - from mpl_toolkits.mplot3d.axes3d import Axes3D - from matplotlib import cm - #from matplotlib.ticker import LinearLocator, FixedLocator, FormatStrFormatter - import matplotlib.pyplot as plt - import numpy as np - - fig = plt.figure() - - ax = fig.add_subplot(1, 2, 1, projection='3d') - X = np.arange(-5, 5, 0.25) - Y = np.arange(-5, 5, 0.25) - X, Y = np.meshgrid(X, Y) - R = np.sqrt(X**2 + Y**2) - Z = np.sin(R) - surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet, - linewidth=0, antialiased=False) - ax.set_zlim3d(-1.01, 1.01) - - #ax.w_zaxis.set_major_locator(LinearLocator(10)) - #ax.w_zaxis.set_major_formatter(FormatStrFormatter('%.03f')) - - fig.colorbar(surf, shrink=0.5, aspect=5) - - from mpl_toolkits.mplot3d.axes3d import get_test_data - ax = fig.add_subplot(1, 2, 2, projection='3d') - X, Y, Z = get_test_data(0.05) - ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10) - - plt.show() - - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/whats_new_98_4_fancy.rst.txt b/_sources/examples/pyplots/whats_new_98_4_fancy.rst.txt deleted file mode 100644 index 6dde674cd32..00000000000 --- a/_sources/examples/pyplots/whats_new_98_4_fancy.rst.txt +++ /dev/null @@ -1,66 +0,0 @@ -.. _pyplots-whats_new_98_4_fancy: - -pyplots example code: whats_new_98_4_fancy.py -============================================= - -[`source code `_] - -:: - - import matplotlib.patches as mpatch - import matplotlib.pyplot as plt - - figheight = 8 - fig = plt.figure(1, figsize=(9, figheight), dpi=80) - fontsize = 0.4 * fig.dpi - - def make_boxstyles(ax): - styles = mpatch.BoxStyle.get_styles() - - for i, (stylename, styleclass) in enumerate(sorted(styles.items())): - ax.text(0.5, (float(len(styles)) - 0.5 - i)/len(styles), stylename, - ha="center", - size=fontsize, - transform=ax.transAxes, - bbox=dict(boxstyle=stylename, fc="w", ec="k")) - - def make_arrowstyles(ax): - styles = mpatch.ArrowStyle.get_styles() - - ax.set_xlim(0, 4) - ax.set_ylim(0, figheight) - - for i, (stylename, styleclass) in enumerate(sorted(styles.items())): - y = (float(len(styles)) -0.25 - i) # /figheight - p = mpatch.Circle((3.2, y), 0.2, fc="w") - ax.add_patch(p) - - ax.annotate(stylename, (3.2, y), - (2., y), - #xycoords="figure fraction", textcoords="figure fraction", - ha="right", va="center", - size=fontsize, - arrowprops=dict(arrowstyle=stylename, - patchB=p, - shrinkA=5, - shrinkB=5, - fc="w", ec="k", - connectionstyle="arc3,rad=-0.05", - ), - bbox=dict(boxstyle="square", fc="w")) - - ax.xaxis.set_visible(False) - ax.yaxis.set_visible(False) - - - ax1 = fig.add_subplot(121, frameon=False, xticks=[], yticks=[]) - make_boxstyles(ax1) - - ax2 = fig.add_subplot(122, frameon=False, xticks=[], yticks=[]) - make_arrowstyles(ax2) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/whats_new_98_4_fill_between.rst.txt b/_sources/examples/pyplots/whats_new_98_4_fill_between.rst.txt deleted file mode 100644 index 0ddf0fcdb71..00000000000 --- a/_sources/examples/pyplots/whats_new_98_4_fill_between.rst.txt +++ /dev/null @@ -1,28 +0,0 @@ -.. _pyplots-whats_new_98_4_fill_between: - -pyplots example code: whats_new_98_4_fill_between.py -==================================================== - -[`source code `_] - -:: - - #!/usr/bin/env python - import matplotlib.mlab as mlab - import matplotlib.pyplot as plt - import numpy as np - - x = np.arange(0.0, 2, 0.01) - y1 = np.sin(2*np.pi*x) - y2 = 1.2*np.sin(4*np.pi*x) - - fig, ax = plt.subplots() - ax.plot(x, y1, x, y2, color='black') - ax.fill_between(x, y1, y2, where=y2>y1, facecolor='green') - ax.fill_between(x, y1, y2, where=y2<=y1, facecolor='red') - ax.set_title('fill between where') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/whats_new_98_4_legend.rst.txt b/_sources/examples/pyplots/whats_new_98_4_legend.rst.txt deleted file mode 100644 index a9299040da7..00000000000 --- a/_sources/examples/pyplots/whats_new_98_4_legend.rst.txt +++ /dev/null @@ -1,30 +0,0 @@ -.. _pyplots-whats_new_98_4_legend: - -pyplots example code: whats_new_98_4_legend.py -============================================== - -[`source code `_] - -:: - - import matplotlib.pyplot as plt - import numpy as np - import matplotlib.pyplot as plt - - - ax = plt.subplot(111) - t1 = np.arange(0.0, 1.0, 0.01) - for n in [1, 2, 3, 4]: - plt.plot(t1, t1**n, label="n=%d"%(n,)) - - leg = plt.legend(loc='best', ncol=2, mode="expand", shadow=True, fancybox=True) - leg.get_frame().set_alpha(0.5) - - - plt.show() - - - - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/whats_new_99_axes_grid.rst.txt b/_sources/examples/pyplots/whats_new_99_axes_grid.rst.txt deleted file mode 100644 index 71eb5cf9e06..00000000000 --- a/_sources/examples/pyplots/whats_new_99_axes_grid.rst.txt +++ /dev/null @@ -1,59 +0,0 @@ -.. _pyplots-whats_new_99_axes_grid: - -pyplots example code: whats_new_99_axes_grid.py -=============================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - from mpl_toolkits.axes_grid.axes_rgb import RGBAxes - - def get_demo_image(): - # prepare image - delta = 0.5 - - extent = (-3,4,-4,3) - x = np.arange(-3.0, 4.001, delta) - y = np.arange(-4.0, 3.001, delta) - X, Y = np.meshgrid(x, y) - import matplotlib.mlab as mlab - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - Z = (Z1 - Z2) * 10 - - return Z, extent - - - - def get_rgb(): - Z, extent = get_demo_image() - - Z[Z<0] = 0. - Z = Z/Z.max() - - R = Z[:13,:13] - G = Z[2:,2:] - B = Z[:13,2:] - - return R, G, B - - - fig = plt.figure(1) - ax = RGBAxes(fig, [0.1, 0.1, 0.8, 0.8]) - - r, g, b = get_rgb() - kwargs = dict(origin="lower", interpolation="nearest") - ax.imshow_rgb(r, g, b, **kwargs) - - ax.RGB.set_xlim(0., 9.5) - ax.RGB.set_ylim(0.9, 10.6) - - - plt.draw() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/whats_new_99_mplot3d.rst.txt b/_sources/examples/pyplots/whats_new_99_mplot3d.rst.txt deleted file mode 100644 index 2a264610ed4..00000000000 --- a/_sources/examples/pyplots/whats_new_99_mplot3d.rst.txt +++ /dev/null @@ -1,30 +0,0 @@ -.. _pyplots-whats_new_99_mplot3d: - -pyplots example code: whats_new_99_mplot3d.py -============================================= - -[`source code `_] - -:: - - import random - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib import cm - from mpl_toolkits.mplot3d import Axes3D - - X = np.arange(-5, 5, 0.25) - Y = np.arange(-5, 5, 0.25) - X, Y = np.meshgrid(X, Y) - R = np.sqrt(X**2 + Y**2) - Z = np.sin(R) - - fig = plt.figure() - ax = Axes3D(fig) - ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.viridis) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/pyplots/whats_new_99_spines.rst.txt b/_sources/examples/pyplots/whats_new_99_spines.rst.txt deleted file mode 100644 index 6adfd36e95b..00000000000 --- a/_sources/examples/pyplots/whats_new_99_spines.rst.txt +++ /dev/null @@ -1,58 +0,0 @@ -.. _pyplots-whats_new_99_spines: - -pyplots example code: whats_new_99_spines.py -============================================ - -[`source code `_] - -:: - - import matplotlib.pyplot as plt - import numpy as np - - - def adjust_spines(ax,spines): - for loc, spine in ax.spines.items(): - if loc in spines: - spine.set_position(('outward',10)) # outward by 10 points - else: - spine.set_color('none') # don't draw spine - - # turn off ticks where there is no spine - if 'left' in spines: - ax.yaxis.set_ticks_position('left') - else: - # no yaxis ticks - ax.yaxis.set_ticks([]) - - if 'bottom' in spines: - ax.xaxis.set_ticks_position('bottom') - else: - # no xaxis ticks - ax.xaxis.set_ticks([]) - - fig = plt.figure() - - x = np.linspace(0,2*np.pi,100) - y = 2*np.sin(x) - - ax = fig.add_subplot(2,2,1) - ax.plot(x,y) - adjust_spines(ax,['left']) - - ax = fig.add_subplot(2,2,2) - ax.plot(x,y) - adjust_spines(ax,[]) - - ax = fig.add_subplot(2,2,3) - ax.plot(x,y) - adjust_spines(ax,['left','bottom']) - - ax = fig.add_subplot(2,2,4) - ax.plot(x,y) - adjust_spines(ax,['bottom']) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/scales/index.rst.txt b/_sources/examples/scales/index.rst.txt deleted file mode 100644 index 2eb4d0e24c5..00000000000 --- a/_sources/examples/scales/index.rst.txt +++ /dev/null @@ -1,15 +0,0 @@ -.. _scales-examples-index: - -############################################## -scales Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - scales diff --git a/_sources/examples/scales/index.txt b/_sources/examples/scales/index.txt deleted file mode 100644 index 2eb4d0e24c5..00000000000 --- a/_sources/examples/scales/index.txt +++ /dev/null @@ -1,15 +0,0 @@ -.. _scales-examples-index: - -############################################## -scales Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - scales diff --git a/_sources/examples/scales/scales.rst.txt b/_sources/examples/scales/scales.rst.txt deleted file mode 100644 index adeeb6107cd..00000000000 --- a/_sources/examples/scales/scales.rst.txt +++ /dev/null @@ -1,65 +0,0 @@ -.. _scales-scales: - -scales example code: scales.py -============================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/scales/scales.py - -:: - - """ - Illustrate the scale transformations applied to axes, e.g. log, symlog, logit. - """ - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.ticker import NullFormatter - - np.random.seed(1) - # make up some data in the interval ]0, 1[ - y = np.random.normal(loc=0.5, scale=0.4, size=1000) - y = y[(y > 0) & (y < 1)] - y.sort() - x = np.arange(len(y)) - - # plot with various axes scales - fig, axs = plt.subplots(2, 2, sharex=True) - fig.subplots_adjust(left=0.08, right=0.98, wspace=0.3) - - # linear - ax = axs[0, 0] - ax.plot(x, y) - ax.set_yscale('linear') - ax.set_title('linear') - ax.grid(True) - - - # log - ax = axs[0, 1] - ax.plot(x, y) - ax.set_yscale('log') - ax.set_title('log') - ax.grid(True) - - - # symmetric log - ax = axs[1, 1] - ax.plot(x, y - y.mean()) - ax.set_yscale('symlog', linthreshy=0.02) - ax.set_title('symlog') - ax.grid(True) - - # logit - ax = axs[1, 0] - ax.plot(x, y) - ax.set_yscale('logit') - ax.set_title('logit') - ax.grid(True) - ax.yaxis.set_minor_formatter(NullFormatter()) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/scales/scales.txt b/_sources/examples/scales/scales.txt deleted file mode 100644 index 3f17f853979..00000000000 --- a/_sources/examples/scales/scales.txt +++ /dev/null @@ -1,61 +0,0 @@ -.. _scales-scales: - -scales example code: scales.py -============================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/scales/scales.py - -:: - - """ - Illustrate the scale transformations applied to axes, e.g. log, symlog, logit. - """ - import numpy as np - import matplotlib.pyplot as plt - - # make up some data in the interval ]0, 1[ - y = np.random.normal(loc=0.5, scale=0.4, size=1000) - y = y[(y > 0) & (y < 1)] - y.sort() - x = np.arange(len(y)) - - # plot with various axes scales - fig, axs = plt.subplots(2, 2) - - # linear - ax = axs[0, 0] - ax.plot(x, y) - ax.set_yscale('linear') - ax.set_title('linear') - ax.grid(True) - - - # log - ax = axs[0, 1] - ax.plot(x, y) - ax.set_yscale('log') - ax.set_title('log') - ax.grid(True) - - - # symmetric log - ax = axs[1, 0] - ax.plot(x, y - y.mean()) - ax.set_yscale('symlog', linthreshy=0.05) - ax.set_title('symlog') - ax.grid(True) - - # logit - ax = axs[1, 1] - ax.plot(x, y) - ax.set_yscale('logit') - ax.set_title('logit') - ax.grid(True) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/shapes_and_collections/artist_reference.rst.txt b/_sources/examples/shapes_and_collections/artist_reference.rst.txt deleted file mode 100644 index b935ac20a01..00000000000 --- a/_sources/examples/shapes_and_collections/artist_reference.rst.txt +++ /dev/null @@ -1,118 +0,0 @@ -.. _shapes_and_collections-artist_reference: - -shapes_and_collections example code: artist_reference.py -======================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/shapes_and_collections/artist_reference.py - -:: - - """ - Reference for matplotlib artists - - This example displays several of matplotlib's graphics primitives (artists) - drawn using matplotlib API. A full list of artists and the documentation is - available at http://matplotlib.org/api/artist_api.html. - - Copyright (c) 2010, Bartosz Telenczuk - BSD License - """ - import matplotlib.pyplot as plt - plt.rcdefaults() - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.path as mpath - import matplotlib.lines as mlines - import matplotlib.patches as mpatches - from matplotlib.collections import PatchCollection - - - def label(xy, text): - y = xy[1] - 0.15 # shift y-value for label so that it's below the artist - plt.text(xy[0], y, text, ha="center", family='sans-serif', size=14) - - - fig, ax = plt.subplots() - # create 3x3 grid to plot the artists - grid = np.mgrid[0.2:0.8:3j, 0.2:0.8:3j].reshape(2, -1).T - - patches = [] - - # add a circle - circle = mpatches.Circle(grid[0], 0.1, ec="none") - patches.append(circle) - label(grid[0], "Circle") - - # add a rectangle - rect = mpatches.Rectangle(grid[1] - [0.025, 0.05], 0.05, 0.1, ec="none") - patches.append(rect) - label(grid[1], "Rectangle") - - # add a wedge - wedge = mpatches.Wedge(grid[2], 0.1, 30, 270, ec="none") - patches.append(wedge) - label(grid[2], "Wedge") - - # add a Polygon - polygon = mpatches.RegularPolygon(grid[3], 5, 0.1) - patches.append(polygon) - label(grid[3], "Polygon") - - # add an ellipse - ellipse = mpatches.Ellipse(grid[4], 0.2, 0.1) - patches.append(ellipse) - label(grid[4], "Ellipse") - - # add an arrow - arrow = mpatches.Arrow(grid[5, 0] - 0.05, grid[5, 1] - 0.05, 0.1, 0.1, width=0.1) - patches.append(arrow) - label(grid[5], "Arrow") - - # add a path patch - Path = mpath.Path - path_data = [ - (Path.MOVETO, [0.018, -0.11]), - (Path.CURVE4, [-0.031, -0.051]), - (Path.CURVE4, [-0.115, 0.073]), - (Path.CURVE4, [-0.03 , 0.073]), - (Path.LINETO, [-0.011, 0.039]), - (Path.CURVE4, [0.043, 0.121]), - (Path.CURVE4, [0.075, -0.005]), - (Path.CURVE4, [0.035, -0.027]), - (Path.CLOSEPOLY, [0.018, -0.11]) - ] - codes, verts = zip(*path_data) - path = mpath.Path(verts + grid[6], codes) - patch = mpatches.PathPatch(path) - patches.append(patch) - label(grid[6], "PathPatch") - - # add a fancy box - fancybox = mpatches.FancyBboxPatch( - grid[7] - [0.025, 0.05], 0.05, 0.1, - boxstyle=mpatches.BoxStyle("Round", pad=0.02)) - patches.append(fancybox) - label(grid[7], "FancyBboxPatch") - - # add a line - x, y = np.array([[-0.06, 0.0, 0.1], [0.05, -0.05, 0.05]]) - line = mlines.Line2D(x + grid[8, 0], y + grid[8, 1], lw=5., alpha=0.3) - label(grid[8], "Line2D") - - colors = np.linspace(0, 1, len(patches)) - collection = PatchCollection(patches, cmap=plt.cm.hsv, alpha=0.3) - collection.set_array(np.array(colors)) - ax.add_collection(collection) - ax.add_line(line) - - plt.subplots_adjust(left=0, right=1, bottom=0, top=1) - plt.axis('equal') - plt.axis('off') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/shapes_and_collections/artist_reference.txt b/_sources/examples/shapes_and_collections/artist_reference.txt deleted file mode 100644 index 707fbbdbd8e..00000000000 --- a/_sources/examples/shapes_and_collections/artist_reference.txt +++ /dev/null @@ -1,118 +0,0 @@ -.. _shapes_and_collections-artist_reference: - -shapes_and_collections example code: artist_reference.py -======================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/shapes_and_collections/artist_reference.py - -:: - - """ - Reference for matplotlib artists - - This example displays several of matplotlib's graphics primitives (artists) - drawn using matplotlib API. A full list of artists and the documentation is - available at http://matplotlib.org/api/artist_api.html. - - Copyright (c) 2010, Bartosz Telenczuk - BSD License - """ - import matplotlib.pyplot as plt - plt.rcdefaults() - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.path as mpath - import matplotlib.lines as mlines - import matplotlib.patches as mpatches - from matplotlib.collections import PatchCollection - - - def label(xy, text): - y = xy[1] - 0.15 # shift y-value for label so that it's below the artist - plt.text(xy[0], y, text, ha="center", family='sans-serif', size=14) - - - fig, ax = plt.subplots() - # create 3x3 grid to plot the artists - grid = np.mgrid[0.2:0.8:3j, 0.2:0.8:3j].reshape(2, -1).T - - patches = [] - - # add a circle - circle = mpatches.Circle(grid[0], 0.1, ec="none") - patches.append(circle) - label(grid[0], "Circle") - - # add a rectangle - rect = mpatches.Rectangle(grid[1] - [0.025, 0.05], 0.05, 0.1, ec="none") - patches.append(rect) - label(grid[1], "Rectangle") - - # add a wedge - wedge = mpatches.Wedge(grid[2], 0.1, 30, 270, ec="none") - patches.append(wedge) - label(grid[2], "Wedge") - - # add a Polygon - polygon = mpatches.RegularPolygon(grid[3], 5, 0.1) - patches.append(polygon) - label(grid[3], "Polygon") - - # add an ellipse - ellipse = mpatches.Ellipse(grid[4], 0.2, 0.1) - patches.append(ellipse) - label(grid[4], "Ellipse") - - # add an arrow - arrow = mpatches.Arrow(grid[5, 0] - 0.05, grid[5, 1] - 0.05, 0.1, 0.1, width=0.1) - patches.append(arrow) - label(grid[5], "Arrow") - - # add a path patch - Path = mpath.Path - path_data = [ - (Path.MOVETO, [0.018, -0.11]), - (Path.CURVE4, [-0.031, -0.051]), - (Path.CURVE4, [-0.115, 0.073]), - (Path.CURVE4, [-0.03 , 0.073]), - (Path.LINETO, [-0.011, 0.039]), - (Path.CURVE4, [0.043, 0.121]), - (Path.CURVE4, [0.075, -0.005]), - (Path.CURVE4, [0.035, -0.027]), - (Path.CLOSEPOLY, [0.018, -0.11]) - ] - codes, verts = zip(*path_data) - path = mpath.Path(verts + grid[6], codes) - patch = mpatches.PathPatch(path) - patches.append(patch) - label(grid[6], "PathPatch") - - # add a fancy box - fancybox = mpatches.FancyBboxPatch( - grid[7] - [0.025, 0.05], 0.05, 0.1, - boxstyle=mpatches.BoxStyle("Round", pad=0.02)) - patches.append(fancybox) - label(grid[7], "FancyBboxPatch") - - # add a line - x, y = np.array([[-0.06, 0.0, 0.1], [0.05, -0.05, 0.05]]) - line = mlines.Line2D(x + grid[8, 0], y + grid[8, 1], lw=5., alpha=0.3) - label(grid[8], "Line2D") - - colors = np.linspace(0, 1, len(patches)) - collection = PatchCollection(patches, cmap=plt.cm.hsv, alpha=0.3) - collection.set_array(np.array(colors)) - ax.add_collection(collection) - ax.add_line(line) - - plt.subplots_adjust(left=0, right=1, bottom=0, top=1) - plt.axis('equal') - plt.axis('off') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/shapes_and_collections/index.rst.txt b/_sources/examples/shapes_and_collections/index.rst.txt deleted file mode 100644 index 1c625ab3397..00000000000 --- a/_sources/examples/shapes_and_collections/index.rst.txt +++ /dev/null @@ -1,17 +0,0 @@ -.. _shapes_and_collections-examples-index: - -############################################## -shapes_and_collections Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - artist_reference - path_patch_demo - scatter_demo diff --git a/_sources/examples/shapes_and_collections/index.txt b/_sources/examples/shapes_and_collections/index.txt deleted file mode 100644 index 1c625ab3397..00000000000 --- a/_sources/examples/shapes_and_collections/index.txt +++ /dev/null @@ -1,17 +0,0 @@ -.. _shapes_and_collections-examples-index: - -############################################## -shapes_and_collections Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - artist_reference - path_patch_demo - scatter_demo diff --git a/_sources/examples/shapes_and_collections/path_patch_demo.rst.txt b/_sources/examples/shapes_and_collections/path_patch_demo.rst.txt deleted file mode 100644 index 222b102b776..00000000000 --- a/_sources/examples/shapes_and_collections/path_patch_demo.rst.txt +++ /dev/null @@ -1,48 +0,0 @@ -.. _shapes_and_collections-path_patch_demo: - -shapes_and_collections example code: path_patch_demo.py -======================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/shapes_and_collections/path_patch_demo.py - -:: - - """ - Demo of a PathPatch object. - """ - import matplotlib.path as mpath - import matplotlib.patches as mpatches - import matplotlib.pyplot as plt - - - fig, ax = plt.subplots() - - Path = mpath.Path - path_data = [ - (Path.MOVETO, (1.58, -2.57)), - (Path.CURVE4, (0.35, -1.1)), - (Path.CURVE4, (-1.75, 2.0)), - (Path.CURVE4, (0.375, 2.0)), - (Path.LINETO, (0.85, 1.15)), - (Path.CURVE4, (2.2, 3.2)), - (Path.CURVE4, (3, 0.05)), - (Path.CURVE4, (2.0, -0.5)), - (Path.CLOSEPOLY, (1.58, -2.57)), - ] - codes, verts = zip(*path_data) - path = mpath.Path(verts, codes) - patch = mpatches.PathPatch(path, facecolor='r', alpha=0.5) - ax.add_patch(patch) - - # plot control points and connecting lines - x, y = zip(*path.vertices) - line, = ax.plot(x, y, 'go-') - - ax.grid() - ax.axis('equal') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/shapes_and_collections/path_patch_demo.txt b/_sources/examples/shapes_and_collections/path_patch_demo.txt deleted file mode 100644 index ce20401e4d6..00000000000 --- a/_sources/examples/shapes_and_collections/path_patch_demo.txt +++ /dev/null @@ -1,48 +0,0 @@ -.. _shapes_and_collections-path_patch_demo: - -shapes_and_collections example code: path_patch_demo.py -======================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/shapes_and_collections/path_patch_demo.py - -:: - - """ - Demo of a PathPatch object. - """ - import matplotlib.path as mpath - import matplotlib.patches as mpatches - import matplotlib.pyplot as plt - - - fig, ax = plt.subplots() - - Path = mpath.Path - path_data = [ - (Path.MOVETO, (1.58, -2.57)), - (Path.CURVE4, (0.35, -1.1)), - (Path.CURVE4, (-1.75, 2.0)), - (Path.CURVE4, (0.375, 2.0)), - (Path.LINETO, (0.85, 1.15)), - (Path.CURVE4, (2.2, 3.2)), - (Path.CURVE4, (3, 0.05)), - (Path.CURVE4, (2.0, -0.5)), - (Path.CLOSEPOLY, (1.58, -2.57)), - ] - codes, verts = zip(*path_data) - path = mpath.Path(verts, codes) - patch = mpatches.PathPatch(path, facecolor='r', alpha=0.5) - ax.add_patch(patch) - - # plot control points and connecting lines - x, y = zip(*path.vertices) - line, = ax.plot(x, y, 'go-') - - ax.grid() - ax.axis('equal') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/shapes_and_collections/scatter_demo.rst.txt b/_sources/examples/shapes_and_collections/scatter_demo.rst.txt deleted file mode 100644 index acb303cd3f9..00000000000 --- a/_sources/examples/shapes_and_collections/scatter_demo.rst.txt +++ /dev/null @@ -1,29 +0,0 @@ -.. _shapes_and_collections-scatter_demo: - -shapes_and_collections example code: scatter_demo.py -==================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/shapes_and_collections/scatter_demo.py - -:: - - """ - Simple demo of a scatter plot. - """ - import numpy as np - import matplotlib.pyplot as plt - - - N = 50 - x = np.random.rand(N) - y = np.random.rand(N) - colors = np.random.rand(N) - area = np.pi * (15 * np.random.rand(N))**2 # 0 to 15 point radii - - plt.scatter(x, y, s=area, c=colors, alpha=0.5) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/shapes_and_collections/scatter_demo.txt b/_sources/examples/shapes_and_collections/scatter_demo.txt deleted file mode 100644 index 29012c100a2..00000000000 --- a/_sources/examples/shapes_and_collections/scatter_demo.txt +++ /dev/null @@ -1,29 +0,0 @@ -.. _shapes_and_collections-scatter_demo: - -shapes_and_collections example code: scatter_demo.py -==================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/shapes_and_collections/scatter_demo.py - -:: - - """ - Simple demo of a scatter plot. - """ - import numpy as np - import matplotlib.pyplot as plt - - - N = 50 - x = np.random.rand(N) - y = np.random.rand(N) - colors = np.random.rand(N) - area = np.pi * (15 * np.random.rand(N))**2 # 0 to 15 point radiuses - - plt.scatter(x, y, s=area, c=colors, alpha=0.5) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/showcase/anatomy.rst.txt b/_sources/examples/showcase/anatomy.rst.txt deleted file mode 100644 index deb065fa7d7..00000000000 --- a/_sources/examples/showcase/anatomy.rst.txt +++ /dev/null @@ -1,154 +0,0 @@ -.. _showcase-anatomy: - -showcase example code: anatomy.py -================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/showcase/anatomy.py - -:: - - # This figure shows the name of several matplotlib elements composing a figure - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.ticker import AutoMinorLocator, MultipleLocator, FuncFormatter - - - np.random.seed(19680801) - - X = np.linspace(0.5, 3.5, 100) - Y1 = 3+np.cos(X) - Y2 = 1+np.cos(1+X/0.75)/2 - Y3 = np.random.uniform(Y1, Y2, len(X)) - - fig = plt.figure(figsize=(8, 8)) - ax = fig.add_subplot(1, 1, 1, aspect=1) - - - def minor_tick(x, pos): - if not x % 1.0: - return "" - return "%.2f" % x - - ax.xaxis.set_major_locator(MultipleLocator(1.000)) - ax.xaxis.set_minor_locator(AutoMinorLocator(4)) - ax.yaxis.set_major_locator(MultipleLocator(1.000)) - ax.yaxis.set_minor_locator(AutoMinorLocator(4)) - ax.xaxis.set_minor_formatter(FuncFormatter(minor_tick)) - - ax.set_xlim(0, 4) - ax.set_ylim(0, 4) - - ax.tick_params(which='major', width=1.0) - ax.tick_params(which='major', length=10) - ax.tick_params(which='minor', width=1.0, labelsize=10) - ax.tick_params(which='minor', length=5, labelsize=10, labelcolor='0.25') - - ax.grid(linestyle="--", linewidth=0.5, color='.25', zorder=-10) - - ax.plot(X, Y1, c=(0.25, 0.25, 1.00), lw=2, label="Blue signal", zorder=10) - ax.plot(X, Y2, c=(1.00, 0.25, 0.25), lw=2, label="Red signal") - ax.plot(X, Y3, linewidth=0, - marker='o', markerfacecolor='w', markeredgecolor='k') - - ax.set_title("Anatomy of a figure", fontsize=20, verticalalignment='bottom') - ax.set_xlabel("X axis label") - ax.set_ylabel("Y axis label") - - ax.legend() - - - def circle(x, y, radius=0.15): - from matplotlib.patches import Circle - from matplotlib.patheffects import withStroke - circle = Circle((x, y), radius, clip_on=False, zorder=10, linewidth=1, - edgecolor='black', facecolor=(0, 0, 0, .0125), - path_effects=[withStroke(linewidth=5, foreground='w')]) - ax.add_artist(circle) - - - def text(x, y, text): - ax.text(x, y, text, backgroundcolor="white", - ha='center', va='top', weight='bold', color='blue') - - - # Minor tick - circle(0.50, -0.10) - text(0.50, -0.32, "Minor tick label") - - # Major tick - circle(-0.03, 4.00) - text(0.03, 3.80, "Major tick") - - # Minor tick - circle(0.00, 3.50) - text(0.00, 3.30, "Minor tick") - - # Major tick label - circle(-0.15, 3.00) - text(-0.15, 2.80, "Major tick label") - - # X Label - circle(1.80, -0.27) - text(1.80, -0.45, "X axis label") - - # Y Label - circle(-0.27, 1.80) - text(-0.27, 1.6, "Y axis label") - - # Title - circle(1.60, 4.13) - text(1.60, 3.93, "Title") - - # Blue plot - circle(1.75, 2.80) - text(1.75, 2.60, "Line\n(line plot)") - - # Red plot - circle(1.20, 0.60) - text(1.20, 0.40, "Line\n(line plot)") - - # Scatter plot - circle(3.20, 1.75) - text(3.20, 1.55, "Markers\n(scatter plot)") - - # Grid - circle(3.00, 3.00) - text(3.00, 2.80, "Grid") - - # Legend - circle(3.70, 3.80) - text(3.70, 3.60, "Legend") - - # Axes - circle(0.5, 0.5) - text(0.5, 0.3, "Axes") - - # Figure - circle(-0.3, 0.65) - text(-0.3, 0.45, "Figure") - - color = 'blue' - ax.annotate('Spines', xy=(4.0, 0.35), xycoords='data', - xytext=(3.3, 0.5), textcoords='data', - weight='bold', color=color, - arrowprops=dict(arrowstyle='->', - connectionstyle="arc3", - color=color)) - - ax.annotate('', xy=(3.15, 0.0), xycoords='data', - xytext=(3.45, 0.45), textcoords='data', - weight='bold', color=color, - arrowprops=dict(arrowstyle='->', - connectionstyle="arc3", - color=color)) - - ax.text(4.0, -0.4, "Made with http://matplotlib.org", - fontsize=10, ha="right", color='.5') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/showcase/bachelors_degrees_by_gender.rst.txt b/_sources/examples/showcase/bachelors_degrees_by_gender.rst.txt deleted file mode 100644 index 795f056e068..00000000000 --- a/_sources/examples/showcase/bachelors_degrees_by_gender.rst.txt +++ /dev/null @@ -1,115 +0,0 @@ -.. _showcase-bachelors_degrees_by_gender: - -showcase example code: bachelors_degrees_by_gender.py -===================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/showcase/bachelors_degrees_by_gender.py - -:: - - import matplotlib.pyplot as plt - from matplotlib.mlab import csv2rec - from matplotlib.cbook import get_sample_data - - fname = get_sample_data('percent_bachelors_degrees_women_usa.csv') - gender_degree_data = csv2rec(fname) - - # These are the colors that will be used in the plot - color_sequence = ['#1f77b4', '#aec7e8', '#ff7f0e', '#ffbb78', '#2ca02c', - '#98df8a', '#d62728', '#ff9896', '#9467bd', '#c5b0d5', - '#8c564b', '#c49c94', '#e377c2', '#f7b6d2', '#7f7f7f', - '#c7c7c7', '#bcbd22', '#dbdb8d', '#17becf', '#9edae5'] - - # You typically want your plot to be ~1.33x wider than tall. This plot - # is a rare exception because of the number of lines being plotted on it. - # Common sizes: (10, 7.5) and (12, 9) - fig, ax = plt.subplots(1, 1, figsize=(12, 14)) - - # Remove the plot frame lines. They are unnecessary here. - ax.spines['top'].set_visible(False) - ax.spines['bottom'].set_visible(False) - ax.spines['right'].set_visible(False) - ax.spines['left'].set_visible(False) - - # Ensure that the axis ticks only show up on the bottom and left of the plot. - # Ticks on the right and top of the plot are generally unnecessary. - ax.get_xaxis().tick_bottom() - ax.get_yaxis().tick_left() - - fig.subplots_adjust(left=.06, right=.75, bottom=.02, top=.94) - # Limit the range of the plot to only where the data is. - # Avoid unnecessary whitespace. - ax.set_xlim(1969.5, 2011.1) - ax.set_ylim(-0.25, 90) - - # Make sure your axis ticks are large enough to be easily read. - # You don't want your viewers squinting to read your plot. - plt.xticks(range(1970, 2011, 10), fontsize=14) - plt.yticks(range(0, 91, 10), fontsize=14) - ax.xaxis.set_major_formatter(plt.FuncFormatter('{:.0f}'.format)) - ax.yaxis.set_major_formatter(plt.FuncFormatter('{:.0f}%'.format)) - - # Provide tick lines across the plot to help your viewers trace along - # the axis ticks. Make sure that the lines are light and small so they - # don't obscure the primary data lines. - plt.grid(True, 'major', 'y', ls='--', lw=.5, c='k', alpha=.3) - - # Remove the tick marks; they are unnecessary with the tick lines we just - # plotted. - plt.tick_params(axis='both', which='both', bottom='off', top='off', - labelbottom='on', left='off', right='off', labelleft='on') - - # Now that the plot is prepared, it's time to actually plot the data! - # Note that I plotted the majors in order of the highest % in the final year. - majors = ['Health Professions', 'Public Administration', 'Education', - 'Psychology', 'Foreign Languages', 'English', - 'Communications\nand Journalism', 'Art and Performance', 'Biology', - 'Agriculture', 'Social Sciences and History', 'Business', - 'Math and Statistics', 'Architecture', 'Physical Sciences', - 'Computer Science', 'Engineering'] - - y_offsets = {'Foreign Languages': 0.5, 'English': -0.5, - 'Communications\nand Journalism': 0.75, - 'Art and Performance': -0.25, 'Agriculture': 1.25, - 'Social Sciences and History': 0.25, 'Business': -0.75, - 'Math and Statistics': 0.75, 'Architecture': -0.75, - 'Computer Science': 0.75, 'Engineering': -0.25} - - for rank, column in enumerate(majors): - # Plot each line separately with its own color. - column_rec_name = column.replace('\n', '_').replace(' ', '_').lower() - - line = plt.plot(gender_degree_data.year, - gender_degree_data[column_rec_name], - lw=2.5, - color=color_sequence[rank]) - - # Add a text label to the right end of every line. Most of the code below - # is adding specific offsets y position because some labels overlapped. - y_pos = gender_degree_data[column_rec_name][-1] - 0.5 - - if column in y_offsets: - y_pos += y_offsets[column] - - # Again, make sure that all labels are large enough to be easily read - # by the viewer. - plt.text(2011.5, y_pos, column, fontsize=14, color=color_sequence[rank]) - - # Make the title big enough so it spans the entire plot, but don't make it - # so big that it requires two lines to show. - - # Note that if the title is descriptive enough, it is unnecessary to include - # axis labels; they are self-evident, in this plot's case. - fig.suptitle('Percentage of Bachelor\'s degrees conferred to women in ' - 'the U.S.A. by major (1970-2011)\n', fontsize=18, ha='center') - - # Finally, save the figure as a PNG. - # You can also save it as a PDF, JPEG, etc. - # Just change the file extension in this call. - # plt.savefig('percent-bachelors-degrees-women-usa.png', bbox_inches='tight') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/showcase/bachelors_degrees_by_gender.txt b/_sources/examples/showcase/bachelors_degrees_by_gender.txt deleted file mode 100644 index fe055df30b1..00000000000 --- a/_sources/examples/showcase/bachelors_degrees_by_gender.txt +++ /dev/null @@ -1,114 +0,0 @@ -.. _showcase-bachelors_degrees_by_gender: - -showcase example code: bachelors_degrees_by_gender.py -===================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/showcase/bachelors_degrees_by_gender.py - -:: - - import matplotlib.pyplot as plt - from matplotlib.mlab import csv2rec - from matplotlib.cbook import get_sample_data - - fname = get_sample_data('percent_bachelors_degrees_women_usa.csv') - gender_degree_data = csv2rec(fname) - - # These are the colors that will be used in the plot - color_sequence = ['#1f77b4', '#aec7e8', '#ff7f0e', '#ffbb78', '#2ca02c', - '#98df8a', '#d62728', '#ff9896', '#9467bd', '#c5b0d5', - '#8c564b', '#c49c94', '#e377c2', '#f7b6d2', '#7f7f7f', - '#c7c7c7', '#bcbd22', '#dbdb8d', '#17becf', '#9edae5'] - - # You typically want your plot to be ~1.33x wider than tall. This plot - # is a rare exception because of the number of lines being plotted on it. - # Common sizes: (10, 7.5) and (12, 9) - fig, ax = plt.subplots(1, 1, figsize=(12, 14)) - - # Remove the plot frame lines. They are unnecessary here. - ax.spines['top'].set_visible(False) - ax.spines['bottom'].set_visible(False) - ax.spines['right'].set_visible(False) - ax.spines['left'].set_visible(False) - - # Ensure that the axis ticks only show up on the bottom and left of the plot. - # Ticks on the right and top of the plot are generally unnecessary. - ax.get_xaxis().tick_bottom() - ax.get_yaxis().tick_left() - - # Limit the range of the plot to only where the data is. - # Avoid unnecessary whitespace. - plt.xlim(1968.5, 2011.1) - plt.ylim(-0.25, 90) - - # Make sure your axis ticks are large enough to be easily read. - # You don't want your viewers squinting to read your plot. - plt.xticks(range(1970, 2011, 10), fontsize=14) - plt.yticks(range(0, 91, 10), ['{0}%'.format(x) - for x in range(0, 91, 10)], fontsize=14) - - # Provide tick lines across the plot to help your viewers trace along - # the axis ticks. Make sure that the lines are light and small so they - # don't obscure the primary data lines. - for y in range(10, 91, 10): - plt.plot(range(1969, 2012), [y] * len(range(1969, 2012)), '--', - lw=0.5, color='black', alpha=0.3) - - # Remove the tick marks; they are unnecessary with the tick lines we just - # plotted. - plt.tick_params(axis='both', which='both', bottom='off', top='off', - labelbottom='on', left='off', right='off', labelleft='on') - - # Now that the plot is prepared, it's time to actually plot the data! - # Note that I plotted the majors in order of the highest % in the final year. - majors = ['Health Professions', 'Public Administration', 'Education', - 'Psychology', 'Foreign Languages', 'English', - 'Communications\nand Journalism', 'Art and Performance', 'Biology', - 'Agriculture', 'Social Sciences and History', 'Business', - 'Math and Statistics', 'Architecture', 'Physical Sciences', - 'Computer Science', 'Engineering'] - - y_offsets = {'Foreign Languages': 0.5, 'English': -0.5, - 'Communications\nand Journalism': 0.75, - 'Art and Performance': -0.25, 'Agriculture': 1.25, - 'Social Sciences and History': 0.25, 'Business': -0.75, - 'Math and Statistics': 0.75, 'Architecture': -0.75, - 'Computer Science': 0.75, 'Engineering': -0.25} - - for rank, column in enumerate(majors): - # Plot each line separately with its own color. - column_rec_name = column.replace('\n', '_').replace(' ', '_').lower() - - line = plt.plot(gender_degree_data.year, - gender_degree_data[column_rec_name], - lw=2.5, - color=color_sequence[rank]) - - # Add a text label to the right end of every line. Most of the code below - # is adding specific offsets y position because some labels overlapped. - y_pos = gender_degree_data[column_rec_name][-1] - 0.5 - - if column in y_offsets: - y_pos += y_offsets[column] - - # Again, make sure that all labels are large enough to be easily read - # by the viewer. - plt.text(2011.5, y_pos, column, fontsize=14, color=color_sequence[rank]) - - # Make the title big enough so it spans the entire plot, but don't make it - # so big that it requires two lines to show. - - # Note that if the title is descriptive enough, it is unnecessary to include - # axis labels; they are self-evident, in this plot's case. - plt.title('Percentage of Bachelor\'s degrees conferred to women in ' - 'the U.S.A. by major (1970-2011)\n', fontsize=18, ha='center') - - # Finally, save the figure as a PNG. - # You can also save it as a PDF, JPEG, etc. - # Just change the file extension in this call. - plt.savefig('percent-bachelors-degrees-women-usa.png', bbox_inches='tight') - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/showcase/firefox.rst.txt b/_sources/examples/showcase/firefox.rst.txt deleted file mode 100644 index 72b13a5fe6e..00000000000 --- a/_sources/examples/showcase/firefox.rst.txt +++ /dev/null @@ -1,85 +0,0 @@ -.. _showcase-firefox: - -showcase example code: firefox.py -================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/showcase/firefox.py - -:: - - """ - ======= - Firefox - ======= - - This example shows how to create the Firefox logo with path and patches. - """ - - import re - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.path import Path - import matplotlib.patches as patches - - # From: http://raphaeljs.com/icons/#firefox - firefox = "M28.4,22.469c0.479-0.964,0.851-1.991,1.095-3.066c0.953-3.661,0.666-6.854,0.666-6.854l-0.327,2.104c0,0-0.469-3.896-1.044-5.353c-0.881-2.231-1.273-2.214-1.274-2.21c0.542,1.379,0.494,2.169,0.483,2.288c-0.01-0.016-0.019-0.032-0.027-0.047c-0.131-0.324-0.797-1.819-2.225-2.878c-2.502-2.481-5.943-4.014-9.745-4.015c-4.056,0-7.705,1.745-10.238,4.525C5.444,6.5,5.183,5.938,5.159,5.317c0,0-0.002,0.002-0.006,0.005c0-0.011-0.003-0.021-0.003-0.031c0,0-1.61,1.247-1.436,4.612c-0.299,0.574-0.56,1.172-0.777,1.791c-0.375,0.817-0.75,2.004-1.059,3.746c0,0,0.133-0.422,0.399-0.988c-0.064,0.482-0.103,0.971-0.116,1.467c-0.09,0.845-0.118,1.865-0.039,3.088c0,0,0.032-0.406,0.136-1.021c0.834,6.854,6.667,12.165,13.743,12.165l0,0c1.86,0,3.636-0.37,5.256-1.036C24.938,27.771,27.116,25.196,28.4,22.469zM16.002,3.356c2.446,0,4.73,0.68,6.68,1.86c-2.274-0.528-3.433-0.261-3.423-0.248c0.013,0.015,3.384,0.589,3.981,1.411c0,0-1.431,0-2.856,0.41c-0.065,0.019,5.242,0.663,6.327,5.966c0,0-0.582-1.213-1.301-1.42c0.473,1.439,0.351,4.17-0.1,5.528c-0.058,0.174-0.118-0.755-1.004-1.155c0.284,2.037-0.018,5.268-1.432,6.158c-0.109,0.07,0.887-3.189,0.201-1.93c-4.093,6.276-8.959,2.539-10.934,1.208c1.585,0.388,3.267,0.108,4.242-0.559c0.982-0.672,1.564-1.162,2.087-1.047c0.522,0.117,0.87-0.407,0.464-0.872c-0.405-0.466-1.392-1.105-2.725-0.757c-0.94,0.247-2.107,1.287-3.886,0.233c-1.518-0.899-1.507-1.63-1.507-2.095c0-0.366,0.257-0.88,0.734-1.028c0.58,0.062,1.044,0.214,1.537,0.466c0.005-0.135,0.006-0.315-0.001-0.519c0.039-0.077,0.015-0.311-0.047-0.596c-0.036-0.287-0.097-0.582-0.19-0.851c0.01-0.002,0.017-0.007,0.021-0.021c0.076-0.344,2.147-1.544,2.299-1.659c0.153-0.114,0.55-0.378,0.506-1.183c-0.015-0.265-0.058-0.294-2.232-0.286c-0.917,0.003-1.425-0.894-1.589-1.245c0.222-1.231,0.863-2.11,1.919-2.704c0.02-0.011,0.015-0.021-0.008-0.027c0.219-0.127-2.524-0.006-3.76,1.604C9.674,8.045,9.219,7.95,8.71,7.95c-0.638,0-1.139,0.07-1.603,0.187c-0.05,0.013-0.122,0.011-0.208-0.001C6.769,8.04,6.575,7.88,6.365,7.672c0.161-0.18,0.324-0.356,0.495-0.526C9.201,4.804,12.43,3.357,16.002,3.356z" - - - def svg_parse(path): - commands = {'M': (Path.MOVETO,), - 'L': (Path.LINETO,), - 'Q': (Path.CURVE3,)*2, - 'C': (Path.CURVE4,)*3, - 'Z': (Path.CLOSEPOLY,)} - path_re = re.compile(r'([MLHVCSQTAZ])([^MLHVCSQTAZ]+)', re.IGNORECASE) - float_re = re.compile(r'(?:[\s,]*)([+-]?\d+(?:\.\d+)?)') - vertices = [] - codes = [] - last = (0, 0) - for cmd, values in path_re.findall(path): - points = [float(v) for v in float_re.findall(values)] - points = np.array(points).reshape((len(points)//2, 2)) - if cmd.islower(): - points += last - cmd = cmd.capitalize() - last = points[-1] - codes.extend(commands[cmd]) - vertices.extend(points.tolist()) - return codes, vertices - - # SVG to matplotlib - codes, verts = svg_parse(firefox) - verts = np.array(verts) - path = Path(verts, codes) - - # Make upside down - verts[:, 1] *= -1 - xmin, xmax = verts[:, 0].min()-1, verts[:, 0].max()+1 - ymin, ymax = verts[:, 1].min()-1, verts[:, 1].max()+1 - - fig = plt.figure(figsize=(5, 5)) - ax = fig.add_axes([0.0, 0.0, 1.0, 1.0], frameon=False, aspect=1) - - # White outline (width = 6) - patch = patches.PathPatch(path, facecolor='None', edgecolor='w', lw=6) - ax.add_patch(patch) - - # Actual shape with black outline - patch = patches.PathPatch(path, facecolor='orange', edgecolor='k', lw=2) - ax.add_patch(patch) - - # Centering - ax.set_xlim(xmin, xmax) - ax.set_ylim(ymin, ymax) - - # No ticks - ax.set_xticks([]) - ax.set_yticks([]) - - # Display - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/showcase/index.rst.txt b/_sources/examples/showcase/index.rst.txt deleted file mode 100644 index 00d6ea35756..00000000000 --- a/_sources/examples/showcase/index.rst.txt +++ /dev/null @@ -1,20 +0,0 @@ -.. _showcase-examples-index: - -############################################## -showcase Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - anatomy - bachelors_degrees_by_gender - firefox - integral_demo - mandelbrot - xkcd diff --git a/_sources/examples/showcase/index.txt b/_sources/examples/showcase/index.txt deleted file mode 100644 index ee4e0b7597c..00000000000 --- a/_sources/examples/showcase/index.txt +++ /dev/null @@ -1,17 +0,0 @@ -.. _showcase-examples-index: - -############################################## -showcase Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - bachelors_degrees_by_gender - integral_demo - xkcd diff --git a/_sources/examples/showcase/integral_demo.rst.txt b/_sources/examples/showcase/integral_demo.rst.txt deleted file mode 100644 index 95b1b2b3d18..00000000000 --- a/_sources/examples/showcase/integral_demo.rst.txt +++ /dev/null @@ -1,65 +0,0 @@ -.. _showcase-integral_demo: - -showcase example code: integral_demo.py -======================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/showcase/integral_demo.py - -:: - - """ - Plot demonstrating the integral as the area under a curve. - - Although this is a simple example, it demonstrates some important tweaks: - - * A simple line plot with custom color and line width. - * A shaded region created using a Polygon patch. - * A text label with mathtext rendering. - * figtext calls to label the x- and y-axes. - * Use of axis spines to hide the top and right spines. - * Custom tick placement and labels. - """ - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.patches import Polygon - - - def func(x): - return (x - 3) * (x - 5) * (x - 7) + 85 - - - a, b = 2, 9 # integral limits - x = np.linspace(0, 10) - y = func(x) - - fig, ax = plt.subplots() - plt.plot(x, y, 'r', linewidth=2) - plt.ylim(ymin=0) - - # Make the shaded region - ix = np.linspace(a, b) - iy = func(ix) - verts = [(a, 0)] + list(zip(ix, iy)) + [(b, 0)] - poly = Polygon(verts, facecolor='0.9', edgecolor='0.5') - ax.add_patch(poly) - - plt.text(0.5 * (a + b), 30, r"$\int_a^b f(x)\mathrm{d}x$", - horizontalalignment='center', fontsize=20) - - plt.figtext(0.9, 0.05, '$x$') - plt.figtext(0.1, 0.9, '$y$') - - ax.spines['right'].set_visible(False) - ax.spines['top'].set_visible(False) - ax.xaxis.set_ticks_position('bottom') - - ax.set_xticks((a, b)) - ax.set_xticklabels(('$a$', '$b$')) - ax.set_yticks([]) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/showcase/integral_demo.txt b/_sources/examples/showcase/integral_demo.txt deleted file mode 100644 index 35ff30492b2..00000000000 --- a/_sources/examples/showcase/integral_demo.txt +++ /dev/null @@ -1,65 +0,0 @@ -.. _showcase-integral_demo: - -showcase example code: integral_demo.py -======================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/showcase/integral_demo.py - -:: - - """ - Plot demonstrating the integral as the area under a curve. - - Although this is a simple example, it demonstrates some important tweaks: - - * A simple line plot with custom color and line width. - * A shaded region created using a Polygon patch. - * A text label with mathtext rendering. - * figtext calls to label the x- and y-axes. - * Use of axis spines to hide the top and right spines. - * Custom tick placement and labels. - """ - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.patches import Polygon - - - def func(x): - return (x - 3) * (x - 5) * (x - 7) + 85 - - - a, b = 2, 9 # integral limits - x = np.linspace(0, 10) - y = func(x) - - fig, ax = plt.subplots() - plt.plot(x, y, 'r', linewidth=2) - plt.ylim(ymin=0) - - # Make the shaded region - ix = np.linspace(a, b) - iy = func(ix) - verts = [(a, 0)] + list(zip(ix, iy)) + [(b, 0)] - poly = Polygon(verts, facecolor='0.9', edgecolor='0.5') - ax.add_patch(poly) - - plt.text(0.5 * (a + b), 30, r"$\int_a^b f(x)\mathrm{d}x$", - horizontalalignment='center', fontsize=20) - - plt.figtext(0.9, 0.05, '$x$') - plt.figtext(0.1, 0.9, '$y$') - - ax.spines['right'].set_visible(False) - ax.spines['top'].set_visible(False) - ax.xaxis.set_ticks_position('bottom') - - ax.set_xticks((a, b)) - ax.set_xticklabels(('$a$', '$b$')) - ax.set_yticks([]) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/showcase/mandelbrot.rst.txt b/_sources/examples/showcase/mandelbrot.rst.txt deleted file mode 100644 index e1aef4e5a06..00000000000 --- a/_sources/examples/showcase/mandelbrot.rst.txt +++ /dev/null @@ -1,90 +0,0 @@ -.. _showcase-mandelbrot: - -showcase example code: mandelbrot.py -==================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/showcase/mandelbrot.py - -:: - - """ - =================================== - Shaded & power normalized rendering - =================================== - - The Mandelbrot set rendering can be improved by using a normalized recount - associated with a power normalized colormap (gamma=0.3). Rendering can be - further enhanced thanks to shading. - - The `maxiter` gives the precision of the computation. `maxiter=200` should - take a few seconds on most modern laptops. - """ - import numpy as np - - - def mandelbrot_set(xmin, xmax, ymin, ymax, xn, yn, maxiter, horizon=2.0): - X = np.linspace(xmin, xmax, xn, dtype=np.float32) - Y = np.linspace(ymin, ymax, yn, dtype=np.float32) - C = X + Y[:, None]*1j - N = np.zeros(C.shape, dtype=int) - Z = np.zeros(C.shape, np.complex64) - for n in range(maxiter): - I = np.less(abs(Z), horizon) - N[I] = n - Z[I] = Z[I]**2 + C[I] - N[N == maxiter-1] = 0 - return Z, N - - - if __name__ == '__main__': - import time - import matplotlib - from matplotlib import colors - import matplotlib.pyplot as plt - - xmin, xmax, xn = -2.25, +0.75, 3000/2 - ymin, ymax, yn = -1.25, +1.25, 2500/2 - maxiter = 200 - horizon = 2.0 ** 40 - log_horizon = np.log(np.log(horizon))/np.log(2) - Z, N = mandelbrot_set(xmin, xmax, ymin, ymax, xn, yn, maxiter, horizon) - - # Normalized recount as explained in: - # https://linas.org/art-gallery/escape/smooth.html - # https://www.ibm.com/developerworks/community/blogs/jfp/entry/My_Christmas_Gift - - # This line will generate warnings for null values but it is faster to - # process them afterwards using the nan_to_num - with np.errstate(invalid='ignore'): - M = np.nan_to_num(N + 1 - - np.log(np.log(abs(Z)))/np.log(2) + - log_horizon) - - dpi = 72 - width = 10 - height = 10*yn/xn - fig = plt.figure(figsize=(width, height), dpi=dpi) - ax = fig.add_axes([0.0, 0.0, 1.0, 1.0], frameon=False, aspect=1) - - # Shaded rendering - light = colors.LightSource(azdeg=315, altdeg=10) - M = light.shade(M, cmap=plt.cm.hot, vert_exag=1.5, - norm=colors.PowerNorm(0.3), blend_mode='hsv') - plt.imshow(M, extent=[xmin, xmax, ymin, ymax], interpolation="bicubic") - ax.set_xticks([]) - ax.set_yticks([]) - - # Some advertisement for matplotlib - year = time.strftime("%Y") - major, minor, micro = matplotlib.__version__.split('.', 2) - text = ("The Mandelbrot fractal set\n" - "Rendered with matplotlib %s.%s, %s - http://matplotlib.org" - % (major, minor, year)) - ax.text(xmin+.025, ymin+.025, text, color="white", fontsize=12, alpha=0.5) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/showcase/xkcd.rst.txt b/_sources/examples/showcase/xkcd.rst.txt deleted file mode 100644 index 7a623570c58..00000000000 --- a/_sources/examples/showcase/xkcd.rst.txt +++ /dev/null @@ -1,75 +0,0 @@ -.. _showcase-xkcd: - -showcase example code: xkcd.py -============================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/showcase/xkcd.py - -:: - - """ - ==== - XKCD - ==== - - Shows how to create an xkcd-like plot. - """ - import matplotlib.pyplot as plt - import numpy as np - - with plt.xkcd(): - # Based on "Stove Ownership" from XKCD by Randall Monroe - # http://xkcd.com/418/ - - fig = plt.figure() - ax = fig.add_axes((0.1, 0.2, 0.8, 0.7)) - ax.spines['right'].set_color('none') - ax.spines['top'].set_color('none') - plt.xticks([]) - plt.yticks([]) - ax.set_ylim([-30, 10]) - - data = np.ones(100) - data[70:] -= np.arange(30) - - plt.annotate( - 'THE DAY I REALIZED\nI COULD COOK BACON\nWHENEVER I WANTED', - xy=(70, 1), arrowprops=dict(arrowstyle='->'), xytext=(15, -10)) - - plt.plot(data) - - plt.xlabel('time') - plt.ylabel('my overall health') - fig.text( - 0.5, 0.05, - '"Stove Ownership" from xkcd by Randall Monroe', - ha='center') - - # Based on "The Data So Far" from XKCD by Randall Monroe - # http://xkcd.com/373/ - - fig = plt.figure() - ax = fig.add_axes((0.1, 0.2, 0.8, 0.7)) - ax.bar([0, 1], [0, 100], 0.25) - ax.spines['right'].set_color('none') - ax.spines['top'].set_color('none') - ax.xaxis.set_ticks_position('bottom') - ax.set_xticks([0, 1]) - ax.set_xlim([-0.5, 1.5]) - ax.set_ylim([0, 110]) - ax.set_xticklabels(['CONFIRMED BY\nEXPERIMENT', 'REFUTED BY\nEXPERIMENT']) - plt.yticks([]) - - plt.title("CLAIMS OF SUPERNATURAL POWERS") - - fig.text( - 0.5, 0.05, - '"The Data So Far" from xkcd by Randall Monroe', - ha='center') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/showcase/xkcd.txt b/_sources/examples/showcase/xkcd.txt deleted file mode 100644 index 0022cb74e4c..00000000000 --- a/_sources/examples/showcase/xkcd.txt +++ /dev/null @@ -1,68 +0,0 @@ -.. _showcase-xkcd: - -showcase example code: xkcd.py -============================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/showcase/xkcd.py - -:: - - import matplotlib.pyplot as plt - import numpy as np - - with plt.xkcd(): - # Based on "Stove Ownership" from XKCD by Randall Monroe - # http://xkcd.com/418/ - - fig = plt.figure() - ax = fig.add_axes((0.1, 0.2, 0.8, 0.7)) - ax.spines['right'].set_color('none') - ax.spines['top'].set_color('none') - plt.xticks([]) - plt.yticks([]) - ax.set_ylim([-30, 10]) - - data = np.ones(100) - data[70:] -= np.arange(30) - - plt.annotate( - 'THE DAY I REALIZED\nI COULD COOK BACON\nWHENEVER I WANTED', - xy=(70, 1), arrowprops=dict(arrowstyle='->'), xytext=(15, -10)) - - plt.plot(data) - - plt.xlabel('time') - plt.ylabel('my overall health') - fig.text( - 0.5, 0.05, - '"Stove Ownership" from xkcd by Randall Monroe', - ha='center') - - # Based on "The Data So Far" from XKCD by Randall Monroe - # http://xkcd.com/373/ - - fig = plt.figure() - ax = fig.add_axes((0.1, 0.2, 0.8, 0.7)) - ax.bar([-0.125, 1.0 - 0.125], [0, 100], 0.25) - ax.spines['right'].set_color('none') - ax.spines['top'].set_color('none') - ax.xaxis.set_ticks_position('bottom') - ax.set_xticks([0, 1]) - ax.set_xlim([-0.5, 1.5]) - ax.set_ylim([0, 110]) - ax.set_xticklabels(['CONFIRMED BY\nEXPERIMENT', 'REFUTED BY\nEXPERIMENT']) - plt.yticks([]) - - plt.title("CLAIMS OF SUPERNATURAL POWERS") - - fig.text( - 0.5, 0.05, - '"The Data So Far" from xkcd by Randall Monroe', - ha='center') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/specialty_plots/advanced_hillshading.rst.txt b/_sources/examples/specialty_plots/advanced_hillshading.rst.txt deleted file mode 100644 index 4cbff0cefa0..00000000000 --- a/_sources/examples/specialty_plots/advanced_hillshading.rst.txt +++ /dev/null @@ -1,85 +0,0 @@ -.. _specialty_plots-advanced_hillshading: - -specialty_plots example code: advanced_hillshading.py -===================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/specialty_plots/advanced_hillshading.py - -:: - - """ - Demonstrates a few common tricks with shaded plots. - """ - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.colors import LightSource, Normalize - - - def display_colorbar(): - """Display a correct numeric colorbar for a shaded plot.""" - y, x = np.mgrid[-4:2:200j, -4:2:200j] - z = 10 * np.cos(x**2 + y**2) - - cmap = plt.cm.copper - ls = LightSource(315, 45) - rgb = ls.shade(z, cmap) - - fig, ax = plt.subplots() - ax.imshow(rgb, interpolation='bilinear') - - # Use a proxy artist for the colorbar... - im = ax.imshow(z, cmap=cmap) - im.remove() - fig.colorbar(im) - - ax.set_title('Using a colorbar with a shaded plot', size='x-large') - - - def avoid_outliers(): - """Use a custom norm to control the displayed z-range of a shaded plot.""" - y, x = np.mgrid[-4:2:200j, -4:2:200j] - z = 10 * np.cos(x**2 + y**2) - - # Add some outliers... - z[100, 105] = 2000 - z[120, 110] = -9000 - - ls = LightSource(315, 45) - fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(8, 4.5)) - - rgb = ls.shade(z, plt.cm.copper) - ax1.imshow(rgb, interpolation='bilinear') - ax1.set_title('Full range of data') - - rgb = ls.shade(z, plt.cm.copper, vmin=-10, vmax=10) - ax2.imshow(rgb, interpolation='bilinear') - ax2.set_title('Manually set range') - - fig.suptitle('Avoiding Outliers in Shaded Plots', size='x-large') - - - def shade_other_data(): - """Demonstrates displaying different variables through shade and color.""" - y, x = np.mgrid[-4:2:200j, -4:2:200j] - z1 = np.sin(x**2) # Data to hillshade - z2 = np.cos(x**2 + y**2) # Data to color - - norm = Normalize(z2.min(), z2.max()) - cmap = plt.cm.RdBu - - ls = LightSource(315, 45) - rgb = ls.shade_rgb(cmap(norm(z2)), z1) - - fig, ax = plt.subplots() - ax.imshow(rgb, interpolation='bilinear') - ax.set_title('Shade by one variable, color by another', size='x-large') - - display_colorbar() - avoid_outliers() - shade_other_data() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/specialty_plots/advanced_hillshading.txt b/_sources/examples/specialty_plots/advanced_hillshading.txt deleted file mode 100644 index 61c21aa1c6e..00000000000 --- a/_sources/examples/specialty_plots/advanced_hillshading.txt +++ /dev/null @@ -1,85 +0,0 @@ -.. _specialty_plots-advanced_hillshading: - -specialty_plots example code: advanced_hillshading.py -===================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/specialty_plots/advanced_hillshading.py - -:: - - """ - Demonstrates a few common tricks with shaded plots. - """ - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.colors import LightSource, Normalize - - - def display_colorbar(): - """Display a correct numeric colorbar for a shaded plot.""" - y, x = np.mgrid[-4:2:200j, -4:2:200j] - z = 10 * np.cos(x**2 + y**2) - - cmap = plt.cm.copper - ls = LightSource(315, 45) - rgb = ls.shade(z, cmap) - - fig, ax = plt.subplots() - ax.imshow(rgb) - - # Use a proxy artist for the colorbar... - im = ax.imshow(z, cmap=cmap) - im.remove() - fig.colorbar(im) - - ax.set_title('Using a colorbar with a shaded plot', size='x-large') - - - def avoid_outliers(): - """Use a custom norm to control the displayed z-range of a shaded plot.""" - y, x = np.mgrid[-4:2:200j, -4:2:200j] - z = 10 * np.cos(x**2 + y**2) - - # Add some outliers... - z[100, 105] = 2000 - z[120, 110] = -9000 - - ls = LightSource(315, 45) - fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(8, 4.5)) - - rgb = ls.shade(z, plt.cm.copper) - ax1.imshow(rgb) - ax1.set_title('Full range of data') - - rgb = ls.shade(z, plt.cm.copper, vmin=-10, vmax=10) - ax2.imshow(rgb) - ax2.set_title('Manually set range') - - fig.suptitle('Avoiding Outliers in Shaded Plots', size='x-large') - - - def shade_other_data(): - """Demonstrates displaying different variables through shade and color.""" - y, x = np.mgrid[-4:2:200j, -4:2:200j] - z1 = np.sin(x**2) # Data to hillshade - z2 = np.cos(x**2 + y**2) # Data to color - - norm = Normalize(z2.min(), z2.max()) - cmap = plt.cm.jet - - ls = LightSource(315, 45) - rgb = ls.shade_rgb(cmap(norm(z2)), z1) - - fig, ax = plt.subplots() - ax.imshow(rgb) - ax.set_title('Shade by one variable, color by another', size='x-large') - - display_colorbar() - avoid_outliers() - shade_other_data() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/specialty_plots/hinton_demo.rst.txt b/_sources/examples/specialty_plots/hinton_demo.rst.txt deleted file mode 100644 index 2fbe9e50f7c..00000000000 --- a/_sources/examples/specialty_plots/hinton_demo.rst.txt +++ /dev/null @@ -1,54 +0,0 @@ -.. _specialty_plots-hinton_demo: - -specialty_plots example code: hinton_demo.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/specialty_plots/hinton_demo.py - -:: - - """ - Demo of a function to create Hinton diagrams. - - Hinton diagrams are useful for visualizing the values of a 2D array (e.g. - a weight matrix): Positive and negative values are represented by white and - black squares, respectively, and the size of each square represents the - magnitude of each value. - - Initial idea from David Warde-Farley on the SciPy Cookbook - """ - import numpy as np - import matplotlib.pyplot as plt - - - def hinton(matrix, max_weight=None, ax=None): - """Draw Hinton diagram for visualizing a weight matrix.""" - ax = ax if ax is not None else plt.gca() - - if not max_weight: - max_weight = 2 ** np.ceil(np.log(np.abs(matrix).max()) / np.log(2)) - - ax.patch.set_facecolor('gray') - ax.set_aspect('equal', 'box') - ax.xaxis.set_major_locator(plt.NullLocator()) - ax.yaxis.set_major_locator(plt.NullLocator()) - - for (x, y), w in np.ndenumerate(matrix): - color = 'white' if w > 0 else 'black' - size = np.sqrt(np.abs(w) / max_weight) - rect = plt.Rectangle([x - size / 2, y - size / 2], size, size, - facecolor=color, edgecolor=color) - ax.add_patch(rect) - - ax.autoscale_view() - ax.invert_yaxis() - - - if __name__ == '__main__': - hinton(np.random.rand(20, 20) - 0.5) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/specialty_plots/hinton_demo.txt b/_sources/examples/specialty_plots/hinton_demo.txt deleted file mode 100644 index e66b8b41d34..00000000000 --- a/_sources/examples/specialty_plots/hinton_demo.txt +++ /dev/null @@ -1,54 +0,0 @@ -.. _specialty_plots-hinton_demo: - -specialty_plots example code: hinton_demo.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/specialty_plots/hinton_demo.py - -:: - - """ - Demo of a function to create Hinton diagrams. - - Hinton diagrams are useful for visualizing the values of a 2D array (e.g. - a weight matrix): Positive and negative values are represented by white and - black squares, respectively, and the size of each square represents the - magnitude of each value. - - Initial idea from David Warde-Farley on the SciPy Cookbook - """ - import numpy as np - import matplotlib.pyplot as plt - - - def hinton(matrix, max_weight=None, ax=None): - """Draw Hinton diagram for visualizing a weight matrix.""" - ax = ax if ax is not None else plt.gca() - - if not max_weight: - max_weight = 2 ** np.ceil(np.log(np.abs(matrix).max()) / np.log(2)) - - ax.patch.set_facecolor('gray') - ax.set_aspect('equal', 'box') - ax.xaxis.set_major_locator(plt.NullLocator()) - ax.yaxis.set_major_locator(plt.NullLocator()) - - for (x, y), w in np.ndenumerate(matrix): - color = 'white' if w > 0 else 'black' - size = np.sqrt(np.abs(w) / max_weight) - rect = plt.Rectangle([x - size / 2, y - size / 2], size, size, - facecolor=color, edgecolor=color) - ax.add_patch(rect) - - ax.autoscale_view() - ax.invert_yaxis() - - - if __name__ == '__main__': - hinton(np.random.rand(20, 20) - 0.5) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/specialty_plots/index.rst.txt b/_sources/examples/specialty_plots/index.rst.txt deleted file mode 100644 index d5eb0653ddc..00000000000 --- a/_sources/examples/specialty_plots/index.rst.txt +++ /dev/null @@ -1,17 +0,0 @@ -.. _specialty_plots-examples-index: - -############################################## -specialty_plots Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - advanced_hillshading - hinton_demo - topographic_hillshading diff --git a/_sources/examples/specialty_plots/index.txt b/_sources/examples/specialty_plots/index.txt deleted file mode 100644 index d5eb0653ddc..00000000000 --- a/_sources/examples/specialty_plots/index.txt +++ /dev/null @@ -1,17 +0,0 @@ -.. _specialty_plots-examples-index: - -############################################## -specialty_plots Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - advanced_hillshading - hinton_demo - topographic_hillshading diff --git a/_sources/examples/specialty_plots/topographic_hillshading.rst.txt b/_sources/examples/specialty_plots/topographic_hillshading.rst.txt deleted file mode 100644 index ebe95cbf81b..00000000000 --- a/_sources/examples/specialty_plots/topographic_hillshading.rst.txt +++ /dev/null @@ -1,84 +0,0 @@ -.. _specialty_plots-topographic_hillshading: - -specialty_plots example code: topographic_hillshading.py -======================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/specialty_plots/topographic_hillshading.py - -:: - - """ - Demonstrates the visual effect of varying blend mode and vertical exaggeration - on "hillshaded" plots. - - Note that the "overlay" and "soft" blend modes work well for complex surfaces - such as this example, while the default "hsv" blend mode works best for smooth - surfaces such as many mathematical functions. - - In most cases, hillshading is used purely for visual purposes, and *dx*/*dy* - can be safely ignored. In that case, you can tweak *vert_exag* (vertical - exaggeration) by trial and error to give the desired visual effect. However, - this example demonstrates how to use the *dx* and *dy* kwargs to ensure that - the *vert_exag* parameter is the true vertical exaggeration. - """ - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.cbook import get_sample_data - from matplotlib.colors import LightSource - - dem = np.load(get_sample_data('jacksboro_fault_dem.npz')) - z = dem['elevation'] - - #-- Optional dx and dy for accurate vertical exaggeration -------------------- - # If you need topographically accurate vertical exaggeration, or you don't want - # to guess at what *vert_exag* should be, you'll need to specify the cellsize - # of the grid (i.e. the *dx* and *dy* parameters). Otherwise, any *vert_exag* - # value you specify will be relative to the grid spacing of your input data - # (in other words, *dx* and *dy* default to 1.0, and *vert_exag* is calculated - # relative to those parameters). Similarly, *dx* and *dy* are assumed to be in - # the same units as your input z-values. Therefore, we'll need to convert the - # given dx and dy from decimal degrees to meters. - dx, dy = dem['dx'], dem['dy'] - dy = 111200 * dy - dx = 111200 * dx * np.cos(np.radians(dem['ymin'])) - #----------------------------------------------------------------------------- - - # Shade from the northwest, with the sun 45 degrees from horizontal - ls = LightSource(azdeg=315, altdeg=45) - cmap = plt.cm.gist_earth - - fig, axes = plt.subplots(nrows=4, ncols=3, figsize=(8, 9)) - plt.setp(axes.flat, xticks=[], yticks=[]) - - # Vary vertical exaggeration and blend mode and plot all combinations - for col, ve in zip(axes.T, [0.1, 1, 10]): - # Show the hillshade intensity image in the first row - col[0].imshow(ls.hillshade(z, vert_exag=ve, dx=dx, dy=dy), cmap='gray') - - # Place hillshaded plots with different blend modes in the rest of the rows - for ax, mode in zip(col[1:], ['hsv', 'overlay', 'soft']): - rgb = ls.shade(z, cmap=cmap, blend_mode=mode, - vert_exag=ve, dx=dx, dy=dy) - ax.imshow(rgb) - - # Label rows and columns - for ax, ve in zip(axes[0], [0.1, 1, 10]): - ax.set_title('{0}'.format(ve), size=18) - for ax, mode in zip(axes[:, 0], ['Hillshade', 'hsv', 'overlay', 'soft']): - ax.set_ylabel(mode, size=18) - - # Group labels... - axes[0, 1].annotate('Vertical Exaggeration', (0.5, 1), xytext=(0, 30), - textcoords='offset points', xycoords='axes fraction', - ha='center', va='bottom', size=20) - axes[2, 0].annotate('Blend Mode', (0, 0.5), xytext=(-30, 0), - textcoords='offset points', xycoords='axes fraction', - ha='right', va='center', size=20, rotation=90) - fig.subplots_adjust(bottom=0.05, right=0.95) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/specialty_plots/topographic_hillshading.txt b/_sources/examples/specialty_plots/topographic_hillshading.txt deleted file mode 100644 index 5dcdadf45c3..00000000000 --- a/_sources/examples/specialty_plots/topographic_hillshading.txt +++ /dev/null @@ -1,84 +0,0 @@ -.. _specialty_plots-topographic_hillshading: - -specialty_plots example code: topographic_hillshading.py -======================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/specialty_plots/topographic_hillshading.py - -:: - - """ - Demonstrates the visual effect of varying blend mode and vertical exaggeration - on "hillshaded" plots. - - Note that the "overlay" and "soft" blend modes work well for complex surfaces - such as this example, while the default "hsv" blend mode works best for smooth - surfaces such as many mathematical functions. - - In most cases, hillshading is used purely for visual purposes, and *dx*/*dy* - can be safely ignored. In that case, you can tweak *vert_exag* (vertical - exaggeration) by trial and error to give the desired visual effect. However, - this example demonstrates how to use the *dx* and *dy* kwargs to ensure that - the *vert_exag* parameter is the true vertical exaggeration. - """ - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.cbook import get_sample_data - from matplotlib.colors import LightSource - - dem = np.load(get_sample_data('jacksboro_fault_dem.npz')) - z = dem['elevation'] - - #-- Optional dx and dy for accurate vertical exaggeration -------------------- - # If you need topographically accurate vertical exaggeration, or you don't want - # to guess at what *vert_exag* should be, you'll need to specify the cellsize - # of the grid (i.e. the *dx* and *dy* parameters). Otherwise, any *vert_exag* - # value you specify will be realitive to the grid spacing of your input data - # (in other words, *dx* and *dy* default to 1.0, and *vert_exag* is calculated - # relative to those parameters). Similarly, *dx* and *dy* are assumed to be in - # the same units as your input z-values. Therefore, we'll need to convert the - # given dx and dy from decimal degrees to meters. - dx, dy = dem['dx'], dem['dy'] - dy = 111200 * dy - dx = 111200 * dx * np.cos(np.radians(dem['ymin'])) - #----------------------------------------------------------------------------- - - # Shade from the northwest, with the sun 45 degrees from horizontal - ls = LightSource(azdeg=315, altdeg=45) - cmap = plt.cm.gist_earth - - fig, axes = plt.subplots(nrows=4, ncols=3, figsize=(8, 9)) - plt.setp(axes.flat, xticks=[], yticks=[]) - - # Vary vertical exaggeration and blend mode and plot all combinations - for col, ve in zip(axes.T, [0.1, 1, 10]): - # Show the hillshade intensity image in the first row - col[0].imshow(ls.hillshade(z, vert_exag=ve, dx=dx, dy=dy), cmap='gray') - - # Place hillshaded plots with different blend modes in the rest of the rows - for ax, mode in zip(col[1:], ['hsv', 'overlay', 'soft']): - rgb = ls.shade(z, cmap=cmap, blend_mode=mode, - vert_exag=ve, dx=dx, dy=dy) - ax.imshow(rgb) - - # Label rows and columns - for ax, ve in zip(axes[0], [0.1, 1, 10]): - ax.set_title('{0}'.format(ve), size=18) - for ax, mode in zip(axes[:, 0], ['Hillshade', 'hsv', 'overlay', 'soft']): - ax.set_ylabel(mode, size=18) - - # Group labels... - axes[0, 1].annotate('Vertical Exaggeration', (0.5, 1), xytext=(0, 30), - textcoords='offset points', xycoords='axes fraction', - ha='center', va='bottom', size=20) - axes[2, 0].annotate('Blend Mode', (0, 0.5), xytext=(-30, 0), - textcoords='offset points', xycoords='axes fraction', - ha='right', va='center', size=20, rotation=90) - fig.subplots_adjust(bottom=0.05, right=0.95) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/boxplot_color_demo.rst.txt b/_sources/examples/statistics/boxplot_color_demo.rst.txt deleted file mode 100644 index 518dd6d9da2..00000000000 --- a/_sources/examples/statistics/boxplot_color_demo.rst.txt +++ /dev/null @@ -1,67 +0,0 @@ -.. _statistics-boxplot_color_demo: - -statistics example code: boxplot_color_demo.py -============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/statistics/boxplot_color_demo.py - -:: - - """ - ================================= - Box plots with custom fill colors - ================================= - - This plot illustrates how to create two types of box plots - (rectangular and notched), and how to fill them with custom - colors by accessing the properties of the artists of the - box plots. Additionally, the ``labels`` parameter is used to - provide x-tick labels for each sample. - - A good general reference on boxplots and their history can be found - here: http://vita.had.co.nz/papers/boxplots.pdf - """ - - import matplotlib.pyplot as plt - import numpy as np - - # Random test data - np.random.seed(123) - all_data = [np.random.normal(0, std, 100) for std in range(1, 4)] - - fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(9, 4)) - - # rectangular box plot - bplot1 = axes[0].boxplot(all_data, - vert=True, # vertical box aligmnent - patch_artist=True) # fill with color - - # notch shape box plot - bplot2 = axes[1].boxplot(all_data, - notch=True, # notch shape - vert=True, # vertical box aligmnent - patch_artist=True) # fill with color - - # fill with colors - colors = ['pink', 'lightblue', 'lightgreen'] - for bplot in (bplot1, bplot2): - for patch, color in zip(bplot['boxes'], colors): - patch.set_facecolor(color) - - # adding horizontal grid lines - for ax in axes: - ax.yaxis.grid(True) - ax.set_xticks([y+1 for y in range(len(all_data))], ) - ax.set_xlabel('xlabel') - ax.set_ylabel('ylabel') - - # add x-tick labels - plt.setp(axes, xticks=[y+1 for y in range(len(all_data))], - xticklabels=['x1', 'x2', 'x3', 'x4']) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/boxplot_color_demo.txt b/_sources/examples/statistics/boxplot_color_demo.txt deleted file mode 100644 index bd0f83181b1..00000000000 --- a/_sources/examples/statistics/boxplot_color_demo.txt +++ /dev/null @@ -1,54 +0,0 @@ -.. _statistics-boxplot_color_demo: - -statistics example code: boxplot_color_demo.py -============================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/statistics/boxplot_color_demo.py - -:: - - # Box plots with custom fill colors - - import matplotlib.pyplot as plt - import numpy as np - - # Random test data - np.random.seed(123) - all_data = [np.random.normal(0, std, 100) for std in range(1, 4)] - - fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(12, 5)) - - # rectangular box plot - bplot1 = axes[0].boxplot(all_data, - vert=True, # vertical box aligmnent - patch_artist=True) # fill with color - - # notch shape box plot - bplot2 = axes[1].boxplot(all_data, - notch=True, # notch shape - vert=True, # vertical box aligmnent - patch_artist=True) # fill with color - - # fill with colors - colors = ['pink', 'lightblue', 'lightgreen'] - for bplot in (bplot1, bplot2): - for patch, color in zip(bplot['boxes'], colors): - patch.set_facecolor(color) - - # adding horizontal grid lines - for ax in axes: - ax.yaxis.grid(True) - ax.set_xticks([y+1 for y in range(len(all_data))], ) - ax.set_xlabel('xlabel') - ax.set_ylabel('ylabel') - - # add x-tick labels - plt.setp(axes, xticks=[y+1 for y in range(len(all_data))], - xticklabels=['x1', 'x2', 'x3', 'x4']) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/boxplot_demo.rst.txt b/_sources/examples/statistics/boxplot_demo.rst.txt deleted file mode 100644 index 0cdc38d424e..00000000000 --- a/_sources/examples/statistics/boxplot_demo.rst.txt +++ /dev/null @@ -1,107 +0,0 @@ -.. _statistics-boxplot_demo: - -statistics example code: boxplot_demo.py -======================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/statistics/boxplot_demo.py - -:: - - """ - ========================================= - Demo of artist customization in box plots - ========================================= - - This example demonstrates how to use the various kwargs - to fully customize box plots. The first figure demonstrates - how to remove and add individual components (note that the - mean is the only value not shown by default). The second - figure demonstrates how the styles of the artists can - be customized. It also demonstrates how to set the limit - of the whiskers to specific percentiles (lower right axes) - - A good general reference on boxplots and their history can be found - here: http://vita.had.co.nz/papers/boxplots.pdf - - """ - - import numpy as np - import matplotlib.pyplot as plt - - # fake data - np.random.seed(937) - data = np.random.lognormal(size=(37, 4), mean=1.5, sigma=1.75) - labels = list('ABCD') - fs = 10 # fontsize - - # demonstrate how to toggle the display of different elements: - fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(6, 6), sharey=True) - axes[0, 0].boxplot(data, labels=labels) - axes[0, 0].set_title('Default', fontsize=fs) - - axes[0, 1].boxplot(data, labels=labels, showmeans=True) - axes[0, 1].set_title('showmeans=True', fontsize=fs) - - axes[0, 2].boxplot(data, labels=labels, showmeans=True, meanline=True) - axes[0, 2].set_title('showmeans=True,\nmeanline=True', fontsize=fs) - - axes[1, 0].boxplot(data, labels=labels, showbox=False, showcaps=False) - tufte_title = 'Tufte Style \n(showbox=False,\nshowcaps=False)' - axes[1, 0].set_title(tufte_title, fontsize=fs) - - axes[1, 1].boxplot(data, labels=labels, notch=True, bootstrap=10000) - axes[1, 1].set_title('notch=True,\nbootstrap=10000', fontsize=fs) - - axes[1, 2].boxplot(data, labels=labels, showfliers=False) - axes[1, 2].set_title('showfliers=False', fontsize=fs) - - for ax in axes.flatten(): - ax.set_yscale('log') - ax.set_yticklabels([]) - - fig.subplots_adjust(hspace=0.4) - plt.show() - - - # demonstrate how to customize the display different elements: - boxprops = dict(linestyle='--', linewidth=3, color='darkgoldenrod') - flierprops = dict(marker='o', markerfacecolor='green', markersize=12, - linestyle='none') - medianprops = dict(linestyle='-.', linewidth=2.5, color='firebrick') - meanpointprops = dict(marker='D', markeredgecolor='black', - markerfacecolor='firebrick') - meanlineprops = dict(linestyle='--', linewidth=2.5, color='purple') - - fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(6, 6), sharey=True) - axes[0, 0].boxplot(data, boxprops=boxprops) - axes[0, 0].set_title('Custom boxprops', fontsize=fs) - - axes[0, 1].boxplot(data, flierprops=flierprops, medianprops=medianprops) - axes[0, 1].set_title('Custom medianprops\nand flierprops', fontsize=fs) - - axes[0, 2].boxplot(data, whis='range') - axes[0, 2].set_title('whis="range"', fontsize=fs) - - axes[1, 0].boxplot(data, meanprops=meanpointprops, meanline=False, - showmeans=True) - axes[1, 0].set_title('Custom mean\nas point', fontsize=fs) - - axes[1, 1].boxplot(data, meanprops=meanlineprops, meanline=True, - showmeans=True) - axes[1, 1].set_title('Custom mean\nas line', fontsize=fs) - - axes[1, 2].boxplot(data, whis=[15, 85]) - axes[1, 2].set_title('whis=[15, 85]\n#percentiles', fontsize=fs) - - for ax in axes.flatten(): - ax.set_yscale('log') - ax.set_yticklabels([]) - - fig.suptitle("I never said they'd be pretty") - fig.subplots_adjust(hspace=0.4) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/boxplot_demo.txt b/_sources/examples/statistics/boxplot_demo.txt deleted file mode 100644 index c25e1ed781f..00000000000 --- a/_sources/examples/statistics/boxplot_demo.txt +++ /dev/null @@ -1,91 +0,0 @@ -.. _statistics-boxplot_demo: - -statistics example code: boxplot_demo.py -======================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/statistics/boxplot_demo.py - -:: - - """ - Demo of the new boxplot functionality - """ - - import numpy as np - import matplotlib.pyplot as plt - - # fake data - np.random.seed(937) - data = np.random.lognormal(size=(37, 4), mean=1.5, sigma=1.75) - labels = list('ABCD') - fs = 10 # fontsize - - # demonstrate how to toggle the display of different elements: - fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(6, 6)) - axes[0, 0].boxplot(data, labels=labels) - axes[0, 0].set_title('Default', fontsize=fs) - - axes[0, 1].boxplot(data, labels=labels, showmeans=True) - axes[0, 1].set_title('showmeans=True', fontsize=fs) - - axes[0, 2].boxplot(data, labels=labels, showmeans=True, meanline=True) - axes[0, 2].set_title('showmeans=True,\nmeanline=True', fontsize=fs) - - axes[1, 0].boxplot(data, labels=labels, showbox=False, showcaps=False) - axes[1, 0].set_title('Tufte Style \n(showbox=False,\nshowcaps=False)', fontsize=fs) - - axes[1, 1].boxplot(data, labels=labels, notch=True, bootstrap=10000) - axes[1, 1].set_title('notch=True,\nbootstrap=10000', fontsize=fs) - - axes[1, 2].boxplot(data, labels=labels, showfliers=False) - axes[1, 2].set_title('showfliers=False', fontsize=fs) - - for ax in axes.flatten(): - ax.set_yscale('log') - ax.set_yticklabels([]) - - fig.subplots_adjust(hspace=0.4) - plt.show() - - - # demonstrate how to customize the display different elements: - boxprops = dict(linestyle='--', linewidth=3, color='darkgoldenrod') - flierprops = dict(marker='o', markerfacecolor='green', markersize=12, - linestyle='none') - medianprops = dict(linestyle='-.', linewidth=2.5, color='firebrick') - meanpointprops = dict(marker='D', markeredgecolor='black', - markerfacecolor='firebrick') - meanlineprops = dict(linestyle='--', linewidth=2.5, color='purple') - - fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(6, 6)) - axes[0, 0].boxplot(data, boxprops=boxprops) - axes[0, 0].set_title('Custom boxprops', fontsize=fs) - - axes[0, 1].boxplot(data, flierprops=flierprops, medianprops=medianprops) - axes[0, 1].set_title('Custom medianprops\nand flierprops', fontsize=fs) - - axes[0, 2].boxplot(data, whis='range') - axes[0, 2].set_title('whis="range"', fontsize=fs) - - axes[1, 0].boxplot(data, meanprops=meanpointprops, meanline=False, - showmeans=True) - axes[1, 0].set_title('Custom mean\nas point', fontsize=fs) - - axes[1, 1].boxplot(data, meanprops=meanlineprops, meanline=True, showmeans=True) - axes[1, 1].set_title('Custom mean\nas line', fontsize=fs) - - axes[1, 2].boxplot(data, whis=[15, 85]) - axes[1, 2].set_title('whis=[15, 85]\n#percentiles', fontsize=fs) - - for ax in axes.flatten(): - ax.set_yscale('log') - ax.set_yticklabels([]) - - fig.suptitle("I never said they'd be pretty") - fig.subplots_adjust(hspace=0.4) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/boxplot_vs_violin_demo.rst.txt b/_sources/examples/statistics/boxplot_vs_violin_demo.rst.txt deleted file mode 100644 index 8a9a0ad7319..00000000000 --- a/_sources/examples/statistics/boxplot_vs_violin_demo.rst.txt +++ /dev/null @@ -1,65 +0,0 @@ -.. _statistics-boxplot_vs_violin_demo: - -statistics example code: boxplot_vs_violin_demo.py -================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/statistics/boxplot_vs_violin_demo.py - -:: - - """ - =================================== - Box plot vs. violin plot comparison - =================================== - - Note that although violin plots are closely related to Tukey's (1977) - box plots, they add useful information such as the distribution of the - sample data (density trace). - - By default, box plots show data points outside 1.5 * the inter-quartile - range as outliers above or below the whiskers whereas violin plots show - the whole range of the data. - - A good general reference on boxplots and their history can be found - here: http://vita.had.co.nz/papers/boxplots.pdf - - Violin plots require matplotlib >= 1.4. - - For more information on violin plots, the scikit-learn docs have a great - section: http://scikit-learn.org/stable/modules/density.html - """ - - import matplotlib.pyplot as plt - import numpy as np - - fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(9, 4)) - - # generate some random test data - all_data = [np.random.normal(0, std, 100) for std in range(6, 10)] - - # plot violin plot - axes[0].violinplot(all_data, - showmeans=False, - showmedians=True) - axes[0].set_title('violin plot') - - # plot box plot - axes[1].boxplot(all_data) - axes[1].set_title('box plot') - - # adding horizontal grid lines - for ax in axes: - ax.yaxis.grid(True) - ax.set_xticks([y+1 for y in range(len(all_data))]) - ax.set_xlabel('xlabel') - ax.set_ylabel('ylabel') - - # add x-tick labels - plt.setp(axes, xticks=[y+1 for y in range(len(all_data))], - xticklabels=['x1', 'x2', 'x3', 'x4']) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/boxplot_vs_violin_demo.txt b/_sources/examples/statistics/boxplot_vs_violin_demo.txt deleted file mode 100644 index 65567ee31ab..00000000000 --- a/_sources/examples/statistics/boxplot_vs_violin_demo.txt +++ /dev/null @@ -1,53 +0,0 @@ -.. _statistics-boxplot_vs_violin_demo: - -statistics example code: boxplot_vs_violin_demo.py -================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/statistics/boxplot_vs_violin_demo.py - -:: - - # Box plot - violin plot comparison - # - # Note that although violin plots are closely related to Tukey's (1977) box plots, - # they add useful information such as the distribution of the sample data (density trace). - # - # By default, box plots show data points outside 1.5 x the inter-quartile range as outliers - # above or below the whiskers wheras violin plots show the whole range of the data. - # - # Violin plots require matplotlib >= 1.4. - - import matplotlib.pyplot as plt - import numpy as np - - fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(12, 5)) - - # generate some random test data - all_data = [np.random.normal(0, std, 100) for std in range(6, 10)] - - # plot violin plot - axes[0].violinplot(all_data, - showmeans=False, - showmedians=True) - axes[0].set_title('violin plot') - - # plot box plot - axes[1].boxplot(all_data) - axes[1].set_title('box plot') - - # adding horizontal grid lines - for ax in axes: - ax.yaxis.grid(True) - ax.set_xticks([y+1 for y in range(len(all_data))]) - ax.set_xlabel('xlabel') - ax.set_ylabel('ylabel') - - # add x-tick labels - plt.setp(axes, xticks=[y+1 for y in range(len(all_data))], - xticklabels=['x1', 'x2', 'x3', 'x4']) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/bxp_demo.rst.txt b/_sources/examples/statistics/bxp_demo.rst.txt deleted file mode 100644 index 260dc02a19f..00000000000 --- a/_sources/examples/statistics/bxp_demo.rst.txt +++ /dev/null @@ -1,111 +0,0 @@ -.. _statistics-bxp_demo: - -statistics example code: bxp_demo.py -==================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/statistics/bxp_demo.py - -:: - - """ - =================================== - Demo of the boxplot drawer function - =================================== - - This example demonstrates how to pass pre-computed box plot - statistics to the box plot drawer. The first figure demonstrates - how to remove and add individual components (note that the - mean is the only value not shown by default). The second - figure demonstrates how the styles of the artists can - be customized. - - A good general reference on boxplots and their history can be found - here: http://vita.had.co.nz/papers/boxplots.pdf - """ - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.cbook as cbook - - # fake data - np.random.seed(937) - data = np.random.lognormal(size=(37, 4), mean=1.5, sigma=1.75) - labels = list('ABCD') - - # compute the boxplot stats - stats = cbook.boxplot_stats(data, labels=labels, bootstrap=10000) - # After we've computed the stats, we can go through and change anything. - # Just to prove it, I'll set the median of each set to the median of all - # the data, and double the means - for n in range(len(stats)): - stats[n]['med'] = np.median(data) - stats[n]['mean'] *= 2 - - print(stats[0].keys()) - - fs = 10 # fontsize - - # demonstrate how to toggle the display of different elements: - fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(6, 6), sharey=True) - axes[0, 0].bxp(stats) - axes[0, 0].set_title('Default', fontsize=fs) - - axes[0, 1].bxp(stats, showmeans=True) - axes[0, 1].set_title('showmeans=True', fontsize=fs) - - axes[0, 2].bxp(stats, showmeans=True, meanline=True) - axes[0, 2].set_title('showmeans=True,\nmeanline=True', fontsize=fs) - - axes[1, 0].bxp(stats, showbox=False, showcaps=False) - tufte_title = 'Tufte Style\n(showbox=False,\nshowcaps=False)' - axes[1, 0].set_title(tufte_title, fontsize=fs) - - axes[1, 1].bxp(stats, shownotches=True) - axes[1, 1].set_title('notch=True', fontsize=fs) - - axes[1, 2].bxp(stats, showfliers=False) - axes[1, 2].set_title('showfliers=False', fontsize=fs) - - for ax in axes.flatten(): - ax.set_yscale('log') - ax.set_yticklabels([]) - - fig.subplots_adjust(hspace=0.4) - plt.show() - - # demonstrate how to customize the display different elements: - boxprops = dict(linestyle='--', linewidth=3, color='darkgoldenrod') - flierprops = dict(marker='o', markerfacecolor='green', markersize=12, - linestyle='none') - medianprops = dict(linestyle='-.', linewidth=2.5, color='firebrick') - meanpointprops = dict(marker='D', markeredgecolor='black', - markerfacecolor='firebrick') - meanlineprops = dict(linestyle='--', linewidth=2.5, color='purple') - - fig, axes = plt.subplots(nrows=2, ncols=2, figsize=(6, 6), sharey=True) - axes[0, 0].bxp(stats, boxprops=boxprops) - axes[0, 0].set_title('Custom boxprops', fontsize=fs) - - axes[0, 1].bxp(stats, flierprops=flierprops, medianprops=medianprops) - axes[0, 1].set_title('Custom medianprops\nand flierprops', fontsize=fs) - - axes[1, 0].bxp(stats, meanprops=meanpointprops, meanline=False, - showmeans=True) - axes[1, 0].set_title('Custom mean\nas point', fontsize=fs) - - axes[1, 1].bxp(stats, meanprops=meanlineprops, meanline=True, - showmeans=True) - axes[1, 1].set_title('Custom mean\nas line', fontsize=fs) - - for ax in axes.flatten(): - ax.set_yscale('log') - ax.set_yticklabels([]) - - fig.suptitle("I never said they'd be pretty") - fig.subplots_adjust(hspace=0.4) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/bxp_demo.txt b/_sources/examples/statistics/bxp_demo.txt deleted file mode 100644 index 5797d198e7a..00000000000 --- a/_sources/examples/statistics/bxp_demo.txt +++ /dev/null @@ -1,97 +0,0 @@ -.. _statistics-bxp_demo: - -statistics example code: bxp_demo.py -==================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/statistics/bxp_demo.py - -:: - - """ - Demo of the new boxplot drawer function - """ - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.cbook as cbook - - # fake data - np.random.seed(937) - data = np.random.lognormal(size=(37, 4), mean=1.5, sigma=1.75) - labels = list('ABCD') - - # compute the boxplot stats - stats = cbook.boxplot_stats(data, labels=labels, bootstrap=10000) - # After we've computed the stats, we can go through and change anything. - # Just to prove it, I'll set the median of each set to the median of all - # the data, and double the means - for n in range(len(stats)): - stats[n]['med'] = np.median(data) - stats[n]['mean'] *= 2 - - print(stats[0].keys()) - fs = 10 # fontsize - - # demonstrate how to toggle the display of different elements: - fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(6, 6)) - axes[0, 0].bxp(stats) - axes[0, 0].set_title('Default', fontsize=fs) - - axes[0, 1].bxp(stats, showmeans=True) - axes[0, 1].set_title('showmeans=True', fontsize=fs) - - axes[0, 2].bxp(stats, showmeans=True, meanline=True) - axes[0, 2].set_title('showmeans=True,\nmeanline=True', fontsize=fs) - - axes[1, 0].bxp(stats, showbox=False, showcaps=False) - axes[1, 0].set_title('Tufte Style\n(showbox=False,\nshowcaps=False)', fontsize=fs) - - axes[1, 1].bxp(stats, shownotches=True) - axes[1, 1].set_title('notch=True', fontsize=fs) - - axes[1, 2].bxp(stats, showfliers=False) - axes[1, 2].set_title('showfliers=False', fontsize=fs) - - for ax in axes.flatten(): - ax.set_yscale('log') - ax.set_yticklabels([]) - - fig.subplots_adjust(hspace=0.4) - plt.show() - - - # demonstrate how to customize the display different elements: - boxprops = dict(linestyle='--', linewidth=3, color='darkgoldenrod') - flierprops = dict(marker='o', markerfacecolor='green', markersize=12, - linestyle='none') - medianprops = dict(linestyle='-.', linewidth=2.5, color='firebrick') - meanpointprops = dict(marker='D', markeredgecolor='black', - markerfacecolor='firebrick') - meanlineprops = dict(linestyle='--', linewidth=2.5, color='purple') - - fig, axes = plt.subplots(nrows=2, ncols=2, figsize=(6, 6)) - axes[0, 0].bxp(stats, boxprops=boxprops) - axes[0, 0].set_title('Custom boxprops', fontsize=fs) - - axes[0, 1].bxp(stats, flierprops=flierprops, medianprops=medianprops) - axes[0, 1].set_title('Custom medianprops\nand flierprops', fontsize=fs) - - axes[1, 0].bxp(stats, meanprops=meanpointprops, meanline=False, - showmeans=True) - axes[1, 0].set_title('Custom mean\nas point', fontsize=fs) - - axes[1, 1].bxp(stats, meanprops=meanlineprops, meanline=True, showmeans=True) - axes[1, 1].set_title('Custom mean\nas line', fontsize=fs) - - for ax in axes.flatten(): - ax.set_yscale('log') - ax.set_yticklabels([]) - - fig.suptitle("I never said they'd be pretty") - fig.subplots_adjust(hspace=0.4) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/customized_violin_demo.rst.txt b/_sources/examples/statistics/customized_violin_demo.rst.txt deleted file mode 100644 index 6c374e33f3a..00000000000 --- a/_sources/examples/statistics/customized_violin_demo.rst.txt +++ /dev/null @@ -1,90 +0,0 @@ -.. _statistics-customized_violin_demo: - -statistics example code: customized_violin_demo.py -================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/statistics/customized_violin_demo.py - -:: - - """ - ================================= - Demo of violin plot customization - ================================= - - This example demonstrates how to fully customize violin plots. - The first plot shows the default style by providing only - the data. The second plot first limits what matplotlib draws - with additional kwargs. Then a simplified representation of - a box plot is drawn on top. Lastly, the styles of the artists - of the violins are modified. - - For more information on violin plots, the scikit-learn docs have a great - section: http://scikit-learn.org/stable/modules/density.html - """ - - import matplotlib.pyplot as plt - import numpy as np - - - def adjacent_values(vals, q1, q3): - upper_adjacent_value = q3 + (q3 - q1) * 1.5 - upper_adjacent_value = np.clip(upper_adjacent_value, q3, vals[-1]) - - lower_adjacent_value = q1 - (q3 - q1) * 1.5 - lower_adjacent_value = np.clip(lower_adjacent_value, vals[0], q1) - return lower_adjacent_value, upper_adjacent_value - - - def set_axis_style(ax, labels): - ax.get_xaxis().set_tick_params(direction='out') - ax.xaxis.set_ticks_position('bottom') - ax.set_xticks(np.arange(1, len(labels) + 1)) - ax.set_xticklabels(labels) - ax.set_xlim(0.25, len(labels) + 0.75) - ax.set_xlabel('Sample name') - - - # create test data - np.random.seed(123) - data = [sorted(np.random.normal(0, std, 100)) for std in range(1, 5)] - - fig, (ax1, ax2) = plt.subplots(nrows=1, ncols=2, figsize=(9, 4), sharey=True) - - ax1.set_title('Default violin plot') - ax1.set_ylabel('Observed values') - ax1.violinplot(data) - - ax2.set_title('Customized violin plot') - parts = ax2.violinplot( - data, showmeans=False, showmedians=False, - showextrema=False) - - for pc in parts['bodies']: - pc.set_facecolor('#D43F3A') - pc.set_edgecolor('black') - pc.set_alpha(1) - - quartile1, medians, quartile3 = np.percentile(data, [25, 50, 75], axis=1) - whiskers = np.array([ - adjacent_values(sorted_array, q1, q3) - for sorted_array, q1, q3 in zip(data, quartile1, quartile3)]) - whiskersMin, whiskersMax = whiskers[:, 0], whiskers[:, 1] - - inds = np.arange(1, len(medians) + 1) - ax2.scatter(inds, medians, marker='o', color='white', s=30, zorder=3) - ax2.vlines(inds, quartile1, quartile3, color='k', linestyle='-', lw=5) - ax2.vlines(inds, whiskersMin, whiskersMax, color='k', linestyle='-', lw=1) - - # set style for the axes - labels = ['A', 'B', 'C', 'D'] - for ax in [ax1, ax2]: - set_axis_style(ax, labels) - - plt.subplots_adjust(bottom=0.15, wspace=0.05) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/errorbar_demo.rst.txt b/_sources/examples/statistics/errorbar_demo.rst.txt deleted file mode 100644 index 56dda1132c5..00000000000 --- a/_sources/examples/statistics/errorbar_demo.rst.txt +++ /dev/null @@ -1,34 +0,0 @@ -.. _statistics-errorbar_demo: - -statistics example code: errorbar_demo.py -========================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/statistics/errorbar_demo.py - -:: - - """ - ============================= - Demo of the errorbar function - ============================= - - This exhibits the most basic use of the error bar method. - In this case, constant values are provided for the error - in both the x- and y-directions. - """ - - import numpy as np - import matplotlib.pyplot as plt - - # example data - x = np.arange(0.1, 4, 0.5) - y = np.exp(-x) - - fig, ax = plt.subplots() - ax.errorbar(x, y, xerr=0.2, yerr=0.4) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/errorbar_demo.txt b/_sources/examples/statistics/errorbar_demo.txt deleted file mode 100644 index 2b9c08422b0..00000000000 --- a/_sources/examples/statistics/errorbar_demo.txt +++ /dev/null @@ -1,26 +0,0 @@ -.. _statistics-errorbar_demo: - -statistics example code: errorbar_demo.py -========================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/statistics/errorbar_demo.py - -:: - - """ - Demo of the errorbar function. - """ - import numpy as np - import matplotlib.pyplot as plt - - # example data - x = np.arange(0.1, 4, 0.5) - y = np.exp(-x) - - plt.errorbar(x, y, xerr=0.2, yerr=0.4) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/errorbar_demo_features.rst.txt b/_sources/examples/statistics/errorbar_demo_features.rst.txt deleted file mode 100644 index b13d6b11602..00000000000 --- a/_sources/examples/statistics/errorbar_demo_features.rst.txt +++ /dev/null @@ -1,61 +0,0 @@ -.. _statistics-errorbar_demo_features: - -statistics example code: errorbar_demo_features.py -================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/statistics/errorbar_demo_features.py - -:: - - """ - =================================================== - Demo of the different ways of specifying error bars - =================================================== - - Errors can be specified as a constant value (as shown in - `errorbar_demo.py`). However, this example demonstrates - how they vary by specifying arrays of error values. - - If the raw ``x`` and ``y`` data have length N, there are two options: - - Array of shape (N,): - Error varies for each point, but the error values are - symmetric (i.e. the lower and upper values are equal). - - Array of shape (2, N): - Error varies for each point, and the lower and upper limits - (in that order) are different (asymmetric case) - - In addition, this example demonstrates how to use log - scale with error bars. - """ - - import numpy as np - import matplotlib.pyplot as plt - - # example data - x = np.arange(0.1, 4, 0.5) - y = np.exp(-x) - - # example error bar values that vary with x-position - error = 0.1 + 0.2 * x - - fig, (ax0, ax1) = plt.subplots(nrows=2, sharex=True) - ax0.errorbar(x, y, yerr=error, fmt='-o') - ax0.set_title('variable, symmetric error') - - # error bar values w/ different -/+ errors that - # also vary with the x-position - lower_error = 0.4 * error - upper_error = error - asymmetric_error = [lower_error, upper_error] - - ax1.errorbar(x, y, xerr=asymmetric_error, fmt='o') - ax1.set_title('variable, asymmetric error') - ax1.set_yscale('log') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/errorbar_demo_features.txt b/_sources/examples/statistics/errorbar_demo_features.txt deleted file mode 100644 index ead10ae55b9..00000000000 --- a/_sources/examples/statistics/errorbar_demo_features.txt +++ /dev/null @@ -1,52 +0,0 @@ -.. _statistics-errorbar_demo_features: - -statistics example code: errorbar_demo_features.py -================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/statistics/errorbar_demo_features.py - -:: - - """ - Demo of errorbar function with different ways of specifying error bars. - - Errors can be specified as a constant value (as shown in `errorbar_demo.py`), - or as demonstrated in this example, they can be specified by an N x 1 or 2 x N, - where N is the number of data points. - - N x 1: - Error varies for each point, but the error values are symmetric (i.e. the - lower and upper values are equal). - - 2 x N: - Error varies for each point, and the lower and upper limits (in that order) - are different (asymmetric case) - - In addition, this example demonstrates how to use log scale with errorbar. - """ - import numpy as np - import matplotlib.pyplot as plt - - # example data - x = np.arange(0.1, 4, 0.5) - y = np.exp(-x) - # example error bar values that vary with x-position - error = 0.1 + 0.2 * x - # error bar values w/ different -/+ errors - lower_error = 0.4 * error - upper_error = error - asymmetric_error = [lower_error, upper_error] - - fig, (ax0, ax1) = plt.subplots(nrows=2, sharex=True) - ax0.errorbar(x, y, yerr=error, fmt='-o') - ax0.set_title('variable, symmetric error') - - ax1.errorbar(x, y, xerr=asymmetric_error, fmt='o') - ax1.set_title('variable, asymmetric error') - ax1.set_yscale('log') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/errorbar_limits.rst.txt b/_sources/examples/statistics/errorbar_limits.rst.txt deleted file mode 100644 index e6615c0ccb4..00000000000 --- a/_sources/examples/statistics/errorbar_limits.rst.txt +++ /dev/null @@ -1,90 +0,0 @@ -.. _statistics-errorbar_limits: - -statistics example code: errorbar_limits.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/statistics/errorbar_limits.py - -:: - - """ - =========================================================== - Demo of how to include upper and lower limits in error bars - =========================================================== - - In matplotlib, errors bars can have "limits". Applying limits to the - error bars essentially makes the error unidirectional. Because of that, - upper and lower limits can be applied in both the y- and x-directions - via the ``uplims``, ``lolims``, ``xuplims``, and ``xlolims`` parameters, - respectively. These parameters can be scalar or boolean arrays. - - For example, if ``xlolims`` is ``True``, the x-error bars will only - extend from the data towards increasing values. If ``uplims`` is an - array filled with ``False`` except for the 4th and 7th values, all of the - y-error bars will be bidirectional, except the 4th and 7th bars, which - will extend from the data towards decreasing y-values. - """ - - import numpy as np - import matplotlib.pyplot as plt - - # example data - x = np.array([0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0]) - y = np.exp(-x) - xerr = 0.1 - yerr = 0.2 - - # lower & upper limits of the error - lolims = np.array([0, 0, 1, 0, 1, 0, 0, 0, 1, 0], dtype=bool) - uplims = np.array([0, 1, 0, 0, 0, 1, 0, 0, 0, 1], dtype=bool) - ls = 'dotted' - - fig, ax = plt.subplots(figsize=(7, 4)) - - # standard error bars - ax.errorbar(x, y, xerr=xerr, yerr=yerr, linestyle=ls) - - # including upper limits - ax.errorbar(x, y + 0.5, xerr=xerr, yerr=yerr, uplims=uplims, - linestyle=ls) - - # including lower limits - ax.errorbar(x, y + 1.0, xerr=xerr, yerr=yerr, lolims=lolims, - linestyle=ls) - - # including upper and lower limits - ax.errorbar(x, y + 1.5, xerr=xerr, yerr=yerr, - lolims=lolims, uplims=uplims, - marker='o', markersize=8, - linestyle=ls) - - # Plot a series with lower and upper limits in both x & y - # constant x-error with varying y-error - xerr = 0.2 - yerr = np.zeros(x.shape) + 0.2 - yerr[[3, 6]] = 0.3 - - # mock up some limits by modifying previous data - xlolims = lolims - xuplims = uplims - lolims = np.zeros(x.shape) - uplims = np.zeros(x.shape) - lolims[[6]] = True # only limited at this index - uplims[[3]] = True # only limited at this index - - # do the plotting - ax.errorbar(x, y + 2.1, xerr=xerr, yerr=yerr, - xlolims=xlolims, xuplims=xuplims, - uplims=uplims, lolims=lolims, - marker='o', markersize=8, - linestyle='none') - - # tidy up the figure - ax.set_xlim((0, 5.5)) - ax.set_title('Errorbar upper and lower limits') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/errorbar_limits.txt b/_sources/examples/statistics/errorbar_limits.txt deleted file mode 100644 index 35320dbb44e..00000000000 --- a/_sources/examples/statistics/errorbar_limits.txt +++ /dev/null @@ -1,66 +0,0 @@ -.. _statistics-errorbar_limits: - -statistics example code: errorbar_limits.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/statistics/errorbar_limits.py - -:: - - """ - Demo of the errorbar function, including upper and lower limits - """ - import numpy as np - import matplotlib.pyplot as plt - - # example data - x = np.arange(0.5, 5.5, 0.5) - y = np.exp(-x) - xerr = 0.1 - yerr = 0.2 - ls = 'dotted' - - fig = plt.figure() - ax = fig.add_subplot(1, 1, 1) - - # standard error bars - plt.errorbar(x, y, xerr=xerr, yerr=yerr, ls=ls, color='blue') - - # including upper limits - uplims = np.zeros(x.shape) - uplims[[1, 5, 9]] = True - plt.errorbar(x, y + 0.5, xerr=xerr, yerr=yerr, uplims=uplims, ls=ls, - color='green') - - # including lower limits - lolims = np.zeros(x.shape) - lolims[[2, 4, 8]] = True - plt.errorbar(x, y + 1.0, xerr=xerr, yerr=yerr, lolims=lolims, ls=ls, - color='red') - - # including upper and lower limits - plt.errorbar(x, y + 1.5, marker='o', ms=8, xerr=xerr, yerr=yerr, - lolims=lolims, uplims=uplims, ls=ls, color='magenta') - - # including xlower and xupper limits - xerr = 0.2 - yerr = np.zeros(x.shape) + 0.2 - yerr[[3, 6]] = 0.3 - xlolims = lolims - xuplims = uplims - lolims = np.zeros(x.shape) - uplims = np.zeros(x.shape) - lolims[[6]] = True - uplims[[3]] = True - plt.errorbar(x, y + 2.1, marker='o', ms=8, xerr=xerr, yerr=yerr, - xlolims=xlolims, xuplims=xuplims, uplims=uplims, lolims=lolims, - ls='none', mec='blue', capsize=0, color='cyan') - - ax.set_xlim((0, 5.5)) - ax.set_title('Errorbar upper and lower limits') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/errorbars_and_boxes.rst.txt b/_sources/examples/statistics/errorbars_and_boxes.rst.txt deleted file mode 100644 index f96963e5af7..00000000000 --- a/_sources/examples/statistics/errorbars_and_boxes.rst.txt +++ /dev/null @@ -1,87 +0,0 @@ -.. _statistics-errorbars_and_boxes: - -statistics example code: errorbars_and_boxes.py -=============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/statistics/errorbars_and_boxes.py - -:: - - """ - ============================================================ - Demo on creating boxes from error bars using PatchCollection - ============================================================ - - In this example, we snazz up a pretty standard error bar plot by adding - a rectangle patch defined by the limits of the bars in both the x- and - y- directions. To do this, we have to write our own custom function - called ``make_error_boxes``. Close inspection of this function will - reveal the preferred pattern in writing functions for matplotlib: - - 1. an ``Axes`` object is passed directly to the function - 2. the function operates on the `Axes` methods directly, not through - the ``pyplot`` interface - 3. plotting kwargs that could be abbreviated are spelled out for - better code readability in the future (for example we use - ``facecolor`` instead of ``fc``) - 4. the artists returned by the ``Axes`` plotting methods are then - returned by the function so that, if desired, their styles - can be modified later outside of the function (they are not - modified in this example). - """ - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.collections import PatchCollection - from matplotlib.patches import Rectangle - - # Number of data points - n = 5 - - # Dummy data - np.random.seed(10) - x = np.arange(0, n, 1) - y = np.random.rand(n) * 5. - - # Dummy errors (above and below) - xerr = np.random.rand(2, n) + 0.1 - yerr = np.random.rand(2, n) + 0.2 - - - def make_error_boxes(ax, xdata, ydata, xerror, yerror, facecolor='r', - edgecolor='None', alpha=0.5): - - # Create list for all the error patches - errorboxes = [] - - # Loop over data points; create box from errors at each point - for x, y, xe, ye in zip(xdata, ydata, xerror.T, yerror.T): - rect = Rectangle((x - xe[0], y - ye[0]), xe.sum(), ye.sum()) - errorboxes.append(rect) - - # Create patch collection with specified colour/alpha - pc = PatchCollection(errorboxes, facecolor=facecolor, alpha=alpha, - edgecolor=edgecolor) - - # Add collection to axes - ax.add_collection(pc) - - # Plot errorbars - artists = ax.errorbar(xdata, ydata, xerr=xerror, yerr=yerror, - fmt='None', ecolor='k') - - return artists - - - # Create figure and axes - fig, ax = plt.subplots(1) - - # Call function to create error boxes - _ = make_error_boxes(ax, x, y, xerr, yerr) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/histogram_demo_cumulative.rst.txt b/_sources/examples/statistics/histogram_demo_cumulative.rst.txt deleted file mode 100644 index 53aa6bfc40f..00000000000 --- a/_sources/examples/statistics/histogram_demo_cumulative.rst.txt +++ /dev/null @@ -1,86 +0,0 @@ -.. _statistics-histogram_demo_cumulative: - -statistics example code: histogram_demo_cumulative.py -===================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/statistics/histogram_demo_cumulative.py - -:: - - """ - ========================================================== - Demo of using histograms to plot a cumulative distribution - ========================================================== - - This shows how to plot a cumulative, normalized histogram as a - step function in order to visualize the empirical cumulative - distribution function (CDF) of a sample. We also use the ``mlab`` - module to show the theoretical CDF. - - A couple of other options to the ``hist`` function are demonstrated. - Namely, we use the ``normed`` parameter to normalize the histogram and - a couple of different options to the ``cumulative`` parameter. - The ``normed`` parameter takes a boolean value. When ``True``, the bin - heights are scaled such that the total area of the histogram is 1. The - ``cumulative`` kwarg is a little more nuanced. Like ``normed``, you - can pass it True or False, but you can also pass it -1 to reverse the - distribution. - - Since we're showing a normalized and cumulative histogram, these curves - are effectively the cumulative distribution functions (CDFs) of the - samples. In engineering, empirical CDFs are sometimes called - "non-exceedance" curves. In other words, you can look at the - y-value for a given-x-value to get the probability of and observation - from the sample not exceeding that x-value. For example, the value of - 225 on the x-axis corresponds to about 0.85 on the y-axis, so there's an - 85% chance that an observation in the sample does not exceed 225. - Conversely, setting, ``cumulative`` to -1 as is done in the - last series for this example, creates a "exceedance" curve. - - Selecting different bin counts and sizes can significantly affect the - shape of a histogram. The Astropy docs have a great section on how to - select these parameters: - http://docs.astropy.org/en/stable/visualization/histogram.html - - """ - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib import mlab - - np.random.seed(0) - - mu = 200 - sigma = 25 - n_bins = 50 - x = np.random.normal(mu, sigma, size=100) - - fig, ax = plt.subplots(figsize=(8, 4)) - - # plot the cumulative histogram - n, bins, patches = ax.hist(x, n_bins, normed=1, histtype='step', - cumulative=True, label='Empirical') - - # Add a line showing the expected distribution. - y = mlab.normpdf(bins, mu, sigma).cumsum() - y /= y[-1] - - ax.plot(bins, y, 'k--', linewidth=1.5, label='Theoretical') - - # Overlay a reversed cumulative histogram. - ax.hist(x, bins=bins, normed=1, histtype='step', cumulative=-1, - label='Reversed emp.') - - # tidy up the figure - ax.grid(True) - ax.legend(loc='right') - ax.set_title('Cumulative step histograms') - ax.set_xlabel('Annual rainfall (mm)') - ax.set_ylabel('Likelihood of occurrence') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/histogram_demo_cumulative.txt b/_sources/examples/statistics/histogram_demo_cumulative.txt deleted file mode 100644 index cd7bdf2bc85..00000000000 --- a/_sources/examples/statistics/histogram_demo_cumulative.txt +++ /dev/null @@ -1,44 +0,0 @@ -.. _statistics-histogram_demo_cumulative: - -statistics example code: histogram_demo_cumulative.py -===================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/statistics/histogram_demo_cumulative.py - -:: - - """ - Demo of the histogram (hist) function used to plot a cumulative distribution. - - """ - import numpy as np - import matplotlib.pyplot as plt - from matplotlib import mlab - - - mu = 200 - sigma = 25 - n_bins = 50 - x = mu + sigma*np.random.randn(10000) - - n, bins, patches = plt.hist(x, n_bins, normed=1, - histtype='step', cumulative=True) - - # Add a line showing the expected distribution. - y = mlab.normpdf(bins, mu, sigma).cumsum() - y /= y[-1] - plt.plot(bins, y, 'k--', linewidth=1.5) - - # Overlay a reversed cumulative histogram. - plt.hist(x, bins=bins, normed=1, histtype='step', cumulative=-1) - - plt.grid(True) - plt.ylim(0, 1.05) - plt.title('cumulative step') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/histogram_demo_features.rst.txt b/_sources/examples/statistics/histogram_demo_features.rst.txt deleted file mode 100644 index fc995aaff75..00000000000 --- a/_sources/examples/statistics/histogram_demo_features.rst.txt +++ /dev/null @@ -1,63 +0,0 @@ -.. _statistics-histogram_demo_features: - -statistics example code: histogram_demo_features.py -=================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/statistics/histogram_demo_features.py - -:: - - """ - ========================================================= - Demo of the histogram (hist) function with a few features - ========================================================= - - In addition to the basic histogram, this demo shows a few optional - features: - - * Setting the number of data bins - * The ``normed`` flag, which normalizes bin heights so that the - integral of the histogram is 1. The resulting histogram is an - approximation of the probability density function. - * Setting the face color of the bars - * Setting the opacity (alpha value). - - Selecting different bin counts and sizes can significantly affect the - shape of a histogram. The Astropy docs have a great section on how to - select these parameters: - http://docs.astropy.org/en/stable/visualization/histogram.html - """ - - import numpy as np - import matplotlib.mlab as mlab - import matplotlib.pyplot as plt - - np.random.seed(0) - - # example data - mu = 100 # mean of distribution - sigma = 15 # standard deviation of distribution - x = mu + sigma * np.random.randn(437) - - num_bins = 50 - - fig, ax = plt.subplots() - - # the histogram of the data - n, bins, patches = ax.hist(x, num_bins, normed=1) - - # add a 'best fit' line - y = mlab.normpdf(bins, mu, sigma) - ax.plot(bins, y, '--') - ax.set_xlabel('Smarts') - ax.set_ylabel('Probability density') - ax.set_title(r'Histogram of IQ: $\mu=100$, $\sigma=15$') - - # Tweak spacing to prevent clipping of ylabel - fig.tight_layout() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/histogram_demo_features.txt b/_sources/examples/statistics/histogram_demo_features.txt deleted file mode 100644 index a27614fdee0..00000000000 --- a/_sources/examples/statistics/histogram_demo_features.txt +++ /dev/null @@ -1,49 +0,0 @@ -.. _statistics-histogram_demo_features: - -statistics example code: histogram_demo_features.py -=================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/statistics/histogram_demo_features.py - -:: - - """ - Demo of the histogram (hist) function with a few features. - - In addition to the basic histogram, this demo shows a few optional features: - - * Setting the number of data bins - * The ``normed`` flag, which normalizes bin heights so that the integral of - the histogram is 1. The resulting histogram is a probability density. - * Setting the face color of the bars - * Setting the opacity (alpha value). - - """ - import numpy as np - import matplotlib.mlab as mlab - import matplotlib.pyplot as plt - - - # example data - mu = 100 # mean of distribution - sigma = 15 # standard deviation of distribution - x = mu + sigma * np.random.randn(10000) - - num_bins = 50 - # the histogram of the data - n, bins, patches = plt.hist(x, num_bins, normed=1, facecolor='green', alpha=0.5) - # add a 'best fit' line - y = mlab.normpdf(bins, mu, sigma) - plt.plot(bins, y, 'r--') - plt.xlabel('Smarts') - plt.ylabel('Probability') - plt.title(r'Histogram of IQ: $\mu=100$, $\sigma=15$') - - # Tweak spacing to prevent clipping of ylabel - plt.subplots_adjust(left=0.15) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/histogram_demo_histtypes.rst.txt b/_sources/examples/statistics/histogram_demo_histtypes.rst.txt deleted file mode 100644 index e111d662924..00000000000 --- a/_sources/examples/statistics/histogram_demo_histtypes.rst.txt +++ /dev/null @@ -1,49 +0,0 @@ -.. _statistics-histogram_demo_histtypes: - -statistics example code: histogram_demo_histtypes.py -==================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/statistics/histogram_demo_histtypes.py - -:: - - """ - ================================================================ - Demo of the histogram function's different ``histtype`` settings - ================================================================ - - * Histogram with step curve that has a color fill. - * Histogram with custom and unequal bin widths. - - Selecting different bin counts and sizes can significantly affect the - shape of a histogram. The Astropy docs have a great section on how to - select these parameters: - http://docs.astropy.org/en/stable/visualization/histogram.html - """ - - import numpy as np - import matplotlib.pyplot as plt - - np.random.seed(0) - - mu = 200 - sigma = 25 - x = np.random.normal(mu, sigma, size=100) - - fig, (ax0, ax1) = plt.subplots(ncols=2, figsize=(8, 4)) - - ax0.hist(x, 20, normed=1, histtype='stepfilled', facecolor='g', alpha=0.75) - ax0.set_title('stepfilled') - - # Create a histogram by providing the bin edges (unequally spaced). - bins = [100, 150, 180, 195, 205, 220, 250, 300] - ax1.hist(x, bins, normed=1, histtype='bar', rwidth=0.8) - ax1.set_title('unequal bins') - - fig.tight_layout() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/histogram_demo_histtypes.txt b/_sources/examples/statistics/histogram_demo_histtypes.txt deleted file mode 100644 index 05b62169bbb..00000000000 --- a/_sources/examples/statistics/histogram_demo_histtypes.txt +++ /dev/null @@ -1,41 +0,0 @@ -.. _statistics-histogram_demo_histtypes: - -statistics example code: histogram_demo_histtypes.py -==================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/statistics/histogram_demo_histtypes.py - -:: - - """ - Demo of the histogram (hist) function with different ``histtype`` settings. - - * Histogram with step curve that has a color fill. - * Histogram with with unequal bin widths. - - """ - import numpy as np - import matplotlib.pyplot as plt - - - mu = 200 - sigma = 25 - x = mu + sigma*np.random.randn(10000) - - fig, (ax0, ax1) = plt.subplots(ncols=2, figsize=(8, 4)) - - ax0.hist(x, 20, normed=1, histtype='stepfilled', facecolor='g', alpha=0.75) - ax0.set_title('stepfilled') - - # Create a histogram by providing the bin edges (unequally spaced). - bins = [100, 150, 180, 195, 205, 220, 250, 300] - ax1.hist(x, bins, normed=1, histtype='bar', rwidth=0.8) - ax1.set_title('unequal bins') - - plt.tight_layout() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/histogram_demo_multihist.rst.txt b/_sources/examples/statistics/histogram_demo_multihist.rst.txt deleted file mode 100644 index 7e86f4104e8..00000000000 --- a/_sources/examples/statistics/histogram_demo_multihist.rst.txt +++ /dev/null @@ -1,61 +0,0 @@ -.. _statistics-histogram_demo_multihist: - -statistics example code: histogram_demo_multihist.py -==================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/statistics/histogram_demo_multihist.py - -:: - - """ - ============================================================= - Demo of the histogram (hist) function with multiple data sets - ============================================================= - - Plot histogram with multiple sample sets and demonstrate: - - * Use of legend with multiple sample sets - * Stacked bars - * Step curve with no fill - * Data sets of different sample sizes - - Selecting different bin counts and sizes can significantly affect the - shape of a histogram. The Astropy docs have a great section on how to - select these parameters: - http://docs.astropy.org/en/stable/visualization/histogram.html - """ - - import numpy as np - import matplotlib.pyplot as plt - - np.random.seed(0) - - n_bins = 10 - x = np.random.randn(1000, 3) - - fig, axes = plt.subplots(nrows=2, ncols=2) - ax0, ax1, ax2, ax3 = axes.flatten() - - colors = ['red', 'tan', 'lime'] - ax0.hist(x, n_bins, normed=1, histtype='bar', color=colors, label=colors) - ax0.legend(prop={'size': 10}) - ax0.set_title('bars with legend') - - ax1.hist(x, n_bins, normed=1, histtype='bar', stacked=True) - ax1.set_title('stacked bar') - - ax2.hist(x, n_bins, histtype='step', stacked=True, fill=False) - ax2.set_title('stack step (unfilled)') - - # Make a multiple-histogram of data-sets with different length. - x_multi = [np.random.randn(n) for n in [10000, 5000, 2000]] - ax3.hist(x_multi, n_bins, histtype='bar') - ax3.set_title('different sample sizes') - - fig.tight_layout() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/histogram_demo_multihist.txt b/_sources/examples/statistics/histogram_demo_multihist.txt deleted file mode 100644 index 8c42003d96a..00000000000 --- a/_sources/examples/statistics/histogram_demo_multihist.txt +++ /dev/null @@ -1,52 +0,0 @@ -.. _statistics-histogram_demo_multihist: - -statistics example code: histogram_demo_multihist.py -==================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/statistics/histogram_demo_multihist.py - -:: - - """ - Demo of the histogram (hist) function with multiple data sets. - - Plot histogram with multiple sample sets and demonstrate: - - * Use of legend with multiple sample sets - * Stacked bars - * Step curve with a color fill - * Data sets of different sample sizes - """ - import numpy as np - import matplotlib.pyplot as plt - - - n_bins = 10 - x = np.random.randn(1000, 3) - - fig, axes = plt.subplots(nrows=2, ncols=2) - ax0, ax1, ax2, ax3 = axes.flat - - colors = ['red', 'tan', 'lime'] - ax0.hist(x, n_bins, normed=1, histtype='bar', color=colors, label=colors) - ax0.legend(prop={'size': 10}) - ax0.set_title('bars with legend') - - ax1.hist(x, n_bins, normed=1, histtype='bar', stacked=True) - ax1.set_title('stacked bar') - - ax2.hist(x, n_bins, histtype='step', stacked=True, fill=True) - ax2.set_title('stepfilled') - - # Make a multiple-histogram of data-sets with different length. - x_multi = [np.random.randn(n) for n in [10000, 5000, 2000]] - ax3.hist(x_multi, n_bins, histtype='bar') - ax3.set_title('different sample sizes') - - plt.tight_layout() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/index.rst.txt b/_sources/examples/statistics/index.rst.txt deleted file mode 100644 index bed0d389efe..00000000000 --- a/_sources/examples/statistics/index.rst.txt +++ /dev/null @@ -1,29 +0,0 @@ -.. _statistics-examples-index: - -############################################## -statistics Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - boxplot_color_demo - boxplot_demo - boxplot_vs_violin_demo - bxp_demo - customized_violin_demo - errorbar_demo - errorbar_demo_features - errorbar_limits - errorbars_and_boxes - histogram_demo_cumulative - histogram_demo_features - histogram_demo_histtypes - histogram_demo_multihist - multiple_histograms_side_by_side - violinplot_demo diff --git a/_sources/examples/statistics/index.txt b/_sources/examples/statistics/index.txt deleted file mode 100644 index ff490b6e6cf..00000000000 --- a/_sources/examples/statistics/index.txt +++ /dev/null @@ -1,27 +0,0 @@ -.. _statistics-examples-index: - -############################################## -statistics Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - boxplot_color_demo - boxplot_demo - boxplot_vs_violin_demo - bxp_demo - errorbar_demo - errorbar_demo_features - errorbar_limits - histogram_demo_cumulative - histogram_demo_features - histogram_demo_histtypes - histogram_demo_multihist - multiple_histograms_side_by_side - violinplot_demo diff --git a/_sources/examples/statistics/multiple_histograms_side_by_side.rst.txt b/_sources/examples/statistics/multiple_histograms_side_by_side.rst.txt deleted file mode 100644 index fa5c2239086..00000000000 --- a/_sources/examples/statistics/multiple_histograms_side_by_side.rst.txt +++ /dev/null @@ -1,77 +0,0 @@ -.. _statistics-multiple_histograms_side_by_side: - -statistics example code: multiple_histograms_side_by_side.py -============================================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/statistics/multiple_histograms_side_by_side.py - -:: - - """ - ======================================================= - Demo of how to produce multiple histograms side by side - ======================================================= - - This example plots horizontal histograms of different samples along - a categorical x-axis. Additionally, the histograms are plotted to - be symmetrical about their x-position, thus making them very similar - to violin plots. - - To make this highly specialized plot, we can't use the standard ``hist`` - method. Instead we use ``barh`` to draw the horizontal bars directly. The - vertical positions and lengths of the bars are computed via the - ``np.histogram`` function. The histograms for all the samples are - computed using the same range (min and max values) and number of bins, - so that the bins for each sample are in the same vertical positions. - - Selecting different bin counts and sizes can significantly affect the - shape of a histogram. The Astropy docs have a great section on how to - select these parameters: - http://docs.astropy.org/en/stable/visualization/histogram.html - """ - - import numpy as np - import matplotlib.pyplot as plt - - np.random.seed(0) - number_of_bins = 20 - - # An example of three data sets to compare - number_of_data_points = 387 - labels = ["A", "B", "C"] - data_sets = [np.random.normal(0, 1, number_of_data_points), - np.random.normal(6, 1, number_of_data_points), - np.random.normal(-3, 1, number_of_data_points)] - - # Computed quantities to aid plotting - hist_range = (np.min(data_sets), np.max(data_sets)) - binned_data_sets = [ - np.histogram(d, range=hist_range, bins=number_of_bins)[0] - for d in data_sets - ] - binned_maximums = np.max(binned_data_sets, axis=1) - x_locations = np.arange(0, sum(binned_maximums), np.max(binned_maximums)) - - # The bin_edges are the same for all of the histograms - bin_edges = np.linspace(hist_range[0], hist_range[1], number_of_bins + 1) - centers = 0.5 * (bin_edges + np.roll(bin_edges, 1))[:-1] - heights = np.diff(bin_edges) - - # Cycle through and plot each histogram - fig, ax = plt.subplots() - for x_loc, binned_data in zip(x_locations, binned_data_sets): - lefts = x_loc - 0.5 * binned_data - ax.barh(centers, binned_data, height=heights, left=lefts) - - ax.set_xticks(x_locations) - ax.set_xticklabels(labels) - - ax.set_ylabel("Data values") - ax.set_xlabel("Data sets") - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/multiple_histograms_side_by_side.txt b/_sources/examples/statistics/multiple_histograms_side_by_side.txt deleted file mode 100644 index ebf9a54db4a..00000000000 --- a/_sources/examples/statistics/multiple_histograms_side_by_side.txt +++ /dev/null @@ -1,56 +0,0 @@ -.. _statistics-multiple_histograms_side_by_side: - -statistics example code: multiple_histograms_side_by_side.py -============================================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/statistics/multiple_histograms_side_by_side.py - -:: - - - """ - Demo of how to produce multiple histograms side by side - """ - - import numpy as np - import matplotlib.pyplot as plt - - number_of_bins = 20 - - # An example of three data sets to compare - number_of_data_points = 1000 - labels = ["A", "B", "C"] - data_sets = [np.random.normal(0, 1, number_of_data_points), - np.random.normal(6, 1, number_of_data_points), - np.random.normal(-3, 1, number_of_data_points)] - - # Computed quantities to aid plotting - hist_range = (np.min(data_sets), np.max(data_sets)) - binned_data_sets = [np.histogram(d, range=hist_range, bins=number_of_bins)[0] - for d in data_sets] - binned_maximums = np.max(binned_data_sets, axis=1) - x_locations = np.arange(0, sum(binned_maximums), np.max(binned_maximums)) - - # The bin_edges are the same for all of the histograms - bin_edges = np.linspace(hist_range[0], hist_range[1], number_of_bins + 1) - centers = .5 * (bin_edges + np.roll(bin_edges, 1))[:-1] - heights = np.diff(bin_edges) - - # Cycle through and plot each histogram - ax = plt.subplot(111) - for x_loc, binned_data in zip(x_locations, binned_data_sets): - lefts = x_loc - .5 * binned_data - ax.barh(centers, binned_data, height=heights, left=lefts) - - ax.set_xticks(x_locations) - ax.set_xticklabels(labels) - - ax.set_ylabel("Data values") - ax.set_xlabel("Data sets") - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/violinplot_demo.rst.txt b/_sources/examples/statistics/violinplot_demo.rst.txt deleted file mode 100644 index 9ac6f51295e..00000000000 --- a/_sources/examples/statistics/violinplot_demo.rst.txt +++ /dev/null @@ -1,76 +0,0 @@ -.. _statistics-violinplot_demo: - -statistics example code: violinplot_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/statistics/violinplot_demo.py - -:: - - """ - ================================== - Demo of the basics of violin plots - ================================== - - Violin plots are similar to histograms and box plots in that they show - an abstract representation of the probability distribution of the - sample. Rather than showing counts of data points that fall into bins - or order statistics, violin plots use kernel density estimation (KDE) to - compute an empirical distribution of the sample. That computation - is controlled by several parameters. This example demonstrates how to - modify the number of points at which the KDE is evaluated (``points``) - and how to modify the band-width of the KDE (``bw_method``). - - For more information on violin plots and KDE, the scikit-learn docs - have a great section: http://scikit-learn.org/stable/modules/density.html - """ - - import random - import numpy as np - import matplotlib.pyplot as plt - - # fake data - fs = 10 # fontsize - pos = [1, 2, 4, 5, 7, 8] - data = [np.random.normal(0, std, size=100) for std in pos] - - fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(6, 6)) - - axes[0, 0].violinplot(data, pos, points=20, widths=0.3, - showmeans=True, showextrema=True, showmedians=True) - axes[0, 0].set_title('Custom violinplot 1', fontsize=fs) - - axes[0, 1].violinplot(data, pos, points=40, widths=0.5, - showmeans=True, showextrema=True, showmedians=True, - bw_method='silverman') - axes[0, 1].set_title('Custom violinplot 2', fontsize=fs) - - axes[0, 2].violinplot(data, pos, points=60, widths=0.7, showmeans=True, - showextrema=True, showmedians=True, bw_method=0.5) - axes[0, 2].set_title('Custom violinplot 3', fontsize=fs) - - axes[1, 0].violinplot(data, pos, points=80, vert=False, widths=0.7, - showmeans=True, showextrema=True, showmedians=True) - axes[1, 0].set_title('Custom violinplot 4', fontsize=fs) - - axes[1, 1].violinplot(data, pos, points=100, vert=False, widths=0.9, - showmeans=True, showextrema=True, showmedians=True, - bw_method='silverman') - axes[1, 1].set_title('Custom violinplot 5', fontsize=fs) - - axes[1, 2].violinplot(data, pos, points=200, vert=False, widths=1.1, - showmeans=True, showextrema=True, showmedians=True, - bw_method=0.5) - axes[1, 2].set_title('Custom violinplot 6', fontsize=fs) - - for ax in axes.flatten(): - ax.set_yticklabels([]) - - fig.suptitle("Violin Plotting Examples") - fig.subplots_adjust(hspace=0.4) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/statistics/violinplot_demo.txt b/_sources/examples/statistics/violinplot_demo.txt deleted file mode 100644 index 5b493fbab4b..00000000000 --- a/_sources/examples/statistics/violinplot_demo.txt +++ /dev/null @@ -1,62 +0,0 @@ -.. _statistics-violinplot_demo: - -statistics example code: violinplot_demo.py -=========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/statistics/violinplot_demo.py - -:: - - """ - Demo of the new violinplot functionality - """ - - import random - import numpy as np - import matplotlib.pyplot as plt - - # fake data - fs = 10 # fontsize - pos = [1, 2, 4, 5, 7, 8] - data = [np.random.normal(size=100) for i in pos] - - fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(6, 6)) - - axes[0, 0].violinplot(data, pos, points=20, widths=0.1, - showmeans=True, showextrema=True, showmedians=True) - axes[0, 0].set_title('Custom violinplot 1', fontsize=fs) - - axes[0, 1].violinplot(data, pos, points=40, widths=0.3, - showmeans=True, showextrema=True, showmedians=True, - bw_method='silverman') - axes[0, 1].set_title('Custom violinplot 2', fontsize=fs) - - axes[0, 2].violinplot(data, pos, points=60, widths=0.5, showmeans=True, - showextrema=True, showmedians=True, bw_method=0.5) - axes[0, 2].set_title('Custom violinplot 3', fontsize=fs) - - axes[1, 0].violinplot(data, pos, points=80, vert=False, widths=0.7, - showmeans=True, showextrema=True, showmedians=True) - axes[1, 0].set_title('Custom violinplot 4', fontsize=fs) - - axes[1, 1].violinplot(data, pos, points=100, vert=False, widths=0.9, - showmeans=True, showextrema=True, showmedians=True, - bw_method='silverman') - axes[1, 1].set_title('Custom violinplot 5', fontsize=fs) - - axes[1, 2].violinplot(data, pos, points=200, vert=False, widths=1.1, - showmeans=True, showextrema=True, showmedians=True, - bw_method=0.5) - axes[1, 2].set_title('Custom violinplot 6', fontsize=fs) - - for ax in axes.flatten(): - ax.set_yticklabels([]) - - fig.suptitle("Violin Plotting Examples") - fig.subplots_adjust(hspace=0.4) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/style_sheets/index.rst.txt b/_sources/examples/style_sheets/index.rst.txt deleted file mode 100644 index f251340bc11..00000000000 --- a/_sources/examples/style_sheets/index.rst.txt +++ /dev/null @@ -1,20 +0,0 @@ -.. _style_sheets-examples-index: - -############################################## -style_sheets Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - plot_bmh - plot_dark_background - plot_fivethirtyeight - plot_ggplot - plot_grayscale - style_sheets_reference diff --git a/_sources/examples/style_sheets/index.txt b/_sources/examples/style_sheets/index.txt deleted file mode 100644 index 754991361fc..00000000000 --- a/_sources/examples/style_sheets/index.txt +++ /dev/null @@ -1,19 +0,0 @@ -.. _style_sheets-examples-index: - -############################################## -style_sheets Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - plot_bmh - plot_dark_background - plot_fivethirtyeight - plot_ggplot - plot_grayscale diff --git a/_sources/examples/style_sheets/plot_bmh.rst.txt b/_sources/examples/style_sheets/plot_bmh.rst.txt deleted file mode 100644 index eb0f4c0a23d..00000000000 --- a/_sources/examples/style_sheets/plot_bmh.rst.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _style_sheets-plot_bmh: - -style_sheets example code: plot_bmh.py -====================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/style_sheets/plot_bmh.py - -:: - - """ - ======================================== - Bayesian Methods for Hackers style sheet - ======================================== - - This example demonstrates the style used in the Bayesian Methods for Hackers - [1]_ online book. - - .. [1] http://camdavidsonpilon.github.io/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/ - - """ - from numpy.random import beta - import matplotlib.pyplot as plt - - - plt.style.use('bmh') - - - def plot_beta_hist(ax, a, b): - ax.hist(beta(a, b, size=10000), histtype="stepfilled", - bins=25, alpha=0.8, normed=True) - - - fig, ax = plt.subplots() - plot_beta_hist(ax, 10, 10) - plot_beta_hist(ax, 4, 12) - plot_beta_hist(ax, 50, 12) - plot_beta_hist(ax, 6, 55) - ax.set_title("'bmh' style sheet") - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/style_sheets/plot_bmh.txt b/_sources/examples/style_sheets/plot_bmh.txt deleted file mode 100644 index 0c55e74da39..00000000000 --- a/_sources/examples/style_sheets/plot_bmh.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _style_sheets-plot_bmh: - -style_sheets example code: plot_bmh.py -====================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/style_sheets/plot_bmh.py - -:: - - """ - This example demonstrates the "bmh" style, which is the design used in the - Bayesian Methods for Hackers online book. - """ - from numpy.random import beta - import matplotlib.pyplot as plt - - plt.style.use('bmh') - - - def plot_beta_hist(a, b): - plt.hist(beta(a, b, size=10000), histtype="stepfilled", - bins=25, alpha=0.8, normed=True) - return - - plot_beta_hist(10, 10) - plot_beta_hist(4, 12) - plot_beta_hist(50, 12) - plot_beta_hist(6, 55) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/style_sheets/plot_dark_background.rst.txt b/_sources/examples/style_sheets/plot_dark_background.rst.txt deleted file mode 100644 index 32bcf6dbcf9..00000000000 --- a/_sources/examples/style_sheets/plot_dark_background.rst.txt +++ /dev/null @@ -1,43 +0,0 @@ -.. _style_sheets-plot_dark_background: - -style_sheets example code: plot_dark_background.py -================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/style_sheets/plot_dark_background.py - -:: - - """ - =========================== - Dark background style sheet - =========================== - - This example demonstrates the "dark_background" style, which uses white for - elements that are typically black (text, borders, etc). Note that not all plot - elements default to colors defined by an rc parameter. - - """ - import numpy as np - import matplotlib.pyplot as plt - - - plt.style.use('dark_background') - - fig, ax = plt.subplots() - - L = 6 - x = np.linspace(0, L) - ncolors = len(plt.rcParams['axes.prop_cycle']) - shift = np.linspace(0, L, ncolors, endpoint=False) - for s in shift: - ax.plot(x, np.sin(x + s), 'o-') - ax.set_xlabel('x-axis') - ax.set_ylabel('y-axis') - ax.set_title("'dark_background' style sheet") - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/style_sheets/plot_dark_background.txt b/_sources/examples/style_sheets/plot_dark_background.txt deleted file mode 100644 index 7d61f1858c0..00000000000 --- a/_sources/examples/style_sheets/plot_dark_background.txt +++ /dev/null @@ -1,37 +0,0 @@ -.. _style_sheets-plot_dark_background: - -style_sheets example code: plot_dark_background.py -================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/style_sheets/plot_dark_background.py - -:: - - """ - This example demonstrates the "dark_background" style, which uses white for - elements that are typically black (text, borders, etc). Note, however, that not - all plot elements default to colors defined by an rc parameter. - - """ - import numpy as np - import matplotlib.pyplot as plt - - - plt.style.use('dark_background') - - L = 6 - x = np.linspace(0, L) - ncolors = len(plt.rcParams['axes.color_cycle']) - shift = np.linspace(0, L, ncolors, endpoint=False) - for s in shift: - plt.plot(x, np.sin(x + s), 'o-') - plt.xlabel('x-axis') - plt.ylabel('y-axis') - plt.title('title') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/style_sheets/plot_fivethirtyeight.rst.txt b/_sources/examples/style_sheets/plot_fivethirtyeight.rst.txt deleted file mode 100644 index 684f279d888..00000000000 --- a/_sources/examples/style_sheets/plot_fivethirtyeight.rst.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _style_sheets-plot_fivethirtyeight: - -style_sheets example code: plot_fivethirtyeight.py -================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/style_sheets/plot_fivethirtyeight.py - -:: - - """ - =========================== - FiveThirtyEight style sheet - =========================== - - This shows an example of the "fivethirtyeight" styling, which - tries to replicate the styles from FiveThirtyEight.com. - """ - - from matplotlib import pyplot as plt - import numpy as np - - - plt.style.use('fivethirtyeight') - - x = np.linspace(0, 10) - - # Fixing random state for reproducibility - np.random.seed(19680801) - - fig, ax = plt.subplots() - - ax.plot(x, np.sin(x) + x + np.random.randn(50)) - ax.plot(x, np.sin(x) + 0.5 * x + np.random.randn(50)) - ax.plot(x, np.sin(x) + 2 * x + np.random.randn(50)) - ax.plot(x, np.sin(x) - 0.5 * x + np.random.randn(50)) - ax.plot(x, np.sin(x) - 2 * x + np.random.randn(50)) - ax.plot(x, np.sin(x) + np.random.randn(50)) - ax.set_title("'fivethirtyeight' style sheet") - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/style_sheets/plot_fivethirtyeight.txt b/_sources/examples/style_sheets/plot_fivethirtyeight.txt deleted file mode 100644 index 5454a4b9123..00000000000 --- a/_sources/examples/style_sheets/plot_fivethirtyeight.txt +++ /dev/null @@ -1,32 +0,0 @@ -.. _style_sheets-plot_fivethirtyeight: - -style_sheets example code: plot_fivethirtyeight.py -================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/style_sheets/plot_fivethirtyeight.py - -:: - - """ - This shows an example of the "fivethirtyeight" styling, which - tries to replicate the styles from FiveThirtyEight.com. - """ - - - from matplotlib import pyplot as plt - import numpy as np - - x = np.linspace(0, 10) - - with plt.style.context('fivethirtyeight'): - plt.plot(x, np.sin(x) + x + np.random.randn(50)) - plt.plot(x, np.sin(x) + 0.5 * x + np.random.randn(50)) - plt.plot(x, np.sin(x) + 2 * x + np.random.randn(50)) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/style_sheets/plot_ggplot.rst.txt b/_sources/examples/style_sheets/plot_ggplot.rst.txt deleted file mode 100644 index 811966dd890..00000000000 --- a/_sources/examples/style_sheets/plot_ggplot.rst.txt +++ /dev/null @@ -1,69 +0,0 @@ -.. _style_sheets-plot_ggplot: - -style_sheets example code: plot_ggplot.py -========================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/style_sheets/plot_ggplot.py - -:: - - """ - ================== - ggplot style sheet - ================== - - This example demonstrates the "ggplot" style, which adjusts the style to - emulate ggplot_ (a popular plotting package for R_). - - These settings were shamelessly stolen from [1]_ (with permission). - - .. [1] http://www.huyng.com/posts/sane-color-scheme-for-matplotlib/ - - .. _ggplot: http://ggplot2.org/ - .. _R: https://www.r-project.org/ - - """ - import numpy as np - import matplotlib.pyplot as plt - - plt.style.use('ggplot') - - fig, axes = plt.subplots(ncols=2, nrows=2) - ax1, ax2, ax3, ax4 = axes.ravel() - - # scatter plot (Note: `plt.scatter` doesn't use default colors) - x, y = np.random.normal(size=(2, 200)) - ax1.plot(x, y, 'o') - - # sinusoidal lines with colors from default color cycle - L = 2*np.pi - x = np.linspace(0, L) - ncolors = len(plt.rcParams['axes.prop_cycle']) - shift = np.linspace(0, L, ncolors, endpoint=False) - for s in shift: - ax2.plot(x, np.sin(x + s), '-') - ax2.margins(0) - - # bar graphs - x = np.arange(5) - y1, y2 = np.random.randint(1, 25, size=(2, 5)) - width = 0.25 - ax3.bar(x, y1, width) - ax3.bar(x + width, y2, width, - color=list(plt.rcParams['axes.prop_cycle'])[2]['color']) - ax3.set_xticks(x + width) - ax3.set_xticklabels(['a', 'b', 'c', 'd', 'e']) - - # circles with colors from default color cycle - for i, color in enumerate(plt.rcParams['axes.prop_cycle']): - xy = np.random.normal(size=2) - ax4.add_patch(plt.Circle(xy, radius=0.3, color=color['color'])) - ax4.axis('equal') - ax4.margins(0) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/style_sheets/plot_ggplot.txt b/_sources/examples/style_sheets/plot_ggplot.txt deleted file mode 100644 index 0a1f523d14e..00000000000 --- a/_sources/examples/style_sheets/plot_ggplot.txt +++ /dev/null @@ -1,64 +0,0 @@ -.. _style_sheets-plot_ggplot: - -style_sheets example code: plot_ggplot.py -========================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/style_sheets/plot_ggplot.py - -:: - - """ - This example demonstrates the "ggplot" style, which adjusts the style to - emulate ggplot_ (a popular plotting package for R_). - - These settings were shamelessly stolen from [1]_ (with permission). - - .. [1] http://www.huyng.com/posts/sane-color-scheme-for-matplotlib/ - - .. _ggplot: http://ggplot2.org/ - .. _R: https://www.r-project.org/ - - """ - import numpy as np - import matplotlib.pyplot as plt - - plt.style.use('ggplot') - - fig, axes = plt.subplots(ncols=2, nrows=2) - ax1, ax2, ax3, ax4 = axes.ravel() - - # scatter plot (Note: `plt.scatter` doesn't use default colors) - x, y = np.random.normal(size=(2, 200)) - ax1.plot(x, y, 'o') - - # sinusoidal lines with colors from default color cycle - L = 2*np.pi - x = np.linspace(0, L) - ncolors = len(plt.rcParams['axes.color_cycle']) - shift = np.linspace(0, L, ncolors, endpoint=False) - for s in shift: - ax2.plot(x, np.sin(x + s), '-') - ax2.margins(0) - - # bar graphs - x = np.arange(5) - y1, y2 = np.random.randint(1, 25, size=(2, 5)) - width = 0.25 - ax3.bar(x, y1, width) - ax3.bar(x + width, y2, width, color=plt.rcParams['axes.color_cycle'][2]) - ax3.set_xticks(x + width) - ax3.set_xticklabels(['a', 'b', 'c', 'd', 'e']) - - # circles with colors from default color cycle - for i, color in enumerate(plt.rcParams['axes.color_cycle']): - xy = np.random.normal(size=2) - ax4.add_patch(plt.Circle(xy, radius=0.3, color=color)) - ax4.axis('equal') - ax4.margins(0) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/style_sheets/plot_grayscale.rst.txt b/_sources/examples/style_sheets/plot_grayscale.rst.txt deleted file mode 100644 index 130f9099dac..00000000000 --- a/_sources/examples/style_sheets/plot_grayscale.rst.txt +++ /dev/null @@ -1,52 +0,0 @@ -.. _style_sheets-plot_grayscale: - -style_sheets example code: plot_grayscale.py -============================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/style_sheets/plot_grayscale.py - -:: - - """ - ===================== - Grayscale style sheet - ===================== - - This example demonstrates the "grayscale" style sheet, which changes all colors - that are defined as rc parameters to grayscale. Note, however, that not all - plot elements default to colors defined by an rc parameter. - - """ - import numpy as np - import matplotlib.pyplot as plt - - - def color_cycle_example(ax): - L = 6 - x = np.linspace(0, L) - ncolors = len(plt.rcParams['axes.prop_cycle']) - shift = np.linspace(0, L, ncolors, endpoint=False) - for s in shift: - ax.plot(x, np.sin(x + s), 'o-') - - - def image_and_patch_example(ax): - ax.imshow(np.random.random(size=(20, 20)), interpolation='none') - c = plt.Circle((5, 5), radius=5, label='patch') - ax.add_patch(c) - - - plt.style.use('grayscale') - - fig, (ax1, ax2) = plt.subplots(ncols=2) - fig.suptitle("'grayscale' style sheet") - - color_cycle_example(ax1) - image_and_patch_example(ax2) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/style_sheets/plot_grayscale.txt b/_sources/examples/style_sheets/plot_grayscale.txt deleted file mode 100644 index 8820e06d9fc..00000000000 --- a/_sources/examples/style_sheets/plot_grayscale.txt +++ /dev/null @@ -1,47 +0,0 @@ -.. _style_sheets-plot_grayscale: - -style_sheets example code: plot_grayscale.py -============================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/style_sheets/plot_grayscale.py - -:: - - """ - This example demonstrates the "grayscale" style sheet, which changes all colors - that are defined as rc parameters to grayscale. Note, however, that not all - plot elements default to colors defined by an rc parameter. - - """ - import numpy as np - import matplotlib.pyplot as plt - - - def color_cycle_example(ax): - L = 6 - x = np.linspace(0, L) - ncolors = len(plt.rcParams['axes.color_cycle']) - shift = np.linspace(0, L, ncolors, endpoint=False) - for s in shift: - ax.plot(x, np.sin(x + s), 'o-') - - - def image_and_patch_example(ax): - ax.imshow(np.random.random(size=(20, 20)), interpolation='none') - c = plt.Circle((5, 5), radius=5, label='patch') - ax.add_patch(c) - - - plt.style.use('grayscale') - - fig, (ax1, ax2) = plt.subplots(ncols=2) - - color_cycle_example(ax1) - image_and_patch_example(ax2) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/style_sheets/style_sheets_reference.rst.txt b/_sources/examples/style_sheets/style_sheets_reference.rst.txt deleted file mode 100644 index 0daee7b4a72..00000000000 --- a/_sources/examples/style_sheets/style_sheets_reference.rst.txt +++ /dev/null @@ -1,160 +0,0 @@ -.. _style_sheets-style_sheets_reference: - -style_sheets example code: style_sheets_reference.py -==================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/style_sheets/style_sheets_reference.py - -:: - - """ - ====================== - Style sheets reference - ====================== - - This script demonstrates the different available style sheets on a - common set of example plots: scatter plot, image, bar graph, patches, - line plot and histogram, - - """ - - import numpy as np - import matplotlib.pyplot as plt - - - def plot_scatter(ax, prng, nb_samples=100): - """Scatter plot. - """ - for mu, sigma, marker in [(-.5, 0.75, 'o'), (0.75, 1., 's')]: - x, y = prng.normal(loc=mu, scale=sigma, size=(2, nb_samples)) - ax.plot(x, y, ls='none', marker=marker) - ax.set_xlabel('X-label') - return ax - - - def plot_colored_sinusoidal_lines(ax): - """Plot sinusoidal lines with colors following the style color cycle. - """ - L = 2 * np.pi - x = np.linspace(0, L) - nb_colors = len(plt.rcParams['axes.prop_cycle']) - shift = np.linspace(0, L, nb_colors, endpoint=False) - for s in shift: - ax.plot(x, np.sin(x + s), '-') - ax.set_xlim([x[0], x[-1]]) - return ax - - - def plot_bar_graphs(ax, prng, min_value=5, max_value=25, nb_samples=5): - """Plot two bar graphs side by side, with letters as x-tick labels. - """ - x = np.arange(nb_samples) - ya, yb = prng.randint(min_value, max_value, size=(2, nb_samples)) - width = 0.25 - ax.bar(x, ya, width) - ax.bar(x + width, yb, width, color='C2') - ax.set_xticks(x + width) - ax.set_xticklabels(['a', 'b', 'c', 'd', 'e']) - return ax - - - def plot_colored_circles(ax, prng, nb_samples=15): - """Plot circle patches. - - NB: draws a fixed amount of samples, rather than using the length of - the color cycle, because different styles may have different numbers - of colors. - """ - for sty_dict, j in zip(plt.rcParams['axes.prop_cycle'], range(nb_samples)): - ax.add_patch(plt.Circle(prng.normal(scale=3, size=2), - radius=1.0, color=sty_dict['color'])) - # Force the limits to be the same across the styles (because different - # styles may have different numbers of available colors). - ax.set_xlim([-4, 8]) - ax.set_ylim([-5, 6]) - ax.set_aspect('equal', adjustable='box') # to plot circles as circles - return ax - - - def plot_image_and_patch(ax, prng, size=(20, 20)): - """Plot an image with random values and superimpose a circular patch. - """ - values = prng.random_sample(size=size) - ax.imshow(values, interpolation='none') - c = plt.Circle((5, 5), radius=5, label='patch') - ax.add_patch(c) - # Remove ticks - ax.set_xticks([]) - ax.set_yticks([]) - - - def plot_histograms(ax, prng, nb_samples=10000): - """Plot 4 histograms and a text annotation. - """ - params = ((10, 10), (4, 12), (50, 12), (6, 55)) - for a, b in params: - values = prng.beta(a, b, size=nb_samples) - ax.hist(values, histtype="stepfilled", bins=30, alpha=0.8, normed=True) - # Add a small annotation. - ax.annotate('Annotation', xy=(0.25, 4.25), xycoords='data', - xytext=(0.9, 0.9), textcoords='axes fraction', - va="top", ha="right", - bbox=dict(boxstyle="round", alpha=0.2), - arrowprops=dict( - arrowstyle="->", - connectionstyle="angle,angleA=-95,angleB=35,rad=10"), - ) - return ax - - - def plot_figure(style_label=""): - """Setup and plot the demonstration figure with a given style. - """ - # Use a dedicated RandomState instance to draw the same "random" values - # across the different figures. - prng = np.random.RandomState(96917002) - - # Tweak the figure size to be better suited for a row of numerous plots: - # double the width and halve the height. NB: use relative changes because - # some styles may have a figure size different from the default one. - (fig_width, fig_height) = plt.rcParams['figure.figsize'] - fig_size = [fig_width * 2, fig_height / 2] - - fig, axes = plt.subplots(ncols=6, nrows=1, num=style_label, - figsize=fig_size, squeeze=True) - axes[0].set_ylabel(style_label) - - plot_scatter(axes[0], prng) - plot_image_and_patch(axes[1], prng) - plot_bar_graphs(axes[2], prng) - plot_colored_circles(axes[3], prng) - plot_colored_sinusoidal_lines(axes[4]) - plot_histograms(axes[5], prng) - - fig.tight_layout() - - return fig - - - if __name__ == "__main__": - - # Setup a list of all available styles, in alphabetical order but - # the `default` and `classic` ones, which will be forced resp. in - # first and second position. - style_list = list(plt.style.available) # *new* list: avoids side effects. - style_list.remove('classic') # `classic` is in the list: first remove it. - style_list.sort() - style_list.insert(0, u'default') - style_list.insert(1, u'classic') - - # Plot a demonstration figure for every available style sheet. - for style_label in style_list: - with plt.style.context(style_label): - fig = plot_figure(style_label=style_label) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/subplots_axes_and_figures/fahrenheit_celsius_scales.rst.txt b/_sources/examples/subplots_axes_and_figures/fahrenheit_celsius_scales.rst.txt deleted file mode 100644 index 1eb07545b94..00000000000 --- a/_sources/examples/subplots_axes_and_figures/fahrenheit_celsius_scales.rst.txt +++ /dev/null @@ -1,51 +0,0 @@ -.. _subplots_axes_and_figures-fahrenheit_celsius_scales: - -subplots_axes_and_figures example code: fahrenheit_celsius_scales.py -==================================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/subplots_axes_and_figures/fahrenheit_celsius_scales.py - -:: - - """ - Demo of how to display two scales on the left and right y axis. - - This example uses the Fahrenheit and Celsius scales. - """ - import matplotlib.pyplot as plt - import numpy as np - - - def fahrenheit2celsius(temp): - """ - Returns temperature in Celsius. - """ - return (5. / 9.) * (temp - 32) - - - def convert_ax_c_to_celsius(ax_f): - """ - Update second axis according with first axis. - """ - y1, y2 = ax_f.get_ylim() - ax_c.set_ylim(fahrenheit2celsius(y1), fahrenheit2celsius(y2)) - ax_c.figure.canvas.draw() - - fig, ax_f = plt.subplots() - ax_c = ax_f.twinx() - - # automatically update ylim of ax2 when ylim of ax1 changes. - ax_f.callbacks.connect("ylim_changed", convert_ax_c_to_celsius) - ax_f.plot(np.linspace(-40, 120, 100)) - ax_f.set_xlim(0, 100) - - ax_f.set_title('Two scales: Fahrenheit and Celsius') - ax_f.set_ylabel('Fahrenheit') - ax_c.set_ylabel('Celsius') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/subplots_axes_and_figures/fahrenheit_celsius_scales.txt b/_sources/examples/subplots_axes_and_figures/fahrenheit_celsius_scales.txt deleted file mode 100644 index ad18cf81059..00000000000 --- a/_sources/examples/subplots_axes_and_figures/fahrenheit_celsius_scales.txt +++ /dev/null @@ -1,51 +0,0 @@ -.. _subplots_axes_and_figures-fahrenheit_celsius_scales: - -subplots_axes_and_figures example code: fahrenheit_celsius_scales.py -==================================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/subplots_axes_and_figures/fahrenheit_celsius_scales.py - -:: - - """ - Demo of how to display two scales on the left and right y axis. - - This example uses the Fahrenheit and Celsius scales. - """ - import matplotlib.pyplot as plt - import numpy as np - - - def fahrenheit2celsius(temp): - """ - Returns temperature in Celsius. - """ - return (5. / 9.) * (temp - 32) - - - def convert_ax_c_to_celsius(ax_f): - """ - Update second axis according with first axis. - """ - y1, y2 = ax_f.get_ylim() - ax_c.set_ylim(fahrenheit2celsius(y1), fahrenheit2celsius(y2)) - ax_c.figure.canvas.draw() - - fig, ax_f = plt.subplots() - ax_c = ax_f.twinx() - - # automatically update ylim of ax2 when ylim of ax1 changes. - ax_f.callbacks.connect("ylim_changed", convert_ax_c_to_celsius) - ax_f.plot(np.linspace(-40, 120, 100)) - ax_f.set_xlim(0, 100) - - ax_f.set_title('Two scales: Fahrenheit and Celsius') - ax_f.set_ylabel('Fahrenheit') - ax_c.set_ylabel('Celsius') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/subplots_axes_and_figures/index.rst.txt b/_sources/examples/subplots_axes_and_figures/index.rst.txt deleted file mode 100644 index 27fee194b05..00000000000 --- a/_sources/examples/subplots_axes_and_figures/index.rst.txt +++ /dev/null @@ -1,16 +0,0 @@ -.. _subplots_axes_and_figures-examples-index: - -############################################## -subplots_axes_and_figures Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - fahrenheit_celsius_scales - subplot_demo diff --git a/_sources/examples/subplots_axes_and_figures/index.txt b/_sources/examples/subplots_axes_and_figures/index.txt deleted file mode 100644 index 27fee194b05..00000000000 --- a/_sources/examples/subplots_axes_and_figures/index.txt +++ /dev/null @@ -1,16 +0,0 @@ -.. _subplots_axes_and_figures-examples-index: - -############################################## -subplots_axes_and_figures Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - fahrenheit_celsius_scales - subplot_demo diff --git a/_sources/examples/subplots_axes_and_figures/subplot_demo.rst.txt b/_sources/examples/subplots_axes_and_figures/subplot_demo.rst.txt deleted file mode 100644 index 41d7eb51328..00000000000 --- a/_sources/examples/subplots_axes_and_figures/subplot_demo.rst.txt +++ /dev/null @@ -1,38 +0,0 @@ -.. _subplots_axes_and_figures-subplot_demo: - -subplots_axes_and_figures example code: subplot_demo.py -======================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/subplots_axes_and_figures/subplot_demo.py - -:: - - """ - Simple demo with multiple subplots. - """ - import numpy as np - import matplotlib.pyplot as plt - - - x1 = np.linspace(0.0, 5.0) - x2 = np.linspace(0.0, 2.0) - - y1 = np.cos(2 * np.pi * x1) * np.exp(-x1) - y2 = np.cos(2 * np.pi * x2) - - plt.subplot(2, 1, 1) - plt.plot(x1, y1, 'o-') - plt.title('A tale of 2 subplots') - plt.ylabel('Damped oscillation') - - plt.subplot(2, 1, 2) - plt.plot(x2, y2, '.-') - plt.xlabel('time (s)') - plt.ylabel('Undamped') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/subplots_axes_and_figures/subplot_demo.txt b/_sources/examples/subplots_axes_and_figures/subplot_demo.txt deleted file mode 100644 index 440b7f8132c..00000000000 --- a/_sources/examples/subplots_axes_and_figures/subplot_demo.txt +++ /dev/null @@ -1,38 +0,0 @@ -.. _subplots_axes_and_figures-subplot_demo: - -subplots_axes_and_figures example code: subplot_demo.py -======================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/subplots_axes_and_figures/subplot_demo.py - -:: - - """ - Simple demo with multiple subplots. - """ - import numpy as np - import matplotlib.pyplot as plt - - - x1 = np.linspace(0.0, 5.0) - x2 = np.linspace(0.0, 2.0) - - y1 = np.cos(2 * np.pi * x1) * np.exp(-x1) - y2 = np.cos(2 * np.pi * x2) - - plt.subplot(2, 1, 1) - plt.plot(x1, y1, 'yo-') - plt.title('A tale of 2 subplots') - plt.ylabel('Damped oscillation') - - plt.subplot(2, 1, 2) - plt.plot(x2, y2, 'r.-') - plt.xlabel('time (s)') - plt.ylabel('Undamped') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/tests/backend_driver.rst.txt b/_sources/examples/tests/backend_driver.rst.txt deleted file mode 100644 index 58954732daf..00000000000 --- a/_sources/examples/tests/backend_driver.rst.txt +++ /dev/null @@ -1,537 +0,0 @@ -.. _tests-backend_driver: - -tests example code: backend_driver.py -===================================== - -[`source code `_] - -:: - - """ - This is used to drive many of the examples across the backends, for - regression testing, and comparing backend efficiency. - - You can specify the backends to be tested either via the --backends - switch, which takes a comma-separated list, or as separate arguments, - e.g. - - python backend_driver.py agg ps - - would test the agg and ps backends. If no arguments are given, a - default list of backends will be tested. - - Interspersed with the backend arguments can be switches for the Python - interpreter executing the tests. If entering such arguments causes an - option parsing error with the driver script, separate them from driver - switches with a --. - """ - - from __future__ import print_function, division - import os - import time - import sys - import glob - from optparse import OptionParser - - import matplotlib.rcsetup as rcsetup - from matplotlib.cbook import Bunch, dedent - - - all_backends = list(rcsetup.all_backends) # to leave the original list alone - - # actual physical directory for each dir - dirs = dict(files=os.path.join('..', 'lines_bars_and_markers'), - shapes=os.path.join('..', 'shapes_and_collections'), - images=os.path.join('..', 'images_contours_and_fields'), - pie=os.path.join('..', 'pie_and_polar_charts'), - text=os.path.join('..', 'text_labels_and_annotations'), - ticks=os.path.join('..', 'ticks_and_spines'), - subplots=os.path.join('..', 'subplots_axes_and_figures'), - specialty=os.path.join('..', 'specialty_plots'), - showcase=os.path.join('..', 'showcase'), - pylab=os.path.join('..', 'pylab_examples'), - api=os.path.join('..', 'api'), - units=os.path.join('..', 'units'), - mplot3d=os.path.join('..', 'mplot3d'), - colors=os.path.join('..', 'color')) - - - # files in each dir - files = dict() - - files['lines'] = [ - 'barh_demo.py', - 'fill_demo.py', - 'fill_demo_features.py', - 'line_demo_dash_control.py', - 'line_styles_reference.py', - 'scatter_with_legend.py' - ] - - files['shapes'] = [ - 'path_patch_demo.py', - 'scatter_demo.py', - ] - - files['colors'] = [ - 'color_cycle_default.py', - 'color_cycle_demo.py', - ] - - files['images'] = [ - 'image_demo.py', - 'contourf_log.py', - ] - - files['statistics'] = [ - 'errorbar_demo.py', - 'errorbar_demo_features.py', - 'histogram_demo_cumulative.py', - 'histogram_demo_features.py', - 'histogram_demo_histtypes.py', - 'histogram_demo_multihist.py', - ] - - files['pie'] = [ - 'pie_demo.py', - 'polar_bar_demo.py', - 'polar_scatter_demo.py', - ] - - files['text_labels_and_annotations'] = [ - 'text_demo_fontdict.py', - 'unicode_demo.py', - ] - - files['ticks_and_spines'] = [ - 'spines_demo_bounds.py', - 'ticklabels_demo_rotation.py', - ] - - files['subplots_axes_and_figures'] = [ - 'subplot_demo.py', - ] - - files['showcase'] = [ - 'integral_demo.py', - ] - - files['pylab'] = [ - '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', - 'axes_demo.py', - 'axes_props.py', - 'axhspan_demo.py', - 'axis_equal_demo.py', - 'bar_stacked.py', - 'barb_demo.py', - 'barchart_demo.py', - 'barcode_demo.py', - 'boxplot_demo.py', - 'broken_barh.py', - 'cohere_demo.py', - 'color_by_yvalue.py', - 'color_demo.py', - 'colorbar_tick_labelling_demo.py', - 'contour_demo.py', - 'contour_image.py', - 'contour_label_demo.py', - 'contourf_demo.py', - 'coords_demo.py', - 'coords_report.py', - 'csd_demo.py', - 'cursor_demo.py', - 'custom_cmap.py', - 'custom_figure_class.py', - 'custom_ticker1.py', - 'customize_rc.py', - 'dashpointlabel.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_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_demo.py', - 'fill_spiral.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', - 'vline_hline_demo.py', - - 'image_clip_path.py', - 'image_demo.py', - 'image_demo2.py', - 'image_interp.py', - 'image_masked.py', - 'image_nonuniform.py', - 'image_origin.py', - 'image_slices_viewer.py', - 'interp_demo.py', - 'invert_axes.py', - 'layer_images.py', - 'legend_demo2.py', - 'legend_demo3.py', - 'line_collection.py', - 'line_collection2.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', - 'matshow.py', - 'mri_demo.py', - 'mri_with_eeg.py', - 'multi_image.py', - 'multiline.py', - 'multiple_figs_demo.py', - 'nan_test.py', - 'newscalarformatter_demo.py', - 'pcolor_demo.py', - 'pcolor_log.py', - 'pcolor_small.py', - 'pie_demo2.py', - 'plotfile_demo.py', - 'polar_demo.py', - 'polar_legend.py', - 'psd_demo.py', - 'psd_demo2.py', - 'psd_demo3.py', - 'quadmesh_demo.py', - 'quiver_demo.py', - 'scatter_custom_symbol.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', - 'simple_plot.py', - 'specgram_demo.py', - 'spine_placement_demo.py', - 'spy_demos.py', - 'stem_plot.py', - 'step_demo.py', - 'stix_fonts_demo.py', - 'subplots_adjust.py', - 'symlog_demo.py', - 'table_demo.py', - 'text_handles.py', - 'text_rotation.py', - 'text_rotation_relative_to_line.py', - 'transoffset.py', - 'xcorr_demo.py', - 'zorder_demo.py', - ] - - - files['api'] = [ - 'agg_oo.py', - 'barchart_demo.py', - 'bbox_intersect.py', - 'collections_demo.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', - 'image_zcoord.py', - 'joinstyle.py', - 'legend_demo.py', - 'line_with_text.py', - 'logo2.py', - 'mathtext_asarray.py', - 'patch_collection.py', - 'quad_bezier.py', - 'scatter_piecharts.py', - 'span_regions.py', - 'two_scales.py', - 'unicode_minus.py', - 'watermark_image.py', - 'watermark_text.py', - ] - - files['units'] = [ - 'annotate_with_units.py', - #'artist_tests.py', # broken, fixme - 'bar_demo2.py', - #'bar_unit_demo.py', # broken, fixme - #'ellipse_with_units.py', # broken, fixme - 'radian_demo.py', - 'units_sample.py', - #'units_scatter.py', # broken, fixme - - ] - - files['mplot3d'] = [ - '2dcollections3d_demo.py', - 'bars3d_demo.py', - 'contour3d_demo.py', - 'contour3d_demo2.py', - 'contourf3d_demo.py', - 'lines3d_demo.py', - 'polys3d_demo.py', - 'scatter3d_demo.py', - 'surface3d_demo.py', - 'surface3d_demo2.py', - 'text3d_demo.py', - 'wire3d_demo.py', - ] - - # dict from dir to files we know we don't want to test (e.g., examples - # not using pyplot, examples requiring user input, animation examples, - # examples that may only work in certain environs (usetex examples?), - # examples that generate multiple figures - - excluded = { - 'pylab': ['__init__.py', 'toggle_images.py', ], - 'units': ['__init__.py', 'date_support.py', ], - } - - - def report_missing(dir, flist): - 'report the py files in dir that are not in flist' - globstr = os.path.join(dir, '*.py') - fnames = glob.glob(globstr) - - pyfiles = set([os.path.split(fullpath)[-1] for fullpath in set(fnames)]) - - exclude = set(excluded.get(dir, [])) - flist = set(flist) - missing = list(pyfiles - flist - exclude) - missing.sort() - if missing: - print('%s files not tested: %s' % (dir, ', '.join(missing))) - - - def report_all_missing(directories): - for f in directories: - report_missing(dirs[f], files[f]) - - - # tests known to fail on a given backend - - failbackend = dict( - svg=('tex_demo.py', ), - agg=('hyperlinks.py', ), - pdf=('hyperlinks.py', ), - ps=('hyperlinks.py', ), - ) - - - try: - import subprocess - - def run(arglist): - try: - ret = subprocess.call(arglist) - except KeyboardInterrupt: - sys.exit() - else: - return ret - except ImportError: - def run(arglist): - os.system(' '.join(arglist)) - - - def drive(backend, directories, python=['python'], switches=[]): - exclude = failbackend.get(backend, []) - - # Clear the destination directory for the examples - path = backend - if os.path.exists(path): - import glob - for fname in os.listdir(path): - os.unlink(os.path.join(path, fname)) - else: - os.mkdir(backend) - failures = [] - - testcases = [os.path.join(dirs[d], fname) - for d in directories - for fname in files[d]] - - for fullpath in testcases: - print('\tdriving %-40s' % (fullpath)) - sys.stdout.flush() - fpath, fname = os.path.split(fullpath) - - if fname in exclude: - print('\tSkipping %s, known to fail on backend: %s' % backend) - continue - - basename, ext = os.path.splitext(fname) - outfile = os.path.join(path, basename) - tmpfile_name = '_tmp_%s.py' % basename - tmpfile = open(tmpfile_name, 'w') - - future_imports = 'from __future__ import division, print_function' - for line in open(fullpath): - line_lstrip = line.lstrip() - if line_lstrip.startswith("#"): - tmpfile.write(line) - elif 'unicode_literals' in line: - future_imports = future_imports + ', unicode_literals' - - tmpfile.writelines(( - future_imports + '\n', - 'import sys\n', - 'sys.path.append("%s")\n' % fpath.replace('\\', '\\\\'), - 'import matplotlib\n', - 'matplotlib.use("%s")\n' % backend, - 'from pylab import savefig\n', - 'import numpy\n', - 'numpy.seterr(invalid="ignore")\n', - )) - for line in open(fullpath): - line_lstrip = line.lstrip() - if (line_lstrip.startswith('from __future__ import') or - line_lstrip.startswith('matplotlib.use') or - line_lstrip.startswith('savefig') or - line_lstrip.startswith('show')): - continue - tmpfile.write(line) - if backend in rcsetup.interactive_bk: - tmpfile.write('show()') - else: - tmpfile.write('\nsavefig(r"%s", dpi=150)' % outfile) - - tmpfile.close() - start_time = time.time() - program = [x % {'name': basename} for x in python] - ret = run(program + [tmpfile_name] + switches) - end_time = time.time() - print("%s %s" % ((end_time - start_time), ret)) - #os.system('%s %s %s' % (python, tmpfile_name, ' '.join(switches))) - os.remove(tmpfile_name) - if ret: - failures.append(fullpath) - return failures - - - def parse_options(): - doc = (__doc__ and __doc__.split('\n\n')) or " " - op = OptionParser(description=doc[0].strip(), - usage='%prog [options] [--] [backends and switches]', - #epilog='\n'.join(doc[1:]) # epilog not supported on my python2.4 machine: JDH - ) - op.disable_interspersed_args() - op.set_defaults(dirs='pylab,api,units,mplot3d', - clean=False, coverage=False, valgrind=False) - op.add_option('-d', '--dirs', '--directories', type='string', - dest='dirs', help=dedent(''' - Run only the tests in these directories; comma-separated list of - one or more of: pylab (or pylab_examples), api, units, mplot3d''')) - op.add_option('-b', '--backends', type='string', dest='backends', - help=dedent(''' - Run tests only for these backends; comma-separated list of - one or more of: agg, ps, svg, pdf, template, cairo, - Default is everything except cairo.''')) - op.add_option('--clean', action='store_true', dest='clean', - help='Remove result directories, run no tests') - op.add_option('-c', '--coverage', action='store_true', dest='coverage', - help='Run in coverage.py') - op.add_option('-v', '--valgrind', action='store_true', dest='valgrind', - help='Run in valgrind') - - options, args = op.parse_args() - switches = [x for x in args if x.startswith('--')] - backends = [x.lower() for x in args if not x.startswith('--')] - if options.backends: - backends += [be.lower() for be in options.backends.split(',')] - - result = Bunch( - dirs=options.dirs.split(','), - backends=backends or ['agg', 'ps', 'svg', 'pdf', 'template'], - clean=options.clean, - coverage=options.coverage, - valgrind=options.valgrind, - switches=switches) - if 'pylab_examples' in result.dirs: - result.dirs[result.dirs.index('pylab_examples')] = 'pylab' - #print(result) - return (result) - - if __name__ == '__main__': - times = {} - failures = {} - options = parse_options() - - if options.clean: - localdirs = [d for d in glob.glob('*') if os.path.isdir(d)] - all_backends_set = set(all_backends) - for d in localdirs: - if d.lower() not in all_backends_set: - continue - print('removing %s' % d) - for fname in glob.glob(os.path.join(d, '*')): - os.remove(fname) - os.rmdir(d) - for fname in glob.glob('_tmp*.py'): - os.remove(fname) - - print('all clean...') - raise SystemExit - if options.coverage: - python = ['coverage.py', '-x'] - elif options.valgrind: - python = ['valgrind', '--tool=memcheck', '--leak-check=yes', - '--log-file=%(name)s', sys.executable] - elif sys.platform == 'win32': - python = [sys.executable] - else: - python = [sys.executable] - - report_all_missing(options.dirs) - for backend in options.backends: - print('testing %s %s' % (backend, ' '.join(options.switches))) - t0 = time.time() - failures[backend] = \ - drive(backend, options.dirs, python, options.switches) - t1 = time.time() - times[backend] = (t1 - t0)/60.0 - - #print(times) - for backend, elapsed in times.items(): - print('Backend %s took %1.2f minutes to complete' % (backend, elapsed)) - failed = failures[backend] - if failed: - print(' Failures: %s' % failed) - if 'template' in times: - print('\ttemplate ratio %1.3f, template residual %1.3f' % ( - elapsed/times['template'], elapsed - times['template'])) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/tests/backend_driver.txt b/_sources/examples/tests/backend_driver.txt deleted file mode 100644 index 73de7a41958..00000000000 --- a/_sources/examples/tests/backend_driver.txt +++ /dev/null @@ -1,542 +0,0 @@ -.. _tests-backend_driver: - -tests example code: backend_driver.py -===================================== - -[`source code `_] - -:: - - #!/usr/bin/env python - - from __future__ import print_function, division - """ - This is used to drive many of the examples across the backends, for - regression testing, and comparing backend efficiency. - - You can specify the backends to be tested either via the --backends - switch, which takes a comma-separated list, or as separate arguments, - e.g. - - python backend_driver.py agg ps - - would test the agg and ps backends. If no arguments are given, a - default list of backends will be tested. - - Interspersed with the backend arguments can be switches for the Python - interpreter executing the tests. If entering such arguments causes an - option parsing error with the driver script, separate them from driver - switches with a --. - """ - - import os - import time - import sys - import glob - from optparse import OptionParser - - import matplotlib.rcsetup as rcsetup - from matplotlib.cbook import Bunch, dedent - - - all_backends = list(rcsetup.all_backends) # to leave the original list alone - - # actual physical directory for each dir - dirs = dict(files=os.path.join('..', 'lines_bars_and_markers'), - shapes=os.path.join('..', 'shapes_and_collections'), - images=os.path.join('..', 'images_contours_and_fields'), - pie=os.path.join('..', 'pie_and_polar_charts'), - text=os.path.join('..', 'text_labels_and_annotations'), - ticks=os.path.join('..', 'ticks_and_spines'), - subplots=os.path.join('..', 'subplots_axes_and_figures'), - specialty=os.path.join('..', 'specialty_plots'), - showcase=os.path.join('..', 'showcase'), - pylab=os.path.join('..', 'pylab_examples'), - api=os.path.join('..', 'api'), - units=os.path.join('..', 'units'), - mplot3d=os.path.join('..', 'mplot3d')) - - - # files in each dir - files = dict() - - files['lines'] = [ - 'barh_demo.py', - 'fill_demo.py', - 'fill_demo_features.py', - 'line_demo_dash_control.py', - 'line_styles_reference.py', - 'scatter_with_legend.py' - ] - - files['shapes'] = [ - 'path_patch_demo.py', - 'scatter_demo.py', - ] - - files['colors'] = [ - 'color_cycle_demo.py', - ] - - files['images'] = [ - 'image_demo.py', - 'contourf_log.py', - ] - - files['statistics'] = [ - 'errorbar_demo.py', - 'errorbar_demo_features.py', - 'histogram_demo_cumulative.py', - 'histogram_demo_features.py', - 'histogram_demo_histtypes.py', - 'histogram_demo_multihist.py', - ] - - files['pie'] = [ - 'pie_demo.py', - 'polar_bar_demo.py', - 'polar_scatter_demo.py', - ] - - files['text_labels_and_annotations'] = [ - 'text_demo_fontdict.py', - 'unicode_demo.py', - ] - - files['ticks_and_spines'] = [ - 'spines_demo_bounds.py', - 'ticklabels_demo_rotation.py', - ] - - files['subplots_axes_and_figures'] = [ - 'subplot_demo.py', - ] - - files['showcase'] = [ - 'integral_demo.py', - ] - - files['pylab'] = [ - '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', - 'axes_demo.py', - 'axes_props.py', - 'axhspan_demo.py', - 'axis_equal_demo.py', - 'bar_stacked.py', - 'barb_demo.py', - 'barchart_demo.py', - 'barcode_demo.py', - 'boxplot_demo.py', - 'broken_barh.py', - 'cohere_demo.py', - 'color_by_yvalue.py', - 'color_demo.py', - 'colorbar_tick_labelling_demo.py', - 'contour_demo.py', - 'contour_image.py', - 'contour_label_demo.py', - 'contourf_demo.py', - 'coords_demo.py', - 'coords_report.py', - 'csd_demo.py', - 'cursor_demo.py', - 'custom_cmap.py', - 'custom_figure_class.py', - 'custom_ticker1.py', - 'customize_rc.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_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_demo.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', - 'vline_hline_demo.py', - - 'image_clip_path.py', - 'image_demo.py', - 'image_demo2.py', - 'image_interp.py', - 'image_masked.py', - 'image_nonuniform.py', - 'image_origin.py', - 'image_slices_viewer.py', - 'interp_demo.py', - 'invert_axes.py', - 'layer_images.py', - 'legend_demo2.py', - 'legend_demo3.py', - 'line_collection.py', - 'line_collection2.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', - 'nan_test.py', - 'newscalarformatter_demo.py', - 'pcolor_demo.py', - 'pcolor_log.py', - 'pcolor_small.py', - 'pie_demo2.py', - 'plotfile_demo.py', - 'polar_demo.py', - 'polar_legend.py', - 'psd_demo.py', - 'psd_demo2.py', - 'psd_demo3.py', - 'quadmesh_demo.py', - 'quiver_demo.py', - 'scatter_custom_symbol.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', - 'simple_plot.py', - 'specgram_demo.py', - 'spine_placement_demo.py', - 'spy_demos.py', - 'stem_plot.py', - 'step_demo.py', - 'stix_fonts_demo.py', - 'stock_demo.py', - 'subplots_adjust.py', - 'symlog_demo.py', - 'table_demo.py', - 'text_handles.py', - 'text_rotation.py', - 'text_rotation_relative_to_line.py', - 'transoffset.py', - 'xcorr_demo.py', - 'zorder_demo.py', - ] - - - files['api'] = [ - 'agg_oo.py', - 'barchart_demo.py', - 'bbox_intersect.py', - 'collections_demo.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', - 'image_zcoord.py', - 'joinstyle.py', - 'legend_demo.py', - 'line_with_text.py', - 'logo2.py', - 'mathtext_asarray.py', - 'patch_collection.py', - 'quad_bezier.py', - 'scatter_piecharts.py', - 'span_regions.py', - 'two_scales.py', - 'unicode_minus.py', - 'watermark_image.py', - 'watermark_text.py', - ] - - files['units'] = [ - 'annotate_with_units.py', - #'artist_tests.py', # broken, fixme - 'bar_demo2.py', - #'bar_unit_demo.py', # broken, fixme - #'ellipse_with_units.py', # broken, fixme - 'radian_demo.py', - 'units_sample.py', - #'units_scatter.py', # broken, fixme - - ] - - files['mplot3d'] = [ - '2dcollections3d_demo.py', - 'bars3d_demo.py', - 'contour3d_demo.py', - 'contour3d_demo2.py', - 'contourf3d_demo.py', - 'lines3d_demo.py', - 'polys3d_demo.py', - 'scatter3d_demo.py', - 'surface3d_demo.py', - 'surface3d_demo2.py', - 'text3d_demo.py', - 'wire3d_demo.py', - ] - - # dict from dir to files we know we don't want to test (e.g., examples - # not using pyplot, examples requiring user input, animation examples, - # examples that may only work in certain environs (usetex examples?), - # examples that generate multiple figures - - excluded = { - 'pylab': ['__init__.py', 'toggle_images.py', ], - 'units': ['__init__.py', 'date_support.py', ], - } - - - def report_missing(dir, flist): - 'report the py files in dir that are not in flist' - globstr = os.path.join(dir, '*.py') - fnames = glob.glob(globstr) - - pyfiles = set([os.path.split(fullpath)[-1] for fullpath in set(fnames)]) - - exclude = set(excluded.get(dir, [])) - flist = set(flist) - missing = list(pyfiles - flist - exclude) - missing.sort() - if missing: - print('%s files not tested: %s' % (dir, ', '.join(missing))) - - - def report_all_missing(directories): - for f in directories: - report_missing(dirs[f], files[f]) - - - # tests known to fail on a given backend - - failbackend = dict( - svg=('tex_demo.py', ), - agg=('hyperlinks.py', ), - pdf=('hyperlinks.py', ), - ps=('hyperlinks.py', ), - ) - - - try: - import subprocess - - def run(arglist): - try: - ret = subprocess.call(arglist) - except KeyboardInterrupt: - sys.exit() - else: - return ret - except ImportError: - def run(arglist): - os.system(' '.join(arglist)) - - - def drive(backend, directories, python=['python'], switches=[]): - exclude = failbackend.get(backend, []) - - # Clear the destination directory for the examples - path = backend - if os.path.exists(path): - import glob - for fname in os.listdir(path): - os.unlink(os.path.join(path, fname)) - else: - os.mkdir(backend) - failures = [] - - testcases = [os.path.join(dirs[d], fname) - for d in directories - for fname in files[d]] - - for fullpath in testcases: - print('\tdriving %-40s' % (fullpath)) - sys.stdout.flush() - fpath, fname = os.path.split(fullpath) - - if fname in exclude: - print('\tSkipping %s, known to fail on backend: %s' % backend) - continue - - basename, ext = os.path.splitext(fname) - outfile = os.path.join(path, basename) - tmpfile_name = '_tmp_%s.py' % basename - tmpfile = open(tmpfile_name, 'w') - - future_imports = 'from __future__ import division, print_function' - for line in open(fullpath): - line_lstrip = line.lstrip() - if line_lstrip.startswith("#"): - tmpfile.write(line) - elif 'unicode_literals' in line: - future_imports = future_imports + ', unicode_literals' - - tmpfile.writelines(( - future_imports + '\n', - 'import sys\n', - 'sys.path.append("%s")\n' % fpath.replace('\\', '\\\\'), - 'import matplotlib\n', - 'matplotlib.use("%s")\n' % backend, - 'from pylab import savefig\n', - 'import numpy\n', - 'numpy.seterr(invalid="ignore")\n', - )) - for line in open(fullpath): - line_lstrip = line.lstrip() - if (line_lstrip.startswith('from __future__ import') or - line_lstrip.startswith('matplotlib.use') or - line_lstrip.startswith('savefig') or - line_lstrip.startswith('show')): - continue - tmpfile.write(line) - if backend in rcsetup.interactive_bk: - tmpfile.write('show()') - else: - tmpfile.write('\nsavefig(r"%s", dpi=150)' % outfile) - - tmpfile.close() - start_time = time.time() - program = [x % {'name': basename} for x in python] - ret = run(program + [tmpfile_name] + switches) - end_time = time.time() - print("%s %s" % ((end_time - start_time), ret)) - #os.system('%s %s %s' % (python, tmpfile_name, ' '.join(switches))) - os.remove(tmpfile_name) - if ret: - failures.append(fullpath) - return failures - - - def parse_options(): - doc = (__doc__ and __doc__.split('\n\n')) or " " - op = OptionParser(description=doc[0].strip(), - usage='%prog [options] [--] [backends and switches]', - #epilog='\n'.join(doc[1:]) # epilog not supported on my python2.4 machine: JDH - ) - op.disable_interspersed_args() - op.set_defaults(dirs='pylab,api,units,mplot3d', - clean=False, coverage=False, valgrind=False) - op.add_option('-d', '--dirs', '--directories', type='string', - dest='dirs', help=dedent(''' - Run only the tests in these directories; comma-separated list of - one or more of: pylab (or pylab_examples), api, units, mplot3d''')) - op.add_option('-b', '--backends', type='string', dest='backends', - help=dedent(''' - Run tests only for these backends; comma-separated list of - one or more of: agg, ps, svg, pdf, template, cairo, - Default is everything except cairo.''')) - op.add_option('--clean', action='store_true', dest='clean', - help='Remove result directories, run no tests') - op.add_option('-c', '--coverage', action='store_true', dest='coverage', - help='Run in coverage.py') - op.add_option('-v', '--valgrind', action='store_true', dest='valgrind', - help='Run in valgrind') - - options, args = op.parse_args() - switches = [x for x in args if x.startswith('--')] - backends = [x.lower() for x in args if not x.startswith('--')] - if options.backends: - backends += [be.lower() for be in options.backends.split(',')] - - result = Bunch( - dirs=options.dirs.split(','), - backends=backends or ['agg', 'ps', 'svg', 'pdf', 'template'], - clean=options.clean, - coverage=options.coverage, - valgrind=options.valgrind, - switches=switches) - if 'pylab_examples' in result.dirs: - result.dirs[result.dirs.index('pylab_examples')] = 'pylab' - #print(result) - return (result) - - if __name__ == '__main__': - times = {} - failures = {} - options = parse_options() - - if options.clean: - localdirs = [d for d in glob.glob('*') if os.path.isdir(d)] - all_backends_set = set(all_backends) - for d in localdirs: - if d.lower() not in all_backends_set: - continue - print('removing %s' % d) - for fname in glob.glob(os.path.join(d, '*')): - os.remove(fname) - os.rmdir(d) - for fname in glob.glob('_tmp*.py'): - os.remove(fname) - - print('all clean...') - raise SystemExit - if options.coverage: - python = ['coverage.py', '-x'] - elif options.valgrind: - python = ['valgrind', '--tool=memcheck', '--leak-check=yes', - '--log-file=%(name)s', sys.executable] - elif sys.platform == 'win32': - python = [sys.executable] - else: - python = [sys.executable] - - report_all_missing(options.dirs) - for backend in options.backends: - print('testing %s %s' % (backend, ' '.join(options.switches))) - t0 = time.time() - failures[backend] = \ - drive(backend, options.dirs, python, options.switches) - t1 = time.time() - times[backend] = (t1 - t0)/60.0 - - #print(times) - for backend, elapsed in times.items(): - print('Backend %s took %1.2f minutes to complete' % (backend, elapsed)) - failed = failures[backend] - if failed: - print(' Failures: %s' % failed) - if 'template' in times: - print('\ttemplate ratio %1.3f, template residual %1.3f' % ( - elapsed/times['template'], elapsed - times['template'])) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/tests/index.rst.txt b/_sources/examples/tests/index.rst.txt deleted file mode 100644 index 67b1b43b5d4..00000000000 --- a/_sources/examples/tests/index.rst.txt +++ /dev/null @@ -1,15 +0,0 @@ -.. _tests-examples-index: - -############################################## -tests Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - backend_driver diff --git a/_sources/examples/tests/index.txt b/_sources/examples/tests/index.txt deleted file mode 100644 index 67b1b43b5d4..00000000000 --- a/_sources/examples/tests/index.txt +++ /dev/null @@ -1,15 +0,0 @@ -.. _tests-examples-index: - -############################################## -tests Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - backend_driver diff --git a/_sources/examples/text_labels_and_annotations/autowrap_demo.rst.txt b/_sources/examples/text_labels_and_annotations/autowrap_demo.rst.txt deleted file mode 100644 index 89f0968e5e9..00000000000 --- a/_sources/examples/text_labels_and_annotations/autowrap_demo.rst.txt +++ /dev/null @@ -1,39 +0,0 @@ -.. _text_labels_and_annotations-autowrap_demo: - -text_labels_and_annotations example code: autowrap_demo.py -========================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/text_labels_and_annotations/autowrap_demo.py - -:: - - """ - ================== - Auto-wrapping text - ================== - - Matplotlib can wrap text automatically, but if it's too long, the text will be - displayed slightly outside of the boundaries of the axis anyways. - """ - - import matplotlib.pyplot as plt - - fig = plt.figure() - plt.axis([0, 10, 0, 10]) - t = "This is a really long string that I'd rather have wrapped so that it"\ - " doesn't go outside of the figure, but if it's long enough it will go"\ - " off the top or bottom!" - plt.text(4, 1, t, ha='left', rotation=15, wrap=True) - plt.text(6, 5, t, ha='left', rotation=15, wrap=True) - plt.text(5, 5, t, ha='right', rotation=-15, wrap=True) - plt.text(5, 10, t, fontsize=18, style='oblique', ha='center', - va='top', wrap=True) - plt.text(3, 4, t, family='serif', style='italic', ha='right', wrap=True) - plt.text(-1, 0, t, ha='left', rotation=-15, wrap=True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/text_labels_and_annotations/autowrap_demo.txt b/_sources/examples/text_labels_and_annotations/autowrap_demo.txt deleted file mode 100644 index 43b15faf7be..00000000000 --- a/_sources/examples/text_labels_and_annotations/autowrap_demo.txt +++ /dev/null @@ -1,33 +0,0 @@ -.. _text_labels_and_annotations-autowrap_demo: - -text_labels_and_annotations example code: autowrap_demo.py -========================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/text_labels_and_annotations/autowrap_demo.py - -:: - - """ - Auto-wrapping text demo. - """ - import matplotlib.pyplot as plt - - fig = plt.figure() - plt.axis([0, 10, 0, 10]) - t = "This is a really long string that I'd rather have wrapped so that it"\ - " doesn't go outside of the figure, but if it's long enough it will go"\ - " off the top or bottom!" - plt.text(4, 1, t, ha='left', rotation=15, wrap=True) - plt.text(6, 5, t, ha='left', rotation=15, wrap=True) - plt.text(5, 5, t, ha='right', rotation=-15, wrap=True) - plt.text(5, 10, t, fontsize=18, style='oblique', ha='center', - va='top', wrap=True) - plt.text(3, 4, t, family='serif', style='italic', ha='right', wrap=True) - plt.text(-1, 0, t, ha='left', rotation=-15, wrap=True) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/text_labels_and_annotations/index.rst.txt b/_sources/examples/text_labels_and_annotations/index.rst.txt deleted file mode 100644 index f5d926b2030..00000000000 --- a/_sources/examples/text_labels_and_annotations/index.rst.txt +++ /dev/null @@ -1,18 +0,0 @@ -.. _text_labels_and_annotations-examples-index: - -############################################## -text_labels_and_annotations Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - autowrap_demo - rainbow_text - text_demo_fontdict - unicode_demo diff --git a/_sources/examples/text_labels_and_annotations/index.txt b/_sources/examples/text_labels_and_annotations/index.txt deleted file mode 100644 index f5d926b2030..00000000000 --- a/_sources/examples/text_labels_and_annotations/index.txt +++ /dev/null @@ -1,18 +0,0 @@ -.. _text_labels_and_annotations-examples-index: - -############################################## -text_labels_and_annotations Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - autowrap_demo - rainbow_text - text_demo_fontdict - unicode_demo diff --git a/_sources/examples/text_labels_and_annotations/rainbow_text.rst.txt b/_sources/examples/text_labels_and_annotations/rainbow_text.rst.txt deleted file mode 100644 index cb40e903553..00000000000 --- a/_sources/examples/text_labels_and_annotations/rainbow_text.rst.txt +++ /dev/null @@ -1,76 +0,0 @@ -.. _text_labels_and_annotations-rainbow_text: - -text_labels_and_annotations example code: rainbow_text.py -========================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/text_labels_and_annotations/rainbow_text.py - -:: - - # -*- coding: utf-8 -*- - """ - The example shows how to string together several text objects. - - HISTORY - ------- - On the matplotlib-users list back in February 2012, Gökhan Sever asked the - following question: - - Is there a way in matplotlib to partially specify the color of a string? - - Example: - - plt.ylabel("Today is cloudy.") - How can I show "today" as red, "is" as green and "cloudy." as blue? - - Thanks. - - Paul Ivanov responded with this answer: - """ - import matplotlib.pyplot as plt - from matplotlib import transforms - - - def rainbow_text(x, y, strings, colors, ax=None, **kw): - """ - Take a list of ``strings`` and ``colors`` and place them next to each - other, with text strings[i] being shown in colors[i]. - - This example shows how to do both vertical and horizontal text, and will - pass all keyword arguments to plt.text, so you can set the font size, - family, etc. - - The text will get added to the ``ax`` axes, if provided, otherwise the - currently active axes will be used. - """ - if ax is None: - ax = plt.gca() - t = ax.transData - canvas = ax.figure.canvas - - # horizontal version - for s, c in zip(strings, colors): - text = ax.text(x, y, s + " ", color=c, transform=t, **kw) - text.draw(canvas.get_renderer()) - ex = text.get_window_extent() - t = transforms.offset_copy(text._transform, x=ex.width, units='dots') - - # vertical version - for s, c in zip(strings, colors): - text = ax.text(x, y, s + " ", color=c, transform=t, - rotation=90, va='bottom', ha='center', **kw) - text.draw(canvas.get_renderer()) - ex = text.get_window_extent() - t = transforms.offset_copy(text._transform, y=ex.height, units='dots') - - - rainbow_text(0, 0, "all unicorns poop rainbows ! ! !".split(), - ['red', 'cyan', 'brown', 'green', 'blue', 'purple', 'black'], - size=16) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/text_labels_and_annotations/rainbow_text.txt b/_sources/examples/text_labels_and_annotations/rainbow_text.txt deleted file mode 100644 index a73a228cac8..00000000000 --- a/_sources/examples/text_labels_and_annotations/rainbow_text.txt +++ /dev/null @@ -1,76 +0,0 @@ -.. _text_labels_and_annotations-rainbow_text: - -text_labels_and_annotations example code: rainbow_text.py -========================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/text_labels_and_annotations/rainbow_text.py - -:: - - # -*- coding: utf-8 -*- - """ - The example shows how to string together several text objects. - - HISTORY - ------- - On the matplotlib-users list back in February 2012, Gökhan Sever asked the - following question: - - Is there a way in matplotlib to partially specify the color of a string? - - Example: - - plt.ylabel("Today is cloudy.") - How can I show "today" as red, "is" as green and "cloudy." as blue? - - Thanks. - - Paul Ivanov responded with this answer: - """ - import matplotlib.pyplot as plt - from matplotlib import transforms - - - def rainbow_text(x, y, strings, colors, ax=None, **kw): - """ - Take a list of ``strings`` and ``colors`` and place them next to each - other, with text strings[i] being shown in colors[i]. - - This example shows how to do both vertical and horizontal text, and will - pass all keyword arguments to plt.text, so you can set the font size, - family, etc. - - The text will get added to the ``ax`` axes, if provided, otherwise the - currently active axes will be used. - """ - if ax is None: - ax = plt.gca() - t = ax.transData - canvas = ax.figure.canvas - - # horizontal version - for s, c in zip(strings, colors): - text = ax.text(x, y, " " + s + " ", color=c, transform=t, **kw) - text.draw(canvas.get_renderer()) - ex = text.get_window_extent() - t = transforms.offset_copy(text._transform, x=ex.width, units='dots') - - # vertical version - for s, c in zip(strings, colors): - text = ax.text(x, y, " " + s + " ", color=c, transform=t, - rotation=90, va='bottom', ha='center', **kw) - text.draw(canvas.get_renderer()) - ex = text.get_window_extent() - t = transforms.offset_copy(text._transform, y=ex.height, units='dots') - - - rainbow_text(0, 0, "all unicorns poop rainbows ! ! !".split(), - ['red', 'cyan', 'brown', 'green', 'blue', 'purple', 'black'], - size=18) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/text_labels_and_annotations/text_demo_fontdict.rst.txt b/_sources/examples/text_labels_and_annotations/text_demo_fontdict.rst.txt deleted file mode 100644 index 29d0d3d89ef..00000000000 --- a/_sources/examples/text_labels_and_annotations/text_demo_fontdict.rst.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _text_labels_and_annotations-text_demo_fontdict: - -text_labels_and_annotations example code: text_demo_fontdict.py -=============================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/text_labels_and_annotations/text_demo_fontdict.py - -:: - - """ - ======================================================= - Controlling style of text and labels using a dictionary - ======================================================= - - This example shows how to share parameters across many text objects and labels - by creating a dictionary of options passed across several functions. - """ - - import numpy as np - import matplotlib.pyplot as plt - - - font = {'family': 'serif', - 'color': 'darkred', - 'weight': 'normal', - 'size': 16, - } - - x = np.linspace(0.0, 5.0, 100) - y = np.cos(2*np.pi*x) * np.exp(-x) - - plt.plot(x, y, 'k') - plt.title('Damped exponential decay', fontdict=font) - plt.text(2, 0.65, r'$\cos(2 \pi t) \exp(-t)$', fontdict=font) - plt.xlabel('time (s)', fontdict=font) - plt.ylabel('voltage (mV)', fontdict=font) - - # Tweak spacing to prevent clipping of ylabel - plt.subplots_adjust(left=0.15) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/text_labels_and_annotations/text_demo_fontdict.txt b/_sources/examples/text_labels_and_annotations/text_demo_fontdict.txt deleted file mode 100644 index 22f6daa3e4e..00000000000 --- a/_sources/examples/text_labels_and_annotations/text_demo_fontdict.txt +++ /dev/null @@ -1,39 +0,0 @@ -.. _text_labels_and_annotations-text_demo_fontdict: - -text_labels_and_annotations example code: text_demo_fontdict.py -=============================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/text_labels_and_annotations/text_demo_fontdict.py - -:: - - """ - Demo using fontdict to control style of text and labels. - """ - import numpy as np - import matplotlib.pyplot as plt - - - font = {'family': 'serif', - 'color': 'darkred', - 'weight': 'normal', - 'size': 16, - } - - x = np.linspace(0.0, 5.0, 100) - y = np.cos(2*np.pi*x) * np.exp(-x) - - plt.plot(x, y, 'k') - plt.title('Damped exponential decay', fontdict=font) - plt.text(2, 0.65, r'$\cos(2 \pi t) \exp(-t)$', fontdict=font) - plt.xlabel('time (s)', fontdict=font) - plt.ylabel('voltage (mV)', fontdict=font) - - # Tweak spacing to prevent clipping of ylabel - plt.subplots_adjust(left=0.15) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/text_labels_and_annotations/unicode_demo.rst.txt b/_sources/examples/text_labels_and_annotations/unicode_demo.rst.txt deleted file mode 100644 index 944df8e6111..00000000000 --- a/_sources/examples/text_labels_and_annotations/unicode_demo.rst.txt +++ /dev/null @@ -1,30 +0,0 @@ -.. _text_labels_and_annotations-unicode_demo: - -text_labels_and_annotations example code: unicode_demo.py -========================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/text_labels_and_annotations/unicode_demo.py - -:: - - # -*- coding: utf-8 -*- - """ - Demo of unicode support in text and labels. - """ - from __future__ import unicode_literals - - import matplotlib.pyplot as plt - - - plt.title('Développés et fabriqués') - plt.xlabel("réactivité nous permettent d'être sélectionnés et adoptés") - plt.ylabel('André was here!') - plt.text(0.2, 0.8, 'Institut für Festkörperphysik', rotation=45) - plt.text(0.4, 0.2, 'AVA (check kerning)') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/text_labels_and_annotations/unicode_demo.txt b/_sources/examples/text_labels_and_annotations/unicode_demo.txt deleted file mode 100644 index b26e9ad140b..00000000000 --- a/_sources/examples/text_labels_and_annotations/unicode_demo.txt +++ /dev/null @@ -1,30 +0,0 @@ -.. _text_labels_and_annotations-unicode_demo: - -text_labels_and_annotations example code: unicode_demo.py -========================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/text_labels_and_annotations/unicode_demo.py - -:: - - # -*- coding: utf-8 -*- - """ - Demo of unicode support in text and labels. - """ - from __future__ import unicode_literals - - import matplotlib.pyplot as plt - - - plt.title('Développés et fabriqués') - plt.xlabel("réactivité nous permettent d'être sélectionnés et adoptés") - plt.ylabel('André was here!') - plt.text(0.2, 0.8, 'Institut für Festkörperphysik', rotation=45) - plt.text(0.4, 0.2, 'AVA (check kerning)') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/ticks_and_spines/index.rst.txt b/_sources/examples/ticks_and_spines/index.rst.txt deleted file mode 100644 index 0ff04e66f56..00000000000 --- a/_sources/examples/ticks_and_spines/index.rst.txt +++ /dev/null @@ -1,21 +0,0 @@ -.. _ticks_and_spines-examples-index: - -############################################## -ticks_and_spines Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - spines_demo - spines_demo_bounds - spines_demo_dropped - tick-formatters - tick-locators - tick_labels_from_values - ticklabels_demo_rotation diff --git a/_sources/examples/ticks_and_spines/index.txt b/_sources/examples/ticks_and_spines/index.txt deleted file mode 100644 index af53d9137c0..00000000000 --- a/_sources/examples/ticks_and_spines/index.txt +++ /dev/null @@ -1,19 +0,0 @@ -.. _ticks_and_spines-examples-index: - -############################################## -ticks_and_spines Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - spines_demo - spines_demo_bounds - spines_demo_dropped - tick_labels_from_values - ticklabels_demo_rotation diff --git a/_sources/examples/ticks_and_spines/spines_demo.rst.txt b/_sources/examples/ticks_and_spines/spines_demo.rst.txt deleted file mode 100644 index b34e8d8e479..00000000000 --- a/_sources/examples/ticks_and_spines/spines_demo.rst.txt +++ /dev/null @@ -1,60 +0,0 @@ -.. _ticks_and_spines-spines_demo: - -ticks_and_spines example code: spines_demo.py -============================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/ticks_and_spines/spines_demo.py - -:: - - """ - ====== - Spines - ====== - - This demo compares: - - normal axes, with spines on all four sides; - - an axes with spines only on the left and bottom; - - an axes using custom bounds to limit the extent of the spine. - """ - import numpy as np - import matplotlib.pyplot as plt - - - x = np.linspace(0, 2 * np.pi, 100) - y = 2 * np.sin(x) - - fig, (ax0, ax1, ax2) = plt.subplots(nrows=3) - - ax0.plot(x, y) - ax0.set_title('normal spines') - - ax1.plot(x, y) - ax1.set_title('bottom-left spines') - - # Hide the right and top spines - ax1.spines['right'].set_visible(False) - ax1.spines['top'].set_visible(False) - # Only show ticks on the left and bottom spines - ax1.yaxis.set_ticks_position('left') - ax1.xaxis.set_ticks_position('bottom') - - ax2.plot(x, y) - - # Only draw spine between the y-ticks - ax2.spines['left'].set_bounds(-1, 1) - # Hide the right and top spines - ax2.spines['right'].set_visible(False) - ax2.spines['top'].set_visible(False) - # Only show ticks on the left and bottom spines - ax2.yaxis.set_ticks_position('left') - ax2.xaxis.set_ticks_position('bottom') - - # Tweak spacing between subplots to prevent labels from overlapping - plt.subplots_adjust(hspace=0.5) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/ticks_and_spines/spines_demo.txt b/_sources/examples/ticks_and_spines/spines_demo.txt deleted file mode 100644 index 9f802d4a2d7..00000000000 --- a/_sources/examples/ticks_and_spines/spines_demo.txt +++ /dev/null @@ -1,46 +0,0 @@ -.. _ticks_and_spines-spines_demo: - -ticks_and_spines example code: spines_demo.py -============================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/ticks_and_spines/spines_demo.py - -:: - - """ - Basic demo of axis spines. - - This demo compares a normal axes, with spines on all four sides, and an axes - with spines only on the left and bottom. - """ - import numpy as np - import matplotlib.pyplot as plt - - - x = np.linspace(0, 2 * np.pi, 100) - y = 2 * np.sin(x) - - fig, (ax0, ax1) = plt.subplots(nrows=2) - - ax0.plot(x, y) - ax0.set_title('normal spines') - - ax1.plot(x, y) - ax1.set_title('bottom-left spines') - - # Hide the right and top spines - ax1.spines['right'].set_visible(False) - ax1.spines['top'].set_visible(False) - # Only show ticks on the left and bottom spines - ax1.yaxis.set_ticks_position('left') - ax1.xaxis.set_ticks_position('bottom') - - # Tweak spacing between subplots to prevent labels from overlapping - plt.subplots_adjust(hspace=0.5) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/ticks_and_spines/spines_demo_bounds.rst.txt b/_sources/examples/ticks_and_spines/spines_demo_bounds.rst.txt deleted file mode 100644 index d07d580ac75..00000000000 --- a/_sources/examples/ticks_and_spines/spines_demo_bounds.rst.txt +++ /dev/null @@ -1,46 +0,0 @@ -.. _ticks_and_spines-spines_demo_bounds: - -ticks_and_spines example code: spines_demo_bounds.py -==================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/ticks_and_spines/spines_demo_bounds.py - -:: - - """ - Demo of spines using custom bounds to limit the extent of the spine. - """ - import numpy as np - import matplotlib.pyplot as plt - - - x = np.linspace(0, 2*np.pi, 50) - y = np.sin(x) - y2 = y + 0.1 * np.random.normal(size=x.shape) - - fig, ax = plt.subplots() - ax.plot(x, y, 'k--') - ax.plot(x, y2, 'ro') - - # set ticks and tick labels - ax.set_xlim((0, 2*np.pi)) - ax.set_xticks([0, np.pi, 2*np.pi]) - ax.set_xticklabels(['0', '$\pi$', '2$\pi$']) - ax.set_ylim((-1.5, 1.5)) - ax.set_yticks([-1, 0, 1]) - - # Only draw spine between the y-ticks - ax.spines['left'].set_bounds(-1, 1) - # Hide the right and top spines - ax.spines['right'].set_visible(False) - ax.spines['top'].set_visible(False) - # Only show ticks on the left and bottom spines - ax.yaxis.set_ticks_position('left') - ax.xaxis.set_ticks_position('bottom') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/ticks_and_spines/spines_demo_bounds.txt b/_sources/examples/ticks_and_spines/spines_demo_bounds.txt deleted file mode 100644 index 334ff84a083..00000000000 --- a/_sources/examples/ticks_and_spines/spines_demo_bounds.txt +++ /dev/null @@ -1,46 +0,0 @@ -.. _ticks_and_spines-spines_demo_bounds: - -ticks_and_spines example code: spines_demo_bounds.py -==================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/ticks_and_spines/spines_demo_bounds.py - -:: - - """ - Demo of spines using custom bounds to limit the extent of the spine. - """ - import numpy as np - import matplotlib.pyplot as plt - - - x = np.linspace(0, 2*np.pi, 50) - y = np.sin(x) - y2 = y + 0.1 * np.random.normal(size=x.shape) - - fig, ax = plt.subplots() - ax.plot(x, y, 'k--') - ax.plot(x, y2, 'ro') - - # set ticks and tick labels - ax.set_xlim((0, 2*np.pi)) - ax.set_xticks([0, np.pi, 2*np.pi]) - ax.set_xticklabels(['0', '$\pi$', '2$\pi$']) - ax.set_ylim((-1.5, 1.5)) - ax.set_yticks([-1, 0, 1]) - - # Only draw spine between the y-ticks - ax.spines['left'].set_bounds(-1, 1) - # Hide the right and top spines - ax.spines['right'].set_visible(False) - ax.spines['top'].set_visible(False) - # Only show ticks on the left and bottom spines - ax.yaxis.set_ticks_position('left') - ax.xaxis.set_ticks_position('bottom') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/ticks_and_spines/spines_demo_dropped.rst.txt b/_sources/examples/ticks_and_spines/spines_demo_dropped.rst.txt deleted file mode 100644 index 0e6f15df784..00000000000 --- a/_sources/examples/ticks_and_spines/spines_demo_dropped.rst.txt +++ /dev/null @@ -1,42 +0,0 @@ -.. _ticks_and_spines-spines_demo_dropped: - -ticks_and_spines example code: spines_demo_dropped.py -===================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/ticks_and_spines/spines_demo_dropped.py - -:: - - """ - ============== - Dropped spines - ============== - - Demo of spines offset from the axes (a.k.a. "dropped spines"). - """ - import numpy as np - import matplotlib.pyplot as plt - - - fig, ax = plt.subplots() - - image = np.random.uniform(size=(10, 10)) - ax.imshow(image, cmap=plt.cm.gray, interpolation='nearest') - ax.set_title('dropped spines') - - # Move left and bottom spines outward by 10 points - ax.spines['left'].set_position(('outward', 10)) - ax.spines['bottom'].set_position(('outward', 10)) - # Hide the right and top spines - ax.spines['right'].set_visible(False) - ax.spines['top'].set_visible(False) - # Only show ticks on the left and bottom spines - ax.yaxis.set_ticks_position('left') - ax.xaxis.set_ticks_position('bottom') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/ticks_and_spines/spines_demo_dropped.txt b/_sources/examples/ticks_and_spines/spines_demo_dropped.txt deleted file mode 100644 index 81540207ada..00000000000 --- a/_sources/examples/ticks_and_spines/spines_demo_dropped.txt +++ /dev/null @@ -1,38 +0,0 @@ -.. _ticks_and_spines-spines_demo_dropped: - -ticks_and_spines example code: spines_demo_dropped.py -===================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/ticks_and_spines/spines_demo_dropped.py - -:: - - """ - Demo of spines offset from the axes (a.k.a. "dropped spines"). - """ - import numpy as np - import matplotlib.pyplot as plt - - - fig, ax = plt.subplots() - - image = np.random.uniform(size=(10, 10)) - ax.imshow(image, cmap=plt.cm.gray, interpolation='nearest') - ax.set_title('dropped spines') - - # Move left and bottom spines outward by 10 points - ax.spines['left'].set_position(('outward', 10)) - ax.spines['bottom'].set_position(('outward', 10)) - # Hide the right and top spines - ax.spines['right'].set_visible(False) - ax.spines['top'].set_visible(False) - # Only show ticks on the left and bottom spines - ax.yaxis.set_ticks_position('left') - ax.xaxis.set_ticks_position('bottom') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/ticks_and_spines/tick-formatters.rst.txt b/_sources/examples/ticks_and_spines/tick-formatters.rst.txt deleted file mode 100644 index c404629e1d0..00000000000 --- a/_sources/examples/ticks_and_spines/tick-formatters.rst.txt +++ /dev/null @@ -1,112 +0,0 @@ -.. _ticks_and_spines-tick-formatters: - -ticks_and_spines example code: tick-formatters.py -================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/ticks_and_spines/tick-formatters.py - -:: - - """ - =============== - Tick formatters - =============== - - Show the different tick formatters. - """ - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.ticker as ticker - - - # Setup a plot such that only the bottom spine is shown - def setup(ax): - ax.spines['right'].set_color('none') - ax.spines['left'].set_color('none') - ax.yaxis.set_major_locator(ticker.NullLocator()) - ax.spines['top'].set_color('none') - ax.xaxis.set_ticks_position('bottom') - ax.tick_params(which='major', width=1.00, length=5) - ax.tick_params(which='minor', width=0.75, length=2.5, labelsize=10) - ax.set_xlim(0, 5) - ax.set_ylim(0, 1) - ax.patch.set_alpha(0.0) - - - plt.figure(figsize=(8, 5)) - n = 6 - - # Null formatter - ax = plt.subplot(n, 1, 1) - setup(ax) - ax.xaxis.set_major_locator(ticker.MultipleLocator(1.00)) - ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.25)) - ax.xaxis.set_major_formatter(ticker.NullFormatter()) - ax.xaxis.set_minor_formatter(ticker.NullFormatter()) - ax.text(0.0, 0.1, "NullFormatter()", fontsize=16, transform=ax.transAxes) - - # Fixed formatter - ax = plt.subplot(n, 1, 2) - setup(ax) - ax.xaxis.set_major_locator(ticker.MultipleLocator(1.0)) - ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.25)) - majors = ["", "0", "1", "2", "3", "4", "5"] - ax.xaxis.set_major_formatter(ticker.FixedFormatter(majors)) - minors = [""] + ["%.2f" % (x-int(x)) if (x-int(x)) - else "" for x in np.arange(0, 5, 0.25)] - ax.xaxis.set_minor_formatter(ticker.FixedFormatter(minors)) - ax.text(0.0, 0.1, "FixedFormatter(['', '0', '1', ...])", - fontsize=15, transform=ax.transAxes) - - - # Func formatter - def major_formatter(x, pos): - return "[%.2f]" % x - - - ax = plt.subplot(n, 1, 3) - setup(ax) - ax.xaxis.set_major_locator(ticker.MultipleLocator(1.00)) - ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.25)) - ax.xaxis.set_major_formatter(ticker.FuncFormatter(major_formatter)) - ax.text(0.0, 0.1, 'FuncFormatter(lambda x, pos: "[%.2f]" % x)', - fontsize=15, transform=ax.transAxes) - - - # FormatStr formatter - ax = plt.subplot(n, 1, 4) - setup(ax) - ax.xaxis.set_major_locator(ticker.MultipleLocator(1.00)) - ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.25)) - ax.xaxis.set_major_formatter(ticker.FormatStrFormatter(">%d<")) - ax.text(0.0, 0.1, "FormatStrFormatter('>%d<')", - fontsize=15, transform=ax.transAxes) - - # Scalar formatter - ax = plt.subplot(n, 1, 5) - setup(ax) - ax.xaxis.set_major_locator(ticker.AutoLocator()) - ax.xaxis.set_minor_locator(ticker.AutoMinorLocator()) - ax.xaxis.set_major_formatter(ticker.ScalarFormatter(useMathText=True)) - ax.text(0.0, 0.1, "ScalarFormatter()", fontsize=15, transform=ax.transAxes) - - # StrMethod formatter - ax = plt.subplot(n, 1, 6) - setup(ax) - ax.xaxis.set_major_locator(ticker.MultipleLocator(1.00)) - ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.25)) - ax.xaxis.set_major_formatter(ticker.StrMethodFormatter("{x}")) - ax.text(0.0, 0.1, "StrMethodFormatter('{x}')", - fontsize=15, transform=ax.transAxes) - - # Push the top of the top axes outside the figure because we only show the - # bottom spine. - plt.subplots_adjust(left=0.05, right=0.95, bottom=0.05, top=1.05) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/ticks_and_spines/tick-locators.rst.txt b/_sources/examples/ticks_and_spines/tick-locators.rst.txt deleted file mode 100644 index 2ece34c77f3..00000000000 --- a/_sources/examples/ticks_and_spines/tick-locators.rst.txt +++ /dev/null @@ -1,115 +0,0 @@ -.. _ticks_and_spines-tick-locators: - -ticks_and_spines example code: tick-locators.py -=============================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/ticks_and_spines/tick-locators.py - -:: - - """ - ============= - Tick locators - ============= - - Show the different tick locators. - """ - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.ticker as ticker - - - # Setup a plot such that only the bottom spine is shown - def setup(ax): - ax.spines['right'].set_color('none') - ax.spines['left'].set_color('none') - ax.yaxis.set_major_locator(ticker.NullLocator()) - ax.spines['top'].set_color('none') - ax.xaxis.set_ticks_position('bottom') - ax.tick_params(which='major', width=1.00) - ax.tick_params(which='major', length=5) - ax.tick_params(which='minor', width=0.75) - ax.tick_params(which='minor', length=2.5) - ax.set_xlim(0, 5) - ax.set_ylim(0, 1) - ax.patch.set_alpha(0.0) - - - plt.figure(figsize=(8, 6)) - n = 8 - - # Null Locator - ax = plt.subplot(n, 1, 1) - setup(ax) - ax.xaxis.set_major_locator(ticker.NullLocator()) - ax.xaxis.set_minor_locator(ticker.NullLocator()) - ax.text(0.0, 0.1, "NullLocator()", fontsize=14, transform=ax.transAxes) - - # Multiple Locator - ax = plt.subplot(n, 1, 2) - setup(ax) - ax.xaxis.set_major_locator(ticker.MultipleLocator(0.5)) - ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.1)) - ax.text(0.0, 0.1, "MultipleLocator(0.5)", fontsize=14, - transform=ax.transAxes) - - # Fixed Locator - ax = plt.subplot(n, 1, 3) - setup(ax) - majors = [0, 1, 5] - ax.xaxis.set_major_locator(ticker.FixedLocator(majors)) - minors = np.linspace(0, 1, 11)[1:-1] - ax.xaxis.set_minor_locator(ticker.FixedLocator(minors)) - ax.text(0.0, 0.1, "FixedLocator([0, 1, 5])", fontsize=14, - transform=ax.transAxes) - - # Linear Locator - ax = plt.subplot(n, 1, 4) - setup(ax) - ax.xaxis.set_major_locator(ticker.LinearLocator(3)) - ax.xaxis.set_minor_locator(ticker.LinearLocator(31)) - ax.text(0.0, 0.1, "LinearLocator(numticks=3)", - fontsize=14, transform=ax.transAxes) - - # Index Locator - ax = plt.subplot(n, 1, 5) - setup(ax) - ax.plot(range(0, 5), [0]*5, color='White') - ax.xaxis.set_major_locator(ticker.IndexLocator(base=.5, offset=.25)) - ax.text(0.0, 0.1, "IndexLocator(base=0.5, offset=0.25)", - fontsize=14, transform=ax.transAxes) - - # Auto Locator - ax = plt.subplot(n, 1, 6) - setup(ax) - ax.xaxis.set_major_locator(ticker.AutoLocator()) - ax.xaxis.set_minor_locator(ticker.AutoMinorLocator()) - ax.text(0.0, 0.1, "AutoLocator()", fontsize=14, transform=ax.transAxes) - - # MaxN Locator - ax = plt.subplot(n, 1, 7) - setup(ax) - ax.xaxis.set_major_locator(ticker.MaxNLocator(4)) - ax.xaxis.set_minor_locator(ticker.MaxNLocator(40)) - ax.text(0.0, 0.1, "MaxNLocator(n=4)", fontsize=14, transform=ax.transAxes) - - # Log Locator - ax = plt.subplot(n, 1, 8) - setup(ax) - ax.set_xlim(10**3, 10**10) - ax.set_xscale('log') - ax.xaxis.set_major_locator(ticker.LogLocator(base=10.0, numticks=15)) - ax.text(0.0, 0.1, "LogLocator(base=10, numticks=15)", - fontsize=15, transform=ax.transAxes) - - # Push the top of the top axes outside the figure because we only show the - # bottom spine. - plt.subplots_adjust(left=0.05, right=0.95, bottom=0.05, top=1.05) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/ticks_and_spines/tick_labels_from_values.rst.txt b/_sources/examples/ticks_and_spines/tick_labels_from_values.rst.txt deleted file mode 100644 index e732d552218..00000000000 --- a/_sources/examples/ticks_and_spines/tick_labels_from_values.rst.txt +++ /dev/null @@ -1,51 +0,0 @@ -.. _ticks_and_spines-tick_labels_from_values: - -ticks_and_spines example code: tick_labels_from_values.py -========================================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/ticks_and_spines/tick_labels_from_values.py - -:: - - """ - ========================================= - Setting tick labels from a list of values - ========================================= - - Using ax.set_xticks causes the tick labels to be set on the currently - chosen ticks. However, you may want to allow matplotlib to dynamically - choose the number of ticks and their spacing. - - In this case it may be better to determine the tick label from the - value at the tick. The following example shows how to do this. - - NB: The MaxNLocator is used here to ensure that the tick values - take integer values. - - """ - - import matplotlib.pyplot as plt - from matplotlib.ticker import FuncFormatter, MaxNLocator - fig = plt.figure() - ax = fig.add_subplot(111) - xs = range(26) - ys = range(26) - labels = list('abcdefghijklmnopqrstuvwxyz') - - - def format_fn(tick_val, tick_pos): - if int(tick_val) in xs: - return labels[int(tick_val)] - else: - return '' - - - ax.xaxis.set_major_formatter(FuncFormatter(format_fn)) - ax.xaxis.set_major_locator(MaxNLocator(integer=True)) - ax.plot(xs, ys) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/ticks_and_spines/tick_labels_from_values.txt b/_sources/examples/ticks_and_spines/tick_labels_from_values.txt deleted file mode 100644 index 618b5ea7f8e..00000000000 --- a/_sources/examples/ticks_and_spines/tick_labels_from_values.txt +++ /dev/null @@ -1,48 +0,0 @@ -.. _ticks_and_spines-tick_labels_from_values: - -ticks_and_spines example code: tick_labels_from_values.py -========================================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/ticks_and_spines/tick_labels_from_values.py - -:: - - """ - - Basic demo showing how to set tick labels to values of a series. - - Using ax.set_xticks causes the tick labels to be set on the currently - chosen ticks. However, you may want to allow matplotlib to dynamically - choose the number of ticks and their spacing. - - In this case it may be better to determine the tick label from the - value at the tick. The following example shows how to do this. - - NB: The MaxNLocator is used here to ensure that the tick values - take integer values. - - """ - - import matplotlib.pyplot as plt - from matplotlib.ticker import FuncFormatter, MaxNLocator - fig = plt.figure() - ax = fig.add_subplot(111) - xs = range(26) - ys = range(26) - labels = list('abcdefghijklmnopqrstuvwxyz') - - - def format_fn(tick_val, tick_pos): - if int(tick_val) in xs: - return labels[int(tick_val)] - else: - return '' - ax.xaxis.set_major_formatter(FuncFormatter(format_fn)) - ax.xaxis.set_major_locator(MaxNLocator(integer=True)) - ax.plot(xs, ys) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/ticks_and_spines/ticklabels_demo_rotation.rst.txt b/_sources/examples/ticks_and_spines/ticklabels_demo_rotation.rst.txt deleted file mode 100644 index 7e5e1959360..00000000000 --- a/_sources/examples/ticks_and_spines/ticklabels_demo_rotation.rst.txt +++ /dev/null @@ -1,36 +0,0 @@ -.. _ticks_and_spines-ticklabels_demo_rotation: - -ticks_and_spines example code: ticklabels_demo_rotation.py -========================================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/ticks_and_spines/ticklabels_demo_rotation.py - -:: - - """ - =========================== - Rotating custom tick labels - =========================== - - Demo of custom tick-labels with user-defined rotation. - """ - import matplotlib.pyplot as plt - - - x = [1, 2, 3, 4] - y = [1, 4, 9, 6] - labels = ['Frogs', 'Hogs', 'Bogs', 'Slogs'] - - plt.plot(x, y, 'ro') - # You can specify a rotation for the tick labels in degrees or with keywords. - plt.xticks(x, labels, rotation='vertical') - # Pad margins so that markers don't get clipped by the axes - plt.margins(0.2) - # Tweak spacing to prevent clipping of tick-labels - plt.subplots_adjust(bottom=0.15) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/ticks_and_spines/ticklabels_demo_rotation.txt b/_sources/examples/ticks_and_spines/ticklabels_demo_rotation.txt deleted file mode 100644 index 756df3e30f0..00000000000 --- a/_sources/examples/ticks_and_spines/ticklabels_demo_rotation.txt +++ /dev/null @@ -1,32 +0,0 @@ -.. _ticks_and_spines-ticklabels_demo_rotation: - -ticks_and_spines example code: ticklabels_demo_rotation.py -========================================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/ticks_and_spines/ticklabels_demo_rotation.py - -:: - - """ - Demo of custom tick-labels with user-defined rotation. - """ - import matplotlib.pyplot as plt - - - x = [1, 2, 3, 4] - y = [1, 4, 9, 6] - labels = ['Frogs', 'Hogs', 'Bogs', 'Slogs'] - - plt.plot(x, y, 'ro') - # You can specify a rotation for the tick labels in degrees or with keywords. - plt.xticks(x, labels, rotation='vertical') - # Pad margins so that markers don't get clipped by the axes - plt.margins(0.2) - # Tweak spacing to prevent clipping of tick-labels - plt.subplots_adjust(bottom=0.15) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/units/annotate_with_units.rst.txt b/_sources/examples/units/annotate_with_units.rst.txt deleted file mode 100644 index 58241a50509..00000000000 --- a/_sources/examples/units/annotate_with_units.rst.txt +++ /dev/null @@ -1,46 +0,0 @@ -.. _units-annotate_with_units: - -units example code: annotate_with_units.py -========================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/units/annotate_with_units.py - -:: - - """ - ===================== - Annotation with units - ===================== - - The example illustrates how to create text and arrow - annotations using a centimeter-scale plot. - - """ - import matplotlib.pyplot as plt - from basic_units import cm - - fig, ax = plt.subplots() - - ax.annotate("Note 01", [0.5*cm, 0.5*cm]) - - # xy and text both unitized - ax.annotate('local max', xy=(3*cm, 1*cm), xycoords='data', - xytext=(0.8*cm, 0.95*cm), textcoords='data', - arrowprops=dict(facecolor='black', shrink=0.05), - horizontalalignment='right', verticalalignment='top') - - # mixing units w/ nonunits - ax.annotate('local max', xy=(3*cm, 1*cm), xycoords='data', - xytext=(0.8, 0.95), textcoords='axes fraction', - arrowprops=dict(facecolor='black', shrink=0.05), - horizontalalignment='right', verticalalignment='top') - - - ax.set_xlim(0*cm, 4*cm) - ax.set_ylim(0*cm, 4*cm) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/units/annotate_with_units.txt b/_sources/examples/units/annotate_with_units.txt deleted file mode 100644 index f74c8d826bc..00000000000 --- a/_sources/examples/units/annotate_with_units.txt +++ /dev/null @@ -1,37 +0,0 @@ -.. _units-annotate_with_units: - -units example code: annotate_with_units.py -========================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/units/annotate_with_units.py - -:: - - import matplotlib.pyplot as plt - from basic_units import cm - - fig, ax = plt.subplots() - - ax.annotate("Note 01", [0.5*cm, 0.5*cm]) - - # xy and text both unitized - ax.annotate('local max', xy=(3*cm, 1*cm), xycoords='data', - xytext=(0.8*cm, 0.95*cm), textcoords='data', - arrowprops=dict(facecolor='black', shrink=0.05), - horizontalalignment='right', verticalalignment='top') - - # mixing units w/ nonunits - ax.annotate('local max', xy=(3*cm, 1*cm), xycoords='data', - xytext=(0.8, 0.95), textcoords='axes fraction', - arrowprops=dict(facecolor='black', shrink=0.05), - horizontalalignment='right', verticalalignment='top') - - - ax.set_xlim(0*cm, 4*cm) - ax.set_ylim(0*cm, 4*cm) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/units/artist_tests.rst.txt b/_sources/examples/units/artist_tests.rst.txt deleted file mode 100644 index 5809947f108..00000000000 --- a/_sources/examples/units/artist_tests.rst.txt +++ /dev/null @@ -1,72 +0,0 @@ -.. _units-artist_tests: - -units example code: artist_tests.py -=================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/units/artist_tests.py - -:: - - """ - ============ - Artist tests - ============ - - Test unit support with each of the Matplotlib primitive artist types. - - The axis handles unit conversions and the artists keep a pointer to their axis - parent. You must initialize the artists with the axis instance if you want to - use them with unit data, or else they will not know how to convert the units - to scalars. - """ - import random - import matplotlib.lines as lines - import matplotlib.patches as patches - import matplotlib.text as text - import matplotlib.collections as collections - - from basic_units import cm, inch - import numpy as np - import matplotlib.pyplot as plt - - fig, ax = plt.subplots() - ax.xaxis.set_units(cm) - ax.yaxis.set_units(cm) - - if 0: - # test a line collection - # Not supported at present. - verts = [] - for i in range(10): - # a random line segment in inches - verts.append(zip(*inch*10*np.random.rand(2, random.randint(2, 15)))) - lc = collections.LineCollection(verts, axes=ax) - ax.add_collection(lc) - - # test a plain-ol-line - line = lines.Line2D([0*cm, 1.5*cm], [0*cm, 2.5*cm], - lw=2, color='black', axes=ax) - ax.add_line(line) - - if 0: - # test a patch - # Not supported at present. - rect = patches.Rectangle((1*cm, 1*cm), width=5*cm, height=2*cm, - alpha=0.2, axes=ax) - ax.add_patch(rect) - - - t = text.Text(3*cm, 2.5*cm, 'text label', ha='left', va='bottom', axes=ax) - ax.add_artist(t) - - ax.set_xlim(-1*cm, 10*cm) - ax.set_ylim(-1*cm, 10*cm) - # ax.xaxis.set_units(inch) - ax.grid(True) - ax.set_title("Artists with units") - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/units/artist_tests.txt b/_sources/examples/units/artist_tests.txt deleted file mode 100644 index 76b60ad5c65..00000000000 --- a/_sources/examples/units/artist_tests.txt +++ /dev/null @@ -1,66 +0,0 @@ -.. _units-artist_tests: - -units example code: artist_tests.py -=================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/units/artist_tests.py - -:: - - """ - Test unit support with each of the matplotlib primitive artist types - - The axes handles unit conversions and the artists keep a pointer to - their axes parent, so you must init the artists with the axes instance - if you want to initialize them with unit data, or else they will not - know how to convert the units to scalars - """ - import random - import matplotlib.lines as lines - import matplotlib.patches as patches - import matplotlib.text as text - import matplotlib.collections as collections - - from basic_units import cm, inch - import numpy as np - import matplotlib.pyplot as plt - - fig, ax = plt.subplots() - ax.xaxis.set_units(cm) - ax.yaxis.set_units(cm) - - if 0: - # test a line collection - # Not supported at present. - verts = [] - for i in range(10): - # a random line segment in inches - verts.append(zip(*inch*10*np.random.rand(2, random.randint(2, 15)))) - lc = collections.LineCollection(verts, axes=ax) - ax.add_collection(lc) - - # test a plain-ol-line - line = lines.Line2D([0*cm, 1.5*cm], [0*cm, 2.5*cm], lw=2, color='black', axes=ax) - ax.add_line(line) - - if 0: - # test a patch - # Not supported at present. - rect = patches.Rectangle((1*cm, 1*cm), width=5*cm, height=2*cm, alpha=0.2, axes=ax) - ax.add_patch(rect) - - - t = text.Text(3*cm, 2.5*cm, 'text label', ha='left', va='bottom', axes=ax) - ax.add_artist(t) - - ax.set_xlim(-1*cm, 10*cm) - ax.set_ylim(-1*cm, 10*cm) - #ax.xaxis.set_units(inch) - ax.grid(True) - ax.set_title("Artists with units") - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/units/bar_demo2.rst.txt b/_sources/examples/units/bar_demo2.rst.txt deleted file mode 100644 index 16d2a35b917..00000000000 --- a/_sources/examples/units/bar_demo2.rst.txt +++ /dev/null @@ -1,48 +0,0 @@ -.. _units-bar_demo2: - -units example code: bar_demo2.py -================================ - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/units/bar_demo2.py - -:: - - """ - =================== - Bar demo with units - =================== - - A plot using a variety of centimetre and inch conversions. This example shows - how default unit introspection works (ax1), how various keywords can be used to - set the x and y units to override the defaults (ax2, ax3, ax4) and how one can - set the xlimits using scalars (ax3, current units assumed) or units - (conversions applied to get the numbers to current units). - - """ - import numpy as np - from basic_units import cm, inch - import matplotlib.pyplot as plt - - cms = cm * np.arange(0, 10, 2) - bottom = 0 * cm - width = 0.8 * cm - - fig, axs = plt.subplots(2, 2) - - axs[0, 0].bar(cms, cms, bottom=bottom) - - axs[0, 1].bar(cms, cms, bottom=bottom, width=width, xunits=cm, yunits=inch) - - axs[1, 0].bar(cms, cms, bottom=bottom, width=width, xunits=inch, yunits=cm) - axs[1, 0].set_xlim(2, 6) # scalars are interpreted in current units - - axs[1, 1].bar(cms, cms, bottom=bottom, width=width, xunits=inch, yunits=inch) - axs[1, 1].set_xlim(2 * cm, 6 * cm) # cm are converted to inches - - fig.tight_layout() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/units/bar_demo2.txt b/_sources/examples/units/bar_demo2.txt deleted file mode 100644 index 1e3df67f25e..00000000000 --- a/_sources/examples/units/bar_demo2.txt +++ /dev/null @@ -1,50 +0,0 @@ -.. _units-bar_demo2: - -units example code: bar_demo2.py -================================ - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/units/bar_demo2.py - -:: - - """ - plot using a variety of cm vs inches conversions. The example shows - how default unit instrospection works (ax1), how various keywords can - be used to set the x and y units to override the defaults (ax2, ax3, - ax4) and how one can set the xlimits using scalars (ax3, current units - assumed) or units (conversions applied to get the numbers to current - units) - - """ - import numpy as np - from basic_units import cm, inch - import matplotlib.pyplot as plt - - - cms = cm * np.arange(0, 10, 2) - bottom = 0*cm - width = 0.8*cm - - fig = plt.figure() - - ax1 = fig.add_subplot(2, 2, 1) - ax1.bar(cms, cms, bottom=bottom) - - ax2 = fig.add_subplot(2, 2, 2) - ax2.bar(cms, cms, bottom=bottom, width=width, xunits=cm, yunits=inch) - - ax3 = fig.add_subplot(2, 2, 3) - ax3.bar(cms, cms, bottom=bottom, width=width, xunits=inch, yunits=cm) - ax3.set_xlim(2, 6) # scalars are interpreted in current units - - ax4 = fig.add_subplot(2, 2, 4) - ax4.bar(cms, cms, bottom=bottom, width=width, xunits=inch, yunits=inch) - #fig.savefig('simple_conversion_plot.png') - ax4.set_xlim(2*cm, 6*cm) # cm are converted to inches - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/units/bar_unit_demo.rst.txt b/_sources/examples/units/bar_unit_demo.rst.txt deleted file mode 100644 index 0d53f24135c..00000000000 --- a/_sources/examples/units/bar_unit_demo.rst.txt +++ /dev/null @@ -1,54 +0,0 @@ -.. _units-bar_unit_demo: - -units example code: bar_unit_demo.py -==================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/units/bar_unit_demo.py - -:: - - """ - ========================= - Group barchart with units - ========================= - - This is the same example as - - the barchart demo in centimeters. - """ - - import numpy as np - from basic_units import cm, inch - import matplotlib.pyplot as plt - - - N = 5 - menMeans = (150*cm, 160*cm, 146*cm, 172*cm, 155*cm) - menStd = (20*cm, 30*cm, 32*cm, 10*cm, 20*cm) - - fig, ax = plt.subplots() - - ind = np.arange(N) # the x locations for the groups - width = 0.35 # the width of the bars - p1 = ax.bar(ind, menMeans, width, color='r', bottom=0*cm, yerr=menStd) - - - womenMeans = (145*cm, 149*cm, 172*cm, 165*cm, 200*cm) - womenStd = (30*cm, 25*cm, 20*cm, 31*cm, 22*cm) - p2 = ax.bar(ind + width, womenMeans, width, - color='y', bottom=0*cm, yerr=womenStd) - - ax.set_title('Scores by group and gender') - ax.set_xticks(ind + width / 2) - ax.set_xticklabels(('G1', 'G2', 'G3', 'G4', 'G5')) - - ax.legend((p1[0], p2[0]), ('Men', 'Women')) - ax.yaxis.set_units(inch) - ax.autoscale_view() - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/units/bar_unit_demo.txt b/_sources/examples/units/bar_unit_demo.txt deleted file mode 100644 index dca9db6205d..00000000000 --- a/_sources/examples/units/bar_unit_demo.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _units-bar_unit_demo: - -units example code: bar_unit_demo.py -==================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/units/bar_unit_demo.py - -:: - - #!/usr/bin/env python - import numpy as np - from basic_units import cm, inch - import matplotlib.pyplot as plt - - - N = 5 - menMeans = (150*cm, 160*cm, 146*cm, 172*cm, 155*cm) - menStd = (20*cm, 30*cm, 32*cm, 10*cm, 20*cm) - - fig, ax = plt.subplots() - - ind = np.arange(N) # the x locations for the groups - width = 0.35 # the width of the bars - p1 = ax.bar(ind, menMeans, width, color='r', bottom=0*cm, yerr=menStd) - - - womenMeans = (145*cm, 149*cm, 172*cm, 165*cm, 200*cm) - womenStd = (30*cm, 25*cm, 20*cm, 31*cm, 22*cm) - p2 = ax.bar(ind + width, womenMeans, width, color='y', bottom=0*cm, yerr=womenStd) - - ax.set_title('Scores by group and gender') - ax.set_xticks(ind + width) - ax.set_xticklabels(('G1', 'G2', 'G3', 'G4', 'G5')) - - ax.legend((p1[0], p2[0]), ('Men', 'Women')) - ax.yaxis.set_units(inch) - ax.autoscale_view() - - #plt.savefig('barchart_demo') - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/units/basic_units.rst.txt b/_sources/examples/units/basic_units.rst.txt deleted file mode 100644 index e40b2c24506..00000000000 --- a/_sources/examples/units/basic_units.rst.txt +++ /dev/null @@ -1,384 +0,0 @@ -.. _units-basic_units: - -units example code: basic_units.py -================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/units/basic_units.py - -:: - - import math - - import numpy as np - - import matplotlib.units as units - import matplotlib.ticker as ticker - from matplotlib.axes import Axes - from matplotlib.cbook import iterable - - - class ProxyDelegate(object): - def __init__(self, fn_name, proxy_type): - self.proxy_type = proxy_type - self.fn_name = fn_name - - def __get__(self, obj, objtype=None): - return self.proxy_type(self.fn_name, obj) - - - class TaggedValueMeta (type): - def __init__(cls, name, bases, dict): - for fn_name in cls._proxies.keys(): - try: - dummy = getattr(cls, fn_name) - except AttributeError: - setattr(cls, fn_name, - ProxyDelegate(fn_name, cls._proxies[fn_name])) - - - class PassThroughProxy(object): - def __init__(self, fn_name, obj): - self.fn_name = fn_name - self.target = obj.proxy_target - - def __call__(self, *args): - fn = getattr(self.target, self.fn_name) - ret = fn(*args) - return ret - - - class ConvertArgsProxy(PassThroughProxy): - def __init__(self, fn_name, obj): - PassThroughProxy.__init__(self, fn_name, obj) - self.unit = obj.unit - - def __call__(self, *args): - converted_args = [] - for a in args: - try: - converted_args.append(a.convert_to(self.unit)) - except AttributeError: - converted_args.append(TaggedValue(a, self.unit)) - converted_args = tuple([c.get_value() for c in converted_args]) - return PassThroughProxy.__call__(self, *converted_args) - - - class ConvertReturnProxy(PassThroughProxy): - def __init__(self, fn_name, obj): - PassThroughProxy.__init__(self, fn_name, obj) - self.unit = obj.unit - - def __call__(self, *args): - ret = PassThroughProxy.__call__(self, *args) - if (type(ret) == type(NotImplemented)): - return NotImplemented - return TaggedValue(ret, self.unit) - - - class ConvertAllProxy(PassThroughProxy): - def __init__(self, fn_name, obj): - PassThroughProxy.__init__(self, fn_name, obj) - self.unit = obj.unit - - def __call__(self, *args): - converted_args = [] - arg_units = [self.unit] - for a in args: - if hasattr(a, 'get_unit') and not hasattr(a, 'convert_to'): - # if this arg has a unit type but no conversion ability, - # this operation is prohibited - return NotImplemented - - if hasattr(a, 'convert_to'): - try: - a = a.convert_to(self.unit) - except: - pass - arg_units.append(a.get_unit()) - converted_args.append(a.get_value()) - else: - converted_args.append(a) - if hasattr(a, 'get_unit'): - arg_units.append(a.get_unit()) - else: - arg_units.append(None) - converted_args = tuple(converted_args) - ret = PassThroughProxy.__call__(self, *converted_args) - if (type(ret) == type(NotImplemented)): - return NotImplemented - ret_unit = unit_resolver(self.fn_name, arg_units) - if (ret_unit == NotImplemented): - return NotImplemented - return TaggedValue(ret, ret_unit) - - - class _TaggedValue(object): - - _proxies = {'__add__': ConvertAllProxy, - '__sub__': ConvertAllProxy, - '__mul__': ConvertAllProxy, - '__rmul__': ConvertAllProxy, - '__cmp__': ConvertAllProxy, - '__lt__': ConvertAllProxy, - '__gt__': ConvertAllProxy, - '__len__': PassThroughProxy} - - def __new__(cls, value, unit): - # generate a new subclass for value - value_class = type(value) - try: - subcls = type('TaggedValue_of_%s' % (value_class.__name__), - tuple([cls, value_class]), - {}) - if subcls not in units.registry: - units.registry[subcls] = basicConverter - return object.__new__(subcls) - except TypeError: - if cls not in units.registry: - units.registry[cls] = basicConverter - return object.__new__(cls) - - def __init__(self, value, unit): - self.value = value - self.unit = unit - self.proxy_target = self.value - - def __getattribute__(self, name): - if (name.startswith('__')): - return object.__getattribute__(self, name) - variable = object.__getattribute__(self, 'value') - if (hasattr(variable, name) and name not in self.__class__.__dict__): - return getattr(variable, name) - return object.__getattribute__(self, name) - - def __array__(self, t=None, context=None): - if t is not None: - return np.asarray(self.value).astype(t) - else: - return np.asarray(self.value, 'O') - - def __array_wrap__(self, array, context): - return TaggedValue(array, self.unit) - - def __repr__(self): - return 'TaggedValue(' + repr(self.value) + ', ' + repr(self.unit) + ')' - - def __str__(self): - return str(self.value) + ' in ' + str(self.unit) - - def __len__(self): - return len(self.value) - - def __iter__(self): - class IteratorProxy(object): - def __init__(self, iter, unit): - self.iter = iter - self.unit = unit - - def __next__(self): - value = next(self.iter) - return TaggedValue(value, self.unit) - next = __next__ # for Python 2 - return IteratorProxy(iter(self.value), self.unit) - - def get_compressed_copy(self, mask): - new_value = np.ma.masked_array(self.value, mask=mask).compressed() - return TaggedValue(new_value, self.unit) - - def convert_to(self, unit): - if (unit == self.unit or not unit): - return self - new_value = self.unit.convert_value_to(self.value, unit) - return TaggedValue(new_value, unit) - - def get_value(self): - return self.value - - def get_unit(self): - return self.unit - - - TaggedValue = TaggedValueMeta('TaggedValue', (_TaggedValue, ), {}) - - - class BasicUnit(object): - def __init__(self, name, fullname=None): - self.name = name - if fullname is None: - fullname = name - self.fullname = fullname - self.conversions = dict() - - def __repr__(self): - return 'BasicUnit(%s)' % self.name - - def __str__(self): - return self.fullname - - def __call__(self, value): - return TaggedValue(value, self) - - def __mul__(self, rhs): - value = rhs - unit = self - if hasattr(rhs, 'get_unit'): - value = rhs.get_value() - unit = rhs.get_unit() - unit = unit_resolver('__mul__', (self, unit)) - if (unit == NotImplemented): - return NotImplemented - return TaggedValue(value, unit) - - def __rmul__(self, lhs): - return self*lhs - - def __array_wrap__(self, array, context): - return TaggedValue(array, self) - - def __array__(self, t=None, context=None): - ret = np.array([1]) - if t is not None: - return ret.astype(t) - else: - return ret - - def add_conversion_factor(self, unit, factor): - def convert(x): - return x*factor - self.conversions[unit] = convert - - def add_conversion_fn(self, unit, fn): - self.conversions[unit] = fn - - def get_conversion_fn(self, unit): - return self.conversions[unit] - - def convert_value_to(self, value, unit): - conversion_fn = self.conversions[unit] - ret = conversion_fn(value) - return ret - - def get_unit(self): - return self - - - class UnitResolver(object): - def addition_rule(self, units): - for unit_1, unit_2 in zip(units[:-1], units[1:]): - if (unit_1 != unit_2): - return NotImplemented - return units[0] - - def multiplication_rule(self, units): - non_null = [u for u in units if u] - if (len(non_null) > 1): - return NotImplemented - return non_null[0] - - op_dict = { - '__mul__': multiplication_rule, - '__rmul__': multiplication_rule, - '__add__': addition_rule, - '__radd__': addition_rule, - '__sub__': addition_rule, - '__rsub__': addition_rule} - - def __call__(self, operation, units): - if (operation not in self.op_dict): - return NotImplemented - - return self.op_dict[operation](self, units) - - - unit_resolver = UnitResolver() - - cm = BasicUnit('cm', 'centimeters') - inch = BasicUnit('inch', 'inches') - inch.add_conversion_factor(cm, 2.54) - cm.add_conversion_factor(inch, 1/2.54) - - radians = BasicUnit('rad', 'radians') - degrees = BasicUnit('deg', 'degrees') - radians.add_conversion_factor(degrees, 180.0/np.pi) - degrees.add_conversion_factor(radians, np.pi/180.0) - - secs = BasicUnit('s', 'seconds') - hertz = BasicUnit('Hz', 'Hertz') - minutes = BasicUnit('min', 'minutes') - - secs.add_conversion_fn(hertz, lambda x: 1./x) - secs.add_conversion_factor(minutes, 1/60.0) - - - # radians formatting - def rad_fn(x, pos=None): - n = int((x / np.pi) * 2.0 + 0.25) - if n == 0: - return '0' - elif n == 1: - return r'$\pi/2$' - elif n == 2: - return r'$\pi$' - elif n % 2 == 0: - return r'$%s\pi$' % (n//2,) - else: - return r'$%s\pi/2$' % (n,) - - - class BasicUnitConverter(units.ConversionInterface): - @staticmethod - def axisinfo(unit, axis): - 'return AxisInfo instance for x and unit' - - if unit == radians: - return units.AxisInfo( - majloc=ticker.MultipleLocator(base=np.pi/2), - majfmt=ticker.FuncFormatter(rad_fn), - label=unit.fullname, - ) - elif unit == degrees: - return units.AxisInfo( - majloc=ticker.AutoLocator(), - majfmt=ticker.FormatStrFormatter(r'$%i^\circ$'), - label=unit.fullname, - ) - elif unit is not None: - if hasattr(unit, 'fullname'): - return units.AxisInfo(label=unit.fullname) - elif hasattr(unit, 'unit'): - return units.AxisInfo(label=unit.unit.fullname) - return None - - @staticmethod - def convert(val, unit, axis): - if units.ConversionInterface.is_numlike(val): - return val - if iterable(val): - return [thisval.convert_to(unit).get_value() for thisval in val] - else: - return val.convert_to(unit).get_value() - - @staticmethod - def default_units(x, axis): - 'return the default unit for x or None' - if iterable(x): - for thisx in x: - return thisx.unit - return x.unit - - - def cos(x): - if iterable(x): - return [math.cos(val.convert_to(radians).get_value()) for val in x] - else: - return math.cos(x.convert_to(radians).get_value()) - - - basicConverter = BasicUnitConverter() - units.registry[BasicUnit] = basicConverter - units.registry[TaggedValue] = basicConverter - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/units/basic_units.txt b/_sources/examples/units/basic_units.txt deleted file mode 100644 index f354b59d617..00000000000 --- a/_sources/examples/units/basic_units.txt +++ /dev/null @@ -1,384 +0,0 @@ -.. _units-basic_units: - -units example code: basic_units.py -================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/units/basic_units.py - -:: - - import math - - import numpy as np - - import matplotlib.units as units - import matplotlib.ticker as ticker - from matplotlib.axes import Axes - from matplotlib.cbook import iterable - - - class ProxyDelegate(object): - def __init__(self, fn_name, proxy_type): - self.proxy_type = proxy_type - self.fn_name = fn_name - - def __get__(self, obj, objtype=None): - return self.proxy_type(self.fn_name, obj) - - - class TaggedValueMeta (type): - def __init__(cls, name, bases, dict): - for fn_name in cls._proxies.keys(): - try: - dummy = getattr(cls, fn_name) - except AttributeError: - setattr(cls, fn_name, - ProxyDelegate(fn_name, cls._proxies[fn_name])) - - - class PassThroughProxy(object): - def __init__(self, fn_name, obj): - self.fn_name = fn_name - self.target = obj.proxy_target - - def __call__(self, *args): - fn = getattr(self.target, self.fn_name) - ret = fn(*args) - return ret - - - class ConvertArgsProxy(PassThroughProxy): - def __init__(self, fn_name, obj): - PassThroughProxy.__init__(self, fn_name, obj) - self.unit = obj.unit - - def __call__(self, *args): - converted_args = [] - for a in args: - try: - converted_args.append(a.convert_to(self.unit)) - except AttributeError: - converted_args.append(TaggedValue(a, self.unit)) - converted_args = tuple([c.get_value() for c in converted_args]) - return PassThroughProxy.__call__(self, *converted_args) - - - class ConvertReturnProxy(PassThroughProxy): - def __init__(self, fn_name, obj): - PassThroughProxy.__init__(self, fn_name, obj) - self.unit = obj.unit - - def __call__(self, *args): - ret = PassThroughProxy.__call__(self, *args) - if (type(ret) == type(NotImplemented)): - return NotImplemented - return TaggedValue(ret, self.unit) - - - class ConvertAllProxy(PassThroughProxy): - def __init__(self, fn_name, obj): - PassThroughProxy.__init__(self, fn_name, obj) - self.unit = obj.unit - - def __call__(self, *args): - converted_args = [] - arg_units = [self.unit] - for a in args: - if hasattr(a, 'get_unit') and not hasattr(a, 'convert_to'): - # if this arg has a unit type but no conversion ability, - # this operation is prohibited - return NotImplemented - - if hasattr(a, 'convert_to'): - try: - a = a.convert_to(self.unit) - except: - pass - arg_units.append(a.get_unit()) - converted_args.append(a.get_value()) - else: - converted_args.append(a) - if hasattr(a, 'get_unit'): - arg_units.append(a.get_unit()) - else: - arg_units.append(None) - converted_args = tuple(converted_args) - ret = PassThroughProxy.__call__(self, *converted_args) - if (type(ret) == type(NotImplemented)): - return NotImplemented - ret_unit = unit_resolver(self.fn_name, arg_units) - if (ret_unit == NotImplemented): - return NotImplemented - return TaggedValue(ret, ret_unit) - - - class _TaggedValue(object): - - _proxies = {'__add__': ConvertAllProxy, - '__sub__': ConvertAllProxy, - '__mul__': ConvertAllProxy, - '__rmul__': ConvertAllProxy, - '__cmp__': ConvertAllProxy, - '__lt__': ConvertAllProxy, - '__gt__': ConvertAllProxy, - '__len__': PassThroughProxy} - - def __new__(cls, value, unit): - # generate a new subclass for value - value_class = type(value) - try: - subcls = type('TaggedValue_of_%s' % (value_class.__name__), - tuple([cls, value_class]), - {}) - if subcls not in units.registry: - units.registry[subcls] = basicConverter - return object.__new__(subcls) - except TypeError: - if cls not in units.registry: - units.registry[cls] = basicConverter - return object.__new__(cls) - - def __init__(self, value, unit): - self.value = value - self.unit = unit - self.proxy_target = self.value - - def __getattribute__(self, name): - if (name.startswith('__')): - return object.__getattribute__(self, name) - variable = object.__getattribute__(self, 'value') - if (hasattr(variable, name) and name not in self.__class__.__dict__): - return getattr(variable, name) - return object.__getattribute__(self, name) - - def __array__(self, t=None, context=None): - if t is not None: - return np.asarray(self.value).astype(t) - else: - return np.asarray(self.value, 'O') - - def __array_wrap__(self, array, context): - return TaggedValue(array, self.unit) - - def __repr__(self): - return 'TaggedValue(' + repr(self.value) + ', ' + repr(self.unit) + ')' - - def __str__(self): - return str(self.value) + ' in ' + str(self.unit) - - def __len__(self): - return len(self.value) - - def __iter__(self): - class IteratorProxy(object): - def __init__(self, iter, unit): - self.iter = iter - self.unit = unit - - def __next__(self): - value = next(self.iter) - return TaggedValue(value, self.unit) - next = __next__ # for Python 2 - return IteratorProxy(iter(self.value), self.unit) - - def get_compressed_copy(self, mask): - new_value = np.ma.masked_array(self.value, mask=mask).compressed() - return TaggedValue(new_value, self.unit) - - def convert_to(self, unit): - if (unit == self.unit or not unit): - return self - new_value = self.unit.convert_value_to(self.value, unit) - return TaggedValue(new_value, unit) - - def get_value(self): - return self.value - - def get_unit(self): - return self.unit - - - TaggedValue = TaggedValueMeta('TaggedValue', (_TaggedValue, ), {}) - - - class BasicUnit(object): - def __init__(self, name, fullname=None): - self.name = name - if fullname is None: - fullname = name - self.fullname = fullname - self.conversions = dict() - - def __repr__(self): - return 'BasicUnit(%s)' % self.name - - def __str__(self): - return self.fullname - - def __call__(self, value): - return TaggedValue(value, self) - - def __mul__(self, rhs): - value = rhs - unit = self - if hasattr(rhs, 'get_unit'): - value = rhs.get_value() - unit = rhs.get_unit() - unit = unit_resolver('__mul__', (self, unit)) - if (unit == NotImplemented): - return NotImplemented - return TaggedValue(value, unit) - - def __rmul__(self, lhs): - return self*lhs - - def __array_wrap__(self, array, context): - return TaggedValue(array, self) - - def __array__(self, t=None, context=None): - ret = np.array([1]) - if t is not None: - return ret.astype(t) - else: - return ret - - def add_conversion_factor(self, unit, factor): - def convert(x): - return x*factor - self.conversions[unit] = convert - - def add_conversion_fn(self, unit, fn): - self.conversions[unit] = fn - - def get_conversion_fn(self, unit): - return self.conversions[unit] - - def convert_value_to(self, value, unit): - conversion_fn = self.conversions[unit] - ret = conversion_fn(value) - return ret - - def get_unit(self): - return self - - - class UnitResolver(object): - def addition_rule(self, units): - for unit_1, unit_2 in zip(units[:-1], units[1:]): - if (unit_1 != unit_2): - return NotImplemented - return units[0] - - def multiplication_rule(self, units): - non_null = [u for u in units if u] - if (len(non_null) > 1): - return NotImplemented - return non_null[0] - - op_dict = { - '__mul__': multiplication_rule, - '__rmul__': multiplication_rule, - '__add__': addition_rule, - '__radd__': addition_rule, - '__sub__': addition_rule, - '__rsub__': addition_rule} - - def __call__(self, operation, units): - if (operation not in self.op_dict): - return NotImplemented - - return self.op_dict[operation](self, units) - - - unit_resolver = UnitResolver() - - cm = BasicUnit('cm', 'centimeters') - inch = BasicUnit('inch', 'inches') - inch.add_conversion_factor(cm, 2.54) - cm.add_conversion_factor(inch, 1/2.54) - - radians = BasicUnit('rad', 'radians') - degrees = BasicUnit('deg', 'degrees') - radians.add_conversion_factor(degrees, 180.0/np.pi) - degrees.add_conversion_factor(radians, np.pi/180.0) - - secs = BasicUnit('s', 'seconds') - hertz = BasicUnit('Hz', 'Hertz') - minutes = BasicUnit('min', 'minutes') - - secs.add_conversion_fn(hertz, lambda x: 1./x) - secs.add_conversion_factor(minutes, 1/60.0) - - - # radians formatting - def rad_fn(x, pos=None): - n = int((x / np.pi) * 2.0 + 0.25) - if n == 0: - return '0' - elif n == 1: - return r'$\pi/2$' - elif n == 2: - return r'$\pi$' - elif n % 2 == 0: - return r'$%s\pi$' % (n//2,) - else: - return r'$%s\pi/2$' % (n,) - - - class BasicUnitConverter(units.ConversionInterface): - @staticmethod - def axisinfo(unit, axis): - 'return AxisInfo instance for x and unit' - - if unit == radians: - return units.AxisInfo( - majloc=ticker.MultipleLocator(base=np.pi/2), - majfmt=ticker.FuncFormatter(rad_fn), - label=unit.fullname, - ) - elif unit == degrees: - return units.AxisInfo( - majloc=ticker.AutoLocator(), - majfmt=ticker.FormatStrFormatter(r'$%i^\circ$'), - label=unit.fullname, - ) - elif unit is not None: - if hasattr(unit, 'fullname'): - return units.AxisInfo(label=unit.fullname) - elif hasattr(unit, 'unit'): - return units.AxisInfo(label=unit.unit.fullname) - return None - - @staticmethod - def convert(val, unit, axis): - if units.ConversionInterface.is_numlike(val): - return val - if iterable(val): - return [thisval.convert_to(unit).get_value() for thisval in val] - else: - return val.convert_to(unit).get_value() - - @staticmethod - def default_units(x, axis): - 'return the default unit for x or None' - if iterable(x): - for thisx in x: - return thisx.unit - return x.unit - - - def cos(x): - if iterable(x): - return [math.cos(val.convert_to(radians).get_value()) for val in x] - else: - return math.cos(x.convert_to(radians).get_value()) - - - basicConverter = BasicUnitConverter() - units.registry[BasicUnit] = basicConverter - units.registry[TaggedValue] = basicConverter - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/units/ellipse_with_units.rst.txt b/_sources/examples/units/ellipse_with_units.rst.txt deleted file mode 100644 index a7bb1779ac9..00000000000 --- a/_sources/examples/units/ellipse_with_units.rst.txt +++ /dev/null @@ -1,84 +0,0 @@ -.. _units-ellipse_with_units: - -units example code: ellipse_with_units.py -========================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/units/ellipse_with_units.py - -:: - - """ - Compare the ellipse generated with arcs versus a polygonal approximation - """ - from basic_units import cm - import numpy as np - from matplotlib import patches - import matplotlib.pyplot as plt - - - xcenter, ycenter = 0.38*cm, 0.52*cm - #xcenter, ycenter = 0., 0. - width, height = 1e-1*cm, 3e-1*cm - angle = -30 - - theta = np.arange(0.0, 360.0, 1.0)*np.pi/180.0 - x = 0.5 * width * np.cos(theta) - y = 0.5 * height * np.sin(theta) - - rtheta = np.radians(angle) - R = np.array([ - [np.cos(rtheta), -np.sin(rtheta)], - [np.sin(rtheta), np.cos(rtheta)], - ]) - - - x, y = np.dot(R, np.array([x, y])) - x += xcenter - y += ycenter - - fig = plt.figure() - ax = fig.add_subplot(211, aspect='auto') - ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1) - - e1 = patches.Ellipse((xcenter, ycenter), width, height, - angle=angle, linewidth=2, fill=False, zorder=2) - - ax.add_patch(e1) - - ax = fig.add_subplot(212, aspect='equal') - ax.fill(x, y, alpha=0.2, facecolor='green', edgecolor='green', zorder=1) - e2 = patches.Ellipse((xcenter, ycenter), width, height, - angle=angle, linewidth=2, fill=False, zorder=2) - - - ax.add_patch(e2) - - #fig.savefig('ellipse_compare.png') - fig.savefig('ellipse_compare') - - fig = plt.figure() - ax = fig.add_subplot(211, aspect='auto') - ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1) - - e1 = patches.Arc((xcenter, ycenter), width, height, - angle=angle, linewidth=2, fill=False, zorder=2) - - ax.add_patch(e1) - - ax = fig.add_subplot(212, aspect='equal') - ax.fill(x, y, alpha=0.2, facecolor='green', edgecolor='green', zorder=1) - e2 = patches.Arc((xcenter, ycenter), width, height, - angle=angle, linewidth=2, fill=False, zorder=2) - - - ax.add_patch(e2) - - #fig.savefig('arc_compare.png') - fig.savefig('arc_compare') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/units/ellipse_with_units.txt b/_sources/examples/units/ellipse_with_units.txt deleted file mode 100644 index dcfb448cd59..00000000000 --- a/_sources/examples/units/ellipse_with_units.txt +++ /dev/null @@ -1,84 +0,0 @@ -.. _units-ellipse_with_units: - -units example code: ellipse_with_units.py -========================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/units/ellipse_with_units.py - -:: - - """ - Compare the ellipse generated with arcs versus a polygonal approximation - """ - from basic_units import cm - import numpy as np - from matplotlib import patches - import matplotlib.pyplot as plt - - - xcenter, ycenter = 0.38*cm, 0.52*cm - #xcenter, ycenter = 0., 0. - width, height = 1e-1*cm, 3e-1*cm - angle = -30 - - theta = np.arange(0.0, 360.0, 1.0)*np.pi/180.0 - x = 0.5 * width * np.cos(theta) - y = 0.5 * height * np.sin(theta) - - rtheta = np.radians(angle) - R = np.array([ - [np.cos(rtheta), -np.sin(rtheta)], - [np.sin(rtheta), np.cos(rtheta)], - ]) - - - x, y = np.dot(R, np.array([x, y])) - x += xcenter - y += ycenter - - fig = plt.figure() - ax = fig.add_subplot(211, aspect='auto') - ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1) - - e1 = patches.Ellipse((xcenter, ycenter), width, height, - angle=angle, linewidth=2, fill=False, zorder=2) - - ax.add_patch(e1) - - ax = fig.add_subplot(212, aspect='equal') - ax.fill(x, y, alpha=0.2, facecolor='green', edgecolor='green', zorder=1) - e2 = patches.Ellipse((xcenter, ycenter), width, height, - angle=angle, linewidth=2, fill=False, zorder=2) - - - ax.add_patch(e2) - - #fig.savefig('ellipse_compare.png') - fig.savefig('ellipse_compare') - - fig = plt.figure() - ax = fig.add_subplot(211, aspect='auto') - ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1) - - e1 = patches.Arc((xcenter, ycenter), width, height, - angle=angle, linewidth=2, fill=False, zorder=2) - - ax.add_patch(e1) - - ax = fig.add_subplot(212, aspect='equal') - ax.fill(x, y, alpha=0.2, facecolor='green', edgecolor='green', zorder=1) - e2 = patches.Arc((xcenter, ycenter), width, height, - angle=angle, linewidth=2, fill=False, zorder=2) - - - ax.add_patch(e2) - - #fig.savefig('arc_compare.png') - fig.savefig('arc_compare') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/units/evans_test.rst.txt b/_sources/examples/units/evans_test.rst.txt deleted file mode 100644 index af6a2cc4cfc..00000000000 --- a/_sources/examples/units/evans_test.rst.txt +++ /dev/null @@ -1,112 +0,0 @@ -.. _units-evans_test: - -units example code: evans_test.py -================================= - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/units/evans_test.py - -:: - - """ - ========== - Evans test - ========== - - A mockup "Foo" units class which supports - conversion and different tick formatting depending on the "unit". - Here the "unit" is just a scalar conversion factor, but this example shows mpl - is entirely agnostic to what kind of units client packages use. - - """ - from matplotlib.cbook import iterable - import matplotlib.units as units - import matplotlib.ticker as ticker - import matplotlib.pyplot as plt - - - class Foo(object): - def __init__(self, val, unit=1.0): - self.unit = unit - self._val = val * unit - - def value(self, unit): - if unit is None: - unit = self.unit - return self._val / unit - - - class FooConverter(object): - @staticmethod - def axisinfo(unit, axis): - 'return the Foo AxisInfo' - if unit == 1.0 or unit == 2.0: - return units.AxisInfo( - majloc=ticker.IndexLocator(8, 0), - majfmt=ticker.FormatStrFormatter("VAL: %s"), - label='foo', - ) - - else: - return None - - @staticmethod - def convert(obj, unit, axis): - """ - convert obj using unit. If obj is a sequence, return the - converted sequence - """ - if units.ConversionInterface.is_numlike(obj): - return obj - - if iterable(obj): - return [o.value(unit) for o in obj] - else: - return obj.value(unit) - - @staticmethod - def default_units(x, axis): - 'return the default unit for x or None' - if iterable(x): - for thisx in x: - return thisx.unit - else: - return x.unit - - - units.registry[Foo] = FooConverter() - - # create some Foos - x = [] - for val in range(0, 50, 2): - x.append(Foo(val, 1.0)) - - # and some arbitrary y data - y = [i for i in range(len(x))] - - - # plot specifying units - fig = plt.figure() - fig.suptitle("Custom units") - fig.subplots_adjust(bottom=0.2) - ax = fig.add_subplot(1, 2, 2) - ax.plot(x, y, 'o', xunits=2.0) - for label in ax.get_xticklabels(): - label.set_rotation(30) - label.set_ha('right') - ax.set_title("xunits = 2.0") - - - # plot without specifying units; will use the None branch for axisinfo - ax = fig.add_subplot(1, 2, 1) - ax.plot(x, y) # uses default units - ax.set_title('default units') - for label in ax.get_xticklabels(): - label.set_rotation(30) - label.set_ha('right') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/units/evans_test.txt b/_sources/examples/units/evans_test.txt deleted file mode 100644 index ae02da446d4..00000000000 --- a/_sources/examples/units/evans_test.txt +++ /dev/null @@ -1,106 +0,0 @@ -.. _units-evans_test: - -units example code: evans_test.py -================================= - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/units/evans_test.py - -:: - - """ - A mockup "Foo" units class which supports - conversion and different tick formatting depending on the "unit". - Here the "unit" is just a scalar conversion factor, but this example shows mpl is - entirely agnostic to what kind of units client packages use - """ - from matplotlib.cbook import iterable - import matplotlib.units as units - import matplotlib.ticker as ticker - import matplotlib.pyplot as plt - - - class Foo(object): - def __init__(self, val, unit=1.0): - self.unit = unit - self._val = val * unit - - def value(self, unit): - if unit is None: - unit = self.unit - return self._val / unit - - - class FooConverter(object): - @staticmethod - def axisinfo(unit, axis): - 'return the Foo AxisInfo' - if unit == 1.0 or unit == 2.0: - return units.AxisInfo( - majloc=ticker.IndexLocator(8, 0), - majfmt=ticker.FormatStrFormatter("VAL: %s"), - label='foo', - ) - - else: - return None - - @staticmethod - def convert(obj, unit, axis): - """ - convert obj using unit. If obj is a sequence, return the - converted sequence - """ - if units.ConversionInterface.is_numlike(obj): - return obj - - if iterable(obj): - return [o.value(unit) for o in obj] - else: - return obj.value(unit) - - @staticmethod - def default_units(x, axis): - 'return the default unit for x or None' - if iterable(x): - for thisx in x: - return thisx.unit - else: - return x.unit - - units.registry[Foo] = FooConverter() - - # create some Foos - x = [] - for val in range(0, 50, 2): - x.append(Foo(val, 1.0)) - - # and some arbitrary y data - y = [i for i in range(len(x))] - - - # plot specifying units - fig = plt.figure() - fig.suptitle("Custom units") - fig.subplots_adjust(bottom=0.2) - ax = fig.add_subplot(1, 2, 2) - ax.plot(x, y, 'o', xunits=2.0) - for label in ax.get_xticklabels(): - label.set_rotation(30) - label.set_ha('right') - ax.set_title("xunits = 2.0") - - - # plot without specifying units; will use the None branch for axisinfo - ax = fig.add_subplot(1, 2, 1) - ax.plot(x, y) # uses default units - ax.set_title('default units') - for label in ax.get_xticklabels(): - label.set_rotation(30) - label.set_ha('right') - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/units/index.rst.txt b/_sources/examples/units/index.rst.txt deleted file mode 100644 index 468167da268..00000000000 --- a/_sources/examples/units/index.rst.txt +++ /dev/null @@ -1,24 +0,0 @@ -.. _units-examples-index: - -############################################## -units Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - annotate_with_units - artist_tests - bar_demo2 - bar_unit_demo - basic_units - ellipse_with_units - evans_test - radian_demo - units_sample - units_scatter diff --git a/_sources/examples/units/index.txt b/_sources/examples/units/index.txt deleted file mode 100644 index 468167da268..00000000000 --- a/_sources/examples/units/index.txt +++ /dev/null @@ -1,24 +0,0 @@ -.. _units-examples-index: - -############################################## -units Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - annotate_with_units - artist_tests - bar_demo2 - bar_unit_demo - basic_units - ellipse_with_units - evans_test - radian_demo - units_sample - units_scatter diff --git a/_sources/examples/units/radian_demo.rst.txt b/_sources/examples/units/radian_demo.rst.txt deleted file mode 100644 index 2815ccf7fc7..00000000000 --- a/_sources/examples/units/radian_demo.rst.txt +++ /dev/null @@ -1,40 +0,0 @@ -.. _units-radian_demo: - -units example code: radian_demo.py -================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/units/radian_demo.py - -:: - - """ - ============ - Radian ticks - ============ - - Plot with radians from the basic_units mockup example package. - - This example shows how the unit class can determine the tick locating, - formatting and axis labeling. - """ - import numpy as np - from basic_units import radians, degrees, cos - from matplotlib.pyplot import figure, show - - x = [val*radians for val in np.arange(0, 15, 0.01)] - - fig = figure() - fig.subplots_adjust(hspace=0.3) - - ax = fig.add_subplot(211) - line1, = ax.plot(x, cos(x), xunits=radians) - - ax = fig.add_subplot(212) - line2, = ax.plot(x, cos(x), xunits=degrees) - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/units/radian_demo.txt b/_sources/examples/units/radian_demo.txt deleted file mode 100644 index 59df01f7dc4..00000000000 --- a/_sources/examples/units/radian_demo.txt +++ /dev/null @@ -1,35 +0,0 @@ -.. _units-radian_demo: - -units example code: radian_demo.py -================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/units/radian_demo.py - -:: - - """ - Plot with radians from the basic_units mockup example package - This example shows how the unit class can determine the tick locating, - formatting and axis labeling. - """ - import numpy as np - from basic_units import radians, degrees, cos - from matplotlib.pyplot import figure, show - - x = [val*radians for val in np.arange(0, 15, 0.01)] - - fig = figure() - fig.subplots_adjust(hspace=0.3) - - ax = fig.add_subplot(211) - line1, = ax.plot(x, cos(x), xunits=radians) - - ax = fig.add_subplot(212) - line2, = ax.plot(x, cos(x), xunits=degrees) - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/units/units_sample.rst.txt b/_sources/examples/units/units_sample.rst.txt deleted file mode 100644 index 0652bda9187..00000000000 --- a/_sources/examples/units/units_sample.rst.txt +++ /dev/null @@ -1,48 +0,0 @@ -.. _units-units_sample: - -units example code: units_sample.py -=================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/units/units_sample.py - -:: - - """ - ====================== - Inches and Centimeters - ====================== - - The example illustrates the ability to override default x and y units (ax1) to - inches and centimeters using the `xunits` and `yunits` parameters for the - `plot` function. Note that conversions are applied to get numbers to correct - units. - - """ - from basic_units import cm, inch - import matplotlib.pyplot as plt - import numpy - - cms = cm * numpy.arange(0, 10, 2) - - fig = plt.figure() - - ax1 = fig.add_subplot(2, 2, 1) - ax1.plot(cms, cms) - - ax2 = fig.add_subplot(2, 2, 2) - ax2.plot(cms, cms, xunits=cm, yunits=inch) - - ax3 = fig.add_subplot(2, 2, 3) - ax3.plot(cms, cms, xunits=inch, yunits=cm) - ax3.set_xlim(3, 6) # scalars are interpreted in current units - - ax4 = fig.add_subplot(2, 2, 4) - ax4.plot(cms, cms, xunits=inch, yunits=inch) - ax4.set_xlim(3*cm, 6*cm) # cm are converted to inches - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/units/units_sample.txt b/_sources/examples/units/units_sample.txt deleted file mode 100644 index 19db57c0c75..00000000000 --- a/_sources/examples/units/units_sample.txt +++ /dev/null @@ -1,47 +0,0 @@ -.. _units-units_sample: - -units example code: units_sample.py -=================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/units/units_sample.py - -:: - - """ - plot using a variety of cm vs inches conversions. The example shows - how default unit instrospection works (ax1), how various keywords can - be used to set the x and y units to override the defaults (ax2, ax3, - ax4) and how one can set the xlimits using scalars (ax3, current units - assumed) or units (conversions applied to get the numbers to current - units) - - """ - from basic_units import cm, inch - import matplotlib.pyplot as plt - import numpy - - cms = cm * numpy.arange(0, 10, 2) - - fig = plt.figure() - - ax1 = fig.add_subplot(2, 2, 1) - ax1.plot(cms, cms) - - ax2 = fig.add_subplot(2, 2, 2) - ax2.plot(cms, cms, xunits=cm, yunits=inch) - - ax3 = fig.add_subplot(2, 2, 3) - ax3.plot(cms, cms, xunits=inch, yunits=cm) - ax3.set_xlim(3, 6) # scalars are interpreted in current units - - ax4 = fig.add_subplot(2, 2, 4) - ax4.plot(cms, cms, xunits=inch, yunits=inch) - #fig.savefig('simple_conversion_plot.png') - ax4.set_xlim(3*cm, 6*cm) # cm are converted to inches - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/units/units_scatter.rst.txt b/_sources/examples/units/units_scatter.rst.txt deleted file mode 100644 index 5cf8d3b1280..00000000000 --- a/_sources/examples/units/units_scatter.rst.txt +++ /dev/null @@ -1,49 +0,0 @@ -.. _units-units_scatter: - -units example code: units_scatter.py -==================================== - - - -.. plot:: /home/tcaswell/src/p/matplotlib/doc/mpl_examples/units/units_scatter.py - -:: - - """ - ============= - Unit handling - ============= - - basic_units is a mockup of a true units package used for testing - purposed, which illustrates the basic interface that a units package - must provide to matplotlib. - - The example below shows support for unit conversions over masked - arrays. - """ - import numpy as np - import matplotlib.pyplot as plt - from basic_units import secs, hertz, minutes - - # create masked array - data = (1, 2, 3, 4, 5, 6, 7, 8) - mask = (1, 0, 1, 0, 0, 0, 1, 0) - xsecs = secs * np.ma.MaskedArray(data, mask, float) - - fig, (ax1, ax2, ax3) = plt.subplots(nrows=3, sharex=True) - ax1.scatter(xsecs, xsecs) - ax1.yaxis.set_units(secs) - ax1.axis([0, 10, 0, 10]) - - ax2.scatter(xsecs, xsecs, yunits=hertz) - ax2.axis([0, 10, 0, 1]) - - ax3.scatter(xsecs, xsecs, yunits=hertz) - ax3.yaxis.set_units(minutes) - ax3.axis([0, 10, 0, 1]) - - fig.tight_layout() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/units/units_scatter.txt b/_sources/examples/units/units_scatter.txt deleted file mode 100644 index 536099fa7bf..00000000000 --- a/_sources/examples/units/units_scatter.txt +++ /dev/null @@ -1,50 +0,0 @@ -.. _units-units_scatter: - -units example code: units_scatter.py -==================================== - - - -.. plot:: /home/tcaswell/source/p/matplotlib/doc/mpl_examples/units/units_scatter.py - -:: - - """ - Demonstrate unit handling - - basic_units is a mockup of a true units package used for testing - purposed, which illustrates the basic interface that a units package - must provide to matplotlib. - - The example below shows support for unit conversions over masked - arrays. - """ - import numpy as np - from basic_units import secs, hertz, minutes - from matplotlib.pylab import figure, show - - # create masked array - - - xsecs = secs*np.ma.MaskedArray((1, 2, 3, 4, 5, 6, 7, 8), (1, 0, 1, 0, 0, 0, 1, 0), np.float) - #xsecs = secs*np.arange(1,10.) - - fig = figure() - ax1 = fig.add_subplot(3, 1, 1) - ax1.scatter(xsecs, xsecs) - #ax1.set_ylabel('seconds') - ax1.axis([0, 10, 0, 10]) - - ax2 = fig.add_subplot(3, 1, 2, sharex=ax1) - ax2.scatter(xsecs, xsecs, yunits=hertz) - ax2.axis([0, 10, 0, 1]) - - ax3 = fig.add_subplot(3, 1, 3, sharex=ax1) - ax3.scatter(xsecs, xsecs, yunits=hertz) - ax3.yaxis.set_units(minutes) - ax3.axis([0, 10, 0, 1]) - - show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_gtk.rst.txt b/_sources/examples/user_interfaces/embedding_in_gtk.rst.txt deleted file mode 100644 index f14931f13c5..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_gtk.rst.txt +++ /dev/null @@ -1,44 +0,0 @@ -.. _user_interfaces-embedding_in_gtk: - -user_interfaces example code: embedding_in_gtk.py -================================================= - -[`source code `_] - -:: - - """ - show how to add a matplotlib FigureCanvasGTK or FigureCanvasGTKAgg widget to a - gtk.Window - """ - - import gtk - - from matplotlib.figure import Figure - from numpy import arange, sin, pi - - # uncomment to select /GTK/GTKAgg/GTKCairo - #from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas - from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas - #from matplotlib.backends.backend_gtkcairo import FigureCanvasGTKCairo as FigureCanvas - - - win = gtk.Window() - win.connect("destroy", lambda x: gtk.main_quit()) - win.set_default_size(400, 300) - win.set_title("Embedding in GTK") - - f = Figure(figsize=(5, 4), dpi=100) - a = f.add_subplot(111) - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - a.plot(t, s) - - canvas = FigureCanvas(f) # a gtk.DrawingArea - win.add(canvas) - - win.show_all() - gtk.main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_gtk.txt b/_sources/examples/user_interfaces/embedding_in_gtk.txt deleted file mode 100644 index 9875616adae..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_gtk.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _user_interfaces-embedding_in_gtk: - -user_interfaces example code: embedding_in_gtk.py -================================================= - -[`source code `_] - -:: - - #!/usr/bin/env python - """ - show how to add a matplotlib FigureCanvasGTK or FigureCanvasGTKAgg widget to a - gtk.Window - """ - - import gtk - - from matplotlib.figure import Figure - from numpy import arange, sin, pi - - # uncomment to select /GTK/GTKAgg/GTKCairo - #from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas - from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas - #from matplotlib.backends.backend_gtkcairo import FigureCanvasGTKCairo as FigureCanvas - - - win = gtk.Window() - win.connect("destroy", lambda x: gtk.main_quit()) - win.set_default_size(400, 300) - win.set_title("Embedding in GTK") - - f = Figure(figsize=(5, 4), dpi=100) - a = f.add_subplot(111) - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - a.plot(t, s) - - canvas = FigureCanvas(f) # a gtk.DrawingArea - win.add(canvas) - - win.show_all() - gtk.main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_gtk2.rst.txt b/_sources/examples/user_interfaces/embedding_in_gtk2.rst.txt deleted file mode 100644 index a25ed2d1c48..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_gtk2.rst.txt +++ /dev/null @@ -1,63 +0,0 @@ -.. _user_interfaces-embedding_in_gtk2: - -user_interfaces example code: embedding_in_gtk2.py -================================================== - -[`source code `_] - -:: - - """ - show how to add a matplotlib FigureCanvasGTK or FigureCanvasGTKAgg widget and - a toolbar to a gtk.Window - """ - import gtk - - from matplotlib.figure import Figure - from numpy import arange, sin, pi - - # uncomment to select /GTK/GTKAgg/GTKCairo - #from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas - from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas - #from matplotlib.backends.backend_gtkcairo import FigureCanvasGTKCairo as FigureCanvas - - # or NavigationToolbar for classic - #from matplotlib.backends.backend_gtk import NavigationToolbar2GTK as NavigationToolbar - from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar - - # implement the default mpl key bindings - from matplotlib.backend_bases import key_press_handler - - win = gtk.Window() - win.connect("destroy", lambda x: gtk.main_quit()) - win.set_default_size(400, 300) - win.set_title("Embedding in GTK") - - vbox = gtk.VBox() - win.add(vbox) - - fig = Figure(figsize=(5, 4), dpi=100) - ax = fig.add_subplot(111) - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - - ax.plot(t, s) - - - canvas = FigureCanvas(fig) # a gtk.DrawingArea - vbox.pack_start(canvas) - toolbar = NavigationToolbar(canvas, win) - vbox.pack_start(toolbar, False, False) - - - def on_key_event(event): - print('you pressed %s' % event.key) - key_press_handler(event, canvas, toolbar) - - canvas.mpl_connect('key_press_event', on_key_event) - - win.show_all() - gtk.main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_gtk2.txt b/_sources/examples/user_interfaces/embedding_in_gtk2.txt deleted file mode 100644 index b2c99161935..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_gtk2.txt +++ /dev/null @@ -1,64 +0,0 @@ -.. _user_interfaces-embedding_in_gtk2: - -user_interfaces example code: embedding_in_gtk2.py -================================================== - -[`source code `_] - -:: - - #!/usr/bin/env python - """ - show how to add a matplotlib FigureCanvasGTK or FigureCanvasGTKAgg widget and - a toolbar to a gtk.Window - """ - import gtk - - from matplotlib.figure import Figure - from numpy import arange, sin, pi - - # uncomment to select /GTK/GTKAgg/GTKCairo - #from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas - from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas - #from matplotlib.backends.backend_gtkcairo import FigureCanvasGTKCairo as FigureCanvas - - # or NavigationToolbar for classic - #from matplotlib.backends.backend_gtk import NavigationToolbar2GTK as NavigationToolbar - from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar - - # implement the default mpl key bindings - from matplotlib.backend_bases import key_press_handler - - win = gtk.Window() - win.connect("destroy", lambda x: gtk.main_quit()) - win.set_default_size(400, 300) - win.set_title("Embedding in GTK") - - vbox = gtk.VBox() - win.add(vbox) - - fig = Figure(figsize=(5, 4), dpi=100) - ax = fig.add_subplot(111) - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - - ax.plot(t, s) - - - canvas = FigureCanvas(fig) # a gtk.DrawingArea - vbox.pack_start(canvas) - toolbar = NavigationToolbar(canvas, win) - vbox.pack_start(toolbar, False, False) - - - def on_key_event(event): - print('you pressed %s' % event.key) - key_press_handler(event, canvas, toolbar) - - canvas.mpl_connect('key_press_event', on_key_event) - - win.show_all() - gtk.main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_gtk3.rst.txt b/_sources/examples/user_interfaces/embedding_in_gtk3.rst.txt deleted file mode 100644 index cee1ce1e3ed..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_gtk3.rst.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _user_interfaces-embedding_in_gtk3: - -user_interfaces example code: embedding_in_gtk3.py -================================================== - -[`source code `_] - -:: - - """ - demonstrate adding a FigureCanvasGTK3Agg widget to a Gtk.ScrolledWindow - using GTK3 accessed via pygobject - """ - - from gi.repository import Gtk - - from matplotlib.figure import Figure - from numpy import arange, sin, pi - from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanvas - - win = Gtk.Window() - win.connect("delete-event", Gtk.main_quit) - win.set_default_size(400, 300) - win.set_title("Embedding in GTK") - - f = Figure(figsize=(5, 4), dpi=100) - a = f.add_subplot(111) - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - a.plot(t, s) - - sw = Gtk.ScrolledWindow() - win.add(sw) - # A scrolled window border goes outside the scrollbars and viewport - sw.set_border_width(10) - - canvas = FigureCanvas(f) # a Gtk.DrawingArea - canvas.set_size_request(800, 600) - sw.add_with_viewport(canvas) - - win.show_all() - Gtk.main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_gtk3.txt b/_sources/examples/user_interfaces/embedding_in_gtk3.txt deleted file mode 100644 index 07f497f117b..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_gtk3.txt +++ /dev/null @@ -1,46 +0,0 @@ -.. _user_interfaces-embedding_in_gtk3: - -user_interfaces example code: embedding_in_gtk3.py -================================================== - -[`source code `_] - -:: - - #!/usr/bin/env python - """ - demonstrate adding a FigureCanvasGTK3Agg widget to a Gtk.ScrolledWindow - using GTK3 accessed via pygobject - """ - - from gi.repository import Gtk - - from matplotlib.figure import Figure - from numpy import arange, sin, pi - from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanvas - - win = Gtk.Window() - win.connect("delete-event", Gtk.main_quit) - win.set_default_size(400, 300) - win.set_title("Embedding in GTK") - - f = Figure(figsize=(5, 4), dpi=100) - a = f.add_subplot(111) - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - a.plot(t, s) - - sw = Gtk.ScrolledWindow() - win.add(sw) - # A scrolled window border goes outside the scrollbars and viewport - sw.set_border_width(10) - - canvas = FigureCanvas(f) # a Gtk.DrawingArea - canvas.set_size_request(800, 600) - sw.add_with_viewport(canvas) - - win.show_all() - Gtk.main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_gtk3_panzoom.rst.txt b/_sources/examples/user_interfaces/embedding_in_gtk3_panzoom.rst.txt deleted file mode 100644 index 6e4384cffb8..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_gtk3_panzoom.rst.txt +++ /dev/null @@ -1,47 +0,0 @@ -.. _user_interfaces-embedding_in_gtk3_panzoom: - -user_interfaces example code: embedding_in_gtk3_panzoom.py -========================================================== - -[`source code `_] - -:: - - """ - demonstrate NavigationToolbar with GTK3 accessed via pygobject - """ - - from gi.repository import Gtk - - from matplotlib.figure import Figure - from numpy import arange, sin, pi - from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanvas - from matplotlib.backends.backend_gtk3 import NavigationToolbar2GTK3 as NavigationToolbar - - win = Gtk.Window() - win.connect("delete-event", Gtk.main_quit) - win.set_default_size(400, 300) - win.set_title("Embedding in GTK") - - f = Figure(figsize=(5, 4), dpi=100) - a = f.add_subplot(1, 1, 1) - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - a.plot(t, s) - - vbox = Gtk.VBox() - win.add(vbox) - - # Add canvas to vbox - canvas = FigureCanvas(f) # a Gtk.DrawingArea - vbox.pack_start(canvas, True, True, 0) - - # Create toolbar - toolbar = NavigationToolbar(canvas, win) - vbox.pack_start(toolbar, False, False, 0) - - win.show_all() - Gtk.main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_gtk3_panzoom.txt b/_sources/examples/user_interfaces/embedding_in_gtk3_panzoom.txt deleted file mode 100644 index def1fcb4bb3..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_gtk3_panzoom.txt +++ /dev/null @@ -1,48 +0,0 @@ -.. _user_interfaces-embedding_in_gtk3_panzoom: - -user_interfaces example code: embedding_in_gtk3_panzoom.py -========================================================== - -[`source code `_] - -:: - - #!/usr/bin/env python - """ - demonstrate NavigationToolbar with GTK3 accessed via pygobject - """ - - from gi.repository import Gtk - - from matplotlib.figure import Figure - from numpy import arange, sin, pi - from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanvas - from matplotlib.backends.backend_gtk3 import NavigationToolbar2GTK3 as NavigationToolbar - - win = Gtk.Window() - win.connect("delete-event", Gtk.main_quit) - win.set_default_size(400, 300) - win.set_title("Embedding in GTK") - - f = Figure(figsize=(5, 4), dpi=100) - a = f.add_subplot(1, 1, 1) - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - a.plot(t, s) - - vbox = Gtk.VBox() - win.add(vbox) - - # Add canvas to vbox - canvas = FigureCanvas(f) # a Gtk.DrawingArea - vbox.pack_start(canvas, True, True, 0) - - # Create toolbar - toolbar = NavigationToolbar(canvas, win) - vbox.pack_start(toolbar, False, False, 0) - - win.show_all() - Gtk.main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_qt.txt b/_sources/examples/user_interfaces/embedding_in_qt.txt deleted file mode 100644 index 48242a12829..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_qt.txt +++ /dev/null @@ -1,149 +0,0 @@ -.. _user_interfaces-embedding_in_qt: - -user_interfaces example code: embedding_in_qt.py -================================================ - -[`source code `_] - -:: - - #! /usr/bin/env python - - # embedding_in_qt.py --- Simple Qt application embedding matplotlib canvases - # - # Copyright (C) 2005 Florent Rougon - # - # This file is an example program for matplotlib. It may be used and - # modified with no restriction; raw copies as well as modified versions - # may be distributed without limitation. - - from __future__ import unicode_literals - import sys, os, random - from qt import * - - from numpy import arange, sin, pi - from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg as FigureCanvas - from matplotlib.figure import Figure - - # This seems to be what PyQt expects, according to the examples shipped in - # its distribution. - TRUE = 1 - FALSE = 0 - - progname = os.path.basename(sys.argv[0]) - progversion = "0.1" - - # Note: color-intensive applications may require a different color allocation - # strategy. - #QApplication.setColorSpec(QApplication.NormalColor) - app = QApplication(sys.argv) - - class MyMplCanvas(FigureCanvas): - """Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.).""" - def __init__(self, parent=None, width=5, height=4, dpi=100): - self.fig = Figure(figsize=(width, height), dpi=dpi) - self.axes = self.fig.add_subplot(111) - # We want the axes cleared every time plot() is called - self.axes.hold(False) - - self.compute_initial_figure() - - FigureCanvas.__init__(self, self.fig) - self.reparent(parent, QPoint(0, 0)) - - FigureCanvas.setSizePolicy(self, - QSizePolicy.Expanding, - QSizePolicy.Expanding) - FigureCanvas.updateGeometry(self) - - def sizeHint(self): - w, h = self.get_width_height() - return QSize(w, h) - - def minimumSizeHint(self): - return QSize(10, 10) - - - class MyStaticMplCanvas(MyMplCanvas): - """Simple canvas with a sine plot.""" - def compute_initial_figure(self): - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - self.axes.plot(t, s) - - - class MyDynamicMplCanvas(MyMplCanvas): - """A canvas that updates itself every second with a new plot.""" - def __init__(self, *args, **kwargs): - MyMplCanvas.__init__(self, *args, **kwargs) - timer = QTimer(self, "canvas update timer") - QObject.connect(timer, SIGNAL("timeout()"), self.update_figure) - timer.start(1000, FALSE) - - def compute_initial_figure(self): - self.axes.plot([0, 1, 2, 3], [1, 2, 0, 4], 'r') - - def update_figure(self): - # Build a list of 4 random integers between 0 and 10 (both inclusive) - l = [ random.randint(0, 10) for i in range(4) ] - - self.axes.plot([0, 1, 2, 3], l, 'r') - self.draw() - - - class ApplicationWindow(QMainWindow): - def __init__(self): - QMainWindow.__init__(self, None, - "application main window", - Qt.WType_TopLevel | Qt.WDestructiveClose) - - self.file_menu = QPopupMenu(self) - self.file_menu.insertItem('&Quit', self.fileQuit, Qt.CTRL + Qt.Key_Q) - self.menuBar().insertItem('&File', self.file_menu) - - self.help_menu = QPopupMenu(self) - self.menuBar().insertSeparator() - self.menuBar().insertItem('&Help', self.help_menu) - - self.help_menu.insertItem('&About', self.about) - - self.main_widget = QWidget(self, "Main widget") - - l = QVBoxLayout(self.main_widget) - sc = MyStaticMplCanvas(self.main_widget, width=5, height=4, dpi=100) - dc = MyDynamicMplCanvas(self.main_widget, width=5, height=4, dpi=100) - l.addWidget(sc) - l.addWidget(dc) - - self.main_widget.setFocus() - self.setCentralWidget(self.main_widget) - - self.statusBar().message("All hail matplotlib!", 2000) - - def fileQuit(self): - qApp.exit(0) - - def closeEvent(self, ce): - self.fileQuit() - - def about(self): - QMessageBox.about(self, "About %s" % progname, - """%(prog)s version %(version)s - Copyright \N{COPYRIGHT SIGN} 2005 Florent Rougon - - This program is a simple example of a Qt application embedding matplotlib - canvases. - - It may be used and modified with no restriction; raw copies as well as - modified versions may be distributed without limitation.""" - % {"prog": progname, "version": progversion}) - - - aw = ApplicationWindow() - aw.setCaption("%s" % progname) - qApp.setMainWidget(aw) - aw.show() - sys.exit(qApp.exec_loop()) - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_qt4.rst.txt b/_sources/examples/user_interfaces/embedding_in_qt4.rst.txt deleted file mode 100644 index bdb78bdd26d..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_qt4.rst.txt +++ /dev/null @@ -1,147 +0,0 @@ -.. _user_interfaces-embedding_in_qt4: - -user_interfaces example code: embedding_in_qt4.py -================================================= - -[`source code `_] - -:: - - - # embedding_in_qt4.py --- Simple Qt4 application embedding matplotlib canvases - # - # Copyright (C) 2005 Florent Rougon - # 2006 Darren Dale - # - # This file is an example program for matplotlib. It may be used and - # modified with no restriction; raw copies as well as modified versions - # may be distributed without limitation. - - from __future__ import unicode_literals - import sys - import os - import random - from matplotlib.backends import qt_compat - use_pyside = qt_compat.QT_API == qt_compat.QT_API_PYSIDE - if use_pyside: - from PySide import QtGui, QtCore - else: - from PyQt4 import QtGui, QtCore - - from numpy import arange, sin, pi - from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas - from matplotlib.figure import Figure - - progname = os.path.basename(sys.argv[0]) - progversion = "0.1" - - - class MyMplCanvas(FigureCanvas): - """Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.).""" - - def __init__(self, parent=None, width=5, height=4, dpi=100): - fig = Figure(figsize=(width, height), dpi=dpi) - self.axes = fig.add_subplot(111) - - self.compute_initial_figure() - - FigureCanvas.__init__(self, fig) - self.setParent(parent) - - FigureCanvas.setSizePolicy(self, - QtGui.QSizePolicy.Expanding, - QtGui.QSizePolicy.Expanding) - FigureCanvas.updateGeometry(self) - - def compute_initial_figure(self): - pass - - - class MyStaticMplCanvas(MyMplCanvas): - """Simple canvas with a sine plot.""" - - def compute_initial_figure(self): - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - self.axes.plot(t, s) - - - class MyDynamicMplCanvas(MyMplCanvas): - """A canvas that updates itself every second with a new plot.""" - - def __init__(self, *args, **kwargs): - MyMplCanvas.__init__(self, *args, **kwargs) - timer = QtCore.QTimer(self) - timer.timeout.connect(self.update_figure) - timer.start(1000) - - def compute_initial_figure(self): - self.axes.plot([0, 1, 2, 3], [1, 2, 0, 4], 'r') - - def update_figure(self): - # Build a list of 4 random integers between 0 and 10 (both inclusive) - l = [random.randint(0, 10) for i in range(4)] - self.axes.cla() - self.axes.plot([0, 1, 2, 3], l, 'r') - self.draw() - - - class ApplicationWindow(QtGui.QMainWindow): - def __init__(self): - QtGui.QMainWindow.__init__(self) - self.setAttribute(QtCore.Qt.WA_DeleteOnClose) - self.setWindowTitle("application main window") - - self.file_menu = QtGui.QMenu('&File', self) - self.file_menu.addAction('&Quit', self.fileQuit, - QtCore.Qt.CTRL + QtCore.Qt.Key_Q) - self.menuBar().addMenu(self.file_menu) - - self.help_menu = QtGui.QMenu('&Help', self) - self.menuBar().addSeparator() - self.menuBar().addMenu(self.help_menu) - - self.help_menu.addAction('&About', self.about) - - self.main_widget = QtGui.QWidget(self) - - l = QtGui.QVBoxLayout(self.main_widget) - sc = MyStaticMplCanvas(self.main_widget, width=5, height=4, dpi=100) - dc = MyDynamicMplCanvas(self.main_widget, width=5, height=4, dpi=100) - l.addWidget(sc) - l.addWidget(dc) - - self.main_widget.setFocus() - self.setCentralWidget(self.main_widget) - - self.statusBar().showMessage("All hail matplotlib!", 2000) - - def fileQuit(self): - self.close() - - def closeEvent(self, ce): - self.fileQuit() - - def about(self): - QtGui.QMessageBox.about(self, "About", - """embedding_in_qt4.py example - Copyright 2005 Florent Rougon, 2006 Darren Dale - - This program is a simple example of a Qt4 application embedding matplotlib - canvases. - - It may be used and modified with no restriction; raw copies as well as - modified versions may be distributed without limitation.""" - ) - - - qApp = QtGui.QApplication(sys.argv) - - aw = ApplicationWindow() - aw.setWindowTitle("%s" % progname) - aw.show() - sys.exit(qApp.exec_()) - #qApp.exec_() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_qt4.txt b/_sources/examples/user_interfaces/embedding_in_qt4.txt deleted file mode 100644 index 624263d4fcc..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_qt4.txt +++ /dev/null @@ -1,151 +0,0 @@ -.. _user_interfaces-embedding_in_qt4: - -user_interfaces example code: embedding_in_qt4.py -================================================= - -[`source code `_] - -:: - - #!/usr/bin/env python - - # embedding_in_qt4.py --- Simple Qt4 application embedding matplotlib canvases - # - # Copyright (C) 2005 Florent Rougon - # 2006 Darren Dale - # - # This file is an example program for matplotlib. It may be used and - # modified with no restriction; raw copies as well as modified versions - # may be distributed without limitation. - - from __future__ import unicode_literals - import sys - import os - import random - from matplotlib.backends import qt_compat - use_pyside = qt_compat.QT_API == qt_compat.QT_API_PYSIDE - if use_pyside: - from PySide import QtGui, QtCore - else: - from PyQt4 import QtGui, QtCore - - from numpy import arange, sin, pi - from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas - from matplotlib.figure import Figure - - progname = os.path.basename(sys.argv[0]) - progversion = "0.1" - - - class MyMplCanvas(FigureCanvas): - """Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.).""" - - def __init__(self, parent=None, width=5, height=4, dpi=100): - fig = Figure(figsize=(width, height), dpi=dpi) - self.axes = fig.add_subplot(111) - # We want the axes cleared every time plot() is called - self.axes.hold(False) - - self.compute_initial_figure() - - # - FigureCanvas.__init__(self, fig) - self.setParent(parent) - - FigureCanvas.setSizePolicy(self, - QtGui.QSizePolicy.Expanding, - QtGui.QSizePolicy.Expanding) - FigureCanvas.updateGeometry(self) - - def compute_initial_figure(self): - pass - - - class MyStaticMplCanvas(MyMplCanvas): - """Simple canvas with a sine plot.""" - - def compute_initial_figure(self): - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - self.axes.plot(t, s) - - - class MyDynamicMplCanvas(MyMplCanvas): - """A canvas that updates itself every second with a new plot.""" - - def __init__(self, *args, **kwargs): - MyMplCanvas.__init__(self, *args, **kwargs) - timer = QtCore.QTimer(self) - timer.timeout.connect(self.update_figure) - timer.start(1000) - - def compute_initial_figure(self): - self.axes.plot([0, 1, 2, 3], [1, 2, 0, 4], 'r') - - def update_figure(self): - # Build a list of 4 random integers between 0 and 10 (both inclusive) - l = [random.randint(0, 10) for i in range(4)] - - self.axes.plot([0, 1, 2, 3], l, 'r') - self.draw() - - - class ApplicationWindow(QtGui.QMainWindow): - def __init__(self): - QtGui.QMainWindow.__init__(self) - self.setAttribute(QtCore.Qt.WA_DeleteOnClose) - self.setWindowTitle("application main window") - - self.file_menu = QtGui.QMenu('&File', self) - self.file_menu.addAction('&Quit', self.fileQuit, - QtCore.Qt.CTRL + QtCore.Qt.Key_Q) - self.menuBar().addMenu(self.file_menu) - - self.help_menu = QtGui.QMenu('&Help', self) - self.menuBar().addSeparator() - self.menuBar().addMenu(self.help_menu) - - self.help_menu.addAction('&About', self.about) - - self.main_widget = QtGui.QWidget(self) - - l = QtGui.QVBoxLayout(self.main_widget) - sc = MyStaticMplCanvas(self.main_widget, width=5, height=4, dpi=100) - dc = MyDynamicMplCanvas(self.main_widget, width=5, height=4, dpi=100) - l.addWidget(sc) - l.addWidget(dc) - - self.main_widget.setFocus() - self.setCentralWidget(self.main_widget) - - self.statusBar().showMessage("All hail matplotlib!", 2000) - - def fileQuit(self): - self.close() - - def closeEvent(self, ce): - self.fileQuit() - - def about(self): - QtGui.QMessageBox.about(self, "About", - """embedding_in_qt4.py example - Copyright 2005 Florent Rougon, 2006 Darren Dale - - This program is a simple example of a Qt4 application embedding matplotlib - canvases. - - It may be used and modified with no restriction; raw copies as well as - modified versions may be distributed without limitation.""" - ) - - - qApp = QtGui.QApplication(sys.argv) - - aw = ApplicationWindow() - aw.setWindowTitle("%s" % progname) - aw.show() - sys.exit(qApp.exec_()) - #qApp.exec_() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_qt4_wtoolbar.rst.txt b/_sources/examples/user_interfaces/embedding_in_qt4_wtoolbar.rst.txt deleted file mode 100644 index 7f07478b4f7..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_qt4_wtoolbar.rst.txt +++ /dev/null @@ -1,86 +0,0 @@ -.. _user_interfaces-embedding_in_qt4_wtoolbar: - -user_interfaces example code: embedding_in_qt4_wtoolbar.py -========================================================== - -[`source code `_] - -:: - - from __future__ import print_function - - import sys - - import numpy as np - from matplotlib.figure import Figure - from matplotlib.backend_bases import key_press_handler - from matplotlib.backends.backend_qt4agg import ( - FigureCanvasQTAgg as FigureCanvas, - NavigationToolbar2QT as NavigationToolbar) - from matplotlib.backends import qt4_compat - use_pyside = qt4_compat.QT_API == qt4_compat.QT_API_PYSIDE - - if use_pyside: - from PySide.QtCore import * - from PySide.QtGui import * - else: - from PyQt4.QtCore import * - from PyQt4.QtGui import * - - - class AppForm(QMainWindow): - def __init__(self, parent=None): - QMainWindow.__init__(self, parent) - #self.x, self.y = self.get_data() - self.data = self.get_data2() - self.create_main_frame() - self.on_draw() - - def create_main_frame(self): - self.main_frame = QWidget() - - self.fig = Figure((5.0, 4.0), dpi=100) - self.canvas = FigureCanvas(self.fig) - self.canvas.setParent(self.main_frame) - self.canvas.setFocusPolicy(Qt.StrongFocus) - self.canvas.setFocus() - - self.mpl_toolbar = NavigationToolbar(self.canvas, self.main_frame) - - self.canvas.mpl_connect('key_press_event', self.on_key_press) - - vbox = QVBoxLayout() - vbox.addWidget(self.canvas) # the matplotlib canvas - vbox.addWidget(self.mpl_toolbar) - self.main_frame.setLayout(vbox) - self.setCentralWidget(self.main_frame) - - def get_data2(self): - return np.arange(20).reshape([4, 5]).copy() - - def on_draw(self): - self.fig.clear() - self.axes = self.fig.add_subplot(111) - #self.axes.plot(self.x, self.y, 'ro') - self.axes.imshow(self.data, interpolation='nearest') - #self.axes.plot([1,2,3]) - self.canvas.draw() - - def on_key_press(self, event): - print('you pressed', event.key) - # implement the default mpl key press events described at - # http://matplotlib.org/users/navigation_toolbar.html#navigation-keyboard-shortcuts - key_press_handler(event, self.canvas, self.mpl_toolbar) - - - def main(): - app = QApplication(sys.argv) - form = AppForm() - form.show() - app.exec_() - - if __name__ == "__main__": - main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_qt4_wtoolbar.txt b/_sources/examples/user_interfaces/embedding_in_qt4_wtoolbar.txt deleted file mode 100644 index 7f07478b4f7..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_qt4_wtoolbar.txt +++ /dev/null @@ -1,86 +0,0 @@ -.. _user_interfaces-embedding_in_qt4_wtoolbar: - -user_interfaces example code: embedding_in_qt4_wtoolbar.py -========================================================== - -[`source code `_] - -:: - - from __future__ import print_function - - import sys - - import numpy as np - from matplotlib.figure import Figure - from matplotlib.backend_bases import key_press_handler - from matplotlib.backends.backend_qt4agg import ( - FigureCanvasQTAgg as FigureCanvas, - NavigationToolbar2QT as NavigationToolbar) - from matplotlib.backends import qt4_compat - use_pyside = qt4_compat.QT_API == qt4_compat.QT_API_PYSIDE - - if use_pyside: - from PySide.QtCore import * - from PySide.QtGui import * - else: - from PyQt4.QtCore import * - from PyQt4.QtGui import * - - - class AppForm(QMainWindow): - def __init__(self, parent=None): - QMainWindow.__init__(self, parent) - #self.x, self.y = self.get_data() - self.data = self.get_data2() - self.create_main_frame() - self.on_draw() - - def create_main_frame(self): - self.main_frame = QWidget() - - self.fig = Figure((5.0, 4.0), dpi=100) - self.canvas = FigureCanvas(self.fig) - self.canvas.setParent(self.main_frame) - self.canvas.setFocusPolicy(Qt.StrongFocus) - self.canvas.setFocus() - - self.mpl_toolbar = NavigationToolbar(self.canvas, self.main_frame) - - self.canvas.mpl_connect('key_press_event', self.on_key_press) - - vbox = QVBoxLayout() - vbox.addWidget(self.canvas) # the matplotlib canvas - vbox.addWidget(self.mpl_toolbar) - self.main_frame.setLayout(vbox) - self.setCentralWidget(self.main_frame) - - def get_data2(self): - return np.arange(20).reshape([4, 5]).copy() - - def on_draw(self): - self.fig.clear() - self.axes = self.fig.add_subplot(111) - #self.axes.plot(self.x, self.y, 'ro') - self.axes.imshow(self.data, interpolation='nearest') - #self.axes.plot([1,2,3]) - self.canvas.draw() - - def on_key_press(self, event): - print('you pressed', event.key) - # implement the default mpl key press events described at - # http://matplotlib.org/users/navigation_toolbar.html#navigation-keyboard-shortcuts - key_press_handler(event, self.canvas, self.mpl_toolbar) - - - def main(): - app = QApplication(sys.argv) - form = AppForm() - form.show() - app.exec_() - - if __name__ == "__main__": - main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_qt5.rst.txt b/_sources/examples/user_interfaces/embedding_in_qt5.rst.txt deleted file mode 100644 index fd1be8482aa..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_qt5.rst.txt +++ /dev/null @@ -1,149 +0,0 @@ -.. _user_interfaces-embedding_in_qt5: - -user_interfaces example code: embedding_in_qt5.py -================================================= - -[`source code `_] - -:: - - - # embedding_in_qt5.py --- Simple Qt5 application embedding matplotlib canvases - # - # Copyright (C) 2005 Florent Rougon - # 2006 Darren Dale - # 2015 Jens H Nielsen - # - # This file is an example program for matplotlib. It may be used and - # modified with no restriction; raw copies as well as modified versions - # may be distributed without limitation. - - from __future__ import unicode_literals - import sys - import os - import random - import matplotlib - # Make sure that we are using QT5 - matplotlib.use('Qt5Agg') - from PyQt5 import QtCore, QtWidgets - - from numpy import arange, sin, pi - from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas - from matplotlib.figure import Figure - - progname = os.path.basename(sys.argv[0]) - progversion = "0.1" - - - class MyMplCanvas(FigureCanvas): - """Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.).""" - - def __init__(self, parent=None, width=5, height=4, dpi=100): - fig = Figure(figsize=(width, height), dpi=dpi) - self.axes = fig.add_subplot(111) - - self.compute_initial_figure() - - FigureCanvas.__init__(self, fig) - self.setParent(parent) - - FigureCanvas.setSizePolicy(self, - QtWidgets.QSizePolicy.Expanding, - QtWidgets.QSizePolicy.Expanding) - FigureCanvas.updateGeometry(self) - - def compute_initial_figure(self): - pass - - - class MyStaticMplCanvas(MyMplCanvas): - """Simple canvas with a sine plot.""" - - def compute_initial_figure(self): - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - self.axes.plot(t, s) - - - class MyDynamicMplCanvas(MyMplCanvas): - """A canvas that updates itself every second with a new plot.""" - - def __init__(self, *args, **kwargs): - MyMplCanvas.__init__(self, *args, **kwargs) - timer = QtCore.QTimer(self) - timer.timeout.connect(self.update_figure) - timer.start(1000) - - def compute_initial_figure(self): - self.axes.plot([0, 1, 2, 3], [1, 2, 0, 4], 'r') - - def update_figure(self): - # Build a list of 4 random integers between 0 and 10 (both inclusive) - l = [random.randint(0, 10) for i in range(4)] - self.axes.cla() - self.axes.plot([0, 1, 2, 3], l, 'r') - self.draw() - - - class ApplicationWindow(QtWidgets.QMainWindow): - def __init__(self): - QtWidgets.QMainWindow.__init__(self) - self.setAttribute(QtCore.Qt.WA_DeleteOnClose) - self.setWindowTitle("application main window") - - self.file_menu = QtWidgets.QMenu('&File', self) - self.file_menu.addAction('&Quit', self.fileQuit, - QtCore.Qt.CTRL + QtCore.Qt.Key_Q) - self.menuBar().addMenu(self.file_menu) - - self.help_menu = QtWidgets.QMenu('&Help', self) - self.menuBar().addSeparator() - self.menuBar().addMenu(self.help_menu) - - self.help_menu.addAction('&About', self.about) - - self.main_widget = QtWidgets.QWidget(self) - - l = QtWidgets.QVBoxLayout(self.main_widget) - sc = MyStaticMplCanvas(self.main_widget, width=5, height=4, dpi=100) - dc = MyDynamicMplCanvas(self.main_widget, width=5, height=4, dpi=100) - l.addWidget(sc) - l.addWidget(dc) - - self.main_widget.setFocus() - self.setCentralWidget(self.main_widget) - - self.statusBar().showMessage("All hail matplotlib!", 2000) - - def fileQuit(self): - self.close() - - def closeEvent(self, ce): - self.fileQuit() - - def about(self): - QtWidgets.QMessageBox.about(self, "About", - """embedding_in_qt5.py example - Copyright 2005 Florent Rougon, 2006 Darren Dale, 2015 Jens H Nielsen - - This program is a simple example of a Qt5 application embedding matplotlib - canvases. - - It may be used and modified with no restriction; raw copies as well as - modified versions may be distributed without limitation. - - This is modified from the embedding in qt4 example to show the difference - between qt4 and qt5""" - ) - - - qApp = QtWidgets.QApplication(sys.argv) - - aw = ApplicationWindow() - aw.setWindowTitle("%s" % progname) - aw.show() - sys.exit(qApp.exec_()) - #qApp.exec_() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_qt5.txt b/_sources/examples/user_interfaces/embedding_in_qt5.txt deleted file mode 100644 index 6d539d62bd8..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_qt5.txt +++ /dev/null @@ -1,153 +0,0 @@ -.. _user_interfaces-embedding_in_qt5: - -user_interfaces example code: embedding_in_qt5.py -================================================= - -[`source code `_] - -:: - - #!/usr/bin/env python - - # embedding_in_qt5.py --- Simple Qt5 application embedding matplotlib canvases - # - # Copyright (C) 2005 Florent Rougon - # 2006 Darren Dale - # 2015 Jens H Nielsen - # - # This file is an example program for matplotlib. It may be used and - # modified with no restriction; raw copies as well as modified versions - # may be distributed without limitation. - - from __future__ import unicode_literals - import sys - import os - import random - import matplotlib - # Make sure that we are using QT5 - matplotlib.use('Qt5Agg') - from PyQt5 import QtCore, QtWidgets - - from numpy import arange, sin, pi - from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas - from matplotlib.figure import Figure - - progname = os.path.basename(sys.argv[0]) - progversion = "0.1" - - - class MyMplCanvas(FigureCanvas): - """Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.).""" - - def __init__(self, parent=None, width=5, height=4, dpi=100): - fig = Figure(figsize=(width, height), dpi=dpi) - self.axes = fig.add_subplot(111) - # We want the axes cleared every time plot() is called - self.axes.hold(False) - - self.compute_initial_figure() - - # - FigureCanvas.__init__(self, fig) - self.setParent(parent) - - FigureCanvas.setSizePolicy(self, - QtWidgets.QSizePolicy.Expanding, - QtWidgets.QSizePolicy.Expanding) - FigureCanvas.updateGeometry(self) - - def compute_initial_figure(self): - pass - - - class MyStaticMplCanvas(MyMplCanvas): - """Simple canvas with a sine plot.""" - - def compute_initial_figure(self): - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - self.axes.plot(t, s) - - - class MyDynamicMplCanvas(MyMplCanvas): - """A canvas that updates itself every second with a new plot.""" - - def __init__(self, *args, **kwargs): - MyMplCanvas.__init__(self, *args, **kwargs) - timer = QtCore.QTimer(self) - timer.timeout.connect(self.update_figure) - timer.start(1000) - - def compute_initial_figure(self): - self.axes.plot([0, 1, 2, 3], [1, 2, 0, 4], 'r') - - def update_figure(self): - # Build a list of 4 random integers between 0 and 10 (both inclusive) - l = [random.randint(0, 10) for i in range(4)] - - self.axes.plot([0, 1, 2, 3], l, 'r') - self.draw() - - - class ApplicationWindow(QtWidgets.QMainWindow): - def __init__(self): - QtWidgets.QMainWindow.__init__(self) - self.setAttribute(QtCore.Qt.WA_DeleteOnClose) - self.setWindowTitle("application main window") - - self.file_menu = QtWidgets.QMenu('&File', self) - self.file_menu.addAction('&Quit', self.fileQuit, - QtCore.Qt.CTRL + QtCore.Qt.Key_Q) - self.menuBar().addMenu(self.file_menu) - - self.help_menu = QtWidgets.QMenu('&Help', self) - self.menuBar().addSeparator() - self.menuBar().addMenu(self.help_menu) - - self.help_menu.addAction('&About', self.about) - - self.main_widget = QtWidgets.QWidget(self) - - l = QtWidgets.QVBoxLayout(self.main_widget) - sc = MyStaticMplCanvas(self.main_widget, width=5, height=4, dpi=100) - dc = MyDynamicMplCanvas(self.main_widget, width=5, height=4, dpi=100) - l.addWidget(sc) - l.addWidget(dc) - - self.main_widget.setFocus() - self.setCentralWidget(self.main_widget) - - self.statusBar().showMessage("All hail matplotlib!", 2000) - - def fileQuit(self): - self.close() - - def closeEvent(self, ce): - self.fileQuit() - - def about(self): - QtWidgets.QMessageBox.about(self, "About", - """embedding_in_qt5.py example - Copyright 2005 Florent Rougon, 2006 Darren Dale, 2015 Jens H Nielsen - - This program is a simple example of a Qt5 application embedding matplotlib - canvases. - - It may be used and modified with no restriction; raw copies as well as - modified versions may be distributed without limitation. - - This is modified from the embedding in qt4 example to show the difference - between qt4 and qt5""" - ) - - - qApp = QtWidgets.QApplication(sys.argv) - - aw = ApplicationWindow() - aw.setWindowTitle("%s" % progname) - aw.show() - sys.exit(qApp.exec_()) - #qApp.exec_() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_tk.rst.txt b/_sources/examples/user_interfaces/embedding_in_tk.rst.txt deleted file mode 100644 index 24ba8e52729..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_tk.rst.txt +++ /dev/null @@ -1,69 +0,0 @@ -.. _user_interfaces-embedding_in_tk: - -user_interfaces example code: embedding_in_tk.py -================================================ - -[`source code `_] - -:: - - import matplotlib - matplotlib.use('TkAgg') - - from numpy import arange, sin, pi - from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg - # implement the default mpl key bindings - from matplotlib.backend_bases import key_press_handler - - - from matplotlib.figure import Figure - - import sys - if sys.version_info[0] < 3: - import Tkinter as Tk - else: - import tkinter as Tk - - root = Tk.Tk() - root.wm_title("Embedding in TK") - - - f = Figure(figsize=(5, 4), dpi=100) - a = f.add_subplot(111) - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - - a.plot(t, s) - - - # a tk.DrawingArea - canvas = FigureCanvasTkAgg(f, master=root) - canvas.show() - canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1) - - toolbar = NavigationToolbar2TkAgg(canvas, root) - toolbar.update() - canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1) - - - def on_key_event(event): - print('you pressed %s' % event.key) - key_press_handler(event, canvas, toolbar) - - canvas.mpl_connect('key_press_event', on_key_event) - - - def _quit(): - root.quit() # stops mainloop - root.destroy() # this is necessary on Windows to prevent - # Fatal Python Error: PyEval_RestoreThread: NULL tstate - - button = Tk.Button(master=root, text='Quit', command=_quit) - button.pack(side=Tk.BOTTOM) - - Tk.mainloop() - # If you put root.destroy() here, it will cause an error if - # the window is closed with the window manager. - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_tk.txt b/_sources/examples/user_interfaces/embedding_in_tk.txt deleted file mode 100644 index 9ae7050242b..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_tk.txt +++ /dev/null @@ -1,71 +0,0 @@ -.. _user_interfaces-embedding_in_tk: - -user_interfaces example code: embedding_in_tk.py -================================================ - -[`source code `_] - -:: - - #!/usr/bin/env python - - import matplotlib - matplotlib.use('TkAgg') - - from numpy import arange, sin, pi - from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg - # implement the default mpl key bindings - from matplotlib.backend_bases import key_press_handler - - - from matplotlib.figure import Figure - - import sys - if sys.version_info[0] < 3: - import Tkinter as Tk - else: - import tkinter as Tk - - root = Tk.Tk() - root.wm_title("Embedding in TK") - - - f = Figure(figsize=(5, 4), dpi=100) - a = f.add_subplot(111) - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - - a.plot(t, s) - - - # a tk.DrawingArea - canvas = FigureCanvasTkAgg(f, master=root) - canvas.show() - canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1) - - toolbar = NavigationToolbar2TkAgg(canvas, root) - toolbar.update() - canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1) - - - def on_key_event(event): - print('you pressed %s' % event.key) - key_press_handler(event, canvas, toolbar) - - canvas.mpl_connect('key_press_event', on_key_event) - - - def _quit(): - root.quit() # stops mainloop - root.destroy() # this is necessary on Windows to prevent - # Fatal Python Error: PyEval_RestoreThread: NULL tstate - - button = Tk.Button(master=root, text='Quit', command=_quit) - button.pack(side=Tk.BOTTOM) - - Tk.mainloop() - # If you put root.destroy() here, it will cause an error if - # the window is closed with the window manager. - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_tk2.rst.txt b/_sources/examples/user_interfaces/embedding_in_tk2.rst.txt deleted file mode 100644 index cba59318518..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_tk2.rst.txt +++ /dev/null @@ -1,55 +0,0 @@ -.. _user_interfaces-embedding_in_tk2: - -user_interfaces example code: embedding_in_tk2.py -================================================= - -[`source code `_] - -:: - - import matplotlib - matplotlib.use('TkAgg') - - from numpy import arange, sin, pi - from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg - from matplotlib.figure import Figure - - import sys - if sys.version_info[0] < 3: - import Tkinter as Tk - else: - import tkinter as Tk - - - def destroy(e): - sys.exit() - - root = Tk.Tk() - root.wm_title("Embedding in TK") - - - f = Figure(figsize=(5, 4), dpi=100) - a = f.add_subplot(111) - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - - a.plot(t, s) - a.set_title('Tk embedding') - a.set_xlabel('X axis label') - a.set_ylabel('Y label') - - - # a tk.DrawingArea - canvas = FigureCanvasTkAgg(f, master=root) - canvas.show() - canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1) - - canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1) - - button = Tk.Button(master=root, text='Quit', command=sys.exit) - button.pack(side=Tk.BOTTOM) - - Tk.mainloop() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_tk2.txt b/_sources/examples/user_interfaces/embedding_in_tk2.txt deleted file mode 100644 index d093543f684..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_tk2.txt +++ /dev/null @@ -1,56 +0,0 @@ -.. _user_interfaces-embedding_in_tk2: - -user_interfaces example code: embedding_in_tk2.py -================================================= - -[`source code `_] - -:: - - #!/usr/bin/env python - import matplotlib - matplotlib.use('TkAgg') - - from numpy import arange, sin, pi - from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg - from matplotlib.figure import Figure - - import sys - if sys.version_info[0] < 3: - import Tkinter as Tk - else: - import tkinter as Tk - - - def destroy(e): - sys.exit() - - root = Tk.Tk() - root.wm_title("Embedding in TK") - - - f = Figure(figsize=(5, 4), dpi=100) - a = f.add_subplot(111) - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - - a.plot(t, s) - a.set_title('Tk embedding') - a.set_xlabel('X axis label') - a.set_ylabel('Y label') - - - # a tk.DrawingArea - canvas = FigureCanvasTkAgg(f, master=root) - canvas.show() - canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1) - - canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1) - - button = Tk.Button(master=root, text='Quit', command=sys.exit) - button.pack(side=Tk.BOTTOM) - - Tk.mainloop() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_tk_canvas.rst.txt b/_sources/examples/user_interfaces/embedding_in_tk_canvas.rst.txt deleted file mode 100644 index f89816f1735..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_tk_canvas.rst.txt +++ /dev/null @@ -1,75 +0,0 @@ -.. _user_interfaces-embedding_in_tk_canvas: - -user_interfaces example code: embedding_in_tk_canvas.py -======================================================= - -[`source code `_] - -:: - - # -*- noplot -*- - - import matplotlib as mpl - import numpy as np - import sys - if sys.version_info[0] < 3: - import Tkinter as tk - else: - import tkinter as tk - import matplotlib.backends.tkagg as tkagg - from matplotlib.backends.backend_agg import FigureCanvasAgg - - - def draw_figure(canvas, figure, loc=(0, 0)): - """ Draw a matplotlib figure onto a Tk canvas - - loc: location of top-left corner of figure on canvas in pixels. - - Inspired by matplotlib source: lib/matplotlib/backends/backend_tkagg.py - """ - figure_canvas_agg = FigureCanvasAgg(figure) - figure_canvas_agg.draw() - figure_x, figure_y, figure_w, figure_h = figure.bbox.bounds - figure_w, figure_h = int(figure_w), int(figure_h) - photo = tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) - - # Position: convert from top-left anchor to center anchor - canvas.create_image(loc[0] + figure_w/2, loc[1] + figure_h/2, image=photo) - - # Unfortunately, there's no accessor for the pointer to the native renderer - tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) - - # Return a handle which contains a reference to the photo object - # which must be kept live or else the picture disappears - return photo - - # Create a canvas - w, h = 300, 200 - window = tk.Tk() - window.title("A figure in a canvas") - canvas = tk.Canvas(window, width=w, height=h) - canvas.pack() - - # Generate some example data - X = np.linspace(0, 2.0*3.14, 50) - Y = np.sin(X) - - # Create the figure we desire to add to an existing canvas - fig = mpl.figure.Figure(figsize=(2, 1)) - ax = fig.add_axes([0, 0, 1, 1]) - ax.plot(X, Y) - - # Keep this handle alive, or else figure will disappear - fig_x, fig_y = 100, 100 - fig_photo = draw_figure(canvas, fig, loc=(fig_x, fig_y)) - fig_w, fig_h = fig_photo.width(), fig_photo.height() - - # Add more elements to the canvas, potentially on top of the figure - canvas.create_line(200, 50, fig_x + fig_w / 2, fig_y + fig_h / 2) - canvas.create_text(200, 50, text="Zero-crossing", anchor="s") - - # Let Tk take over - tk.mainloop() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_tk_canvas.txt b/_sources/examples/user_interfaces/embedding_in_tk_canvas.txt deleted file mode 100644 index 49dd021a364..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_tk_canvas.txt +++ /dev/null @@ -1,76 +0,0 @@ -.. _user_interfaces-embedding_in_tk_canvas: - -user_interfaces example code: embedding_in_tk_canvas.py -======================================================= - -[`source code `_] - -:: - - #!/usr/bin/env python - # -*- noplot -*- - - import matplotlib as mpl - import numpy as np - import sys - if sys.version_info[0] < 3: - import Tkinter as tk - else: - import tkinter as tk - import matplotlib.backends.tkagg as tkagg - from matplotlib.backends.backend_agg import FigureCanvasAgg - - - def draw_figure(canvas, figure, loc=(0, 0)): - """ Draw a matplotlib figure onto a Tk canvas - - loc: location of top-left corner of figure on canvas in pixels. - - Inspired by matplotlib source: lib/matplotlib/backends/backend_tkagg.py - """ - figure_canvas_agg = FigureCanvasAgg(figure) - figure_canvas_agg.draw() - figure_x, figure_y, figure_w, figure_h = figure.bbox.bounds - figure_w, figure_h = int(figure_w), int(figure_h) - photo = tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) - - # Position: convert from top-left anchor to center anchor - canvas.create_image(loc[0] + figure_w/2, loc[1] + figure_h/2, image=photo) - - # Unfortunatly, there's no accessor for the pointer to the native renderer - tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) - - # Return a handle which contains a reference to the photo object - # which must be kept live or else the picture disappears - return photo - - # Create a canvas - w, h = 300, 200 - window = tk.Tk() - window.title("A figure in a canvas") - canvas = tk.Canvas(window, width=w, height=h) - canvas.pack() - - # Generate some example data - X = np.linspace(0, 2.0*3.14, 50) - Y = np.sin(X) - - # Create the figure we desire to add to an existing canvas - fig = mpl.figure.Figure(figsize=(2, 1)) - ax = fig.add_axes([0, 0, 1, 1]) - ax.plot(X, Y) - - # Keep this handle alive, or else figure will disappear - fig_x, fig_y = 100, 100 - fig_photo = draw_figure(canvas, fig, loc=(fig_x, fig_y)) - fig_w, fig_h = fig_photo.width(), fig_photo.height() - - # Add more elements to the canvas, potentially on top of the figure - canvas.create_line(200, 50, fig_x + fig_w / 2, fig_y + fig_h / 2) - canvas.create_text(200, 50, text="Zero-crossing", anchor="s") - - # Let Tk take over - tk.mainloop() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_wx2.rst.txt b/_sources/examples/user_interfaces/embedding_in_wx2.rst.txt deleted file mode 100644 index c16c284cf95..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_wx2.rst.txt +++ /dev/null @@ -1,86 +0,0 @@ -.. _user_interfaces-embedding_in_wx2: - -user_interfaces example code: embedding_in_wx2.py -================================================= - -[`source code `_] - -:: - - """ - An example of how to use wx or wxagg in an application with the new - toolbar - comment out the setA_toolbar line for no toolbar - """ - - # matplotlib requires wxPython 2.8+ - # set the wxPython version in lib\site-packages\wx.pth file - # or if you have wxversion installed un-comment the lines below - #import wxversion - #wxversion.ensureMinimal('2.8') - - from numpy import arange, sin, pi - - import matplotlib - - # uncomment the following to use wx rather than wxagg - #matplotlib.use('WX') - #from matplotlib.backends.backend_wx import FigureCanvasWx as FigureCanvas - - # comment out the following to use wx rather than wxagg - matplotlib.use('WXAgg') - from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas - - from matplotlib.backends.backend_wx import NavigationToolbar2Wx - - from matplotlib.figure import Figure - - import wx - import wx.lib.mixins.inspection as WIT - - - class CanvasFrame(wx.Frame): - def __init__(self): - wx.Frame.__init__(self, None, -1, - 'CanvasFrame', size=(550, 350)) - - self.figure = Figure() - self.axes = self.figure.add_subplot(111) - t = arange(0.0, 3.0, 0.01) - s = sin(2 * pi * t) - - self.axes.plot(t, s) - self.canvas = FigureCanvas(self, -1, self.figure) - - self.sizer = wx.BoxSizer(wx.VERTICAL) - self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.EXPAND) - self.SetSizer(self.sizer) - self.Fit() - - self.add_toolbar() # comment this out for no toolbar - - def add_toolbar(self): - self.toolbar = NavigationToolbar2Wx(self.canvas) - self.toolbar.Realize() - # By adding toolbar in sizer, we are able to put it at the bottom - # of the frame - so appearance is closer to GTK version. - self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) - # update the axes menu on the toolbar - self.toolbar.update() - - - # alternatively you could use - #class App(wx.App): - class App(WIT.InspectableApp): - def OnInit(self): - 'Create the main window and insert the custom frame' - self.Init() - frame = CanvasFrame() - frame.Show(True) - - return True - - app = App(0) - app.MainLoop() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_wx2.txt b/_sources/examples/user_interfaces/embedding_in_wx2.txt deleted file mode 100644 index ac0cf8e1b8a..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_wx2.txt +++ /dev/null @@ -1,87 +0,0 @@ -.. _user_interfaces-embedding_in_wx2: - -user_interfaces example code: embedding_in_wx2.py -================================================= - -[`source code `_] - -:: - - #!/usr/bin/env python - """ - An example of how to use wx or wxagg in an application with the new - toolbar - comment out the setA_toolbar line for no toolbar - """ - - # matplotlib requires wxPython 2.8+ - # set the wxPython version in lib\site-packages\wx.pth file - # or if you have wxversion installed un-comment the lines below - #import wxversion - #wxversion.ensureMinimal('2.8') - - from numpy import arange, sin, pi - - import matplotlib - - # uncomment the following to use wx rather than wxagg - #matplotlib.use('WX') - #from matplotlib.backends.backend_wx import FigureCanvasWx as FigureCanvas - - # comment out the following to use wx rather than wxagg - matplotlib.use('WXAgg') - from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas - - from matplotlib.backends.backend_wx import NavigationToolbar2Wx - - from matplotlib.figure import Figure - - import wx - import wx.lib.mixins.inspection as WIT - - - class CanvasFrame(wx.Frame): - def __init__(self): - wx.Frame.__init__(self, None, -1, - 'CanvasFrame', size=(550, 350)) - - self.figure = Figure() - self.axes = self.figure.add_subplot(111) - t = arange(0.0, 3.0, 0.01) - s = sin(2 * pi * t) - - self.axes.plot(t, s) - self.canvas = FigureCanvas(self, -1, self.figure) - - self.sizer = wx.BoxSizer(wx.VERTICAL) - self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.EXPAND) - self.SetSizer(self.sizer) - self.Fit() - - self.add_toolbar() # comment this out for no toolbar - - def add_toolbar(self): - self.toolbar = NavigationToolbar2Wx(self.canvas) - self.toolbar.Realize() - # By adding toolbar in sizer, we are able to put it at the bottom - # of the frame - so appearance is closer to GTK version. - self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) - # update the axes menu on the toolbar - self.toolbar.update() - - - # alternatively you could use - #class App(wx.App): - class App(WIT.InspectableApp): - def OnInit(self): - 'Create the main window and insert the custom frame' - self.Init() - frame = CanvasFrame() - frame.Show(True) - - return True - - app = App(0) - app.MainLoop() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_wx3.rst.txt b/_sources/examples/user_interfaces/embedding_in_wx3.rst.txt deleted file mode 100644 index 359dcd01d1d..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_wx3.rst.txt +++ /dev/null @@ -1,173 +0,0 @@ -.. _user_interfaces-embedding_in_wx3: - -user_interfaces example code: embedding_in_wx3.py -================================================= - -[`source code `_] - -:: - - """ - Copyright (C) 2003-2004 Andrew Straw, Jeremy O'Donoghue and others - - License: This work is licensed under the PSF. A copy should be included - with this source code, and is also available at - http://www.python.org/psf/license.html - - This is yet another example of using matplotlib with wx. Hopefully - this is pretty full-featured: - - - both matplotlib toolbar and WX buttons manipulate plot - - full wxApp framework, including widget interaction - - XRC (XML wxWidgets resource) file to create GUI (made with XRCed) - - This was derived from embedding_in_wx and dynamic_image_wxagg. - - Thanks to matplotlib and wx teams for creating such great software! - - """ - from __future__ import print_function - - # matplotlib requires wxPython 2.8+ - # set the wxPython version in lib\site-packages\wx.pth file - # or if you have wxversion installed un-comment the lines below - #import wxversion - #wxversion.ensureMinimal('2.8') - - import sys - import time - import os - import gc - import matplotlib - matplotlib.use('WXAgg') - import matplotlib.cm as cm - import matplotlib.cbook as cbook - from matplotlib.backends.backend_wxagg import Toolbar, FigureCanvasWxAgg - from matplotlib.figure import Figure - import numpy as np - - import wx - import wx.xrc as xrc - - ERR_TOL = 1e-5 # floating point slop for peak-detection - - - matplotlib.rc('image', origin='lower') - - - class PlotPanel(wx.Panel): - def __init__(self, parent): - wx.Panel.__init__(self, parent, -1) - - self.fig = Figure((5, 4), 75) - self.canvas = FigureCanvasWxAgg(self, -1, self.fig) - self.toolbar = Toolbar(self.canvas) # matplotlib toolbar - self.toolbar.Realize() - # self.toolbar.set_active([0,1]) - - # Now put all into a sizer - sizer = wx.BoxSizer(wx.VERTICAL) - # This way of adding to sizer allows resizing - sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) - # Best to allow the toolbar to resize! - sizer.Add(self.toolbar, 0, wx.GROW) - self.SetSizer(sizer) - self.Fit() - - def init_plot_data(self): - a = self.fig.add_subplot(111) - - x = np.arange(120.0) * 2 * np.pi / 60.0 - y = np.arange(100.0) * 2 * np.pi / 50.0 - self.x, self.y = np.meshgrid(x, y) - z = np.sin(self.x) + np.cos(self.y) - self.im = a.imshow(z, cmap=cm.RdBu) # , interpolation='nearest') - - zmax = np.amax(z) - ERR_TOL - ymax_i, xmax_i = np.nonzero(z >= zmax) - if self.im.origin == 'upper': - ymax_i = z.shape[0] - ymax_i - self.lines = a.plot(xmax_i, ymax_i, 'ko') - - self.toolbar.update() # Not sure why this is needed - ADS - - def GetToolBar(self): - # You will need to override GetToolBar if you are using an - # unmanaged toolbar in your frame - return self.toolbar - - def OnWhiz(self, evt): - self.x += np.pi / 15 - self.y += np.pi / 20 - z = np.sin(self.x) + np.cos(self.y) - self.im.set_array(z) - - zmax = np.amax(z) - ERR_TOL - ymax_i, xmax_i = np.nonzero(z >= zmax) - if self.im.origin == 'upper': - ymax_i = z.shape[0] - ymax_i - self.lines[0].set_data(xmax_i, ymax_i) - - self.canvas.draw() - - def onEraseBackground(self, evt): - # this is supposed to prevent redraw flicker on some X servers... - pass - - - class MyApp(wx.App): - def OnInit(self): - xrcfile = cbook.get_sample_data('embedding_in_wx3.xrc', - asfileobj=False) - print('loading', xrcfile) - - self.res = xrc.XmlResource(xrcfile) - - # main frame and panel --------- - - self.frame = self.res.LoadFrame(None, "MainFrame") - self.panel = xrc.XRCCTRL(self.frame, "MainPanel") - - # matplotlib panel ------------- - - # container for matplotlib panel (I like to make a container - # panel for our panel so I know where it'll go when in XRCed.) - plot_container = xrc.XRCCTRL(self.frame, "plot_container_panel") - sizer = wx.BoxSizer(wx.VERTICAL) - - # matplotlib panel itself - self.plotpanel = PlotPanel(plot_container) - self.plotpanel.init_plot_data() - - # wx boilerplate - sizer.Add(self.plotpanel, 1, wx.EXPAND) - plot_container.SetSizer(sizer) - - # whiz button ------------------ - whiz_button = xrc.XRCCTRL(self.frame, "whiz_button") - whiz_button.Bind(wx.EVT_BUTTON, self.plotpanel.OnWhiz) - - # bang button ------------------ - bang_button = xrc.XRCCTRL(self.frame, "bang_button") - bang_button.Bind(wx.EVT_BUTTON, self.OnBang) - - # final setup ------------------ - sizer = self.panel.GetSizer() - self.frame.Show(1) - - self.SetTopWindow(self.frame) - - return True - - def OnBang(self, event): - bang_count = xrc.XRCCTRL(self.frame, "bang_count") - bangs = bang_count.GetValue() - bangs = int(bangs) + 1 - bang_count.SetValue(str(bangs)) - - if __name__ == '__main__': - app = MyApp(0) - app.MainLoop() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_wx3.txt b/_sources/examples/user_interfaces/embedding_in_wx3.txt deleted file mode 100644 index 89766da5a84..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_wx3.txt +++ /dev/null @@ -1,175 +0,0 @@ -.. _user_interfaces-embedding_in_wx3: - -user_interfaces example code: embedding_in_wx3.py -================================================= - -[`source code `_] - -:: - - #!/usr/bin/env python - - """ - Copyright (C) 2003-2004 Andrew Straw, Jeremy O'Donoghue and others - - License: This work is licensed under the PSF. A copy should be included - with this source code, and is also available at - http://www.python.org/psf/license.html - - This is yet another example of using matplotlib with wx. Hopefully - this is pretty full-featured: - - - both matplotlib toolbar and WX buttons manipulate plot - - full wxApp framework, including widget interaction - - XRC (XML wxWidgets resource) file to create GUI (made with XRCed) - - This was derived from embedding_in_wx and dynamic_image_wxagg. - - Thanks to matplotlib and wx teams for creating such great software! - - """ - from __future__ import print_function - - # matplotlib requires wxPython 2.8+ - # set the wxPython version in lib\site-packages\wx.pth file - # or if you have wxversion installed un-comment the lines below - #import wxversion - #wxversion.ensureMinimal('2.8') - - import sys - import time - import os - import gc - import matplotlib - matplotlib.use('WXAgg') - import matplotlib.cm as cm - import matplotlib.cbook as cbook - from matplotlib.backends.backend_wxagg import Toolbar, FigureCanvasWxAgg - from matplotlib.figure import Figure - import numpy as np - - import wx - import wx.xrc as xrc - - ERR_TOL = 1e-5 # floating point slop for peak-detection - - - matplotlib.rc('image', origin='lower') - - - class PlotPanel(wx.Panel): - def __init__(self, parent): - wx.Panel.__init__(self, parent, -1) - - self.fig = Figure((5, 4), 75) - self.canvas = FigureCanvasWxAgg(self, -1, self.fig) - self.toolbar = Toolbar(self.canvas) # matplotlib toolbar - self.toolbar.Realize() - # self.toolbar.set_active([0,1]) - - # Now put all into a sizer - sizer = wx.BoxSizer(wx.VERTICAL) - # This way of adding to sizer allows resizing - sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) - # Best to allow the toolbar to resize! - sizer.Add(self.toolbar, 0, wx.GROW) - self.SetSizer(sizer) - self.Fit() - - def init_plot_data(self): - a = self.fig.add_subplot(111) - - x = np.arange(120.0) * 2 * np.pi / 60.0 - y = np.arange(100.0) * 2 * np.pi / 50.0 - self.x, self.y = np.meshgrid(x, y) - z = np.sin(self.x) + np.cos(self.y) - self.im = a.imshow(z, cmap=cm.jet) # , interpolation='nearest') - - zmax = np.amax(z) - ERR_TOL - ymax_i, xmax_i = np.nonzero(z >= zmax) - if self.im.origin == 'upper': - ymax_i = z.shape[0] - ymax_i - self.lines = a.plot(xmax_i, ymax_i, 'ko') - - self.toolbar.update() # Not sure why this is needed - ADS - - def GetToolBar(self): - # You will need to override GetToolBar if you are using an - # unmanaged toolbar in your frame - return self.toolbar - - def OnWhiz(self, evt): - self.x += np.pi / 15 - self.y += np.pi / 20 - z = np.sin(self.x) + np.cos(self.y) - self.im.set_array(z) - - zmax = np.amax(z) - ERR_TOL - ymax_i, xmax_i = np.nonzero(z >= zmax) - if self.im.origin == 'upper': - ymax_i = z.shape[0] - ymax_i - self.lines[0].set_data(xmax_i, ymax_i) - - self.canvas.draw() - - def onEraseBackground(self, evt): - # this is supposed to prevent redraw flicker on some X servers... - pass - - - class MyApp(wx.App): - def OnInit(self): - xrcfile = cbook.get_sample_data('embedding_in_wx3.xrc', - asfileobj=False) - print('loading', xrcfile) - - self.res = xrc.XmlResource(xrcfile) - - # main frame and panel --------- - - self.frame = self.res.LoadFrame(None, "MainFrame") - self.panel = xrc.XRCCTRL(self.frame, "MainPanel") - - # matplotlib panel ------------- - - # container for matplotlib panel (I like to make a container - # panel for our panel so I know where it'll go when in XRCed.) - plot_container = xrc.XRCCTRL(self.frame, "plot_container_panel") - sizer = wx.BoxSizer(wx.VERTICAL) - - # matplotlib panel itself - self.plotpanel = PlotPanel(plot_container) - self.plotpanel.init_plot_data() - - # wx boilerplate - sizer.Add(self.plotpanel, 1, wx.EXPAND) - plot_container.SetSizer(sizer) - - # whiz button ------------------ - whiz_button = xrc.XRCCTRL(self.frame, "whiz_button") - whiz_button.Bind(wx.EVT_BUTTON, self.plotpanel.OnWhiz) - - # bang button ------------------ - bang_button = xrc.XRCCTRL(self.frame, "bang_button") - bang_button.Bind(wx.EVT_BUTTON, self.OnBang) - - # final setup ------------------ - sizer = self.panel.GetSizer() - self.frame.Show(1) - - self.SetTopWindow(self.frame) - - return True - - def OnBang(self, event): - bang_count = xrc.XRCCTRL(self.frame, "bang_count") - bangs = bang_count.GetValue() - bangs = int(bangs) + 1 - bang_count.SetValue(str(bangs)) - - if __name__ == '__main__': - app = MyApp(0) - app.MainLoop() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_wx4.rst.txt b/_sources/examples/user_interfaces/embedding_in_wx4.rst.txt deleted file mode 100644 index 17842cc0020..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_wx4.rst.txt +++ /dev/null @@ -1,123 +0,0 @@ -.. _user_interfaces-embedding_in_wx4: - -user_interfaces example code: embedding_in_wx4.py -================================================= - -[`source code `_] - -:: - - """ - An example of how to use wx or wxagg in an application with a custom - toolbar - """ - - # matplotlib requires wxPython 2.8+ - # set the wxPython version in lib\site-packages\wx.pth file - # or if you have wxversion installed un-comment the lines below - #import wxversion - #wxversion.ensureMinimal('2.8') - - from numpy import arange, sin, pi - - import matplotlib - - matplotlib.use('WXAgg') - from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas - from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg - - from matplotlib.backends.backend_wx import _load_bitmap - from matplotlib.figure import Figure - from numpy.random import rand - - import wx - - - class MyNavigationToolbar(NavigationToolbar2WxAgg): - """ - Extend the default wx toolbar with your own event handlers - """ - ON_CUSTOM = wx.NewId() - - def __init__(self, canvas, cankill): - NavigationToolbar2WxAgg.__init__(self, canvas) - - # for simplicity I'm going to reuse a bitmap from wx, you'll - # probably want to add your own. - if 'phoenix' in wx.PlatformInfo: - self.AddTool(self.ON_CUSTOM, 'Click me', - _load_bitmap('back.png'), - 'Activate custom contol') - self.Bind(wx.EVT_TOOL, self._on_custom, id=self.ON_CUSTOM) - else: - self.AddSimpleTool(self.ON_CUSTOM, _load_bitmap('back.png'), - 'Click me', 'Activate custom contol') - self.Bind(wx.EVT_TOOL, self._on_custom, id=self.ON_CUSTOM) - - def _on_custom(self, evt): - # add some text to the axes in a random location in axes (0,1) - # coords) with a random color - - # get the axes - ax = self.canvas.figure.axes[0] - - # generate a random location can color - x, y = tuple(rand(2)) - rgb = tuple(rand(3)) - - # add the text and draw - ax.text(x, y, 'You clicked me', - transform=ax.transAxes, - color=rgb) - self.canvas.draw() - evt.Skip() - - - class CanvasFrame(wx.Frame): - def __init__(self): - wx.Frame.__init__(self, None, -1, - 'CanvasFrame', size=(550, 350)) - - self.figure = Figure(figsize=(5, 4), dpi=100) - self.axes = self.figure.add_subplot(111) - t = arange(0.0, 3.0, 0.01) - s = sin(2 * pi * t) - - self.axes.plot(t, s) - - self.canvas = FigureCanvas(self, -1, self.figure) - - self.sizer = wx.BoxSizer(wx.VERTICAL) - self.sizer.Add(self.canvas, 1, wx.TOP | wx.LEFT | wx.EXPAND) - # Capture the paint message - self.Bind(wx.EVT_PAINT, self.OnPaint) - - self.toolbar = MyNavigationToolbar(self.canvas, True) - self.toolbar.Realize() - # By adding toolbar in sizer, we are able to put it at the bottom - # of the frame - so appearance is closer to GTK version. - self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) - - # update the axes menu on the toolbar - self.toolbar.update() - self.SetSizer(self.sizer) - self.Fit() - - def OnPaint(self, event): - self.canvas.draw() - event.Skip() - - - class App(wx.App): - def OnInit(self): - 'Create the main window and insert the custom frame' - frame = CanvasFrame() - frame.Show(True) - - return True - - app = App(0) - app.MainLoop() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_wx4.txt b/_sources/examples/user_interfaces/embedding_in_wx4.txt deleted file mode 100644 index d6c813858ea..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_wx4.txt +++ /dev/null @@ -1,124 +0,0 @@ -.. _user_interfaces-embedding_in_wx4: - -user_interfaces example code: embedding_in_wx4.py -================================================= - -[`source code `_] - -:: - - #!/usr/bin/env python - """ - An example of how to use wx or wxagg in an application with a custom - toolbar - """ - - # matplotlib requires wxPython 2.8+ - # set the wxPython version in lib\site-packages\wx.pth file - # or if you have wxversion installed un-comment the lines below - #import wxversion - #wxversion.ensureMinimal('2.8') - - from numpy import arange, sin, pi - - import matplotlib - - matplotlib.use('WXAgg') - from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas - from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg - - from matplotlib.backends.backend_wx import _load_bitmap - from matplotlib.figure import Figure - from numpy.random import rand - - import wx - - - class MyNavigationToolbar(NavigationToolbar2WxAgg): - """ - Extend the default wx toolbar with your own event handlers - """ - ON_CUSTOM = wx.NewId() - - def __init__(self, canvas, cankill): - NavigationToolbar2WxAgg.__init__(self, canvas) - - # for simplicity I'm going to reuse a bitmap from wx, you'll - # probably want to add your own. - if 'phoenix' in wx.PlatformInfo: - self.AddTool(self.ON_CUSTOM, 'Click me', - _load_bitmap('stock_left.xpm'), - 'Activate custom contol') - self.Bind(wx.EVT_TOOL, self._on_custom, id=self.ON_CUSTOM) - else: - self.AddSimpleTool(self.ON_CUSTOM, _load_bitmap('stock_left.xpm'), - 'Click me', 'Activate custom contol') - self.Bind(wx.EVT_TOOL, self._on_custom, id=self.ON_CUSTOM) - - def _on_custom(self, evt): - # add some text to the axes in a random location in axes (0,1) - # coords) with a random color - - # get the axes - ax = self.canvas.figure.axes[0] - - # generate a random location can color - x, y = tuple(rand(2)) - rgb = tuple(rand(3)) - - # add the text and draw - ax.text(x, y, 'You clicked me', - transform=ax.transAxes, - color=rgb) - self.canvas.draw() - evt.Skip() - - - class CanvasFrame(wx.Frame): - def __init__(self): - wx.Frame.__init__(self, None, -1, - 'CanvasFrame', size=(550, 350)) - - self.figure = Figure(figsize=(5, 4), dpi=100) - self.axes = self.figure.add_subplot(111) - t = arange(0.0, 3.0, 0.01) - s = sin(2 * pi * t) - - self.axes.plot(t, s) - - self.canvas = FigureCanvas(self, -1, self.figure) - - self.sizer = wx.BoxSizer(wx.VERTICAL) - self.sizer.Add(self.canvas, 1, wx.TOP | wx.LEFT | wx.EXPAND) - # Capture the paint message - self.Bind(wx.EVT_PAINT, self.OnPaint) - - self.toolbar = MyNavigationToolbar(self.canvas, True) - self.toolbar.Realize() - # By adding toolbar in sizer, we are able to put it at the bottom - # of the frame - so appearance is closer to GTK version. - self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) - - # update the axes menu on the toolbar - self.toolbar.update() - self.SetSizer(self.sizer) - self.Fit() - - def OnPaint(self, event): - self.canvas.draw() - event.Skip() - - - class App(wx.App): - def OnInit(self): - 'Create the main window and insert the custom frame' - frame = CanvasFrame() - frame.Show(True) - - return True - - app = App(0) - app.MainLoop() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_wx5.rst.txt b/_sources/examples/user_interfaces/embedding_in_wx5.rst.txt deleted file mode 100644 index b02b73ce8f6..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_wx5.rst.txt +++ /dev/null @@ -1,76 +0,0 @@ -.. _user_interfaces-embedding_in_wx5: - -user_interfaces example code: embedding_in_wx5.py -================================================= - -[`source code `_] - -:: - - # matplotlib requires wxPython 2.8+ - # set the wxPython version in lib\site-packages\wx.pth file - # or if you have wxversion installed un-comment the lines below - #import wxversion - #wxversion.ensureMinimal('2.8') - - import wx - import wx.lib.mixins.inspection as wit - - if 'phoenix' in wx.PlatformInfo: - import wx.lib.agw.aui as aui - else: - import wx.aui as aui - - import matplotlib as mpl - from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas - from matplotlib.backends.backend_wxagg import NavigationToolbar2Wx as Toolbar - - - class Plot(wx.Panel): - def __init__(self, parent, id=-1, dpi=None, **kwargs): - wx.Panel.__init__(self, parent, id=id, **kwargs) - self.figure = mpl.figure.Figure(dpi=dpi, figsize=(2, 2)) - self.canvas = Canvas(self, -1, self.figure) - self.toolbar = Toolbar(self.canvas) - self.toolbar.Realize() - - sizer = wx.BoxSizer(wx.VERTICAL) - sizer.Add(self.canvas, 1, wx.EXPAND) - sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) - self.SetSizer(sizer) - - - class PlotNotebook(wx.Panel): - def __init__(self, parent, id=-1): - wx.Panel.__init__(self, parent, id=id) - self.nb = aui.AuiNotebook(self) - sizer = wx.BoxSizer() - sizer.Add(self.nb, 1, wx.EXPAND) - self.SetSizer(sizer) - - def add(self, name="plot"): - page = Plot(self.nb) - self.nb.AddPage(page, name) - return page.figure - - - def demo(): - # alternatively you could use - #app = wx.App() - # InspectableApp is a great debug tool, see: - # http://wiki.wxpython.org/Widget%20Inspection%20Tool - app = wit.InspectableApp() - frame = wx.Frame(None, -1, 'Plotter') - plotter = PlotNotebook(frame) - axes1 = plotter.add('figure 1').gca() - axes1.plot([1, 2, 3], [2, 1, 4]) - axes2 = plotter.add('figure 2').gca() - axes2.plot([1, 2, 3, 4, 5], [2, 1, 4, 2, 3]) - frame.Show() - app.MainLoop() - - if __name__ == "__main__": - demo() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_in_wx5.txt b/_sources/examples/user_interfaces/embedding_in_wx5.txt deleted file mode 100644 index 6a354681a9d..00000000000 --- a/_sources/examples/user_interfaces/embedding_in_wx5.txt +++ /dev/null @@ -1,78 +0,0 @@ -.. _user_interfaces-embedding_in_wx5: - -user_interfaces example code: embedding_in_wx5.py -================================================= - -[`source code `_] - -:: - - #!/usr/bin/env python - - # matplotlib requires wxPython 2.8+ - # set the wxPython version in lib\site-packages\wx.pth file - # or if you have wxversion installed un-comment the lines below - #import wxversion - #wxversion.ensureMinimal('2.8') - - import wx - import wx.lib.mixins.inspection as wit - - if 'phoenix' in wx.PlatformInfo: - import wx.lib.agw.aui as aui - else: - import wx.aui as aui - - import matplotlib as mpl - from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas - from matplotlib.backends.backend_wxagg import NavigationToolbar2Wx as Toolbar - - - class Plot(wx.Panel): - def __init__(self, parent, id=-1, dpi=None, **kwargs): - wx.Panel.__init__(self, parent, id=id, **kwargs) - self.figure = mpl.figure.Figure(dpi=dpi, figsize=(2, 2)) - self.canvas = Canvas(self, -1, self.figure) - self.toolbar = Toolbar(self.canvas) - self.toolbar.Realize() - - sizer = wx.BoxSizer(wx.VERTICAL) - sizer.Add(self.canvas, 1, wx.EXPAND) - sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) - self.SetSizer(sizer) - - - class PlotNotebook(wx.Panel): - def __init__(self, parent, id=-1): - wx.Panel.__init__(self, parent, id=id) - self.nb = aui.AuiNotebook(self) - sizer = wx.BoxSizer() - sizer.Add(self.nb, 1, wx.EXPAND) - self.SetSizer(sizer) - - def add(self, name="plot"): - page = Plot(self.nb) - self.nb.AddPage(page, name) - return page.figure - - - def demo(): - # alternatively you could use - #app = wx.App() - # InspectableApp is a great debug tool, see: - # http://wiki.wxpython.org/Widget%20Inspection%20Tool - app = wit.InspectableApp() - frame = wx.Frame(None, -1, 'Plotter') - plotter = PlotNotebook(frame) - axes1 = plotter.add('figure 1').gca() - axes1.plot([1, 2, 3], [2, 1, 4]) - axes2 = plotter.add('figure 2').gca() - axes2.plot([1, 2, 3, 4, 5], [2, 1, 4, 2, 3]) - frame.Show() - app.MainLoop() - - if __name__ == "__main__": - demo() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_webagg.rst.txt b/_sources/examples/user_interfaces/embedding_webagg.rst.txt deleted file mode 100644 index 4202a500229..00000000000 --- a/_sources/examples/user_interfaces/embedding_webagg.rst.txt +++ /dev/null @@ -1,258 +0,0 @@ -.. _user_interfaces-embedding_webagg: - -user_interfaces example code: embedding_webagg.py -================================================= - -[`source code `_] - -:: - - """ - This example demonstrates how to embed matplotlib WebAgg interactive - plotting in your own web application and framework. It is not - necessary to do all this if you merely want to display a plot in a - browser or use matplotlib's built-in Tornado-based server "on the - side". - - The framework being used must support web sockets. - """ - - import io - - try: - import tornado - except ImportError: - raise RuntimeError("This example requires tornado.") - import tornado.web - import tornado.httpserver - import tornado.ioloop - import tornado.websocket - - - from matplotlib.backends.backend_webagg_core import ( - FigureManagerWebAgg, new_figure_manager_given_figure) - from matplotlib.figure import Figure - - import numpy as np - - import json - - - def create_figure(): - """ - Creates a simple example figure. - """ - fig = Figure() - a = fig.add_subplot(111) - t = np.arange(0.0, 3.0, 0.01) - s = np.sin(2 * np.pi * t) - a.plot(t, s) - return fig - - - # The following is the content of the web page. You would normally - # generate this using some sort of template facility in your web - # framework, but here we just use Python string formatting. - html_content = """ - - - - - - - - - - - - - - matplotlib - - - -
-
- - - """ - - - class MyApplication(tornado.web.Application): - class MainPage(tornado.web.RequestHandler): - """ - Serves the main HTML page. - """ - - def get(self): - manager = self.application.manager - ws_uri = "ws://{req.host}/".format(req=self.request) - content = html_content % { - "ws_uri": ws_uri, "fig_id": manager.num} - self.write(content) - - class MplJs(tornado.web.RequestHandler): - """ - Serves the generated matplotlib javascript file. The content - is dynamically generated based on which toolbar functions the - user has defined. Call `FigureManagerWebAgg` to get its - content. - """ - - def get(self): - self.set_header('Content-Type', 'application/javascript') - js_content = FigureManagerWebAgg.get_javascript() - - self.write(js_content) - - class Download(tornado.web.RequestHandler): - """ - Handles downloading of the figure in various file formats. - """ - - def get(self, fmt): - manager = self.application.manager - - mimetypes = { - 'ps': 'application/postscript', - 'eps': 'application/postscript', - 'pdf': 'application/pdf', - 'svg': 'image/svg+xml', - 'png': 'image/png', - 'jpeg': 'image/jpeg', - 'tif': 'image/tiff', - 'emf': 'application/emf' - } - - self.set_header('Content-Type', mimetypes.get(fmt, 'binary')) - - buff = io.BytesIO() - manager.canvas.print_figure(buff, format=fmt) - self.write(buff.getvalue()) - - class WebSocket(tornado.websocket.WebSocketHandler): - """ - A websocket for interactive communication between the plot in - the browser and the server. - - In addition to the methods required by tornado, it is required to - have two callback methods: - - - ``send_json(json_content)`` is called by matplotlib when - it needs to send json to the browser. `json_content` is - a JSON tree (Python dictionary), and it is the responsibility - of this implementation to encode it as a string to send over - the socket. - - - ``send_binary(blob)`` is called to send binary image data - to the browser. - """ - supports_binary = True - - def open(self): - # Register the websocket with the FigureManager. - manager = self.application.manager - manager.add_web_socket(self) - if hasattr(self, 'set_nodelay'): - self.set_nodelay(True) - - def on_close(self): - # When the socket is closed, deregister the websocket with - # the FigureManager. - manager = self.application.manager - manager.remove_web_socket(self) - - def on_message(self, message): - # The 'supports_binary' message is relevant to the - # websocket itself. The other messages get passed along - # to matplotlib as-is. - - # Every message has a "type" and a "figure_id". - message = json.loads(message) - if message['type'] == 'supports_binary': - self.supports_binary = message['value'] - else: - manager = self.application.manager - manager.handle_json(message) - - def send_json(self, content): - self.write_message(json.dumps(content)) - - def send_binary(self, blob): - if self.supports_binary: - self.write_message(blob, binary=True) - else: - data_uri = "data:image/png;base64,{0}".format( - blob.encode('base64').replace('\n', '')) - self.write_message(data_uri) - - def __init__(self, figure): - self.figure = figure - self.manager = new_figure_manager_given_figure( - id(figure), figure) - - super(MyApplication, self).__init__([ - # Static files for the CSS and JS - (r'/_static/(.*)', - tornado.web.StaticFileHandler, - {'path': FigureManagerWebAgg.get_static_file_path()}), - - # The page that contains all of the pieces - ('/', self.MainPage), - - ('/mpl.js', self.MplJs), - - # Sends images and events to the browser, and receives - # events from the browser - ('/ws', self.WebSocket), - - # Handles the downloading (i.e., saving) of static images - (r'/download.([a-z0-9.]+)', self.Download), - ]) - - - if __name__ == "__main__": - figure = create_figure() - application = MyApplication(figure) - - http_server = tornado.httpserver.HTTPServer(application) - http_server.listen(8080) - - print("http://127.0.0.1:8080/") - print("Press Ctrl+C to quit") - - tornado.ioloop.IOLoop.instance().start() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/embedding_webagg.txt b/_sources/examples/user_interfaces/embedding_webagg.txt deleted file mode 100644 index 4202a500229..00000000000 --- a/_sources/examples/user_interfaces/embedding_webagg.txt +++ /dev/null @@ -1,258 +0,0 @@ -.. _user_interfaces-embedding_webagg: - -user_interfaces example code: embedding_webagg.py -================================================= - -[`source code `_] - -:: - - """ - This example demonstrates how to embed matplotlib WebAgg interactive - plotting in your own web application and framework. It is not - necessary to do all this if you merely want to display a plot in a - browser or use matplotlib's built-in Tornado-based server "on the - side". - - The framework being used must support web sockets. - """ - - import io - - try: - import tornado - except ImportError: - raise RuntimeError("This example requires tornado.") - import tornado.web - import tornado.httpserver - import tornado.ioloop - import tornado.websocket - - - from matplotlib.backends.backend_webagg_core import ( - FigureManagerWebAgg, new_figure_manager_given_figure) - from matplotlib.figure import Figure - - import numpy as np - - import json - - - def create_figure(): - """ - Creates a simple example figure. - """ - fig = Figure() - a = fig.add_subplot(111) - t = np.arange(0.0, 3.0, 0.01) - s = np.sin(2 * np.pi * t) - a.plot(t, s) - return fig - - - # The following is the content of the web page. You would normally - # generate this using some sort of template facility in your web - # framework, but here we just use Python string formatting. - html_content = """ - - - - - - - - - - - - - - matplotlib - - - -
-
- - - """ - - - class MyApplication(tornado.web.Application): - class MainPage(tornado.web.RequestHandler): - """ - Serves the main HTML page. - """ - - def get(self): - manager = self.application.manager - ws_uri = "ws://{req.host}/".format(req=self.request) - content = html_content % { - "ws_uri": ws_uri, "fig_id": manager.num} - self.write(content) - - class MplJs(tornado.web.RequestHandler): - """ - Serves the generated matplotlib javascript file. The content - is dynamically generated based on which toolbar functions the - user has defined. Call `FigureManagerWebAgg` to get its - content. - """ - - def get(self): - self.set_header('Content-Type', 'application/javascript') - js_content = FigureManagerWebAgg.get_javascript() - - self.write(js_content) - - class Download(tornado.web.RequestHandler): - """ - Handles downloading of the figure in various file formats. - """ - - def get(self, fmt): - manager = self.application.manager - - mimetypes = { - 'ps': 'application/postscript', - 'eps': 'application/postscript', - 'pdf': 'application/pdf', - 'svg': 'image/svg+xml', - 'png': 'image/png', - 'jpeg': 'image/jpeg', - 'tif': 'image/tiff', - 'emf': 'application/emf' - } - - self.set_header('Content-Type', mimetypes.get(fmt, 'binary')) - - buff = io.BytesIO() - manager.canvas.print_figure(buff, format=fmt) - self.write(buff.getvalue()) - - class WebSocket(tornado.websocket.WebSocketHandler): - """ - A websocket for interactive communication between the plot in - the browser and the server. - - In addition to the methods required by tornado, it is required to - have two callback methods: - - - ``send_json(json_content)`` is called by matplotlib when - it needs to send json to the browser. `json_content` is - a JSON tree (Python dictionary), and it is the responsibility - of this implementation to encode it as a string to send over - the socket. - - - ``send_binary(blob)`` is called to send binary image data - to the browser. - """ - supports_binary = True - - def open(self): - # Register the websocket with the FigureManager. - manager = self.application.manager - manager.add_web_socket(self) - if hasattr(self, 'set_nodelay'): - self.set_nodelay(True) - - def on_close(self): - # When the socket is closed, deregister the websocket with - # the FigureManager. - manager = self.application.manager - manager.remove_web_socket(self) - - def on_message(self, message): - # The 'supports_binary' message is relevant to the - # websocket itself. The other messages get passed along - # to matplotlib as-is. - - # Every message has a "type" and a "figure_id". - message = json.loads(message) - if message['type'] == 'supports_binary': - self.supports_binary = message['value'] - else: - manager = self.application.manager - manager.handle_json(message) - - def send_json(self, content): - self.write_message(json.dumps(content)) - - def send_binary(self, blob): - if self.supports_binary: - self.write_message(blob, binary=True) - else: - data_uri = "data:image/png;base64,{0}".format( - blob.encode('base64').replace('\n', '')) - self.write_message(data_uri) - - def __init__(self, figure): - self.figure = figure - self.manager = new_figure_manager_given_figure( - id(figure), figure) - - super(MyApplication, self).__init__([ - # Static files for the CSS and JS - (r'/_static/(.*)', - tornado.web.StaticFileHandler, - {'path': FigureManagerWebAgg.get_static_file_path()}), - - # The page that contains all of the pieces - ('/', self.MainPage), - - ('/mpl.js', self.MplJs), - - # Sends images and events to the browser, and receives - # events from the browser - ('/ws', self.WebSocket), - - # Handles the downloading (i.e., saving) of static images - (r'/download.([a-z0-9.]+)', self.Download), - ]) - - - if __name__ == "__main__": - figure = create_figure() - application = MyApplication(figure) - - http_server = tornado.httpserver.HTTPServer(application) - http_server.listen(8080) - - print("http://127.0.0.1:8080/") - print("Press Ctrl+C to quit") - - tornado.ioloop.IOLoop.instance().start() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/fourier_demo_wx.rst.txt b/_sources/examples/user_interfaces/fourier_demo_wx.rst.txt deleted file mode 100644 index e5dfaee466c..00000000000 --- a/_sources/examples/user_interfaces/fourier_demo_wx.rst.txt +++ /dev/null @@ -1,257 +0,0 @@ -.. _user_interfaces-fourier_demo_wx: - -user_interfaces example code: fourier_demo_wx.py -================================================ - -[`source code `_] - -:: - - import numpy as np - - # matplotlib requires wxPython 2.8+ - # set the wxPython version in lib\site-packages\wx.pth file - # or if you have wxversion installed un-comment the lines below - #import wxversion - #wxversion.ensureMinimal('2.8') - - import wx - import matplotlib - matplotlib.interactive(False) - matplotlib.use('WXAgg') - from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg - from matplotlib.figure import Figure - from matplotlib.pyplot import gcf, setp - - - class Knob(object): - """ - Knob - simple class with a "setKnob" method. - A Knob instance is attached to a Param instance, e.g., param.attach(knob) - Base class is for documentation purposes. - """ - - def setKnob(self, value): - pass - - - class Param(object): - """ - The idea of the "Param" class is that some parameter in the GUI may have - several knobs that both control it and reflect the parameter's state, e.g. - a slider, text, and dragging can all change the value of the frequency in - the waveform of this example. - The class allows a cleaner way to update/"feedback" to the other knobs when - one is being changed. Also, this class handles min/max constraints for all - the knobs. - Idea - knob list - in "set" method, knob object is passed as well - - the other knobs in the knob list have a "set" method which gets - called for the others. - """ - - def __init__(self, initialValue=None, minimum=0., maximum=1.): - self.minimum = minimum - self.maximum = maximum - if initialValue != self.constrain(initialValue): - raise ValueError('illegal initial value') - self.value = initialValue - self.knobs = [] - - def attach(self, knob): - self.knobs += [knob] - - def set(self, value, knob=None): - self.value = value - self.value = self.constrain(value) - for feedbackKnob in self.knobs: - if feedbackKnob != knob: - feedbackKnob.setKnob(self.value) - return self.value - - def constrain(self, value): - if value <= self.minimum: - value = self.minimum - if value >= self.maximum: - value = self.maximum - return value - - - class SliderGroup(Knob): - def __init__(self, parent, label, param): - self.sliderLabel = wx.StaticText(parent, label=label) - self.sliderText = wx.TextCtrl(parent, -1, style=wx.TE_PROCESS_ENTER) - self.slider = wx.Slider(parent, -1) - # self.slider.SetMax(param.maximum*1000) - self.slider.SetRange(0, param.maximum * 1000) - self.setKnob(param.value) - - sizer = wx.BoxSizer(wx.HORIZONTAL) - sizer.Add(self.sliderLabel, 0, - wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, - border=2) - sizer.Add(self.sliderText, 0, - wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, - border=2) - sizer.Add(self.slider, 1, wx.EXPAND) - self.sizer = sizer - - self.slider.Bind(wx.EVT_SLIDER, self.sliderHandler) - self.sliderText.Bind(wx.EVT_TEXT_ENTER, self.sliderTextHandler) - - self.param = param - self.param.attach(self) - - def sliderHandler(self, evt): - value = evt.GetInt() / 1000. - self.param.set(value) - - def sliderTextHandler(self, evt): - value = float(self.sliderText.GetValue()) - self.param.set(value) - - def setKnob(self, value): - self.sliderText.SetValue('%g' % value) - self.slider.SetValue(value * 1000) - - - class FourierDemoFrame(wx.Frame): - def __init__(self, *args, **kwargs): - wx.Frame.__init__(self, *args, **kwargs) - - self.fourierDemoWindow = FourierDemoWindow(self) - self.frequencySliderGroup = SliderGroup( - self, - label='Frequency f0:', - param=self.fourierDemoWindow.f0) - self.amplitudeSliderGroup = SliderGroup(self, label=' Amplitude a:', - param=self.fourierDemoWindow.A) - - sizer = wx.BoxSizer(wx.VERTICAL) - sizer.Add(self.fourierDemoWindow, 1, wx.EXPAND) - sizer.Add(self.frequencySliderGroup.sizer, 0, - wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=5) - sizer.Add(self.amplitudeSliderGroup.sizer, 0, - wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=5) - self.SetSizer(sizer) - - - class FourierDemoWindow(wx.Window, Knob): - def __init__(self, *args, **kwargs): - wx.Window.__init__(self, *args, **kwargs) - self.lines = [] - self.figure = Figure() - self.canvas = FigureCanvasWxAgg(self, -1, self.figure) - self.canvas.callbacks.connect('button_press_event', self.mouseDown) - self.canvas.callbacks.connect('motion_notify_event', self.mouseMotion) - self.canvas.callbacks.connect('button_release_event', self.mouseUp) - self.state = '' - self.mouseInfo = (None, None, None, None) - self.f0 = Param(2., minimum=0., maximum=6.) - self.A = Param(1., minimum=0.01, maximum=2.) - self.draw() - - # Not sure I like having two params attached to the same Knob, - # but that is what we have here... it works but feels kludgy - - # although maybe it's not too bad since the knob changes both params - # at the same time (both f0 and A are affected during a drag) - self.f0.attach(self) - self.A.attach(self) - self.Bind(wx.EVT_SIZE, self.sizeHandler) - - self.Bind(wx.EVT_PAINT, self.OnPaint) - - def OnPaint(self, event): - self.canvas.draw() - event.Skip() - - def sizeHandler(self, *args, **kwargs): - self.canvas.SetSize(self.GetSize()) - - def mouseDown(self, evt): - if self.lines[0] in self.figure.hitlist(evt): - self.state = 'frequency' - elif self.lines[1] in self.figure.hitlist(evt): - self.state = 'time' - else: - self.state = '' - self.mouseInfo = (evt.xdata, evt.ydata, - max(self.f0.value, .1), - self.A.value) - - def mouseMotion(self, evt): - if self.state == '': - return - x, y = evt.xdata, evt.ydata - if x is None: # outside the axes - return - x0, y0, f0Init, AInit = self.mouseInfo - self.A.set(AInit + (AInit * (y - y0) / y0), self) - if self.state == 'frequency': - self.f0.set(f0Init + (f0Init * (x - x0) / x0)) - elif self.state == 'time': - if (x - x0) / x0 != -1.: - self.f0.set(1. / (1. / f0Init + (1. / f0Init * (x - x0) / x0))) - - def mouseUp(self, evt): - self.state = '' - - def draw(self): - if not hasattr(self, 'subplot1'): - self.subplot1 = self.figure.add_subplot(211) - self.subplot2 = self.figure.add_subplot(212) - x1, y1, x2, y2 = self.compute(self.f0.value, self.A.value) - color = (1., 0., 0.) - self.lines += self.subplot1.plot(x1, y1, color=color, linewidth=2) - self.lines += self.subplot2.plot(x2, y2, color=color, linewidth=2) - # Set some plot attributes - self.subplot1.set_title( - "Click and drag waveforms to change frequency and amplitude", - fontsize=12) - self.subplot1.set_ylabel("Frequency Domain Waveform X(f)", fontsize=8) - self.subplot1.set_xlabel("frequency f", fontsize=8) - self.subplot2.set_ylabel("Time Domain Waveform x(t)", fontsize=8) - self.subplot2.set_xlabel("time t", fontsize=8) - self.subplot1.set_xlim([-6, 6]) - self.subplot1.set_ylim([0, 1]) - self.subplot2.set_xlim([-2, 2]) - self.subplot2.set_ylim([-2, 2]) - self.subplot1.text(0.05, .95, - r'$X(f) = \mathcal{F}\{x(t)\}$', - verticalalignment='top', - transform=self.subplot1.transAxes) - self.subplot2.text(0.05, .95, - r'$x(t) = a \cdot \cos(2\pi f_0 t) e^{-\pi t^2}$', - verticalalignment='top', - transform=self.subplot2.transAxes) - - def compute(self, f0, A): - f = np.arange(-6., 6., 0.02) - t = np.arange(-2., 2., 0.01) - x = A * np.cos(2 * np.pi * f0 * t) * np.exp(-np.pi * t ** 2) - X = A / 2 * \ - (np.exp(-np.pi * (f - f0) ** 2) + np.exp(-np.pi * (f + f0) ** 2)) - return f, X, t, x - - def repaint(self): - self.canvas.draw() - - def setKnob(self, value): - # Note, we ignore value arg here and just go by state of the params - x1, y1, x2, y2 = self.compute(self.f0.value, self.A.value) - setp(self.lines[0], xdata=x1, ydata=y1) - setp(self.lines[1], xdata=x2, ydata=y2) - self.repaint() - - - class App(wx.App): - def OnInit(self): - self.frame1 = FourierDemoFrame(parent=None, title="Fourier Demo", - size=(640, 480)) - self.frame1.Show() - return True - - app = App() - app.MainLoop() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/fourier_demo_wx.txt b/_sources/examples/user_interfaces/fourier_demo_wx.txt deleted file mode 100644 index 1007bd84595..00000000000 --- a/_sources/examples/user_interfaces/fourier_demo_wx.txt +++ /dev/null @@ -1,258 +0,0 @@ -.. _user_interfaces-fourier_demo_wx: - -user_interfaces example code: fourier_demo_wx.py -================================================ - -[`source code `_] - -:: - - #!/usr/bin/env python - import numpy as np - - # matplotlib requires wxPython 2.8+ - # set the wxPython version in lib\site-packages\wx.pth file - # or if you have wxversion installed un-comment the lines below - #import wxversion - #wxversion.ensureMinimal('2.8') - - import wx - import matplotlib - matplotlib.interactive(False) - matplotlib.use('WXAgg') - from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg - from matplotlib.figure import Figure - from matplotlib.pyplot import gcf, setp - - - class Knob(object): - """ - Knob - simple class with a "setKnob" method. - A Knob instance is attached to a Param instance, e.g., param.attach(knob) - Base class is for documentation purposes. - """ - - def setKnob(self, value): - pass - - - class Param(object): - """ - The idea of the "Param" class is that some parameter in the GUI may have - several knobs that both control it and reflect the parameter's state, e.g. - a slider, text, and dragging can all change the value of the frequency in - the waveform of this example. - The class allows a cleaner way to update/"feedback" to the other knobs when - one is being changed. Also, this class handles min/max constraints for all - the knobs. - Idea - knob list - in "set" method, knob object is passed as well - - the other knobs in the knob list have a "set" method which gets - called for the others. - """ - - def __init__(self, initialValue=None, minimum=0., maximum=1.): - self.minimum = minimum - self.maximum = maximum - if initialValue != self.constrain(initialValue): - raise ValueError('illegal initial value') - self.value = initialValue - self.knobs = [] - - def attach(self, knob): - self.knobs += [knob] - - def set(self, value, knob=None): - self.value = value - self.value = self.constrain(value) - for feedbackKnob in self.knobs: - if feedbackKnob != knob: - feedbackKnob.setKnob(self.value) - return self.value - - def constrain(self, value): - if value <= self.minimum: - value = self.minimum - if value >= self.maximum: - value = self.maximum - return value - - - class SliderGroup(Knob): - def __init__(self, parent, label, param): - self.sliderLabel = wx.StaticText(parent, label=label) - self.sliderText = wx.TextCtrl(parent, -1, style=wx.TE_PROCESS_ENTER) - self.slider = wx.Slider(parent, -1) - # self.slider.SetMax(param.maximum*1000) - self.slider.SetRange(0, param.maximum * 1000) - self.setKnob(param.value) - - sizer = wx.BoxSizer(wx.HORIZONTAL) - sizer.Add(self.sliderLabel, 0, - wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, - border=2) - sizer.Add(self.sliderText, 0, - wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, - border=2) - sizer.Add(self.slider, 1, wx.EXPAND) - self.sizer = sizer - - self.slider.Bind(wx.EVT_SLIDER, self.sliderHandler) - self.sliderText.Bind(wx.EVT_TEXT_ENTER, self.sliderTextHandler) - - self.param = param - self.param.attach(self) - - def sliderHandler(self, evt): - value = evt.GetInt() / 1000. - self.param.set(value) - - def sliderTextHandler(self, evt): - value = float(self.sliderText.GetValue()) - self.param.set(value) - - def setKnob(self, value): - self.sliderText.SetValue('%g' % value) - self.slider.SetValue(value * 1000) - - - class FourierDemoFrame(wx.Frame): - def __init__(self, *args, **kwargs): - wx.Frame.__init__(self, *args, **kwargs) - - self.fourierDemoWindow = FourierDemoWindow(self) - self.frequencySliderGroup = SliderGroup( - self, - label='Frequency f0:', - param=self.fourierDemoWindow.f0) - self.amplitudeSliderGroup = SliderGroup(self, label=' Amplitude a:', - param=self.fourierDemoWindow.A) - - sizer = wx.BoxSizer(wx.VERTICAL) - sizer.Add(self.fourierDemoWindow, 1, wx.EXPAND) - sizer.Add(self.frequencySliderGroup.sizer, 0, - wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=5) - sizer.Add(self.amplitudeSliderGroup.sizer, 0, - wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=5) - self.SetSizer(sizer) - - - class FourierDemoWindow(wx.Window, Knob): - def __init__(self, *args, **kwargs): - wx.Window.__init__(self, *args, **kwargs) - self.lines = [] - self.figure = Figure() - self.canvas = FigureCanvasWxAgg(self, -1, self.figure) - self.canvas.callbacks.connect('button_press_event', self.mouseDown) - self.canvas.callbacks.connect('motion_notify_event', self.mouseMotion) - self.canvas.callbacks.connect('button_release_event', self.mouseUp) - self.state = '' - self.mouseInfo = (None, None, None, None) - self.f0 = Param(2., minimum=0., maximum=6.) - self.A = Param(1., minimum=0.01, maximum=2.) - self.draw() - - # Not sure I like having two params attached to the same Knob, - # but that is what we have here... it works but feels kludgy - - # although maybe it's not too bad since the knob changes both params - # at the same time (both f0 and A are affected during a drag) - self.f0.attach(self) - self.A.attach(self) - self.Bind(wx.EVT_SIZE, self.sizeHandler) - - self.Bind(wx.EVT_PAINT, self.OnPaint) - - def OnPaint(self, event): - self.canvas.draw() - event.Skip() - - def sizeHandler(self, *args, **kwargs): - self.canvas.SetSize(self.GetSize()) - - def mouseDown(self, evt): - if self.lines[0] in self.figure.hitlist(evt): - self.state = 'frequency' - elif self.lines[1] in self.figure.hitlist(evt): - self.state = 'time' - else: - self.state = '' - self.mouseInfo = (evt.xdata, evt.ydata, - max(self.f0.value, .1), - self.A.value) - - def mouseMotion(self, evt): - if self.state == '': - return - x, y = evt.xdata, evt.ydata - if x is None: # outside the axes - return - x0, y0, f0Init, AInit = self.mouseInfo - self.A.set(AInit + (AInit * (y - y0) / y0), self) - if self.state == 'frequency': - self.f0.set(f0Init + (f0Init * (x - x0) / x0)) - elif self.state == 'time': - if (x - x0) / x0 != -1.: - self.f0.set(1. / (1. / f0Init + (1. / f0Init * (x - x0) / x0))) - - def mouseUp(self, evt): - self.state = '' - - def draw(self): - if not hasattr(self, 'subplot1'): - self.subplot1 = self.figure.add_subplot(211) - self.subplot2 = self.figure.add_subplot(212) - x1, y1, x2, y2 = self.compute(self.f0.value, self.A.value) - color = (1., 0., 0.) - self.lines += self.subplot1.plot(x1, y1, color=color, linewidth=2) - self.lines += self.subplot2.plot(x2, y2, color=color, linewidth=2) - # Set some plot attributes - self.subplot1.set_title( - "Click and drag waveforms to change frequency and amplitude", - fontsize=12) - self.subplot1.set_ylabel("Frequency Domain Waveform X(f)", fontsize=8) - self.subplot1.set_xlabel("frequency f", fontsize=8) - self.subplot2.set_ylabel("Time Domain Waveform x(t)", fontsize=8) - self.subplot2.set_xlabel("time t", fontsize=8) - self.subplot1.set_xlim([-6, 6]) - self.subplot1.set_ylim([0, 1]) - self.subplot2.set_xlim([-2, 2]) - self.subplot2.set_ylim([-2, 2]) - self.subplot1.text(0.05, .95, - r'$X(f) = \mathcal{F}\{x(t)\}$', - verticalalignment='top', - transform=self.subplot1.transAxes) - self.subplot2.text(0.05, .95, - r'$x(t) = a \cdot \cos(2\pi f_0 t) e^{-\pi t^2}$', - verticalalignment='top', - transform=self.subplot2.transAxes) - - def compute(self, f0, A): - f = np.arange(-6., 6., 0.02) - t = np.arange(-2., 2., 0.01) - x = A * np.cos(2 * np.pi * f0 * t) * np.exp(-np.pi * t ** 2) - X = A / 2 * \ - (np.exp(-np.pi * (f - f0) ** 2) + np.exp(-np.pi * (f + f0) ** 2)) - return f, X, t, x - - def repaint(self): - self.canvas.draw() - - def setKnob(self, value): - # Note, we ignore value arg here and just go by state of the params - x1, y1, x2, y2 = self.compute(self.f0.value, self.A.value) - setp(self.lines[0], xdata=x1, ydata=y1) - setp(self.lines[1], xdata=x2, ydata=y2) - self.repaint() - - - class App(wx.App): - def OnInit(self): - self.frame1 = FourierDemoFrame(parent=None, title="Fourier Demo", - size=(640, 480)) - self.frame1.Show() - return True - - app = App() - app.MainLoop() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/gtk_spreadsheet.rst.txt b/_sources/examples/user_interfaces/gtk_spreadsheet.rst.txt deleted file mode 100644 index ea33057edf2..00000000000 --- a/_sources/examples/user_interfaces/gtk_spreadsheet.rst.txt +++ /dev/null @@ -1,102 +0,0 @@ -.. _user_interfaces-gtk_spreadsheet: - -user_interfaces example code: gtk_spreadsheet.py -================================================ - -[`source code `_] - -:: - - """ - Example of embedding matplotlib in an application and interacting with - a treeview to store data. Double click on an entry to update plot - data - - """ - import pygtk - pygtk.require('2.0') - import gtk - from gtk import gdk - - import matplotlib - matplotlib.use('GTKAgg') # or 'GTK' - from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas - - from numpy.random import random - from matplotlib.figure import Figure - - - class DataManager(gtk.Window): - numRows, numCols = 20, 10 - - data = random((numRows, numCols)) - - def __init__(self): - gtk.Window.__init__(self) - self.set_default_size(600, 600) - self.connect('destroy', lambda win: gtk.main_quit()) - - self.set_title('GtkListStore demo') - self.set_border_width(8) - - vbox = gtk.VBox(False, 8) - self.add(vbox) - - label = gtk.Label('Double click a row to plot the data') - - vbox.pack_start(label, False, False) - - sw = gtk.ScrolledWindow() - sw.set_shadow_type(gtk.SHADOW_ETCHED_IN) - sw.set_policy(gtk.POLICY_NEVER, - gtk.POLICY_AUTOMATIC) - vbox.pack_start(sw, True, True) - - model = self.create_model() - - self.treeview = gtk.TreeView(model) - self.treeview.set_rules_hint(True) - - # matplotlib stuff - fig = Figure(figsize=(6, 4)) - - self.canvas = FigureCanvas(fig) # a gtk.DrawingArea - vbox.pack_start(self.canvas, True, True) - ax = fig.add_subplot(111) - self.line, = ax.plot(self.data[0, :], 'go') # plot the first row - - self.treeview.connect('row-activated', self.plot_row) - sw.add(self.treeview) - - self.add_columns() - - self.add_events(gdk.BUTTON_PRESS_MASK | - gdk.KEY_PRESS_MASK | - gdk.KEY_RELEASE_MASK) - - def plot_row(self, treeview, path, view_column): - ind, = path # get the index into data - points = self.data[ind, :] - self.line.set_ydata(points) - self.canvas.draw() - - def add_columns(self): - for i in range(self.numCols): - column = gtk.TreeViewColumn('%d' % i, gtk.CellRendererText(), text=i) - self.treeview.append_column(column) - - def create_model(self): - types = [float]*self.numCols - store = gtk.ListStore(*types) - - for row in self.data: - store.append(row) - return store - - - manager = DataManager() - manager.show_all() - gtk.main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/gtk_spreadsheet.txt b/_sources/examples/user_interfaces/gtk_spreadsheet.txt deleted file mode 100644 index 30176bb75f2..00000000000 --- a/_sources/examples/user_interfaces/gtk_spreadsheet.txt +++ /dev/null @@ -1,103 +0,0 @@ -.. _user_interfaces-gtk_spreadsheet: - -user_interfaces example code: gtk_spreadsheet.py -================================================ - -[`source code `_] - -:: - - #!/usr/bin/env python - """ - Example of embedding matplotlib in an application and interacting with - a treeview to store data. Double click on an entry to update plot - data - - """ - import pygtk - pygtk.require('2.0') - import gtk - from gtk import gdk - - import matplotlib - matplotlib.use('GTKAgg') # or 'GTK' - from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas - - from numpy.random import random - from matplotlib.figure import Figure - - - class DataManager(gtk.Window): - numRows, numCols = 20, 10 - - data = random((numRows, numCols)) - - def __init__(self): - gtk.Window.__init__(self) - self.set_default_size(600, 600) - self.connect('destroy', lambda win: gtk.main_quit()) - - self.set_title('GtkListStore demo') - self.set_border_width(8) - - vbox = gtk.VBox(False, 8) - self.add(vbox) - - label = gtk.Label('Double click a row to plot the data') - - vbox.pack_start(label, False, False) - - sw = gtk.ScrolledWindow() - sw.set_shadow_type(gtk.SHADOW_ETCHED_IN) - sw.set_policy(gtk.POLICY_NEVER, - gtk.POLICY_AUTOMATIC) - vbox.pack_start(sw, True, True) - - model = self.create_model() - - self.treeview = gtk.TreeView(model) - self.treeview.set_rules_hint(True) - - # matplotlib stuff - fig = Figure(figsize=(6, 4)) - - self.canvas = FigureCanvas(fig) # a gtk.DrawingArea - vbox.pack_start(self.canvas, True, True) - ax = fig.add_subplot(111) - self.line, = ax.plot(self.data[0, :], 'go') # plot the first row - - self.treeview.connect('row-activated', self.plot_row) - sw.add(self.treeview) - - self.add_columns() - - self.add_events(gdk.BUTTON_PRESS_MASK | - gdk.KEY_PRESS_MASK | - gdk.KEY_RELEASE_MASK) - - def plot_row(self, treeview, path, view_column): - ind, = path # get the index into data - points = self.data[ind, :] - self.line.set_ydata(points) - self.canvas.draw() - - def add_columns(self): - for i in range(self.numCols): - column = gtk.TreeViewColumn('%d' % i, gtk.CellRendererText(), text=i) - self.treeview.append_column(column) - - def create_model(self): - types = [float]*self.numCols - store = gtk.ListStore(*types) - - for row in self.data: - store.append(row) - return store - - - manager = DataManager() - manager.show_all() - gtk.main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/histogram_demo_canvasagg.rst.txt b/_sources/examples/user_interfaces/histogram_demo_canvasagg.rst.txt deleted file mode 100644 index 98bf33fceb4..00000000000 --- a/_sources/examples/user_interfaces/histogram_demo_canvasagg.rst.txt +++ /dev/null @@ -1,70 +0,0 @@ -.. _user_interfaces-histogram_demo_canvasagg: - -user_interfaces example code: histogram_demo_canvasagg.py -========================================================= - -[`source code `_] - -:: - - """ - This is an example that shows you how to work directly with the agg - figure canvas to create a figure using the pythonic API. - - In this example, the contents of the agg canvas are extracted to a - string, which can in turn be passed off to PIL or put in a numeric - array - - - """ - from matplotlib.backends.backend_agg import FigureCanvasAgg - from matplotlib.figure import Figure - from matplotlib.mlab import normpdf - from numpy.random import randn - import numpy - - fig = Figure(figsize=(5, 4), dpi=100) - ax = fig.add_subplot(111) - - canvas = FigureCanvasAgg(fig) - - mu, sigma = 100, 15 - x = mu + sigma*randn(10000) - - # the histogram of the data - n, bins, patches = ax.hist(x, 50, normed=1) - - # add a 'best fit' line - y = normpdf(bins, mu, sigma) - line, = ax.plot(bins, y, 'r--') - line.set_linewidth(1) - - ax.set_xlabel('Smarts') - ax.set_ylabel('Probability') - ax.set_title(r'$\mathrm{Histogram of IQ: }\mu=100, \sigma=15$') - - ax.set_xlim((40, 160)) - ax.set_ylim((0, 0.03)) - - canvas.draw() - - s = canvas.tostring_rgb() # save this and convert to bitmap as needed - - # get the figure dimensions for creating bitmaps or numpy arrays, - # etc. - l, b, w, h = fig.bbox.bounds - w, h = int(w), int(h) - - if 0: - # convert to a numpy array - X = numpy.fromstring(s, numpy.uint8) - X.shape = h, w, 3 - - if 0: - # pass off to PIL - from PIL import Image - im = Image.fromstring("RGB", (w, h), s) - im.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/histogram_demo_canvasagg.txt b/_sources/examples/user_interfaces/histogram_demo_canvasagg.txt deleted file mode 100644 index 35c415ff679..00000000000 --- a/_sources/examples/user_interfaces/histogram_demo_canvasagg.txt +++ /dev/null @@ -1,71 +0,0 @@ -.. _user_interfaces-histogram_demo_canvasagg: - -user_interfaces example code: histogram_demo_canvasagg.py -========================================================= - -[`source code `_] - -:: - - #!/usr/bin/env python - """ - This is an example that shows you how to work directly with the agg - figure canvas to create a figure using the pythonic API. - - In this example, the contents of the agg canvas are extracted to a - string, which can in turn be passed off to PIL or put in a numeric - array - - - """ - from matplotlib.backends.backend_agg import FigureCanvasAgg - from matplotlib.figure import Figure - from matplotlib.mlab import normpdf - from numpy.random import randn - import numpy - - fig = Figure(figsize=(5, 4), dpi=100) - ax = fig.add_subplot(111) - - canvas = FigureCanvasAgg(fig) - - mu, sigma = 100, 15 - x = mu + sigma*randn(10000) - - # the histogram of the data - n, bins, patches = ax.hist(x, 50, normed=1) - - # add a 'best fit' line - y = normpdf(bins, mu, sigma) - line, = ax.plot(bins, y, 'r--') - line.set_linewidth(1) - - ax.set_xlabel('Smarts') - ax.set_ylabel('Probability') - ax.set_title(r'$\mathrm{Histogram of IQ: }\mu=100, \sigma=15$') - - ax.set_xlim((40, 160)) - ax.set_ylim((0, 0.03)) - - canvas.draw() - - s = canvas.tostring_rgb() # save this and convert to bitmap as needed - - # get the figure dimensions for creating bitmaps or numpy arrays, - # etc. - l, b, w, h = fig.bbox.bounds - w, h = int(w), int(h) - - if 0: - # convert to a numpy array - X = numpy.fromstring(s, numpy.uint8) - X.shape = h, w, 3 - - if 0: - # pass off to PIL - from PIL import Image - im = Image.fromstring("RGB", (w, h), s) - im.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/index.rst.txt b/_sources/examples/user_interfaces/index.rst.txt deleted file mode 100644 index a84c2e5d368..00000000000 --- a/_sources/examples/user_interfaces/index.rst.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _user_interfaces-examples-index: - -############################################## -user_interfaces Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - embedding_in_gtk - embedding_in_gtk2 - embedding_in_gtk3 - embedding_in_gtk3_panzoom - embedding_in_qt4 - embedding_in_qt4_wtoolbar - embedding_in_qt5 - embedding_in_tk - embedding_in_tk2 - embedding_in_tk_canvas - embedding_in_wx2 - embedding_in_wx3 - embedding_in_wx4 - embedding_in_wx5 - embedding_webagg - fourier_demo_wx - gtk_spreadsheet - histogram_demo_canvasagg - interactive - interactive2 - lineprops_dialog_gtk - mathtext_wx - mpl_with_glade - mpl_with_glade_316 - pylab_with_gtk - rec_edit_gtk_custom - rec_edit_gtk_simple - svg_histogram - svg_tooltip - toolmanager - wxcursor_demo diff --git a/_sources/examples/user_interfaces/index.txt b/_sources/examples/user_interfaces/index.txt deleted file mode 100644 index a84c2e5d368..00000000000 --- a/_sources/examples/user_interfaces/index.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _user_interfaces-examples-index: - -############################################## -user_interfaces Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - embedding_in_gtk - embedding_in_gtk2 - embedding_in_gtk3 - embedding_in_gtk3_panzoom - embedding_in_qt4 - embedding_in_qt4_wtoolbar - embedding_in_qt5 - embedding_in_tk - embedding_in_tk2 - embedding_in_tk_canvas - embedding_in_wx2 - embedding_in_wx3 - embedding_in_wx4 - embedding_in_wx5 - embedding_webagg - fourier_demo_wx - gtk_spreadsheet - histogram_demo_canvasagg - interactive - interactive2 - lineprops_dialog_gtk - mathtext_wx - mpl_with_glade - mpl_with_glade_316 - pylab_with_gtk - rec_edit_gtk_custom - rec_edit_gtk_simple - svg_histogram - svg_tooltip - toolmanager - wxcursor_demo diff --git a/_sources/examples/user_interfaces/interactive.rst.txt b/_sources/examples/user_interfaces/interactive.rst.txt deleted file mode 100644 index cb27d435ecb..00000000000 --- a/_sources/examples/user_interfaces/interactive.rst.txt +++ /dev/null @@ -1,255 +0,0 @@ -.. _user_interfaces-interactive: - -user_interfaces example code: interactive.py -============================================ - -[`source code `_] - -:: - - """Multithreaded interactive interpreter with GTK and Matplotlib support. - - WARNING: - As of 2010/06/25, this is not working, at least on Linux. - I have disabled it as a runnable script. - EF - - - Usage: - - pyint-gtk.py -> starts shell with gtk thread running separately - - pyint-gtk.py -pylab [filename] -> initializes matplotlib, optionally running - the named file. The shell starts after the file is executed. - - Threading code taken from: - http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by Brian - McErlean and John Finlay. - - Matplotlib support taken from interactive.py in the matplotlib distribution. - - Also borrows liberally from code.py in the Python standard library.""" - - from __future__ import print_function - - __author__ = "Fernando Perez " - - import sys - import code - import threading - - import gobject - import gtk - - try: - import readline - except ImportError: - has_readline = False - else: - has_readline = True - - - class MTConsole(code.InteractiveConsole): - """Simple multi-threaded shell""" - - def __init__(self, on_kill=None, *args, **kw): - code.InteractiveConsole.__init__(self, *args, **kw) - self.code_to_run = None - self.ready = threading.Condition() - self._kill = False - if on_kill is None: - on_kill = [] - # Check that all things to kill are callable: - for _ in on_kill: - if not callable(_): - raise TypeError('on_kill must be a list of callables') - self.on_kill = on_kill - # Set up tab-completer - if has_readline: - import rlcompleter - try: # this form only works with python 2.3 - self.completer = rlcompleter.Completer(self.locals) - except: # simpler for py2.2 - self.completer = rlcompleter.Completer() - - readline.set_completer(self.completer.complete) - # Use tab for completions - readline.parse_and_bind('tab: complete') - # This forces readline to automatically print the above list when tab - # completion is set to 'complete'. - readline.parse_and_bind('set show-all-if-ambiguous on') - # Bindings for incremental searches in the history. These searches - # use the string typed so far on the command line and search - # anything in the previous input history containing them. - readline.parse_and_bind('"\C-r": reverse-search-history') - readline.parse_and_bind('"\C-s": forward-search-history') - - def runsource(self, source, filename="", symbol="single"): - """Compile and run some source in the interpreter. - - Arguments are as for compile_command(). - - One several things can happen: - - 1) The input is incorrect; compile_command() raised an - exception (SyntaxError or OverflowError). A syntax traceback - will be printed by calling the showsyntaxerror() method. - - 2) The input is incomplete, and more input is required; - compile_command() returned None. Nothing happens. - - 3) The input is complete; compile_command() returned a code - object. The code is executed by calling self.runcode() (which - also handles run-time exceptions, except for SystemExit). - - The return value is True in case 2, False in the other cases (unless - an exception is raised). The return value can be used to - decide whether to use sys.ps1 or sys.ps2 to prompt the next - line. - """ - try: - code = self.compile(source, filename, symbol) - except (OverflowError, SyntaxError, ValueError): - # Case 1 - self.showsyntaxerror(filename) - return False - - if code is None: - # Case 2 - return True - - # Case 3 - # Store code in self, so the execution thread can handle it - self.ready.acquire() - self.code_to_run = code - self.ready.wait() # Wait until processed in timeout interval - self.ready.release() - - return False - - def runcode(self): - """Execute a code object. - - When an exception occurs, self.showtraceback() is called to display a - traceback.""" - - self.ready.acquire() - if self._kill: - print('Closing threads...') - sys.stdout.flush() - for tokill in self.on_kill: - tokill() - print('Done.') - - if self.code_to_run is not None: - self.ready.notify() - code.InteractiveConsole.runcode(self, self.code_to_run) - - self.code_to_run = None - self.ready.release() - return True - - def kill(self): - """Kill the thread, returning when it has been shut down.""" - self.ready.acquire() - self._kill = True - self.ready.release() - - - class GTKInterpreter(threading.Thread): - """Run gtk.main in the main thread and a python interpreter in a - separate thread. - Python commands can be passed to the thread where they will be executed. - This is implemented by periodically checking for passed code using a - GTK timeout callback. - """ - TIMEOUT = 100 # Millisecond interval between timeouts. - - def __init__(self, banner=None): - threading.Thread.__init__(self) - self.banner = banner - self.shell = MTConsole(on_kill=[gtk.main_quit]) - - def run(self): - self.pre_interact() - self.shell.interact(self.banner) - self.shell.kill() - - def mainloop(self): - self.start() - gobject.timeout_add(self.TIMEOUT, self.shell.runcode) - try: - if gtk.gtk_version[0] >= 2: - gtk.gdk.threads_init() - except AttributeError: - pass - gtk.main() - self.join() - - def pre_interact(self): - """This method should be overridden by subclasses. - - It gets called right before interact(), but after the thread starts. - Typically used to push initialization code into the interpreter""" - - pass - - - class MatplotLibInterpreter(GTKInterpreter): - """Threaded interpreter with matplotlib support. - - Note that this explicitly sets GTKAgg as the backend, since it has - specific GTK hooks in it.""" - - def __init__(self, banner=None): - banner = """\nWelcome to matplotlib, a MATLAB-like python environment. - help(matlab) -> help on matlab compatible commands from matplotlib. - help(plotting) -> help on plotting commands. - """ - GTKInterpreter.__init__(self, banner) - - def pre_interact(self): - """Initialize matplotlib before user interaction begins""" - - push = self.shell.push - # Code to execute in user's namespace - lines = ["import matplotlib", - "matplotlib.use('GTKAgg')", - "matplotlib.interactive(1)", - "import matplotlib.pylab as pylab", - "from matplotlib.pylab import *\n"] - - map(push, lines) - - # Execute file if given. - if len(sys.argv) > 1: - import matplotlib - matplotlib.interactive(0) # turn off interaction - fname = sys.argv[1] - try: - inFile = file(fname, 'r') - except IOError: - print('*** ERROR *** Could not read file <%s>' % fname) - else: - print('*** Executing file <%s>:' % fname) - for line in inFile: - if line.lstrip().find('show()') == 0: - continue - print('>>', line) - push(line) - inFile.close() - matplotlib.interactive(1) # turn on interaction - - if __name__ == '__main__': - print("This demo is not presently functional, so running") - print("it as a script has been disabled.") - sys.exit() - # Quick sys.argv hack to extract the option and leave filenames in sys.argv. - # For real option handling, use optparse or getopt. - if len(sys.argv) > 1 and sys.argv[1] == '-pylab': - sys.argv = [sys.argv[0]] + sys.argv[2:] - MatplotLibInterpreter().mainloop() - else: - GTKInterpreter().mainloop() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/interactive.txt b/_sources/examples/user_interfaces/interactive.txt deleted file mode 100644 index dcd50a0af09..00000000000 --- a/_sources/examples/user_interfaces/interactive.txt +++ /dev/null @@ -1,257 +0,0 @@ -.. _user_interfaces-interactive: - -user_interfaces example code: interactive.py -============================================ - -[`source code `_] - -:: - - #!/usr/bin/env python - - """Multithreaded interactive interpreter with GTK and Matplotlib support. - - WARNING: - As of 2010/06/25, this is not working, at least on Linux. - I have disabled it as a runnable script. - EF - - - Usage: - - pyint-gtk.py -> starts shell with gtk thread running separately - - pyint-gtk.py -pylab [filename] -> initializes matplotlib, optionally running - the named file. The shell starts after the file is executed. - - Threading code taken from: - http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by Brian - McErlean and John Finlay. - - Matplotlib support taken from interactive.py in the matplotlib distribution. - - Also borrows liberally from code.py in the Python standard library.""" - - from __future__ import print_function - - __author__ = "Fernando Perez " - - import sys - import code - import threading - - import gobject - import gtk - - try: - import readline - except ImportError: - has_readline = False - else: - has_readline = True - - - class MTConsole(code.InteractiveConsole): - """Simple multi-threaded shell""" - - def __init__(self, on_kill=None, *args, **kw): - code.InteractiveConsole.__init__(self, *args, **kw) - self.code_to_run = None - self.ready = threading.Condition() - self._kill = False - if on_kill is None: - on_kill = [] - # Check that all things to kill are callable: - for _ in on_kill: - if not callable(_): - raise TypeError('on_kill must be a list of callables') - self.on_kill = on_kill - # Set up tab-completer - if has_readline: - import rlcompleter - try: # this form only works with python 2.3 - self.completer = rlcompleter.Completer(self.locals) - except: # simpler for py2.2 - self.completer = rlcompleter.Completer() - - readline.set_completer(self.completer.complete) - # Use tab for completions - readline.parse_and_bind('tab: complete') - # This forces readline to automatically print the above list when tab - # completion is set to 'complete'. - readline.parse_and_bind('set show-all-if-ambiguous on') - # Bindings for incremental searches in the history. These searches - # use the string typed so far on the command line and search - # anything in the previous input history containing them. - readline.parse_and_bind('"\C-r": reverse-search-history') - readline.parse_and_bind('"\C-s": forward-search-history') - - def runsource(self, source, filename="", symbol="single"): - """Compile and run some source in the interpreter. - - Arguments are as for compile_command(). - - One several things can happen: - - 1) The input is incorrect; compile_command() raised an - exception (SyntaxError or OverflowError). A syntax traceback - will be printed by calling the showsyntaxerror() method. - - 2) The input is incomplete, and more input is required; - compile_command() returned None. Nothing happens. - - 3) The input is complete; compile_command() returned a code - object. The code is executed by calling self.runcode() (which - also handles run-time exceptions, except for SystemExit). - - The return value is True in case 2, False in the other cases (unless - an exception is raised). The return value can be used to - decide whether to use sys.ps1 or sys.ps2 to prompt the next - line. - """ - try: - code = self.compile(source, filename, symbol) - except (OverflowError, SyntaxError, ValueError): - # Case 1 - self.showsyntaxerror(filename) - return False - - if code is None: - # Case 2 - return True - - # Case 3 - # Store code in self, so the execution thread can handle it - self.ready.acquire() - self.code_to_run = code - self.ready.wait() # Wait until processed in timeout interval - self.ready.release() - - return False - - def runcode(self): - """Execute a code object. - - When an exception occurs, self.showtraceback() is called to display a - traceback.""" - - self.ready.acquire() - if self._kill: - print('Closing threads...') - sys.stdout.flush() - for tokill in self.on_kill: - tokill() - print('Done.') - - if self.code_to_run is not None: - self.ready.notify() - code.InteractiveConsole.runcode(self, self.code_to_run) - - self.code_to_run = None - self.ready.release() - return True - - def kill(self): - """Kill the thread, returning when it has been shut down.""" - self.ready.acquire() - self._kill = True - self.ready.release() - - - class GTKInterpreter(threading.Thread): - """Run gtk.main in the main thread and a python interpreter in a - separate thread. - Python commands can be passed to the thread where they will be executed. - This is implemented by periodically checking for passed code using a - GTK timeout callback. - """ - TIMEOUT = 100 # Millisecond interval between timeouts. - - def __init__(self, banner=None): - threading.Thread.__init__(self) - self.banner = banner - self.shell = MTConsole(on_kill=[gtk.main_quit]) - - def run(self): - self.pre_interact() - self.shell.interact(self.banner) - self.shell.kill() - - def mainloop(self): - self.start() - gobject.timeout_add(self.TIMEOUT, self.shell.runcode) - try: - if gtk.gtk_version[0] >= 2: - gtk.gdk.threads_init() - except AttributeError: - pass - gtk.main() - self.join() - - def pre_interact(self): - """This method should be overridden by subclasses. - - It gets called right before interact(), but after the thread starts. - Typically used to push initialization code into the interpreter""" - - pass - - - class MatplotLibInterpreter(GTKInterpreter): - """Threaded interpreter with matplotlib support. - - Note that this explicitly sets GTKAgg as the backend, since it has - specific GTK hooks in it.""" - - def __init__(self, banner=None): - banner = """\nWelcome to matplotlib, a MATLAB-like python environment. - help(matlab) -> help on matlab compatible commands from matplotlib. - help(plotting) -> help on plotting commands. - """ - GTKInterpreter.__init__(self, banner) - - def pre_interact(self): - """Initialize matplotlib before user interaction begins""" - - push = self.shell.push - # Code to execute in user's namespace - lines = ["import matplotlib", - "matplotlib.use('GTKAgg')", - "matplotlib.interactive(1)", - "import matplotlib.pylab as pylab", - "from matplotlib.pylab import *\n"] - - map(push, lines) - - # Execute file if given. - if len(sys.argv) > 1: - import matplotlib - matplotlib.interactive(0) # turn off interaction - fname = sys.argv[1] - try: - inFile = file(fname, 'r') - except IOError: - print('*** ERROR *** Could not read file <%s>' % fname) - else: - print('*** Executing file <%s>:' % fname) - for line in inFile: - if line.lstrip().find('show()') == 0: - continue - print('>>', line) - push(line) - inFile.close() - matplotlib.interactive(1) # turn on interaction - - if __name__ == '__main__': - print("This demo is not presently functional, so running") - print("it as a script has been disabled.") - sys.exit() - # Quick sys.argv hack to extract the option and leave filenames in sys.argv. - # For real option handling, use optparse or getopt. - if len(sys.argv) > 1 and sys.argv[1] == '-pylab': - sys.argv = [sys.argv[0]] + sys.argv[2:] - MatplotLibInterpreter().mainloop() - else: - GTKInterpreter().mainloop() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/interactive2.rst.txt b/_sources/examples/user_interfaces/interactive2.rst.txt deleted file mode 100644 index f512b5ffada..00000000000 --- a/_sources/examples/user_interfaces/interactive2.rst.txt +++ /dev/null @@ -1,393 +0,0 @@ -.. _user_interfaces-interactive2: - -user_interfaces example code: interactive2.py -============================================= - -[`source code `_] - -:: - - from __future__ import print_function - - # GTK Interactive Console - # (C) 2003, Jon Anderson - # See www.python.org/2.2/license.html for - # license details. - # - import gtk - import gtk.gdk - - import code - import os - import sys - import pango - - import __builtin__ - import __main__ - - - banner = """GTK Interactive Python Console - Thanks to Jon Anderson - %s - """ % sys.version - - banner += """ - - Welcome to matplotlib. - - help(matplotlib) -- some general information about matplotlib - help(plotting) -- shows a list of plot specific commands - - """ - - - class Completer(object): - """ - Taken from rlcompleter, with readline references stripped, and a local dictionary to use. - """ - - def __init__(self, locals): - self.locals = locals - - def complete(self, text, state): - """Return the next possible completion for 'text'. - This is called successively with state == 0, 1, 2, ... until it - returns None. The completion should begin with 'text'. - - """ - if state == 0: - if "." in text: - self.matches = self.attr_matches(text) - else: - self.matches = self.global_matches(text) - try: - return self.matches[state] - except IndexError: - return None - - def global_matches(self, text): - """Compute matches when text is a simple name. - - Return a list of all keywords, built-in functions and names - currently defines in __main__ that match. - - """ - import keyword - matches = [] - n = len(text) - for list in [keyword.kwlist, __builtin__.__dict__.keys(), __main__.__dict__.keys(), self.locals.keys()]: - for word in list: - if word[:n] == text and word != "__builtins__": - matches.append(word) - return matches - - def attr_matches(self, text): - """Compute matches when text contains a dot. - - Assuming the text is of the form NAME.NAME....[NAME], and is - evaluatable in the globals of __main__, it will be evaluated - and its attributes (as revealed by dir()) are used as possible - completions. (For class instances, class members are are also - considered.) - - WARNING: this can still invoke arbitrary C code, if an object - with a __getattr__ hook is evaluated. - - """ - import re - m = re.match(r"(\w+(\.\w+)*)\.(\w*)", text) - if not m: - return - expr, attr = m.group(1, 3) - object = eval(expr, __main__.__dict__, self.locals) - words = dir(object) - if hasattr(object, '__class__'): - words.append('__class__') - words = words + get_class_members(object.__class__) - matches = [] - n = len(attr) - for word in words: - if word[:n] == attr and word != "__builtins__": - matches.append("%s.%s" % (expr, word)) - return matches - - - def get_class_members(klass): - ret = dir(klass) - if hasattr(klass, '__bases__'): - for base in klass.__bases__: - ret = ret + get_class_members(base) - return ret - - - class OutputStream(object): - """ - A Multiplexing output stream. - It can replace another stream, and tee output to the original stream and too - a GTK textview. - """ - - def __init__(self, view, old_out, style): - self.view = view - self.buffer = view.get_buffer() - self.mark = self.buffer.create_mark("End", self.buffer.get_end_iter(), False) - self.out = old_out - self.style = style - self.tee = 1 - - def write(self, text): - if self.tee: - self.out.write(text) - - end = self.buffer.get_end_iter() - - if self.view is not None: - self.view.scroll_to_mark(self.mark, 0, True, 1, 1) - - self.buffer.insert_with_tags(end, text, self.style) - - - class GTKInterpreterConsole(gtk.ScrolledWindow): - """ - An InteractiveConsole for GTK. It's an actual widget, - so it can be dropped in just about anywhere. - """ - - def __init__(self): - gtk.ScrolledWindow.__init__(self) - self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) - - self.text = gtk.TextView() - self.text.set_wrap_mode(True) - - self.interpreter = code.InteractiveInterpreter() - - self.completer = Completer(self.interpreter.locals) - self.buffer = [] - self.history = [] - self.banner = banner - self.ps1 = ">>> " - self.ps2 = "... " - - self.text.add_events(gtk.gdk.KEY_PRESS_MASK) - self.text.connect("key_press_event", self.key_pressed) - - self.current_history = -1 - - self.mark = self.text.get_buffer().create_mark("End", self.text.get_buffer().get_end_iter(), False) - - # setup colors - self.style_banner = gtk.TextTag("banner") - self.style_banner.set_property("foreground", "saddle brown") - - self.style_ps1 = gtk.TextTag("ps1") - self.style_ps1.set_property("foreground", "DarkOrchid4") - self.style_ps1.set_property("editable", False) - self.style_ps1.set_property("font", "courier") - - self.style_ps2 = gtk.TextTag("ps2") - self.style_ps2.set_property("foreground", "DarkOliveGreen") - self.style_ps2.set_property("editable", False) - self.style_ps2.set_property("font", "courier") - - self.style_out = gtk.TextTag("stdout") - self.style_out.set_property("foreground", "midnight blue") - self.style_err = gtk.TextTag("stderr") - self.style_err.set_property("style", pango.STYLE_ITALIC) - self.style_err.set_property("foreground", "red") - - self.text.get_buffer().get_tag_table().add(self.style_banner) - self.text.get_buffer().get_tag_table().add(self.style_ps1) - self.text.get_buffer().get_tag_table().add(self.style_ps2) - self.text.get_buffer().get_tag_table().add(self.style_out) - self.text.get_buffer().get_tag_table().add(self.style_err) - - self.stdout = OutputStream(self.text, sys.stdout, self.style_out) - self.stderr = OutputStream(self.text, sys.stderr, self.style_err) - - sys.stderr = self.stderr - sys.stdout = self.stdout - - self.current_prompt = None - - self.write_line(self.banner, self.style_banner) - self.prompt_ps1() - - self.add(self.text) - self.text.show() - - def reset_history(self): - self.history = [] - - def reset_buffer(self): - self.buffer = [] - - def prompt_ps1(self): - self.current_prompt = self.prompt_ps1 - self.write_line(self.ps1, self.style_ps1) - - def prompt_ps2(self): - self.current_prompt = self.prompt_ps2 - self.write_line(self.ps2, self.style_ps2) - - def write_line(self, text, style=None): - start, end = self.text.get_buffer().get_bounds() - if style is None: - self.text.get_buffer().insert(end, text) - else: - self.text.get_buffer().insert_with_tags(end, text, style) - - self.text.scroll_to_mark(self.mark, 0, True, 1, 1) - - def push(self, line): - - self.buffer.append(line) - if len(line) > 0: - self.history.append(line) - - source = "\n".join(self.buffer) - - more = self.interpreter.runsource(source, "<>") - - if not more: - self.reset_buffer() - - return more - - def key_pressed(self, widget, event): - if event.keyval == gtk.gdk.keyval_from_name('Return'): - return self.execute_line() - - if event.keyval == gtk.gdk.keyval_from_name('Up'): - self.current_history = self.current_history - 1 - if self.current_history < - len(self.history): - self.current_history = - len(self.history) - return self.show_history() - elif event.keyval == gtk.gdk.keyval_from_name('Down'): - self.current_history = self.current_history + 1 - if self.current_history > 0: - self.current_history = 0 - return self.show_history() - elif event.keyval == gtk.gdk.keyval_from_name('Home'): - l = self.text.get_buffer().get_line_count() - 1 - start = self.text.get_buffer().get_iter_at_line_offset(l, 4) - self.text.get_buffer().place_cursor(start) - return True - elif event.keyval == gtk.gdk.keyval_from_name('space') and event.state & gtk.gdk.CONTROL_MASK: - return self.complete_line() - return False - - def show_history(self): - if self.current_history == 0: - return True - else: - self.replace_line(self.history[self.current_history]) - return True - - def current_line(self): - start, end = self.current_line_bounds() - return self.text.get_buffer().get_text(start, end, True) - - def current_line_bounds(self): - txt_buffer = self.text.get_buffer() - l = txt_buffer.get_line_count() - 1 - - start = txt_buffer.get_iter_at_line(l) - if start.get_chars_in_line() >= 4: - start.forward_chars(4) - end = txt_buffer.get_end_iter() - return start, end - - def replace_line(self, txt): - start, end = self.current_line_bounds() - self.text.get_buffer().delete(start, end) - self.write_line(txt) - - def execute_line(self, line=None): - if line is None: - line = self.current_line() - self.write_line("\n") - else: - self.write_line(line + "\n") - - more = self.push(line) - - self.text.get_buffer().place_cursor(self.text.get_buffer().get_end_iter()) - - if more: - self.prompt_ps2() - else: - self.prompt_ps1() - - self.current_history = 0 - - self.window.raise_() - - return True - - def complete_line(self): - line = self.current_line() - tokens = line.split() - token = tokens[-1] - - completions = [] - p = self.completer.complete(token, len(completions)) - while p is not None: - completions.append(p) - p = self.completer.complete(token, len(completions)) - - if len(completions) != 1: - self.write_line("\n") - self.write_line("\n".join(completions), self.style_ps1) - self.write_line("\n") - self.current_prompt() - self.write_line(line) - else: - i = line.rfind(token) - line = line[0:i] + completions[0] - self.replace_line(line) - - return True - - - def main(): - w = gtk.Window() - console = GTKInterpreterConsole() - console.set_size_request(640, 480) - w.add(console) - - def destroy(arg=None): - gtk.main_quit() - - def key_event(widget, event): - if gtk.gdk.keyval_name(event.keyval) == 'd' and \ - event.state & gtk.gdk.CONTROL_MASK: - destroy() - return False - - w.connect("destroy", destroy) - - w.add_events(gtk.gdk.KEY_PRESS_MASK) - w.connect('key_press_event', key_event) - w.show_all() - - console.execute_line('import matplotlib') - console.execute_line("matplotlib.use('GTKAgg')") - console.execute_line('matplotlib.interactive(1)') - console.execute_line('from pylab import *') - - if len(sys.argv) > 1: - fname = sys.argv[1] - if not os.path.exists(fname): - print('%s does not exist' % fname) - for line in file(fname): - line = line.strip() - - console.execute_line(line) - gtk.main() - - if __name__ == '__main__': - main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/interactive2.txt b/_sources/examples/user_interfaces/interactive2.txt deleted file mode 100644 index 57cb2b51c37..00000000000 --- a/_sources/examples/user_interfaces/interactive2.txt +++ /dev/null @@ -1,395 +0,0 @@ -.. _user_interfaces-interactive2: - -user_interfaces example code: interactive2.py -============================================= - -[`source code `_] - -:: - - #!/usr/bin/env python - - from __future__ import print_function - - # GTK Interactive Console - # (C) 2003, Jon Anderson - # See www.python.org/2.2/license.html for - # license details. - # - import gtk - import gtk.gdk - - import code - import os - import sys - import pango - - import __builtin__ - import __main__ - - - banner = """GTK Interactive Python Console - Thanks to Jon Anderson - %s - """ % sys.version - - banner += """ - - Welcome to matplotlib. - - help(matplotlib) -- some general information about matplotlib - help(plotting) -- shows a list of plot specific commands - - """ - - - class Completer(object): - """ - Taken from rlcompleter, with readline references stripped, and a local dictionary to use. - """ - - def __init__(self, locals): - self.locals = locals - - def complete(self, text, state): - """Return the next possible completion for 'text'. - This is called successively with state == 0, 1, 2, ... until it - returns None. The completion should begin with 'text'. - - """ - if state == 0: - if "." in text: - self.matches = self.attr_matches(text) - else: - self.matches = self.global_matches(text) - try: - return self.matches[state] - except IndexError: - return None - - def global_matches(self, text): - """Compute matches when text is a simple name. - - Return a list of all keywords, built-in functions and names - currently defines in __main__ that match. - - """ - import keyword - matches = [] - n = len(text) - for list in [keyword.kwlist, __builtin__.__dict__.keys(), __main__.__dict__.keys(), self.locals.keys()]: - for word in list: - if word[:n] == text and word != "__builtins__": - matches.append(word) - return matches - - def attr_matches(self, text): - """Compute matches when text contains a dot. - - Assuming the text is of the form NAME.NAME....[NAME], and is - evaluatable in the globals of __main__, it will be evaluated - and its attributes (as revealed by dir()) are used as possible - completions. (For class instances, class members are are also - considered.) - - WARNING: this can still invoke arbitrary C code, if an object - with a __getattr__ hook is evaluated. - - """ - import re - m = re.match(r"(\w+(\.\w+)*)\.(\w*)", text) - if not m: - return - expr, attr = m.group(1, 3) - object = eval(expr, __main__.__dict__, self.locals) - words = dir(object) - if hasattr(object, '__class__'): - words.append('__class__') - words = words + get_class_members(object.__class__) - matches = [] - n = len(attr) - for word in words: - if word[:n] == attr and word != "__builtins__": - matches.append("%s.%s" % (expr, word)) - return matches - - - def get_class_members(klass): - ret = dir(klass) - if hasattr(klass, '__bases__'): - for base in klass.__bases__: - ret = ret + get_class_members(base) - return ret - - - class OutputStream(object): - """ - A Multiplexing output stream. - It can replace another stream, and tee output to the original stream and too - a GTK textview. - """ - - def __init__(self, view, old_out, style): - self.view = view - self.buffer = view.get_buffer() - self.mark = self.buffer.create_mark("End", self.buffer.get_end_iter(), False) - self.out = old_out - self.style = style - self.tee = 1 - - def write(self, text): - if self.tee: - self.out.write(text) - - end = self.buffer.get_end_iter() - - if self.view is not None: - self.view.scroll_to_mark(self.mark, 0, True, 1, 1) - - self.buffer.insert_with_tags(end, text, self.style) - - - class GTKInterpreterConsole(gtk.ScrolledWindow): - """ - An InteractiveConsole for GTK. It's an actual widget, - so it can be dropped in just about anywhere. - """ - - def __init__(self): - gtk.ScrolledWindow.__init__(self) - self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) - - self.text = gtk.TextView() - self.text.set_wrap_mode(True) - - self.interpreter = code.InteractiveInterpreter() - - self.completer = Completer(self.interpreter.locals) - self.buffer = [] - self.history = [] - self.banner = banner - self.ps1 = ">>> " - self.ps2 = "... " - - self.text.add_events(gtk.gdk.KEY_PRESS_MASK) - self.text.connect("key_press_event", self.key_pressed) - - self.current_history = -1 - - self.mark = self.text.get_buffer().create_mark("End", self.text.get_buffer().get_end_iter(), False) - - # setup colors - self.style_banner = gtk.TextTag("banner") - self.style_banner.set_property("foreground", "saddle brown") - - self.style_ps1 = gtk.TextTag("ps1") - self.style_ps1.set_property("foreground", "DarkOrchid4") - self.style_ps1.set_property("editable", False) - self.style_ps1.set_property("font", "courier") - - self.style_ps2 = gtk.TextTag("ps2") - self.style_ps2.set_property("foreground", "DarkOliveGreen") - self.style_ps2.set_property("editable", False) - self.style_ps2.set_property("font", "courier") - - self.style_out = gtk.TextTag("stdout") - self.style_out.set_property("foreground", "midnight blue") - self.style_err = gtk.TextTag("stderr") - self.style_err.set_property("style", pango.STYLE_ITALIC) - self.style_err.set_property("foreground", "red") - - self.text.get_buffer().get_tag_table().add(self.style_banner) - self.text.get_buffer().get_tag_table().add(self.style_ps1) - self.text.get_buffer().get_tag_table().add(self.style_ps2) - self.text.get_buffer().get_tag_table().add(self.style_out) - self.text.get_buffer().get_tag_table().add(self.style_err) - - self.stdout = OutputStream(self.text, sys.stdout, self.style_out) - self.stderr = OutputStream(self.text, sys.stderr, self.style_err) - - sys.stderr = self.stderr - sys.stdout = self.stdout - - self.current_prompt = None - - self.write_line(self.banner, self.style_banner) - self.prompt_ps1() - - self.add(self.text) - self.text.show() - - def reset_history(self): - self.history = [] - - def reset_buffer(self): - self.buffer = [] - - def prompt_ps1(self): - self.current_prompt = self.prompt_ps1 - self.write_line(self.ps1, self.style_ps1) - - def prompt_ps2(self): - self.current_prompt = self.prompt_ps2 - self.write_line(self.ps2, self.style_ps2) - - def write_line(self, text, style=None): - start, end = self.text.get_buffer().get_bounds() - if style is None: - self.text.get_buffer().insert(end, text) - else: - self.text.get_buffer().insert_with_tags(end, text, style) - - self.text.scroll_to_mark(self.mark, 0, True, 1, 1) - - def push(self, line): - - self.buffer.append(line) - if len(line) > 0: - self.history.append(line) - - source = "\n".join(self.buffer) - - more = self.interpreter.runsource(source, "<>") - - if not more: - self.reset_buffer() - - return more - - def key_pressed(self, widget, event): - if event.keyval == gtk.gdk.keyval_from_name('Return'): - return self.execute_line() - - if event.keyval == gtk.gdk.keyval_from_name('Up'): - self.current_history = self.current_history - 1 - if self.current_history < - len(self.history): - self.current_history = - len(self.history) - return self.show_history() - elif event.keyval == gtk.gdk.keyval_from_name('Down'): - self.current_history = self.current_history + 1 - if self.current_history > 0: - self.current_history = 0 - return self.show_history() - elif event.keyval == gtk.gdk.keyval_from_name('Home'): - l = self.text.get_buffer().get_line_count() - 1 - start = self.text.get_buffer().get_iter_at_line_offset(l, 4) - self.text.get_buffer().place_cursor(start) - return True - elif event.keyval == gtk.gdk.keyval_from_name('space') and event.state & gtk.gdk.CONTROL_MASK: - return self.complete_line() - return False - - def show_history(self): - if self.current_history == 0: - return True - else: - self.replace_line(self.history[self.current_history]) - return True - - def current_line(self): - start, end = self.current_line_bounds() - return self.text.get_buffer().get_text(start, end, True) - - def current_line_bounds(self): - txt_buffer = self.text.get_buffer() - l = txt_buffer.get_line_count() - 1 - - start = txt_buffer.get_iter_at_line(l) - if start.get_chars_in_line() >= 4: - start.forward_chars(4) - end = txt_buffer.get_end_iter() - return start, end - - def replace_line(self, txt): - start, end = self.current_line_bounds() - self.text.get_buffer().delete(start, end) - self.write_line(txt) - - def execute_line(self, line=None): - if line is None: - line = self.current_line() - self.write_line("\n") - else: - self.write_line(line + "\n") - - more = self.push(line) - - self.text.get_buffer().place_cursor(self.text.get_buffer().get_end_iter()) - - if more: - self.prompt_ps2() - else: - self.prompt_ps1() - - self.current_history = 0 - - self.window.raise_() - - return True - - def complete_line(self): - line = self.current_line() - tokens = line.split() - token = tokens[-1] - - completions = [] - p = self.completer.complete(token, len(completions)) - while p is not None: - completions.append(p) - p = self.completer.complete(token, len(completions)) - - if len(completions) != 1: - self.write_line("\n") - self.write_line("\n".join(completions), self.style_ps1) - self.write_line("\n") - self.current_prompt() - self.write_line(line) - else: - i = line.rfind(token) - line = line[0:i] + completions[0] - self.replace_line(line) - - return True - - - def main(): - w = gtk.Window() - console = GTKInterpreterConsole() - console.set_size_request(640, 480) - w.add(console) - - def destroy(arg=None): - gtk.main_quit() - - def key_event(widget, event): - if gtk.gdk.keyval_name(event.keyval) == 'd' and \ - event.state & gtk.gdk.CONTROL_MASK: - destroy() - return False - - w.connect("destroy", destroy) - - w.add_events(gtk.gdk.KEY_PRESS_MASK) - w.connect('key_press_event', key_event) - w.show_all() - - console.execute_line('import matplotlib') - console.execute_line("matplotlib.use('GTKAgg')") - console.execute_line('matplotlib.interactive(1)') - console.execute_line('from pylab import *') - - if len(sys.argv) > 1: - fname = sys.argv[1] - if not os.path.exists(fname): - print('%s does not exist' % fname) - for line in file(fname): - line = line.strip() - - console.execute_line(line) - gtk.main() - - if __name__ == '__main__': - main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/lineprops_dialog_gtk.rst.txt b/_sources/examples/user_interfaces/lineprops_dialog_gtk.rst.txt deleted file mode 100644 index 87762bac97b..00000000000 --- a/_sources/examples/user_interfaces/lineprops_dialog_gtk.rst.txt +++ /dev/null @@ -1,36 +0,0 @@ -.. _user_interfaces-lineprops_dialog_gtk: - -user_interfaces example code: lineprops_dialog_gtk.py -===================================================== - -[`source code `_] - -:: - - import matplotlib - matplotlib.use('GTKAgg') - from matplotlib.backends.backend_gtk import DialogLineprops - - import numpy as np - import matplotlib.pyplot as plt - - - def f(t): - s1 = np.cos(2*np.pi*t) - e1 = np.exp(-t) - return np.multiply(s1, e1) - - t1 = np.arange(0.0, 5.0, 0.1) - t2 = np.arange(0.0, 5.0, 0.02) - t3 = np.arange(0.0, 2.0, 0.01) - - fig, ax = plt.subplots() - l1, = ax.plot(t1, f(t1), 'bo', label='line 1') - l2, = ax.plot(t2, f(t2), 'k--', label='line 2') - - dlg = DialogLineprops([l1, l2]) - dlg.show() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/lineprops_dialog_gtk.txt b/_sources/examples/user_interfaces/lineprops_dialog_gtk.txt deleted file mode 100644 index 87762bac97b..00000000000 --- a/_sources/examples/user_interfaces/lineprops_dialog_gtk.txt +++ /dev/null @@ -1,36 +0,0 @@ -.. _user_interfaces-lineprops_dialog_gtk: - -user_interfaces example code: lineprops_dialog_gtk.py -===================================================== - -[`source code `_] - -:: - - import matplotlib - matplotlib.use('GTKAgg') - from matplotlib.backends.backend_gtk import DialogLineprops - - import numpy as np - import matplotlib.pyplot as plt - - - def f(t): - s1 = np.cos(2*np.pi*t) - e1 = np.exp(-t) - return np.multiply(s1, e1) - - t1 = np.arange(0.0, 5.0, 0.1) - t2 = np.arange(0.0, 5.0, 0.02) - t3 = np.arange(0.0, 2.0, 0.01) - - fig, ax = plt.subplots() - l1, = ax.plot(t1, f(t1), 'bo', label='line 1') - l2, = ax.plot(t2, f(t2), 'k--', label='line 2') - - dlg = DialogLineprops([l1, l2]) - dlg.show() - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/mathtext_wx.rst.txt b/_sources/examples/user_interfaces/mathtext_wx.rst.txt deleted file mode 100644 index 4b981b827db..00000000000 --- a/_sources/examples/user_interfaces/mathtext_wx.rst.txt +++ /dev/null @@ -1,133 +0,0 @@ -.. _user_interfaces-mathtext_wx: - -user_interfaces example code: mathtext_wx.py -============================================ - -[`source code `_] - -:: - - """ - Demonstrates how to convert mathtext to a wx.Bitmap for display in various - controls on wxPython. - """ - - import matplotlib - matplotlib.use("WxAgg") - from numpy import arange, sin, pi, cos, log - from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas - from matplotlib.backends.backend_wx import NavigationToolbar2Wx, wxc - from matplotlib.figure import Figure - - import wx - - IS_GTK = 'wxGTK' in wx.PlatformInfo - IS_WIN = 'wxMSW' in wx.PlatformInfo - - ############################################################ - # This is where the "magic" happens. - from matplotlib.mathtext import MathTextParser - mathtext_parser = MathTextParser("Bitmap") - - - def mathtext_to_wxbitmap(s): - ftimage, depth = mathtext_parser.parse(s, 150) - return wxc.BitmapFromBuffer( - ftimage.get_width(), ftimage.get_height(), - ftimage.as_rgba_str()) - ############################################################ - - functions = [ - (r'$\sin(2 \pi x)$', lambda x: sin(2*pi*x)), - (r'$\frac{4}{3}\pi x^3$', lambda x: (4.0/3.0)*pi*x**3), - (r'$\cos(2 \pi x)$', lambda x: cos(2*pi*x)), - (r'$\log(x)$', lambda x: log(x)) - ] - - - class CanvasFrame(wx.Frame): - def __init__(self, parent, title): - wx.Frame.__init__(self, parent, -1, title, size=(550, 350)) - self.SetBackgroundColour(wxc.NamedColour("WHITE")) - - self.figure = Figure() - self.axes = self.figure.add_subplot(111) - - self.canvas = FigureCanvas(self, -1, self.figure) - - self.change_plot(0) - - self.sizer = wx.BoxSizer(wx.VERTICAL) - self.add_buttonbar() - self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) - self.add_toolbar() # comment this out for no toolbar - - menuBar = wx.MenuBar() - - # File Menu - menu = wx.Menu() - menu.Append(wx.ID_EXIT, "E&xit\tAlt-X", "Exit this simple sample") - menuBar.Append(menu, "&File") - - if IS_GTK or IS_WIN: - # Equation Menu - menu = wx.Menu() - for i, (mt, func) in enumerate(functions): - bm = mathtext_to_wxbitmap(mt) - item = wx.MenuItem(menu, 1000 + i, " ") - item.SetBitmap(bm) - menu.AppendItem(item) - self.Bind(wx.EVT_MENU, self.OnChangePlot, item) - menuBar.Append(menu, "&Functions") - - self.SetMenuBar(menuBar) - - self.SetSizer(self.sizer) - self.Fit() - - def add_buttonbar(self): - self.button_bar = wx.Panel(self) - self.button_bar_sizer = wx.BoxSizer(wx.HORIZONTAL) - self.sizer.Add(self.button_bar, 0, wx.LEFT | wx.TOP | wx.GROW) - - for i, (mt, func) in enumerate(functions): - bm = mathtext_to_wxbitmap(mt) - button = wx.BitmapButton(self.button_bar, 1000 + i, bm) - self.button_bar_sizer.Add(button, 1, wx.GROW) - self.Bind(wx.EVT_BUTTON, self.OnChangePlot, button) - - self.button_bar.SetSizer(self.button_bar_sizer) - - def add_toolbar(self): - """Copied verbatim from embedding_wx2.py""" - self.toolbar = NavigationToolbar2Wx(self.canvas) - self.toolbar.Realize() - # By adding toolbar in sizer, we are able to put it at the bottom - # of the frame - so appearance is closer to GTK version. - self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) - # update the axes menu on the toolbar - self.toolbar.update() - - def OnChangePlot(self, event): - self.change_plot(event.GetId() - 1000) - - def change_plot(self, plot_number): - t = arange(1.0, 3.0, 0.01) - s = functions[plot_number][1](t) - self.axes.clear() - self.axes.plot(t, s) - self.canvas.draw() - - - class MyApp(wx.App): - def OnInit(self): - frame = CanvasFrame(None, "wxPython mathtext demo app") - self.SetTopWindow(frame) - frame.Show(True) - return True - - app = MyApp() - app.MainLoop() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/mathtext_wx.txt b/_sources/examples/user_interfaces/mathtext_wx.txt deleted file mode 100644 index 4b981b827db..00000000000 --- a/_sources/examples/user_interfaces/mathtext_wx.txt +++ /dev/null @@ -1,133 +0,0 @@ -.. _user_interfaces-mathtext_wx: - -user_interfaces example code: mathtext_wx.py -============================================ - -[`source code `_] - -:: - - """ - Demonstrates how to convert mathtext to a wx.Bitmap for display in various - controls on wxPython. - """ - - import matplotlib - matplotlib.use("WxAgg") - from numpy import arange, sin, pi, cos, log - from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas - from matplotlib.backends.backend_wx import NavigationToolbar2Wx, wxc - from matplotlib.figure import Figure - - import wx - - IS_GTK = 'wxGTK' in wx.PlatformInfo - IS_WIN = 'wxMSW' in wx.PlatformInfo - - ############################################################ - # This is where the "magic" happens. - from matplotlib.mathtext import MathTextParser - mathtext_parser = MathTextParser("Bitmap") - - - def mathtext_to_wxbitmap(s): - ftimage, depth = mathtext_parser.parse(s, 150) - return wxc.BitmapFromBuffer( - ftimage.get_width(), ftimage.get_height(), - ftimage.as_rgba_str()) - ############################################################ - - functions = [ - (r'$\sin(2 \pi x)$', lambda x: sin(2*pi*x)), - (r'$\frac{4}{3}\pi x^3$', lambda x: (4.0/3.0)*pi*x**3), - (r'$\cos(2 \pi x)$', lambda x: cos(2*pi*x)), - (r'$\log(x)$', lambda x: log(x)) - ] - - - class CanvasFrame(wx.Frame): - def __init__(self, parent, title): - wx.Frame.__init__(self, parent, -1, title, size=(550, 350)) - self.SetBackgroundColour(wxc.NamedColour("WHITE")) - - self.figure = Figure() - self.axes = self.figure.add_subplot(111) - - self.canvas = FigureCanvas(self, -1, self.figure) - - self.change_plot(0) - - self.sizer = wx.BoxSizer(wx.VERTICAL) - self.add_buttonbar() - self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) - self.add_toolbar() # comment this out for no toolbar - - menuBar = wx.MenuBar() - - # File Menu - menu = wx.Menu() - menu.Append(wx.ID_EXIT, "E&xit\tAlt-X", "Exit this simple sample") - menuBar.Append(menu, "&File") - - if IS_GTK or IS_WIN: - # Equation Menu - menu = wx.Menu() - for i, (mt, func) in enumerate(functions): - bm = mathtext_to_wxbitmap(mt) - item = wx.MenuItem(menu, 1000 + i, " ") - item.SetBitmap(bm) - menu.AppendItem(item) - self.Bind(wx.EVT_MENU, self.OnChangePlot, item) - menuBar.Append(menu, "&Functions") - - self.SetMenuBar(menuBar) - - self.SetSizer(self.sizer) - self.Fit() - - def add_buttonbar(self): - self.button_bar = wx.Panel(self) - self.button_bar_sizer = wx.BoxSizer(wx.HORIZONTAL) - self.sizer.Add(self.button_bar, 0, wx.LEFT | wx.TOP | wx.GROW) - - for i, (mt, func) in enumerate(functions): - bm = mathtext_to_wxbitmap(mt) - button = wx.BitmapButton(self.button_bar, 1000 + i, bm) - self.button_bar_sizer.Add(button, 1, wx.GROW) - self.Bind(wx.EVT_BUTTON, self.OnChangePlot, button) - - self.button_bar.SetSizer(self.button_bar_sizer) - - def add_toolbar(self): - """Copied verbatim from embedding_wx2.py""" - self.toolbar = NavigationToolbar2Wx(self.canvas) - self.toolbar.Realize() - # By adding toolbar in sizer, we are able to put it at the bottom - # of the frame - so appearance is closer to GTK version. - self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) - # update the axes menu on the toolbar - self.toolbar.update() - - def OnChangePlot(self, event): - self.change_plot(event.GetId() - 1000) - - def change_plot(self, plot_number): - t = arange(1.0, 3.0, 0.01) - s = functions[plot_number][1](t) - self.axes.clear() - self.axes.plot(t, s) - self.canvas.draw() - - - class MyApp(wx.App): - def OnInit(self): - frame = CanvasFrame(None, "wxPython mathtext demo app") - self.SetTopWindow(frame) - frame.Show(True) - return True - - app = MyApp() - app.MainLoop() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/mpl_with_glade.rst.txt b/_sources/examples/user_interfaces/mpl_with_glade.rst.txt deleted file mode 100644 index 9f0a2ced0d8..00000000000 --- a/_sources/examples/user_interfaces/mpl_with_glade.rst.txt +++ /dev/null @@ -1,112 +0,0 @@ -.. _user_interfaces-mpl_with_glade: - -user_interfaces example code: mpl_with_glade.py -=============================================== - -[`source code `_] - -:: - - from __future__ import print_function - import matplotlib - matplotlib.use('GTK') - - from matplotlib.figure import Figure - from matplotlib.axes import Subplot - from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas - from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar - from matplotlib.widgets import SpanSelector - - from numpy import arange, sin, pi - import gtk - import gtk.glade - - - def simple_msg(msg, parent=None, title=None): - dialog = gtk.MessageDialog( - parent=None, - type=gtk.MESSAGE_INFO, - buttons=gtk.BUTTONS_OK, - message_format=msg) - if parent is not None: - dialog.set_transient_for(parent) - if title is not None: - dialog.set_title(title) - dialog.show() - dialog.run() - dialog.destroy() - return None - - - class GladeHandlers(object): - def on_buttonClickMe_clicked(event): - simple_msg('Nothing to say, really', - parent=widgets['windowMain'], - title='Thanks!') - - - class WidgetsWrapper(object): - def __init__(self): - self.widgets = gtk.glade.XML('mpl_with_glade.glade') - self.widgets.signal_autoconnect(GladeHandlers.__dict__) - - self['windowMain'].connect('destroy', lambda x: gtk.main_quit()) - self['windowMain'].move(10, 10) - self.figure = Figure(figsize=(8, 6), dpi=72) - self.axis = self.figure.add_subplot(111) - - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - self.axis.plot(t, s) - self.axis.set_xlabel('time (s)') - self.axis.set_ylabel('voltage') - - self.canvas = FigureCanvas(self.figure) # a gtk.DrawingArea - self.canvas.show() - self.canvas.set_size_request(600, 400) - self.canvas.set_events( - gtk.gdk.BUTTON_PRESS_MASK | - gtk.gdk.KEY_PRESS_MASK | - gtk.gdk.KEY_RELEASE_MASK - ) - self.canvas.set_flags(gtk.HAS_FOCUS | gtk.CAN_FOCUS) - self.canvas.grab_focus() - - def keypress(widget, event): - print('key press') - - def buttonpress(widget, event): - print('button press') - - self.canvas.connect('key_press_event', keypress) - self.canvas.connect('button_press_event', buttonpress) - - def onselect(xmin, xmax): - print(xmin, xmax) - - span = SpanSelector(self.axis, onselect, 'horizontal', useblit=False, - rectprops=dict(alpha=0.5, facecolor='red')) - - self['vboxMain'].pack_start(self.canvas, True, True) - self['vboxMain'].show() - - # below is optional if you want the navigation toolbar - self.navToolbar = NavigationToolbar(self.canvas, self['windowMain']) - self.navToolbar.lastDir = '/var/tmp/' - self['vboxMain'].pack_start(self.navToolbar) - self.navToolbar.show() - - sep = gtk.HSeparator() - sep.show() - self['vboxMain'].pack_start(sep, True, True) - - self['vboxMain'].reorder_child(self['buttonClickMe'], -1) - - def __getitem__(self, key): - return self.widgets.get_widget(key) - - widgets = WidgetsWrapper() - gtk.main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/mpl_with_glade.txt b/_sources/examples/user_interfaces/mpl_with_glade.txt deleted file mode 100644 index c1c0464d3bf..00000000000 --- a/_sources/examples/user_interfaces/mpl_with_glade.txt +++ /dev/null @@ -1,114 +0,0 @@ -.. _user_interfaces-mpl_with_glade: - -user_interfaces example code: mpl_with_glade.py -=============================================== - -[`source code `_] - -:: - - #!/usr/bin/env python - - from __future__ import print_function - import matplotlib - matplotlib.use('GTK') - - from matplotlib.figure import Figure - from matplotlib.axes import Subplot - from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas - from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar - from matplotlib.widgets import SpanSelector - - from numpy import arange, sin, pi - import gtk - import gtk.glade - - - def simple_msg(msg, parent=None, title=None): - dialog = gtk.MessageDialog( - parent=None, - type=gtk.MESSAGE_INFO, - buttons=gtk.BUTTONS_OK, - message_format=msg) - if parent is not None: - dialog.set_transient_for(parent) - if title is not None: - dialog.set_title(title) - dialog.show() - dialog.run() - dialog.destroy() - return None - - - class GladeHandlers(object): - def on_buttonClickMe_clicked(event): - simple_msg('Nothing to say, really', - parent=widgets['windowMain'], - title='Thanks!') - - - class WidgetsWrapper(object): - def __init__(self): - self.widgets = gtk.glade.XML('mpl_with_glade.glade') - self.widgets.signal_autoconnect(GladeHandlers.__dict__) - - self['windowMain'].connect('destroy', lambda x: gtk.main_quit()) - self['windowMain'].move(10, 10) - self.figure = Figure(figsize=(8, 6), dpi=72) - self.axis = self.figure.add_subplot(111) - - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - self.axis.plot(t, s) - self.axis.set_xlabel('time (s)') - self.axis.set_ylabel('voltage') - - self.canvas = FigureCanvas(self.figure) # a gtk.DrawingArea - self.canvas.show() - self.canvas.set_size_request(600, 400) - self.canvas.set_events( - gtk.gdk.BUTTON_PRESS_MASK | - gtk.gdk.KEY_PRESS_MASK | - gtk.gdk.KEY_RELEASE_MASK - ) - self.canvas.set_flags(gtk.HAS_FOCUS | gtk.CAN_FOCUS) - self.canvas.grab_focus() - - def keypress(widget, event): - print('key press') - - def buttonpress(widget, event): - print('button press') - - self.canvas.connect('key_press_event', keypress) - self.canvas.connect('button_press_event', buttonpress) - - def onselect(xmin, xmax): - print(xmin, xmax) - - span = SpanSelector(self.axis, onselect, 'horizontal', useblit=False, - rectprops=dict(alpha=0.5, facecolor='red')) - - self['vboxMain'].pack_start(self.canvas, True, True) - self['vboxMain'].show() - - # below is optional if you want the navigation toolbar - self.navToolbar = NavigationToolbar(self.canvas, self['windowMain']) - self.navToolbar.lastDir = '/var/tmp/' - self['vboxMain'].pack_start(self.navToolbar) - self.navToolbar.show() - - sep = gtk.HSeparator() - sep.show() - self['vboxMain'].pack_start(sep, True, True) - - self['vboxMain'].reorder_child(self['buttonClickMe'], -1) - - def __getitem__(self, key): - return self.widgets.get_widget(key) - - widgets = WidgetsWrapper() - gtk.main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/mpl_with_glade_316.rst.txt b/_sources/examples/user_interfaces/mpl_with_glade_316.rst.txt deleted file mode 100644 index ff0d616b5f6..00000000000 --- a/_sources/examples/user_interfaces/mpl_with_glade_316.rst.txt +++ /dev/null @@ -1,52 +0,0 @@ -.. _user_interfaces-mpl_with_glade_316: - -user_interfaces example code: mpl_with_glade_316.py -=================================================== - -[`source code `_] - -:: - - from gi.repository import Gtk - - from matplotlib.figure import Figure - from matplotlib.axes import Subplot - from numpy import arange, sin, pi - from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanvas - - - class Window1Signals(object): - def on_window1_destroy(self, widget): - Gtk.main_quit() - - - def main(): - builder = Gtk.Builder() - builder.add_objects_from_file("mpl_with_glade_316.glade", ("window1", "")) - builder.connect_signals(Window1Signals()) - window = builder.get_object("window1") - sw = builder.get_object("scrolledwindow1") - - # Start of Matplotlib specific code - figure = Figure(figsize=(8, 6), dpi=71) - axis = figure.add_subplot(111) - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - axis.plot(t, s) - - axis.set_xlabel('time [s]') - axis.set_ylabel('voltage [V]') - - canvas = FigureCanvas(figure) # a Gtk.DrawingArea - canvas.set_size_request(800, 600) - sw.add_with_viewport(canvas) - # End of Matplotlib specific code - - window.show_all() - Gtk.main() - - if __name__ == "__main__": - main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/mpl_with_glade_316.txt b/_sources/examples/user_interfaces/mpl_with_glade_316.txt deleted file mode 100644 index 5bf5bb490c7..00000000000 --- a/_sources/examples/user_interfaces/mpl_with_glade_316.txt +++ /dev/null @@ -1,54 +0,0 @@ -.. _user_interfaces-mpl_with_glade_316: - -user_interfaces example code: mpl_with_glade_316.py -=================================================== - -[`source code `_] - -:: - - #!/usr/bin/env python3 - - from gi.repository import Gtk - - from matplotlib.figure import Figure - from matplotlib.axes import Subplot - from numpy import arange, sin, pi - from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanvas - - - class Window1Signals(object): - def on_window1_destroy(self, widget): - Gtk.main_quit() - - - def main(): - builder = Gtk.Builder() - builder.add_objects_from_file("mpl_with_glade_316.glade", ("window1", "")) - builder.connect_signals(Window1Signals()) - window = builder.get_object("window1") - sw = builder.get_object("scrolledwindow1") - - # Start of Matplotlib specific code - figure = Figure(figsize=(8, 6), dpi=71) - axis = figure.add_subplot(111) - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - axis.plot(t, s) - - axis.set_xlabel('time [s]') - axis.set_ylabel('voltage [V]') - - canvas = FigureCanvas(figure) # a Gtk.DrawingArea - canvas.set_size_request(800, 600) - sw.add_with_viewport(canvas) - # End of Matplotlib specific code - - window.show_all() - Gtk.main() - - if __name__ == "__main__": - main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/printing_in_wx.txt b/_sources/examples/user_interfaces/printing_in_wx.txt deleted file mode 100644 index 487b5663d07..00000000000 --- a/_sources/examples/user_interfaces/printing_in_wx.txt +++ /dev/null @@ -1,200 +0,0 @@ -.. _user_interfaces-printing_in_wx: - -user_interfaces example code: printing_in_wx.py -=============================================== - -[`source code `_] - -:: - - #!/usr/bin/env python - # printing_in_wx.py - # - - from __future__ import print_function - """ - This examples demonstrates Printing (ie, to a printer) with a - matplotlib figure using a wx Frame. This borrows the data from - embedding_in_wx.py, but with several changes: - Menus for - Save export figure (png,eps,bmp) to file - Copy copy bitmap of figure to the system clipboard - Print Setup setup size of figure for printing - Print Preview preview printer page - Print send figure to a system printer - Exit end application - - where 'figure' means an image of the matplotlib canvas - - In addition, "Ctrl-C" is bound to Copy-figure-to-clipboard - - - This is a very simple use of matplotlib, and mostly focused on - demonstrating the interaction between wxPython and the matplotlib - figure canvas. - - Matt Newville - last modified: 12-Nov-2004 - license: use it any way you want - """ - - import wx - import os - import matplotlib - - # either WX or WXAgg can be used here. - # matplotlib.use('WX') - # from matplotlib.backends.backend_wxagg import FigureCanvasWx as FigCanvas - - matplotlib.use('WXAgg') - from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigCanvas - - from matplotlib.figure import Figure - import numpy - - class PlotFrame(wx.Frame): - help_msg=""" Menus for - Save export figure (png,eps,bmp) to file - Copy copy bitmap of figure to the system clipboard - Print Setup setup size of figure for printing - Print Preview preview printer page - Print send figure to a system printer - Exit end application - - where 'figure' means an image of the matplotlib canvas - - In addition, "Ctrl-C" is bound to copy-figure-to-clipboard - """ - - start_msg = """ Use Menus to test printing - or Ctrl-C to copy plot image to clipboard """ - - about_msg = """ printing_in_wx version 0.1 12-Nov-2004 - Matt Newville """ - - def __init__(self): - wx.Frame.__init__(self, None, -1, "Test Printing with WX Backend") - self.fig = Figure((5.0,3.0), 100) - self.canvas= FigCanvas(self, -1, self.fig) - self.axes = self.fig.add_axes([0.15,0.15,0.75,0.75]) - - - sizer = wx.BoxSizer(wx.VERTICAL) - sizer.Add(self.canvas, 1, wx.LEFT|wx.TOP|wx.GROW) - sizer.Add(wx.StaticText(self,-1, self.start_msg), 0, - wx.ALIGN_LEFT|wx.TOP) - - self.canvas.Bind(wx.EVT_KEY_DOWN, self.onKeyEvent) - - self.SetSizer(sizer) - self.Fit() - self.Build_Menus() - self.Plot_Data() - - def Build_Menus(self): - """ build menus """ - MENU_EXIT = wx.NewId() - MENU_SAVE = wx.NewId() - MENU_PRINT = wx.NewId() - MENU_PSETUP= wx.NewId() - MENU_PREVIEW=wx.NewId() - MENU_CLIPB =wx.NewId() - MENU_HELP =wx.NewId() - - menuBar = wx.MenuBar() - - f0 = wx.Menu() - f0.Append(MENU_SAVE, "&Export", "Save Image of Plot") - f0.AppendSeparator() - f0.Append(MENU_PSETUP, "Page Setup...", "Printer Setup") - f0.Append(MENU_PREVIEW,"Print Preview...", "Print Preview") - f0.Append(MENU_PRINT, "&Print", "Print Plot") - f0.AppendSeparator() - f0.Append(MENU_EXIT, "E&xit", "Exit") - menuBar.Append(f0, "&File"); - - f1 = wx.Menu() - f1.Append(MENU_HELP, "Quick Reference", "Quick Reference") - - menuBar.Append(f1, "&Help"); - - self.SetMenuBar(menuBar) - - self.Bind(wx.EVT_MENU, self.onPrint, id=MENU_PRINT) - self.Bind(wx.EVT_MENU, self.onPrinterSetup, id=MENU_PSETUP) - self.Bind(wx.EVT_MENU, self.onPrinterPreview, id=MENU_PREVIEW) - self.Bind(wx.EVT_MENU, self.onClipboard, id=MENU_CLIPB) - self.Bind(wx.EVT_MENU, self.onExport, id=MENU_SAVE) - self.Bind(wx.EVT_MENU, self.onExit , id=MENU_EXIT) - self.Bind(wx.EVT_MENU, self.onHelp, id=MENU_HELP) - - # the printer / clipboard methods are implemented - # in backend_wx, and so are very simple to use. - def onPrinterSetup(self,event=None): - self.canvas.Printer_Setup(event=event) - - def onPrinterPreview(self,event=None): - self.canvas.Printer_Preview(event=event) - - def onPrint(self,event=None): - self.canvas.Printer_Print(event=event) - - def onClipboard(self,event=None): - self.canvas.Copy_to_Clipboard(event=event) - - - def onKeyEvent(self,event=None): - """ capture , act upon keystroke events""" - if event == None: return - key = event.KeyCode() - if (key < wx.WXK_SPACE or key > 255): return - - if (event.ControlDown() and chr(key)=='C'): # Ctrl-C - self.onClipboard(event=event) - - def onHelp(self, event=None): - dlg = wx.MessageDialog(self, self.help_msg, - "Quick Reference", - wx.OK | wx.ICON_INFORMATION) - dlg.ShowModal() - dlg.Destroy() - - def onExport(self,event=None): - """ save figure image to file""" - file_choices = "PNG (*.png)|*.png|" \ - "PS (*.ps)|*.ps|" \ - "EPS (*.eps)|*.eps|" \ - "BMP (*.bmp)|*.bmp" - - thisdir = os.getcwd() - - dlg = wx.FileDialog(self, message='Save Plot Figure as...', - defaultDir = thisdir, defaultFile='plot.png', - wildcard=file_choices, style=wx.SAVE) - - if dlg.ShowModal() == wx.ID_OK: - path = dlg.GetPath() - self.canvas.print_figure(path,dpi=300) - if (path.find(thisdir) == 0): - path = path[len(thisdir)+1:] - print('Saved plot to %s' % path) - - def onExit(self,event=None): - self.Destroy() - - def Plot_Data(self): - t = numpy.arange(0.0,5.0,0.01) - s = numpy.sin(2.0*numpy.pi*t) - c = numpy.cos(0.4*numpy.pi*t) - self.axes.plot(t,s) - self.axes.plot(t,c) - - - if __name__ == '__main__': - app = wx.PySimpleApp() - fig = PlotFrame() - fig.Show(True) - app.MainLoop() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/pylab_with_gtk.rst.txt b/_sources/examples/user_interfaces/pylab_with_gtk.rst.txt deleted file mode 100644 index c02cc6fd3c9..00000000000 --- a/_sources/examples/user_interfaces/pylab_with_gtk.rst.txt +++ /dev/null @@ -1,71 +0,0 @@ -.. _user_interfaces-pylab_with_gtk: - -user_interfaces example code: pylab_with_gtk.py -=============================================== - -[`source code `_] - -:: - - """ - An example of how to use pylab to manage your figure windows, but - modify the GUI by accessing the underlying gtk widgets - """ - from __future__ import print_function - import matplotlib - matplotlib.use('GTKAgg') - import matplotlib.pyplot as plt - - - fig, ax = plt.subplots() - plt.plot([1, 2, 3], 'ro-', label='easy as 1 2 3') - plt.plot([1, 4, 9], 'gs--', label='easy as 1 2 3 squared') - plt.legend() - - - manager = plt.get_current_fig_manager() - # you can also access the window or vbox attributes this way - toolbar = manager.toolbar - - # now let's add a button to the toolbar - import gtk - next = 8 # where to insert this in the mpl toolbar - button = gtk.Button('Click me') - button.show() - - - def clicked(button): - print('hi mom') - button.connect('clicked', clicked) - - toolitem = gtk.ToolItem() - toolitem.show() - toolitem.set_tooltip( - toolbar.tooltips, - 'Click me for fun and profit') - - toolitem.add(button) - toolbar.insert(toolitem, next) - next += 1 - - # now let's add a widget to the vbox - label = gtk.Label() - label.set_markup('Drag mouse over axes for position') - label.show() - vbox = manager.vbox - vbox.pack_start(label, False, False) - vbox.reorder_child(manager.toolbar, -1) - - - def update(event): - if event.xdata is None: - label.set_markup('Drag mouse over axes for position') - else: - label.set_markup('x,y=(%f, %f)' % (event.xdata, event.ydata)) - - plt.connect('motion_notify_event', update) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/pylab_with_gtk.txt b/_sources/examples/user_interfaces/pylab_with_gtk.txt deleted file mode 100644 index c02cc6fd3c9..00000000000 --- a/_sources/examples/user_interfaces/pylab_with_gtk.txt +++ /dev/null @@ -1,71 +0,0 @@ -.. _user_interfaces-pylab_with_gtk: - -user_interfaces example code: pylab_with_gtk.py -=============================================== - -[`source code `_] - -:: - - """ - An example of how to use pylab to manage your figure windows, but - modify the GUI by accessing the underlying gtk widgets - """ - from __future__ import print_function - import matplotlib - matplotlib.use('GTKAgg') - import matplotlib.pyplot as plt - - - fig, ax = plt.subplots() - plt.plot([1, 2, 3], 'ro-', label='easy as 1 2 3') - plt.plot([1, 4, 9], 'gs--', label='easy as 1 2 3 squared') - plt.legend() - - - manager = plt.get_current_fig_manager() - # you can also access the window or vbox attributes this way - toolbar = manager.toolbar - - # now let's add a button to the toolbar - import gtk - next = 8 # where to insert this in the mpl toolbar - button = gtk.Button('Click me') - button.show() - - - def clicked(button): - print('hi mom') - button.connect('clicked', clicked) - - toolitem = gtk.ToolItem() - toolitem.show() - toolitem.set_tooltip( - toolbar.tooltips, - 'Click me for fun and profit') - - toolitem.add(button) - toolbar.insert(toolitem, next) - next += 1 - - # now let's add a widget to the vbox - label = gtk.Label() - label.set_markup('Drag mouse over axes for position') - label.show() - vbox = manager.vbox - vbox.pack_start(label, False, False) - vbox.reorder_child(manager.toolbar, -1) - - - def update(event): - if event.xdata is None: - label.set_markup('Drag mouse over axes for position') - else: - label.set_markup('x,y=(%f, %f)' % (event.xdata, event.ydata)) - - plt.connect('motion_notify_event', update) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/rec_edit_gtk_custom.rst.txt b/_sources/examples/user_interfaces/rec_edit_gtk_custom.rst.txt deleted file mode 100644 index 6c13907ada5..00000000000 --- a/_sources/examples/user_interfaces/rec_edit_gtk_custom.rst.txt +++ /dev/null @@ -1,54 +0,0 @@ -.. _user_interfaces-rec_edit_gtk_custom: - -user_interfaces example code: rec_edit_gtk_custom.py -==================================================== - -[`source code `_] - -:: - - """ - generate an editable gtk treeview widget for record arrays with custom - formatting of the cells and show how to limit string entries to a list - of strings - """ - from __future__ import print_function - import gtk - import numpy as np - import matplotlib.mlab as mlab - import matplotlib.cbook as cbook - import mpl_toolkits.gtktools as gtktools - - - datafile = cbook.get_sample_data('demodata.csv', asfileobj=False) - r = mlab.csv2rec(datafile, converterd={'weekdays': str}) - - - formatd = mlab.get_formatd(r) - formatd['date'] = mlab.FormatDate('%Y-%m-%d') - formatd['prices'] = mlab.FormatMillions(precision=1) - formatd['gain'] = mlab.FormatPercent(precision=2) - - # use a drop down combo for weekdays - stringd = dict(weekdays=['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']) - constant = ['clientid'] # block editing of this field - - - liststore = gtktools.RecListStore(r, formatd=formatd, stringd=stringd) - treeview = gtktools.RecTreeView(liststore, constant=constant) - - - def mycallback(liststore, rownum, colname, oldval, newval): - print('verify: old=%s, new=%s, rec=%s' % (oldval, newval, liststore.r[rownum][colname])) - - liststore.callbacks.connect('cell_changed', mycallback) - - win = gtk.Window() - win.set_title('click to edit') - win.add(treeview) - win.show_all() - win.connect('delete-event', lambda *args: gtk.main_quit()) - gtk.main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/rec_edit_gtk_custom.txt b/_sources/examples/user_interfaces/rec_edit_gtk_custom.txt deleted file mode 100644 index 6c13907ada5..00000000000 --- a/_sources/examples/user_interfaces/rec_edit_gtk_custom.txt +++ /dev/null @@ -1,54 +0,0 @@ -.. _user_interfaces-rec_edit_gtk_custom: - -user_interfaces example code: rec_edit_gtk_custom.py -==================================================== - -[`source code `_] - -:: - - """ - generate an editable gtk treeview widget for record arrays with custom - formatting of the cells and show how to limit string entries to a list - of strings - """ - from __future__ import print_function - import gtk - import numpy as np - import matplotlib.mlab as mlab - import matplotlib.cbook as cbook - import mpl_toolkits.gtktools as gtktools - - - datafile = cbook.get_sample_data('demodata.csv', asfileobj=False) - r = mlab.csv2rec(datafile, converterd={'weekdays': str}) - - - formatd = mlab.get_formatd(r) - formatd['date'] = mlab.FormatDate('%Y-%m-%d') - formatd['prices'] = mlab.FormatMillions(precision=1) - formatd['gain'] = mlab.FormatPercent(precision=2) - - # use a drop down combo for weekdays - stringd = dict(weekdays=['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']) - constant = ['clientid'] # block editing of this field - - - liststore = gtktools.RecListStore(r, formatd=formatd, stringd=stringd) - treeview = gtktools.RecTreeView(liststore, constant=constant) - - - def mycallback(liststore, rownum, colname, oldval, newval): - print('verify: old=%s, new=%s, rec=%s' % (oldval, newval, liststore.r[rownum][colname])) - - liststore.callbacks.connect('cell_changed', mycallback) - - win = gtk.Window() - win.set_title('click to edit') - win.add(treeview) - win.show_all() - win.connect('delete-event', lambda *args: gtk.main_quit()) - gtk.main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/rec_edit_gtk_simple.rst.txt b/_sources/examples/user_interfaces/rec_edit_gtk_simple.rst.txt deleted file mode 100644 index e6fdb723dbf..00000000000 --- a/_sources/examples/user_interfaces/rec_edit_gtk_simple.rst.txt +++ /dev/null @@ -1,29 +0,0 @@ -.. _user_interfaces-rec_edit_gtk_simple: - -user_interfaces example code: rec_edit_gtk_simple.py -==================================================== - -[`source code `_] - -:: - - """ - Load a CSV file into a record array and edit it in a gtk treeview - """ - - import gtk - import numpy as np - import matplotlib.mlab as mlab - import matplotlib.cbook as cbook - import mpl_toolkits.gtktools as gtktools - - datafile = cbook.get_sample_data('demodata.csv', asfileobj=False) - r = mlab.csv2rec(datafile, converterd={'weekdays': str}) - - liststore, treeview, win = gtktools.edit_recarray(r) - win.set_title('click to edit') - win.connect('delete-event', lambda *args: gtk.main_quit()) - gtk.main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/rec_edit_gtk_simple.txt b/_sources/examples/user_interfaces/rec_edit_gtk_simple.txt deleted file mode 100644 index e6fdb723dbf..00000000000 --- a/_sources/examples/user_interfaces/rec_edit_gtk_simple.txt +++ /dev/null @@ -1,29 +0,0 @@ -.. _user_interfaces-rec_edit_gtk_simple: - -user_interfaces example code: rec_edit_gtk_simple.py -==================================================== - -[`source code `_] - -:: - - """ - Load a CSV file into a record array and edit it in a gtk treeview - """ - - import gtk - import numpy as np - import matplotlib.mlab as mlab - import matplotlib.cbook as cbook - import mpl_toolkits.gtktools as gtktools - - datafile = cbook.get_sample_data('demodata.csv', asfileobj=False) - r = mlab.csv2rec(datafile, converterd={'weekdays': str}) - - liststore, treeview, win = gtktools.edit_recarray(r) - win.set_title('click to edit') - win.connect('delete-event', lambda *args: gtk.main_quit()) - gtk.main() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/svg_histogram.rst.txt b/_sources/examples/user_interfaces/svg_histogram.rst.txt deleted file mode 100644 index 856505af144..00000000000 --- a/_sources/examples/user_interfaces/svg_histogram.rst.txt +++ /dev/null @@ -1,165 +0,0 @@ -.. _user_interfaces-svg_histogram: - -user_interfaces example code: svg_histogram.py -============================================== - -[`source code `_] - -:: - - """ - Demonstrate how to create an interactive histogram, in which bars - are hidden or shown by clicking on legend markers. - - The interactivity is encoded in ecmascript (javascript) and inserted in - the SVG code in a post-processing step. To render the image, open it in - a web browser. SVG is supported in most web browsers used by Linux and - OSX users. Windows IE9 supports SVG, but earlier versions do not. - - Notes - ----- - The matplotlib backend lets us assign ids to each object. This is the - mechanism used here to relate matplotlib objects created in python and - the corresponding SVG constructs that are parsed in the second step. - While flexible, ids are cumbersome to use for large collection of - objects. Two mechanisms could be used to simplify things: - * systematic grouping of objects into SVG tags, - * assigning classes to each SVG object according to its origin. - - For example, instead of modifying the properties of each individual bar, - the bars from the `hist` function could either be grouped in - a PatchCollection, or be assigned a class="hist_##" attribute. - - CSS could also be used more extensively to replace repetitive markup - throughout the generated SVG. - - Author: david.huard@gmail.com - - """ - - - import numpy as np - import matplotlib.pyplot as plt - import xml.etree.ElementTree as ET - from io import BytesIO - import json - - - plt.rcParams['svg.fonttype'] = 'none' - - # Apparently, this `register_namespace` method works only with - # python 2.7 and up and is necessary to avoid garbling the XML name - # space with ns0. - ET.register_namespace("", "http://www.w3.org/2000/svg") - - - # --- Create histogram, legend and title --- - plt.figure() - r = np.random.randn(100) - r1 = r + 1 - labels = ['Rabbits', 'Frogs'] - H = plt.hist([r, r1], label=labels) - containers = H[-1] - leg = plt.legend(frameon=False) - plt.title("From a web browser, click on the legend\n" - "marker to toggle the corresponding histogram.") - - - # --- Add ids to the svg objects we'll modify - - hist_patches = {} - for ic, c in enumerate(containers): - hist_patches['hist_%d' % ic] = [] - for il, element in enumerate(c): - element.set_gid('hist_%d_patch_%d' % (ic, il)) - hist_patches['hist_%d' % ic].append('hist_%d_patch_%d' % (ic, il)) - - # Set ids for the legend patches - for i, t in enumerate(leg.get_patches()): - t.set_gid('leg_patch_%d' % i) - - # Set ids for the text patches - for i, t in enumerate(leg.get_texts()): - t.set_gid('leg_text_%d' % i) - - # Save SVG in a fake file object. - f = BytesIO() - plt.savefig(f, format="svg") - - # Create XML tree from the SVG file. - tree, xmlid = ET.XMLID(f.getvalue()) - - - # --- Add interactivity --- - - # Add attributes to the patch objects. - for i, t in enumerate(leg.get_patches()): - el = xmlid['leg_patch_%d' % i] - el.set('cursor', 'pointer') - el.set('onclick', "toggle_hist(this)") - - # Add attributes to the text objects. - for i, t in enumerate(leg.get_texts()): - el = xmlid['leg_text_%d' % i] - el.set('cursor', 'pointer') - el.set('onclick', "toggle_hist(this)") - - # Create script defining the function `toggle_hist`. - # We create a global variable `container` that stores the patches id - # belonging to each histogram. Then a function "toggle_element" sets the - # visibility attribute of all patches of each histogram and the opacity - # of the marker itself. - - script = """ - - """ % json.dumps(hist_patches) - - # Add a transition effect - css = tree.getchildren()[0][0] - css.text = css.text + "g {-webkit-transition:opacity 0.4s ease-out;" + \ - "-moz-transition:opacity 0.4s ease-out;}" - - # Insert the script and save to file. - tree.insert(0, ET.XML(script)) - - ET.ElementTree(tree).write("svg_histogram.svg") - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/svg_histogram.txt b/_sources/examples/user_interfaces/svg_histogram.txt deleted file mode 100644 index bbc5ee27db2..00000000000 --- a/_sources/examples/user_interfaces/svg_histogram.txt +++ /dev/null @@ -1,167 +0,0 @@ -.. _user_interfaces-svg_histogram: - -user_interfaces example code: svg_histogram.py -============================================== - -[`source code `_] - -:: - - #!/usr/bin/env python - #-*- encoding:utf-8 -*- - - """ - Demonstrate how to create an interactive histogram, in which bars - are hidden or shown by cliking on legend markers. - - The interactivity is encoded in ecmascript (javascript) and inserted in - the SVG code in a post-processing step. To render the image, open it in - a web browser. SVG is supported in most web browsers used by Linux and - OSX users. Windows IE9 supports SVG, but earlier versions do not. - - Notes - ----- - The matplotlib backend lets us assign ids to each object. This is the - mechanism used here to relate matplotlib objects created in python and - the corresponding SVG constructs that are parsed in the second step. - While flexible, ids are cumbersome to use for large collection of - objects. Two mechanisms could be used to simplify things: - * systematic grouping of objects into SVG tags, - * assingning classes to each SVG object according to its origin. - - For example, instead of modifying the properties of each individual bar, - the bars from the `hist` function could either be grouped in - a PatchCollection, or be assigned a class="hist_##" attribute. - - CSS could also be used more extensively to replace repetitive markup - troughout the generated SVG. - - __author__="david.huard@gmail.com" - - """ - - - import numpy as np - import matplotlib.pyplot as plt - import xml.etree.ElementTree as ET - from io import BytesIO - import json - - plt.rcParams['svg.embed_char_paths'] = 'none' - - # Apparently, this `register_namespace` method works only with - # python 2.7 and up and is necessary to avoid garbling the XML name - # space with ns0. - ET.register_namespace("", "http://www.w3.org/2000/svg") - - - # --- Create histogram, legend and title --- - plt.figure() - r = np.random.randn(100) - r1 = r + 1 - labels = ['Rabbits', 'Frogs'] - H = plt.hist([r, r1], label=labels) - containers = H[-1] - leg = plt.legend(frameon=False) - plt.title("From a web browser, click on the legend\n" - "marker to toggle the corresponding histogram.") - - - # --- Add ids to the svg objects we'll modify - - hist_patches = {} - for ic, c in enumerate(containers): - hist_patches['hist_%d' % ic] = [] - for il, element in enumerate(c): - element.set_gid('hist_%d_patch_%d' % (ic, il)) - hist_patches['hist_%d' % ic].append('hist_%d_patch_%d' % (ic, il)) - - # Set ids for the legend patches - for i, t in enumerate(leg.get_patches()): - t.set_gid('leg_patch_%d' % i) - - # Set ids for the text patches - for i, t in enumerate(leg.get_texts()): - t.set_gid('leg_text_%d' % i) - - # Save SVG in a fake file object. - f = BytesIO() - plt.savefig(f, format="svg") - - # Create XML tree from the SVG file. - tree, xmlid = ET.XMLID(f.getvalue()) - - - # --- Add interactivity --- - - # Add attributes to the patch objects. - for i, t in enumerate(leg.get_patches()): - el = xmlid['leg_patch_%d' % i] - el.set('cursor', 'pointer') - el.set('onclick', "toggle_hist(this)") - - # Add attributes to the text objects. - for i, t in enumerate(leg.get_texts()): - el = xmlid['leg_text_%d' % i] - el.set('cursor', 'pointer') - el.set('onclick', "toggle_hist(this)") - - # Create script defining the function `toggle_hist`. - # We create a global variable `container` that stores the patches id - # belonging to each histogram. Then a function "toggle_element" sets the - # visibility attribute of all patches of each histogram and the opacity - # of the marker itself. - - script = """ - - """ % json.dumps(hist_patches) - - # Add a transition effect - css = tree.getchildren()[0][0] - css.text = css.text + "g {-webkit-transition:opacity 0.4s ease-out;" + \ - "-moz-transition:opacity 0.4s ease-out;}" - - # Insert the script and save to file. - tree.insert(0, ET.XML(script)) - - ET.ElementTree(tree).write("svg_histogram.svg") - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/svg_tooltip.rst.txt b/_sources/examples/user_interfaces/svg_tooltip.rst.txt deleted file mode 100644 index e1b4bbcf997..00000000000 --- a/_sources/examples/user_interfaces/svg_tooltip.rst.txt +++ /dev/null @@ -1,119 +0,0 @@ -.. _user_interfaces-svg_tooltip: - -user_interfaces example code: svg_tooltip.py -============================================ - -[`source code `_] - -:: - - """ - SVG tooltip example - =================== - - This example shows how to create a tooltip that will show up when - hovering over a matplotlib patch. - - Although it is possible to create the tooltip from CSS or javascript, - here we create it in matplotlib and simply toggle its visibility on - when hovering over the patch. This approach provides total control over - the tooltip placement and appearance, at the expense of more code up - front. - - The alternative approach would be to put the tooltip content in `title` - attributes of SVG objects. Then, using an existing js/CSS library, it - would be relatively straightforward to create the tooltip in the - browser. The content would be dictated by the `title` attribute, and - the appearance by the CSS. - - - :author: David Huard - """ - - - import matplotlib.pyplot as plt - import xml.etree.ElementTree as ET - from io import BytesIO - - ET.register_namespace("", "http://www.w3.org/2000/svg") - - fig, ax = plt.subplots() - - # Create patches to which tooltips will be assigned. - rect1 = plt.Rectangle((10, -20), 10, 5, fc='blue') - rect2 = plt.Rectangle((-20, 15), 10, 5, fc='green') - - shapes = [rect1, rect2] - labels = ['This is a blue rectangle.', 'This is a green rectangle'] - - for i, (item, label) in enumerate(zip(shapes, labels)): - patch = ax.add_patch(item) - annotate = ax.annotate(labels[i], xy=item.get_xy(), xytext=(0, 0), - textcoords='offset points', color='w', ha='center', - fontsize=8, bbox=dict(boxstyle='round, pad=.5', - fc=(.1, .1, .1, .92), - ec=(1., 1., 1.), lw=1, - zorder=1)) - - ax.add_patch(patch) - patch.set_gid('mypatch_{:03d}'.format(i)) - annotate.set_gid('mytooltip_{:03d}'.format(i)) - - # Save the figure in a fake file object - ax.set_xlim(-30, 30) - ax.set_ylim(-30, 30) - ax.set_aspect('equal') - - f = BytesIO() - plt.savefig(f, format="svg") - - # --- Add interactivity --- - - # Create XML tree from the SVG file. - tree, xmlid = ET.XMLID(f.getvalue()) - tree.set('onload', 'init(evt)') - - for i in shapes: - # Get the index of the shape - index = shapes.index(i) - # Hide the tooltips - tooltip = xmlid['mytooltip_{:03d}'.format(index)] - tooltip.set('visibility', 'hidden') - # Assign onmouseover and onmouseout callbacks to patches. - mypatch = xmlid['mypatch_{:03d}'.format(index)] - mypatch.set('onmouseover', "ShowTooltip(this)") - mypatch.set('onmouseout', "HideTooltip(this)") - - # This is the script defining the ShowTooltip and HideTooltip functions. - script = """ - - """ - - # Insert the script at the top of the file and save it. - tree.insert(0, ET.XML(script)) - ET.ElementTree(tree).write('svg_tooltip.svg') - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/svg_tooltip.txt b/_sources/examples/user_interfaces/svg_tooltip.txt deleted file mode 100644 index 3d66d5767c5..00000000000 --- a/_sources/examples/user_interfaces/svg_tooltip.txt +++ /dev/null @@ -1,137 +0,0 @@ -.. _user_interfaces-svg_tooltip: - -user_interfaces example code: svg_tooltip.py -============================================ - -[`source code `_] - -:: - - """ - SVG tooltip example - =================== - - This example shows how to create a tooltip that will show up when - hovering over a matplotlib patch. - - Although it is possible to create the tooltip from CSS or javascript, - here we create it in matplotlib and simply toggle its visibility on - when hovering over the patch. This approach provides total control over - the tooltip placement and appearance, at the expense of more code up - front. - - The alternative approach would be to put the tooltip content in `title` - atttributes of SVG objects. Then, using an existing js/CSS library, it - would be relatively straightforward to create the tooltip in the - browser. The content would be dictated by the `title` attribute, and - the appearance by the CSS. - - - :author: David Huard - """ - - - import matplotlib.pyplot as plt - import xml.etree.ElementTree as ET - from io import BytesIO - - ET.register_namespace("", "http://www.w3.org/2000/svg") - - fig, ax = plt.subplots() - - # Create patches to which tooltips will be assigned. - circle = plt.Circle((0, 0), 5, fc='blue') - rect = plt.Rectangle((-5, 10), 10, 5, fc='green') - - ax.add_patch(circle) - ax.add_patch(rect) - - # Create the tooltips - circle_tip = ax.annotate( - 'This is a blue circle.', - xy=(0, 0), - xytext=(30, -30), - textcoords='offset points', - color='w', - ha='left', - bbox=dict(boxstyle='round,pad=.5', fc=(.1, .1, .1, .92), - ec=(1., 1., 1.), lw=1, zorder=1)) - - rect_tip = ax.annotate( - 'This is a green rectangle.', - xy=(-5, 10), - xytext=(30, 40), - textcoords='offset points', - color='w', - ha='left', - bbox=dict(boxstyle='round,pad=.5', fc=(.1, .1, .1, .92), - ec=(1., 1., 1.), lw=1, zorder=1)) - - # Set id for the patches - for i, t in enumerate(ax.patches): - t.set_gid('patch_%d' % i) - - # Set id for the annotations - for i, t in enumerate(ax.texts): - t.set_gid('tooltip_%d' % i) - - - # Save the figure in a fake file object - ax.set_xlim(-30, 30) - ax.set_ylim(-30, 30) - ax.set_aspect('equal') - - f = BytesIO() - plt.savefig(f, format="svg") - - # --- Add interactivity --- - - # Create XML tree from the SVG file. - tree, xmlid = ET.XMLID(f.getvalue()) - tree.set('onload', 'init(evt)') - - # Hide the tooltips - for i, t in enumerate(ax.texts): - el = xmlid['tooltip_%d' % i] - el.set('visibility', 'hidden') - - # Assign onmouseover and onmouseout callbacks to patches. - for i, t in enumerate(ax.patches): - el = xmlid['patch_%d' % i] - el.set('onmouseover', "ShowTooltip(this)") - el.set('onmouseout', "HideTooltip(this)") - - # This is the script defining the ShowTooltip and HideTooltip functions. - script = """ - - """ - - # Insert the script at the top of the file and save it. - tree.insert(0, ET.XML(script)) - ET.ElementTree(tree).write('svg_tooltip.svg') - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/toolmanager.rst.txt b/_sources/examples/user_interfaces/toolmanager.rst.txt deleted file mode 100644 index 6c2654c4a1d..00000000000 --- a/_sources/examples/user_interfaces/toolmanager.rst.txt +++ /dev/null @@ -1,104 +0,0 @@ -.. _user_interfaces-toolmanager: - -user_interfaces example code: toolmanager.py -============================================ - -[`source code `_] - -:: - - '''This example demonstrates how to: - * Modify the Toolbar - * Create tools - * Add tools - * Remove tools - Using `matplotlib.backend_managers.ToolManager` - ''' - - - from __future__ import print_function - import matplotlib - matplotlib.use('GTK3Cairo') - matplotlib.rcParams['toolbar'] = 'toolmanager' - import matplotlib.pyplot as plt - from matplotlib.backend_tools import ToolBase, ToolToggleBase - from gi.repository import Gtk, Gdk - - - class ListTools(ToolBase): - '''List all the tools controlled by the `ToolManager`''' - # keyboard shortcut - default_keymap = 'm' - description = 'List Tools' - - def trigger(self, *args, **kwargs): - print('_' * 80) - print("{0:12} {1:45} {2}".format('Name (id)', - 'Tool description', - 'Keymap')) - print('-' * 80) - tools = self.toolmanager.tools - for name in sorted(tools.keys()): - if not tools[name].description: - continue - keys = ', '.join(sorted(self.toolmanager.get_tool_keymap(name))) - print("{0:12} {1:45} {2}".format(name, - tools[name].description, - keys)) - print('_' * 80) - print("Active Toggle tools") - print("{0:12} {1:45}".format("Group", "Active")) - print('-' * 80) - for group, active in self.toolmanager.active_toggle.items(): - print("{0:12} {1:45}".format(group, active)) - - - class GroupHideTool(ToolToggleBase): - '''Hide lines with a given gid''' - default_keymap = 'G' - description = 'Hide by gid' - - def __init__(self, *args, **kwargs): - self.gid = kwargs.pop('gid') - ToolToggleBase.__init__(self, *args, **kwargs) - - def enable(self, *args): - self.set_lines_visibility(False) - - def disable(self, *args): - self.set_lines_visibility(True) - - def set_lines_visibility(self, state): - gr_lines = [] - for ax in self.figure.get_axes(): - for line in ax.get_lines(): - if line.get_gid() == self.gid: - line.set_visible(state) - self.figure.canvas.draw() - - - fig = plt.figure() - plt.plot([1, 2, 3], gid='mygroup') - plt.plot([2, 3, 4], gid='unknown') - plt.plot([3, 2, 1], gid='mygroup') - - # Add the custom tools that we created - fig.canvas.manager.toolmanager.add_tool('List', ListTools) - fig.canvas.manager.toolmanager.add_tool('Hide', GroupHideTool, gid='mygroup') - - - # Add an existing tool to new group `foo`. - # It can be added as many times as we want - fig.canvas.manager.toolbar.add_tool('zoom', 'foo') - - # Remove the forward button - fig.canvas.manager.toolmanager.remove_tool('forward') - - # To add a custom tool to the toolbar at specific location inside - # the navigation group - fig.canvas.manager.toolbar.add_tool('Hide', 'navigation', 1) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/toolmanager.txt b/_sources/examples/user_interfaces/toolmanager.txt deleted file mode 100644 index 6c2654c4a1d..00000000000 --- a/_sources/examples/user_interfaces/toolmanager.txt +++ /dev/null @@ -1,104 +0,0 @@ -.. _user_interfaces-toolmanager: - -user_interfaces example code: toolmanager.py -============================================ - -[`source code `_] - -:: - - '''This example demonstrates how to: - * Modify the Toolbar - * Create tools - * Add tools - * Remove tools - Using `matplotlib.backend_managers.ToolManager` - ''' - - - from __future__ import print_function - import matplotlib - matplotlib.use('GTK3Cairo') - matplotlib.rcParams['toolbar'] = 'toolmanager' - import matplotlib.pyplot as plt - from matplotlib.backend_tools import ToolBase, ToolToggleBase - from gi.repository import Gtk, Gdk - - - class ListTools(ToolBase): - '''List all the tools controlled by the `ToolManager`''' - # keyboard shortcut - default_keymap = 'm' - description = 'List Tools' - - def trigger(self, *args, **kwargs): - print('_' * 80) - print("{0:12} {1:45} {2}".format('Name (id)', - 'Tool description', - 'Keymap')) - print('-' * 80) - tools = self.toolmanager.tools - for name in sorted(tools.keys()): - if not tools[name].description: - continue - keys = ', '.join(sorted(self.toolmanager.get_tool_keymap(name))) - print("{0:12} {1:45} {2}".format(name, - tools[name].description, - keys)) - print('_' * 80) - print("Active Toggle tools") - print("{0:12} {1:45}".format("Group", "Active")) - print('-' * 80) - for group, active in self.toolmanager.active_toggle.items(): - print("{0:12} {1:45}".format(group, active)) - - - class GroupHideTool(ToolToggleBase): - '''Hide lines with a given gid''' - default_keymap = 'G' - description = 'Hide by gid' - - def __init__(self, *args, **kwargs): - self.gid = kwargs.pop('gid') - ToolToggleBase.__init__(self, *args, **kwargs) - - def enable(self, *args): - self.set_lines_visibility(False) - - def disable(self, *args): - self.set_lines_visibility(True) - - def set_lines_visibility(self, state): - gr_lines = [] - for ax in self.figure.get_axes(): - for line in ax.get_lines(): - if line.get_gid() == self.gid: - line.set_visible(state) - self.figure.canvas.draw() - - - fig = plt.figure() - plt.plot([1, 2, 3], gid='mygroup') - plt.plot([2, 3, 4], gid='unknown') - plt.plot([3, 2, 1], gid='mygroup') - - # Add the custom tools that we created - fig.canvas.manager.toolmanager.add_tool('List', ListTools) - fig.canvas.manager.toolmanager.add_tool('Hide', GroupHideTool, gid='mygroup') - - - # Add an existing tool to new group `foo`. - # It can be added as many times as we want - fig.canvas.manager.toolbar.add_tool('zoom', 'foo') - - # Remove the forward button - fig.canvas.manager.toolmanager.remove_tool('forward') - - # To add a custom tool to the toolbar at specific location inside - # the navigation group - fig.canvas.manager.toolbar.add_tool('Hide', 'navigation', 1) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/wxcursor_demo.rst.txt b/_sources/examples/user_interfaces/wxcursor_demo.rst.txt deleted file mode 100644 index ce53259f289..00000000000 --- a/_sources/examples/user_interfaces/wxcursor_demo.rst.txt +++ /dev/null @@ -1,87 +0,0 @@ -.. _user_interfaces-wxcursor_demo: - -user_interfaces example code: wxcursor_demo.py -============================================== - -[`source code `_] - -:: - - """ - Example to draw a cursor and report the data coords in wx - """ - # matplotlib requires wxPython 2.8+ - # set the wxPython version in lib\site-packages\wx.pth file - # or if you have wxversion installed un-comment the lines below - #import wxversion - #wxversion.ensureMinimal('2.8') - - import matplotlib - matplotlib.use('WXAgg') - - from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas - from matplotlib.backends.backend_wx import NavigationToolbar2Wx, wxc - from matplotlib.figure import Figure - from numpy import arange, sin, pi - - import wx - - - class CanvasFrame(wx.Frame): - def __init__(self, ): - wx.Frame.__init__(self, None, -1, - 'CanvasFrame', size=(550, 350)) - - self.SetBackgroundColour(wxc.NamedColour("WHITE")) - - self.figure = Figure() - self.axes = self.figure.add_subplot(111) - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - - self.axes.plot(t, s) - self.axes.set_xlabel('t') - self.axes.set_ylabel('sin(t)') - self.figure_canvas = FigureCanvas(self, -1, self.figure) - - # Note that event is a MplEvent - self.figure_canvas.mpl_connect('motion_notify_event', self.UpdateStatusBar) - self.figure_canvas.Bind(wx.EVT_ENTER_WINDOW, self.ChangeCursor) - - self.sizer = wx.BoxSizer(wx.VERTICAL) - self.sizer.Add(self.figure_canvas, 1, wx.LEFT | wx.TOP | wx.GROW) - self.SetSizer(self.sizer) - self.Fit() - - self.statusBar = wx.StatusBar(self, -1) - self.SetStatusBar(self.statusBar) - - self.toolbar = NavigationToolbar2Wx(self.figure_canvas) - self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) - self.toolbar.Show() - - def ChangeCursor(self, event): - self.figure_canvas.SetCursor(wxc.StockCursor(wx.CURSOR_BULLSEYE)) - - def UpdateStatusBar(self, event): - if event.inaxes: - x, y = event.xdata, event.ydata - self.statusBar.SetStatusText(("x= " + str(x) + - " y=" + str(y)), - 0) - - - class App(wx.App): - def OnInit(self): - 'Create the main window and insert the custom frame' - frame = CanvasFrame() - self.SetTopWindow(frame) - frame.Show(True) - return True - - if __name__ == '__main__': - app = App(0) - app.MainLoop() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/user_interfaces/wxcursor_demo.txt b/_sources/examples/user_interfaces/wxcursor_demo.txt deleted file mode 100644 index ce53259f289..00000000000 --- a/_sources/examples/user_interfaces/wxcursor_demo.txt +++ /dev/null @@ -1,87 +0,0 @@ -.. _user_interfaces-wxcursor_demo: - -user_interfaces example code: wxcursor_demo.py -============================================== - -[`source code `_] - -:: - - """ - Example to draw a cursor and report the data coords in wx - """ - # matplotlib requires wxPython 2.8+ - # set the wxPython version in lib\site-packages\wx.pth file - # or if you have wxversion installed un-comment the lines below - #import wxversion - #wxversion.ensureMinimal('2.8') - - import matplotlib - matplotlib.use('WXAgg') - - from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas - from matplotlib.backends.backend_wx import NavigationToolbar2Wx, wxc - from matplotlib.figure import Figure - from numpy import arange, sin, pi - - import wx - - - class CanvasFrame(wx.Frame): - def __init__(self, ): - wx.Frame.__init__(self, None, -1, - 'CanvasFrame', size=(550, 350)) - - self.SetBackgroundColour(wxc.NamedColour("WHITE")) - - self.figure = Figure() - self.axes = self.figure.add_subplot(111) - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - - self.axes.plot(t, s) - self.axes.set_xlabel('t') - self.axes.set_ylabel('sin(t)') - self.figure_canvas = FigureCanvas(self, -1, self.figure) - - # Note that event is a MplEvent - self.figure_canvas.mpl_connect('motion_notify_event', self.UpdateStatusBar) - self.figure_canvas.Bind(wx.EVT_ENTER_WINDOW, self.ChangeCursor) - - self.sizer = wx.BoxSizer(wx.VERTICAL) - self.sizer.Add(self.figure_canvas, 1, wx.LEFT | wx.TOP | wx.GROW) - self.SetSizer(self.sizer) - self.Fit() - - self.statusBar = wx.StatusBar(self, -1) - self.SetStatusBar(self.statusBar) - - self.toolbar = NavigationToolbar2Wx(self.figure_canvas) - self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) - self.toolbar.Show() - - def ChangeCursor(self, event): - self.figure_canvas.SetCursor(wxc.StockCursor(wx.CURSOR_BULLSEYE)) - - def UpdateStatusBar(self, event): - if event.inaxes: - x, y = event.xdata, event.ydata - self.statusBar.SetStatusText(("x= " + str(x) + - " y=" + str(y)), - 0) - - - class App(wx.App): - def OnInit(self): - 'Create the main window and insert the custom frame' - frame = CanvasFrame() - self.SetTopWindow(frame) - frame.Show(True) - return True - - if __name__ == '__main__': - app = App(0) - app.MainLoop() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/widgets/buttons.rst.txt b/_sources/examples/widgets/buttons.rst.txt deleted file mode 100644 index 1a6cc88a056..00000000000 --- a/_sources/examples/widgets/buttons.rst.txt +++ /dev/null @@ -1,52 +0,0 @@ -.. _widgets-buttons: - -widgets example code: buttons.py -================================ - -[`source code `_] - -:: - - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.widgets import Button - - freqs = np.arange(2, 20, 3) - - fig, ax = plt.subplots() - plt.subplots_adjust(bottom=0.2) - t = np.arange(0.0, 1.0, 0.001) - s = np.sin(2*np.pi*freqs[0]*t) - l, = plt.plot(t, s, lw=2) - - - class Index(object): - ind = 0 - - def next(self, event): - self.ind += 1 - i = self.ind % len(freqs) - ydata = np.sin(2*np.pi*freqs[i]*t) - l.set_ydata(ydata) - plt.draw() - - def prev(self, event): - self.ind -= 1 - i = self.ind % len(freqs) - ydata = np.sin(2*np.pi*freqs[i]*t) - l.set_ydata(ydata) - plt.draw() - - callback = Index() - axprev = plt.axes([0.7, 0.05, 0.1, 0.075]) - axnext = plt.axes([0.81, 0.05, 0.1, 0.075]) - bnext = Button(axnext, 'Next') - bnext.on_clicked(callback.next) - bprev = Button(axprev, 'Previous') - bprev.on_clicked(callback.prev) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/widgets/buttons.txt b/_sources/examples/widgets/buttons.txt deleted file mode 100644 index 1a6cc88a056..00000000000 --- a/_sources/examples/widgets/buttons.txt +++ /dev/null @@ -1,52 +0,0 @@ -.. _widgets-buttons: - -widgets example code: buttons.py -================================ - -[`source code `_] - -:: - - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.widgets import Button - - freqs = np.arange(2, 20, 3) - - fig, ax = plt.subplots() - plt.subplots_adjust(bottom=0.2) - t = np.arange(0.0, 1.0, 0.001) - s = np.sin(2*np.pi*freqs[0]*t) - l, = plt.plot(t, s, lw=2) - - - class Index(object): - ind = 0 - - def next(self, event): - self.ind += 1 - i = self.ind % len(freqs) - ydata = np.sin(2*np.pi*freqs[i]*t) - l.set_ydata(ydata) - plt.draw() - - def prev(self, event): - self.ind -= 1 - i = self.ind % len(freqs) - ydata = np.sin(2*np.pi*freqs[i]*t) - l.set_ydata(ydata) - plt.draw() - - callback = Index() - axprev = plt.axes([0.7, 0.05, 0.1, 0.075]) - axnext = plt.axes([0.81, 0.05, 0.1, 0.075]) - bnext = Button(axnext, 'Next') - bnext.on_clicked(callback.next) - bprev = Button(axprev, 'Previous') - bprev.on_clicked(callback.prev) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/widgets/check_buttons.rst.txt b/_sources/examples/widgets/check_buttons.rst.txt deleted file mode 100644 index 416796b8d42..00000000000 --- a/_sources/examples/widgets/check_buttons.rst.txt +++ /dev/null @@ -1,42 +0,0 @@ -.. _widgets-check_buttons: - -widgets example code: check_buttons.py -====================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.widgets import CheckButtons - - t = np.arange(0.0, 2.0, 0.01) - s0 = np.sin(2*np.pi*t) - s1 = np.sin(4*np.pi*t) - s2 = np.sin(6*np.pi*t) - - fig, ax = plt.subplots() - l0, = ax.plot(t, s0, visible=False, lw=2) - l1, = ax.plot(t, s1, lw=2) - l2, = ax.plot(t, s2, lw=2) - plt.subplots_adjust(left=0.2) - - rax = plt.axes([0.05, 0.4, 0.1, 0.15]) - check = CheckButtons(rax, ('2 Hz', '4 Hz', '6 Hz'), (False, True, True)) - - - def func(label): - if label == '2 Hz': - l0.set_visible(not l0.get_visible()) - elif label == '4 Hz': - l1.set_visible(not l1.get_visible()) - elif label == '6 Hz': - l2.set_visible(not l2.get_visible()) - plt.draw() - check.on_clicked(func) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/widgets/check_buttons.txt b/_sources/examples/widgets/check_buttons.txt deleted file mode 100644 index 416796b8d42..00000000000 --- a/_sources/examples/widgets/check_buttons.txt +++ /dev/null @@ -1,42 +0,0 @@ -.. _widgets-check_buttons: - -widgets example code: check_buttons.py -====================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.widgets import CheckButtons - - t = np.arange(0.0, 2.0, 0.01) - s0 = np.sin(2*np.pi*t) - s1 = np.sin(4*np.pi*t) - s2 = np.sin(6*np.pi*t) - - fig, ax = plt.subplots() - l0, = ax.plot(t, s0, visible=False, lw=2) - l1, = ax.plot(t, s1, lw=2) - l2, = ax.plot(t, s2, lw=2) - plt.subplots_adjust(left=0.2) - - rax = plt.axes([0.05, 0.4, 0.1, 0.15]) - check = CheckButtons(rax, ('2 Hz', '4 Hz', '6 Hz'), (False, True, True)) - - - def func(label): - if label == '2 Hz': - l0.set_visible(not l0.get_visible()) - elif label == '4 Hz': - l1.set_visible(not l1.get_visible()) - elif label == '6 Hz': - l2.set_visible(not l2.get_visible()) - plt.draw() - check.on_clicked(func) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/widgets/cursor.rst.txt b/_sources/examples/widgets/cursor.rst.txt deleted file mode 100644 index b2ed0813869..00000000000 --- a/_sources/examples/widgets/cursor.rst.txt +++ /dev/null @@ -1,29 +0,0 @@ -.. _widgets-cursor: - -widgets example code: cursor.py -=============================== - -[`source code `_] - -:: - - from matplotlib.widgets import Cursor - import numpy as np - import matplotlib.pyplot as plt - - - fig = plt.figure(figsize=(8, 6)) - ax = fig.add_subplot(111, facecolor='#FFFFCC') - - x, y = 4*(np.random.rand(2, 100) - .5) - ax.plot(x, y, 'o') - ax.set_xlim(-2, 2) - ax.set_ylim(-2, 2) - - # set useblit = True on gtkagg for enhanced performance - cursor = Cursor(ax, useblit=True, color='red', linewidth=2) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/widgets/cursor.txt b/_sources/examples/widgets/cursor.txt deleted file mode 100644 index eb51730e079..00000000000 --- a/_sources/examples/widgets/cursor.txt +++ /dev/null @@ -1,31 +0,0 @@ -.. _widgets-cursor: - -widgets example code: cursor.py -=============================== - -[`source code `_] - -:: - - #!/usr/bin/env python - - from matplotlib.widgets import Cursor - import numpy as np - import matplotlib.pyplot as plt - - - fig = plt.figure(figsize=(8, 6)) - ax = fig.add_subplot(111, axisbg='#FFFFCC') - - x, y = 4*(np.random.rand(2, 100) - .5) - ax.plot(x, y, 'o') - ax.set_xlim(-2, 2) - ax.set_ylim(-2, 2) - - # set useblit = True on gtkagg for enhanced performance - cursor = Cursor(ax, useblit=True, color='red', linewidth=2) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/widgets/index.rst.txt b/_sources/examples/widgets/index.rst.txt deleted file mode 100644 index 0e7d818da67..00000000000 --- a/_sources/examples/widgets/index.rst.txt +++ /dev/null @@ -1,24 +0,0 @@ -.. _widgets-examples-index: - -############################################## -widgets Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - buttons - check_buttons - cursor - lasso_selector_demo - menu - multicursor - radio_buttons - rectangle_selector - slider_demo - span_selector diff --git a/_sources/examples/widgets/index.txt b/_sources/examples/widgets/index.txt deleted file mode 100644 index 0e7d818da67..00000000000 --- a/_sources/examples/widgets/index.txt +++ /dev/null @@ -1,24 +0,0 @@ -.. _widgets-examples-index: - -############################################## -widgets Examples -############################################## - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - :maxdepth: 1 - - buttons - check_buttons - cursor - lasso_selector_demo - menu - multicursor - radio_buttons - rectangle_selector - slider_demo - span_selector diff --git a/_sources/examples/widgets/lasso_selector_demo.rst.txt b/_sources/examples/widgets/lasso_selector_demo.rst.txt deleted file mode 100644 index fef0baca4d4..00000000000 --- a/_sources/examples/widgets/lasso_selector_demo.rst.txt +++ /dev/null @@ -1,98 +0,0 @@ -.. _widgets-lasso_selector_demo: - -widgets example code: lasso_selector_demo.py -============================================ - -[`source code `_] - -:: - - from __future__ import print_function - - from six.moves import input - - import numpy as np - - from matplotlib.widgets import LassoSelector - from matplotlib.path import Path - - - class SelectFromCollection(object): - """Select indices from a matplotlib collection using `LassoSelector`. - - Selected indices are saved in the `ind` attribute. This tool highlights - selected points by fading them out (i.e., reducing their alpha values). - If your collection has alpha < 1, this tool will permanently alter them. - - Note that this tool selects collection objects based on their *origins* - (i.e., `offsets`). - - Parameters - ---------- - ax : :class:`~matplotlib.axes.Axes` - Axes to interact with. - - collection : :class:`matplotlib.collections.Collection` subclass - Collection you want to select from. - - alpha_other : 0 <= float <= 1 - To highlight a selection, this tool sets all selected points to an - alpha value of 1 and non-selected points to `alpha_other`. - """ - - def __init__(self, ax, collection, alpha_other=0.3): - self.canvas = ax.figure.canvas - self.collection = collection - self.alpha_other = alpha_other - - self.xys = collection.get_offsets() - self.Npts = len(self.xys) - - # Ensure that we have separate colors for each object - self.fc = collection.get_facecolors() - if len(self.fc) == 0: - raise ValueError('Collection must have a facecolor') - elif len(self.fc) == 1: - self.fc = np.tile(self.fc, self.Npts).reshape(self.Npts, -1) - - self.lasso = LassoSelector(ax, onselect=self.onselect) - self.ind = [] - - def onselect(self, verts): - path = Path(verts) - self.ind = np.nonzero([path.contains_point(xy) for xy in self.xys])[0] - self.fc[:, -1] = self.alpha_other - self.fc[self.ind, -1] = 1 - self.collection.set_facecolors(self.fc) - self.canvas.draw_idle() - - def disconnect(self): - self.lasso.disconnect_events() - self.fc[:, -1] = 1 - self.collection.set_facecolors(self.fc) - self.canvas.draw_idle() - - - if __name__ == '__main__': - import matplotlib.pyplot as plt - - plt.ion() - data = np.random.rand(100, 2) - - subplot_kw = dict(xlim=(0, 1), ylim=(0, 1), autoscale_on=False) - fig, ax = plt.subplots(subplot_kw=subplot_kw) - - pts = ax.scatter(data[:, 0], data[:, 1], s=80) - selector = SelectFromCollection(ax, pts) - - plt.draw() - input('Press Enter to accept selected points') - print("Selected points:") - print(selector.xys[selector.ind]) - selector.disconnect() - - # Block end of script so you can check that the lasso is disconnected. - input('Press Enter to quit') - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/widgets/lasso_selector_demo.txt b/_sources/examples/widgets/lasso_selector_demo.txt deleted file mode 100644 index 0d046865ae0..00000000000 --- a/_sources/examples/widgets/lasso_selector_demo.txt +++ /dev/null @@ -1,102 +0,0 @@ -.. _widgets-lasso_selector_demo: - -widgets example code: lasso_selector_demo.py -============================================ - -[`source code `_] - -:: - - from __future__ import print_function - - import numpy as np - - from matplotlib.widgets import LassoSelector - from matplotlib.path import Path - - try: - raw_input - except NameError: - # Python 3 - raw_input = input - - - class SelectFromCollection(object): - """Select indices from a matplotlib collection using `LassoSelector`. - - Selected indices are saved in the `ind` attribute. This tool highlights - selected points by fading them out (i.e., reducing their alpha values). - If your collection has alpha < 1, this tool will permanently alter them. - - Note that this tool selects collection objects based on their *origins* - (i.e., `offsets`). - - Parameters - ---------- - ax : :class:`~matplotlib.axes.Axes` - Axes to interact with. - - collection : :class:`matplotlib.collections.Collection` subclass - Collection you want to select from. - - alpha_other : 0 <= float <= 1 - To highlight a selection, this tool sets all selected points to an - alpha value of 1 and non-selected points to `alpha_other`. - """ - - def __init__(self, ax, collection, alpha_other=0.3): - self.canvas = ax.figure.canvas - self.collection = collection - self.alpha_other = alpha_other - - self.xys = collection.get_offsets() - self.Npts = len(self.xys) - - # Ensure that we have separate colors for each object - self.fc = collection.get_facecolors() - if len(self.fc) == 0: - raise ValueError('Collection must have a facecolor') - elif len(self.fc) == 1: - self.fc = np.tile(self.fc, self.Npts).reshape(self.Npts, -1) - - self.lasso = LassoSelector(ax, onselect=self.onselect) - self.ind = [] - - def onselect(self, verts): - path = Path(verts) - self.ind = np.nonzero([path.contains_point(xy) for xy in self.xys])[0] - self.fc[:, -1] = self.alpha_other - self.fc[self.ind, -1] = 1 - self.collection.set_facecolors(self.fc) - self.canvas.draw_idle() - - def disconnect(self): - self.lasso.disconnect_events() - self.fc[:, -1] = 1 - self.collection.set_facecolors(self.fc) - self.canvas.draw_idle() - - - if __name__ == '__main__': - import matplotlib.pyplot as plt - - plt.ion() - data = np.random.rand(100, 2) - - subplot_kw = dict(xlim=(0, 1), ylim=(0, 1), autoscale_on=False) - fig, ax = plt.subplots(subplot_kw=subplot_kw) - - pts = ax.scatter(data[:, 0], data[:, 1], s=80) - selector = SelectFromCollection(ax, pts) - - plt.draw() - raw_input('Press any key to accept selected points') - print("Selected points:") - print(selector.xys[selector.ind]) - selector.disconnect() - - # Block end of script so you can check that the lasso is disconnected. - raw_input('Press any key to quit') - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/widgets/menu.rst.txt b/_sources/examples/widgets/menu.rst.txt deleted file mode 100644 index f469b3a566d..00000000000 --- a/_sources/examples/widgets/menu.rst.txt +++ /dev/null @@ -1,188 +0,0 @@ -.. _widgets-menu: - -widgets example code: menu.py -============================= - -[`source code `_] - -:: - - from __future__ import division, print_function - import numpy as np - import matplotlib - import matplotlib.colors as colors - import matplotlib.patches as patches - import matplotlib.mathtext as mathtext - import matplotlib.pyplot as plt - import matplotlib.artist as artist - import matplotlib.image as image - - - class ItemProperties(object): - def __init__(self, fontsize=14, labelcolor='black', bgcolor='yellow', - alpha=1.0): - self.fontsize = fontsize - self.labelcolor = labelcolor - self.bgcolor = bgcolor - self.alpha = alpha - - self.labelcolor_rgb = colors.to_rgba(labelcolor)[:3] - self.bgcolor_rgb = colors.to_rgba(bgcolor)[:3] - - - class MenuItem(artist.Artist): - parser = mathtext.MathTextParser("Bitmap") - padx = 5 - pady = 5 - - def __init__(self, fig, labelstr, props=None, hoverprops=None, - on_select=None): - artist.Artist.__init__(self) - - self.set_figure(fig) - self.labelstr = labelstr - - if props is None: - props = ItemProperties() - - if hoverprops is None: - hoverprops = ItemProperties() - - self.props = props - self.hoverprops = hoverprops - - self.on_select = on_select - - x, self.depth = self.parser.to_mask( - labelstr, fontsize=props.fontsize, dpi=fig.dpi) - - if props.fontsize != hoverprops.fontsize: - raise NotImplementedError( - 'support for different font sizes not implemented') - - self.labelwidth = x.shape[1] - self.labelheight = x.shape[0] - - self.labelArray = np.zeros((x.shape[0], x.shape[1], 4)) - self.labelArray[:, :, -1] = x/255. - - self.label = image.FigureImage(fig, origin='upper') - self.label.set_array(self.labelArray) - - # we'll update these later - self.rect = patches.Rectangle((0, 0), 1, 1) - - self.set_hover_props(False) - - fig.canvas.mpl_connect('button_release_event', self.check_select) - - def check_select(self, event): - over, junk = self.rect.contains(event) - if not over: - return - - if self.on_select is not None: - self.on_select(self) - - def set_extent(self, x, y, w, h): - print(x, y, w, h) - self.rect.set_x(x) - self.rect.set_y(y) - self.rect.set_width(w) - self.rect.set_height(h) - - self.label.ox = x + self.padx - self.label.oy = y - self.depth + self.pady/2. - - self.rect._update_patch_transform() - self.hover = False - - def draw(self, renderer): - self.rect.draw(renderer) - self.label.draw(renderer) - - def set_hover_props(self, b): - if b: - props = self.hoverprops - else: - props = self.props - - r, g, b = props.labelcolor_rgb - self.labelArray[:, :, 0] = r - self.labelArray[:, :, 1] = g - self.labelArray[:, :, 2] = b - self.label.set_array(self.labelArray) - self.rect.set(facecolor=props.bgcolor, alpha=props.alpha) - - def set_hover(self, event): - 'check the hover status of event and return true if status is changed' - b, junk = self.rect.contains(event) - - changed = (b != self.hover) - - if changed: - self.set_hover_props(b) - - self.hover = b - return changed - - - class Menu(object): - def __init__(self, fig, menuitems): - self.figure = fig - fig.suppressComposite = True - - self.menuitems = menuitems - self.numitems = len(menuitems) - - maxw = max([item.labelwidth for item in menuitems]) - maxh = max([item.labelheight for item in menuitems]) - - totalh = self.numitems*maxh + (self.numitems + 1)*2*MenuItem.pady - - x0 = 100 - y0 = 400 - - width = maxw + 2*MenuItem.padx - height = maxh + MenuItem.pady - - for item in menuitems: - left = x0 - bottom = y0 - maxh - MenuItem.pady - - item.set_extent(left, bottom, width, height) - - fig.artists.append(item) - y0 -= maxh + MenuItem.pady - - fig.canvas.mpl_connect('motion_notify_event', self.on_move) - - def on_move(self, event): - draw = False - for item in self.menuitems: - draw = item.set_hover(event) - if draw: - self.figure.canvas.draw() - break - - - fig = plt.figure() - fig.subplots_adjust(left=0.3) - props = ItemProperties(labelcolor='black', bgcolor='yellow', - fontsize=15, alpha=0.2) - hoverprops = ItemProperties(labelcolor='white', bgcolor='blue', - fontsize=15, alpha=0.2) - - menuitems = [] - for label in ('open', 'close', 'save', 'save as', 'quit'): - def on_select(item): - print('you selected %s' % item.labelstr) - item = MenuItem(fig, label, props=props, hoverprops=hoverprops, - on_select=on_select) - menuitems.append(item) - - menu = Menu(fig, menuitems) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/widgets/menu.txt b/_sources/examples/widgets/menu.txt deleted file mode 100644 index a25e57d98bf..00000000000 --- a/_sources/examples/widgets/menu.txt +++ /dev/null @@ -1,188 +0,0 @@ -.. _widgets-menu: - -widgets example code: menu.py -============================= - -[`source code `_] - -:: - - from __future__ import division, print_function - import numpy as np - import matplotlib - import matplotlib.colors as colors - import matplotlib.patches as patches - import matplotlib.mathtext as mathtext - import matplotlib.pyplot as plt - import matplotlib.artist as artist - import matplotlib.image as image - - - class ItemProperties(object): - def __init__(self, fontsize=14, labelcolor='black', bgcolor='yellow', - alpha=1.0): - self.fontsize = fontsize - self.labelcolor = labelcolor - self.bgcolor = bgcolor - self.alpha = alpha - - self.labelcolor_rgb = colors.colorConverter.to_rgb(labelcolor) - self.bgcolor_rgb = colors.colorConverter.to_rgb(bgcolor) - - - class MenuItem(artist.Artist): - parser = mathtext.MathTextParser("Bitmap") - padx = 5 - pady = 5 - - def __init__(self, fig, labelstr, props=None, hoverprops=None, - on_select=None): - artist.Artist.__init__(self) - - self.set_figure(fig) - self.labelstr = labelstr - - if props is None: - props = ItemProperties() - - if hoverprops is None: - hoverprops = ItemProperties() - - self.props = props - self.hoverprops = hoverprops - - self.on_select = on_select - - x, self.depth = self.parser.to_mask( - labelstr, fontsize=props.fontsize, dpi=fig.dpi) - - if props.fontsize != hoverprops.fontsize: - raise NotImplementedError( - 'support for different font sizes not implemented') - - self.labelwidth = x.shape[1] - self.labelheight = x.shape[0] - - self.labelArray = np.zeros((x.shape[0], x.shape[1], 4)) - self.labelArray[:, :, -1] = x/255. - - self.label = image.FigureImage(fig, origin='upper') - self.label.set_array(self.labelArray) - - # we'll update these later - self.rect = patches.Rectangle((0, 0), 1, 1) - - self.set_hover_props(False) - - fig.canvas.mpl_connect('button_release_event', self.check_select) - - def check_select(self, event): - over, junk = self.rect.contains(event) - if not over: - return - - if self.on_select is not None: - self.on_select(self) - - def set_extent(self, x, y, w, h): - print(x, y, w, h) - self.rect.set_x(x) - self.rect.set_y(y) - self.rect.set_width(w) - self.rect.set_height(h) - - self.label.ox = x + self.padx - self.label.oy = y - self.depth + self.pady/2. - - self.rect._update_patch_transform() - self.hover = False - - def draw(self, renderer): - self.rect.draw(renderer) - self.label.draw(renderer) - - def set_hover_props(self, b): - if b: - props = self.hoverprops - else: - props = self.props - - r, g, b = props.labelcolor_rgb - self.labelArray[:, :, 0] = r - self.labelArray[:, :, 1] = g - self.labelArray[:, :, 2] = b - self.label.set_array(self.labelArray) - self.rect.set(facecolor=props.bgcolor, alpha=props.alpha) - - def set_hover(self, event): - 'check the hover status of event and return true if status is changed' - b, junk = self.rect.contains(event) - - changed = (b != self.hover) - - if changed: - self.set_hover_props(b) - - self.hover = b - return changed - - - class Menu(object): - def __init__(self, fig, menuitems): - self.figure = fig - fig.suppressComposite = True - - self.menuitems = menuitems - self.numitems = len(menuitems) - - maxw = max([item.labelwidth for item in menuitems]) - maxh = max([item.labelheight for item in menuitems]) - - totalh = self.numitems*maxh + (self.numitems + 1)*2*MenuItem.pady - - x0 = 100 - y0 = 400 - - width = maxw + 2*MenuItem.padx - height = maxh + MenuItem.pady - - for item in menuitems: - left = x0 - bottom = y0 - maxh - MenuItem.pady - - item.set_extent(left, bottom, width, height) - - fig.artists.append(item) - y0 -= maxh + MenuItem.pady - - fig.canvas.mpl_connect('motion_notify_event', self.on_move) - - def on_move(self, event): - draw = False - for item in self.menuitems: - draw = item.set_hover(event) - if draw: - self.figure.canvas.draw() - break - - - fig = plt.figure() - fig.subplots_adjust(left=0.3) - props = ItemProperties(labelcolor='black', bgcolor='yellow', - fontsize=15, alpha=0.2) - hoverprops = ItemProperties(labelcolor='white', bgcolor='blue', - fontsize=15, alpha=0.2) - - menuitems = [] - for label in ('open', 'close', 'save', 'save as', 'quit'): - def on_select(item): - print('you selected %s' % item.labelstr) - item = MenuItem(fig, label, props=props, hoverprops=hoverprops, - on_select=on_select) - menuitems.append(item) - - menu = Menu(fig, menuitems) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/widgets/multicursor.rst.txt b/_sources/examples/widgets/multicursor.rst.txt deleted file mode 100644 index 3d750b77bc7..00000000000 --- a/_sources/examples/widgets/multicursor.rst.txt +++ /dev/null @@ -1,29 +0,0 @@ -.. _widgets-multicursor: - -widgets example code: multicursor.py -==================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.widgets import MultiCursor - - t = np.arange(0.0, 2.0, 0.01) - s1 = np.sin(2*np.pi*t) - s2 = np.sin(4*np.pi*t) - fig = plt.figure() - ax1 = fig.add_subplot(211) - ax1.plot(t, s1) - - - ax2 = fig.add_subplot(212, sharex=ax1) - ax2.plot(t, s2) - - multi = MultiCursor(fig.canvas, (ax1, ax2), color='r', lw=1) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/widgets/multicursor.txt b/_sources/examples/widgets/multicursor.txt deleted file mode 100644 index 3d750b77bc7..00000000000 --- a/_sources/examples/widgets/multicursor.txt +++ /dev/null @@ -1,29 +0,0 @@ -.. _widgets-multicursor: - -widgets example code: multicursor.py -==================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.widgets import MultiCursor - - t = np.arange(0.0, 2.0, 0.01) - s1 = np.sin(2*np.pi*t) - s2 = np.sin(4*np.pi*t) - fig = plt.figure() - ax1 = fig.add_subplot(211) - ax1.plot(t, s1) - - - ax2 = fig.add_subplot(212, sharex=ax1) - ax2.plot(t, s2) - - multi = MultiCursor(fig.canvas, (ax1, ax2), color='r', lw=1) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/widgets/radio_buttons.rst.txt b/_sources/examples/widgets/radio_buttons.rst.txt deleted file mode 100644 index 0a7f32007f9..00000000000 --- a/_sources/examples/widgets/radio_buttons.rst.txt +++ /dev/null @@ -1,56 +0,0 @@ -.. _widgets-radio_buttons: - -widgets example code: radio_buttons.py -====================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.widgets import RadioButtons - - t = np.arange(0.0, 2.0, 0.01) - s0 = np.sin(2*np.pi*t) - s1 = np.sin(4*np.pi*t) - s2 = np.sin(8*np.pi*t) - - fig, ax = plt.subplots() - l, = ax.plot(t, s0, lw=2, color='red') - plt.subplots_adjust(left=0.3) - - axcolor = 'lightgoldenrodyellow' - rax = plt.axes([0.05, 0.7, 0.15, 0.15], facecolor=axcolor) - radio = RadioButtons(rax, ('2 Hz', '4 Hz', '8 Hz')) - - - def hzfunc(label): - hzdict = {'2 Hz': s0, '4 Hz': s1, '8 Hz': s2} - ydata = hzdict[label] - l.set_ydata(ydata) - plt.draw() - radio.on_clicked(hzfunc) - - rax = plt.axes([0.05, 0.4, 0.15, 0.15], facecolor=axcolor) - radio2 = RadioButtons(rax, ('red', 'blue', 'green')) - - - def colorfunc(label): - l.set_color(label) - plt.draw() - radio2.on_clicked(colorfunc) - - rax = plt.axes([0.05, 0.1, 0.15, 0.15], facecolor=axcolor) - radio3 = RadioButtons(rax, ('-', '--', '-.', 'steps', ':')) - - - def stylefunc(label): - l.set_linestyle(label) - plt.draw() - radio3.on_clicked(stylefunc) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/widgets/radio_buttons.txt b/_sources/examples/widgets/radio_buttons.txt deleted file mode 100644 index 256a6d27a31..00000000000 --- a/_sources/examples/widgets/radio_buttons.txt +++ /dev/null @@ -1,56 +0,0 @@ -.. _widgets-radio_buttons: - -widgets example code: radio_buttons.py -====================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.widgets import RadioButtons - - t = np.arange(0.0, 2.0, 0.01) - s0 = np.sin(2*np.pi*t) - s1 = np.sin(4*np.pi*t) - s2 = np.sin(8*np.pi*t) - - fig, ax = plt.subplots() - l, = ax.plot(t, s0, lw=2, color='red') - plt.subplots_adjust(left=0.3) - - axcolor = 'lightgoldenrodyellow' - rax = plt.axes([0.05, 0.7, 0.15, 0.15], axisbg=axcolor) - radio = RadioButtons(rax, ('2 Hz', '4 Hz', '8 Hz')) - - - def hzfunc(label): - hzdict = {'2 Hz': s0, '4 Hz': s1, '8 Hz': s2} - ydata = hzdict[label] - l.set_ydata(ydata) - plt.draw() - radio.on_clicked(hzfunc) - - rax = plt.axes([0.05, 0.4, 0.15, 0.15], axisbg=axcolor) - radio2 = RadioButtons(rax, ('red', 'blue', 'green')) - - - def colorfunc(label): - l.set_color(label) - plt.draw() - radio2.on_clicked(colorfunc) - - rax = plt.axes([0.05, 0.1, 0.15, 0.15], axisbg=axcolor) - radio3 = RadioButtons(rax, ('-', '--', '-.', 'steps', ':')) - - - def stylefunc(label): - l.set_linestyle(label) - plt.draw() - radio3.on_clicked(stylefunc) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/widgets/rectangle_selector.rst.txt b/_sources/examples/widgets/rectangle_selector.rst.txt deleted file mode 100644 index 3b0c02bb8e8..00000000000 --- a/_sources/examples/widgets/rectangle_selector.rst.txt +++ /dev/null @@ -1,64 +0,0 @@ -.. _widgets-rectangle_selector: - -widgets example code: rectangle_selector.py -=========================================== - -[`source code `_] - -:: - - from __future__ import print_function - """ - Do a mouseclick somewhere, move the mouse to some destination, release - the button. This class gives click- and release-events and also draws - a line or a box from the click-point to the actual mouseposition - (within the same axes) until the button is released. Within the - method 'self.ignore()' it is checked whether the button from eventpress - and eventrelease are the same. - - """ - from matplotlib.widgets import RectangleSelector - import numpy as np - import matplotlib.pyplot as plt - - - def line_select_callback(eclick, erelease): - 'eclick and erelease are the press and release events' - x1, y1 = eclick.xdata, eclick.ydata - x2, y2 = erelease.xdata, erelease.ydata - print("(%3.2f, %3.2f) --> (%3.2f, %3.2f)" % (x1, y1, x2, y2)) - print(" The button you used were: %s %s" % (eclick.button, erelease.button)) - - - def toggle_selector(event): - print(' Key pressed.') - if event.key in ['Q', 'q'] and toggle_selector.RS.active: - print(' RectangleSelector deactivated.') - toggle_selector.RS.set_active(False) - if event.key in ['A', 'a'] and not toggle_selector.RS.active: - print(' RectangleSelector activated.') - toggle_selector.RS.set_active(True) - - - fig, current_ax = plt.subplots() # make a new plotting range - N = 100000 # If N is large one can see - x = np.linspace(0.0, 10.0, N) # improvement by use blitting! - - plt.plot(x, +np.sin(.2*np.pi*x), lw=3.5, c='b', alpha=.7) # plot something - plt.plot(x, +np.cos(.2*np.pi*x), lw=3.5, c='r', alpha=.5) - plt.plot(x, -np.sin(.2*np.pi*x), lw=3.5, c='g', alpha=.3) - - print("\n click --> release") - - # drawtype is 'box' or 'line' or 'none' - toggle_selector.RS = RectangleSelector(current_ax, line_select_callback, - drawtype='box', useblit=True, - button=[1, 3], # don't use middle button - minspanx=5, minspany=5, - spancoords='pixels', - interactive=True) - plt.connect('key_press_event', toggle_selector) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/widgets/rectangle_selector.txt b/_sources/examples/widgets/rectangle_selector.txt deleted file mode 100644 index fd5973da6f1..00000000000 --- a/_sources/examples/widgets/rectangle_selector.txt +++ /dev/null @@ -1,64 +0,0 @@ -.. _widgets-rectangle_selector: - -widgets example code: rectangle_selector.py -=========================================== - -[`source code `_] - -:: - - from __future__ import print_function - """ - Do a mouseclick somewhere, move the mouse to some destination, release - the button. This class gives click- and release-events and also draws - a line or a box from the click-point to the actual mouseposition - (within the same axes) until the button is released. Within the - method 'self.ignore()' it is checked wether the button from eventpress - and eventrelease are the same. - - """ - from matplotlib.widgets import RectangleSelector - import numpy as np - import matplotlib.pyplot as plt - - - def line_select_callback(eclick, erelease): - 'eclick and erelease are the press and release events' - x1, y1 = eclick.xdata, eclick.ydata - x2, y2 = erelease.xdata, erelease.ydata - print("(%3.2f, %3.2f) --> (%3.2f, %3.2f)" % (x1, y1, x2, y2)) - print(" The button you used were: %s %s" % (eclick.button, erelease.button)) - - - def toggle_selector(event): - print(' Key pressed.') - if event.key in ['Q', 'q'] and toggle_selector.RS.active: - print(' RectangleSelector deactivated.') - toggle_selector.RS.set_active(False) - if event.key in ['A', 'a'] and not toggle_selector.RS.active: - print(' RectangleSelector activated.') - toggle_selector.RS.set_active(True) - - - fig, current_ax = plt.subplots() # make a new plotingrange - N = 100000 # If N is large one can see - x = np.linspace(0.0, 10.0, N) # improvement by use blitting! - - plt.plot(x, +np.sin(.2*np.pi*x), lw=3.5, c='b', alpha=.7) # plot something - plt.plot(x, +np.cos(.2*np.pi*x), lw=3.5, c='r', alpha=.5) - plt.plot(x, -np.sin(.2*np.pi*x), lw=3.5, c='g', alpha=.3) - - print("\n click --> release") - - # drawtype is 'box' or 'line' or 'none' - toggle_selector.RS = RectangleSelector(current_ax, line_select_callback, - drawtype='box', useblit=True, - button=[1, 3], # don't use middle button - minspanx=5, minspany=5, - spancoords='pixels', - interactive=True) - plt.connect('key_press_event', toggle_selector) - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/widgets/slider_demo.rst.txt b/_sources/examples/widgets/slider_demo.rst.txt deleted file mode 100644 index 0a656a00890..00000000000 --- a/_sources/examples/widgets/slider_demo.rst.txt +++ /dev/null @@ -1,60 +0,0 @@ -.. _widgets-slider_demo: - -widgets example code: slider_demo.py -==================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.widgets import Slider, Button, RadioButtons - - fig, ax = plt.subplots() - plt.subplots_adjust(left=0.25, bottom=0.25) - t = np.arange(0.0, 1.0, 0.001) - a0 = 5 - f0 = 3 - s = a0*np.sin(2*np.pi*f0*t) - l, = plt.plot(t, s, lw=2, color='red') - plt.axis([0, 1, -10, 10]) - - axcolor = 'lightgoldenrodyellow' - axfreq = plt.axes([0.25, 0.1, 0.65, 0.03], facecolor=axcolor) - axamp = plt.axes([0.25, 0.15, 0.65, 0.03], facecolor=axcolor) - - sfreq = Slider(axfreq, 'Freq', 0.1, 30.0, valinit=f0) - samp = Slider(axamp, 'Amp', 0.1, 10.0, valinit=a0) - - - def update(val): - amp = samp.val - freq = sfreq.val - l.set_ydata(amp*np.sin(2*np.pi*freq*t)) - fig.canvas.draw_idle() - sfreq.on_changed(update) - samp.on_changed(update) - - resetax = plt.axes([0.8, 0.025, 0.1, 0.04]) - button = Button(resetax, 'Reset', color=axcolor, hovercolor='0.975') - - - def reset(event): - sfreq.reset() - samp.reset() - button.on_clicked(reset) - - rax = plt.axes([0.025, 0.5, 0.15, 0.15], facecolor=axcolor) - radio = RadioButtons(rax, ('red', 'blue', 'green'), active=0) - - - def colorfunc(label): - l.set_color(label) - fig.canvas.draw_idle() - radio.on_clicked(colorfunc) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/widgets/slider_demo.txt b/_sources/examples/widgets/slider_demo.txt deleted file mode 100644 index 2e1aa3cde0e..00000000000 --- a/_sources/examples/widgets/slider_demo.txt +++ /dev/null @@ -1,60 +0,0 @@ -.. _widgets-slider_demo: - -widgets example code: slider_demo.py -==================================== - -[`source code `_] - -:: - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.widgets import Slider, Button, RadioButtons - - fig, ax = plt.subplots() - plt.subplots_adjust(left=0.25, bottom=0.25) - t = np.arange(0.0, 1.0, 0.001) - a0 = 5 - f0 = 3 - s = a0*np.sin(2*np.pi*f0*t) - l, = plt.plot(t, s, lw=2, color='red') - plt.axis([0, 1, -10, 10]) - - axcolor = 'lightgoldenrodyellow' - axfreq = plt.axes([0.25, 0.1, 0.65, 0.03], axisbg=axcolor) - axamp = plt.axes([0.25, 0.15, 0.65, 0.03], axisbg=axcolor) - - sfreq = Slider(axfreq, 'Freq', 0.1, 30.0, valinit=f0) - samp = Slider(axamp, 'Amp', 0.1, 10.0, valinit=a0) - - - def update(val): - amp = samp.val - freq = sfreq.val - l.set_ydata(amp*np.sin(2*np.pi*freq*t)) - fig.canvas.draw_idle() - sfreq.on_changed(update) - samp.on_changed(update) - - resetax = plt.axes([0.8, 0.025, 0.1, 0.04]) - button = Button(resetax, 'Reset', color=axcolor, hovercolor='0.975') - - - def reset(event): - sfreq.reset() - samp.reset() - button.on_clicked(reset) - - rax = plt.axes([0.025, 0.5, 0.15, 0.15], axisbg=axcolor) - radio = RadioButtons(rax, ('red', 'blue', 'green'), active=0) - - - def colorfunc(label): - l.set_color(label) - fig.canvas.draw_idle() - radio.on_clicked(colorfunc) - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/widgets/span_selector.rst.txt b/_sources/examples/widgets/span_selector.rst.txt deleted file mode 100644 index 7a3780a868f..00000000000 --- a/_sources/examples/widgets/span_selector.rst.txt +++ /dev/null @@ -1,51 +0,0 @@ -.. _widgets-span_selector: - -widgets example code: span_selector.py -====================================== - -[`source code `_] - -:: - - """ - The SpanSelector is a mouse widget to select a xmin/xmax range and plot the - detail view of the selected region in the lower axes - """ - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.widgets import SpanSelector - - fig = plt.figure(figsize=(8, 6)) - ax = fig.add_subplot(211, facecolor='#FFFFCC') - - x = np.arange(0.0, 5.0, 0.01) - y = np.sin(2*np.pi*x) + 0.5*np.random.randn(len(x)) - - ax.plot(x, y, '-') - ax.set_ylim(-2, 2) - ax.set_title('Press left mouse button and drag to test') - - ax2 = fig.add_subplot(212, facecolor='#FFFFCC') - line2, = ax2.plot(x, y, '-') - - - def onselect(xmin, xmax): - indmin, indmax = np.searchsorted(x, (xmin, xmax)) - indmax = min(len(x) - 1, indmax) - - thisx = x[indmin:indmax] - thisy = y[indmin:indmax] - line2.set_data(thisx, thisy) - ax2.set_xlim(thisx[0], thisx[-1]) - ax2.set_ylim(thisy.min(), thisy.max()) - fig.canvas.draw() - - # set useblit True on gtkagg for enhanced performance - span = SpanSelector(ax, onselect, 'horizontal', useblit=True, - rectprops=dict(alpha=0.5, facecolor='red')) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/examples/widgets/span_selector.txt b/_sources/examples/widgets/span_selector.txt deleted file mode 100644 index f09a723173a..00000000000 --- a/_sources/examples/widgets/span_selector.txt +++ /dev/null @@ -1,52 +0,0 @@ -.. _widgets-span_selector: - -widgets example code: span_selector.py -====================================== - -[`source code `_] - -:: - - #!/usr/bin/env python - """ - The SpanSelector is a mouse widget to select a xmin/xmax range and plot the - detail view of the selected region in the lower axes - """ - import numpy as np - import matplotlib.pyplot as plt - from matplotlib.widgets import SpanSelector - - fig = plt.figure(figsize=(8, 6)) - ax = fig.add_subplot(211, axisbg='#FFFFCC') - - x = np.arange(0.0, 5.0, 0.01) - y = np.sin(2*np.pi*x) + 0.5*np.random.randn(len(x)) - - ax.plot(x, y, '-') - ax.set_ylim(-2, 2) - ax.set_title('Press left mouse button and drag to test') - - ax2 = fig.add_subplot(212, axisbg='#FFFFCC') - line2, = ax2.plot(x, y, '-') - - - def onselect(xmin, xmax): - indmin, indmax = np.searchsorted(x, (xmin, xmax)) - indmax = min(len(x) - 1, indmax) - - thisx = x[indmin:indmax] - thisy = y[indmin:indmax] - line2.set_data(thisx, thisy) - ax2.set_xlim(thisx[0], thisx[-1]) - ax2.set_ylim(thisy.min(), thisy.max()) - fig.canvas.draw() - - # set useblit True on gtkagg for enhanced performance - span = SpanSelector(ax, onselect, 'horizontal', useblit=True, - rectprops=dict(alpha=0.5, facecolor='red')) - - - plt.show() - - -Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`) \ No newline at end of file diff --git a/_sources/faq/usage_faq.rst.txt b/_sources/faq/usage_faq.rst.txt deleted file mode 100644 index fd240d8ca80..00000000000 --- a/_sources/faq/usage_faq.rst.txt +++ /dev/null @@ -1,629 +0,0 @@ -.. _usage-faq: - -*************** -Usage -*************** - -.. contents:: - :backlinks: none - - -.. _general_concepts: - -General Concepts -================ - -:mod:`matplotlib` has an extensive codebase that can be daunting to many -new users. However, most of matplotlib can be understood with a fairly -simple conceptual framework and knowledge of a few important points. - -Plotting requires action on a range of levels, from the most general -(e.g., 'contour this 2-D array') to the most specific (e.g., 'color -this screen pixel red'). The purpose of a plotting package is to assist -you in visualizing your data as easily as possible, with all the necessary -control -- that is, by using relatively high-level commands most of -the time, and still have the ability to use the low-level commands when -needed. - -Therefore, everything in matplotlib is organized in a hierarchy. At the top -of the hierarchy is the matplotlib "state-machine environment" which is -provided by the :mod:`matplotlib.pyplot` module. At this level, simple -functions are used to add plot elements (lines, images, text, etc.) to -the current axes in the current figure. - -.. note:: - Pyplot's state-machine environment behaves similarly to MATLAB and - should be most familiar to users with MATLAB experience. - -The next level down in the hierarchy is the first level of the object-oriented -interface, in which pyplot is used only for a few functions such as figure -creation, and the user explicitly creates and keeps track of the figure -and axes objects. At this level, the user uses pyplot to create figures, -and through those figures, one or more axes objects can be created. These -axes objects are then used for most plotting actions. - -For even more control -- which is essential for things like embedding -matplotlib plots in GUI applications -- the pyplot level may be dropped -completely, leaving a purely object-oriented approach. - -.. _figure_parts: - -Parts of a Figure -================= -.. image:: anatomy.png - -:class:`~matplotlib.figure.Figure` ----------------------------------- - -The **whole** figure. The figure keeps -track of all the child :class:`~matplotlib.axes.Axes`, a smattering of -'special' artists (titles, figure legends, etc), and the **canvas**. -(Don't worry too much about the canvas, it is crucial as it is the -object that actually does the drawing to get you your plot, but as the -user it is more-or-less invisible to you). A figure can have any -number of :class:`~matplotlib.axes.Axes`, but to be useful should have -at least one. - -The easiest way to create a new figure is with pyplot:: - - fig = plt.figure() # an empty figure with no axes - fig, ax_lst = plt.subplots(2, 2) # a figure with a 2x2 grid of Axes - - -:class:`~matplotlib.axes.Axes` ------------------------------- - -This is what you think of as 'a plot', it is the region of the image -with the data space (marked as the inner blue box). A given figure -can contain many Axes, but a given :class:`~matplotlib.axes.Axes` -object can only be in one :class:`~matplotlib.figure.Figure`. The -Axes contains two (or three in the case of 3D) -:class:`~matplotlib.axis.Axis` objects (be aware of the difference -between **Axes** and **Axis**) which take care of the data limits (the -data limits can also be controlled via set via the -:meth:`~matplotlib.axes.Axes.set_xlim` and -:meth:`~matplotlib.axes.Axes.set_ylim` :class:`Axes` methods). Each -:class:`Axes` has a title (set via -:meth:`~matplotlib.axes.Axes.set_title`), an x-label (set via -:meth:`~matplotlib.axes.Axes.set_xlabel`), and a y-label set via -:meth:`~matplotlib.axes.Axes.set_ylabel`). - -The :class:`Axes` class and it's member functions are the primary entry -point to working with the OO interface. - -:class:`~matplotlib.axis.Axis` ------------------------------- - -These are the number-line-like objects (circled in green). They take -care of setting the graph limits and generating the ticks (the marks -on the axis) and ticklabels (strings labeling the ticks). The -location of the ticks is determined by a -:class:`~matplotlib.ticker.Locator` object and the ticklabel strings -are formatted by a :class:`~matplotlib.ticker.Formatter`. The -combination of the correct :class:`Locator` and :class:`Formatter` gives -very fine control over the tick locations and labels. - -:class:`~matplotlib.artist.Artist` ----------------------------------- - -Basically everything you can see on the figure is an artist (even the -:class:`Figure`, :class:`Axes`, and :class:`Axis` objects). This -includes :class:`Text` objects, :class:`Line2D` objects, -:class:`collection` objects, :class:`Patch` objects ... (you get the -idea). When the figure is rendered, all of the artists are drawn to -the **canvas**. Most Artists are tied to an Axes; such an Artist -cannot be shared by multiple Axes, or moved from one to another. - -.. _input_types: - -Types of inputs to plotting functions -===================================== - -All of plotting functions expect `np.array` or `np.ma.masked_array` as -input. Classes that are 'array-like' such as `pandas` data objects -and `np.matrix` may or may not work as intended. It is best to -convert these to `np.array` objects prior to plotting. - -For example, to covert a `pandas.DataFrame` :: - - a = pandas.DataFrame(np.random.rand(4,5), columns = list('abcde')) - a_asndarray = a.values - -and to covert a `np.matrix` :: - - b = np.matrix([[1,2],[3,4]]) - b_asarray = np.asarray(b) - - - -.. _pylab: - -Matplotlib, pyplot and pylab: how are they related? -==================================================== - -Matplotlib is the whole package; :mod:`matplotlib.pyplot` -is a module in matplotlib; and :mod:`pylab` is a module -that gets installed alongside :mod:`matplotlib`. - -Pyplot provides the state-machine interface to the underlying -object-oriented plotting library. The state-machine implicitly and -automatically creates figures and axes to achieve the desired -plot. For example:: - - - import matplotlib.pyplot as plt - import numpy as np - - x = np.linspace(0, 2, 100) - - plt.plot(x, x, label='linear') - plt.plot(x, x**2, label='quadratic') - plt.plot(x, x**3, label='cubic') - - plt.xlabel('x label') - plt.ylabel('y label') - - plt.title("Simple Plot") - - plt.legend() - - plt.show() - -The first call to ``plt.plot`` will automatically create the necessary -figure and axes to achieve the desired plot. Subsequent calls to -``plt.plot`` re-use the current axes and each add another line. -Setting the title, legend, and axis labels also automatically use the -current axes and set the title, create the legend, and label the axis -respectively. - -:mod:`pylab` is a convenience module that bulk imports -:mod:`matplotlib.pyplot` (for plotting) and :mod:`numpy` -(for mathematics and working with arrays) in a single name space. -Although many examples use :mod:`pylab`, it is no longer recommended. - -For non-interactive plotting it is suggested -to use pyplot to create the figures and then the OO interface for -plotting. - -.. _coding_styles: - -Coding Styles -================== - -When viewing this documentation and examples, you will find different -coding styles and usage patterns. These styles are perfectly valid -and have their pros and cons. Just about all of the examples can be -converted into another style and achieve the same results. -The only caveat is to avoid mixing the coding styles for your own code. - -.. note:: - Developers for matplotlib have to follow a specific style and guidelines. - See :ref:`developers-guide-index`. - -Of the different styles, there are two that are officially supported. -Therefore, these are the preferred ways to use matplotlib. - -For the pyplot style, the imports at the top of your -scripts will typically be:: - - import matplotlib.pyplot as plt - import numpy as np - -Then one calls, for example, np.arange, np.zeros, np.pi, plt.figure, -plt.plot, plt.show, etc. Use the pyplot interface -for creating figures, and then use the object methods for the rest:: - - import matplotlib.pyplot as plt - import numpy as np - x = np.arange(0, 10, 0.2) - y = np.sin(x) - fig = plt.figure() - ax = fig.add_subplot(111) - ax.plot(x, y) - plt.show() - -So, why all the extra typing instead of the MATLAB-style (which relies -on global state and a flat namespace)? For very simple things like -this example, the only advantage is academic: the wordier styles are -more explicit, more clear as to where things come from and what is -going on. For more complicated applications, this explicitness and -clarity becomes increasingly valuable, and the richer and more -complete object-oriented interface will likely make the program easier -to write and maintain. - - -Typically one finds oneself making the same plots over and over -again, but with different data sets, which leads to needing to write -specialized functions to do the plotting. The recommended function -signature is something like: :: - - def my_plotter(ax, data1, data2, param_dict): - """ - A helper function to make a graph - - Parameters - ---------- - ax : Axes - The axes to draw to - - data1 : array - The x data - - data2 : array - The y data - - param_dict : dict - Dictionary of kwargs to pass to ax.plot - - Returns - ------- - out : list - list of artists added - """ - out = ax.plot(data1, data2, **param_dict) - return out - -which you would then use as:: - - fig, ax = plt.subplots(1, 1) - my_plotter(ax, data1, data2, {'marker':'x'}) - - -or if you wanted to have 2 sub-plots:: - - fig, (ax1, ax2) = plt.subplots(1, 2) - my_plotter(ax1, data1, data2, {'marker':'x'}) - my_plotter(ax2, data3, data4, {'marker':'o'}) - -Again, for these simple examples this style seems like overkill, however -once the graphs get slightly more complex it pays off. - -.. _what-is-a-backend: - -What is a backend? -================== - -A lot of documentation on the website and in the mailing lists refers -to the "backend" and many new users are confused by this term. -matplotlib targets many different use cases and output formats. Some -people use matplotlib interactively from the python shell and have -plotting windows pop up when they type commands. Some people embed -matplotlib into graphical user interfaces like wxpython or pygtk to -build rich applications. Others use matplotlib in batch scripts to -generate postscript images from some numerical simulations, and still -others in web application servers to dynamically serve up graphs. - -To support all of these use cases, matplotlib can target different -outputs, and each of these capabilities is called a backend; the -"frontend" is the user facing code, i.e., the plotting code, whereas the -"backend" does all the hard work behind-the-scenes to make the figure. -There are two types of backends: user interface backends (for use in -pygtk, wxpython, tkinter, qt4, or macosx; also referred to as -"interactive backends") and hardcopy backends to make image files -(PNG, SVG, PDF, PS; also referred to as "non-interactive backends"). - -There are four ways to configure your backend. If they conflict each other, -the method mentioned last in the following list will be used, e.g. calling -:func:`~matplotlib.use()` will override the setting in your ``matplotlibrc``. - - -#. The ``backend`` parameter in your ``matplotlibrc`` file (see - :ref:`customizing-matplotlib`):: - - backend : WXAgg # use wxpython with antigrain (agg) rendering - -#. Setting the :envvar:`MPLBACKEND` environment - variable, either for your current shell or for a single script:: - - > export MPLBACKEND="module://my_backend" - > python simple_plot.py - - > MPLBACKEND="module://my_backend" python simple_plot.py - - Setting this environment variable will override the ``backend`` parameter - in *any* ``matplotlibrc``, even if there is a ``matplotlibrc`` in your - current working directory. Therefore setting :envvar:`MPLBACKEND` - globally, e.g. in your ``.bashrc`` or ``.profile``, is discouraged as it - might lead to counter-intuitive behavior. - -#. To set the backend for a single script, you can alternatively use the `-d` - command line argument:: - - > python script.py -dbackend - - This method is **deprecated** as the `-d` argument might conflict with - scripts which parse command line arguments (see issue - `#1986 `_). You - should use :envvar:`MPLBACKEND` instead. - -#. If your script depends on a specific backend you can use the - :func:`~matplotlib.use` function:: - - import matplotlib - matplotlib.use('PS') # generate postscript output by default - - If you use the :func:`~matplotlib.use` function, this must be done before - importing :mod:`matplotlib.pyplot`. Calling :func:`~matplotlib.use` after - pyplot has been imported will have no effect. Using - :func:`~matplotlib.use` will require changes in your code if users want to - use a different backend. Therefore, you should avoid explicitly calling - :func:`~matplotlib.use` unless absolutely necessary. - -.. note:: - Backend name specifications are not case-sensitive; e.g., 'GTKAgg' - and 'gtkagg' are equivalent. - -With a typical installation of matplotlib, such as from a -binary installer or a linux distribution package, a good default -backend will already be set, allowing both interactive work and -plotting from scripts, with output to the screen and/or to -a file, so at least initially you will not need to use any of the -methods given above. - -If, however, you want to write graphical user interfaces, or a web -application server (:ref:`howto-webapp`), or need a better -understanding of what is going on, read on. To make things a little -more customizable for graphical user interfaces, matplotlib separates -the concept of the renderer (the thing that actually does the drawing) -from the canvas (the place where the drawing goes). The canonical -renderer for user interfaces is ``Agg`` which uses the `Anti-Grain -Geometry`_ C++ library to make a raster (pixel) image of the figure. -All of the user interfaces except ``macosx`` can be used with -agg rendering, e.g., -``WXAgg``, ``GTKAgg``, ``QT4Agg``, ``QT5Agg``, ``TkAgg``. In -addition, some of the user interfaces support other rendering engines. -For example, with GTK, you can also select GDK rendering (backend -``GTK`` deprecated in 2.0) or Cairo rendering (backend ``GTKCairo``). - -For the rendering engines, one can also distinguish between `vector -`_ or `raster -`_ renderers. Vector -graphics languages issue drawing commands like "draw a line from this -point to this point" and hence are scale free, and raster backends -generate a pixel representation of the line whose accuracy depends on a -DPI setting. - -Here is a summary of the matplotlib renderers (there is an eponymous -backed for each; these are *non-interactive backends*, capable of -writing to a file): - -============= ============ ================================================ -Renderer Filetypes Description -============= ============ ================================================ -:term:`AGG` :term:`png` :term:`raster graphics` -- high quality images - using the `Anti-Grain Geometry`_ engine -PS :term:`ps` :term:`vector graphics` -- Postscript_ output - :term:`eps` -PDF :term:`pdf` :term:`vector graphics` -- - `Portable Document Format`_ -SVG :term:`svg` :term:`vector graphics` -- - `Scalable Vector Graphics`_ -:term:`Cairo` :term:`png` :term:`vector graphics` -- - :term:`ps` `Cairo graphics`_ - :term:`pdf` - :term:`svg` - ... -:term:`GDK` :term:`png` :term:`raster graphics` -- - :term:`jpg` the `Gimp Drawing Kit`_ Deprecated in 2.0 - :term:`tiff` - ... -============= ============ ================================================ - -And here are the user interfaces and renderer combinations supported; -these are *interactive backends*, capable of displaying to the screen -and of using appropriate renderers from the table above to write to -a file: - -============ ================================================================ -Backend Description -============ ================================================================ -GTKAgg Agg rendering to a :term:`GTK` 2.x canvas (requires PyGTK_ and - pycairo_ or cairocffi_; Python2 only) -GTK3Agg Agg rendering to a :term:`GTK` 3.x canvas (requires PyGObject_ - and pycairo_ or cairocffi_) -GTK GDK rendering to a :term:`GTK` 2.x canvas (not recommended and d - eprecated in 2.0) (requires PyGTK_ and pycairo_ or cairocffi_; - Python2 only) -GTKCairo Cairo rendering to a :term:`GTK` 2.x canvas (requires PyGTK_ - and pycairo_ or cairocffi_; Python2 only) -GTK3Cairo Cairo rendering to a :term:`GTK` 3.x canvas (requires PyGObject_ - and pycairo_ or cairocffi_) -WXAgg Agg rendering to to a :term:`wxWidgets` canvas - (requires wxPython_) -WX Native :term:`wxWidgets` drawing to a :term:`wxWidgets` Canvas - (not recommended and deprecated in 2.0) (requires wxPython_) -TkAgg Agg rendering to a :term:`Tk` canvas (requires TkInter_) -Qt4Agg Agg rendering to a :term:`Qt4` canvas (requires PyQt4_ or ``pyside``) -Qt5Agg Agg rendering in a :term:`Qt5` canvas (requires PyQt5_) -macosx Cocoa rendering in OSX windows - (presently lacks blocking show() behavior when matplotlib - is in non-interactive mode) -============ ================================================================ - -.. _`Anti-Grain Geometry`: http://antigrain.com/ -.. _Postscript: https://en.wikipedia.org/wiki/PostScript -.. _`Portable Document Format`: https://en.wikipedia.org/wiki/Portable_Document_Format -.. _`Scalable Vector Graphics`: https://en.wikipedia.org/wiki/Scalable_Vector_Graphics -.. _`Cairo graphics`: https://en.wikipedia.org/wiki/Cairo_(graphics) -.. _`Gimp Drawing Kit`: https://en.wikipedia.org/wiki/GDK -.. _PyGTK: http://www.pygtk.org -.. _PyGObject: https://wiki.gnome.org/action/show/Projects/PyGObject -.. _pycairo: https://www.cairographics.org/pycairo/ -.. _cairocffi: https://pythonhosted.org/cairocffi/ -.. _wxPython: https://www.wxpython.org/ -.. _TkInter: https://wiki.python.org/moin/TkInter -.. _PyQt4: https://riverbankcomputing.com/software/pyqt/intro -.. _PyQt5: https://riverbankcomputing.com/software/pyqt/intro - -WX backends -=========== - -At present the release version of `wxPython` (also known as wxPython classic) -does not support python3. A work in progress redesigned version known as -wxPython-Phoenix_ does support python3. -Matplotlib should work with both versions. - -.. _wxPython-Phoenix: https://wxpython.org/Phoenix/docs/html/main.html - -GTK and Cairo -============= - -Both `GTK2` and `GTK3` have implicit dependencies on PyCairo regardless of the -specific Matplotlib backend used. Unfortunatly the latest release of PyCairo -for Python3 does not implement the Python wrappers needed for the `GTK3Agg` -backend. `Cairocffi` can be used as a replacement which implements the correct -wrapper. - -How do I select PyQt4 or PySide? -======================================== - -You can choose either PyQt4 or PySide when using the `qt4` backend by setting -the appropriate value for `backend.qt4` in your :file:`matplotlibrc` file. The -default value is `PyQt4`. - -The setting in your :file:`matplotlibrc` file can be overridden by setting the -`QT_API` environment variable to either `pyqt` or `pyside` to use `PyQt4` or -`PySide`, respectively. - -Since the default value for the bindings to be used is `PyQt4`, -:mod:`matplotlib` first tries to import it, if the import fails, it tries to -import `PySide`. - -.. _interactive-mode: - -What is interactive mode? -=================================== - -Use of an interactive backend (see :ref:`what-is-a-backend`) -permits--but does not by itself require or ensure--plotting -to the screen. Whether and when plotting to the screen occurs, -and whether a script or shell session continues after a plot -is drawn on the screen, depends on the functions and methods -that are called, and on a state variable that determines whether -matplotlib is in "interactive mode". The default Boolean value is set -by the :file:`matplotlibrc` file, and may be customized like any other -configuration parameter (see :ref:`customizing-matplotlib`). It -may also be set via :func:`matplotlib.interactive`, and its -value may be queried via :func:`matplotlib.is_interactive`. Turning -interactive mode on and off in the middle of a stream of plotting -commands, whether in a script or in a shell, is rarely needed -and potentially confusing, so in the following we will assume all -plotting is done with interactive mode either on or off. - -.. note:: - Major changes related to interactivity, and in particular the - role and behavior of :func:`~matplotlib.pyplot.show`, were made in the - transition to matplotlib version 1.0, and bugs were fixed in - 1.0.1. Here we describe the version 1.0.1 behavior for the - primary interactive backends, with the partial exception of - *macosx*. - -Interactive mode may also be turned on via :func:`matplotlib.pyplot.ion`, -and turned off via :func:`matplotlib.pyplot.ioff`. - -.. note:: - Interactive mode works with suitable backends in ipython and in - the ordinary python shell, but it does *not* work in the IDLE IDE. - If the default backend does not support interactivity, an interactive - backend can be explicitly activated using any of the methods discussed in `What is a backend?`_. - - -Interactive example --------------------- - -From an ordinary python prompt, or after invoking ipython with no options, -try this:: - - import matplotlib.pyplot as plt - plt.ion() - plt.plot([1.6, 2.7]) - -Assuming you are running version 1.0.1 or higher, and you have -an interactive backend installed and selected by default, you should -see a plot, and your terminal prompt should also be active; you -can type additional commands such as:: - - plt.title("interactive test") - plt.xlabel("index") - -and you will see the plot being updated after each line. This is -because you are in interactive mode *and* you are using pyplot -functions. Now try an alternative method of modifying the -plot. Get a reference to the :class:`~matplotlib.axes.Axes` instance, and -call a method of that instance:: - - ax = plt.gca() - ax.plot([3.1, 2.2]) - -Nothing changed, because the Axes methods do not include an -automatic call to :func:`~matplotlib.pyplot.draw_if_interactive`; -that call is added by the pyplot functions. If you are using -methods, then when you want to update the plot on the screen, -you need to call :func:`~matplotlib.pyplot.draw`:: - - plt.draw() - -Now you should see the new line added to the plot. - -Non-interactive example ------------------------ - -Start a fresh session as in the previous example, but now -turn interactive mode off:: - - import matplotlib.pyplot as plt - plt.ioff() - plt.plot([1.6, 2.7]) - -Nothing happened--or at least nothing has shown up on the -screen (unless you are using *macosx* backend, which is -anomalous). To make the plot appear, you need to do this:: - - plt.show() - -Now you see the plot, but your terminal command line is -unresponsive; the :func:`show()` command *blocks* the input -of additional commands until you manually kill the plot -window. - -What good is this--being forced to use a blocking function? -Suppose you need a script that plots the contents of a file -to the screen. You want to look at that plot, and then end -the script. Without some blocking command such as show(), the -script would flash up the plot and then end immediately, -leaving nothing on the screen. - -In addition, non-interactive mode delays all drawing until -show() is called; this is more efficient than redrawing -the plot each time a line in the script adds a new feature. - -Prior to version 1.0, show() generally could not be called -more than once in a single script (although sometimes one -could get away with it); for version 1.0.1 and above, this -restriction is lifted, so one can write a script like this:: - - import numpy as np - import matplotlib.pyplot as plt - plt.ioff() - for i in range(3): - plt.plot(np.random.rand(10)) - plt.show() - -which makes three plots, one at a time. - -Summary -------- - -In interactive mode, pyplot functions automatically draw -to the screen. - -When plotting interactively, if using -object method calls in addition to pyplot functions, then -call :func:`~matplotlib.pyplot.draw` whenever you want to -refresh the plot. - -Use non-interactive mode in scripts in which you want to -generate one or more figures and display them before ending -or generating a new set of figures. In that case, use -:func:`~matplotlib.pyplot.show` to display the figure(s) and -to block execution until you have manually destroyed them. diff --git a/_sources/mpl_toolkits/axes_grid/api/anchored_artists_api.rst.txt b/_sources/mpl_toolkits/axes_grid/api/anchored_artists_api.rst.txt deleted file mode 100644 index 4aeba4e3aaf..00000000000 --- a/_sources/mpl_toolkits/axes_grid/api/anchored_artists_api.rst.txt +++ /dev/null @@ -1,7 +0,0 @@ -:mod:`mpl_toolkits.axes_grid1.anchored_artists` -=============================================== - -.. automodule:: mpl_toolkits.axes_grid1.anchored_artists - :members: - :undoc-members: - :show-inheritance: diff --git a/_sources/mpl_toolkits/axes_grid/api/axes_divider_api.rst.txt b/_sources/mpl_toolkits/axes_grid/api/axes_divider_api.rst.txt deleted file mode 100644 index fc090530e66..00000000000 --- a/_sources/mpl_toolkits/axes_grid/api/axes_divider_api.rst.txt +++ /dev/null @@ -1,18 +0,0 @@ - -:mod:`mpl_toolkits.axes_grid.axes_divider` -========================================== - -.. autoclass:: mpl_toolkits.axes_grid.axes_divider.Divider - :members: - :undoc-members: - - -.. autoclass:: mpl_toolkits.axes_grid.axes_divider.AxesLocator - :members: - :undoc-members: - -.. autoclass:: mpl_toolkits.axes_grid.axes_divider.SubplotDivider - :members: - -.. autoclass:: mpl_toolkits.axes_grid.axes_divider.AxesDivider - :members: diff --git a/_sources/mpl_toolkits/axes_grid/api/axes_divider_api.txt b/_sources/mpl_toolkits/axes_grid/api/axes_divider_api.txt deleted file mode 100644 index fc090530e66..00000000000 --- a/_sources/mpl_toolkits/axes_grid/api/axes_divider_api.txt +++ /dev/null @@ -1,18 +0,0 @@ - -:mod:`mpl_toolkits.axes_grid.axes_divider` -========================================== - -.. autoclass:: mpl_toolkits.axes_grid.axes_divider.Divider - :members: - :undoc-members: - - -.. autoclass:: mpl_toolkits.axes_grid.axes_divider.AxesLocator - :members: - :undoc-members: - -.. autoclass:: mpl_toolkits.axes_grid.axes_divider.SubplotDivider - :members: - -.. autoclass:: mpl_toolkits.axes_grid.axes_divider.AxesDivider - :members: diff --git a/_sources/mpl_toolkits/axes_grid/api/axes_grid_api.rst.txt b/_sources/mpl_toolkits/axes_grid/api/axes_grid_api.rst.txt deleted file mode 100644 index 15fa8bd2a2c..00000000000 --- a/_sources/mpl_toolkits/axes_grid/api/axes_grid_api.rst.txt +++ /dev/null @@ -1,11 +0,0 @@ - -:mod:`mpl_toolkits.axes_grid.axes_grid` -======================================= - -.. autoclass:: mpl_toolkits.axes_grid.axes_grid.Grid - :members: - :undoc-members: - -.. autoclass:: mpl_toolkits.axes_grid.axes_grid.ImageGrid - :members: - :undoc-members: diff --git a/_sources/mpl_toolkits/axes_grid/api/axes_grid_api.txt b/_sources/mpl_toolkits/axes_grid/api/axes_grid_api.txt deleted file mode 100644 index 15fa8bd2a2c..00000000000 --- a/_sources/mpl_toolkits/axes_grid/api/axes_grid_api.txt +++ /dev/null @@ -1,11 +0,0 @@ - -:mod:`mpl_toolkits.axes_grid.axes_grid` -======================================= - -.. autoclass:: mpl_toolkits.axes_grid.axes_grid.Grid - :members: - :undoc-members: - -.. autoclass:: mpl_toolkits.axes_grid.axes_grid.ImageGrid - :members: - :undoc-members: diff --git a/_sources/mpl_toolkits/axes_grid/api/axes_size_api.rst.txt b/_sources/mpl_toolkits/axes_grid/api/axes_size_api.rst.txt deleted file mode 100644 index 1238bfd903b..00000000000 --- a/_sources/mpl_toolkits/axes_grid/api/axes_size_api.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -:mod:`mpl_toolkits.axes_grid.axes_size` -======================================= - -.. automodule:: mpl_toolkits.axes_grid.axes_size - :members: Fixed, Scaled, AxesX, AxesY, MaxWidth, MaxHeight, Fraction, Padded, from_any - diff --git a/_sources/mpl_toolkits/axes_grid/api/axes_size_api.txt b/_sources/mpl_toolkits/axes_grid/api/axes_size_api.txt deleted file mode 100644 index 1238bfd903b..00000000000 --- a/_sources/mpl_toolkits/axes_grid/api/axes_size_api.txt +++ /dev/null @@ -1,6 +0,0 @@ -:mod:`mpl_toolkits.axes_grid.axes_size` -======================================= - -.. automodule:: mpl_toolkits.axes_grid.axes_size - :members: Fixed, Scaled, AxesX, AxesY, MaxWidth, MaxHeight, Fraction, Padded, from_any - diff --git a/_sources/mpl_toolkits/axes_grid/api/axis_artist_api.rst.txt b/_sources/mpl_toolkits/axes_grid/api/axis_artist_api.rst.txt deleted file mode 100644 index f18a52daab6..00000000000 --- a/_sources/mpl_toolkits/axes_grid/api/axis_artist_api.rst.txt +++ /dev/null @@ -1,16 +0,0 @@ - -:mod:`mpl_toolkits.axes_grid.axis_artist` -========================================= - -.. autoclass:: mpl_toolkits.axes_grid.axis_artist.AxisArtist - :members: - :undoc-members: - -.. autoclass:: mpl_toolkits.axes_grid.axis_artist.Ticks - :members: - -.. autoclass:: mpl_toolkits.axes_grid.axis_artist.AxisLabel - :members: - -.. autoclass:: mpl_toolkits.axes_grid.axis_artist.TickLabels - :members: diff --git a/_sources/mpl_toolkits/axes_grid/api/axis_artist_api.txt b/_sources/mpl_toolkits/axes_grid/api/axis_artist_api.txt deleted file mode 100644 index f18a52daab6..00000000000 --- a/_sources/mpl_toolkits/axes_grid/api/axis_artist_api.txt +++ /dev/null @@ -1,16 +0,0 @@ - -:mod:`mpl_toolkits.axes_grid.axis_artist` -========================================= - -.. autoclass:: mpl_toolkits.axes_grid.axis_artist.AxisArtist - :members: - :undoc-members: - -.. autoclass:: mpl_toolkits.axes_grid.axis_artist.Ticks - :members: - -.. autoclass:: mpl_toolkits.axes_grid.axis_artist.AxisLabel - :members: - -.. autoclass:: mpl_toolkits.axes_grid.axis_artist.TickLabels - :members: diff --git a/_sources/mpl_toolkits/axes_grid/api/index.rst.txt b/_sources/mpl_toolkits/axes_grid/api/index.rst.txt deleted file mode 100644 index 672336ee2db..00000000000 --- a/_sources/mpl_toolkits/axes_grid/api/index.rst.txt +++ /dev/null @@ -1,28 +0,0 @@ -.. _axes_grid-api-index: - -####################################### - The Matplotlib AxesGrid Toolkit API -####################################### - -:Release: |version| -:Date: |today| - -.. toctree:: - - axes_size_api.rst - axes_divider_api.rst - axes_grid_api.rst - axis_artist_api.rst - - -####################################### - The Matplotlib axes_grid1 Toolkit API -####################################### - -:Release: |version| -:Date: |today| - -.. toctree:: - - anchored_artists_api.rst - inset_locator_api.rst diff --git a/_sources/mpl_toolkits/axes_grid/api/index.txt b/_sources/mpl_toolkits/axes_grid/api/index.txt deleted file mode 100644 index 0e5975592c4..00000000000 --- a/_sources/mpl_toolkits/axes_grid/api/index.txt +++ /dev/null @@ -1,27 +0,0 @@ -.. _axes_grid-api-index: - -####################################### - The Matplotlib AxesGrid Toolkit API -####################################### - -:Release: |version| -:Date: |today| - -.. toctree:: - - axes_size_api.rst - axes_divider_api.rst - axes_grid_api.rst - axis_artist_api.rst - - -####################################### - The Matplotlib axes_grid1 Toolkit API -####################################### - -:Release: |version| -:Date: |today| - -.. toctree:: - - inset_locator_api.rst diff --git a/_sources/mpl_toolkits/axes_grid/api/inset_locator_api.rst.txt b/_sources/mpl_toolkits/axes_grid/api/inset_locator_api.rst.txt deleted file mode 100644 index c9c1bfbbb49..00000000000 --- a/_sources/mpl_toolkits/axes_grid/api/inset_locator_api.rst.txt +++ /dev/null @@ -1,7 +0,0 @@ -:mod:`mpl_toolkits.axes_grid1.inset_locator` -============================================ - -.. automodule:: mpl_toolkits.axes_grid1.inset_locator - :members: - :undoc-members: - :show-inheritance: diff --git a/_sources/mpl_toolkits/axes_grid/api/inset_locator_api.txt b/_sources/mpl_toolkits/axes_grid/api/inset_locator_api.txt deleted file mode 100644 index c9c1bfbbb49..00000000000 --- a/_sources/mpl_toolkits/axes_grid/api/inset_locator_api.txt +++ /dev/null @@ -1,7 +0,0 @@ -:mod:`mpl_toolkits.axes_grid1.inset_locator` -============================================ - -.. automodule:: mpl_toolkits.axes_grid1.inset_locator - :members: - :undoc-members: - :show-inheritance: diff --git a/_sources/mpl_toolkits/axes_grid/index.rst.txt b/_sources/mpl_toolkits/axes_grid/index.rst.txt deleted file mode 100644 index 90f223c8436..00000000000 --- a/_sources/mpl_toolkits/axes_grid/index.rst.txt +++ /dev/null @@ -1,36 +0,0 @@ - -.. _toolkit_axesgrid-index: - -Matplotlib AxesGrid Toolkit -=========================== - -The matplotlib AxesGrid toolkit is a collection of helper classes to -ease displaying multiple images in matplotlib. While the aspect -parameter in matplotlib adjust the position of the single axes, -AxesGrid toolkit provides a framework to adjust the position of -multiple axes according to their aspects. - - -.. image:: ../../_static/demo_axes_grid.png - -.. note:: - AxesGrid toolkit has been a part of matplotlib since v - 0.99. Originally, the toolkit had a single namespace of - *axes_grid*. In more recent version (since svn r8226), the toolkit - has divided into two separate namespace (*axes_grid1* and *axisartist*). - While *axes_grid* namespace is maintained for the backward compatibility, - use of *axes_grid1* and *axisartist* is recommended. - -.. warning:: - *axes_grid* and *axisartist* (but not *axes_grid1*) uses - a custom Axes class (derived from the mpl's original Axes class). - As a side effect, some commands (mostly tick-related) do not work. - Use *axes_grid1* to avoid this, or see how things are different in - *axes_grid* and *axisartist* (LINK needed) - -.. toctree:: - :maxdepth: 2 - - users/overview.rst - users/index.rst - api/index.rst diff --git a/_sources/mpl_toolkits/axes_grid/index.txt b/_sources/mpl_toolkits/axes_grid/index.txt deleted file mode 100644 index 90f223c8436..00000000000 --- a/_sources/mpl_toolkits/axes_grid/index.txt +++ /dev/null @@ -1,36 +0,0 @@ - -.. _toolkit_axesgrid-index: - -Matplotlib AxesGrid Toolkit -=========================== - -The matplotlib AxesGrid toolkit is a collection of helper classes to -ease displaying multiple images in matplotlib. While the aspect -parameter in matplotlib adjust the position of the single axes, -AxesGrid toolkit provides a framework to adjust the position of -multiple axes according to their aspects. - - -.. image:: ../../_static/demo_axes_grid.png - -.. note:: - AxesGrid toolkit has been a part of matplotlib since v - 0.99. Originally, the toolkit had a single namespace of - *axes_grid*. In more recent version (since svn r8226), the toolkit - has divided into two separate namespace (*axes_grid1* and *axisartist*). - While *axes_grid* namespace is maintained for the backward compatibility, - use of *axes_grid1* and *axisartist* is recommended. - -.. warning:: - *axes_grid* and *axisartist* (but not *axes_grid1*) uses - a custom Axes class (derived from the mpl's original Axes class). - As a side effect, some commands (mostly tick-related) do not work. - Use *axes_grid1* to avoid this, or see how things are different in - *axes_grid* and *axisartist* (LINK needed) - -.. toctree:: - :maxdepth: 2 - - users/overview.rst - users/index.rst - api/index.rst diff --git a/_sources/mpl_toolkits/axes_grid/users/axes_divider.rst.txt b/_sources/mpl_toolkits/axes_grid/users/axes_divider.rst.txt deleted file mode 100644 index fe0b782306c..00000000000 --- a/_sources/mpl_toolkits/axes_grid/users/axes_divider.rst.txt +++ /dev/null @@ -1,93 +0,0 @@ -AxesDivider -=========== - -The axes_divider module provide helper classes to adjust the axes -positions of set of images in the drawing time. - -* :mod:`~mpl_toolkits.axes_grid.axes_size` provides a classes of - units that the size of each axes will be determined. For example, - you can specify a fixed size - -* :class:`~mpl_toolkits.axes_grid.axes_size.Divider` this is the class - that is used calculates the axes position. It divides the given - rectangular area into several areas. You initialize the divider by - setting the horizontal and vertical list of sizes that the division - will be based on. You then use the new_locator method, whose return - value is a callable object that can be used to set the axes_locator - of the axes. - - -You first initialize the divider by specifying its grids, i.e., -horizontal and vertical. - -for example,:: - - rect = [0.2, 0.2, 0.6, 0.6] - horiz=[h0, h1, h2, h3] - vert=[v0, v1, v2] - divider = Divider(fig, rect, horiz, vert) - -where, rect is a bounds of the box that will be divided and h0,..h3, -v0,..v2 need to be an instance of classes in the -:mod:`~mpl_toolkits.axes_grid.axes_size`. They have *get_size* method -that returns a tuple of two floats. The first float is the relative -size, and the second float is the absolute size. Consider a following -grid. - -+-----+-----+-----+-----+ -| v0 | | | | -+-----+-----+-----+-----+ -| v1 | | | | -+-----+-----+-----+-----+ -|h0,v2| h1 | h2 | h3 | -+-----+-----+-----+-----+ - - -* v0 => 0, 2 -* v1 => 2, 0 -* v2 => 3, 0 - -The height of the bottom row is always 2 (axes_divider internally -assumes that the unit is inch). The first and the second rows with -height ratio of 2:3. For example, if the total height of the grid 6, -then the first and second row will each occupy 2/(2+3) and 3/(2+3) of -(6-1) inches. The widths of columns (horiz) will be similarly -determined. When aspect ratio is set, the total height (or width) will -be adjusted accordingly. - - -The :mod:`mpl_toolkits.axes_grid.axes_size` contains several classes -that can be used to set the horizontal and vertical configurations. For -example, for the vertical configuration above will be:: - - from mpl_toolkits.axes_grid.axes_size import Fixed, Scaled - vert = [Fixed(2), Scaled(2), Scaled(3)] - -After you set up the divider object, then you create a locator -instance which will be given to the axes.:: - - locator = divider.new_locator(nx=0, ny=1) - ax.set_axes_locator(locator) - -The return value of the new_locator method is a instance of the -AxesLocator class. It is a callable object that returns the -location and size of the cell at the first column and the second row. -You may create a locator that spans over multiple cells.:: - - locator = divider.new_locator(nx=0, nx=2, ny=1) - -The above locator, when called, will return the position and size of -the cells spanning the first and second column and the first row. You -may consider it as [0:2, 1]. - -See the example, - -.. plot:: mpl_toolkits/axes_grid/figures/simple_axes_divider2.py - :include-source: - -You can adjust the size of the each axes according to their x or y -data limits (AxesX and AxesY), similar to the axes aspect parameter. - -.. plot:: mpl_toolkits/axes_grid/figures/simple_axes_divider3.py - :include-source: - diff --git a/_sources/mpl_toolkits/axes_grid/users/axes_divider.txt b/_sources/mpl_toolkits/axes_grid/users/axes_divider.txt deleted file mode 100644 index fe0b782306c..00000000000 --- a/_sources/mpl_toolkits/axes_grid/users/axes_divider.txt +++ /dev/null @@ -1,93 +0,0 @@ -AxesDivider -=========== - -The axes_divider module provide helper classes to adjust the axes -positions of set of images in the drawing time. - -* :mod:`~mpl_toolkits.axes_grid.axes_size` provides a classes of - units that the size of each axes will be determined. For example, - you can specify a fixed size - -* :class:`~mpl_toolkits.axes_grid.axes_size.Divider` this is the class - that is used calculates the axes position. It divides the given - rectangular area into several areas. You initialize the divider by - setting the horizontal and vertical list of sizes that the division - will be based on. You then use the new_locator method, whose return - value is a callable object that can be used to set the axes_locator - of the axes. - - -You first initialize the divider by specifying its grids, i.e., -horizontal and vertical. - -for example,:: - - rect = [0.2, 0.2, 0.6, 0.6] - horiz=[h0, h1, h2, h3] - vert=[v0, v1, v2] - divider = Divider(fig, rect, horiz, vert) - -where, rect is a bounds of the box that will be divided and h0,..h3, -v0,..v2 need to be an instance of classes in the -:mod:`~mpl_toolkits.axes_grid.axes_size`. They have *get_size* method -that returns a tuple of two floats. The first float is the relative -size, and the second float is the absolute size. Consider a following -grid. - -+-----+-----+-----+-----+ -| v0 | | | | -+-----+-----+-----+-----+ -| v1 | | | | -+-----+-----+-----+-----+ -|h0,v2| h1 | h2 | h3 | -+-----+-----+-----+-----+ - - -* v0 => 0, 2 -* v1 => 2, 0 -* v2 => 3, 0 - -The height of the bottom row is always 2 (axes_divider internally -assumes that the unit is inch). The first and the second rows with -height ratio of 2:3. For example, if the total height of the grid 6, -then the first and second row will each occupy 2/(2+3) and 3/(2+3) of -(6-1) inches. The widths of columns (horiz) will be similarly -determined. When aspect ratio is set, the total height (or width) will -be adjusted accordingly. - - -The :mod:`mpl_toolkits.axes_grid.axes_size` contains several classes -that can be used to set the horizontal and vertical configurations. For -example, for the vertical configuration above will be:: - - from mpl_toolkits.axes_grid.axes_size import Fixed, Scaled - vert = [Fixed(2), Scaled(2), Scaled(3)] - -After you set up the divider object, then you create a locator -instance which will be given to the axes.:: - - locator = divider.new_locator(nx=0, ny=1) - ax.set_axes_locator(locator) - -The return value of the new_locator method is a instance of the -AxesLocator class. It is a callable object that returns the -location and size of the cell at the first column and the second row. -You may create a locator that spans over multiple cells.:: - - locator = divider.new_locator(nx=0, nx=2, ny=1) - -The above locator, when called, will return the position and size of -the cells spanning the first and second column and the first row. You -may consider it as [0:2, 1]. - -See the example, - -.. plot:: mpl_toolkits/axes_grid/figures/simple_axes_divider2.py - :include-source: - -You can adjust the size of the each axes according to their x or y -data limits (AxesX and AxesY), similar to the axes aspect parameter. - -.. plot:: mpl_toolkits/axes_grid/figures/simple_axes_divider3.py - :include-source: - diff --git a/_sources/mpl_toolkits/axes_grid/users/axisartist.rst.txt b/_sources/mpl_toolkits/axes_grid/users/axisartist.rst.txt deleted file mode 100644 index 67cdf64ecfa..00000000000 --- a/_sources/mpl_toolkits/axes_grid/users/axisartist.rst.txt +++ /dev/null @@ -1,457 +0,0 @@ -.. _axisartist-manual: - -==================== -AXISARTIST namespace -==================== - -The AxisArtist namespace includes a derived Axes implementation. The -biggest difference is that the artists responsible to draw axis line, -ticks, ticklabel and axis labels are separated out from the mpl's Axis -class, which are much more than artists in the original mpl. This -change was strongly motivated to support curvilinear grid. Here are a -few things that mpl_tootlkits.axisartist.Axes is different from original -Axes from mpl. - -* Axis elements (axis line(spine), ticks, ticklabel and axis labels) - are drawn by a AxisArtist instance. Unlike Axis, left, right, top - and bottom axis are drawn by separate artists. And each of them may - have different tick location and different tick labels. - -* gridlines are drawn by a Gridlines instance. The change was - motivated that in curvilinear coordinate, a gridline may not cross - axis-lines (i.e., no associated ticks). In the original Axes class, - gridlines are tied to ticks. - -* ticklines can be rotated if necessary (i.e, along the gridlines) - -In summary, all these changes was to support - -* a curvilinear grid. -* a floating axis - -.. plot:: mpl_toolkits/axes_grid/examples/demo_floating_axis.py - - -*mpl_toolkits.axisartist.Axes* class defines a *axis* attribute, which -is a dictionary of AxisArtist instances. By default, the dictionary -has 4 AxisArtist instances, responsible for drawing of left, right, -bottom and top axis. - -xaxis and yaxis attributes are still available, however they are set -to not visible. As separate artists are used for rendering axis, some -axis-related method in mpl may have no effect. -In addition to AxisArtist instances, the mpl_toolkits.axisartist.Axes will -have *gridlines* attribute (Gridlines), which obviously draws grid -lines. - -In both AxisArtist and Gridlines, the calculation of tick and grid -location is delegated to an instance of GridHelper class. -mpl_toolkits.axisartist.Axes class uses GridHelperRectlinear as a grid -helper. The GridHelperRectlinear class is a wrapper around the *xaxis* -and *yaxis* of mpl's original Axes, and it was meant to work as the -way how mpl's original axes works. For example, tick location changes -using set_ticks method and etc. should work as expected. But change in -artist properties (e.g., color) will not work in general, although -some effort has been made so that some often-change attributes (color, -etc.) are respected. - - -AxisArtist -========== - -AxisArtist can be considered as a container artist with following -attributes which will draw ticks, labels, etc. - - * line - * major_ticks, major_ticklabels - * minor_ticks, minor_ticklabels - * offsetText - * label - - -line ----- - -Derived from Line2d class. Responsible for drawing a spinal(?) line. - -major_ticks, minor_ticks ------------------------- - -Derived from Line2d class. Note that ticks are markers. - - -major_ticklabels, minor_ticklabels ----------------------------------- - -Derived from Text. Note that it is not a list of Text artist, but a -single artist (similar to a collection). - -axislabel ---------- - -Derived from Text. - - -Default AxisArtists -------------------- - -By default, following for axis artists are defined.:: - - ax.axis["left"], ax.axis["bottom"], ax.axis["right"], ax.axis["top"] - -The ticklabels and axislabel of the top and the right axis are set to -not visible. - -For example, if you want to change the color attributes of -major_ticklabels of the bottom x-axis :: - - ax.axis["bottom"].major_ticklabels.set_color("b") - -Similarly, to make ticklabels invisible :: - - ax.axis["bottom"].major_ticklabels.set_visible(False) - -AxisAritst provides a helper method to control the visibility of ticks, -ticklabels, and label. To make ticklabel invisible, :: - - ax.axis["bottom"].toggle(ticklabels=False) - -To make all of ticks, ticklabels, and (axis) label invisible :: - - ax.axis["bottom"].toggle(all=False) - -To turn all off but ticks on :: - - ax.axis["bottom"].toggle(all=False, ticks=True) - -To turn all on but (axis) label off :: - - ax.axis["bottom"].toggle(all=True, label=False)) - - -ax.axis's __getitem__ method can take multiple axis names. For -example, to turn ticklabels of "top" and "right" axis on, :: - - ax.axis["top","right"].toggle(ticklabels=True)) - -Note that 'ax.axis["top","right"]' returns a simple proxy object that translate above code to something like below. :: - - for n in ["top","right"]: - ax.axis[n].toggle(ticklabels=True)) - -So, any return values in the for loop are ignored. And you should not -use it anything more than a simple method. - -Like the list indexing ":" means all items, i.e., :: - - ax.axis[:].major_ticks.set_color("r") - -changes tick color in all axis. - - -HowTo -===== - -1. Changing tick locations and label. - - Same as the original mpl's axes.:: - - ax.set_xticks([1,2,3]) - -2. Changing axis properties like color, etc. - - Change the properties of appropriate artists. For example, to change - the color of the ticklabels:: - - ax.axis["left"].major_ticklabels.set_color("r") - -3. To change the attributes of multiple axis:: - - ax.axis["left","bottom"].major_ticklabels.set_color("r") - - or to change the attributes of all axis:: - - ax.axis[:].major_ticklabels.set_color("r") - -4. To change the tick size (length), you need to use - axis.major_ticks.set_ticksize method. To change the direction of - the ticks (ticks are in opposite direction of ticklabels by - default), use axis.major_ticks.set_tick_out method. - - To change the pad between ticks and ticklabels, use - axis.major_ticklabels.set_pad method. - - To change the pad between ticklabels and axis label, - axis.label.set_pad method. - - -Rotation and Alignment of TickLabels -==================================== - -This is also quite different from the original mpl and can be -confusing. When you want to rotate the ticklabels, first consider -using "set_axis_direction" method. :: - - ax1.axis["left"].major_ticklabels.set_axis_direction("top") - ax1.axis["right"].label.set_axis_direction("left") - -.. plot:: mpl_toolkits/axes_grid/figures/simple_axis_direction01.py - -The parameter for set_axis_direction is one of ["left", "right", -"bottom", "top"]. - -You must understand some underlying concept of directions. - - 1. There is a reference direction which is defined as the direction - of the axis line with increasing coordinate. For example, the - reference direction of the left x-axis is from bottom to top. - - .. plot:: mpl_toolkits/axes_grid/figures/axis_direction_demo_step01.py - - The direction, text angle, and alignments of the ticks, ticklabels and - axis-label is determined with respect to the reference direction - - 2. *ticklabel_direction* is either the right-hand side (+) of the - reference direction or the left-hand side (-). - - .. plot:: mpl_toolkits/axes_grid/figures/axis_direction_demo_step02.py - - 3. same for the *label_direction* - - .. plot:: mpl_toolkits/axes_grid/figures/axis_direction_demo_step03.py - - 4. ticks are by default drawn toward the opposite direction of the ticklabels. - - 5. text rotation of ticklabels and label is determined in reference - to the *ticklabel_direction* or *label_direction*, - respectively. The rotation of ticklabels and label is anchored. - - .. plot:: mpl_toolkits/axes_grid/figures/axis_direction_demo_step04.py - - -On the other hand, there is a concept of "axis_direction". This is a -default setting of above properties for each, "bottom", "left", "top", -and "right" axis. - - ========== =========== ========= ========== ========= ========== - ? ? left bottom right top - ---------- ----------- --------- ---------- --------- ---------- - axislabel direction '-' '+' '+' '-' - axislabel rotation 180 0 0 180 - axislabel va center top center bottom - axislabel ha right center right center - ticklabel direction '-' '+' '+' '-' - ticklabels rotation 90 0 -90 180 - ticklabel ha right center right center - ticklabel va center baseline center baseline - ========== =========== ========= ========== ========= ========== - - -And, 'set_axis_direction("top")' means to adjust the text rotation -etc, for settings suitable for "top" axis. The concept of axis -direction can be more clear with curved axis. - -.. plot:: mpl_toolkits/axes_grid/figures/demo_axis_direction.py - -The axis_direction can be adjusted in the AxisArtist level, or in the -level of its child arists, i.e., ticks, ticklabels, and axis-label. :: - - ax1.axis["left"].set_axis_direction("top") - -changes axis_direction of all the associated artist with the "left" -axis, while :: - - ax1.axis["left"].major_ticklabels.set_axis_direction("top") - -changes the axis_direction of only the major_ticklabels. Note that -set_axis_direction in the AxisArtist level changes the -ticklabel_direction and label_direction, while changing the -axis_direction of ticks, ticklabels, and axis-label does not affect -them. - - -If you want to make ticks outward and ticklabels inside the axes, -use invert_ticklabel_direction method. :: - - ax.axis[:].invert_ticklabel_direction() - -A related method is "set_tick_out". It makes ticks outward (as a -matter of fact, it makes ticks toward the opposite direction of the -default direction). :: - - ax.axis[:].major_ticks.set_tick_out(True) - -.. plot:: mpl_toolkits/axes_grid/figures/simple_axis_direction03.py - - -So, in summary, - - * AxisArtist's methods - * set_axis_direction : "left", "right", "bottom", or "top" - * set_ticklabel_direction : "+" or "-" - * set_axislabel_direction : "+" or "-" - * invert_ticklabel_direction - * Ticks' methods (major_ticks and minor_ticks) - * set_tick_out : True or False - * set_ticksize : size in points - * TickLabels' methods (major_ticklabels and minor_ticklabels) - * set_axis_direction : "left", "right", "bottom", or "top" - * set_rotation : angle with respect to the reference direction - * set_ha and set_va : see below - * AxisLabels' methods (label) - * set_axis_direction : "left", "right", "bottom", or "top" - * set_rotation : angle with respect to the reference direction - * set_ha and set_va - - - -Adjusting ticklabels alignment ------------------------------- - -Alignment of TickLabels are treated specially. See below - -.. plot:: mpl_toolkits/axes_grid/figures/demo_ticklabel_alignment.py - -Adjusting pad --------------- - -To change the pad between ticks and ticklabels :: - - ax.axis["left"].major_ticklabels.set_pad(10) - -Or ticklabels and axis-label :: - - ax.axis["left"].label.set_pad(10) - - -.. plot:: mpl_toolkits/axes_grid/figures/simple_axis_pad.py - - -GridHelper -========== - -To actually define a curvilinear coordinate, you have to use your own -grid helper. A generalised version of grid helper class is supplied -and this class should suffice in most of cases. A user may provide -two functions which defines a transformation (and its inverse pair) -from the curved coordinate to (rectilinear) image coordinate. Note that -while ticks and grids are drawn for curved coordinate, the data -transform of the axes itself (ax.transData) is still rectilinear -(image) coordinate. :: - - - from mpl_toolkits.axisartist.grid_helper_curvelinear \ - import GridHelperCurveLinear - from mpl_toolkits.axisartist import Subplot - - # from curved coordinate to rectlinear coordinate. - def tr(x, y): - x, y = np.asarray(x), np.asarray(y) - return x, y-x - - # from rectlinear coordinate to curved coordinate. - def inv_tr(x,y): - x, y = np.asarray(x), np.asarray(y) - return x, y+x - - - grid_helper = GridHelperCurveLinear((tr, inv_tr)) - - ax1 = Subplot(fig, 1, 1, 1, grid_helper=grid_helper) - - fig.add_subplot(ax1) - - -You may use matplotlib's Transform instance instead (but a -inverse transformation must be defined). Often, coordinate range in a -curved coordinate system may have a limited range, or may have -cycles. In those cases, a more customized version of grid helper is -required. :: - - - import mpl_toolkits.axisartist.angle_helper as angle_helper - - # PolarAxes.PolarTransform takes radian. However, we want our coordinate - # system in degree - tr = Affine2D().scale(np.pi/180., 1.) + PolarAxes.PolarTransform() - - - # extreme finder : find a range of coordinate. - # 20, 20 : number of sampling points along x, y direction - # The first coordinate (longitude, but theta in polar) - # has a cycle of 360 degree. - # The second coordinate (latitude, but radius in polar) has a minimum of 0 - extreme_finder = angle_helper.ExtremeFinderCycle(20, 20, - lon_cycle = 360, - lat_cycle = None, - lon_minmax = None, - lat_minmax = (0, np.inf), - ) - - # Find a grid values appropriate for the coordinate (degree, - # minute, second). The argument is a approximate number of grids. - grid_locator1 = angle_helper.LocatorDMS(12) - - # And also uses an appropriate formatter. Note that,the - # acceptable Locator and Formatter class is a bit different than - # that of mpl's, and you cannot directly use mpl's Locator and - # Formatter here (but may be possible in the future). - tick_formatter1 = angle_helper.FormatterDMS() - - grid_helper = GridHelperCurveLinear(tr, - extreme_finder=extreme_finder, - grid_locator1=grid_locator1, - tick_formatter1=tick_formatter1 - ) - - -Again, the *transData* of the axes is still a rectilinear coordinate -(image coordinate). You may manually do conversion between two -coordinates, or you may use Parasite Axes for convenience.:: - - ax1 = SubplotHost(fig, 1, 2, 2, grid_helper=grid_helper) - - # A parasite axes with given transform - ax2 = ParasiteAxesAuxTrans(ax1, tr, "equal") - # note that ax2.transData == tr + ax1.transData - # Anthing you draw in ax2 will match the ticks and grids of ax1. - ax1.parasites.append(ax2) - - -.. plot:: mpl_toolkits/axes_grid/examples/demo_curvelinear_grid.py - - - -FloatingAxis -============ - -A floating axis is an axis one of whose data coordinate is fixed, i.e, -its location is not fixed in Axes coordinate but changes as axes data -limits changes. A floating axis can be created using -*new_floating_axis* method. However, it is your responsibility that -the resulting AxisArtist is properly added to the axes. A recommended -way is to add it as an item of Axes's axis attribute.:: - - # floating axis whose first (index starts from 0) coordinate - # (theta) is fixed at 60 - - ax1.axis["lat"] = axis = ax1.new_floating_axis(0, 60) - axis.label.set_text(r"$\theta = 60^{\circ}$") - axis.label.set_visible(True) - - -See the first example of this page. - -Current Limitations and TODO's -============================== - -The code need more refinement. Here is a incomplete list of issues and TODO's - -* No easy way to support a user customized tick location (for - curvilinear grid). A new Locator class needs to be created. - -* FloatingAxis may have coordinate limits, e.g., a floating axis of x - = 0, but y only spans from 0 to 1. - -* The location of axislabel of FloatingAxis needs to be optionally - given as a coordinate value. ex, a floating axis of x=0 with label at y=1 diff --git a/_sources/mpl_toolkits/axes_grid/users/axisartist.txt b/_sources/mpl_toolkits/axes_grid/users/axisartist.txt deleted file mode 100644 index 67cdf64ecfa..00000000000 --- a/_sources/mpl_toolkits/axes_grid/users/axisartist.txt +++ /dev/null @@ -1,457 +0,0 @@ -.. _axisartist-manual: - -==================== -AXISARTIST namespace -==================== - -The AxisArtist namespace includes a derived Axes implementation. The -biggest difference is that the artists responsible to draw axis line, -ticks, ticklabel and axis labels are separated out from the mpl's Axis -class, which are much more than artists in the original mpl. This -change was strongly motivated to support curvilinear grid. Here are a -few things that mpl_tootlkits.axisartist.Axes is different from original -Axes from mpl. - -* Axis elements (axis line(spine), ticks, ticklabel and axis labels) - are drawn by a AxisArtist instance. Unlike Axis, left, right, top - and bottom axis are drawn by separate artists. And each of them may - have different tick location and different tick labels. - -* gridlines are drawn by a Gridlines instance. The change was - motivated that in curvilinear coordinate, a gridline may not cross - axis-lines (i.e., no associated ticks). In the original Axes class, - gridlines are tied to ticks. - -* ticklines can be rotated if necessary (i.e, along the gridlines) - -In summary, all these changes was to support - -* a curvilinear grid. -* a floating axis - -.. plot:: mpl_toolkits/axes_grid/examples/demo_floating_axis.py - - -*mpl_toolkits.axisartist.Axes* class defines a *axis* attribute, which -is a dictionary of AxisArtist instances. By default, the dictionary -has 4 AxisArtist instances, responsible for drawing of left, right, -bottom and top axis. - -xaxis and yaxis attributes are still available, however they are set -to not visible. As separate artists are used for rendering axis, some -axis-related method in mpl may have no effect. -In addition to AxisArtist instances, the mpl_toolkits.axisartist.Axes will -have *gridlines* attribute (Gridlines), which obviously draws grid -lines. - -In both AxisArtist and Gridlines, the calculation of tick and grid -location is delegated to an instance of GridHelper class. -mpl_toolkits.axisartist.Axes class uses GridHelperRectlinear as a grid -helper. The GridHelperRectlinear class is a wrapper around the *xaxis* -and *yaxis* of mpl's original Axes, and it was meant to work as the -way how mpl's original axes works. For example, tick location changes -using set_ticks method and etc. should work as expected. But change in -artist properties (e.g., color) will not work in general, although -some effort has been made so that some often-change attributes (color, -etc.) are respected. - - -AxisArtist -========== - -AxisArtist can be considered as a container artist with following -attributes which will draw ticks, labels, etc. - - * line - * major_ticks, major_ticklabels - * minor_ticks, minor_ticklabels - * offsetText - * label - - -line ----- - -Derived from Line2d class. Responsible for drawing a spinal(?) line. - -major_ticks, minor_ticks ------------------------- - -Derived from Line2d class. Note that ticks are markers. - - -major_ticklabels, minor_ticklabels ----------------------------------- - -Derived from Text. Note that it is not a list of Text artist, but a -single artist (similar to a collection). - -axislabel ---------- - -Derived from Text. - - -Default AxisArtists -------------------- - -By default, following for axis artists are defined.:: - - ax.axis["left"], ax.axis["bottom"], ax.axis["right"], ax.axis["top"] - -The ticklabels and axislabel of the top and the right axis are set to -not visible. - -For example, if you want to change the color attributes of -major_ticklabels of the bottom x-axis :: - - ax.axis["bottom"].major_ticklabels.set_color("b") - -Similarly, to make ticklabels invisible :: - - ax.axis["bottom"].major_ticklabels.set_visible(False) - -AxisAritst provides a helper method to control the visibility of ticks, -ticklabels, and label. To make ticklabel invisible, :: - - ax.axis["bottom"].toggle(ticklabels=False) - -To make all of ticks, ticklabels, and (axis) label invisible :: - - ax.axis["bottom"].toggle(all=False) - -To turn all off but ticks on :: - - ax.axis["bottom"].toggle(all=False, ticks=True) - -To turn all on but (axis) label off :: - - ax.axis["bottom"].toggle(all=True, label=False)) - - -ax.axis's __getitem__ method can take multiple axis names. For -example, to turn ticklabels of "top" and "right" axis on, :: - - ax.axis["top","right"].toggle(ticklabels=True)) - -Note that 'ax.axis["top","right"]' returns a simple proxy object that translate above code to something like below. :: - - for n in ["top","right"]: - ax.axis[n].toggle(ticklabels=True)) - -So, any return values in the for loop are ignored. And you should not -use it anything more than a simple method. - -Like the list indexing ":" means all items, i.e., :: - - ax.axis[:].major_ticks.set_color("r") - -changes tick color in all axis. - - -HowTo -===== - -1. Changing tick locations and label. - - Same as the original mpl's axes.:: - - ax.set_xticks([1,2,3]) - -2. Changing axis properties like color, etc. - - Change the properties of appropriate artists. For example, to change - the color of the ticklabels:: - - ax.axis["left"].major_ticklabels.set_color("r") - -3. To change the attributes of multiple axis:: - - ax.axis["left","bottom"].major_ticklabels.set_color("r") - - or to change the attributes of all axis:: - - ax.axis[:].major_ticklabels.set_color("r") - -4. To change the tick size (length), you need to use - axis.major_ticks.set_ticksize method. To change the direction of - the ticks (ticks are in opposite direction of ticklabels by - default), use axis.major_ticks.set_tick_out method. - - To change the pad between ticks and ticklabels, use - axis.major_ticklabels.set_pad method. - - To change the pad between ticklabels and axis label, - axis.label.set_pad method. - - -Rotation and Alignment of TickLabels -==================================== - -This is also quite different from the original mpl and can be -confusing. When you want to rotate the ticklabels, first consider -using "set_axis_direction" method. :: - - ax1.axis["left"].major_ticklabels.set_axis_direction("top") - ax1.axis["right"].label.set_axis_direction("left") - -.. plot:: mpl_toolkits/axes_grid/figures/simple_axis_direction01.py - -The parameter for set_axis_direction is one of ["left", "right", -"bottom", "top"]. - -You must understand some underlying concept of directions. - - 1. There is a reference direction which is defined as the direction - of the axis line with increasing coordinate. For example, the - reference direction of the left x-axis is from bottom to top. - - .. plot:: mpl_toolkits/axes_grid/figures/axis_direction_demo_step01.py - - The direction, text angle, and alignments of the ticks, ticklabels and - axis-label is determined with respect to the reference direction - - 2. *ticklabel_direction* is either the right-hand side (+) of the - reference direction or the left-hand side (-). - - .. plot:: mpl_toolkits/axes_grid/figures/axis_direction_demo_step02.py - - 3. same for the *label_direction* - - .. plot:: mpl_toolkits/axes_grid/figures/axis_direction_demo_step03.py - - 4. ticks are by default drawn toward the opposite direction of the ticklabels. - - 5. text rotation of ticklabels and label is determined in reference - to the *ticklabel_direction* or *label_direction*, - respectively. The rotation of ticklabels and label is anchored. - - .. plot:: mpl_toolkits/axes_grid/figures/axis_direction_demo_step04.py - - -On the other hand, there is a concept of "axis_direction". This is a -default setting of above properties for each, "bottom", "left", "top", -and "right" axis. - - ========== =========== ========= ========== ========= ========== - ? ? left bottom right top - ---------- ----------- --------- ---------- --------- ---------- - axislabel direction '-' '+' '+' '-' - axislabel rotation 180 0 0 180 - axislabel va center top center bottom - axislabel ha right center right center - ticklabel direction '-' '+' '+' '-' - ticklabels rotation 90 0 -90 180 - ticklabel ha right center right center - ticklabel va center baseline center baseline - ========== =========== ========= ========== ========= ========== - - -And, 'set_axis_direction("top")' means to adjust the text rotation -etc, for settings suitable for "top" axis. The concept of axis -direction can be more clear with curved axis. - -.. plot:: mpl_toolkits/axes_grid/figures/demo_axis_direction.py - -The axis_direction can be adjusted in the AxisArtist level, or in the -level of its child arists, i.e., ticks, ticklabels, and axis-label. :: - - ax1.axis["left"].set_axis_direction("top") - -changes axis_direction of all the associated artist with the "left" -axis, while :: - - ax1.axis["left"].major_ticklabels.set_axis_direction("top") - -changes the axis_direction of only the major_ticklabels. Note that -set_axis_direction in the AxisArtist level changes the -ticklabel_direction and label_direction, while changing the -axis_direction of ticks, ticklabels, and axis-label does not affect -them. - - -If you want to make ticks outward and ticklabels inside the axes, -use invert_ticklabel_direction method. :: - - ax.axis[:].invert_ticklabel_direction() - -A related method is "set_tick_out". It makes ticks outward (as a -matter of fact, it makes ticks toward the opposite direction of the -default direction). :: - - ax.axis[:].major_ticks.set_tick_out(True) - -.. plot:: mpl_toolkits/axes_grid/figures/simple_axis_direction03.py - - -So, in summary, - - * AxisArtist's methods - * set_axis_direction : "left", "right", "bottom", or "top" - * set_ticklabel_direction : "+" or "-" - * set_axislabel_direction : "+" or "-" - * invert_ticklabel_direction - * Ticks' methods (major_ticks and minor_ticks) - * set_tick_out : True or False - * set_ticksize : size in points - * TickLabels' methods (major_ticklabels and minor_ticklabels) - * set_axis_direction : "left", "right", "bottom", or "top" - * set_rotation : angle with respect to the reference direction - * set_ha and set_va : see below - * AxisLabels' methods (label) - * set_axis_direction : "left", "right", "bottom", or "top" - * set_rotation : angle with respect to the reference direction - * set_ha and set_va - - - -Adjusting ticklabels alignment ------------------------------- - -Alignment of TickLabels are treated specially. See below - -.. plot:: mpl_toolkits/axes_grid/figures/demo_ticklabel_alignment.py - -Adjusting pad --------------- - -To change the pad between ticks and ticklabels :: - - ax.axis["left"].major_ticklabels.set_pad(10) - -Or ticklabels and axis-label :: - - ax.axis["left"].label.set_pad(10) - - -.. plot:: mpl_toolkits/axes_grid/figures/simple_axis_pad.py - - -GridHelper -========== - -To actually define a curvilinear coordinate, you have to use your own -grid helper. A generalised version of grid helper class is supplied -and this class should suffice in most of cases. A user may provide -two functions which defines a transformation (and its inverse pair) -from the curved coordinate to (rectilinear) image coordinate. Note that -while ticks and grids are drawn for curved coordinate, the data -transform of the axes itself (ax.transData) is still rectilinear -(image) coordinate. :: - - - from mpl_toolkits.axisartist.grid_helper_curvelinear \ - import GridHelperCurveLinear - from mpl_toolkits.axisartist import Subplot - - # from curved coordinate to rectlinear coordinate. - def tr(x, y): - x, y = np.asarray(x), np.asarray(y) - return x, y-x - - # from rectlinear coordinate to curved coordinate. - def inv_tr(x,y): - x, y = np.asarray(x), np.asarray(y) - return x, y+x - - - grid_helper = GridHelperCurveLinear((tr, inv_tr)) - - ax1 = Subplot(fig, 1, 1, 1, grid_helper=grid_helper) - - fig.add_subplot(ax1) - - -You may use matplotlib's Transform instance instead (but a -inverse transformation must be defined). Often, coordinate range in a -curved coordinate system may have a limited range, or may have -cycles. In those cases, a more customized version of grid helper is -required. :: - - - import mpl_toolkits.axisartist.angle_helper as angle_helper - - # PolarAxes.PolarTransform takes radian. However, we want our coordinate - # system in degree - tr = Affine2D().scale(np.pi/180., 1.) + PolarAxes.PolarTransform() - - - # extreme finder : find a range of coordinate. - # 20, 20 : number of sampling points along x, y direction - # The first coordinate (longitude, but theta in polar) - # has a cycle of 360 degree. - # The second coordinate (latitude, but radius in polar) has a minimum of 0 - extreme_finder = angle_helper.ExtremeFinderCycle(20, 20, - lon_cycle = 360, - lat_cycle = None, - lon_minmax = None, - lat_minmax = (0, np.inf), - ) - - # Find a grid values appropriate for the coordinate (degree, - # minute, second). The argument is a approximate number of grids. - grid_locator1 = angle_helper.LocatorDMS(12) - - # And also uses an appropriate formatter. Note that,the - # acceptable Locator and Formatter class is a bit different than - # that of mpl's, and you cannot directly use mpl's Locator and - # Formatter here (but may be possible in the future). - tick_formatter1 = angle_helper.FormatterDMS() - - grid_helper = GridHelperCurveLinear(tr, - extreme_finder=extreme_finder, - grid_locator1=grid_locator1, - tick_formatter1=tick_formatter1 - ) - - -Again, the *transData* of the axes is still a rectilinear coordinate -(image coordinate). You may manually do conversion between two -coordinates, or you may use Parasite Axes for convenience.:: - - ax1 = SubplotHost(fig, 1, 2, 2, grid_helper=grid_helper) - - # A parasite axes with given transform - ax2 = ParasiteAxesAuxTrans(ax1, tr, "equal") - # note that ax2.transData == tr + ax1.transData - # Anthing you draw in ax2 will match the ticks and grids of ax1. - ax1.parasites.append(ax2) - - -.. plot:: mpl_toolkits/axes_grid/examples/demo_curvelinear_grid.py - - - -FloatingAxis -============ - -A floating axis is an axis one of whose data coordinate is fixed, i.e, -its location is not fixed in Axes coordinate but changes as axes data -limits changes. A floating axis can be created using -*new_floating_axis* method. However, it is your responsibility that -the resulting AxisArtist is properly added to the axes. A recommended -way is to add it as an item of Axes's axis attribute.:: - - # floating axis whose first (index starts from 0) coordinate - # (theta) is fixed at 60 - - ax1.axis["lat"] = axis = ax1.new_floating_axis(0, 60) - axis.label.set_text(r"$\theta = 60^{\circ}$") - axis.label.set_visible(True) - - -See the first example of this page. - -Current Limitations and TODO's -============================== - -The code need more refinement. Here is a incomplete list of issues and TODO's - -* No easy way to support a user customized tick location (for - curvilinear grid). A new Locator class needs to be created. - -* FloatingAxis may have coordinate limits, e.g., a floating axis of x - = 0, but y only spans from 0 to 1. - -* The location of axislabel of FloatingAxis needs to be optionally - given as a coordinate value. ex, a floating axis of x=0 with label at y=1 diff --git a/_sources/mpl_toolkits/axes_grid/users/index.rst.txt b/_sources/mpl_toolkits/axes_grid/users/index.rst.txt deleted file mode 100644 index 9ae9dbdd74b..00000000000 --- a/_sources/mpl_toolkits/axes_grid/users/index.rst.txt +++ /dev/null @@ -1,14 +0,0 @@ -.. _axes_grid_users-guide-index: - -################################################ - The Matplotlib AxesGrid Toolkit User's Guide -################################################ - -:Release: |version| -:Date: |today| - -.. toctree:: - - axes_divider.rst - axisartist.rst - diff --git a/_sources/mpl_toolkits/axes_grid/users/index.txt b/_sources/mpl_toolkits/axes_grid/users/index.txt deleted file mode 100644 index 9ae9dbdd74b..00000000000 --- a/_sources/mpl_toolkits/axes_grid/users/index.txt +++ /dev/null @@ -1,14 +0,0 @@ -.. _axes_grid_users-guide-index: - -################################################ - The Matplotlib AxesGrid Toolkit User's Guide -################################################ - -:Release: |version| -:Date: |today| - -.. toctree:: - - axes_divider.rst - axisartist.rst - diff --git a/_sources/mpl_toolkits/axes_grid/users/overview.rst.txt b/_sources/mpl_toolkits/axes_grid/users/overview.rst.txt deleted file mode 100644 index 8a04b92ea55..00000000000 --- a/_sources/mpl_toolkits/axes_grid/users/overview.rst.txt +++ /dev/null @@ -1,480 +0,0 @@ -============================ -Overview of AxesGrid toolkit -============================ - -What is AxesGrid toolkit? -========================= - -The matplotlib AxesGrid toolkit is a collection of helper classes, -mainly to ease displaying (multiple) images in matplotlib. - -.. contents:: - :depth: 1 - :local: - -.. note:: - AxesGrid toolkit has been a part of matplotlib since v - 0.99. Originally, the toolkit had a single namespace of - *axes_grid*. In more recent version (since svn r8226), the toolkit - has divided into two separate namespace (*axes_grid1* and *axisartist*). - While *axes_grid* namespace is maintained for the backward compatibility, - use of *axes_grid1* and *axisartist* is recommended. - -.. warning:: - *axes_grid* and *axisartist* (but not *axes_grid1*) uses - a custom Axes class (derived from the mpl's original Axes class). - As a side effect, some commands (mostly tick-related) do not work. - Use *axes_grid1* to avoid this, or see how things are different in - *axes_grid* and *axisartist* (LINK needed) - - -AxesGrid toolkit has two namespaces (*axes_grid1* and *axisartist*). -*axisartist* contains custom Axes class that is meant to support for -curvilinear grids (e.g., the world coordinate system in astronomy). -Unlike mpl's original Axes class which uses Axes.xaxis and Axes.yaxis -to draw ticks, ticklines and etc., Axes in axisartist uses special -artist (AxisArtist) which can handle tick, ticklines and etc. for -curved coordinate systems. - -.. plot:: mpl_toolkits/axes_grid/examples/demo_floating_axis.py - -Since it uses a special artists, some mpl commands that work on -Axes.xaxis and Axes.yaxis may not work. See LINK for more detail. - - -*axes_grid1* is a collection of helper classes to ease displaying -(multiple) images with matplotlib. In matplotlib, the axes location -(and size) is specified in the normalized figure coordinates, which -may not be ideal for displaying images that needs to have a given -aspect ratio. For example, it helps you to have a colorbar whose -height always matches that of the image. `ImageGrid`_, `RGB Axes`_ and -`AxesDivider`_ are helper classes that deals with adjusting the -location of (multiple) Axes. They provides a framework to adjust the -position of multiple axes at the drawing time. `ParasiteAxes`_ -provides twinx(or twiny)-like features so that you can plot different -data (e.g., different y-scale) in a same Axes. `AnchoredArtists`_ -includes custom artists which are placed at some anchored position, -like the legend. - -.. plot:: mpl_toolkits/axes_grid/examples/demo_axes_grid.py - - -AXES_GRID1 -========== - -ImageGrid ---------- - - -A class that creates a grid of Axes. In matplotlib, the axes location -(and size) is specified in the normalized figure coordinates. This may -not be ideal for images that needs to be displayed with a given aspect -ratio. For example, displaying images of a same size with some fixed -padding between them cannot be easily done in matplotlib. ImageGrid is -used in such case. - -.. plot:: mpl_toolkits/axes_grid/examples/simple_axesgrid.py - :include-source: - -* The position of each axes is determined at the drawing time (see - `AxesDivider`_), so that the size of the entire grid fits in the - given rectangle (like the aspect of axes). Note that in this example, - the paddings between axes are fixed even if you changes the figure - size. - -* axes in the same column has a same axes width (in figure - coordinate), and similarly, axes in the same row has a same - height. The widths (height) of the axes in the same row (column) are - scaled according to their view limits (xlim or ylim). - - .. plot:: mpl_toolkits/axes_grid/examples/simple_axesgrid2.py - :include-source: - -* xaxis are shared among axes in a same column. Similarly, yaxis are - shared among axes in a same row. Therefore, changing axis properties - (view limits, tick location, etc. either by plot commands or using - your mouse in interactive backends) of one axes will affect all - other shared axes. - - - -When initialized, ImageGrid creates given number (*ngrids* or *ncols* * -*nrows* if *ngrids* is None) of Axes instances. A sequence-like -interface is provided to access the individual Axes instances (e.g., -grid[0] is the first Axes in the grid. See below for the order of -axes). - - - -AxesGrid takes following arguments, - - - ============= ======== ================================================ - Name Default Description - ============= ======== ================================================ - fig - rect - nrows_ncols number of rows and cols. e.g., (2,2) - ngrids None number of grids. nrows x ncols if None - direction "row" increasing direction of axes number. [row|column] - axes_pad 0.02 pad between axes in inches - add_all True Add axes to figures if True - share_all False xaxis & yaxis of all axes are shared if True - aspect True aspect of axes - label_mode "L" location of tick labels thaw will be displayed. - "1" (only the lower left axes), - "L" (left most and bottom most axes), - or "all". - cbar_mode None [None|single|each] - cbar_location "right" [right|top] - cbar_pad None pad between image axes and colorbar axes - cbar_size "5%" size of the colorbar - axes_class None - ============= ======== ================================================ - - *rect* - specifies the location of the grid. You can either specify - coordinates of the rectangle to be used (e.g., (0.1, 0.1, 0.8, 0.8) - as in the Axes), or the subplot-like position (e.g., "121"). - - *direction* - means the increasing direction of the axes number. - - *aspect* - By default (False), widths and heights of axes in the grid are - scaled independently. If True, they are scaled according to their - data limits (similar to aspect parameter in mpl). - - *share_all* - if True, xaxis and yaxis of all axes are shared. - - *direction* - direction of increasing axes number. For "row", - - +---------+---------+ - | grid[0] | grid[1] | - +---------+---------+ - | grid[2] | grid[3] | - +---------+---------+ - - For "column", - - +---------+---------+ - | grid[0] | grid[2] | - +---------+---------+ - | grid[1] | grid[3] | - +---------+---------+ - -You can also create a colorbar (or colorbars). You can have colorbar -for each axes (cbar_mode="each"), or you can have a single colorbar -for the grid (cbar_mode="single"). The colorbar can be placed on your -right, or top. The axes for each colorbar is stored as a *cbar_axes* -attribute. - - - -The examples below show what you can do with AxesGrid. - -.. plot:: mpl_toolkits/axes_grid/examples/demo_axes_grid.py - - -AxesDivider ------------ - -Behind the scene, the ImageGrid class and the RGBAxes class utilize the -AxesDivider class, whose role is to calculate the location of the axes -at drawing time. While a more about the AxesDivider is (will be) -explained in (yet to be written) AxesDividerGuide, direct use of the -AxesDivider class will not be necessary for most users. The -axes_divider module provides a helper function make_axes_locatable, -which can be useful. It takes a existing axes instance and create a -divider for it. :: - - ax = subplot(1,1,1) - divider = make_axes_locatable(ax) - - - - -*make_axes_locatable* returns an instance of the AxesLocator class, -derived from the Locator. It provides *append_axes* method that -creates a new axes on the given side of ("top", "right", "bottom" and -"left") of the original axes. - - - -colorbar whose height (or width) in sync with the master axes -------------------------------------------------------------- - -.. plot:: mpl_toolkits/axes_grid/figures/simple_colorbar.py - :include-source: - - - - -scatter_hist.py with AxesDivider -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The "scatter_hist.py" example in mpl can be rewritten using -*make_axes_locatable*. :: - - axScatter = subplot(111) - axScatter.scatter(x, y) - axScatter.set_aspect(1.) - - # create new axes on the right and on the top of the current axes. - divider = make_axes_locatable(axScatter) - axHistx = divider.append_axes("top", size=1.2, pad=0.1, sharex=axScatter) - axHisty = divider.append_axes("right", size=1.2, pad=0.1, sharey=axScatter) - - # the scatter plot: - # histograms - bins = np.arange(-lim, lim + binwidth, binwidth) - axHistx.hist(x, bins=bins) - axHisty.hist(y, bins=bins, orientation='horizontal') - - -See the full source code below. - -.. plot:: mpl_toolkits/axes_grid/examples/scatter_hist.py - - -The scatter_hist using the AxesDivider has some advantage over the -original scatter_hist.py in mpl. For example, you can set the aspect -ratio of the scatter plot, even with the x-axis or y-axis is shared -accordingly. - - -ParasiteAxes ------------- - -The ParasiteAxes is an axes whose location is identical to its host -axes. The location is adjusted in the drawing time, thus it works even -if the host change its location (e.g., images). - -In most cases, you first create a host axes, which provides a few -method that can be used to create parasite axes. They are *twinx*, -*twiny* (which are similar to twinx and twiny in the matplotlib) and -*twin*. *twin* takes an arbitrary transformation that maps between the -data coordinates of the host axes and the parasite axes. *draw* -method of the parasite axes are never called. Instead, host axes -collects artists in parasite axes and draw them as if they belong to -the host axes, i.e., artists in parasite axes are merged to those of -the host axes and then drawn according to their zorder. The host and -parasite axes modifies some of the axes behavior. For example, color -cycle for plot lines are shared between host and parasites. Also, the -legend command in host, creates a legend that includes lines in the -parasite axes. To create a host axes, you may use *host_suplot* or -*host_axes* command. - - -Example 1. twinx -~~~~~~~~~~~~~~~~ - -.. plot:: mpl_toolkits/axes_grid/figures/parasite_simple.py - :include-source: - -Example 2. twin -~~~~~~~~~~~~~~~ - -*twin* without a transform argument treat the parasite axes to have a -same data transform as the host. This can be useful when you want the -top(or right)-axis to have different tick-locations, tick-labels, or -tick-formatter for bottom(or left)-axis. :: - - ax2 = ax.twin() # now, ax2 is responsible for "top" axis and "right" axis - ax2.set_xticks([0., .5*np.pi, np.pi, 1.5*np.pi, 2*np.pi]) - ax2.set_xticklabels(["0", r"$\frac{1}{2}\pi$", - r"$\pi$", r"$\frac{3}{2}\pi$", r"$2\pi$"]) - - -.. plot:: mpl_toolkits/axes_grid/examples/simple_axisline4.py - - - -A more sophisticated example using twin. Note that if you change the -x-limit in the host axes, the x-limit of the parasite axes will change -accordingly. - - -.. plot:: mpl_toolkits/axes_grid/examples/parasite_simple2.py - - -AnchoredArtists ---------------- - -It's a collection of artists whose location is anchored to the (axes) -bbox, like the legend. It is derived from *OffsetBox* in mpl, and -artist need to be drawn in the canvas coordinate. But, there is a -limited support for an arbitrary transform. For example, the ellipse -in the example below will have width and height in the data -coordinate. - -.. plot:: mpl_toolkits/axes_grid/examples/simple_anchored_artists.py - :include-source: - - -InsetLocator ------------- - -:mod:`mpl_toolkits.axes_grid.inset_locator` provides helper classes -and functions to place your (inset) axes at the anchored position of -the parent axes, similarly to AnchoredArtist. - -Using :func:`mpl_toolkits.axes_grid.inset_locator.inset_axes`, you -can have inset axes whose size is either fixed, or a fixed proportion -of the parent axes. For example,:: - - inset_axes = inset_axes(parent_axes, - width="30%", # width = 30% of parent_bbox - height=1., # height : 1 inch - loc=3) - -creates an inset axes whose width is 30% of the parent axes and whose -height is fixed at 1 inch. - -You may creates your inset whose size is determined so that the data -scale of the inset axes to be that of the parent axes multiplied by -some factor. For example, :: - - inset_axes = zoomed_inset_axes(ax, - 0.5, # zoom = 0.5 - loc=1) - -creates an inset axes whose data scale is half of the parent axes. -Here is complete examples. - -.. plot:: mpl_toolkits/axes_grid/examples/inset_locator_demo.py - -For example, :func:`zoomed_inset_axes` can be used when you want the -inset represents the zoom-up of the small portion in the parent axes. -And :mod:`~mpl_toolkits/axes_grid/inset_locator` provides a helper -function :func:`mark_inset` to mark the location of the area -represented by the inset axes. - -.. plot:: mpl_toolkits/axes_grid/examples/inset_locator_demo2.py - :include-source: - - -RGB Axes -~~~~~~~~ - -RGBAxes is a helper class to conveniently show RGB composite -images. Like ImageGrid, the location of axes are adjusted so that the -area occupied by them fits in a given rectangle. Also, the xaxis and -yaxis of each axes are shared. :: - - from mpl_toolkits.axes_grid1.axes_rgb import RGBAxes - - fig = plt.figure(1) - ax = RGBAxes(fig, [0.1, 0.1, 0.8, 0.8]) - - r, g, b = get_rgb() # r,g,b are 2-d images - ax.imshow_rgb(r, g, b, - origin="lower", interpolation="nearest") - - -.. plot:: mpl_toolkits/axes_grid/figures/simple_rgb.py - - -AXISARTIST -========== - - -AxisArtist ----------- - -AxisArtist module provides a custom (and very experimental) Axes -class, where each axis (left, right, top and bottom) have a separate -artist associated which is responsible to draw axis-line, ticks, -ticklabels, label. Also, you can create your own axis, which can pass -through a fixed position in the axes coordinate, or a fixed position -in the data coordinate (i.e., the axis floats around when viewlimit -changes). - -The axes class, by default, have its xaxis and yaxis invisible, and -has 4 additional artists which are responsible to draw axis in -"left","right","bottom" and "top". They are accessed as -ax.axis["left"], ax.axis["right"], and so on, i.e., ax.axis is a -dictionary that contains artists (note that ax.axis is still a -callable methods and it behaves as an original Axes.axis method in -mpl). - -To create an axes, :: - - import mpl_toolkits.axisartist as AA - fig = plt.figure(1) - ax = AA.Axes(fig, [0.1, 0.1, 0.8, 0.8]) - fig.add_axes(ax) - -or to create a subplot :: - - ax = AA.Subplot(fig, 111) - fig.add_subplot(ax) - -For example, you can hide the right, and top axis by :: - - ax.axis["right"].set_visible(False) - ax.axis["top"].set_visible(False) - - -.. plot:: mpl_toolkits/axes_grid/figures/simple_axisline3.py - - -It is also possible to add an extra axis. For example, you may have an -horizontal axis at y=0 (in data coordinate). :: - - ax.axis["y=0"] = ax.new_floating_axis(nth_coord=0, value=0) - -.. plot:: mpl_toolkits/axes_grid/figures/simple_axisartist1.py - :include-source: - - -Or a fixed axis with some offset :: - - # make new (right-side) yaxis, but wth some offset - ax.axis["right2"] = ax.new_fixed_axis(loc="right", - offset=(20, 0)) - - - -AxisArtist with ParasiteAxes -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Most commands in the axes_grid1 toolkit can take a axes_class keyword -argument, and the commands creates an axes of the given class. For example, -to create a host subplot with axisartist.Axes, :: - - import mpl_tookits.axisartist as AA - from mpl_toolkits.axes_grid1 import host_subplot - - host = host_subplot(111, axes_class=AA.Axes) - - -Here is an example that uses parasiteAxes. - - -.. plot:: mpl_toolkits/axes_grid/examples/demo_parasite_axes2.py - - - -Curvilinear Grid ----------------- - -The motivation behind the AxisArtist module is to support curvilinear grid -and ticks. - -.. plot:: mpl_toolkits/axes_grid/examples/demo_curvelinear_grid.py - -See :ref:`axisartist-manual` for more details. - - -Floating Axes -------------- - -This also support a Floating Axes whose outer axis are defined as -floating axis. - -.. plot:: mpl_toolkits/axes_grid/examples/demo_floating_axes.py - - diff --git a/_sources/mpl_toolkits/axes_grid/users/overview.txt b/_sources/mpl_toolkits/axes_grid/users/overview.txt deleted file mode 100644 index 8a04b92ea55..00000000000 --- a/_sources/mpl_toolkits/axes_grid/users/overview.txt +++ /dev/null @@ -1,480 +0,0 @@ -============================ -Overview of AxesGrid toolkit -============================ - -What is AxesGrid toolkit? -========================= - -The matplotlib AxesGrid toolkit is a collection of helper classes, -mainly to ease displaying (multiple) images in matplotlib. - -.. contents:: - :depth: 1 - :local: - -.. note:: - AxesGrid toolkit has been a part of matplotlib since v - 0.99. Originally, the toolkit had a single namespace of - *axes_grid*. In more recent version (since svn r8226), the toolkit - has divided into two separate namespace (*axes_grid1* and *axisartist*). - While *axes_grid* namespace is maintained for the backward compatibility, - use of *axes_grid1* and *axisartist* is recommended. - -.. warning:: - *axes_grid* and *axisartist* (but not *axes_grid1*) uses - a custom Axes class (derived from the mpl's original Axes class). - As a side effect, some commands (mostly tick-related) do not work. - Use *axes_grid1* to avoid this, or see how things are different in - *axes_grid* and *axisartist* (LINK needed) - - -AxesGrid toolkit has two namespaces (*axes_grid1* and *axisartist*). -*axisartist* contains custom Axes class that is meant to support for -curvilinear grids (e.g., the world coordinate system in astronomy). -Unlike mpl's original Axes class which uses Axes.xaxis and Axes.yaxis -to draw ticks, ticklines and etc., Axes in axisartist uses special -artist (AxisArtist) which can handle tick, ticklines and etc. for -curved coordinate systems. - -.. plot:: mpl_toolkits/axes_grid/examples/demo_floating_axis.py - -Since it uses a special artists, some mpl commands that work on -Axes.xaxis and Axes.yaxis may not work. See LINK for more detail. - - -*axes_grid1* is a collection of helper classes to ease displaying -(multiple) images with matplotlib. In matplotlib, the axes location -(and size) is specified in the normalized figure coordinates, which -may not be ideal for displaying images that needs to have a given -aspect ratio. For example, it helps you to have a colorbar whose -height always matches that of the image. `ImageGrid`_, `RGB Axes`_ and -`AxesDivider`_ are helper classes that deals with adjusting the -location of (multiple) Axes. They provides a framework to adjust the -position of multiple axes at the drawing time. `ParasiteAxes`_ -provides twinx(or twiny)-like features so that you can plot different -data (e.g., different y-scale) in a same Axes. `AnchoredArtists`_ -includes custom artists which are placed at some anchored position, -like the legend. - -.. plot:: mpl_toolkits/axes_grid/examples/demo_axes_grid.py - - -AXES_GRID1 -========== - -ImageGrid ---------- - - -A class that creates a grid of Axes. In matplotlib, the axes location -(and size) is specified in the normalized figure coordinates. This may -not be ideal for images that needs to be displayed with a given aspect -ratio. For example, displaying images of a same size with some fixed -padding between them cannot be easily done in matplotlib. ImageGrid is -used in such case. - -.. plot:: mpl_toolkits/axes_grid/examples/simple_axesgrid.py - :include-source: - -* The position of each axes is determined at the drawing time (see - `AxesDivider`_), so that the size of the entire grid fits in the - given rectangle (like the aspect of axes). Note that in this example, - the paddings between axes are fixed even if you changes the figure - size. - -* axes in the same column has a same axes width (in figure - coordinate), and similarly, axes in the same row has a same - height. The widths (height) of the axes in the same row (column) are - scaled according to their view limits (xlim or ylim). - - .. plot:: mpl_toolkits/axes_grid/examples/simple_axesgrid2.py - :include-source: - -* xaxis are shared among axes in a same column. Similarly, yaxis are - shared among axes in a same row. Therefore, changing axis properties - (view limits, tick location, etc. either by plot commands or using - your mouse in interactive backends) of one axes will affect all - other shared axes. - - - -When initialized, ImageGrid creates given number (*ngrids* or *ncols* * -*nrows* if *ngrids* is None) of Axes instances. A sequence-like -interface is provided to access the individual Axes instances (e.g., -grid[0] is the first Axes in the grid. See below for the order of -axes). - - - -AxesGrid takes following arguments, - - - ============= ======== ================================================ - Name Default Description - ============= ======== ================================================ - fig - rect - nrows_ncols number of rows and cols. e.g., (2,2) - ngrids None number of grids. nrows x ncols if None - direction "row" increasing direction of axes number. [row|column] - axes_pad 0.02 pad between axes in inches - add_all True Add axes to figures if True - share_all False xaxis & yaxis of all axes are shared if True - aspect True aspect of axes - label_mode "L" location of tick labels thaw will be displayed. - "1" (only the lower left axes), - "L" (left most and bottom most axes), - or "all". - cbar_mode None [None|single|each] - cbar_location "right" [right|top] - cbar_pad None pad between image axes and colorbar axes - cbar_size "5%" size of the colorbar - axes_class None - ============= ======== ================================================ - - *rect* - specifies the location of the grid. You can either specify - coordinates of the rectangle to be used (e.g., (0.1, 0.1, 0.8, 0.8) - as in the Axes), or the subplot-like position (e.g., "121"). - - *direction* - means the increasing direction of the axes number. - - *aspect* - By default (False), widths and heights of axes in the grid are - scaled independently. If True, they are scaled according to their - data limits (similar to aspect parameter in mpl). - - *share_all* - if True, xaxis and yaxis of all axes are shared. - - *direction* - direction of increasing axes number. For "row", - - +---------+---------+ - | grid[0] | grid[1] | - +---------+---------+ - | grid[2] | grid[3] | - +---------+---------+ - - For "column", - - +---------+---------+ - | grid[0] | grid[2] | - +---------+---------+ - | grid[1] | grid[3] | - +---------+---------+ - -You can also create a colorbar (or colorbars). You can have colorbar -for each axes (cbar_mode="each"), or you can have a single colorbar -for the grid (cbar_mode="single"). The colorbar can be placed on your -right, or top. The axes for each colorbar is stored as a *cbar_axes* -attribute. - - - -The examples below show what you can do with AxesGrid. - -.. plot:: mpl_toolkits/axes_grid/examples/demo_axes_grid.py - - -AxesDivider ------------ - -Behind the scene, the ImageGrid class and the RGBAxes class utilize the -AxesDivider class, whose role is to calculate the location of the axes -at drawing time. While a more about the AxesDivider is (will be) -explained in (yet to be written) AxesDividerGuide, direct use of the -AxesDivider class will not be necessary for most users. The -axes_divider module provides a helper function make_axes_locatable, -which can be useful. It takes a existing axes instance and create a -divider for it. :: - - ax = subplot(1,1,1) - divider = make_axes_locatable(ax) - - - - -*make_axes_locatable* returns an instance of the AxesLocator class, -derived from the Locator. It provides *append_axes* method that -creates a new axes on the given side of ("top", "right", "bottom" and -"left") of the original axes. - - - -colorbar whose height (or width) in sync with the master axes -------------------------------------------------------------- - -.. plot:: mpl_toolkits/axes_grid/figures/simple_colorbar.py - :include-source: - - - - -scatter_hist.py with AxesDivider -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The "scatter_hist.py" example in mpl can be rewritten using -*make_axes_locatable*. :: - - axScatter = subplot(111) - axScatter.scatter(x, y) - axScatter.set_aspect(1.) - - # create new axes on the right and on the top of the current axes. - divider = make_axes_locatable(axScatter) - axHistx = divider.append_axes("top", size=1.2, pad=0.1, sharex=axScatter) - axHisty = divider.append_axes("right", size=1.2, pad=0.1, sharey=axScatter) - - # the scatter plot: - # histograms - bins = np.arange(-lim, lim + binwidth, binwidth) - axHistx.hist(x, bins=bins) - axHisty.hist(y, bins=bins, orientation='horizontal') - - -See the full source code below. - -.. plot:: mpl_toolkits/axes_grid/examples/scatter_hist.py - - -The scatter_hist using the AxesDivider has some advantage over the -original scatter_hist.py in mpl. For example, you can set the aspect -ratio of the scatter plot, even with the x-axis or y-axis is shared -accordingly. - - -ParasiteAxes ------------- - -The ParasiteAxes is an axes whose location is identical to its host -axes. The location is adjusted in the drawing time, thus it works even -if the host change its location (e.g., images). - -In most cases, you first create a host axes, which provides a few -method that can be used to create parasite axes. They are *twinx*, -*twiny* (which are similar to twinx and twiny in the matplotlib) and -*twin*. *twin* takes an arbitrary transformation that maps between the -data coordinates of the host axes and the parasite axes. *draw* -method of the parasite axes are never called. Instead, host axes -collects artists in parasite axes and draw them as if they belong to -the host axes, i.e., artists in parasite axes are merged to those of -the host axes and then drawn according to their zorder. The host and -parasite axes modifies some of the axes behavior. For example, color -cycle for plot lines are shared between host and parasites. Also, the -legend command in host, creates a legend that includes lines in the -parasite axes. To create a host axes, you may use *host_suplot* or -*host_axes* command. - - -Example 1. twinx -~~~~~~~~~~~~~~~~ - -.. plot:: mpl_toolkits/axes_grid/figures/parasite_simple.py - :include-source: - -Example 2. twin -~~~~~~~~~~~~~~~ - -*twin* without a transform argument treat the parasite axes to have a -same data transform as the host. This can be useful when you want the -top(or right)-axis to have different tick-locations, tick-labels, or -tick-formatter for bottom(or left)-axis. :: - - ax2 = ax.twin() # now, ax2 is responsible for "top" axis and "right" axis - ax2.set_xticks([0., .5*np.pi, np.pi, 1.5*np.pi, 2*np.pi]) - ax2.set_xticklabels(["0", r"$\frac{1}{2}\pi$", - r"$\pi$", r"$\frac{3}{2}\pi$", r"$2\pi$"]) - - -.. plot:: mpl_toolkits/axes_grid/examples/simple_axisline4.py - - - -A more sophisticated example using twin. Note that if you change the -x-limit in the host axes, the x-limit of the parasite axes will change -accordingly. - - -.. plot:: mpl_toolkits/axes_grid/examples/parasite_simple2.py - - -AnchoredArtists ---------------- - -It's a collection of artists whose location is anchored to the (axes) -bbox, like the legend. It is derived from *OffsetBox* in mpl, and -artist need to be drawn in the canvas coordinate. But, there is a -limited support for an arbitrary transform. For example, the ellipse -in the example below will have width and height in the data -coordinate. - -.. plot:: mpl_toolkits/axes_grid/examples/simple_anchored_artists.py - :include-source: - - -InsetLocator ------------- - -:mod:`mpl_toolkits.axes_grid.inset_locator` provides helper classes -and functions to place your (inset) axes at the anchored position of -the parent axes, similarly to AnchoredArtist. - -Using :func:`mpl_toolkits.axes_grid.inset_locator.inset_axes`, you -can have inset axes whose size is either fixed, or a fixed proportion -of the parent axes. For example,:: - - inset_axes = inset_axes(parent_axes, - width="30%", # width = 30% of parent_bbox - height=1., # height : 1 inch - loc=3) - -creates an inset axes whose width is 30% of the parent axes and whose -height is fixed at 1 inch. - -You may creates your inset whose size is determined so that the data -scale of the inset axes to be that of the parent axes multiplied by -some factor. For example, :: - - inset_axes = zoomed_inset_axes(ax, - 0.5, # zoom = 0.5 - loc=1) - -creates an inset axes whose data scale is half of the parent axes. -Here is complete examples. - -.. plot:: mpl_toolkits/axes_grid/examples/inset_locator_demo.py - -For example, :func:`zoomed_inset_axes` can be used when you want the -inset represents the zoom-up of the small portion in the parent axes. -And :mod:`~mpl_toolkits/axes_grid/inset_locator` provides a helper -function :func:`mark_inset` to mark the location of the area -represented by the inset axes. - -.. plot:: mpl_toolkits/axes_grid/examples/inset_locator_demo2.py - :include-source: - - -RGB Axes -~~~~~~~~ - -RGBAxes is a helper class to conveniently show RGB composite -images. Like ImageGrid, the location of axes are adjusted so that the -area occupied by them fits in a given rectangle. Also, the xaxis and -yaxis of each axes are shared. :: - - from mpl_toolkits.axes_grid1.axes_rgb import RGBAxes - - fig = plt.figure(1) - ax = RGBAxes(fig, [0.1, 0.1, 0.8, 0.8]) - - r, g, b = get_rgb() # r,g,b are 2-d images - ax.imshow_rgb(r, g, b, - origin="lower", interpolation="nearest") - - -.. plot:: mpl_toolkits/axes_grid/figures/simple_rgb.py - - -AXISARTIST -========== - - -AxisArtist ----------- - -AxisArtist module provides a custom (and very experimental) Axes -class, where each axis (left, right, top and bottom) have a separate -artist associated which is responsible to draw axis-line, ticks, -ticklabels, label. Also, you can create your own axis, which can pass -through a fixed position in the axes coordinate, or a fixed position -in the data coordinate (i.e., the axis floats around when viewlimit -changes). - -The axes class, by default, have its xaxis and yaxis invisible, and -has 4 additional artists which are responsible to draw axis in -"left","right","bottom" and "top". They are accessed as -ax.axis["left"], ax.axis["right"], and so on, i.e., ax.axis is a -dictionary that contains artists (note that ax.axis is still a -callable methods and it behaves as an original Axes.axis method in -mpl). - -To create an axes, :: - - import mpl_toolkits.axisartist as AA - fig = plt.figure(1) - ax = AA.Axes(fig, [0.1, 0.1, 0.8, 0.8]) - fig.add_axes(ax) - -or to create a subplot :: - - ax = AA.Subplot(fig, 111) - fig.add_subplot(ax) - -For example, you can hide the right, and top axis by :: - - ax.axis["right"].set_visible(False) - ax.axis["top"].set_visible(False) - - -.. plot:: mpl_toolkits/axes_grid/figures/simple_axisline3.py - - -It is also possible to add an extra axis. For example, you may have an -horizontal axis at y=0 (in data coordinate). :: - - ax.axis["y=0"] = ax.new_floating_axis(nth_coord=0, value=0) - -.. plot:: mpl_toolkits/axes_grid/figures/simple_axisartist1.py - :include-source: - - -Or a fixed axis with some offset :: - - # make new (right-side) yaxis, but wth some offset - ax.axis["right2"] = ax.new_fixed_axis(loc="right", - offset=(20, 0)) - - - -AxisArtist with ParasiteAxes -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Most commands in the axes_grid1 toolkit can take a axes_class keyword -argument, and the commands creates an axes of the given class. For example, -to create a host subplot with axisartist.Axes, :: - - import mpl_tookits.axisartist as AA - from mpl_toolkits.axes_grid1 import host_subplot - - host = host_subplot(111, axes_class=AA.Axes) - - -Here is an example that uses parasiteAxes. - - -.. plot:: mpl_toolkits/axes_grid/examples/demo_parasite_axes2.py - - - -Curvilinear Grid ----------------- - -The motivation behind the AxisArtist module is to support curvilinear grid -and ticks. - -.. plot:: mpl_toolkits/axes_grid/examples/demo_curvelinear_grid.py - -See :ref:`axisartist-manual` for more details. - - -Floating Axes -------------- - -This also support a Floating Axes whose outer axis are defined as -floating axis. - -.. plot:: mpl_toolkits/axes_grid/examples/demo_floating_axes.py - - diff --git a/_sources/mpl_toolkits/mplot3d/api.rst.txt b/_sources/mpl_toolkits/mplot3d/api.rst.txt deleted file mode 100644 index 64217a482fe..00000000000 --- a/_sources/mpl_toolkits/mplot3d/api.rst.txt +++ /dev/null @@ -1,64 +0,0 @@ -.. _toolkit_mplot3d-api: - -*********** -mplot3d API -*********** -.. contents:: - :backlinks: none - -.. _toolkit_mplot3d-axesapi: - -:mod:`~mpl_toolkits.mplot3d.axes3d` -=================================== - -.. note:: - Significant effort went into bringing axes3d to feature-parity with - regular axes objects for version 1.1.0. However, more work remains. - Please report any functions that do not behave as expected as a bug. - In addition, help and patches would be greatly appreciated! - -.. automodule:: mpl_toolkits.mplot3d.axes3d - :members: - :undoc-members: - :show-inheritance: - - -.. _toolkit_mplot3d-axisapi: - -:mod:`~mpl_toolkits.mplot3d.axis3d` -=================================== - -.. note:: - Historically, axis3d has suffered from having hard-coded constants - controlling the look and feel of the 3D plot. This precluded user - level adjustments such as label spacing, font colors and panel colors. - For version 1.1.0, these constants have been consolidated into a single - private member dictionary, `self._axinfo`, for the axis object. This is - intended only as a stop-gap measure to allow user-level customization, - but it is not intended to be permanent. - -.. automodule:: mpl_toolkits.mplot3d.axis3d - :members: - :undoc-members: - :show-inheritance: - -.. _toolkit_mplot3d-artapi: - -:mod:`~mpl_toolkits.mplot3d.art3d` -================================== - -.. automodule:: mpl_toolkits.mplot3d.art3d - :members: - :undoc-members: - :show-inheritance: - -.. _toolkit_mplot3d-projapi: - -:mod:`~mpl_toolkits.mplot3d.proj3d` -=================================== - -.. automodule:: mpl_toolkits.mplot3d.proj3d - :members: - :undoc-members: - :show-inheritance: - diff --git a/_sources/mpl_toolkits/mplot3d/tutorial.rst.txt b/_sources/mpl_toolkits/mplot3d/tutorial.rst.txt deleted file mode 100644 index b0cda866196..00000000000 --- a/_sources/mpl_toolkits/mplot3d/tutorial.rst.txt +++ /dev/null @@ -1,150 +0,0 @@ -.. _toolkit_mplot3d-tutorial: -.. currentmodule:: mpl_toolkits.mplot3d - -**************** -mplot3d tutorial -**************** -.. contents:: - :backlinks: none - -.. _mplot3d_getting_started: - -Getting started -=============== -An Axes3D object is created just like any other axes using -the projection='3d' keyword. -Create a new :class:`matplotlib.figure.Figure` and -add a new axes to it of type :class:`~mpl_toolkits.mplot3d.Axes3D`:: - - import matplotlib.pyplot as plt - from mpl_toolkits.mplot3d import Axes3D - fig = plt.figure() - ax = fig.add_subplot(111, projection='3d') - -.. versionadded:: 1.0.0 - This approach is the preferred method of creating a 3D axes. - -.. note:: - Prior to version 1.0.0, the method of creating a 3D axes was - different. For those using older versions of matplotlib, change - ``ax = fig.add_subplot(111, projection='3d')`` - to ``ax = Axes3D(fig)``. - -.. _plot3d: - -Line plots -==================== -.. automethod:: Axes3D.plot - -.. plot:: mpl_examples/mplot3d/lines3d_demo.py - -.. _scatter3d: - -Scatter plots -============= -.. automethod:: Axes3D.scatter - -.. plot:: mpl_examples/mplot3d/scatter3d_demo.py - -.. _wireframe: - -Wireframe plots -=============== -.. automethod:: Axes3D.plot_wireframe - -.. plot:: mpl_examples/mplot3d/wire3d_demo.py - -.. _surface: - -Surface plots -============= -.. automethod:: Axes3D.plot_surface - -.. plot:: mpl_examples/mplot3d/surface3d_demo.py -.. plot:: mpl_examples/mplot3d/surface3d_demo2.py -.. plot:: mpl_examples/mplot3d/surface3d_demo3.py - -.. _trisurface: - -Tri-Surface plots -================= -.. automethod:: Axes3D.plot_trisurf - -.. plot:: mpl_examples/mplot3d/trisurf3d_demo.py - - -.. _contour3d: - -Contour plots -============= -.. automethod:: Axes3D.contour - -.. plot:: mpl_examples/mplot3d/contour3d_demo.py -.. plot:: mpl_examples/mplot3d/contour3d_demo2.py -.. plot:: mpl_examples/mplot3d/contour3d_demo3.py - -.. _contourf3d: - -Filled contour plots -==================== -.. automethod:: Axes3D.contourf - -.. plot:: mpl_examples/mplot3d/contourf3d_demo.py -.. plot:: mpl_examples/mplot3d/contourf3d_demo2.py - -.. versionadded:: 1.1.0 - The feature demoed in the second contourf3d example was enabled as a - result of a bugfix for version 1.1.0. - -.. _polygon3d: - -Polygon plots -==================== -.. automethod:: Axes3D.add_collection3d - -.. plot:: mpl_examples/mplot3d/polys3d_demo.py - -.. _bar3d: - -Bar plots -==================== -.. automethod:: Axes3D.bar - -.. plot:: mpl_examples/mplot3d/bars3d_demo.py - -.. _quiver3d: - -Quiver -==================== -.. automethod:: Axes3D.quiver - -.. plot:: mpl_examples/mplot3d/quiver3d_demo.py - -.. _2dcollections3d: - -2D plots in 3D -==================== -.. plot:: mpl_examples/mplot3d/2dcollections3d_demo.py - -.. _text3d: - -Text -==================== -.. automethod:: Axes3D.text - -.. plot:: mpl_examples/mplot3d/text3d_demo.py - -.. _3dsubplots: - -Subplotting -==================== -Having multiple 3D plots in a single figure is the same -as it is for 2D plots. Also, you can have both 2D and 3D plots -in the same figure. - -.. versionadded:: 1.0.0 - Subplotting 3D plots was added in v1.0.0. Earlier version can not - do this. - -.. plot:: mpl_examples/mplot3d/subplot3d_demo.py -.. plot:: mpl_examples/mplot3d/mixed_subplots_demo.py diff --git a/_sources/users/annotations.rst.txt b/_sources/users/annotations.rst.txt deleted file mode 100644 index 3d66c655731..00000000000 --- a/_sources/users/annotations.rst.txt +++ /dev/null @@ -1,502 +0,0 @@ -============ - Annotation -============ - -.. contents:: Table of Contents - :depth: 3 - -.. _annotations-tutorial: - -Basic annotation -================ - -The uses of the basic :func:`~matplotlib.pyplot.text` will place text -at an arbitrary position on the Axes. A common use case of text is to -annotate some feature of the plot, and the -:func:`~matplotlib.Axes.annotate` method provides helper functionality -to make annotations easy. In an annotation, there are two points to -consider: the location being annotated represented by the argument -``xy`` and the location of the text ``xytext``. Both of these -arguments are ``(x,y)`` tuples. - -.. plot:: mpl_examples/pyplots/annotation_basic.py - :include-source: - - -In this example, both the ``xy`` (arrow tip) and ``xytext`` locations -(text location) are in data coordinates. There are a variety of other -coordinate systems one can choose -- you can specify the coordinate -system of ``xy`` and ``xytext`` with one of the following strings for -``xycoords`` and ``textcoords`` (default is 'data') - -==================== ==================================================== -argument coordinate system -==================== ==================================================== - 'figure points' points from the lower left corner of the figure - 'figure pixels' pixels from the lower left corner of the figure - 'figure fraction' 0,0 is lower left of figure and 1,1 is upper right - 'axes points' points from lower left corner of axes - 'axes pixels' pixels from lower left corner of axes - 'axes fraction' 0,0 is lower left of axes and 1,1 is upper right - 'data' use the axes data coordinate system -==================== ==================================================== - -For example to place the text coordinates in fractional axes -coordinates, one could do:: - - ax.annotate('local max', xy=(3, 1), xycoords='data', - xytext=(0.8, 0.95), textcoords='axes fraction', - arrowprops=dict(facecolor='black', shrink=0.05), - horizontalalignment='right', verticalalignment='top', - ) - -For physical coordinate systems (points or pixels) the origin is the -bottom-left of the figure or axes. - -Optionally, you can enable drawing of an arrow from the text to the annotated -point by giving a dictionary of arrow properties in the optional keyword -argument ``arrowprops``. - - -==================== ===================================================== -``arrowprops`` key description -==================== ===================================================== -width the width of the arrow in points -frac the fraction of the arrow length occupied by the head -headwidth the width of the base of the arrow head in points -shrink move the tip and base some percent away from - the annotated point and text - -\*\*kwargs any key for :class:`matplotlib.patches.Polygon`, - e.g., ``facecolor`` -==================== ===================================================== - - -In the example below, the ``xy`` point is in native coordinates -(``xycoords`` defaults to 'data'). For a polar axes, this is in -(theta, radius) space. The text in this example is placed in the -fractional figure coordinate system. :class:`matplotlib.text.Text` -keyword args like ``horizontalalignment``, ``verticalalignment`` and -``fontsize`` are passed from `~matplotlib.Axes.annotate` to the -``Text`` instance. - -.. plot:: mpl_examples/pyplots/annotation_polar.py - :include-source: - -For more on all the wild and wonderful things you can do with -annotations, including fancy arrows, see :ref:`plotting-guide-annotation` -and :ref:`pylab_examples-annotation_demo`. - - -Do not proceed unless you have already read :ref:`annotations-tutorial`, -:func:`~matplotlib.pyplot.text` and :func:`~matplotlib.pyplot.annotate`! - - -.. _plotting-guide-annotation: - -Advanced Annotation -=================== - - -Annotating with Text with Box ------------------------------ - -Let's start with a simple example. - -.. plot:: users/plotting/examples/annotate_text_arrow.py - - -The :func:`~matplotlib.pyplot.text` function in the pyplot module (or -text method of the Axes class) takes bbox keyword argument, and when -given, a box around the text is drawn. :: - - bbox_props = dict(boxstyle="rarrow,pad=0.3", fc="cyan", ec="b", lw=2) - t = ax.text(0, 0, "Direction", ha="center", va="center", rotation=45, - size=15, - bbox=bbox_props) - - -The patch object associated with the text can be accessed by:: - - bb = t.get_bbox_patch() - -The return value is an instance of FancyBboxPatch and the patch -properties like facecolor, edgewidth, etc. can be accessed and -modified as usual. To change the shape of the box, use the *set_boxstyle* -method. :: - - bb.set_boxstyle("rarrow", pad=0.6) - -The arguments are the name of the box style with its attributes as -keyword arguments. Currently, following box styles are implemented. - - ========== ============== ========================== - Class Name Attrs - ========== ============== ========================== - Circle ``circle`` pad=0.3 - DArrow ``darrow`` pad=0.3 - LArrow ``larrow`` pad=0.3 - RArrow ``rarrow`` pad=0.3 - Round ``round`` pad=0.3,rounding_size=None - Round4 ``round4`` pad=0.3,rounding_size=None - Roundtooth ``roundtooth`` pad=0.3,tooth_size=None - Sawtooth ``sawtooth`` pad=0.3,tooth_size=None - Square ``square`` pad=0.3 - ========== ============== ========================== - -.. plot:: mpl_examples/pylab_examples/fancybox_demo2.py - - -Note that the attribute arguments can be specified within the style -name with separating comma (this form can be used as "boxstyle" value -of bbox argument when initializing the text instance) :: - - bb.set_boxstyle("rarrow,pad=0.6") - - - - -Annotating with Arrow ---------------------- - -The :func:`~matplotlib.pyplot.annotate` function in the pyplot module -(or annotate method of the Axes class) is used to draw an arrow -connecting two points on the plot. :: - - ax.annotate("Annotation", - xy=(x1, y1), xycoords='data', - xytext=(x2, y2), textcoords='offset points', - ) - -This annotates a point at ``xy`` in the given coordinate (``xycoords``) -with the text at ``xytext`` given in ``textcoords``. Often, the -annotated point is specified in the *data* coordinate and the annotating -text in *offset points*. -See :func:`~matplotlib.pyplot.annotate` for available coordinate systems. - -An arrow connecting two points (xy & xytext) can be optionally drawn by -specifying the ``arrowprops`` argument. To draw only an arrow, use -empty string as the first argument. :: - - ax.annotate("", - xy=(0.2, 0.2), xycoords='data', - xytext=(0.8, 0.8), textcoords='data', - arrowprops=dict(arrowstyle="->", - connectionstyle="arc3"), - ) - -.. plot:: users/plotting/examples/annotate_simple01.py - -The arrow drawing takes a few steps. - -1. a connecting path between two points are created. This is - controlled by ``connectionstyle`` key value. - -2. If patch object is given (*patchA* & *patchB*), the path is clipped to - avoid the patch. - -3. The path is further shrunk by given amount of pixels (*shrinkA* - & *shrinkB*) - -4. The path is transmuted to arrow patch, which is controlled by the - ``arrowstyle`` key value. - - -.. plot:: users/plotting/examples/annotate_explain.py - - -The creation of the connecting path between two points is controlled by -``connectionstyle`` key and the following styles are available. - - ========== ============================================= - Name Attrs - ========== ============================================= - ``angle`` angleA=90,angleB=0,rad=0.0 - ``angle3`` angleA=90,angleB=0 - ``arc`` angleA=0,angleB=0,armA=None,armB=None,rad=0.0 - ``arc3`` rad=0.0 - ``bar`` armA=0.0,armB=0.0,fraction=0.3,angle=None - ========== ============================================= - -Note that "3" in ``angle3`` and ``arc3`` is meant to indicate that the -resulting path is a quadratic spline segment (three control -points). As will be discussed below, some arrow style options can only -be used when the connecting path is a quadratic spline. - -The behavior of each connection style is (limitedly) demonstrated in the -example below. (Warning : The behavior of the ``bar`` style is currently not -well defined, it may be changed in the future). - -.. plot:: users/plotting/examples/connectionstyle_demo.py - - -The connecting path (after clipping and shrinking) is then mutated to -an arrow patch, according to the given ``arrowstyle``. - - ========== ============================================= - Name Attrs - ========== ============================================= - ``-`` None - ``->`` head_length=0.4,head_width=0.2 - ``-[`` widthB=1.0,lengthB=0.2,angleB=None - ``|-|`` widthA=1.0,widthB=1.0 - ``-|>`` head_length=0.4,head_width=0.2 - ``<-`` head_length=0.4,head_width=0.2 - ``<->`` head_length=0.4,head_width=0.2 - ``<|-`` head_length=0.4,head_width=0.2 - ``<|-|>`` head_length=0.4,head_width=0.2 - ``fancy`` head_length=0.4,head_width=0.4,tail_width=0.4 - ``simple`` head_length=0.5,head_width=0.5,tail_width=0.2 - ``wedge`` tail_width=0.3,shrink_factor=0.5 - ========== ============================================= - -.. plot:: mpl_examples/pylab_examples/fancyarrow_demo.py - -Some arrowstyles only work with connection styles that generate a -quadratic-spline segment. They are ``fancy``, ``simple``, and ``wedge``. -For these arrow styles, you must use the "angle3" or "arc3" connection -style. - -If the annotation string is given, the patchA is set to the bbox patch -of the text by default. - -.. plot:: users/plotting/examples/annotate_simple02.py - -As in the text command, a box around the text can be drawn using -the ``bbox`` argument. - -.. plot:: users/plotting/examples/annotate_simple03.py - -By default, the starting point is set to the center of the text -extent. This can be adjusted with ``relpos`` key value. The values -are normalized to the extent of the text. For example, (0,0) means -lower-left corner and (1,1) means top-right. - -.. plot:: users/plotting/examples/annotate_simple04.py - - -Placing Artist at the anchored location of the Axes ---------------------------------------------------- - -There are classes of artists that can be placed at an anchored location -in the Axes. A common example is the legend. This type of artist can -be created by using the OffsetBox class. A few predefined classes are -available in ``mpl_toolkits.axes_grid.anchored_artists``. :: - - from mpl_toolkits.axes_grid.anchored_artists import AnchoredText - at = AnchoredText("Figure 1a", - prop=dict(size=8), frameon=True, - loc=2, - ) - at.patch.set_boxstyle("round,pad=0.,rounding_size=0.2") - ax.add_artist(at) - - -.. plot:: users/plotting/examples/anchored_box01.py - - -The *loc* keyword has same meaning as in the legend command. - -A simple application is when the size of the artist (or collection of -artists) is known in pixel size during the time of creation. For -example, If you want to draw a circle with fixed size of 20 pixel x 20 -pixel (radius = 10 pixel), you can utilize -``AnchoredDrawingArea``. The instance is created with a size of the -drawing area (in pixels), and arbitrary artists can added to the -drawing area. Note that the extents of the artists that are added to -the drawing area are not related to the placement of the drawing -area itself. Only the initial size matters. :: - - from mpl_toolkits.axes_grid.anchored_artists import AnchoredDrawingArea - - ada = AnchoredDrawingArea(20, 20, 0, 0, - loc=1, pad=0., frameon=False) - p1 = Circle((10, 10), 10) - ada.drawing_area.add_artist(p1) - p2 = Circle((30, 10), 5, fc="r") - ada.drawing_area.add_artist(p2) - -The artists that are added to the drawing area should not have a -transform set (it will be overridden) and the dimensions of those -artists are interpreted as a pixel coordinate, i.e., the radius of the -circles in above example are 10 pixels and 5 pixels, respectively. - -.. plot:: users/plotting/examples/anchored_box02.py - -Sometimes, you want your artists to scale with the data coordinate (or -coordinates other than canvas pixels). You can use -``AnchoredAuxTransformBox`` class. This is similar to -``AnchoredDrawingArea`` except that the extent of the artist is -determined during the drawing time respecting the specified transform. :: - - from mpl_toolkits.axes_grid.anchored_artists import AnchoredAuxTransformBox - - box = AnchoredAuxTransformBox(ax.transData, loc=2) - el = Ellipse((0,0), width=0.1, height=0.4, angle=30) # in data coordinates! - box.drawing_area.add_artist(el) - -The ellipse in the above example will have width and height -corresponding to 0.1 and 0.4 in data coordinateing and will be -automatically scaled when the view limits of the axes change. - -.. plot:: users/plotting/examples/anchored_box03.py - -As in the legend, the bbox_to_anchor argument can be set. Using the -HPacker and VPacker, you can have an arrangement(?) of artist as in the -legend (as a matter of fact, this is how the legend is created). - -.. plot:: users/plotting/examples/anchored_box04.py - -Note that unlike the legend, the ``bbox_transform`` is set -to IdentityTransform by default. - -Using Complex Coordinates with Annotations ------------------------------------------- - -The Annotation in matplotlib supports several types of coordinates as -described in :ref:`annotations-tutorial`. For an advanced user who wants -more control, it supports a few other options. - - 1. :class:`~matplotlib.transforms.Transform` instance. For example, :: - - ax.annotate("Test", xy=(0.5, 0.5), xycoords=ax.transAxes) - - is identical to :: - - ax.annotate("Test", xy=(0.5, 0.5), xycoords="axes fraction") - - With this, you can annotate a point in other axes. :: - - ax1, ax2 = subplot(121), subplot(122) - ax2.annotate("Test", xy=(0.5, 0.5), xycoords=ax1.transData, - xytext=(0.5, 0.5), textcoords=ax2.transData, - arrowprops=dict(arrowstyle="->")) - - 2. :class:`~matplotlib.artist.Artist` instance. The xy value (or - xytext) is interpreted as a fractional coordinate of the bbox - (return value of *get_window_extent*) of the artist. :: - - an1 = ax.annotate("Test 1", xy=(0.5, 0.5), xycoords="data", - va="center", ha="center", - bbox=dict(boxstyle="round", fc="w")) - an2 = ax.annotate("Test 2", xy=(1, 0.5), xycoords=an1, # (1,0.5) of the an1's bbox - xytext=(30,0), textcoords="offset points", - va="center", ha="left", - bbox=dict(boxstyle="round", fc="w"), - arrowprops=dict(arrowstyle="->")) - - .. plot:: users/plotting/examples/annotate_simple_coord01.py - - Note that it is your responsibility that the extent of the - coordinate artist (*an1* in above example) is determined before *an2* - gets drawn. In most cases, it means that *an2* needs to be drawn - later than *an1*. - - - 3. A callable object that returns an instance of either - :class:`~matplotlib.transforms.BboxBase` or - :class:`~matplotlib.transforms.Transform`. If a transform is - returned, it is the same as 1 and if a bbox is returned, it is the same - as 2. The callable object should take a single argument of the - renderer instance. For example, the following two commands give - identical results :: - - an2 = ax.annotate("Test 2", xy=(1, 0.5), xycoords=an1, - xytext=(30,0), textcoords="offset points") - an2 = ax.annotate("Test 2", xy=(1, 0.5), xycoords=an1.get_window_extent, - xytext=(30,0), textcoords="offset points") - - - 4. A tuple of two coordinate specifications. The first item is for the - x-coordinate and the second is for the y-coordinate. For example, :: - - annotate("Test", xy=(0.5, 1), xycoords=("data", "axes fraction")) - - 0.5 is in data coordinates, and 1 is in normalized axes coordinates. - You may use an artist or transform as with a tuple. For example, - - .. plot:: users/plotting/examples/annotate_simple_coord02.py - :include-source: - - - 5. Sometimes, you want your annotation with some "offset points", not from the - annotated point but from some other point. - :class:`~matplotlib.text.OffsetFrom` is a helper class for such cases. - - .. plot:: users/plotting/examples/annotate_simple_coord03.py - :include-source: - - You may take a look at this example :ref:`pylab_examples-annotation_demo3`. - -Using ConnectorPatch --------------------- - -The ConnectorPatch is like an annotation without text. While the annotate -function is recommended in most situations, the ConnectorPatch is useful when -you want to connect points in different axes. :: - - from matplotlib.patches import ConnectionPatch - xy = (0.2, 0.2) - con = ConnectionPatch(xyA=xy, xyB=xy, coordsA="data", coordsB="data", - axesA=ax1, axesB=ax2) - ax2.add_artist(con) - -The above code connects point xy in the data coordinates of ``ax1`` to -point xy in the data coordinates of ``ax2``. Here is a simple example. - -.. plot:: users/plotting/examples/connect_simple01.py - - -While the ConnectorPatch instance can be added to any axes, you may want to add -it to the axes that is latest in drawing order to prevent overlap by other -axes. - - -Advanced Topics -~~~~~~~~~~~~~~~ - -Zoom effect between Axes ------------------------- - -mpl_toolkits.axes_grid.inset_locator defines some patch classes useful -for interconnecting two axes. Understanding the code requires some -knowledge of how mpl's transform works. But, utilizing it will be -straight forward. - - -.. plot:: mpl_examples/pylab_examples/axes_zoom_effect.py - - -Define Custom BoxStyle ----------------------- - -You can use a custom box style. The value for the ``boxstyle`` can be a -callable object in the following forms.:: - - def __call__(self, x0, y0, width, height, mutation_size, - aspect_ratio=1.): - """ - Given the location and size of the box, return the path of - the box around it. - - - *x0*, *y0*, *width*, *height* : location and size of the box - - *mutation_size* : a reference scale for the mutation. - - *aspect_ratio* : aspect-ratio for the mutation. - """ - path = ... - return path - -Here is a complete example. - -.. plot:: users/plotting/examples/custom_boxstyle01.py - -However, it is recommended that you derive from the -matplotlib.patches.BoxStyle._Base as demonstrated below. - -.. plot:: users/plotting/examples/custom_boxstyle02.py - :include-source: - - -Similarly, you can define a custom ConnectionStyle and a custom ArrowStyle. -See the source code of ``lib/matplotlib/patches.py`` and check -how each style class is defined. diff --git a/_sources/users/artists.rst.txt b/_sources/users/artists.rst.txt deleted file mode 100644 index b6f600b572c..00000000000 --- a/_sources/users/artists.rst.txt +++ /dev/null @@ -1,639 +0,0 @@ -.. _artist-tutorial: - -*************** -Artist tutorial -*************** - -There are three layers to the matplotlib API. The -:class:`matplotlib.backend_bases.FigureCanvas` is the area onto which -the figure is drawn, the :class:`matplotlib.backend_bases.Renderer` is -the object which knows how to draw on the -:class:`~matplotlib.backend_bases.FigureCanvas`, and the -:class:`matplotlib.artist.Artist` is the object that knows how to use -a renderer to paint onto the canvas. The -:class:`~matplotlib.backend_bases.FigureCanvas` and -:class:`~matplotlib.backend_bases.Renderer` handle all the details of -talking to user interface toolkits like `wxPython -`_ or drawing languages like PostScript®, and -the ``Artist`` handles all the high level constructs like representing -and laying out the figure, text, and lines. The typical user will -spend 95% of their time working with the ``Artists``. - -There are two types of ``Artists``: primitives and containers. The primitives -represent the standard graphical objects we want to paint onto our canvas: -:class:`~matplotlib.lines.Line2D`, :class:`~matplotlib.patches.Rectangle`, -:class:`~matplotlib.text.Text`, :class:`~matplotlib.image.AxesImage`, etc., and -the containers are places to put them (:class:`~matplotlib.axis.Axis`, -:class:`~matplotlib.axes.Axes` and :class:`~matplotlib.figure.Figure`). The -standard use is to create a :class:`~matplotlib.figure.Figure` instance, use -the ``Figure`` to create one or more :class:`~matplotlib.axes.Axes` or -:class:`~matplotlib.axes.Subplot` instances, and use the ``Axes`` instance -helper methods to create the primitives. In the example below, we create a -``Figure`` instance using :func:`matplotlib.pyplot.figure`, which is a -convenience method for instantiating ``Figure`` instances and connecting them -with your user interface or drawing toolkit ``FigureCanvas``. As we will -discuss below, this is not necessary -- you can work directly with PostScript, -PDF Gtk+, or wxPython ``FigureCanvas`` instances, instantiate your ``Figures`` -directly and connect them yourselves -- but since we are focusing here on the -``Artist`` API we'll let :mod:`~matplotlib.pyplot` handle some of those details -for us:: - - import matplotlib.pyplot as plt - fig = plt.figure() - ax = fig.add_subplot(2,1,1) # two rows, one column, first plot - -The :class:`~matplotlib.axes.Axes` is probably the most important -class in the matplotlib API, and the one you will be working with most -of the time. This is because the ``Axes`` is the plotting area into -which most of the objects go, and the ``Axes`` has many special helper -methods (:meth:`~matplotlib.axes.Axes.plot`, -:meth:`~matplotlib.axes.Axes.text`, -:meth:`~matplotlib.axes.Axes.hist`, -:meth:`~matplotlib.axes.Axes.imshow`) to create the most common -graphics primitives (:class:`~matplotlib.lines.Line2D`, -:class:`~matplotlib.text.Text`, -:class:`~matplotlib.patches.Rectangle`, -:class:`~matplotlib.image.Image`, respectively). These helper methods -will take your data (e.g., ``numpy`` arrays and strings) and create -primitive ``Artist`` instances as needed (e.g., ``Line2D``), add them to -the relevant containers, and draw them when requested. Most of you -are probably familiar with the :class:`~matplotlib.axes.Subplot`, -which is just a special case of an ``Axes`` that lives on a regular -rows by columns grid of ``Subplot`` instances. If you want to create -an ``Axes`` at an arbitrary location, simply use the -:meth:`~matplotlib.figure.Figure.add_axes` method which takes a list -of ``[left, bottom, width, height]`` values in 0-1 relative figure -coordinates:: - - fig2 = plt.figure() - ax2 = fig2.add_axes([0.15, 0.1, 0.7, 0.3]) - -Continuing with our example:: - - import numpy as np - t = np.arange(0.0, 1.0, 0.01) - s = np.sin(2*np.pi*t) - line, = ax.plot(t, s, color='blue', lw=2) - -In this example, ``ax`` is the ``Axes`` instance created by the -``fig.add_subplot`` call above (remember ``Subplot`` is just a -subclass of ``Axes``) and when you call ``ax.plot``, it creates a -``Line2D`` instance and adds it to the :attr:`Axes.lines -` list. In the interactive `ipython -`_ session below, you can see that the -``Axes.lines`` list is length one and contains the same line that was -returned by the ``line, = ax.plot...`` call: - -.. sourcecode:: ipython - - In [101]: ax.lines[0] - Out[101]: - - In [102]: line - Out[102]: - -If you make subsequent calls to ``ax.plot`` (and the hold state is "on" -which is the default) then additional lines will be added to the list. -You can remove lines later simply by calling the list methods; either -of these will work:: - - del ax.lines[0] - ax.lines.remove(line) # one or the other, not both! - -The Axes also has helper methods to configure and decorate the x-axis -and y-axis tick, tick labels and axis labels:: - - xtext = ax.set_xlabel('my xdata') # returns a Text instance - ytext = ax.set_ylabel('my ydata') - -When you call :meth:`ax.set_xlabel `, -it passes the information on the :class:`~matplotlib.text.Text` -instance of the :class:`~matplotlib.axis.XAxis`. Each ``Axes`` -instance contains an :class:`~matplotlib.axis.XAxis` and a -:class:`~matplotlib.axis.YAxis` instance, which handle the layout and -drawing of the ticks, tick labels and axis labels. - -.. I'm commenting this out, since the new Sphinx cross-references -.. sort of take care of this above - MGD - -.. Here are the most important matplotlib modules that contain the -.. classes referenced above - -.. =============== ================== -.. Artist Module -.. =============== ================== -.. Artist matplotlib.artist -.. Rectangle matplotlib.patches -.. Line2D matplotlib.lines -.. Axes matplotlib.axes -.. XAxis and YAxis matplotlib.axis -.. Figure matplotlib.figure -.. Text matplotlib.text -.. =============== ================== - -Try creating the figure below. - -.. plot:: mpl_examples/pyplots/fig_axes_labels_simple.py - -.. _customizing-artists: - -Customizing your objects -======================== - -Every element in the figure is represented by a matplotlib -:class:`~matplotlib.artist.Artist`, and each has an extensive list of -properties to configure its appearance. The figure itself contains a -:class:`~matplotlib.patches.Rectangle` exactly the size of the figure, -which you can use to set the background color and transparency of the -figures. Likewise, each :class:`~matplotlib.axes.Axes` bounding box -(the standard white box with black edges in the typical matplotlib -plot, has a ``Rectangle`` instance that determines the color, -transparency, and other properties of the Axes. These instances are -stored as member variables :attr:`Figure.patch -` and :attr:`Axes.patch -` ("Patch" is a name inherited from -MATLAB, and is a 2D "patch" of color on the figure, e.g., rectangles, -circles and polygons). Every matplotlib ``Artist`` has the following -properties - -========== ================================================================================ -Property Description -========== ================================================================================ -alpha The transparency - a scalar from 0-1 -animated A boolean that is used to facilitate animated drawing -axes The axes that the Artist lives in, possibly None -clip_box The bounding box that clips the Artist -clip_on Whether clipping is enabled -clip_path The path the artist is clipped to -contains A picking function to test whether the artist contains the pick point -figure The figure instance the artist lives in, possibly None -label A text label (e.g., for auto-labeling) -picker A python object that controls object picking -transform The transformation -visible A boolean whether the artist should be drawn -zorder A number which determines the drawing order -rasterized Boolean; Turns vectors into rastergraphics: (for compression & eps transparency) -========== ================================================================================ - -Each of the properties is accessed with an old-fashioned setter or -getter (yes we know this irritates Pythonistas and we plan to support -direct access via properties or traits but it hasn't been done yet). -For example, to multiply the current alpha by a half:: - - a = o.get_alpha() - o.set_alpha(0.5*a) - -If you want to set a number of properties at once, you can also use -the ``set`` method with keyword arguments. For example:: - - o.set(alpha=0.5, zorder=2) - -If you are working interactively at the python shell, a handy way to -inspect the ``Artist`` properties is to use the -:func:`matplotlib.artist.getp` function (simply -:func:`~matplotlib.pylab.getp` in pylab), which lists the properties -and their values. This works for classes derived from ``Artist`` as -well, e.g., ``Figure`` and ``Rectangle``. Here are the ``Figure`` rectangle -properties mentioned above: - -.. sourcecode:: ipython - - In [149]: matplotlib.artist.getp(fig.patch) - alpha = 1.0 - animated = False - antialiased or aa = True - axes = None - clip_box = None - clip_on = False - clip_path = None - contains = None - edgecolor or ec = w - facecolor or fc = 0.75 - figure = Figure(8.125x6.125) - fill = 1 - hatch = None - height = 1 - label = - linewidth or lw = 1.0 - picker = None - transform = - verts = ((0, 0), (0, 1), (1, 1), (1, 0)) - visible = True - width = 1 - window_extent = - x = 0 - y = 0 - zorder = 1 - -.. TODO: Update these URLs - -The docstrings for all of the classes also contain the ``Artist`` -properties, so you can consult the interactive "help" or the -:ref:`artist-api` for a listing of properties for a given object. - -.. _object-containers: - -Object containers -================= - - -Now that we know how to inspect and set the properties of a given -object we want to configure, we need to know how to get at that object. -As mentioned in the introduction, there are two kinds of objects: -primitives and containers. The primitives are usually the things you -want to configure (the font of a :class:`~matplotlib.text.Text` -instance, the width of a :class:`~matplotlib.lines.Line2D`) although -the containers also have some properties as well -- for example the -:class:`~matplotlib.axes.Axes` :class:`~matplotlib.artist.Artist` is a -container that contains many of the primitives in your plot, but it -also has properties like the ``xscale`` to control whether the xaxis -is 'linear' or 'log'. In this section we'll review where the various -container objects store the ``Artists`` that you want to get at. - -.. _figure-container: - -Figure container -================ - -The top level container ``Artist`` is the -:class:`matplotlib.figure.Figure`, and it contains everything in the -figure. The background of the figure is a -:class:`~matplotlib.patches.Rectangle` which is stored in -:attr:`Figure.patch `. As -you add subplots (:meth:`~matplotlib.figure.Figure.add_subplot`) and -axes (:meth:`~matplotlib.figure.Figure.add_axes`) to the figure -these will be appended to the :attr:`Figure.axes -`. These are also returned by the -methods that create them: - -.. sourcecode:: ipython - - In [156]: fig = plt.figure() - - In [157]: ax1 = fig.add_subplot(211) - - In [158]: ax2 = fig.add_axes([0.1, 0.1, 0.7, 0.3]) - - In [159]: ax1 - Out[159]: - - In [160]: print fig.axes - [, ] - -Because the figure maintains the concept of the "current axes" (see -:meth:`Figure.gca ` and -:meth:`Figure.sca `) to support the -pylab/pyplot state machine, you should not insert or remove axes -directly from the axes list, but rather use the -:meth:`~matplotlib.figure.Figure.add_subplot` and -:meth:`~matplotlib.figure.Figure.add_axes` methods to insert, and the -:meth:`~matplotlib.figure.Figure.delaxes` method to delete. You are -free however, to iterate over the list of axes or index into it to get -access to ``Axes`` instances you want to customize. Here is an -example which turns all the axes grids on:: - - for ax in fig.axes: - ax.grid(True) - - -The figure also has its own text, lines, patches and images, which you -can use to add primitives directly. The default coordinate system for -the ``Figure`` will simply be in pixels (which is not usually what you -want) but you can control this by setting the transform property of -the ``Artist`` you are adding to the figure. - -.. TODO: Is that still true? - -More useful is "figure coordinates" where (0, 0) is the bottom-left of -the figure and (1, 1) is the top-right of the figure which you can -obtain by setting the ``Artist`` transform to :attr:`fig.transFigure -`: - -.. sourcecode:: ipython - - In [191]: fig = plt.figure() - - In [192]: l1 = matplotlib.lines.Line2D([0, 1], [0, 1], - transform=fig.transFigure, figure=fig) - - In [193]: l2 = matplotlib.lines.Line2D([0, 1], [1, 0], - transform=fig.transFigure, figure=fig) - - In [194]: fig.lines.extend([l1, l2]) - - In [195]: fig.canvas.draw() - -.. plot:: mpl_examples/pyplots/fig_x.py - - -Here is a summary of the Artists the figure contains - -.. TODO: Add xrefs to this table - -================ =============================================================== -Figure attribute Description -================ =============================================================== -axes A list of Axes instances (includes Subplot) -patch The Rectangle background -images A list of FigureImages patches - useful for raw pixel display -legends A list of Figure Legend instances (different from Axes.legends) -lines A list of Figure Line2D instances (rarely used, see Axes.lines) -patches A list of Figure patches (rarely used, see Axes.patches) -texts A list Figure Text instances -================ =============================================================== - -.. _axes-container: - -Axes container -============== - -The :class:`matplotlib.axes.Axes` is the center of the matplotlib -universe -- it contains the vast majority of all the ``Artists`` used -in a figure with many helper methods to create and add these -``Artists`` to itself, as well as helper methods to access and -customize the ``Artists`` it contains. Like the -:class:`~matplotlib.figure.Figure`, it contains a -:class:`~matplotlib.patches.Patch` -:attr:`~matplotlib.axes.Axes.patch` which is a -:class:`~matplotlib.patches.Rectangle` for Cartesian coordinates and a -:class:`~matplotlib.patches.Circle` for polar coordinates; this patch -determines the shape, background and border of the plotting region:: - - ax = fig.add_subplot(111) - rect = ax.patch # a Rectangle instance - rect.set_facecolor('green') - -When you call a plotting method, e.g., the canonical -:meth:`~matplotlib.axes.Axes.plot` and pass in arrays or lists of -values, the method will create a :meth:`matplotlib.lines.Line2D` -instance, update the line with all the ``Line2D`` properties passed as -keyword arguments, add the line to the :attr:`Axes.lines -` container, and returns it to you: - -.. sourcecode:: ipython - - In [213]: x, y = np.random.rand(2, 100) - - In [214]: line, = ax.plot(x, y, '-', color='blue', linewidth=2) - -``plot`` returns a list of lines because you can pass in multiple x, y -pairs to plot, and we are unpacking the first element of the length -one list into the line variable. The line has been added to the -``Axes.lines`` list: - -.. sourcecode:: ipython - - In [229]: print ax.lines - [] - -Similarly, methods that create patches, like -:meth:`~matplotlib.axes.Axes.bar` creates a list of rectangles, will -add the patches to the :attr:`Axes.patches -` list: - -.. sourcecode:: ipython - - In [233]: n, bins, rectangles = ax.hist(np.random.randn(1000), 50, facecolor='yellow') - - In [234]: rectangles - Out[234]: - - In [235]: print len(ax.patches) - -You should not add objects directly to the ``Axes.lines`` or -``Axes.patches`` lists unless you know exactly what you are doing, -because the ``Axes`` needs to do a few things when it creates and adds -an object. It sets the figure and axes property of the ``Artist``, as -well as the default ``Axes`` transformation (unless a transformation -is set). It also inspects the data contained in the ``Artist`` to -update the data structures controlling auto-scaling, so that the view -limits can be adjusted to contain the plotted data. You can, -nonetheless, create objects yourself and add them directly to the -``Axes`` using helper methods like -:meth:`~matplotlib.axes.Axes.add_line` and -:meth:`~matplotlib.axes.Axes.add_patch`. Here is an annotated -interactive session illustrating what is going on: - -.. sourcecode:: ipython - - In [261]: fig = plt.figure() - - In [262]: ax = fig.add_subplot(111) - - # create a rectangle instance - In [263]: rect = matplotlib.patches.Rectangle( (1,1), width=5, height=12) - - # by default the axes instance is None - In [264]: print rect.get_axes() - None - - # and the transformation instance is set to the "identity transform" - In [265]: print rect.get_transform() - - - # now we add the Rectangle to the Axes - In [266]: ax.add_patch(rect) - - # and notice that the ax.add_patch method has set the axes - # instance - In [267]: print rect.get_axes() - Axes(0.125,0.1;0.775x0.8) - - # and the transformation has been set too - In [268]: print rect.get_transform() - - - # the default axes transformation is ax.transData - In [269]: print ax.transData - - - # notice that the xlimits of the Axes have not been changed - In [270]: print ax.get_xlim() - (0.0, 1.0) - - # but the data limits have been updated to encompass the rectangle - In [271]: print ax.dataLim.bounds - (1.0, 1.0, 5.0, 12.0) - - # we can manually invoke the auto-scaling machinery - In [272]: ax.autoscale_view() - - # and now the xlim are updated to encompass the rectangle - In [273]: print ax.get_xlim() - (1.0, 6.0) - - # we have to manually force a figure draw - In [274]: ax.figure.canvas.draw() - - -There are many, many ``Axes`` helper methods for creating primitive -``Artists`` and adding them to their respective containers. The table -below summarizes a small sampling of them, the kinds of ``Artist`` they -create, and where they store them - -============================== ==================== ======================= -Helper method Artist Container -============================== ==================== ======================= -ax.annotate - text annotations Annotate ax.texts -ax.bar - bar charts Rectangle ax.patches -ax.errorbar - error bar plots Line2D and Rectangle ax.lines and ax.patches -ax.fill - shared area Polygon ax.patches -ax.hist - histograms Rectangle ax.patches -ax.imshow - image data AxesImage ax.images -ax.legend - axes legends Legend ax.legends -ax.plot - xy plots Line2D ax.lines -ax.scatter - scatter charts PolygonCollection ax.collections -ax.text - text Text ax.texts -============================== ==================== ======================= - - -In addition to all of these ``Artists``, the ``Axes`` contains two -important ``Artist`` containers: the :class:`~matplotlib.axis.XAxis` -and :class:`~matplotlib.axis.YAxis`, which handle the drawing of the -ticks and labels. These are stored as instance variables -:attr:`~matplotlib.axes.Axes.xaxis` and -:attr:`~matplotlib.axes.Axes.yaxis`. The ``XAxis`` and ``YAxis`` -containers will be detailed below, but note that the ``Axes`` contains -many helper methods which forward calls on to the -:class:`~matplotlib.axis.Axis` instances so you often do not need to -work with them directly unless you want to. For example, you can set -the font color of the ``XAxis`` ticklabels using the ``Axes`` helper -method:: - - for label in ax.get_xticklabels(): - label.set_color('orange') - -Below is a summary of the Artists that the Axes contains - -============== ====================================== -Axes attribute Description -============== ====================================== -artists A list of Artist instances -patch Rectangle instance for Axes background -collections A list of Collection instances -images A list of AxesImage -legends A list of Legend instances -lines A list of Line2D instances -patches A list of Patch instances -texts A list of Text instances -xaxis matplotlib.axis.XAxis instance -yaxis matplotlib.axis.YAxis instance -============== ====================================== - -.. _axis-container: - -Axis containers -=============== - -The :class:`matplotlib.axis.Axis` instances handle the drawing of the -tick lines, the grid lines, the tick labels and the axis label. You -can configure the left and right ticks separately for the y-axis, and -the upper and lower ticks separately for the x-axis. The ``Axis`` -also stores the data and view intervals used in auto-scaling, panning -and zooming, as well as the :class:`~matplotlib.ticker.Locator` and -:class:`~matplotlib.ticker.Formatter` instances which control where -the ticks are placed and how they are represented as strings. - -Each ``Axis`` object contains a :attr:`~matplotlib.axis.Axis.label` attribute -(this is what :mod:`~matplotlib.pylab` modifies in calls to -:func:`~matplotlib.pylab.xlabel` and :func:`~matplotlib.pylab.ylabel`) as well -as a list of major and minor ticks. The ticks are -:class:`~matplotlib.axis.XTick` and :class:`~matplotlib.axis.YTick` instances, -which contain the actual line and text primitives that render the ticks and -ticklabels. Because the ticks are dynamically created as needed (e.g., when -panning and zooming), you should access the lists of major and minor ticks -through their accessor methods :meth:`~matplotlib.axis.Axis.get_major_ticks` -and :meth:`~matplotlib.axis.Axis.get_minor_ticks`. Although the ticks contain -all the primitives and will be covered below, ``Axis`` instances have accessor -methods that return the tick lines, tick labels, tick locations etc.: - -.. sourcecode:: ipython - - In [285]: axis = ax.xaxis - - In [286]: axis.get_ticklocs() - Out[286]: array([ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.]) - - In [287]: axis.get_ticklabels() - Out[287]: - - # note there are twice as many ticklines as labels because by - # default there are tick lines at the top and bottom but only tick - # labels below the xaxis; this can be customized - In [288]: axis.get_ticklines() - Out[288]: - - # by default you get the major ticks back - In [291]: axis.get_ticklines() - Out[291]: - - # but you can also ask for the minor ticks - In [292]: axis.get_ticklines(minor=True) - Out[292]: - -Here is a summary of some of the useful accessor methods of the ``Axis`` -(these have corresponding setters where useful, such as -set_major_formatter) - -====================== ========================================================= -Accessor method Description -====================== ========================================================= -get_scale The scale of the axis, e.g., 'log' or 'linear' -get_view_interval The interval instance of the axis view limits -get_data_interval The interval instance of the axis data limits -get_gridlines A list of grid lines for the Axis -get_label The axis label - a Text instance -get_ticklabels A list of Text instances - keyword minor=True|False -get_ticklines A list of Line2D instances - keyword minor=True|False -get_ticklocs A list of Tick locations - keyword minor=True|False -get_major_locator The matplotlib.ticker.Locator instance for major ticks -get_major_formatter The matplotlib.ticker.Formatter instance for major ticks -get_minor_locator The matplotlib.ticker.Locator instance for minor ticks -get_minor_formatter The matplotlib.ticker.Formatter instance for minor ticks -get_major_ticks A list of Tick instances for major ticks -get_minor_ticks A list of Tick instances for minor ticks -grid Turn the grid on or off for the major or minor ticks -====================== ========================================================= - -Here is an example, not recommended for its beauty, which customizes -the axes and tick properties - -.. plot:: mpl_examples/pyplots/fig_axes_customize_simple.py - :include-source: - - -.. _tick-container: - -Tick containers -=============== - -The :class:`matplotlib.axis.Tick` is the final container object in our -descent from the :class:`~matplotlib.figure.Figure` to the -:class:`~matplotlib.axes.Axes` to the :class:`~matplotlib.axis.Axis` -to the :class:`~matplotlib.axis.Tick`. The ``Tick`` contains the tick -and grid line instances, as well as the label instances for the upper -and lower ticks. Each of these is accessible directly as an attribute -of the ``Tick``. In addition, there are boolean variables that determine -whether the upper labels and ticks are on for the x-axis and whether -the right labels and ticks are on for the y-axis. - -============== ========================================================== -Tick attribute Description -============== ========================================================== -tick1line Line2D instance -tick2line Line2D instance -gridline Line2D instance -label1 Text instance -label2 Text instance -gridOn boolean which determines whether to draw the gridline -tick1On boolean which determines whether to draw the 1st tickline -tick2On boolean which determines whether to draw the 2nd tickline -label1On boolean which determines whether to draw the 1st tick label -label2On boolean which determines whether to draw the 2nd tick label -============== ========================================================== - -Here is an example which sets the formatter for the right side ticks with -dollar signs and colors them green on the right side of the yaxis - -.. plot:: mpl_examples/pyplots/dollar_ticks.py - :include-source: diff --git a/_sources/users/color_index.rst.txt b/_sources/users/color_index.rst.txt deleted file mode 100644 index 84238a040f0..00000000000 --- a/_sources/users/color_index.rst.txt +++ /dev/null @@ -1,16 +0,0 @@ -.. _color-index: - -======== - Colors -======== - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. toctree:: - - colors.rst - colormaps.rst - colormapnorms.rst diff --git a/_sources/users/colormapnorms.rst.txt b/_sources/users/colormapnorms.rst.txt deleted file mode 100644 index e7ea1425134..00000000000 --- a/_sources/users/colormapnorms.rst.txt +++ /dev/null @@ -1,136 +0,0 @@ -.. _colormapnorm-tutorial: - -Colormap Normalization -====================== - -Objects that use colormaps by default linearly map the colors in the -colormap from data values *vmin* to *vmax*. For example:: - - pcm = ax.pcolormesh(x, y, Z, vmin=-1., vmax=1., cmap='RdBu_r') - -will map the data in *Z* linearly from -1 to +1, so *Z=0* will -give a color at the center of the colormap *RdBu_r* (white in this -case). - -Matplotlib does this mapping in two steps, with a normalization from -[0,1] occurring first, and then mapping onto the indices in the -colormap. Normalizations are classes defined in the -:func:`matplotlib.colors` module. The default, linear normalization is -:func:`matplotlib.colors.Normalize`. - -Artists that map data to color pass the arguments *vmin* and *vmax* to -construct a :func:`matplotlib.colors.Normalize` instance, then call it: - -.. ipython:: - - In [1]: import matplotlib as mpl - - In [2]: norm = mpl.colors.Normalize(vmin=-1.,vmax=1.) - - In [3]: norm(0.) - Out[3]: 0.5 - -However, there are sometimes cases where it is useful to map data to -colormaps in a non-linear fashion. - -Logarithmic ------------ - -One of the most common transformations is to plot data by taking -its logarithm (to the base-10). This transformation is useful to -display changes across disparate scales. Using :func:`colors.LogNorm` -normalizes the data via :math:`log_{10}`. In the example below, -there are two bumps, one much smaller than the other. Using -:func:`colors.LogNorm`, the shape and location of each bump can clearly -be seen: - -.. plot:: users/plotting/examples/colormap_normalizations_lognorm.py - :include-source: - -Symmetric logarithmic ---------------------- - -Similarly, it sometimes happens that there is data that is positive -and negative, but we would still like a logarithmic scaling applied to -both. In this case, the negative numbers are also scaled -logarithmically, and mapped to smaller numbers; e.g., if `vmin=-vmax`, -then they the negative numbers are mapped from 0 to 0.5 and the -positive from 0.5 to 1. - -Since the logarithm of values close to zero tends toward infinity, a -small range around zero needs to be mapped linearly. The parameter -*linthresh* allows the user to specify the size of this range -(-*linthresh*, *linthresh*). The size of this range in the colormap is -set by *linscale*. When *linscale* == 1.0 (the default), the space used -for the positive and negative halves of the linear range will be equal -to one decade in the logarithmic range. - -.. plot:: users/plotting/examples/colormap_normalizations_symlognorm.py - :include-source: - -Power-law ---------- - -Sometimes it is useful to remap the colors onto a power-law -relationship (i.e. :math:`y=x^{\gamma}`, where :math:`\gamma` is the -power). For this we use the :func:`colors.PowerNorm`. It takes as an -argument *gamma* (*gamma* == 1.0 will just yield the default linear -normalization): - -.. note:: - - There should probably be a good reason for plotting the data using - this type of transformation. Technical viewers are used to linear - and logarithmic axes and data transformations. Power laws are less - common, and viewers should explicitly be made aware that they have - been used. - - -.. plot:: users/plotting/examples/colormap_normalizations_power.py - :include-source: - -Discrete bounds ---------------- - -Another normaization that comes with matplolib is -:func:`colors.BoundaryNorm`. In addition to *vmin* and *vmax*, this -takes as arguments boundaries between which data is to be mapped. The -colors are then linearly distributed between these "bounds". For -instance: - -.. ipython:: - - In [2]: import matplotlib.colors as colors - - In [3]: bounds = np.array([-0.25, -0.125, 0, 0.5, 1]) - - In [4]: norm = colors.BoundaryNorm(boundaries=bounds, ncolors=4) - - In [5]: print(norm([-0.2,-0.15,-0.02, 0.3, 0.8, 0.99])) - [0 0 1 2 3 3] - -Note unlike the other norms, this norm returns values from 0 to *ncolors*-1. - -.. plot:: users/plotting/examples/colormap_normalizations_bounds.py - :include-source: - - -Custom normalization: Two linear ranges ---------------------------------------- - -It is possible to define your own normalization. In the following -example, we modify :func:`colors:SymLogNorm` to use different linear -maps for the negative data values and the positive. (Note that this -example is simple, and does not validate inputs or account for complex -cases such as masked data) - -.. note:: - This may appear soon as :func:`colors.OffsetNorm`. - - As above, non-symmetric mapping of data to color is non-standard - practice for quantitative data, and should only be used advisedly. A - practical example is having an ocean/land colormap where the land and - ocean data span different ranges. - -.. plot:: users/plotting/examples/colormap_normalizations_custom.py - :include-source: diff --git a/_sources/users/colormaps.rst.txt b/_sources/users/colormaps.rst.txt deleted file mode 100644 index 92c390c5431..00000000000 --- a/_sources/users/colormaps.rst.txt +++ /dev/null @@ -1,194 +0,0 @@ -.. _colormaps: - -****************** -Choosing Colormaps -****************** - - -Overview -======== - -The idea behind choosing a good colormap is to find a good representation in 3D -colorspace for your data set. The best colormap for any given data set depends -on many things including: - -- Whether representing form or metric data ([Ware]_) - -- Your knowledge of the data set (*e.g.*, is there a critical value - from which the other values deviate?) - -- If there is an intuitive color scheme for the parameter you are plotting - -- If there is a standard in the field the audience may be expecting - -For many applications, a perceptually uniform colormap is the best -choice --- one in which equal steps in data are perceived as equal -steps in the color space. Researchers have found that the human brain -perceives changes in the lightness parameter as changes in the data -much better than, for example, changes in hue. Therefore, colormaps -which have monotonically increasing lightness through the colormap -will be better interpreted by the viewer. A wonderful example of -perceptually uniform colormaps is [colorcet]_. - -Color can be represented in 3D space in various ways. One way to represent color -is using CIELAB. In CIELAB, color space is represented by lightness, -:math:`L^*`; red-green, :math:`a^*`; and yellow-blue, :math:`b^*`. The lightness -parameter :math:`L^*` can then be used to learn more about how the matplotlib -colormaps will be perceived by viewers. - -An excellent starting resource for learning about human perception of colormaps -is from [IBM]_. - - -Classes of colormaps -==================== - -Colormaps are often split into several categories based on their function (see, -*e.g.*, [Moreland]_): - -1. Sequential: change in lightness and often saturation of color - incrementally, often using a single hue; should be used for - representing information that has ordering. - -2. Diverging: change in lightness and possibly saturation of two - different colors that meet in the middle at an unsaturated color; - should be used when the information being plotted has a critical - middle value, such as topography or when the data deviates around - zero. - -3. Qualitative: often are miscellaneous colors; should be used to - represent information which does not have ordering or - relationships. - - -Lightness of matplotlib colormaps -================================= - -Here we examine the lightness values of the matplotlib colormaps. Note that some -documentation on the colormaps is available ([list-colormaps]_). - -Sequential ----------- - -For the Sequential plots, the lightness value increases monotonically through -the colormaps. This is good. Some of the :math:`L^*` values in the colormaps -span from 0 to 100 (binary and the other grayscale), and others start around -:math:`L^*=20`. Those that have a smaller range of :math:`L^*` will accordingly -have a smaller perceptual range. Note also that the :math:`L^*` function varies -amongst the colormaps: some are approximately linear in :math:`L^*` and others -are more curved. - -Sequential2 ------------ - -Many of the :math:`L^*` values from the Sequential2 plots are monotonically -increasing, but some (autumn, cool, spring, and winter) plateau or even go both -up and down in :math:`L^*` space. Others (afmhot, copper, gist_heat, and hot) -have kinks in the :math:`L^*` functions. Data that is being represented in a -region of the colormap that is at a plateau or kink will lead to a perception of -banding of the data in those values in the colormap (see [mycarta-banding]_ for -an excellent example of this). - -Diverging ---------- - -For the Diverging maps, we want to have monotonically increasing :math:`L^*` -values up to a maximum, which should be close to :math:`L^*=100`, followed by -monotonically decreasing :math:`L^*` values. We are looking for approximately -equal minimum :math:`L^*` values at opposite ends of the colormap. By these -measures, BrBG and RdBu are good options. coolwarm is a good option, but it -doesn't span a wide range of :math:`L^*` values (see grayscale section below). - -Qualitative ------------ - -Qualitative colormaps are not aimed at being perceptual maps, but looking at the -lightness parameter can verify that for us. The :math:`L^*` values move all over -the place throughout the colormap, and are clearly not monotonically increasing. -These would not be good options for use as perceptual colormaps. - -Miscellaneous -------------- - -Some of the miscellaneous colormaps have particular uses for which -they have been created. For example, gist_earth, ocean, and terrain -all seem to be created for plotting topography (green/brown) and water -depths (blue) together. We would expect to see a divergence in these -colormaps, then, but multiple kinks may not be ideal, such as in -gist_earth and terrain. CMRmap was created to convert well to -grayscale, though it does appear to have some small kinks in -:math:`L^*`. cubehelix was created to vary smoothly in both lightness -and hue, but appears to have a small hump in the green hue area. - -The often-used jet colormap is included in this set of colormaps. We can see -that the :math:`L^*` values vary widely throughout the colormap, making it a -poor choice for representing data for viewers to see perceptually. See an -extension on this idea at [mycarta-jet]_. - -.. plot:: users/plotting/colormaps/lightness.py - -Grayscale conversion -==================== - -It is important to pay attention to conversion to grayscale for color -plots, since they may be printed on black and white printers. If not -carefully considered, your readers may end up with indecipherable -plots because the grayscale changes unpredictably through the -colormap. - -Conversion to grayscale is done in many different ways [bw]_. Some of the better -ones use a linear combination of the rgb values of a pixel, but weighted -according to how we perceive color intensity. A nonlinear method of conversion -to grayscale is to use the :math:`L^*` values of the pixels. In general, similar -principles apply for this question as they do for presenting one's information -perceptually; that is, if a colormap is chosen that is monotonically increasing -in :math:`L^*` values, it will print in a reasonable manner to grayscale. - -With this in mind, we see that the Sequential colormaps have reasonable -representations in grayscale. Some of the Sequential2 colormaps have decent -enough grayscale representations, though some (autumn, spring, summer, winter) -have very little grayscale change. If a colormap like this was used in a plot -and then the plot was printed to grayscale, a lot of the information may map to -the same gray values. The Diverging colormaps mostly vary from darker gray on -the outer edges to white in the middle. Some (PuOr and seismic) have noticably -darker gray on one side than the other and therefore are not very symmetric. -coolwarm has little range of gray scale and would print to a more uniform plot, -losing a lot of detail. Note that overlaid, labeled contours could help -differentiate between one side of the colormap vs. the other since color cannot -be used once a plot is printed to grayscale. Many of the Qualitative and -Miscellaneous colormaps, such as Accent, hsv, and jet, change from darker to -lighter and back to darker gray throughout the colormap. This would make it -impossible for a viewer to interpret the information in a plot once it is -printed in grayscale. - -.. plot:: users/plotting/colormaps/grayscale.py - - -Color vision deficiencies -========================= - -There is a lot of information available about color blindness (*e.g.*, -[colorblindness]_). Additionally, there are tools available to convert images to -how they look for different types of color vision deficiencies (*e.g.*, -[vischeck]_). - -The most common form of color vision deficiency involves differentiating between -red and green. Thus, avoiding colormaps with both red and green will avoid many -problems in general. - - -References -========== - -.. [colorcet] https://github.com/bokeh/colorcet -.. [Ware] http://ccom.unh.edu/sites/default/files/publications/Ware_1988_CGA_Color_sequences_univariate_maps.pdf -.. [Moreland] http://www.sandia.gov/~kmorel/documents/ColorMaps/ColorMapsExpanded.pdf -.. [list-colormaps] https://gist.github.com/endolith/2719900#id7 -.. [mycarta-banding] https://mycarta.wordpress.com/2012/10/14/the-rainbow-is-deadlong-live-the-rainbow-part-4-cie-lab-heated-body/ -.. [mycarta-jet] https://mycarta.wordpress.com/2012/10/06/the-rainbow-is-deadlong-live-the-rainbow-part-3/ -.. [mycarta-lablinear] https://mycarta.wordpress.com/2012/12/06/the-rainbow-is-deadlong-live-the-rainbow-part-5-cie-lab-linear-l-rainbow/ -.. [mycarta-cubelaw] https://mycarta.wordpress.com/2013/02/21/perceptual-rainbow-palette-the-method/ -.. [bw] http://www.tannerhelland.com/3643/grayscale-image-algorithm-vb6/ -.. [colorblindness] http://www.color-blindness.com/ -.. [vischeck] http://www.vischeck.com/vischeck/ -.. [IBM] http://www.research.ibm.com/people/l/lloydt/color/color.HTM diff --git a/_sources/users/colors.rst.txt b/_sources/users/colors.rst.txt deleted file mode 100644 index d08861bccec..00000000000 --- a/_sources/users/colors.rst.txt +++ /dev/null @@ -1,116 +0,0 @@ -.. _colors: - -***************** -Specifying Colors -***************** - -In almost all places in matplotlib where a color can be specified by the user -it can be provided as: - -* an RGB or RGBA tuple of float values in ``[0, 1]`` - (e.g., ``(0.1, 0.2, 0.5)`` or ``(0.1, 0.2, 0.5, 0.3)``) -* a hex RGB or RGBA string (e.g., ``'#0F0F0F'`` or ``'#0F0F0F0F'``) -* a string representation of a float value in ``[0, 1]`` - inclusive for gray level (e.g., ``'0.5'``) -* one of ``{'b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'}`` -* a X11/CSS4 color name -* a name from the `xkcd color survey `__ - prefixed with ``'xkcd:'`` (e.g., ``'xkcd:sky blue'``) -* one of ``{'C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8', 'C9'}`` -* one of ``{'tab:blue', 'tab:orange', 'tab:green', - 'tab:red', 'tab:purple', 'tab:brown', 'tab:pink', - 'tab:gray', 'tab:olive', 'tab:cyan'}`` which are the Tableau Colors from the - 'T10' categorical palette (which is the default color cycle). - -All string specifications of color are case-insensitive. - - -``'CN'`` color selection ------------------------- - -Color can be specified by a string matching the regex ``C[0-9]``. -This can be passed any place that a color is currently accepted and -can be used as a 'single character color' in format-string to -`matplotlib.Axes.plot`. - -The single digit is the index into the default property cycle -(``matplotlib.rcParams['axes.prop_cycle']``). If the property cycle does not -include ``'color'`` then black is returned. The color is evaluated when the -artist is created. For example, - -.. plot:: - :include-source: True - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib as mpl - th = np.linspace(0, 2*np.pi, 128) - - def demo(sty): - mpl.style.use(sty) - fig, ax = plt.subplots(figsize=(3, 3)) - - ax.set_title('style: {!r}'.format(sty), color='C0') - - ax.plot(th, np.cos(th), 'C1', label='C1') - ax.plot(th, np.sin(th), 'C2', label='C2') - ax.legend() - - demo('default') - demo('seaborn') - -will use the first color for the title and then plot using the second -and third colors of each style's ``mpl.rcParams['axes.prop_cycle']``. - - -xkcd v X11/CSS4 ---------------- - -The xkcd colors are derived from a user survey conducted by the -webcomic xkcd. `Details of the survey are available on the xkcd blog -`__. - -Out of 148 colors in the CSS color list, there are 95 name collisions -between the X11/CSS4 names and the xkcd names, all but 3 of which have -different hex values. For example ``'blue'`` maps to ``'#0000FF'`` -where as ``'xkcd:blue'`` maps to ``'#0343DF'``. Due to these name -collisions all of the xkcd colors have ``'xkcd:'`` prefixed. As noted in -the blog post, while it might be interesting to re-define the X11/CSS4 names -based on such a survey, we do not do so unilaterally. - -The name collisions are shown in the table below; the color names -where the hex values agree are shown in bold. - - -.. plot:: - - import matplotlib.pyplot as plt - import matplotlib._color_data as mcd - import matplotlib.patches as mpatch - - overlap = {name for name in mcd.CSS4_COLORS - if "xkcd:" + name in mcd.XKCD_COLORS} - - fig = plt.figure(figsize=[4.8, 16]) - ax = fig.add_axes([0, 0, 1, 1]) - - for j, n in enumerate(sorted(overlap, reverse=True)): - weight = None - cn = mcd.CSS4_COLORS[n] - xkcd = mcd.XKCD_COLORS["xkcd:" + n].upper() - if cn == xkcd: - weight = 'bold' - - r1 = mpatch.Rectangle((0, j), 1, 1, color=cn) - r2 = mpatch.Rectangle((1, j), 1, 1, color=xkcd) - txt = ax.text(2, j+.5, ' ' + n, va='center', fontsize=10, - weight=weight) - ax.add_patch(r1) - ax.add_patch(r2) - ax.axhline(j, color='k') - - ax.text(.5, j + 1.5, 'X11', ha='center', va='center') - ax.text(1.5, j + 1.5, 'xkcd', ha='center', va='center') - ax.set_xlim(0, 3) - ax.set_ylim(0, j + 2) - ax.axis('off') diff --git a/_sources/users/customizing.rst.txt b/_sources/users/customizing.rst.txt deleted file mode 100644 index 4a4c887d0f3..00000000000 --- a/_sources/users/customizing.rst.txt +++ /dev/null @@ -1,182 +0,0 @@ -.. _customizing-matplotlib: - -======================== - Customizing matplotlib -======================== - -Using style sheets -================== - -The ``style`` package adds support for easy-to-switch plotting "styles" with -the same parameters as a matplotlibrc_ file (which is read at startup to -configure matplotlib). - -There are a number of pre-defined styles provided by matplotlib. For -example, there's a pre-defined style called "ggplot", which emulates the -aesthetics of ggplot_ (a popular plotting package for R_). To use this style, -just add:: - - >>> import matplotlib.pyplot as plt - >>> plt.style.use('ggplot') - -To list all available styles, use:: - - >>> print(plt.style.available) - - -Defining your own style ------------------------ - -You can create custom styles and use them by calling ``style.use`` with the -path or URL to the style sheet. Additionally, if you add your -``.mplstyle`` file to ``mpl_configdir/stylelib``, you can reuse -your custom style sheet with a call to ``style.use()``. By default -``mpl_configdir`` should be ``~/.config/matplotlib``, but you can check where -yours is with ``matplotlib.get_configdir()``; you may need to create this -directory. You also can change the directory where matplotlib looks for -the stylelib/ folder by setting the MPLCONFIGDIR environment variable, -see :ref:`locating-matplotlib-config-dir`. - -Note that a custom style sheet in ``mpl_configdir/stylelib`` will -override a style sheet defined by matplotlib if the styles have the same name. - -For example, you might want to create -``mpl_configdir/stylelib/presentation.mplstyle`` with the following:: - - axes.titlesize : 24 - axes.labelsize : 20 - lines.linewidth : 3 - lines.markersize : 10 - xtick.labelsize : 16 - ytick.labelsize : 16 - -Then, when you want to adapt a plot designed for a paper to one that looks -good in a presentation, you can just add:: - - >>> import matplotlib.pyplot as plt - >>> plt.style.use('presentation') - - -Composing styles ----------------- - -Style sheets are designed to be composed together. So you can have a style -sheet that customizes colors and a separate style sheet that alters element -sizes for presentations. These styles can easily be combined by passing -a list of styles:: - - >>> import matplotlib.pyplot as plt - >>> plt.style.use(['dark_background', 'presentation']) - -Note that styles further to the right will overwrite values that are already -defined by styles on the left. - - -Temporary styling ------------------ - -If you only want to use a style for a specific block of code but don't want -to change the global styling, the style package provides a context manager -for limiting your changes to a specific scope. To isolate your styling -changes, you can write something like the following:: - - >>> import numpy as np - >>> import matplotlib.pyplot as plt - >>> - >>> with plt.style.context(('dark_background')): - >>> plt.plot(np.sin(np.linspace(0, 2 * np.pi)), 'r-o') - >>> - >>> # Some plotting code with the default style - >>> - >>> plt.show() - - -matplotlib rcParams -=================== - -.. _customizing-with-dynamic-rc-settings: - -Dynamic rc settings -------------------- - -You can also dynamically change the default rc settings in a python script or -interactively from the python shell. All of the rc settings are stored in a -dictionary-like variable called :data:`matplotlib.rcParams`, which is global to -the matplotlib package. rcParams can be modified directly, for example:: - - import matplotlib as mpl - mpl.rcParams['lines.linewidth'] = 2 - mpl.rcParams['lines.color'] = 'r' - -Matplotlib also provides a couple of convenience functions for modifying rc -settings. The :func:`matplotlib.rc` command can be used to modify multiple -settings in a single group at once, using keyword arguments:: - - import matplotlib as mpl - mpl.rc('lines', linewidth=2, color='r') - -The :func:`matplotlib.rcdefaults` command will restore the standard matplotlib -default settings. - -There is some degree of validation when setting the values of rcParams, see -:mod:`matplotlib.rcsetup` for details. - -.. _customizing-with-matplotlibrc-files: - -The :file:`matplotlibrc` file ------------------------------ - -matplotlib uses :file:`matplotlibrc` configuration files to customize all kinds -of properties, which we call `rc settings` or `rc parameters`. You can control -the defaults of almost every property in matplotlib: figure size and dpi, line -width, color and style, axes, axis and grid properties, text and font -properties and so on. matplotlib looks for :file:`matplotlibrc` in four -locations, in the following order: - -1. :file:`matplotlibrc` in the current working directory, usually used for - specific customizations that you do not want to apply elsewhere. - -2. :file:`$MATPLOTLIBRC/matplotlibrc`. - -3. It next looks in a user-specific place, depending on your platform: - - - On Linux and FreeBSD, it looks in :file:`.config/matplotlib/matplotlibrc` - (or `$XDG_CONFIG_HOME/matplotlib/matplotlibrc`) if you've customized - your environment. - - - On other platforms, it looks in :file:`.matplotlib/matplotlibrc`. - - See :ref:`locating-matplotlib-config-dir`. - -4. :file:`{INSTALL}/matplotlib/mpl-data/matplotlibrc`, where - :file:`{INSTALL}` is something like - :file:`/usr/lib/python3.5/site-packages` on Linux, and maybe - :file:`C:\\Python35\\Lib\\site-packages` on Windows. Every time you - install matplotlib, this file will be overwritten, so if you want - your customizations to be saved, please move this file to your - user-specific matplotlib directory. - -To display where the currently active :file:`matplotlibrc` file was -loaded from, one can do the following:: - - >>> import matplotlib - >>> matplotlib.matplotlib_fname() - '/home/foo/.config/matplotlib/matplotlibrc' - -See below for a sample :ref:`matplotlibrc file`. - -.. _matplotlibrc-sample: - -A sample matplotlibrc file -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. htmlonly:: - - `(download) <../_static/matplotlibrc>`__ - -.. literalinclude:: ../_static/matplotlibrc - - -.. _matplotlibrc: http://matplotlib.org/users/customizing.html -.. _ggplot: http://ggplot2.org/ -.. _R: https://www.r-project.org/ diff --git a/_sources/users/examples_index.rst.txt b/_sources/users/examples_index.rst.txt deleted file mode 100644 index e71c1db6d8a..00000000000 --- a/_sources/users/examples_index.rst.txt +++ /dev/null @@ -1,8 +0,0 @@ -=================== - Selected Examples -=================== - -.. toctree:: - - screenshots.rst - recipes.rst diff --git a/_sources/users/gridspec.rst.txt b/_sources/users/gridspec.rst.txt deleted file mode 100644 index f62d723ac21..00000000000 --- a/_sources/users/gridspec.rst.txt +++ /dev/null @@ -1,164 +0,0 @@ -.. _gridspec-guide: - - -********************************************** -Customizing Location of Subplot Using GridSpec -********************************************** - - :class:`~matplotlib.gridspec.GridSpec` - specifies the geometry of the grid that a subplot will be - placed. The number of rows and number of columns of the grid - need to be set. Optionally, the subplot layout parameters - (e.g., left, right, etc.) can be tuned. - - :class:`~matplotlib.gridspec.SubplotSpec` - specifies the location of the subplot in the given *GridSpec*. - - :func:`~matplotlib.pyplot.subplot2grid` - a helper function that is similar to :func:`~matplotlib.pyplot.subplot` - but uses 0-based indexing and let subplot to occupy multiple cells. - - -Basic Example of using subplot2grid -=================================== - -To use :func:`~matplotlib.pyplot.subplot2grid`, you provide geometry of -the grid and the location of the subplot in the grid. For a simple -single-cell subplot:: - - ax = plt.subplot2grid((2, 2), (0, 0)) - -is identical to :: - - ax = plt.subplot(2, 2, 1) - -Note that, unlike Matplotlib's subplot, the index starts from 0 in GridSpec. - -To create a subplot that spans multiple cells, :: - - ax2 = plt.subplot2grid((3, 3), (1, 0), colspan=2) - ax3 = plt.subplot2grid((3, 3), (1, 2), rowspan=2) - -For example, the following commands :: - - ax1 = plt.subplot2grid((3, 3), (0, 0), colspan=3) - ax2 = plt.subplot2grid((3, 3), (1, 0), colspan=2) - ax3 = plt.subplot2grid((3, 3), (1, 2), rowspan=2) - ax4 = plt.subplot2grid((3, 3), (2, 0)) - ax5 = plt.subplot2grid((3, 3), (2, 1)) - -creates - -.. plot:: users/plotting/examples/demo_gridspec01.py - - -GridSpec and SubplotSpec -======================== - -You can create :class:`~matplotlib.gridspec.GridSpec` explicitly and use -them to create a subplot. - -For example, :: - - ax = plt.subplot2grid((2, 2), (0, 0)) - -is equal to :: - - import matplotlib.gridspec as gridspec - gs = gridspec.GridSpec(2, 2) - ax = plt.subplot(gs[0, 0]) - -A GridSpec instance provides array-like (2d or 1d) indexing that -returns the SubplotSpec instance. For a SubplotSpec that spans multiple -cells, use slice. :: - - ax2 = plt.subplot(gs[1, :-1]) - ax3 = plt.subplot(gs[1:, -1]) - -The above example becomes :: - - gs = gridspec.GridSpec(3, 3) - ax1 = plt.subplot(gs[0, :]) - ax2 = plt.subplot(gs[1, :-1]) - ax3 = plt.subplot(gs[1:, -1]) - ax4 = plt.subplot(gs[-1, 0]) - ax5 = plt.subplot(gs[-1, -2]) - -.. plot:: users/plotting/examples/demo_gridspec02.py - -Adjust GridSpec layout -====================== - -When a GridSpec is explicitly used, you can adjust the layout -parameters of subplots that are created from the GridSpec. :: - - gs1 = gridspec.GridSpec(3, 3) - gs1.update(left=0.05, right=0.48, wspace=0.05) - -This is similar to :func:`~matplotlib.pyplot.subplots_adjust`, but it only -affects the subplots that are created from the given GridSpec. - -The code below :: - - gs1 = gridspec.GridSpec(3, 3) - gs1.update(left=0.05, right=0.48, wspace=0.05) - ax1 = plt.subplot(gs1[:-1, :]) - ax2 = plt.subplot(gs1[-1, :-1]) - ax3 = plt.subplot(gs1[-1, -1]) - - gs2 = gridspec.GridSpec(3, 3) - gs2.update(left=0.55, right=0.98, hspace=0.05) - ax4 = plt.subplot(gs2[:, :-1]) - ax5 = plt.subplot(gs2[:-1, -1]) - ax6 = plt.subplot(gs2[-1, -1]) - -creates - -.. plot:: users/plotting/examples/demo_gridspec03.py - -GridSpec using SubplotSpec -========================== - -You can create GridSpec from the :class:`~matplotlib.gridspec.SubplotSpec`, -in which case its layout parameters are set to that of the location of -the given SubplotSpec. :: - - gs0 = gridspec.GridSpec(1, 2) - - gs00 = gridspec.GridSpecFromSubplotSpec(3, 3, subplot_spec=gs0[0]) - gs01 = gridspec.GridSpecFromSubplotSpec(3, 3, subplot_spec=gs0[1]) - - -.. plot:: users/plotting/examples/demo_gridspec04.py - - -A Complex Nested GridSpec using SubplotSpec -=========================================== - -Here's a more sophisticated example of nested GridSpec where we put -a box around each cell of the outer 4x4 grid, by hiding appropriate -spines in each of the inner 3x3 grids. - -.. plot:: users/plotting/examples/demo_gridspec06.py - - -GridSpec with Varying Cell Sizes -================================ - -By default, GridSpec creates cells of equal sizes. You can adjust -relative heights and widths of rows and columns. Note that absolute -values are meaningless, only their relative ratios matter. :: - - gs = gridspec.GridSpec(2, 2, - width_ratios=[1, 2], - height_ratios=[4, 1] - ) - - ax1 = plt.subplot(gs[0]) - ax2 = plt.subplot(gs[1]) - ax3 = plt.subplot(gs[2]) - ax4 = plt.subplot(gs[3]) - - -.. plot:: users/plotting/examples/demo_gridspec05.py - diff --git a/_sources/users/image_tutorial.rst.txt b/_sources/users/image_tutorial.rst.txt deleted file mode 100644 index 1d1f58ee5e8..00000000000 --- a/_sources/users/image_tutorial.rst.txt +++ /dev/null @@ -1,384 +0,0 @@ -.. _image_tutorial: - - -************** -Image tutorial -************** - -.. _imaging_startup: - -Startup commands -=================== - -First, let's start IPython. It is a most excellent enhancement to the -standard Python prompt, and it ties in especially well with -Matplotlib. Start IPython either at a shell, or the IPython Notebook now. - -With IPython started, we now need to connect to a GUI event loop. This -tells IPython where (and how) to display plots. To connect to a GUI -loop, execute the **%matplotlib** magic at your IPython prompt. There's more -detail on exactly what this does at `IPython's documentation on GUI -event loops -`_. - -If you're using IPython Notebook, the same commands are available, but -people commonly use a specific argument to the %matplotlib magic: - -.. sourcecode:: ipython - - In [1]: %matplotlib inline - -This turns on inline plotting, where plot graphics will appear in your -notebook. This has important implications for interactivity. For inline plotting, commands in -cells below the cell that outputs a plot will not affect the plot. For example, -changing the color map is not possible from cells below the cell that creates a plot. -However, for other backends, such as qt4, that open a separate window, -cells below those that create the plot will change the plot - it is a -live object in memory. - -This tutorial will use matplotlib's imperative-style plotting -interface, pyplot. This interface maintains global state, and is very -useful for quickly and easily experimenting with various plot -settings. The alternative is the object-oriented interface, which is also -very powerful, and generally more suitable for large application -development. If you'd like to learn about the object-oriented -interface, a great place to start is our `FAQ on usage -`_. For now, let's get on -with the imperative-style approach: - -.. sourcecode:: ipython - - In [2]: import matplotlib.pyplot as plt - In [3]: import matplotlib.image as mpimg - In [4]: import numpy as np - -.. _importing_data: - -Importing image data into Numpy arrays -=============================================== - -Loading image data is supported by the `Pillow -`_ library. Natively, matplotlib only -supports PNG images. The commands shown below fall back on Pillow if the -native read fails. - -The image used in this example is a PNG file, but keep that Pillow -requirement in mind for your own data. - -Here's the image we're going to play with: - -.. image:: ../_static/stinkbug.png - -It's a 24-bit RGB PNG image (8 bits for each of R, G, B). Depending -on where you get your data, the other kinds of image that you'll most -likely encounter are RGBA images, which allow for transparency, or -single-channel grayscale (luminosity) images. You can right click on -it and choose "Save image as" to download it to your computer for the -rest of this tutorial. - -And here we go... - -.. sourcecode:: ipython - - In [5]: img=mpimg.imread('stinkbug.png') - Out[5]: - array([[[ 0.40784314, 0.40784314, 0.40784314], - [ 0.40784314, 0.40784314, 0.40784314], - [ 0.40784314, 0.40784314, 0.40784314], - ..., - [ 0.42745098, 0.42745098, 0.42745098], - [ 0.42745098, 0.42745098, 0.42745098], - [ 0.42745098, 0.42745098, 0.42745098]], - - ..., - [[ 0.44313726, 0.44313726, 0.44313726], - [ 0.4509804 , 0.4509804 , 0.4509804 ], - [ 0.4509804 , 0.4509804 , 0.4509804 ], - ..., - [ 0.44705883, 0.44705883, 0.44705883], - [ 0.44705883, 0.44705883, 0.44705883], - [ 0.44313726, 0.44313726, 0.44313726]]], dtype=float32) - -Note the dtype there - float32. Matplotlib has rescaled the 8 bit -data from each channel to floating point data between 0.0 and 1.0. As -a side note, the only datatype that Pillow can work with is uint8. -Matplotlib plotting can handle float32 and uint8, but image -reading/writing for any format other than PNG is limited to uint8 -data. Why 8 bits? Most displays can only render 8 bits per channel -worth of color gradation. Why can they only render 8 bits/channel? -Because that's about all the human eye can see. More here (from a -photography standpoint): `Luminous Landscape bit depth tutorial -`_. - -Each inner list represents a pixel. Here, with an RGB image, there -are 3 values. Since it's a black and white image, R, G, and B are all -similar. An RGBA (where A is alpha, or transparency), has 4 values -per inner list, and a simple luminance image just has one value (and -is thus only a 2-D array, not a 3-D array). For RGB and RGBA images, -matplotlib supports float32 and uint8 data types. For grayscale, -matplotlib supports only float32. If your array data does not meet -one of these descriptions, you need to rescale it. - -.. _plotting_data: - -Plotting numpy arrays as images -=================================== - -So, you have your data in a numpy array (either by importing it, or by -generating it). Let's render it. In Matplotlib, this is performed -using the :func:`~matplotlib.pyplot.imshow` function. Here we'll grab -the plot object. This object gives you an easy way to manipulate the -plot from the prompt. - -.. sourcecode:: ipython - - In [6]: imgplot = plt.imshow(img) - -.. plot:: - - import matplotlib.pyplot as plt - import matplotlib.image as mpimg - import numpy as np - img = mpimg.imread('../_static/stinkbug.png') - imgplot = plt.imshow(img) - -You can also plot any numpy array. - -.. _Pseudocolor: - -Applying pseudocolor schemes to image plots -------------------------------------------------- - -Pseudocolor can be a useful tool for enhancing contrast and -visualizing your data more easily. This is especially useful when -making presentations of your data using projectors - their contrast is -typically quite poor. - -Pseudocolor is only relevant to single-channel, grayscale, luminosity -images. We currently have an RGB image. Since R, G, and B are all -similar (see for yourself above or in your data), we can just pick one -channel of our data: - -.. sourcecode:: ipython - - In [7]: lum_img = img[:,:,0] - -This is array slicing. You can read more in the `Numpy tutorial -`_. - -.. sourcecode:: ipython - - In [8]: plt.imshow(lum_img) - -.. plot:: - - import matplotlib.pyplot as plt - import matplotlib.image as mpimg - import numpy as np - img = mpimg.imread('../_static/stinkbug.png') - lum_img = img[:, :, 0] - plt.imshow(lum_img) - -Now, with a luminosity (2D, no color) image, the default colormap (aka lookup table, -LUT), is applied. The default is called viridis. There are plenty of -others to choose from. - -.. sourcecode:: ipython - - In [9]: plt.imshow(lum_img, cmap="hot") - -.. plot:: - - import matplotlib.pyplot as plt - import matplotlib.image as mpimg - import numpy as np - img = mpimg.imread('../_static/stinkbug.png') - lum_img = img[:,:,0] - imgplot = plt.imshow(lum_img) - imgplot.set_cmap('hot') - -Note that you can also change colormaps on existing plot objects using the -:meth:`~matplotlib.image.Image.set_cmap` method: - -.. sourcecode:: ipython - - In [10]: imgplot = plt.imshow(lum_img) - In [11]: imgplot.set_cmap('nipy_spectral') - -.. plot:: - - import matplotlib.pyplot as plt - import matplotlib.image as mpimg - import numpy as np - img = mpimg.imread('../_static/stinkbug.png') - lum_img = img[:, :, 0] - imgplot = plt.imshow(lum_img) - imgplot.set_cmap('nipy_spectral') - -.. note:: - - However, remember that in the IPython notebook with the inline backend, - you can't make changes to plots that have already been rendered. If you - create imgplot here in one cell, you cannot call set_cmap() on it in a later - cell and expect the earlier plot to change. Make sure that you enter these - commands together in one cell. plt commands will not change plots from earlier - cells. - -There are many other colormap schemes available. See the `list and -images of the colormaps -<../examples/color/colormaps_reference.html>`_. - -.. _`Color Bars`: - -Color scale reference ------------------------- - -It's helpful to have an idea of what value a color represents. We can -do that by adding color bars. - -.. sourcecode:: ipython - - In [12]: imgplot = plt.imshow(lum_img) - In [13]: plt.colorbar() - -.. plot:: - - import matplotlib.pyplot as plt - import matplotlib.image as mpimg - import numpy as np - img = mpimg.imread('../_static/stinkbug.png') - lum_img = img[:, :, 0] - imgplot = plt.imshow(lum_img) - imgplot.set_cmap('nipy_spectral') - plt.colorbar() - -This adds a colorbar to your existing figure. This won't -automatically change if you change you switch to a different -colormap - you have to re-create your plot, and add in the colorbar -again. - -.. _`Data ranges`: - -Examining a specific data range ---------------------------------- - -Sometimes you want to enhance the contrast in your image, or expand -the contrast in a particular region while sacrificing the detail in -colors that don't vary much, or don't matter. A good tool to find -interesting regions is the histogram. To create a histogram of our -image data, we use the :func:`~matplotlib.pyplot.hist` function. - -.. sourcecode:: ipython - - In [14]: plt.hist(lum_img.ravel(), bins=256, range=(0.0, 1.0), fc='k', ec='k') - -.. plot:: - - import matplotlib.pyplot as plt - import matplotlib.image as mpimg - import numpy as np - img = mpimg.imread('../_static/stinkbug.png') - lum_img = img[:,:,0] - plt.hist(lum_img.flatten(), 256, range=(0.0, 1.0), fc='k', ec='k') - -Most often, the "interesting" part of the image is around the peak, -and you can get extra contrast by clipping the regions above and/or -below the peak. In our histogram, it looks like there's not much -useful information in the high end (not many white things in the -image). Let's adjust the upper limit, so that we effectively "zoom in -on" part of the histogram. We do this by passing the clim argument to -imshow. You could also do this by calling the -:meth:`~matplotlib.image.Image.set_clim` method of the image plot -object, but make sure that you do so in the same cell as your plot -command when working with the IPython Notebook - it will not change -plots from earlier cells. - -.. sourcecode:: ipython - - In [15]: imgplot = plt.imshow(lum_img, clim=(0.0, 0.7)) - -.. plot:: - - import matplotlib.pyplot as plt - import matplotlib.image as mpimg - import numpy as np - fig = plt.figure() - a=fig.add_subplot(1,2,1) - img = mpimg.imread('../_static/stinkbug.png') - lum_img = img[:,:,0] - imgplot = plt.imshow(lum_img) - a.set_title('Before') - plt.colorbar(ticks=[0.1,0.3,0.5,0.7], orientation ='horizontal') - a=fig.add_subplot(1,2,2) - imgplot = plt.imshow(lum_img) - imgplot.set_clim(0.0,0.7) - a.set_title('After') - plt.colorbar(ticks=[0.1,0.3,0.5,0.7], orientation='horizontal') - -.. _Interpolation: - -Array Interpolation schemes ---------------------------- - -Interpolation calculates what the color or value of a pixel "should" -be, according to different mathematical schemes. One common place -that this happens is when you resize an image. The number of pixels -change, but you want the same information. Since pixels are discrete, -there's missing space. Interpolation is how you fill that space. -This is why your images sometimes come out looking pixelated when you -blow them up. The effect is more pronounced when the difference -between the original image and the expanded image is greater. Let's -take our image and shrink it. We're effectively discarding pixels, -only keeping a select few. Now when we plot it, that data gets blown -up to the size on your screen. The old pixels aren't there anymore, -and the computer has to draw in pixels to fill that space. - -We'll use the Pillow library that we used to load the image also to resize -the image. - -.. sourcecode:: ipython - - In [16]: from PIL import Image - In [17]: img = Image.open('../_static/stinkbug.png') - In [18]: img.thumbnail((64, 64), Image.ANTIALIAS) # resizes image in-place - In [19]: imgplot = plt.imshow(img) - -.. plot:: - - import matplotlib.pyplot as plt - from PIL import Image - img = Image.open('../_static/stinkbug.png') # opens the file using Pillow - it's not an array yet - img.thumbnail((64, 64), Image.ANTIALIAS) # resizes image in-place - imgplot = plt.imshow(img) - -Here we have the default interpolation, bilinear, since we did not -give :func:`~matplotlib.pyplot.imshow` any interpolation argument. - -Let's try some others: - -.. sourcecode:: ipython - - In [20]: imgplot = plt.imshow(img, interpolation="nearest") - -.. plot:: - - import matplotlib.pyplot as plt - from PIL import Image - img = Image.open('../_static/stinkbug.png') # opens the file using Pillow - it's not an array yet - img.thumbnail((64, 64), Image.ANTIALIAS) # resizes image in-place - imgplot = plt.imshow(img, interpolation="nearest") - -.. sourcecode:: ipython - - In [21]: imgplot = plt.imshow(img, interpolation="bicubic") - -.. plot:: - - import matplotlib.pyplot as plt - from PIL import Image - img = Image.open('../_static/stinkbug.png') # opens the file using Pillow - it's not an array yet - img.thumbnail((64, 64), Image.ANTIALIAS) # resizes image in-place - imgplot = plt.imshow(img, interpolation="bicubic") - -Bicubic interpolation is often used when blowing up photos - people -tend to prefer blurry over pixelated. diff --git a/_sources/users/index_text.rst.txt b/_sources/users/index_text.rst.txt deleted file mode 100644 index 7904d7e3173..00000000000 --- a/_sources/users/index_text.rst.txt +++ /dev/null @@ -1,13 +0,0 @@ -.. _text-guide: - -Working with text -################# - -.. toctree:: - - text_intro.rst - text_props.rst - annotations.rst - mathtext.rst - usetex.rst - pgf.rst diff --git a/_sources/users/legend_guide.rst.txt b/_sources/users/legend_guide.rst.txt deleted file mode 100644 index 96d73bcce07..00000000000 --- a/_sources/users/legend_guide.rst.txt +++ /dev/null @@ -1,281 +0,0 @@ -.. _plotting-guide-legend: - -************ -Legend guide -************ - -.. currentmodule:: matplotlib.pyplot - - -This legend guide is an extension of the documentation available at -:func:`~matplotlib.pyplot.legend` - please ensure you are familiar with -contents of that documentation before proceeding with this guide. - - -This guide makes use of some common terms, which are documented here for clarity: - -.. glossary:: - - legend entry - A legend is made up of one or more legend entries. An entry is made up of - exactly one key and one label. - - legend key - The colored/patterned marker to the left of each legend label. - - legend label - The text which describes the handle represented by the key. - - legend handle - The original object which is used to generate an appropriate entry in - the legend. - - -Controlling the legend entries -============================== - -Calling :func:`legend` with no arguments automatically fetches the legend -handles and their associated labels. This functionality is equivalent to:: - - handles, labels = ax.get_legend_handles_labels() - ax.legend(handles, labels) - -The :meth:`~matplotlib.axes.Axes.get_legend_handles_labels` function returns -a list of handles/artists which exist on the Axes which can be used to -generate entries for the resulting legend - it is worth noting however that -not all artists can be added to a legend, at which point a "proxy" will have -to be created (see :ref:`proxy_legend_handles` for further details). - -For full control of what is being added to the legend, it is common to pass -the appropriate handles directly to :func:`legend`:: - - line_up, = plt.plot([1,2,3], label='Line 2') - line_down, = plt.plot([3,2,1], label='Line 1') - plt.legend(handles=[line_up, line_down]) - -In some cases, it is not possible to set the label of the handle, so it is -possible to pass through the list of labels to :func:`legend`:: - - line_up, = plt.plot([1,2,3], label='Line 2') - line_down, = plt.plot([3,2,1], label='Line 1') - plt.legend([line_up, line_down], ['Line Up', 'Line Down']) - - -.. _proxy_legend_handles: - -Creating artists specifically for adding to the legend (aka. Proxy artists) -=========================================================================== - -Not all handles can be turned into legend entries automatically, -so it is often necessary to create an artist which *can*. Legend handles -don't have to exists on the Figure or Axes in order to be used. - -Suppose we wanted to create a legend which has an entry for some data which -is represented by a red color: - -.. plot:: - :include-source: - - import matplotlib.patches as mpatches - import matplotlib.pyplot as plt - - red_patch = mpatches.Patch(color='red', label='The red data') - plt.legend(handles=[red_patch]) - - plt.show() - -There are many supported legend handles, instead of creating a patch of color -we could have created a line with a marker: - -.. plot:: - :include-source: - - import matplotlib.lines as mlines - import matplotlib.pyplot as plt - - blue_line = mlines.Line2D([], [], color='blue', marker='*', - markersize=15, label='Blue stars') - plt.legend(handles=[blue_line]) - - plt.show() - - -Legend location -=============== - -The location of the legend can be specified by the keyword argument -*loc*. Please see the documentation at :func:`legend` for more details. - -The ``bbox_to_anchor`` keyword gives a great degree of control for manual -legend placement. For example, if you want your axes legend located at the -figure's top right-hand corner instead of the axes' corner, simply specify -the corner's location, and the coordinate system of that location:: - - plt.legend(bbox_to_anchor=(1, 1), - bbox_transform=plt.gcf().transFigure) - -More examples of custom legend placement: - -.. plot:: users/plotting/examples/simple_legend01.py - :include-source: - - -Multiple legends on the same Axes -================================= - -Sometimes it is more clear to split legend entries across multiple -legends. Whilst the instinctive approach to doing this might be to call -the :func:`legend` function multiple times, you will find that only one -legend ever exists on the Axes. This has been done so that it is possible -to call :func:`legend` repeatedly to update the legend to the latest -handles on the Axes, so to persist old legend instances, we must add them -manually to the Axes: - -.. plot:: users/plotting/examples/simple_legend02.py - :include-source: - -Legend Handlers -=============== - -In order to create legend entries, handles are given as an argument to an -appropriate :class:`~matplotlib.legend_handler.HandlerBase` subclass. -The choice of handler subclass is determined by the following rules: - - 1. Update :func:`~matplotlib.legend.Legend.get_legend_handler_map` - with the value in the ``handler_map`` keyword. - 2. Check if the ``handle`` is in the newly created ``handler_map``. - 3. Check if the type of ``handle`` is in the newly created - ``handler_map``. - 4. Check if any of the types in the ``handle``'s mro is in the newly - created ``handler_map``. - -For completeness, this logic is mostly implemented in -:func:`~matplotlib.legend.Legend.get_legend_handler`. - -All of this flexibility means that we have the necessary hooks to implement -custom handlers for our own type of legend key. - -The simplest example of using custom handlers is to instantiate one of the -existing :class:`~matplotlib.legend_handler.HandlerBase` subclasses. For the -sake of simplicity, let's choose :class:`matplotlib.legend_handler.HandlerLine2D` -which accepts a ``numpoints`` argument (note numpoints is a keyword -on the :func:`legend` function for convenience). We can then pass the mapping -of instance to Handler as a keyword to legend. - -.. plot:: - :include-source: - - import matplotlib.pyplot as plt - from matplotlib.legend_handler import HandlerLine2D - - line1, = plt.plot([3,2,1], marker='o', label='Line 1') - line2, = plt.plot([1,2,3], marker='o', label='Line 2') - - plt.legend(handler_map={line1: HandlerLine2D(numpoints=4)}) - -As you can see, "Line 1" now has 4 marker points, where "Line 2" has 2 (the -default). Try the above code, only change the map's key from ``line1`` to -``type(line1)``. Notice how now both :class:`~matplotlib.lines.Line2D` instances -get 4 markers. - -Along with handlers for complex plot types such as errorbars, stem plots -and histograms, the default ``handler_map`` has a special ``tuple`` handler -(:class:`~matplotlib.legend_handler.HandlerTuple`) which simply plots -the handles on top of one another for each item in the given tuple. The -following example demonstrates combining two legend keys on top of one another: - -.. plot:: - :include-source: - - import matplotlib.pyplot as plt - from numpy.random import randn - - z = randn(10) - - red_dot, = plt.plot(z, "ro", markersize=15) - # Put a white cross over some of the data. - white_cross, = plt.plot(z[:5], "w+", markeredgewidth=3, markersize=15) - - plt.legend([red_dot, (red_dot, white_cross)], ["Attr A", "Attr A+B"]) - - -Implementing a custom legend handler ------------------------------------- - -A custom handler can be implemented to turn any handle into a legend key (handles -don't necessarily need to be matplotlib artists). -The handler must implement a "legend_artist" method which returns a -single artist for the legend to use. Signature details about the "legend_artist" -are documented at :meth:`~matplotlib.legend_handler.HandlerBase.legend_artist`. - -.. plot:: - :include-source: - - import matplotlib.pyplot as plt - import matplotlib.patches as mpatches - - class AnyObject(object): - pass - - class AnyObjectHandler(object): - def legend_artist(self, legend, orig_handle, fontsize, handlebox): - x0, y0 = handlebox.xdescent, handlebox.ydescent - width, height = handlebox.width, handlebox.height - patch = mpatches.Rectangle([x0, y0], width, height, facecolor='red', - edgecolor='black', hatch='xx', lw=3, - transform=handlebox.get_transform()) - handlebox.add_artist(patch) - return patch - - plt.legend([AnyObject()], ['My first handler'], - handler_map={AnyObject: AnyObjectHandler()}) - -Alternatively, had we wanted to globally accept ``AnyObject`` instances without -needing to manually set the ``handler_map`` keyword all the time, we could have -registered the new handler with:: - - from matplotlib.legend import Legend - Legend.update_default_handler_map({AnyObject: AnyObjectHandler()}) - -Whilst the power here is clear, remember that there are already many handlers -implemented and what you want to achieve may already be easily possible with -existing classes. For example, to produce elliptical legend keys, rather than -rectangular ones: - -.. plot:: - :include-source: - - from matplotlib.legend_handler import HandlerPatch - import matplotlib.pyplot as plt - import matplotlib.patches as mpatches - - - class HandlerEllipse(HandlerPatch): - def create_artists(self, legend, orig_handle, - xdescent, ydescent, width, height, fontsize, trans): - center = 0.5 * width - 0.5 * xdescent, 0.5 * height - 0.5 * ydescent - p = mpatches.Ellipse(xy=center, width=width + xdescent, - height=height + ydescent) - self.update_prop(p, orig_handle, legend) - p.set_transform(trans) - return [p] - - - c = mpatches.Circle((0.5, 0.5), 0.25, facecolor="green", - edgecolor="red", linewidth=3) - plt.gca().add_patch(c) - - plt.legend([c], ["An ellipse, not a rectangle"], - handler_map={mpatches.Circle: HandlerEllipse()}) - -Known examples of using legend -============================== - -Here is a non-exhaustive list of the examples available involving legend -being used in various ways: - -* :ref:`lines_bars_and_markers-scatter_with_legend` -* :ref:`api-legend_demo` -* :ref:`pylab_examples-contourf_hatching` -* :ref:`pylab_examples-figlegend_demo` -* :ref:`pylab_examples-scatter_symbol` diff --git a/_sources/users/mathtext.rst.txt b/_sources/users/mathtext.rst.txt deleted file mode 100644 index cf906d2caaf..00000000000 --- a/_sources/users/mathtext.rst.txt +++ /dev/null @@ -1,344 +0,0 @@ -.. _mathtext-tutorial: - -Writing mathematical expressions -================================ - -You can use a subset TeX markup in any matplotlib text string by -placing it inside a pair of dollar signs ($). - -Note that you do not need to have TeX installed, since matplotlib -ships its own TeX expression parser, layout engine and fonts. The -layout engine is a fairly direct adaptation of the layout algorithms -in Donald Knuth's TeX, so the quality is quite good (matplotlib also -provides a ``usetex`` option for those who do want to call out to TeX -to generate their text (see :ref:`usetex-tutorial`). - -Any text element can use math text. You should use raw strings (precede the -quotes with an ``'r'``), and surround the math text with dollar signs ($), as in -TeX. Regular text and mathtext can be interleaved within the same string. -Mathtext can use DejaVu Sans (default), DejaVu Serif, the Computer Modern fonts -(from (La)TeX), `STIX `_ fonts (with are designed -to blend well with Times), or a Unicode font that you provide. The mathtext -font can be selected with the customization variable ``mathtext.fontset`` (see -:ref:`customizing-matplotlib`) - -.. note:: - On `"narrow" `_ builds - of Python, if you use the STIX fonts you should also set - ``ps.fonttype`` and ``pdf.fonttype`` to 3 (the default), not 42. - Otherwise `some characters will not be visible - `_. - -Here is a simple example:: - - # plain text - plt.title('alpha > beta') - -produces "alpha > beta". - -Whereas this:: - - # math text - plt.title(r'$\alpha > \beta$') - -produces ":math:`\alpha > \beta`". - -.. note:: - Mathtext should be placed between a pair of dollar signs ($). To - make it easy to display monetary values, e.g., "$100.00", if a - single dollar sign is present in the entire string, it will be - displayed verbatim as a dollar sign. This is a small change from - regular TeX, where the dollar sign in non-math text would have to - be escaped ('\\\$'). - -.. note:: - While the syntax inside the pair of dollar signs ($) aims to be - TeX-like, the text outside does not. In particular, characters - such as:: - - # $ % & ~ _ ^ \ { } \( \) \[ \] - - have special meaning outside of math mode in TeX. Therefore, these - characters will behave differently depending on the rcParam - ``text.usetex`` flag. See the :ref:`usetex tutorial - ` for more information. - -Subscripts and superscripts ---------------------------- - -To make subscripts and superscripts, use the ``'_'`` and ``'^'`` symbols:: - - r'$\alpha_i > \beta_i$' - -.. math:: - - \alpha_i > \beta_i - -Some symbols automatically put their sub/superscripts under and over -the operator. For example, to write the sum of :math:`x_i` from :math:`0` to -:math:`\infty`, you could do:: - - r'$\sum_{i=0}^\infty x_i$' - -.. math:: - - \sum_{i=0}^\infty x_i - -Fractions, binomials and stacked numbers ----------------------------------------- - -Fractions, binomials and stacked numbers can be created with the -``\frac{}{}``, ``\binom{}{}`` and ``\stackrel{}{}`` commands, -respectively:: - - r'$\frac{3}{4} \binom{3}{4} \stackrel{3}{4}$' - -produces - -.. math:: - - \frac{3}{4} \binom{3}{4} \stackrel{3}{4} - -Fractions can be arbitrarily nested:: - - r'$\frac{5 - \frac{1}{x}}{4}$' - -produces - -.. math:: - - \frac{5 - \frac{1}{x}}{4} - -Note that special care needs to be taken to place parentheses and brackets around -fractions. Doing things the obvious way produces brackets that are -too small:: - - r'$(\frac{5 - \frac{1}{x}}{4})$' - -.. math :: - - (\frac{5 - \frac{1}{x}}{4}) - -The solution is to precede the bracket with ``\left`` and ``\right`` -to inform the parser that those brackets encompass the entire object:: - - r'$\left(\frac{5 - \frac{1}{x}}{4}\right)$' - -.. math :: - - \left(\frac{5 - \frac{1}{x}}{4}\right) - -Radicals --------- - -Radicals can be produced with the ``\sqrt[]{}`` command. For example:: - - r'$\sqrt{2}$' - -.. math :: - - \sqrt{2} - -Any base can (optionally) be provided inside square brackets. Note -that the base must be a simple expression, and can not contain layout -commands such as fractions or sub/superscripts:: - - r'$\sqrt[3]{x}$' - -.. math :: - - \sqrt[3]{x} - -Fonts ------ - -The default font is *italics* for mathematical symbols. - -.. note:: - - This default can be changed using the ``mathtext.default`` rcParam. - This is useful, for example, to use the same font as regular - non-math text for math text, by setting it to ``regular``. - -To change fonts, e.g., to write "sin" in a Roman font, enclose the text -in a font command:: - - r'$s(t) = \mathcal{A}\mathrm{sin}(2 \omega t)$' - -.. math:: - - s(t) = \mathcal{A}\mathrm{sin}(2 \omega t) - -More conveniently, many commonly used function names that are typeset in a -Roman font have shortcuts. So the expression above could be written -as follows:: - - r'$s(t) = \mathcal{A}\sin(2 \omega t)$' - -.. math:: - - s(t) = \mathcal{A}\sin(2 \omega t) - -Here "s" and "t" are variable in italics font (default), "sin" is in -Roman font, and the amplitude "A" is in calligraphy font. Note in the -example above the caligraphy ``A`` is squished into the ``sin``. You -can use a spacing command to add a little whitespace between them:: - - s(t) = \mathcal{A}\/\sin(2 \omega t) - -.. math:: - - s(t) = \mathcal{A}\/\sin(2 \omega t) - -The choices available with all fonts are: - - ============================ ================================== - Command Result - ============================ ================================== - ``\mathrm{Roman}`` :math:`\mathrm{Roman}` - ``\mathit{Italic}`` :math:`\mathit{Italic}` - ``\mathtt{Typewriter}`` :math:`\mathtt{Typewriter}` - ``\mathcal{CALLIGRAPHY}`` :math:`\mathcal{CALLIGRAPHY}` - ============================ ================================== - -.. role:: math-stix(math) - :fontset: stix - -When using the `STIX `_ fonts, you also have the choice of: - - ====================================== ========================================= - Command Result - ====================================== ========================================= - ``\mathbb{blackboard}`` :math-stix:`\mathbb{blackboard}` - ``\mathrm{\mathbb{blackboard}}`` :math-stix:`\mathrm{\mathbb{blackboard}}` - ``\mathfrak{Fraktur}`` :math-stix:`\mathfrak{Fraktur}` - ``\mathsf{sansserif}`` :math-stix:`\mathsf{sansserif}` - ``\mathrm{\mathsf{sansserif}}`` :math-stix:`\mathrm{\mathsf{sansserif}}` - ====================================== ========================================= - -.. htmlonly:: - - ====================================== ========================================= - ``\mathcircled{circled}`` :math-stix:`\mathcircled{circled}` - ====================================== ========================================= - -There are also three global "font sets" to choose from, which are -selected using the ``mathtext.fontset`` parameter in -:ref:`matplotlibrc `. - -``cm``: **Computer Modern (TeX)** - -.. image:: ../_static/cm_fontset.png - -``stix``: **STIX** (designed to blend well with Times) - -.. image:: ../_static/stix_fontset.png - -``stixsans``: **STIX sans-serif** - -.. image:: ../_static/stixsans_fontset.png - -Additionally, you can use ``\mathdefault{...}`` or its alias -``\mathregular{...}`` to use the font used for regular text outside of -mathtext. There are a number of limitations to this approach, most -notably that far fewer symbols will be available, but it can be useful -to make math expressions blend well with other text in the plot. - -Custom fonts -~~~~~~~~~~~~ - -mathtext also provides a way to use custom fonts for math. This -method is fairly tricky to use, and should be considered an -experimental feature for patient users only. By setting the rcParam -``mathtext.fontset`` to ``custom``, you can then set the following -parameters, which control which font file to use for a particular set -of math characters. - - ============================== ================================= - Parameter Corresponds to - ============================== ================================= - ``mathtext.it`` ``\mathit{}`` or default italic - ``mathtext.rm`` ``\mathrm{}`` Roman (upright) - ``mathtext.tt`` ``\mathtt{}`` Typewriter (monospace) - ``mathtext.bf`` ``\mathbf{}`` bold italic - ``mathtext.cal`` ``\mathcal{}`` calligraphic - ``mathtext.sf`` ``\mathsf{}`` sans-serif - ============================== ================================= - -Each parameter should be set to a fontconfig font descriptor (as -defined in the yet-to-be-written font chapter). - -.. TODO: Link to font chapter - -The fonts used should have a Unicode mapping in order to find any -non-Latin characters, such as Greek. If you want to use a math symbol -that is not contained in your custom fonts, you can set the rcParam -``mathtext.fallback_to_cm`` to ``True`` which will cause the mathtext -system to use characters from the default Computer Modern fonts -whenever a particular character can not be found in the custom font. - -Note that the math glyphs specified in Unicode have evolved over time, -and many fonts may not have glyphs in the correct place for mathtext. - -Accents -------- - -An accent command may precede any symbol to add an accent above it. -There are long and short forms for some of them. - - ============================== ================================= - Command Result - ============================== ================================= - ``\acute a`` or ``\'a`` :math:`\acute a` - ``\bar a`` :math:`\bar a` - ``\breve a`` :math:`\breve a` - ``\ddot a`` or ``\"a`` :math:`\ddot a` - ``\dot a`` or ``\.a`` :math:`\dot a` - ``\grave a`` or ``\`a`` :math:`\grave a` - ``\hat a`` or ``\^a`` :math:`\hat a` - ``\tilde a`` or ``\~a`` :math:`\tilde a` - ``\vec a`` :math:`\vec a` - ``\overline{abc}`` :math:`\overline{abc}` - ============================== ================================= - -In addition, there are two special accents that automatically adjust -to the width of the symbols below: - - ============================== ================================= - Command Result - ============================== ================================= - ``\widehat{xyz}`` :math:`\widehat{xyz}` - ``\widetilde{xyz}`` :math:`\widetilde{xyz}` - ============================== ================================= - -Care should be taken when putting accents on lower-case i's and j's. -Note that in the following ``\imath`` is used to avoid the extra dot -over the i:: - - r"$\hat i\ \ \hat \imath$" - -.. math:: - - \hat i\ \ \hat \imath - -Symbols -------- - -You can also use a large number of the TeX symbols, as in ``\infty``, -``\leftarrow``, ``\sum``, ``\int``. - -.. math_symbol_table:: - -If a particular symbol does not have a name (as is true of many of the -more obscure symbols in the STIX fonts), Unicode characters can -also be used:: - - ur'$\u23ce$' - -Example -------- - -Here is an example illustrating many of these features in context. - -.. plot:: mpl_examples/pyplots/pyplot_mathtext.py - :include-source: diff --git a/_sources/users/path_tutorial.rst.txt b/_sources/users/path_tutorial.rst.txt deleted file mode 100644 index 47a3891c626..00000000000 --- a/_sources/users/path_tutorial.rst.txt +++ /dev/null @@ -1,187 +0,0 @@ -.. _path_tutorial: - -************* -Path Tutorial -************* - -The object underlying all of the :mod:`matplotlib.patch` objects is -the :class:`~matplotlib.path.Path`, which supports the standard set of -moveto, lineto, curveto commands to draw simple and compound outlines -consisting of line segments and splines. The ``Path`` is instantiated -with a (N,2) array of (x,y) vertices, and a N-length array of path -codes. For example to draw the unit rectangle from (0,0) to (1,1), we -could use this code - -.. plot:: - :include-source: - - import matplotlib.pyplot as plt - from matplotlib.path import Path - import matplotlib.patches as patches - - verts = [ - (0., 0.), # left, bottom - (0., 1.), # left, top - (1., 1.), # right, top - (1., 0.), # right, bottom - (0., 0.), # ignored - ] - - codes = [Path.MOVETO, - Path.LINETO, - Path.LINETO, - Path.LINETO, - Path.CLOSEPOLY, - ] - - path = Path(verts, codes) - - fig = plt.figure() - ax = fig.add_subplot(111) - patch = patches.PathPatch(path, facecolor='orange', lw=2) - ax.add_patch(patch) - ax.set_xlim(-2,2) - ax.set_ylim(-2,2) - plt.show() - - -The following path codes are recognized - -============== ================================= ==================================================================================================================== -Code Vertices Description -============== ================================= ==================================================================================================================== -``STOP`` 1 (ignored) A marker for the end of the entire path (currently not required and ignored) -``MOVETO`` 1 Pick up the pen and move to the given vertex. -``LINETO`` 1 Draw a line from the current position to the given vertex. -``CURVE3`` 2 (1 control point, 1 endpoint) Draw a quadratic Bézier curve from the current position, with the given control point, to the given end point. -``CURVE4`` 3 (2 control points, 1 endpoint) Draw a cubic Bézier curve from the current position, with the given control points, to the given end point. -``CLOSEPOLY`` 1 (point itself is ignored) Draw a line segment to the start point of the current polyline. -============== ================================= ==================================================================================================================== - - -.. path-curves: - - -Bézier example -============== - -Some of the path components require multiple vertices to specify them: -for example CURVE 3 is a `bézier -`_ curve with one -control point and one end point, and CURVE4 has three vertices for the -two control points and the end point. The example below shows a -CURVE4 Bézier spline -- the bézier curve will be contained in the -convex hull of the start point, the two control points, and the end -point - -.. plot:: - :include-source: - - import matplotlib.pyplot as plt - from matplotlib.path import Path - import matplotlib.patches as patches - - verts = [ - (0., 0.), # P0 - (0.2, 1.), # P1 - (1., 0.8), # P2 - (0.8, 0.), # P3 - ] - - codes = [Path.MOVETO, - Path.CURVE4, - Path.CURVE4, - Path.CURVE4, - ] - - path = Path(verts, codes) - - fig = plt.figure() - ax = fig.add_subplot(111) - patch = patches.PathPatch(path, facecolor='none', lw=2) - ax.add_patch(patch) - - xs, ys = zip(*verts) - ax.plot(xs, ys, 'x--', lw=2, color='black', ms=10) - - ax.text(-0.05, -0.05, 'P0') - ax.text(0.15, 1.05, 'P1') - ax.text(1.05, 0.85, 'P2') - ax.text(0.85, -0.05, 'P3') - - ax.set_xlim(-0.1, 1.1) - ax.set_ylim(-0.1, 1.1) - plt.show() - -.. compound_paths: - -Compound paths -============== - -All of the simple patch primitives in matplotlib, Rectangle, Circle, -Polygon, etc, are implemented with simple path. Plotting functions -like :meth:`~matplotlib.axes.Axes.hist` and -:meth:`~matplotlib.axes.Axes.bar`, which create a number of -primitives, e.g., a bunch of Rectangles, can usually be implemented more -efficiently using a compound path. The reason ``bar`` creates a list -of rectangles and not a compound path is largely historical: the -:class:`~matplotlib.path.Path` code is comparatively new and ``bar`` -predates it. While we could change it now, it would break old code, -so here we will cover how to create compound paths, replacing the -functionality in bar, in case you need to do so in your own code for -efficiency reasons, e.g., you are creating an animated bar plot. - -We will make the histogram chart by creating a series of rectangles -for each histogram bar: the rectangle width is the bin width and the -rectangle height is the number of datapoints in that bin. First we'll -create some random normally distributed data and compute the -histogram. Because numpy returns the bin edges and not centers, the -length of ``bins`` is 1 greater than the length of ``n`` in the -example below:: - - # histogram our data with numpy - data = np.random.randn(1000) - n, bins = np.histogram(data, 100) - -We'll now extract the corners of the rectangles. Each of the -``left``, ``bottom``, etc, arrays below is ``len(n)``, where ``n`` is -the array of counts for each histogram bar:: - - # get the corners of the rectangles for the histogram - left = np.array(bins[:-1]) - right = np.array(bins[1:]) - bottom = np.zeros(len(left)) - top = bottom + n - -Now we have to construct our compound path, which will consist of a -series of ``MOVETO``, ``LINETO`` and ``CLOSEPOLY`` for each rectangle. -For each rectangle, we need 5 vertices: 1 for the ``MOVETO``, 3 for -the ``LINETO``, and 1 for the ``CLOSEPOLY``. As indicated in the -table above, the vertex for the closepoly is ignored but we still need -it to keep the codes aligned with the vertices:: - - nverts = nrects*(1+3+1) - verts = np.zeros((nverts, 2)) - codes = np.ones(nverts, int) * path.Path.LINETO - codes[0::5] = path.Path.MOVETO - codes[4::5] = path.Path.CLOSEPOLY - verts[0::5,0] = left - verts[0::5,1] = bottom - verts[1::5,0] = left - verts[1::5,1] = top - verts[2::5,0] = right - verts[2::5,1] = top - verts[3::5,0] = right - verts[3::5,1] = bottom - -All that remains is to create the path, attach it to a -:class:`~matplotlib.patch.PathPatch`, and add it to our axes:: - - barpath = path.Path(verts, codes) - patch = patches.PathPatch(barpath, facecolor='green', - edgecolor='yellow', alpha=0.5) - ax.add_patch(patch) - -Here is the result - -.. plot:: mpl_examples/pyplots/compound_path_demo.py diff --git a/_sources/users/patheffects_guide.rst.txt b/_sources/users/patheffects_guide.rst.txt deleted file mode 100644 index e674f4be4ba..00000000000 --- a/_sources/users/patheffects_guide.rst.txt +++ /dev/null @@ -1,134 +0,0 @@ -.. _patheffects-guide: - -****************** -Path effects guide -****************** - -.. py:module:: matplotlib.patheffects - - -Matplotlib's :mod:`~matplotlib.patheffects` module provides functionality to -apply a multiple draw stage to any Artist which can be rendered via a -:class:`~matplotlib.path.Path`. - -Artists which can have a path effect applied to them include :class:`~matplotlib.patches.Patch`, -:class:`~matplotlib.lines.Line2D`, :class:`~matplotlib.collections.Collection` and even -:class:`~matplotlib.text.Text`. Each artist's path effects can be controlled via the -``set_path_effects`` method (:class:`~matplotlib.artist.Artist.set_path_effects`), which takes -an iterable of :class:`AbstractPathEffect` instances. - -The simplest path effect is the :class:`Normal` effect, which simply -draws the artist without any effect: - -.. plot:: - :include-source: - - import matplotlib.pyplot as plt - import matplotlib.patheffects as path_effects - - fig = plt.figure(figsize=(5, 1.5)) - text = fig.text(0.5, 0.5, 'Hello path effects world!\nThis is the normal ' - 'path effect.\nPretty dull, huh?', - ha='center', va='center', size=20) - text.set_path_effects([path_effects.Normal()]) - plt.show() - -Whilst the plot doesn't look any different to what you would expect without any path -effects, the drawing of the text now been changed to use the path effects -framework, opening up the possibilities for more interesting examples. - -Adding a shadow ---------------- - -A far more interesting path effect than :class:`Normal` is the -drop-shadow, which we can apply to any of our path based artists. The classes -:class:`SimplePatchShadow` and -:class:`SimpleLineShadow` do precisely this by drawing either a filled -patch or a line patch below the original artist: - -.. plot:: - :include-source: - - import matplotlib.pyplot as plt - import matplotlib.patheffects as path_effects - - text = plt.text(0.5, 0.5, 'Hello path effects world!', - path_effects=[path_effects.withSimplePatchShadow()]) - - plt.plot([0, 3, 2, 5], linewidth=5, color='blue', - path_effects=[path_effects.SimpleLineShadow(), - path_effects.Normal()]) - plt.show() - - -Notice the two approaches to setting the path effects in this example. The -first uses the ``with*`` classes to include the desired functionality automatically -followed with the "normal" effect, whereas the latter explicitly defines the two path -effects to draw. - -Making an artist stand out --------------------------- - -One nice way of making artists visually stand out is to draw an outline in a bold -color below the actual artist. The :class:`Stroke` path effect -makes this a relatively simple task: - -.. plot:: - :include-source: - - import matplotlib.pyplot as plt - import matplotlib.patheffects as path_effects - - fig = plt.figure(figsize=(7, 1)) - text = fig.text(0.5, 0.5, 'This text stands out because of\n' - 'its black border.', color='white', - ha='center', va='center', size=30) - text.set_path_effects([path_effects.Stroke(linewidth=3, foreground='black'), - path_effects.Normal()]) - plt.show() - -It is important to note that this effect only works because we have drawn the text -path twice; once with a thick black line, and then once with the original text -path on top. - -You may have noticed that the keywords to :class:`Stroke` and -:class:`SimplePatchShadow` and :class:`SimpleLineShadow` are not the usual Artist -keywords (such as ``facecolor`` and ``edgecolor`` etc.). This is because with these -path effects we are operating at lower level of matplotlib. In fact, the keywords -which are accepted are those for a :class:`matplotlib.backend_bases.GraphicsContextBase` -instance, which have been designed for making it easy to create new backends - and not -for its user interface. - - -Greater control of the path effect artist ------------------------------------------ - -As already mentioned, some of the path effects operate at a lower level than most users -will be used to, meaning that setting keywords such as ``facecolor`` and ``edgecolor`` -raise an AttributeError. Luckily there is a generic :class:`PathPatchEffect` path effect -which creates a :class:`~matplotlib.patches.PathPatch` class with the original path. -The keywords to this effect are identical to those of :class:`~matplotlib.patches.PathPatch`: - -.. plot:: - :include-source: - - import matplotlib.pyplot as plt - import matplotlib.patheffects as path_effects - - fig = plt.figure(figsize=(8, 1)) - t = fig.text(0.02, 0.5, 'Hatch shadow', fontsize=75, weight=1000, va='center') - t.set_path_effects([path_effects.PathPatchEffect(offset=(4, -4), hatch='xxxx', - facecolor='gray'), - path_effects.PathPatchEffect(edgecolor='white', linewidth=1.1, - facecolor='black')]) - plt.show() - - -.. - Headings for future consideration: - - Implementing a custom path effect - --------------------------------- - - What is going on under the hood - -------------------------------- diff --git a/_sources/users/pgf.rst.txt b/_sources/users/pgf.rst.txt deleted file mode 100644 index 041ff8cf555..00000000000 --- a/_sources/users/pgf.rst.txt +++ /dev/null @@ -1,177 +0,0 @@ -.. _pgf-tutorial: - -********************************* -Typesetting With XeLaTeX/LuaLaTeX -********************************* - -Using the ``pgf`` backend, matplotlib can export figures as pgf drawing commands -that can be processed with pdflatex, xelatex or lualatex. XeLaTeX and LuaLaTeX -have full unicode support and can use any font that is installed in the operating -system, making use of advanced typographic features of OpenType, AAT and -Graphite. Pgf pictures created by ``plt.savefig('figure.pgf')`` can be -embedded as raw commands in LaTeX documents. Figures can also be directly -compiled and saved to PDF with ``plt.savefig('figure.pdf')`` by either -switching to the backend - -.. code-block:: python - - matplotlib.use('pgf') - -or registering it for handling pdf output - -.. code-block:: python - - from matplotlib.backends.backend_pgf import FigureCanvasPgf - matplotlib.backend_bases.register_backend('pdf', FigureCanvasPgf) - -The second method allows you to keep using regular interactive backends and to -save xelatex, lualatex or pdflatex compiled PDF files from the graphical user interface. - -Matplotlib's pgf support requires a recent LaTeX_ installation that includes -the TikZ/PGF packages (such as TeXLive_), preferably with XeLaTeX or LuaLaTeX -installed. If either pdftocairo or ghostscript is present on your system, -figures can optionally be saved to PNG images as well. The executables -for all applications must be located on your :envvar:`PATH`. - -Rc parameters that control the behavior of the pgf backend: - - ================= ===================================================== - Parameter Documentation - ================= ===================================================== - pgf.preamble Lines to be included in the LaTeX preamble - pgf.rcfonts Setup fonts from rc params using the fontspec package - pgf.texsystem Either "xelatex" (default), "lualatex" or "pdflatex" - ================= ===================================================== - -.. note:: - - TeX defines a set of special characters, such as:: - - # $ % & ~ _ ^ \ { } - - Generally, these characters must be escaped correctly. For convenience, - some characters (_,^,%) are automatically escaped outside of math - environments. - -.. _pgf-rcfonts: - -Font specification -================== - -The fonts used for obtaining the size of text elements or when compiling -figures to PDF are usually defined in the matplotlib rc parameters. You can -also use the LaTeX default Computer Modern fonts by clearing the lists for -``font.serif``, ``font.sans-serif`` or ``font.monospace``. Please note that -the glyph coverage of these fonts is very limited. If you want to keep the -Computer Modern font face but require extended unicode support, consider -installing the `Computer Modern Unicode `_ -fonts *CMU Serif*, *CMU Sans Serif*, etc. - -When saving to ``.pgf``, the font configuration matplotlib used for the -layout of the figure is included in the header of the text file. - -.. literalinclude:: plotting/examples/pgf_fonts.py - :end-before: plt.savefig - -.. image:: /_static/pgf_fonts.* - - -.. _pgf-preamble: - -Custom preamble -=============== - -Full customization is possible by adding your own commands to the preamble. -Use the ``pgf.preamble`` parameter if you want to configure the math fonts, -using ``unicode-math`` for example, or for loading additional packages. Also, -if you want to do the font configuration yourself instead of using the fonts -specified in the rc parameters, make sure to disable ``pgf.rcfonts``. - -.. htmlonly:: - - .. literalinclude:: plotting/examples/pgf_preamble.py - :end-before: plt.savefig - -.. latexonly:: - - .. literalinclude:: plotting/examples/pgf_preamble.py - :end-before: import matplotlib.pyplot as plt - -.. image:: /_static/pgf_preamble.* - - -.. _pgf-texsystem: - -Choosing the TeX system -======================= - -The TeX system to be used by matplotlib is chosen by the ``pgf.texsystem`` -parameter. Possible values are ``'xelatex'`` (default), ``'lualatex'`` and -``'pdflatex'``. Please note that when selecting pdflatex the fonts and -unicode handling must be configured in the preamble. - -.. literalinclude:: plotting/examples/pgf_texsystem.py - :end-before: plt.savefig - -.. image:: /_static/pgf_texsystem.* - - -.. _pgf-troubleshooting: - -Troubleshooting -=============== - -* Please note that the TeX packages found in some Linux distributions and - MiKTeX installations are dramatically outdated. Make sure to update your - package catalog and upgrade or install a recent TeX distribution. - -* On Windows, the :envvar:`PATH` environment variable may need to be modified - to include the directories containing the latex, dvipng and ghostscript - executables. See :ref:`environment-variables` and - :ref:`setting-windows-environment-variables` for details. - -* A limitation on Windows causes the backend to keep file handles that have - been opened by your application open. As a result, it may not be possible - to delete the corresponding files until the application closes (see - `#1324 `_). - -* Sometimes the font rendering in figures that are saved to png images is - very bad. This happens when the pdftocairo tool is not available and - ghostscript is used for the pdf to png conversion. - -* Make sure what you are trying to do is possible in a LaTeX document, - that your LaTeX syntax is valid and that you are using raw strings - if necessary to avoid unintended escape sequences. - -* The ``pgf.preamble`` rc setting provides lots of flexibility, and lots of - ways to cause problems. When experiencing problems, try to minimalize or - disable the custom preamble. - -* Configuring an ``unicode-math`` environment can be a bit tricky. The - TeXLive distribution for example provides a set of math fonts which are - usually not installed system-wide. XeTeX, unlike LuaLatex, cannot find - these fonts by their name, which is why you might have to specify - ``\setmathfont{xits-math.otf}`` instead of ``\setmathfont{XITS Math}`` or - alternatively make the fonts available to your OS. See this - `tex.stackexchange.com question `_ - for more details. - -* If the font configuration used by matplotlib differs from the font setting - in yout LaTeX document, the alignment of text elements in imported figures - may be off. Check the header of your ``.pgf`` file if you are unsure about - the fonts matplotlib used for the layout. - -* Vector images and hence ``.pgf`` files can become bloated if there are a lot - of objects in the graph. This can be the case for image processing or very - big scatter graphs. In an extreme case this can cause TeX to run out of - memory: "TeX capacity exceeded, sorry" You can configure latex to increase - the amount of memory available to generate the ``.pdf`` image as discussed on - `tex.stackexchange.com `_. - Another way would be to "rasterize" parts of the graph causing problems - using either the ``rasterized=True`` keyword, or ``.set_rasterized(True)`` as per - `this example `_. - -* If you still need help, please see :ref:`reporting-problems` - -.. _LaTeX: http://www.tug.org -.. _TeXLive: http://www.tug.org/texlive/ diff --git a/_sources/users/pyplot_tutorial.rst.txt b/_sources/users/pyplot_tutorial.rst.txt deleted file mode 100644 index 77ba9384d7d..00000000000 --- a/_sources/users/pyplot_tutorial.rst.txt +++ /dev/null @@ -1,307 +0,0 @@ -.. _pyplot-tutorial: - -*************** -Pyplot tutorial -*************** - -:mod:`matplotlib.pyplot` is a collection of command style functions -that make matplotlib work like MATLAB. -Each ``pyplot`` function makes -some change to a figure: e.g., creates a figure, creates a plotting area -in a figure, plots some lines in a plotting area, decorates the plot -with labels, etc. In :mod:`matplotlib.pyplot` various states are preserved -across function calls, so that it keeps track of things like -the current figure and plotting area, and the plotting -functions are directed to the current axes (please note that "axes" here -and in most places in the documentation refers to the *axes* -`part of a figure `__ -and not the strict mathematical term for more than one axis). - -.. plot:: mpl_examples/pyplots/pyplot_simple.py - :include-source: - -You may be wondering why the x-axis ranges from 0-3 and the y-axis -from 1-4. If you provide a single list or array to the -:func:`~matplotlib.pyplot.plot` command, matplotlib assumes it is a -sequence of y values, and automatically generates the x values for -you. Since python ranges start with 0, the default x vector has the -same length as y but starts with 0. Hence the x data are -``[0,1,2,3]``. - -:func:`~matplotlib.pyplot.plot` is a versatile command, and will take -an arbitrary number of arguments. For example, to plot x versus y, -you can issue the command:: - - plt.plot([1, 2, 3, 4], [1, 4, 9, 16]) - -For every x, y pair of arguments, there is an optional third argument -which is the format string that indicates the color and line type of -the plot. The letters and symbols of the format string are from -MATLAB, and you concatenate a color string with a line style string. -The default format string is 'b-', which is a solid blue line. For -example, to plot the above with red circles, you would issue - -.. plot:: mpl_examples/pyplots/pyplot_formatstr.py - :include-source: - -See the :func:`~matplotlib.pyplot.plot` documentation for a complete -list of line styles and format strings. The -:func:`~matplotlib.pyplot.axis` command in the example above takes a -list of ``[xmin, xmax, ymin, ymax]`` and specifies the viewport of the -axes. - -If matplotlib were limited to working with lists, it would be fairly -useless for numeric processing. Generally, you will use `numpy -`_ arrays. In fact, all sequences are -converted to numpy arrays internally. The example below illustrates a -plotting several lines with different format styles in one command -using arrays. - -.. plot:: mpl_examples/pyplots/pyplot_three.py - :include-source: - -.. _controlling-line-properties: - -Controlling line properties -=========================== - -Lines have many attributes that you can set: linewidth, dash style, -antialiased, etc; see :class:`matplotlib.lines.Line2D`. There are -several ways to set line properties - -* Use keyword args:: - - plt.plot(x, y, linewidth=2.0) - - -* Use the setter methods of a ``Line2D`` instance. ``plot`` returns a list - of ``Line2D`` objects; e.g., ``line1, line2 = plot(x1, y1, x2, y2)``. In the code - below we will suppose that we have only - one line so that the list returned is of length 1. We use tuple unpacking with - ``line,`` to get the first element of that list:: - - line, = plt.plot(x, y, '-') - line.set_antialiased(False) # turn off antialising - -* Use the :func:`~matplotlib.pyplot.setp` command. The example below - uses a MATLAB-style command to set multiple properties - on a list of lines. ``setp`` works transparently with a list of objects - or a single object. You can either use python keyword arguments or - MATLAB-style string/value pairs:: - - lines = plt.plot(x1, y1, x2, y2) - # use keyword args - plt.setp(lines, color='r', linewidth=2.0) - # or MATLAB style string value pairs - plt.setp(lines, 'color', 'r', 'linewidth', 2.0) - - -Here are the available :class:`~matplotlib.lines.Line2D` properties. - -====================== ================================================== -Property Value Type -====================== ================================================== -alpha float -animated [True | False] -antialiased or aa [True | False] -clip_box a matplotlib.transform.Bbox instance -clip_on [True | False] -clip_path a Path instance and a Transform instance, a Patch -color or c any matplotlib color -contains the hit testing function -dash_capstyle [``'butt'`` | ``'round'`` | ``'projecting'``] -dash_joinstyle [``'miter'`` | ``'round'`` | ``'bevel'``] -dashes sequence of on/off ink in points -data (np.array xdata, np.array ydata) -figure a matplotlib.figure.Figure instance -label any string -linestyle or ls [ ``'-'`` | ``'--'`` | ``'-.'`` | ``':'`` | ``'steps'`` | ...] -linewidth or lw float value in points -lod [True | False] -marker [ ``'+'`` | ``','`` | ``'.'`` | ``'1'`` | ``'2'`` | ``'3'`` | ``'4'`` ] -markeredgecolor or mec any matplotlib color -markeredgewidth or mew float value in points -markerfacecolor or mfc any matplotlib color -markersize or ms float -markevery [ None | integer | (startind, stride) ] -picker used in interactive line selection -pickradius the line pick selection radius -solid_capstyle [``'butt'`` | ``'round'`` | ``'projecting'``] -solid_joinstyle [``'miter'`` | ``'round'`` | ``'bevel'``] -transform a matplotlib.transforms.Transform instance -visible [True | False] -xdata np.array -ydata np.array -zorder any number -====================== ================================================== - -To get a list of settable line properties, call the -:func:`~matplotlib.pyplot.setp` function with a line or lines -as argument - -.. sourcecode:: ipython - - In [69]: lines = plt.plot([1, 2, 3]) - - In [70]: plt.setp(lines) - alpha: float - animated: [True | False] - antialiased or aa: [True | False] - ...snip - -.. _multiple-figs-axes: - -Working with multiple figures and axes -====================================== - - -MATLAB, and :mod:`~matplotlib.pyplot`, have the concept of the current -figure and the current axes. All plotting commands apply to the -current axes. The function :func:`~matplotlib.pyplot.gca` returns the -current axes (a :class:`matplotlib.axes.Axes` instance), and -:func:`~matplotlib.pyplot.gcf` returns the current figure -(:class:`matplotlib.figure.Figure` instance). Normally, you don't have -to worry about this, because it is all taken care of behind the -scenes. Below is a script to create two subplots. - -.. plot:: mpl_examples/pyplots/pyplot_two_subplots.py - :include-source: - -The :func:`~matplotlib.pyplot.figure` command here is optional because -``figure(1)`` will be created by default, just as a ``subplot(111)`` -will be created by default if you don't manually specify any axes. The -:func:`~matplotlib.pyplot.subplot` command specifies ``numrows, -numcols, fignum`` where ``fignum`` ranges from 1 to -``numrows*numcols``. The commas in the ``subplot`` command are -optional if ``numrows*numcols<10``. So ``subplot(211)`` is identical -to ``subplot(2, 1, 1)``. You can create an arbitrary number of subplots -and axes. If you want to place an axes manually, i.e., not on a -rectangular grid, use the :func:`~matplotlib.pyplot.axes` command, -which allows you to specify the location as ``axes([left, bottom, -width, height])`` where all values are in fractional (0 to 1) -coordinates. See :ref:`pylab_examples-axes_demo` for an example of -placing axes manually and :ref:`pylab_examples-subplots_demo` for an -example with lots of subplots. - - -You can create multiple figures by using multiple -:func:`~matplotlib.pyplot.figure` calls with an increasing figure -number. Of course, each figure can contain as many axes and subplots -as your heart desires:: - - import matplotlib.pyplot as plt - plt.figure(1) # the first figure - plt.subplot(211) # the first subplot in the first figure - plt.plot([1, 2, 3]) - plt.subplot(212) # the second subplot in the first figure - plt.plot([4, 5, 6]) - - - plt.figure(2) # a second figure - plt.plot([4, 5, 6]) # creates a subplot(111) by default - - plt.figure(1) # figure 1 current; subplot(212) still current - plt.subplot(211) # make subplot(211) in figure1 current - plt.title('Easy as 1, 2, 3') # subplot 211 title - -You can clear the current figure with :func:`~matplotlib.pyplot.clf` -and the current axes with :func:`~matplotlib.pyplot.cla`. If you find -it annoying that states (specifically the current image, figure and axes) -are being maintained for you behind the scenes, don't despair: this is just a thin -stateful wrapper around an object oriented API, which you can use -instead (see :ref:`artist-tutorial`) - -If you are making lots of figures, you need to be aware of one -more thing: the memory required for a figure is not completely -released until the figure is explicitly closed with -:func:`~matplotlib.pyplot.close`. Deleting all references to the -figure, and/or using the window manager to kill the window in which -the figure appears on the screen, is not enough, because pyplot -maintains internal references until :func:`~matplotlib.pyplot.close` -is called. - -.. _working-with-text: - -Working with text -================= - -The :func:`~matplotlib.pyplot.text` command can be used to add text in -an arbitrary location, and the :func:`~matplotlib.pyplot.xlabel`, -:func:`~matplotlib.pyplot.ylabel` and :func:`~matplotlib.pyplot.title` -are used to add text in the indicated locations (see :ref:`text-intro` -for a more detailed example) - -.. plot:: mpl_examples/pyplots/pyplot_text.py - :include-source: - - -All of the :func:`~matplotlib.pyplot.text` commands return an -:class:`matplotlib.text.Text` instance. Just as with with lines -above, you can customize the properties by passing keyword arguments -into the text functions or using :func:`~matplotlib.pyplot.setp`:: - - t = plt.xlabel('my data', fontsize=14, color='red') - -These properties are covered in more detail in :ref:`text-properties`. - - -Using mathematical expressions in text --------------------------------------- - -matplotlib accepts TeX equation expressions in any text expression. -For example to write the expression :math:`\sigma_i=15` in the title, -you can write a TeX expression surrounded by dollar signs:: - - plt.title(r'$\sigma_i=15$') - -The ``r`` preceding the title string is important -- it signifies -that the string is a *raw* string and not to treat backslashes as -python escapes. matplotlib has a built-in TeX expression parser and -layout engine, and ships its own math fonts -- for details see -:ref:`mathtext-tutorial`. Thus you can use mathematical text across platforms -without requiring a TeX installation. For those who have LaTeX and -dvipng installed, you can also use LaTeX to format your text and -incorporate the output directly into your display figures or saved -postscript -- see :ref:`usetex-tutorial`. - - -Annotating text ---------------- - -The uses of the basic :func:`~matplotlib.pyplot.text` command above -place text at an arbitrary position on the Axes. A common use for -text is to annotate some feature of the plot, and the -:func:`~matplotlib.pyplot.annotate` method provides helper -functionality to make annotations easy. In an annotation, there are -two points to consider: the location being annotated represented by -the argument ``xy`` and the location of the text ``xytext``. Both of -these arguments are ``(x,y)`` tuples. - -.. plot:: mpl_examples/pyplots/pyplot_annotate.py - :include-source: - -In this basic example, both the ``xy`` (arrow tip) and ``xytext`` -locations (text location) are in data coordinates. There are a -variety of other coordinate systems one can choose -- see -:ref:`annotations-tutorial` and :ref:`plotting-guide-annotation` for -details. More examples can be found in -:ref:`pylab_examples-annotation_demo`. - - -Logarithmic and other nonlinear axes -==================================== - -:mod:`matplotlib.pyplot` supports not only linear axis scales, but also -logarithmic and logit scales. This is commonly used if data spans many orders -of magnitude. Changing the scale of an axis is easy: - - plt.xscale('log') - -An example of four plots with the same data and different scales for the y axis -is shown below. - -.. plot:: mpl_examples/pyplots/pyplot_scales.py - :include-source: - -It is also possible to add your own scale, see :ref:`adding-new-scales` for -details. diff --git a/_sources/users/recipes.rst.txt b/_sources/users/recipes.rst.txt deleted file mode 100644 index 64e2f2cf34d..00000000000 --- a/_sources/users/recipes.rst.txt +++ /dev/null @@ -1,379 +0,0 @@ -.. _recipes: - -******************** -Our Favorite Recipes -******************** - -Here is a collection of short tutorials, examples and code snippets -that illustrate some of the useful idioms and tricks to make snazzier -figures and overcome some matplotlib warts. - - -Sharing axis limits and views -============================= - -It's common to make two or more plots which share an axis, e.g., two -subplots with time as a common axis. When you pan and zoom around on -one, you want the other to move around with you. To facilitate this, -matplotlib Axes support a ``sharex`` and ``sharey`` attribute. When -you create a :func:`~matplotlib.pyplot.subplot` or -:func:`~matplotlib.pyplot.axes` instance, you can pass in a keyword -indicating what axes you want to share with - -.. sourcecode:: ipython - - In [96]: t = np.arange(0, 10, 0.01) - - In [97]: ax1 = plt.subplot(211) - - In [98]: ax1.plot(t, np.sin(2*np.pi*t)) - Out[98]: [] - - In [99]: ax2 = plt.subplot(212, sharex=ax1) - - In [100]: ax2.plot(t, np.sin(4*np.pi*t)) - Out[100]: [] - -Easily creating subplots -======================== - -In early versions of matplotlib, if you wanted to use the pythonic API -and create a figure instance and from that create a grid of subplots, -possibly with shared axes, it involved a fair amount of boilerplate -code. e.g. - -.. sourcecode:: python - - # old style - fig = plt.figure() - ax1 = fig.add_subplot(221) - ax2 = fig.add_subplot(222, sharex=ax1, sharey=ax1) - ax3 = fig.add_subplot(223, sharex=ax1, sharey=ax1) - ax3 = fig.add_subplot(224, sharex=ax1, sharey=ax1) - -Fernando Perez has provided a nice top level method to create in -:func:`~matplotlib.pyplots.subplots` (note the "s" at the end) -everything at once, and turn on x and y sharing for the whole bunch. -You can either unpack the axes individually:: - - # new style method 1; unpack the axes - fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, sharex=True, sharey=True) - ax1.plot(x) - -or get them back as a numrows x numcolumns object array which supports -numpy indexing:: - - # new style method 2; use an axes array - fig, axs = plt.subplots(2, 2, sharex=True, sharey=True) - axs[0,0].plot(x) - - - -Fixing common date annoyances -============================= - - -.. plot:: - :nofigs: - :context: - - # clear the state for context use below - plt.close('all') - -matplotlib allows you to natively plots python datetime instances, and -for the most part does a good job picking tick locations and string -formats. There are a couple of things it does not handle so -gracefully, and here are some tricks to help you work around them. -We'll load up some sample date data which contains datetime.date -objects in a numpy record array:: - - In [63]: datafile = cbook.get_sample_data('goog.npy') - - In [64]: r = np.load(datafile).view(np.recarray) - - In [65]: r.dtype - Out[65]: dtype([('date', '|O4'), ('', '|V4'), ('open', '] - -you will see that the x tick labels are all squashed together. - -.. plot:: - :context: - - import matplotlib.cbook as cbook - datafile = cbook.get_sample_data('goog.npy') - try: - # Python3 cannot load python2 .npy files with datetime(object) arrays - # unless the encoding is set to bytes. Hovever this option was - # not added until numpy 1.10 so this example will only work with - # python 2 or with numpy 1.10 and later. - r = np.load(datafile, encoding='bytes').view(np.recarray) - except TypeError: - # Old Numpy - r = np.load(datafile).view(np.recarray) - plt.figure() - plt.plot(r.date, r.close) - plt.title('Default date handling can cause overlapping labels') - -Another annoyance is that if you hover the mouse over the window and -look in the lower right corner of the matplotlib toolbar -(:ref:`navigation-toolbar`) at the x and y coordinates, you see that -the x locations are formatted the same way the tick labels are, e.g., -"Dec 2004". What we'd like is for the location in the toolbar to have -a higher degree of precision, e.g., giving us the exact date out mouse is -hovering over. To fix the first problem, we can use -:func:`matplotlib.figure.Figure.autofmt_xdate` and to fix the second -problem we can use the ``ax.fmt_xdata`` attribute which can be set to -any function that takes a scalar and returns a string. matplotlib has -a number of date formatters built in, so we'll use one of those. - -.. plot:: - :include-source: - :context: - - plt.close('all') - fig, ax = plt.subplots(1) - ax.plot(r.date, r.close) - - # rotate and align the tick labels so they look better - fig.autofmt_xdate() - - # use a more precise date string for the x axis locations in the - # toolbar - import matplotlib.dates as mdates - ax.fmt_xdata = mdates.DateFormatter('%Y-%m-%d') - plt.title('fig.autofmt_xdate fixes the labels') - -Now when you hover your mouse over the plotted data, you'll see date -format strings like 2004-12-01 in the toolbar. - -Fill Between and Alpha -====================== - -The :meth:`~matplotlib.axes.Axes.fill_between` function generates a -shaded region between a min and max boundary that is useful for -illustrating ranges. It has a very handy ``where`` argument to -combine filling with logical ranges, e.g., to just fill in a curve over -some threshold value. - -At its most basic level, ``fill_between`` can be use to enhance a -graphs visual appearance. Let's compare two graphs of a financial -times with a simple line plot on the left and a filled line on the -right. - -.. plot:: - :include-source: - - import matplotlib.pyplot as plt - import numpy as np - - import matplotlib.cbook as cbook - - # load up some sample financial data - datafile = cbook.get_sample_data('goog.npy') - try: - # Python3 cannot load python2 .npy files with datetime(object) arrays - # unless the encoding is set to bytes. Hovever this option was - # not added until numpy 1.10 so this example will only work with - # python 2 or with numpy 1.10 and later. - r = np.load(datafile, encoding='bytes').view(np.recarray) - except TypeError: - r = np.load(datafile).view(np.recarray) - # create two subplots with the shared x and y axes - fig, (ax1, ax2) = plt.subplots(1,2, sharex=True, sharey=True) - - pricemin = r.close.min() - - ax1.plot(r.date, r.close, lw=2) - ax2.fill_between(r.date, pricemin, r.close, facecolor='blue', alpha=0.5) - - for ax in ax1, ax2: - ax.grid(True) - - ax1.set_ylabel('price') - for label in ax2.get_yticklabels(): - label.set_visible(False) - - fig.suptitle('Google (GOOG) daily closing price') - fig.autofmt_xdate() - -The alpha channel is not necessary here, but it can be used to soften -colors for more visually appealing plots. In other examples, as we'll -see below, the alpha channel is functionally useful as the shaded -regions can overlap and alpha allows you to see both. Note that the -postscript format does not support alpha (this is a postscript -limitation, not a matplotlib limitation), so when using alpha save -your figures in PNG, PDF or SVG. - -Our next example computes two populations of random walkers with a -different mean and standard deviation of the normal distributions from -which the steps are drawn. We use shared regions to plot +/- one -standard deviation of the mean position of the population. Here the -alpha channel is useful, not just aesthetic. - -.. plot:: - :include-source: - - import matplotlib.pyplot as plt - import numpy as np - - Nsteps, Nwalkers = 100, 250 - t = np.arange(Nsteps) - - # an (Nsteps x Nwalkers) array of random walk steps - S1 = 0.002 + 0.01*np.random.randn(Nsteps, Nwalkers) - S2 = 0.004 + 0.02*np.random.randn(Nsteps, Nwalkers) - - # an (Nsteps x Nwalkers) array of random walker positions - X1 = S1.cumsum(axis=0) - X2 = S2.cumsum(axis=0) - - - # Nsteps length arrays empirical means and standard deviations of both - # populations over time - mu1 = X1.mean(axis=1) - sigma1 = X1.std(axis=1) - mu2 = X2.mean(axis=1) - sigma2 = X2.std(axis=1) - - # plot it! - fig, ax = plt.subplots(1) - ax.plot(t, mu1, lw=2, label='mean population 1', color='blue') - ax.plot(t, mu2, lw=2, label='mean population 2', color='yellow') - ax.fill_between(t, mu1+sigma1, mu1-sigma1, facecolor='blue', alpha=0.5) - ax.fill_between(t, mu2+sigma2, mu2-sigma2, facecolor='yellow', alpha=0.5) - ax.set_title('random walkers empirical $\mu$ and $\pm \sigma$ interval') - ax.legend(loc='upper left') - ax.set_xlabel('num steps') - ax.set_ylabel('position') - ax.grid() - - -The ``where`` keyword argument is very handy for highlighting certain -regions of the graph. ``where`` takes a boolean mask the same length -as the x, ymin and ymax arguments, and only fills in the region where -the boolean mask is True. In the example below, we simulate a single -random walker and compute the analytic mean and standard deviation of -the population positions. The population mean is shown as the black -dashed line, and the plus/minus one sigma deviation from the mean is -shown as the yellow filled region. We use the where mask -``X>upper_bound`` to find the region where the walker is above the one -sigma boundary, and shade that region blue. - -.. plot:: - :include-source: - - np.random.seed(1234) - - Nsteps = 500 - t = np.arange(Nsteps) - - mu = 0.002 - sigma = 0.01 - - # the steps and position - S = mu + sigma*np.random.randn(Nsteps) - X = S.cumsum() - - # the 1 sigma upper and lower analytic population bounds - lower_bound = mu*t - sigma*np.sqrt(t) - upper_bound = mu*t + sigma*np.sqrt(t) - - fig, ax = plt.subplots(1) - ax.plot(t, X, lw=2, label='walker position', color='blue') - ax.plot(t, mu*t, lw=1, label='population mean', color='black', ls='--') - ax.fill_between(t, lower_bound, upper_bound, facecolor='yellow', alpha=0.5, - label='1 sigma range') - ax.legend(loc='upper left') - - # here we use the where argument to only fill the region where the - # walker is above the population 1 sigma boundary - ax.fill_between(t, upper_bound, X, where=X>upper_bound, facecolor='blue', alpha=0.5) - ax.set_xlabel('num steps') - ax.set_ylabel('position') - ax.grid() - - -Another handy use of filled regions is to highlight horizontal or -vertical spans of an axes -- for that matplotlib has some helper -functions :meth:`~matplotlib.axes.Axes.axhspan` and -:meth:`~matplotlib.axes.Axes.axvspan` and example -:ref:`pylab_examples-axhspan_demo`. - - -Transparent, fancy legends -========================== - -Sometimes you know what your data looks like before you plot it, and -may know for instance that there won't be much data in the upper right -hand corner. Then you can safely create a legend that doesn't overlay -your data:: - - ax.legend(loc='upper right') - -Other times you don't know where your data is, and loc='best' will try -and place the legend:: - - ax.legend(loc='best') - -but still, your legend may overlap your data, and in these cases it's -nice to make the legend frame transparent. - - -.. plot:: - :include-source: - - np.random.seed(1234) - fig, ax = plt.subplots(1) - ax.plot(np.random.randn(300), 'o-', label='normal distribution') - ax.plot(np.random.rand(300), 's-', label='uniform distribution') - ax.set_ylim(-3, 3) - ax.legend(loc='best', fancybox=True, framealpha=0.5) - - ax.set_title('fancy, transparent legends') - - -Placing text boxes -================== - -When decorating axes with text boxes, two useful tricks are to place -the text in axes coordinates (see :ref:`transforms_tutorial`), so the -text doesn't move around with changes in x or y limits. You can also -use the ``bbox`` property of text to surround the text with a -:class:`~matplotlib.patches.Patch` instance -- the ``bbox`` keyword -argument takes a dictionary with keys that are Patch properties. - -.. plot:: - :include-source: - - np.random.seed(1234) - fig, ax = plt.subplots(1) - x = 30*np.random.randn(10000) - mu = x.mean() - median = np.median(x) - sigma = x.std() - textstr = '$\mu=%.2f$\n$\mathrm{median}=%.2f$\n$\sigma=%.2f$'%(mu, median, sigma) - - ax.hist(x, 50) - # these are matplotlib.patch.Patch properties - props = dict(boxstyle='round', facecolor='wheat', alpha=0.5) - - # place a text box in upper left in axes coords - ax.text(0.05, 0.95, textstr, transform=ax.transAxes, fontsize=14, - verticalalignment='top', bbox=props) diff --git a/_sources/users/screenshots.rst.txt b/_sources/users/screenshots.rst.txt deleted file mode 100644 index 7bf30859f87..00000000000 --- a/_sources/users/screenshots.rst.txt +++ /dev/null @@ -1,281 +0,0 @@ -.. _matplotlibscreenshots: - -********************** -Screenshots -********************** - -Here you'll find a host of example plots with the code that -generated them. - -Simple Plot -=========== - -Here's a very basic :func:`~matplotlib.pyplot.plot` with text labels: - -.. plot:: mpl_examples/pylab_examples/simple_plot.py - -.. _screenshots_subplot_demo: - -Subplot demo -============ - -Multiple axes (i.e. subplots) are created with the -:func:`~matplotlib.pyplot.subplot` command: - -.. plot:: mpl_examples/subplots_axes_and_figures/subplot_demo.py - -.. _screenshots_histogram_demo: - -Histograms -========== - -The :func:`~matplotlib.pyplot.hist` command automatically generates -histograms and returns the bin counts or probabilities: - -.. plot:: mpl_examples/statistics/histogram_demo_features.py - - -.. _screenshots_path_demo: - -Path demo -========= - -You can add arbitrary paths in matplotlib using the -:mod:`matplotlib.path` module: - -.. plot:: mpl_examples/shapes_and_collections/path_patch_demo.py - -.. _screenshots_mplot3d_surface: - -mplot3d -========= - -The mplot3d toolkit (see :ref:`toolkit_mplot3d-tutorial` and -:ref:`mplot3d-examples-index`) has support for simple 3d graphs -including surface, wireframe, scatter, and bar charts. - -.. plot:: mpl_examples/mplot3d/surface3d_demo.py - -Thanks to John Porter, Jonathon Taylor, Reinier Heeres, and Ben Root for -the `mplot3d` toolkit. This toolkit is included with all standard matplotlib -installs. - -.. _screenshots_ellipse_demo: - - -Streamplot -========== - -The :meth:`~matplotlib.pyplot.streamplot` function plots the streamlines of -a vector field. In addition to simply plotting the streamlines, it allows you -to map the colors and/or line widths of streamlines to a separate parameter, -such as the speed or local intensity of the vector field. - -.. plot:: mpl_examples/images_contours_and_fields/streamplot_demo_features.py - -This feature complements the :meth:`~matplotlib.pyplot.quiver` function for -plotting vector fields. Thanks to Tom Flannaghan and Tony Yu for adding the -streamplot function. - - -Ellipses -======== - -In support of the -`Phoenix `_ mission to -Mars (which used matplotlib to display ground tracking of spacecraft), -Michael Droettboom built on work by Charlie Moad to provide an extremely -accurate 8-spline approximation to elliptical arcs (see -:class:`~matplotlib.patches.Arc`), which are insensitive to zoom level. - -.. plot:: mpl_examples/pylab_examples/ellipse_demo.py - -.. _screenshots_barchart_demo: - -Bar charts -========== - -Bar charts are simple to create using the :func:`~matplotlib.pyplot.bar` -command, which includes customizations such as error bars: - -.. plot:: mpl_examples/pylab_examples/barchart_demo.py - -It's also simple to create stacked bars -(`bar_stacked.py <../examples/pylab_examples/bar_stacked.html>`_), -or horizontal bar charts -(`barh_demo.py <../examples/lines_bars_and_markers/barh_demo.html>`_). - -.. _screenshots_pie_demo: - - -Pie charts -========== - -The :func:`~matplotlib.pyplot.pie` command allows you to easily create pie -charts. Optional features include auto-labeling the percentage of area, -exploding one or more wedges from the center of the pie, and a shadow effect. -Take a close look at the attached code, which generates this figure in just -a few lines of code. - -.. plot:: mpl_examples/pie_and_polar_charts/pie_demo_features.py - -.. _screenshots_table_demo: - -Table demo -========== - -The :func:`~matplotlib.pyplot.table` command adds a text table -to an axes. - -.. plot:: mpl_examples/pylab_examples/table_demo.py - - -.. _screenshots_scatter_demo: - - -Scatter demo -============ - -The :func:`~matplotlib.pyplot.scatter` command makes a scatter plot -with (optional) size and color arguments. This example plots changes -in Google's stock price, with marker sizes reflecting the -trading volume and colors varying with time. Here, the -alpha attribute is used to make semitransparent circle markers. - -.. plot:: mpl_examples/pylab_examples/scatter_demo2.py - - -.. _screenshots_slider_demo: - -Slider demo -=========== - -Matplotlib has basic GUI widgets that are independent of the graphical -user interface you are using, allowing you to write cross GUI figures -and widgets. See :mod:`matplotlib.widgets` and the -`widget examples <../examples/widgets/index.html>`_. - -.. plot:: mpl_examples/widgets/slider_demo.py - - -.. _screenshots_fill_demo: - -Fill demo -========= - -The :func:`~matplotlib.pyplot.fill` command lets you -plot filled curves and polygons: - -.. plot:: mpl_examples/lines_bars_and_markers/fill_demo.py - -Thanks to Andrew Straw for adding this function. - -.. _screenshots_date_demo: - -Date demo -========= - -You can plot date data with major and minor ticks and custom tick formatters -for both. - -.. plot:: mpl_examples/api/date_demo.py - -See :mod:`matplotlib.ticker` and :mod:`matplotlib.dates` for details and usage. - - -.. _screenshots_log_demo: - -Log plots -========= - -The :func:`~matplotlib.pyplot.semilogx`, -:func:`~matplotlib.pyplot.semilogy` and -:func:`~matplotlib.pyplot.loglog` functions simplify the creation of -logarithmic plots. - -.. plot:: mpl_examples/pylab_examples/log_demo.py - -Thanks to Andrew Straw, Darren Dale and Gregory Lielens for contributions -log-scaling infrastructure. - -.. _screenshots_polar_demo: - -Polar plots -=========== - -The :func:`~matplotlib.pyplot.polar` command generates polar plots. - -.. plot:: mpl_examples/pylab_examples/polar_demo.py - -.. _screenshots_legend_demo: - - -Legends -======= - -The :func:`~matplotlib.pyplot.legend` command automatically -generates figure legends, with MATLAB-compatible legend placement -commands. - -.. plot:: mpl_examples/api/legend_demo.py - -Thanks to Charles Twardy for input on the legend command. - -.. _screenshots_mathtext_examples_demo: - -Mathtext_examples -================= - -Below is a sampling of the many TeX expressions now supported by matplotlib's -internal mathtext engine. The mathtext module provides TeX style mathematical -expressions using `FreeType `_ -and the DejaVu, BaKoMa computer modern, or `STIX `_ -fonts. See the :mod:`matplotlib.mathtext` module for additional details. - -.. plot:: mpl_examples/pylab_examples/mathtext_examples.py - -Matplotlib's mathtext infrastructure is an independent implementation and -does not require TeX or any external packages installed on your computer. See -the tutorial at :ref:`mathtext-tutorial`. - - -.. _screenshots_tex_demo: - -Native TeX rendering -==================== - -Although matplotlib's internal math rendering engine is quite -powerful, sometimes you need TeX. Matplotlib supports external TeX -rendering of strings with the *usetex* option. - -.. plot:: mpl_examples/pyplots/tex_demo.py - -.. _screenshots_eeg_demo: - -EEG demo -========= - -You can embed matplotlib into pygtk, wx, Tk, or Qt applications. -Here is a screenshot of an EEG viewer called `pbrain -`__. - -.. image:: ../_static/eeg_small.png - -The lower axes uses :func:`~matplotlib.pyplot.specgram` -to plot the spectrogram of one of the EEG channels. - -For examples of how to embed matplotlib in different toolkits, see: - - * :ref:`user_interfaces-embedding_in_gtk2` - * :ref:`user_interfaces-embedding_in_wx2` - * :ref:`user_interfaces-mpl_with_glade` - * :ref:`user_interfaces-embedding_in_qt4` - * :ref:`user_interfaces-embedding_in_tk` - -XKCD-style sketch plots -======================= - -matplotlib supports plotting in the style of `xkcd -`. - -.. plot:: mpl_examples/showcase/xkcd.py diff --git a/_sources/users/text_intro.rst.txt b/_sources/users/text_intro.rst.txt deleted file mode 100644 index 1075b0d58fe..00000000000 --- a/_sources/users/text_intro.rst.txt +++ /dev/null @@ -1,62 +0,0 @@ -.. _text-intro: - -Text introduction -================= - -matplotlib has extensive text support, including support for -mathematical expressions, truetype support for raster and -vector outputs, newline separated text with arbitrary -rotations, and unicode support. Because it embeds -fonts directly in output documents, e.g., for postscript -or PDF, what you see on the screen is what you get in the hardcopy. -`FreeType `_ support -produces very nice, antialiased fonts, that look good even at small -raster sizes. matplotlib includes its own -:mod:`matplotlib.font_manager` (thanks to Paul Barrett), which -implements a cross platform, `W3C ` -compliant font finding algorithm. - -The user has a great deal of control over text properties (font size, font -weight, text location and color, etc.) with sensible defaults set in -the `rc file `. -And significantly, for those interested in mathematical -or scientific figures, matplotlib implements a large number of TeX -math symbols and commands, supporting :ref:`mathematical expressions -` anywhere in your figure. - - -Basic text commands -=================== - -The following commands are used to create text in the pyplot -interface - -* :func:`~matplotlib.pyplot.text` - add text at an arbitrary location to the ``Axes``; - :meth:`matplotlib.axes.Axes.text` in the API. - -* :func:`~matplotlib.pyplot.xlabel` - add a label to the x-axis; - :meth:`matplotlib.axes.Axes.set_xlabel` in the API. - -* :func:`~matplotlib.pyplot.ylabel` - add a label to the y-axis; - :meth:`matplotlib.axes.Axes.set_ylabel` in the API. - -* :func:`~matplotlib.pyplot.title` - add a title to the ``Axes``; - :meth:`matplotlib.axes.Axes.set_title` in the API. - -* :func:`~matplotlib.pyplot.figtext` - add text at an arbitrary location to the ``Figure``; - :meth:`matplotlib.figure.Figure.text` in the API. - -* :func:`~matplotlib.pyplot.suptitle` - add a title to the ``Figure``; - :meth:`matplotlib.figure.Figure.suptitle` in the API. - -* :func:`~matplotlib.pyplot.annotate` - add an annotation, with - optional arrow, to the ``Axes`` ; :meth:`matplotlib.axes.Axes.annotate` - in the API. - -All of these functions create and return a -:func:`matplotlib.text.Text` instance, which can be configured with a -variety of font and other properties. The example below shows all of -these commands in action. - -.. plot:: mpl_examples/pyplots/text_commands.py - :include-source: diff --git a/_sources/users/text_props.rst.txt b/_sources/users/text_props.rst.txt deleted file mode 100644 index 6ec9c504714..00000000000 --- a/_sources/users/text_props.rst.txt +++ /dev/null @@ -1,157 +0,0 @@ -.. _text-properties: - -============================ - Text properties and layout -============================ - -The :class:`matplotlib.text.Text` instances have a variety of -properties which can be configured via keyword arguments to the text -commands (e.g., :func:`~matplotlib.pyplot.title`, -:func:`~matplotlib.pyplot.xlabel` and :func:`~matplotlib.pyplot.text`). - -========================== ====================================================================================================================== -Property Value Type -========================== ====================================================================================================================== -alpha `float` -backgroundcolor any matplotlib :ref:`color ` -bbox `~matplotlib.patches.Rectangle` prop dict plus key ``'pad'`` which is a pad in points -clip_box a matplotlib.transform.Bbox instance -clip_on [True | False] -clip_path a `~matplotlib.path.Path` instance and a `~matplotlib.transforms.Transform` instance, a `~matplotlib.patches.Patch` -color any matplotlib :ref:`color ` -family [ ``'serif'`` | ``'sans-serif'`` | ``'cursive'`` | ``'fantasy'`` | ``'monospace'`` ] -fontproperties a `~matplotlib.font_manager.FontProperties` instance -horizontalalignment or ha [ ``'center'`` | ``'right'`` | ``'left'`` ] -label any string -linespacing `float` -multialignment [``'left'`` | ``'right'`` | ``'center'`` ] -name or fontname string e.g., [``'Sans'`` | ``'Courier'`` | ``'Helvetica'`` ...] -picker [None|float|boolean|callable] -position (x, y) -rotation [ angle in degrees | ``'vertical'`` | ``'horizontal'`` ] -size or fontsize [ size in points | relative size, e.g., ``'smaller'``, ``'x-large'`` ] -style or fontstyle [ ``'normal'`` | ``'italic'`` | ``'oblique'`` ] -text string or anything printable with '%s' conversion -transform a `~matplotlib.transforms.Transform` instance -variant [ ``'normal'`` | ``'small-caps'`` ] -verticalalignment or va [ ``'center'`` | ``'top'`` | ``'bottom'`` | ``'baseline'`` ] -visible [True | False] -weight or fontweight [ ``'normal'`` | ``'bold'`` | ``'heavy'`` | ``'light'`` | ``'ultrabold'`` | ``'ultralight'``] -x `float` -y `float` -zorder any number -========================== ====================================================================================================================== - - -You can lay out text with the alignment arguments -``horizontalalignment``, ``verticalalignment``, and -``multialignment``. ``horizontalalignment`` controls whether the x -positional argument for the text indicates the left, center or right -side of the text bounding box. ``verticalalignment`` controls whether -the y positional argument for the text indicates the bottom, center or -top side of the text bounding box. ``multialignment``, for newline -separated strings only, controls whether the different lines are left, -center or right justified. Here is an example which uses the -:func:`~matplotlib.pyplot.text` command to show the various alignment -possibilities. The use of ``transform=ax.transAxes`` throughout the -code indicates that the coordinates are given relative to the axes -bounding box, with 0,0 being the lower left of the axes and 1,1 the -upper right. - -.. plot:: mpl_examples/pyplots/text_layout.py - :include-source: - - -============== - Default Font -============== - -The base default font is controlled by a set of rcParams: - -+---------------------+----------------------------------------------------+ -| rcParam | usage | -+=====================+====================================================+ -| ``'font.family'`` | List of either names of font or ``{'cursive', | -| | 'fantasy', 'monospace', 'sans', 'sans serif', | -| | 'sans-serif', 'serif'}``. | -| | | -+---------------------+----------------------------------------------------+ -| ``'font.style'`` | The default style, ex ``'normal'``, | -| | ``'italic'``. | -| | | -+---------------------+----------------------------------------------------+ -| ``'font.variant'`` | Default variant, ex ``'normal'``, ``'small-caps'`` | -| | (untested) | -+---------------------+----------------------------------------------------+ -| ``'font.stretch'`` | Default stretch, ex ``'normal'``, ``'condensed'`` | -| | (incomplete) | -| | | -+---------------------+----------------------------------------------------+ -| ``'font.weight'`` | Default weight. Either string or integer | -| | | -| | | -+---------------------+----------------------------------------------------+ -| ``'font.size'`` | Default font size in points. Relative font sizes | -| | (``'large'``, ``'x-small'``) are computed against | -| | this size. | -+---------------------+----------------------------------------------------+ - -The mapping between the family aliases (``{'cursive', 'fantasy', -'monospace', 'sans', 'sans serif', 'sans-serif', 'serif'}``) and actual font names -is controlled by the following rcParams: - - -+------------------------------------------+--------------------------------+ -| family alias | rcParam with mappings | -+==========================================+================================+ -| ``'serif'`` | ``'font.serif'`` | -+------------------------------------------+--------------------------------+ -| ``'monospace'`` | ``'font.monospace'`` | -+------------------------------------------+--------------------------------+ -| ``'fantasy'`` | ``'font.fantasy'`` | -+------------------------------------------+--------------------------------+ -| ``'cursive'`` | ``'font.cursive'`` | -+------------------------------------------+--------------------------------+ -| ``{'sans', 'sans serif', 'sans-serif'}`` | ``'font.sans-serif'`` | -+------------------------------------------+--------------------------------+ - - -which are lists of font names. - -Text with non-latin glyphs -========================== - -As of v2.0 the :ref:`default font ` contains -glyphs for many western alphabets, but still does not cover all of the -glyphs that may be required by mpl users. For example, DejaVu has no -coverage of Chinese, Korean, or Japanese. - - -To set the default font to be one that supports the code points you -need, prepend the font name to ``'font.family'`` or the desired alias -lists :: - - matplotlib.rcParams['font.sans-serif'] = ['Source Han Sans TW', 'sans-serif'] - -or set it in your :file:`.matplotlibrc` file:: - - font.sans-serif: Source Han Sans TW, Ariel, sans-serif - -To control the font used on per-artist basis use the ``'name'``, -``'fontname'`` or ``'fontproperties'`` kwargs documented :ref:`above -`. - - -On linux, `fc-list `__ can be a -useful tool to discover the font name; for example :: - - $ fc-list :lang=zh family - Noto to Sans Mono CJK TC,Noto Sans Mono CJK TC Bold - Noto Sans CJK TC,Noto Sans CJK TC Medium - Noto Sans CJK TC,Noto Sans CJK TC DemiLight - Noto Sans CJK KR,Noto Sans CJK KR Black - Noto Sans CJK TC,Noto Sans CJK TC Black - Noto Sans Mono CJK TC,Noto Sans Mono CJK TC Regular - Noto Sans CJK SC,Noto Sans CJK SC Light - -lists all of the fonts that support Chinese. diff --git a/_sources/users/tight_layout_guide.rst.txt b/_sources/users/tight_layout_guide.rst.txt deleted file mode 100644 index 7f008901a2a..00000000000 --- a/_sources/users/tight_layout_guide.rst.txt +++ /dev/null @@ -1,322 +0,0 @@ -.. _plotting-guide-tight-layout: - -****************** -Tight Layout guide -****************** - -*tight_layout* automatically adjusts subplot params so that the -subplot(s) fits in to the figure area. This is an experimental -feature and may not work for some cases. It only checks the extents -of ticklabels, axis labels, and titles. - - -Simple Example -============== - -In matplotlib, the location of axes (including subplots) are specified in -normalized figure coordinates. It can happen that your axis labels or -titles (or sometimes even ticklabels) go outside the figure area, and are thus -clipped. - -.. plot:: - :include-source: - :context: - - plt.rcParams['savefig.facecolor'] = "0.8" - - def example_plot(ax, fontsize=12): - ax.plot([1, 2]) - ax.locator_params(nbins=3) - ax.set_xlabel('x-label', fontsize=fontsize) - ax.set_ylabel('y-label', fontsize=fontsize) - ax.set_title('Title', fontsize=fontsize) - - plt.close('all') - fig, ax = plt.subplots() - example_plot(ax, fontsize=24) - -To prevent this, the location of axes needs to be adjusted. For -subplots, this can be done by adjusting the subplot params -(:ref:`howto-subplots-adjust`). Matplotlib v1.1 introduces a new -command :func:`~matplotlib.pyplot.tight_layout` that does this -automatically for you. - -.. plot:: - :include-source: - :context: - - plt.tight_layout() - -When you have multiple subplots, often you see labels of different -axes overlapping each other. - -.. plot:: - :include-source: - :context: - - plt.close('all') - fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(nrows=2, ncols=2) - example_plot(ax1) - example_plot(ax2) - example_plot(ax3) - example_plot(ax4) - - -:func:`~matplotlib.pyplot.tight_layout` will also adjust spacing between -subplots to minimize the overlaps. - -.. plot:: - :include-source: - :context: - - plt.tight_layout() - -:func:`~matplotlib.pyplot.tight_layout` can take keyword arguments of -*pad*, *w_pad* and *h_pad*. These control the extra padding around the -figure border and between subplots. The pads are specified in fraction -of fontsize. - -.. plot:: - :include-source: - :context: - - plt.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0) - -:func:`~matplotlib.pyplot.tight_layout` will work even if the sizes of -subplots are different as far as their grid specification is -compatible. In the example below, *ax1* and *ax2* are subplots of a 2x2 -grid, while *ax3* is of a 1x2 grid. - - -.. plot:: - :include-source: - :context: - - plt.close('all') - fig = plt.figure() - - ax1 = plt.subplot(221) - ax2 = plt.subplot(223) - ax3 = plt.subplot(122) - - example_plot(ax1) - example_plot(ax2) - example_plot(ax3) - - plt.tight_layout() - - -It works with subplots created with -:func:`~matplotlib.pyplot.subplot2grid`. In general, subplots created -from the gridspec (:ref:`gridspec-guide`) will work. - -.. plot:: - :include-source: - :context: - - plt.close('all') - fig = plt.figure() - - ax1 = plt.subplot2grid((3, 3), (0, 0)) - ax2 = plt.subplot2grid((3, 3), (0, 1), colspan=2) - ax3 = plt.subplot2grid((3, 3), (1, 0), colspan=2, rowspan=2) - ax4 = plt.subplot2grid((3, 3), (1, 2), rowspan=2) - - example_plot(ax1) - example_plot(ax2) - example_plot(ax3) - example_plot(ax4) - - plt.tight_layout() - - -Although not thoroughly tested, it seems to work for subplots with -aspect != "auto" (e.g., axes with images). - - -.. plot:: - :include-source: - :context: - - arr = np.arange(100).reshape((10,10)) - - plt.close('all') - fig = plt.figure(figsize=(5,4)) - - ax = plt.subplot(111) - im = ax.imshow(arr, interpolation="none") - - plt.tight_layout() - - -Caveats -------- - - * :func:`~matplotlib.pyplot.tight_layout` only considers ticklabels, axis - labels, and titles. Thus, other artists may be clipped and also may - overlap. - - * It assumes that the extra space needed for ticklabels, axis labels, - and titles is independent of original location of axes. This is - often true, but there are rare cases where it is not. - - * pad=0 clips some of the texts by a few pixels. This may be a bug or - a limitation of the current algorithm and it is not clear why it - happens. Meanwhile, use of pad at least larger than 0.3 is - recommended. - - - - -Use with GridSpec ------------------ - -GridSpec has its own :func:`~matplotlib.gridspec.GridSpec.tight_layout` method -(the pyplot api :func:`~matplotlib.pyplot.tight_layout` also works). - -.. plot:: - :include-source: - :context: - - plt.close('all') - fig = plt.figure() - - import matplotlib.gridspec as gridspec - - gs1 = gridspec.GridSpec(2, 1) - ax1 = fig.add_subplot(gs1[0]) - ax2 = fig.add_subplot(gs1[1]) - - example_plot(ax1) - example_plot(ax2) - - gs1.tight_layout(fig) - - -You may provide an optional *rect* parameter, which specifies the bounding box -that the subplots will be fit inside. The coordinates must be in normalized -figure coordinates and the default is (0, 0, 1, 1). - -.. plot:: - :include-source: - :context: - - gs1.tight_layout(fig, rect=[0, 0, 0.5, 1]) - - -For example, this can be used for a figure with multiple gridspecs. - -.. plot:: - :include-source: - :context: - - gs2 = gridspec.GridSpec(3, 1) - - for ss in gs2: - ax = fig.add_subplot(ss) - example_plot(ax) - ax.set_title("") - ax.set_xlabel("") - - ax.set_xlabel("x-label", fontsize=12) - - gs2.tight_layout(fig, rect=[0.5, 0, 1, 1], h_pad=0.5) - - -We may try to match the top and bottom of two grids :: - - top = min(gs1.top, gs2.top) - bottom = max(gs1.bottom, gs2.bottom) - - gs1.update(top=top, bottom=bottom) - gs2.update(top=top, bottom=bottom) - - -While this should be mostly good enough, adjusting top and bottom -may require adjustment of hspace also. To update hspace & vspace, we -call :func:`~matplotlib.gridspec.GridSpec.tight_layout` again with updated -rect argument. Note that the rect argument specifies the area including the -ticklabels, etc. Thus, we will increase the bottom (which is 0 for the normal -case) by the difference between the *bottom* from above and the bottom of each -gridspec. Same thing for the top. - -.. plot:: - :include-source: - :context: - - top = min(gs1.top, gs2.top) - bottom = max(gs1.bottom, gs2.bottom) - - gs1.tight_layout(fig, rect=[None, 0 + (bottom-gs1.bottom), - 0.5, 1 - (gs1.top-top)]) - gs2.tight_layout(fig, rect=[0.5, 0 + (bottom-gs2.bottom), - None, 1 - (gs2.top-top)], - h_pad=0.5) - - - -Use with AxesGrid1 ------------------- - -While limited, the axes_grid1 toolkit is also supported. - - -.. plot:: - :include-source: - :context: - - plt.close('all') - fig = plt.figure() - - from mpl_toolkits.axes_grid1 import Grid - grid = Grid(fig, rect=111, nrows_ncols=(2,2), - axes_pad=0.25, label_mode='L', - ) - - for ax in grid: - example_plot(ax) - ax.title.set_visible(False) - - plt.tight_layout() - - - -Colorbar --------- - -If you create a colorbar with the :func:`~matplotlib.pyplot.colorbar` -command, the created colorbar is an instance of Axes, *not* Subplot, so -tight_layout does not work. With Matplotlib v1.1, you may create a -colorbar as a subplot using the gridspec. - -.. plot:: - :include-source: - :context: - - plt.close('all') - arr = np.arange(100).reshape((10,10)) - fig = plt.figure(figsize=(4, 4)) - im = plt.imshow(arr, interpolation="none") - - plt.colorbar(im, use_gridspec=True) - - plt.tight_layout() - -Another option is to use AxesGrid1 toolkit to -explicitly create an axes for colorbar. - -.. plot:: - :include-source: - :context: - - plt.close('all') - arr = np.arange(100).reshape((10,10)) - fig = plt.figure(figsize=(4, 4)) - im = plt.imshow(arr, interpolation="none") - - from mpl_toolkits.axes_grid1 import make_axes_locatable - divider = make_axes_locatable(plt.gca()) - cax = divider.append_axes("right", "5%", pad="3%") - plt.colorbar(im, cax=cax) - - plt.tight_layout() diff --git a/_sources/users/transforms_tutorial.rst.txt b/_sources/users/transforms_tutorial.rst.txt deleted file mode 100644 index fc3e574f190..00000000000 --- a/_sources/users/transforms_tutorial.rst.txt +++ /dev/null @@ -1,455 +0,0 @@ -.. _transforms_tutorial: - -************************** -Transformations Tutorial -************************** - -Like any graphics packages, matplotlib is built on top of a -transformation framework to easily move between coordinate systems, -the userland `data` coordinate system, the `axes` coordinate system, -the `figure` coordinate system, and the `display` coordinate system. -In 95% of your plotting, you won't need to think about this, as it -happens under the hood, but as you push the limits of custom figure -generation, it helps to have an understanding of these objects so you -can reuse the existing transformations matplotlib makes available to -you, or create your own (see :mod:`matplotlib.transforms`). The table -below summarizes the existing coordinate systems, the transformation -object you should use to work in that coordinate system, and the -description of that system. In the `Transformation Object` column, -``ax`` is a :class:`~matplotlib.axes.Axes` instance, and ``fig`` is a -:class:`~matplotlib.figure.Figure` instance. - -========== ===================== ==================================================================================== -Coordinate Transformation Object Description -========== ===================== ==================================================================================== -`data` ``ax.transData`` The userland data coordinate system, controlled by the xlim and ylim -`axes` ``ax.transAxes`` The coordinate system of the :class:`~matplotlib.axes.Axes`; (0,0) is - bottom left of the axes, and (1,1) is top right of the axes. -`figure` ``fig.transFigure`` The coordinate system of the :class:`~matplotlib.figure.Figure`; (0,0) - is bottom left of the figure, and (1,1) is top right of the figure. -`display` `None` This is the pixel coordinate system of the display; (0,0) is the bottom - left of the display, and (width, height) is the top right of the display in pixels. - Alternatively, the identity transform - (:class:`matplotlib.transforms.IdentityTransform()`) may be used instead of None. -========== ===================== ==================================================================================== - - -All of the transformation objects in the table above take inputs in -their coordinate system, and transform the input to the `display` -coordinate system. That is why the `display` coordinate system has -`None` for the `Transformation Object` column -- it already is in -display coordinates. The transformations also know how to invert -themselves, to go from `display` back to the native coordinate system. -This is particularly useful when processing events from the user -interface, which typically occur in display space, and you want to -know where the mouse click or key-press occurred in your data -coordinate system. - -.. _data-coords: - -Data coordinates -================ - -Let's start with the most commonly used coordinate, the `data` -coordinate system. Whenever you add data to the axes, matplotlib -updates the datalimits, most commonly updated with the -:meth:`~matplotlib.axes.Axes.set_xlim` and -:meth:`~matplotlib.axes.Axes.set_ylim` methods. For example, in the -figure below, the data limits stretch from 0 to 10 on the x-axis, and --1 to 1 on the y-axis. - -.. plot:: - :include-source: - - import numpy as np - import matplotlib.pyplot as plt - - x = np.arange(0, 10, 0.005) - y = np.exp(-x/2.) * np.sin(2*np.pi*x) - - fig = plt.figure() - ax = fig.add_subplot(111) - ax.plot(x, y) - ax.set_xlim(0, 10) - ax.set_ylim(-1, 1) - - plt.show() - -You can use the ``ax.transData`` instance to transform from your -`data` to your `display` coordinate system, either a single point or a -sequence of points as shown below: - -.. sourcecode:: ipython - - In [14]: type(ax.transData) - Out[14]: - - In [15]: ax.transData.transform((5, 0)) - Out[15]: array([ 335.175, 247. ]) - - In [16]: ax.transData.transform([(5, 0), (1,2)]) - Out[16]: - array([[ 335.175, 247. ], - [ 132.435, 642.2 ]]) - -You can use the :meth:`~matplotlib.transforms.Transform.inverted` -method to create a transform which will take you from display to data -coordinates: - -.. sourcecode:: ipython - - In [41]: inv = ax.transData.inverted() - - In [42]: type(inv) - Out[42]: - - In [43]: inv.transform((335.175, 247.)) - Out[43]: array([ 5., 0.]) - -If your are typing along with this tutorial, the exact values of the -display coordinates may differ if you have a different window size or -dpi setting. Likewise, in the figure below, the display labeled -points are probably not the same as in the ipython session because the -documentation figure size defaults are different. - -.. plot:: mpl_examples/pyplots/annotate_transform.py - - -.. note:: - - If you run the source code in the example above in a GUI backend, - you may also find that the two arrows for the `data` and `display` - annotations do not point to exactly the same point. This is because - the display point was computed before the figure was displayed, and - the GUI backend may slightly resize the figure when it is created. - The effect is more pronounced if you resize the figure yourself. - This is one good reason why you rarely want to work in display - space, but you can connect to the ``'on_draw'`` - :class:`~matplotlib.backend_bases.Event` to update figure - coordinates on figure draws; see :ref:`event-handling-tutorial`. - -When you change the x or y limits of your axes, the data limits are -updated so the transformation yields a new display point. Note that -when we just change the ylim, only the y-display coordinate is -altered, and when we change the xlim too, both are altered. More on -this later when we talk about the -:class:`~matplotlib.transforms.Bbox`. - -.. sourcecode:: ipython - - In [54]: ax.transData.transform((5, 0)) - Out[54]: array([ 335.175, 247. ]) - - In [55]: ax.set_ylim(-1,2) - Out[55]: (-1, 2) - - In [56]: ax.transData.transform((5, 0)) - Out[56]: array([ 335.175 , 181.13333333]) - - In [57]: ax.set_xlim(10,20) - Out[57]: (10, 20) - - In [58]: ax.transData.transform((5, 0)) - Out[58]: array([-171.675 , 181.13333333]) - - - -.. _axes-coords: - -Axes coordinates -================ - -After the `data` coordinate system, `axes` is probably the second most -useful coordinate system. Here the point (0,0) is the bottom left of -your axes or subplot, (0.5, 0.5) is the center, and (1.0, 1.0) is the -top right. You can also refer to points outside the range, so (-0.1, -1.1) is to the left and above your axes. This coordinate system is -extremely useful when placing text in your axes, because you often -want a text bubble in a fixed, location, e.g., the upper left of the axes -pane, and have that location remain fixed when you pan or zoom. Here -is a simple example that creates four panels and labels them 'A', 'B', -'C', 'D' as you often see in journals. - -.. plot:: - :include-source: - - import numpy as np - import matplotlib.pyplot as plt - - fig = plt.figure() - for i, label in enumerate(('A', 'B', 'C', 'D')): - ax = fig.add_subplot(2,2,i+1) - ax.text(0.05, 0.95, label, transform=ax.transAxes, - fontsize=16, fontweight='bold', va='top') - - plt.show() - -You can also make lines or patches in the axes coordinate system, but -this is less useful in my experience than using ``ax.transAxes`` for -placing text. Nonetheless, here is a silly example which plots some -random dots in `data` space, and overlays a semi-transparent -:class:`~matplotlib.patches.Circle` centered in the middle of the axes -with a radius one quarter of the axes -- if your axes does not -preserve aspect ratio (see :meth:`~matplotlib.axes.Axes.set_aspect`), -this will look like an ellipse. Use the pan/zoom tool to move around, -or manually change the data xlim and ylim, and you will see the data -move, but the circle will remain fixed because it is not in `data` -coordinates and will always remain at the center of the axes. - -.. plot:: - :include-source: - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.patches as patches - fig = plt.figure() - ax = fig.add_subplot(111) - x, y = 10*np.random.rand(2, 1000) - ax.plot(x, y, 'go') # plot some data in data coordinates - - circ = patches.Circle((0.5, 0.5), 0.25, transform=ax.transAxes, - facecolor='yellow', alpha=0.5) - ax.add_patch(circ) - - plt.show() - -.. blended_transformations: - -Blended transformations -======================= - -Drawing in `blended` coordinate spaces which mix `axes` with `data` -coordinates is extremely useful, for example to create a horizontal -span which highlights some region of the y-data but spans across the -x-axis regardless of the data limits, pan or zoom level, etc. In fact -these blended lines and spans are so useful, we have built in -functions to make them easy to plot (see -:meth:`~matplotlib.axes.Axes.axhline`, -:meth:`~matplotlib.axes.Axes.axvline`, -:meth:`~matplotlib.axes.Axes.axhspan`, -:meth:`~matplotlib.axes.Axes.axvspan`) but for didactic purposes we -will implement the horizontal span here using a blended -transformation. This trick only works for separable transformations, -like you see in normal Cartesian coordinate systems, but not on -inseparable transformations like the -:class:`~matplotlib.projections.polar.PolarAxes.PolarTransform`. - -.. plot:: - :include-source: - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.patches as patches - import matplotlib.transforms as transforms - - fig = plt.figure() - ax = fig.add_subplot(111) - - x = np.random.randn(1000) - - ax.hist(x, 30) - ax.set_title(r'$\sigma=1 \/ \dots \/ \sigma=2$', fontsize=16) - - # the x coords of this transformation are data, and the - # y coord are axes - trans = transforms.blended_transform_factory( - ax.transData, ax.transAxes) - - # highlight the 1..2 stddev region with a span. - # We want x to be in data coordinates and y to - # span from 0..1 in axes coords - rect = patches.Rectangle((1,0), width=1, height=1, - transform=trans, color='yellow', - alpha=0.5) - - ax.add_patch(rect) - - plt.show() - -.. note:: - - The blended transformations where x is in data coords and y in axes - coordinates is so useful that we have helper methods to return the - versions mpl uses internally for drawing ticks, ticklabels, etc. - The methods are :meth:`matplotlib.axes.Axes.get_xaxis_transform` and - :meth:`matplotlib.axes.Axes.get_yaxis_transform`. So in the example - above, the call to - :meth:`~matplotlib.transforms.blended_transform_factory` can be - replaced by ``get_xaxis_transform``:: - - trans = ax.get_xaxis_transform() - -.. offset-transforms-shadow: - -Using offset transforms to create a shadow effect -================================================= - -One use of transformations is to create a new transformation that is -offset from another transformation, e.g., to place one object shifted a -bit relative to another object. Typically you want the shift to be in -some physical dimension, like points or inches rather than in data -coordinates, so that the shift effect is constant at different zoom -levels and dpi settings. - -One use for an offset is to create a shadow effect, where you draw one -object identical to the first just to the right of it, and just below -it, adjusting the zorder to make sure the shadow is drawn first and -then the object it is shadowing above it. The transforms module has a -helper transformation -:class:`~matplotlib.transforms.ScaledTranslation`. It is -instantiated with:: - - trans = ScaledTranslation(xt, yt, scale_trans) - -where `xt` and `yt` are the translation offsets, and `scale_trans` is -a transformation which scales `xt` and `yt` at transformation time -before applying the offsets. A typical use case is to use the figure -``fig.dpi_scale_trans`` transformation for the `scale_trans` argument, -to first scale `xt` and `yt` specified in points to `display` space -before doing the final offset. The dpi and inches offset is a -common-enough use case that we have a special helper function to -create it in :func:`matplotlib.transforms.offset_copy`, which returns -a new transform with an added offset. But in the example below, we'll -create the offset transform ourselves. Note the use of the plus -operator in:: - - offset = transforms.ScaledTranslation(dx, dy, - fig.dpi_scale_trans) - shadow_transform = ax.transData + offset - -showing that can chain transformations using the addition operator. -This code says: first apply the data transformation ``ax.transData`` -and then translate the data by `dx` and `dy` points. In typography, -a`point `_ is -1/72 inches, and by specifying your offsets in points, your figure -will look the same regardless of the dpi resolution it is saved in. - -.. plot:: - :include-source: - - import numpy as np - import matplotlib.pyplot as plt - import matplotlib.patches as patches - import matplotlib.transforms as transforms - - fig = plt.figure() - ax = fig.add_subplot(111) - - # make a simple sine wave - x = np.arange(0., 2., 0.01) - y = np.sin(2*np.pi*x) - line, = ax.plot(x, y, lw=3, color='blue') - - # shift the object over 2 points, and down 2 points - dx, dy = 2/72., -2/72. - offset = transforms.ScaledTranslation(dx, dy, - fig.dpi_scale_trans) - shadow_transform = ax.transData + offset - - # now plot the same data with our offset transform; - # use the zorder to make sure we are below the line - ax.plot(x, y, lw=3, color='gray', - transform=shadow_transform, - zorder=0.5*line.get_zorder()) - - ax.set_title('creating a shadow effect with an offset transform') - plt.show() - - -.. transformation-pipeline: - -The transformation pipeline -=========================== - -The ``ax.transData`` transform we have been working with in this -tutorial is a composite of three different transformations that -comprise the transformation pipeline from `data` -> `display` -coordinates. Michael Droettboom implemented the transformations -framework, taking care to provide a clean API that segregated the -nonlinear projections and scales that happen in polar and logarithmic -plots, from the linear affine transformations that happen when you pan -and zoom. There is an efficiency here, because you can pan and zoom -in your axes which affects the affine transformation, but you may not -need to compute the potentially expensive nonlinear scales or -projections on simple navigation events. It is also possible to -multiply affine transformation matrices together, and then apply them -to coordinates in one step. This is not true of all possible -transformations. - - -Here is how the ``ax.transData`` instance is defined in the basic -separable axis :class:`~matplotlib.axes.Axes` class:: - - self.transData = self.transScale + (self.transLimits + self.transAxes) - -We've been introduced to the ``transAxes`` instance above in -:ref:`axes-coords`, which maps the (0,0), (1,1) corners of the -axes or subplot bounding box to `display` space, so let's look at -these other two pieces. - -``self.transLimits`` is the transformation that takes you from -``data`` to ``axes`` coordinates; i.e., it maps your view xlim and ylim -to the unit space of the axes (and ``transAxes`` then takes that unit -space to display space). We can see this in action here - -.. sourcecode:: ipython - - In [80]: ax = subplot(111) - - In [81]: ax.set_xlim(0, 10) - Out[81]: (0, 10) - - In [82]: ax.set_ylim(-1,1) - Out[82]: (-1, 1) - - In [84]: ax.transLimits.transform((0,-1)) - Out[84]: array([ 0., 0.]) - - In [85]: ax.transLimits.transform((10,-1)) - Out[85]: array([ 1., 0.]) - - In [86]: ax.transLimits.transform((10,1)) - Out[86]: array([ 1., 1.]) - - In [87]: ax.transLimits.transform((5,0)) - Out[87]: array([ 0.5, 0.5]) - -and we can use this same inverted transformation to go from the unit -`axes` coordinates back to `data` coordinates. - -.. sourcecode:: ipython - - In [90]: inv.transform((0.25, 0.25)) - Out[90]: array([ 2.5, -0.5]) - -The final piece is the ``self.transScale`` attribute, which is -responsible for the optional non-linear scaling of the data, e.g., for -logarithmic axes. When an Axes is initially setup, this is just set to -the identity transform, since the basic matplotlib axes has linear -scale, but when you call a logarithmic scaling function like -:meth:`~matplotlib.axes.Axes.semilogx` or explicitly set the scale to -logarithmic with :meth:`~matplotlib.axes.Axes.set_xscale`, then the -``ax.transScale`` attribute is set to handle the nonlinear projection. -The scales transforms are properties of the respective ``xaxis`` and -``yaxis`` :class:`~matplotlib.axis.Axis` instances. For example, when -you call ``ax.set_xscale('log')``, the xaxis updates its scale to a -:class:`matplotlib.scale.LogScale` instance. - -For non-separable axes the PolarAxes, there is one more piece to -consider, the projection transformation. The ``transData`` -:class:`matplotlib.projections.polar.PolarAxes` is similar to that for -the typical separable matplotlib Axes, with one additional piece -``transProjection``:: - - self.transData = self.transScale + self.transProjection + \ - (self.transProjectionAffine + self.transAxes) - -``transProjection`` handles the projection from the space, -e.g., latitude and longitude for map data, or radius and theta for polar -data, to a separable Cartesian coordinate system. There are several -projection examples in the ``matplotlib.projections`` package, and the -best way to learn more is to open the source for those packages and -see how to make your own, since matplotlib supports extensible axes -and projections. Michael Droettboom has provided a nice tutorial -example of creating a hammer projection axes; see -:ref:`api-custom_projection_example`. diff --git a/_sources/users/tutorials.rst.txt b/_sources/users/tutorials.rst.txt deleted file mode 100644 index 0675f0a4f5a..00000000000 --- a/_sources/users/tutorials.rst.txt +++ /dev/null @@ -1,45 +0,0 @@ -.. _tutorials-index: - -=========== - Tutorials -=========== - -.. htmlonly:: - - :Release: |version| - :Date: |today| - -.. _tutorials-index-intro: - -Introductory ------------- - -.. toctree:: - :maxdepth: 2 - - pyplot_tutorial.rst - image_tutorial.rst - gridspec.rst - tight_layout_guide.rst - -.. _tutorials-index-inter: - -Intermediate ------------- -.. toctree:: - :maxdepth: 2 - - artists.rst - legend_guide.rst - -.. _tutorials-index-adv: - -Advanced --------- - -.. toctree:: - :maxdepth: 2 - - transforms_tutorial.rst - path_tutorial.rst - patheffects_guide.rst diff --git a/_sources/users/usetex.rst.txt b/_sources/users/usetex.rst.txt deleted file mode 100644 index b094d572918..00000000000 --- a/_sources/users/usetex.rst.txt +++ /dev/null @@ -1,158 +0,0 @@ -.. _usetex-tutorial: - -************************* -Text rendering With LaTeX -************************* - -Matplotlib has the option to use LaTeX to manage all text layout. This -option is available with the following backends: - -* Agg -* PS -* PDF - -The LaTeX option is activated by setting ``text.usetex : True`` in -your rc settings. Text handling with matplotlib's LaTeX support is -slower than matplotlib's very capable :ref:`mathtext -`, but is more flexible, since different LaTeX -packages (font packages, math packages, etc.) can be used. The -results can be striking, especially when you take care to use the same -fonts in your figures as in the main document. - -Matplotlib's LaTeX support requires a working LaTeX_ installation, dvipng_ -(which may be included with your LaTeX installation), and Ghostscript_ -(GPL Ghostscript 8.60 or later is recommended). The executables for these -external dependencies must all be located on your :envvar:`PATH`. - -There are a couple of options to mention, which can be changed using :ref:`rc -settings `. Here is an example matplotlibrc file:: - - font.family : serif - font.serif : Times, Palatino, New Century Schoolbook, Bookman, Computer Modern Roman - font.sans-serif : Helvetica, Avant Garde, Computer Modern Sans serif - font.cursive : Zapf Chancery - font.monospace : Courier, Computer Modern Typewriter - - text.usetex : true - -The first valid font in each family is the one that will be loaded. If the -fonts are not specified, the Computer Modern fonts are used by default. All of -the other fonts are Adobe fonts. Times and Palatino each have their own -accompanying math fonts, while the other Adobe serif fonts make use of the -Computer Modern math fonts. See the PSNFSS_ documentation for more details. - -To use LaTeX and select Helvetica as the default font, without editing -matplotlibrc use:: - - from matplotlib import rc - rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']}) - ## for Palatino and other serif fonts use: - #rc('font',**{'family':'serif','serif':['Palatino']}) - rc('text', usetex=True) - -Here is the standard example, `tex_demo.py`: - -.. plot:: mpl_examples/pyplots/tex_demo.py - :include-source: - -Note that display math mode (``$$ e=mc^2 $$``) is not supported, but adding the -command ``\displaystyle``, as in `tex_demo.py`, will produce the same -results. - -.. note:: - Certain characters require special escaping in TeX, such as:: - - # $ % & ~ _ ^ \ { } \( \) \[ \] - - Therefore, these characters will behave differently depending on - the rcParam ``text.usetex`` flag. - -.. _usetex-unicode: - -usetex with unicode -=================== -It is also possible to use unicode strings with the LaTeX text manager, here is -an example taken from `tex_unicode_demo.py`: - -.. plot:: mpl_examples/pylab_examples/tex_unicode_demo.py - :include-source: - -.. _usetex-postscript: - -Postscript options -================== - -In order to produce encapsulated postscript files that can be embedded in a new -LaTeX document, the default behavior of matplotlib is to distill the output, -which removes some postscript operators used by LaTeX that are illegal in an -eps file. This step produces results which may be unacceptable to some users, -because the text is coarsely rasterized and converted to bitmaps, which are not -scalable like standard postscript, and the text is not searchable. One -workaround is to to set ``ps.distiller.res`` to a higher value (perhaps 6000) -in your rc settings, which will produce larger files but may look better and -scale reasonably. A better workaround, which requires Poppler_ or Xpdf_, can be -activated by changing the ``ps.usedistiller`` rc setting to ``xpdf``. This -alternative produces postscript without rasterizing text, so it scales -properly, can be edited in Adobe Illustrator, and searched text in pdf -documents. - -.. _usetex-hangups: - -Possible hangups -================ - -* On Windows, the :envvar:`PATH` environment variable may need to be modified - to include the directories containing the latex, dvipng and ghostscript - executables. See :ref:`environment-variables` and - :ref:`setting-windows-environment-variables` for details. - -* Using MiKTeX with Computer Modern fonts, if you get odd \*Agg and PNG - results, go to MiKTeX/Options and update your format files - -* The fonts look terrible on screen. You are probably running Mac OS, and there - is some funny business with older versions of dvipng on the mac. Set - ``text.dvipnghack : True`` in your matplotlibrc file. - -* On Ubuntu and Gentoo, the base texlive install does not ship with - the type1cm package. You may need to install some of the extra - packages to get all the goodies that come bundled with other latex - distributions. - -* Some progress has been made so matplotlib uses the dvi files - directly for text layout. This allows latex to be used for text - layout with the pdf and svg backends, as well as the \*Agg and PS - backends. In the future, a latex installation may be the only - external dependency. - -.. _usetex-troubleshooting: - -Troubleshooting -=============== - -* Try deleting your :file:`.matplotlib/tex.cache` directory. If you don't know - where to find :file:`.matplotlib`, see :ref:`locating-matplotlib-config-dir`. - -* Make sure LaTeX, dvipng and ghostscript are each working and on your - :envvar:`PATH`. - -* Make sure what you are trying to do is possible in a LaTeX document, - that your LaTeX syntax is valid and that you are using raw strings - if necessary to avoid unintended escape sequences. - -* Most problems reported on the mailing list have been cleared up by - upgrading Ghostscript_. If possible, please try upgrading to the - latest release before reporting problems to the list. - -* The ``text.latex.preamble`` rc setting is not officially supported. This - option provides lots of flexibility, and lots of ways to cause - problems. Please disable this option before reporting problems to - the mailing list. - -* If you still need help, please see :ref:`reporting-problems` - -.. _LaTeX: http://www.tug.org -.. _dvipng: http://www.nongnu.org/dvipng/ -.. _Ghostscript: https://ghostscript.com/ -.. _PSNFSS: http://www.ctan.org/tex-archive/macros/latex/required/psnfss/psnfss2e.pdf -.. _Poppler: https://poppler.freedesktop.org/ -.. _Xpdf: http://www.foolabs.com/xpdf diff --git a/_static/CHANGELOG b/_static/CHANGELOG deleted file mode 100644 index 00791883a7e..00000000000 --- a/_static/CHANGELOG +++ /dev/null @@ -1,5395 +0,0 @@ -2015-11-16 Levels passed to contour(f) and tricontour(f) must be in increasing - order. - -2015-10-21 Added get_ticks_direction() - -2015-02-27 Added the rcParam 'image.composite_image' to permit users - to decide whether they want the vector graphics backends to combine - all images within a set of axes into a single composite image. - (If images do not get combined, users can open vector graphics files - in Adobe Illustrator or Inkscape and edit each image individually.) - -2015-02-19 Rewrite of C++ code that calculates contours to add support for - corner masking. This is controlled by the 'corner_mask' keyword - in plotting commands 'contour' and 'contourf'. - IMT - -2015-01-23 Text bounding boxes are now computed with advance width rather than - ink area. This may result in slightly different placement of text. - -2014-10-27 Allowed selection of the backend using the `MPLBACKEND` environment - variable. Added documentation on backend selection methods. - -2014-09-27 Overhauled `colors.LightSource`. Added `LightSource.hillshade` to - allow the independent generation of illumination maps. Added new - types of blending for creating more visually appealing shaded relief - plots (e.g. `blend_mode="overlay"`, etc, in addition to the legacy - "hsv" mode). - -2014-06-10 Added Colorbar.remove() - -2014-06-07 Fixed bug so radial plots can be saved as ps in py3k. - -2014-06-01 Changed the fmt kwarg of errorbar to support the - the mpl convention that "none" means "don't draw it", - and to default to the empty string, so that plotting - of data points is done with the plot() function - defaults. Deprecated use of the None object in place - "none". - -2014-05-22 Allow the linscale keyword parameter of symlog scale to be - smaller than one. - -2014-05-20 Added logic to in FontManager to invalidate font-cache if - if font-family rcparams have changed. - -2014-05-16 Fixed the positioning of multi-line text in the PGF backend. - -2014-05-14 Added Axes.add_image() as the standard way to add AxesImage - instances to Axes. This improves the consistency with - add_artist(), add_collection(), add_container(), add_line(), - add_patch(), and add_table(). - -2014-05-02 Added colorblind-friendly colormap, named 'Wistia'. - -2014-04-27 Improved input clean up in Axes.{h|v}lines - Coerce input into a 1D ndarrays (after dealing with units). - -2014-04-27 removed un-needed cast to float in stem - -2014-04-23 Updated references to "ipython -pylab" - The preferred method for invoking pylab is now using the - "%pylab" magic. - -Chris G. - -2014-04-22 Added (re-)generate a simple automatic legend to "Figure Options" - dialog of the Qt4Agg backend. - -2014-04-22 Added an example showing the difference between - interpolation = 'none' and interpolation = 'nearest' in - `imshow()` when saving vector graphics files. - -2014-04-22 Added violin plotting functions. See `Axes.violinplot`, - `Axes.violin`, `cbook.violin_stats` and `mlab.GaussianKDE` for - details. - -2014-04-10 Fixed the triangular marker rendering error. The "Up" triangle was - rendered instead of "Right" triangle and vice-versa. - -2014-04-08 Fixed a bug in parasite_axes.py by making a list out - of a generator at line 263. - -2014-04-02 Added `clipon=False` to patch creation of wedges and shadows - in `pie`. - -2014-02-25 In backend_qt4agg changed from using update -> repaint under - windows. See comment in source near `self._priv_update` for - longer explaination. - -2014-03-27 Added tests for pie ccw parameter. Removed pdf and svg images - from tests for pie linewidth parameter. - -2014-03-24 Changed the behaviour of axes to not ignore leading or trailing - patches of height 0 (or width 0) while calculating the x and y - axis limits. Patches having both height == 0 and width == 0 are - ignored. - -2014-03-24 Added bool kwarg (manage_xticks) to boxplot to enable/disable - the managemnet of the xlimits and ticks when making a boxplot. - Default in True which maintains current behavior by default. - -2014-03-23 Fixed a bug in projections/polar.py by making sure that the theta - value being calculated when given the mouse coordinates stays within - the range of 0 and 2 * pi. - -2014-03-22 Added the keyword arguments wedgeprops and textprops to pie. - Users can control the wedge and text properties of the pie - in more detail, if they choose. - -2014-03-17 Bug was fixed in append_axes from the AxesDivider class would not - append axes in the right location with respect to the reference - locator axes - -2014-03-13 Add parameter 'clockwise' to function pie, True by default. - -2014-02-28 Added 'origin' kwarg to `spy` - -2014-02-27 Implemented separate horizontal/vertical axes padding to the - ImageGrid in the AxesGrid toolkit - -2014-02-27 Allowed markevery property of matplotlib.lines.Line2D to be, an int - numpy fancy index, slice object, or float. The float behaviour - turns on markers at approximately equal display-coordinate-distances - along the line. - -2014-02-25 In backend_qt4agg changed from using update -> repaint under - windows. See comment in source near `self._priv_update` for - longer explaination. - -2014-01-02 `triplot` now returns the artist it adds and support of line and - marker kwargs has been improved. GBY - -2013-12-30 Made streamplot grid size consistent for different types of density - argument. A 30x30 grid is now used for both density=1 and - density=(1, 1). - -2013-12-03 Added a pure boxplot-drawing method that allow a more complete - customization of boxplots. It takes a list of dicts contains stats. - Also created a function (`cbook.boxplot_stats`) that generates the - stats needed. - -2013-11-28 Added qhull extension module to perform Delaunay triangulation more - robustly than before. It is used by tri.Triangulation (and hence - all pyplot.tri* methods) and mlab.griddata. Deprecated - matplotlib.delaunay module. - IMT - -2013-11-05 Add power-law normalization method. This is useful for, - e.g., showing small populations in a "hist2d" histogram. - -2013-10-27 Added get_rlabel_position and set_rlabel_position methods to - PolarAxes to control angular position of radial tick labels. - -2013-10-06 Add stride-based functions to mlab for easy creation of 2D arrays - with less memory. - -2013-10-06 Improve window and detrend functions in mlab, particulart support for - 2D arrays. - -2013-10-06 Improve performance of all spectrum-related mlab functions and plots. - -2013-10-06 Added support for magnitude, phase, and angle spectrums to - axes.specgram, and support for magnitude, phase, angle, and complex - spectrums to mlab-specgram. - -2013-10-06 Added magnitude_spectrum, angle_spectrum, and phase_spectrum plots, - as well as magnitude_spectrum, angle_spectrum, phase_spectrum, - and complex_spectrum functions to mlab - -2013-07-12 Added support for datetime axes to 2d plots. Axis values are passed - through Axes.convert_xunits/Axes.convert_yunits before being used by - contour/contourf, pcolormesh and pcolor. - -2013-07-12 Allowed matplotlib.dates.date2num, matplotlib.dates.num2date, - and matplotlib.dates.datestr2num to accept n-d inputs. Also - factored in support for n-d arrays to matplotlib.dates.DateConverter - and matplotlib.units.Registry. - -2013-06-26 Refactored the axes module: the axes module is now a folder, - containing the following submodule: - - _subplots.py, containing all the subplots helper methods - - _base.py, containing several private methods and a new - _AxesBase class. This _AxesBase class contains all the methods - that are not directly linked to plots of the "old" Axes - - _axes.py contains the Axes class. This class now inherits from - _AxesBase: it contains all "plotting" methods and labelling - methods. - This refactoring should not affect the API. Only private methods - are not importable from the axes module anymore. - -2013-05-18 Added support for arbitrary rasterization resolutions to the - SVG backend. Previously the resolution was hard coded to 72 - dpi. Now the backend class takes a image_dpi argument for - its constructor, adjusts the image bounding box accordingly - and forwards a magnification factor to the image renderer. - The code and results now resemble those of the PDF backend. - - MW - -2013-05-08 Changed behavior of hist when given stacked=True and normed=True. - Histograms are now stacked first, then the sum is normalized. - Previously, each histogram was normalized, then they were stacked. - -2013-04-25 Changed all instances of: - - from matplotlib import MatplotlibDeprecationWarning as mplDeprecation - to: - - from cbook import mplDeprecation - - and removed the import into the matplotlib namespace in __init__.py - Thomas Caswell - -2013-04-15 Added 'axes.xmargin' and 'axes.ymargin' to rpParams to set default - margins on auto-scaleing. - TAC - -2013-04-16 Added patheffect support for Line2D objects. -JJL - -2013-03-31 Added support for arbitrary unstructured user-specified - triangulations to Axes3D.tricontour[f] - Damon McDougall - -2013-03-19 Added support for passing `linestyle` kwarg to `step` so all `plot` - kwargs are passed to the underlying `plot` call. -TAC - -2013-02-25 Added classes CubicTriInterpolator, UniformTriRefiner, TriAnalyzer - to matplotlib.tri module. - GBy - -2013-01-23 Add 'savefig.directory' to rcParams to remember and fill in the last - directory saved to for figure save dialogs - Martin Spacek - -2013-01-13 Add eventplot method to axes and pyplot and EventCollection class - to collections. - -2013-01-08 Added two extra titles to axes which are flush with the left and - right edges of the plot respectively. - Andrew Dawson - -2013-01-07 Add framealpha keyword argument to legend - PO - -2013-01-16 Till Stensitzki added a baseline feature to stackplot - -2012-12-22 Added classes for interpolation within triangular grids - (LinearTriInterpolator) and to find the triangles in which points - lie (TrapezoidMapTriFinder) to matplotlib.tri module. - IMT - -2012-12-05 Added MatplotlibDeprecationWarning class for signaling deprecation. - Matplotlib developers can use this class as follows: - - from matplotlib import MatplotlibDeprecationWarning as mplDeprecation - - In light of the fact that Python builtin DeprecationWarnings are - ignored by default as of Python 2.7, this class was put in to allow - for the signaling of deprecation, but via UserWarnings which are - not ignored by default. - PI - -2012-11-27 Added the *mtext* parameter for supplying matplotlib.text.Text - instances to RendererBase.draw_tex and RendererBase.draw_text. - This allows backends to utilize additional text attributes, like - the alignment of text elements. - pwuertz - -2012-11-26 deprecate matplotlib/mpl.py, which was used only in pylab.py and is - now replaced by the more suitable `import matplotlib as mpl`. - PI - -2012-11-25 Make rc_context available via pyplot interface - PI - -2012-11-16 plt.set_cmap no longer throws errors if there is not already - an active colorable artist, such as an image, and just sets - up the colormap to use from that point forward. - PI - -2012-11-16 Added the funcction _get_rbga_face, which is identical to - _get_rbg_face except it return a (r,g,b,a) tuble, to line2D. - Modified Line2D.draw to use _get_rbga_face to get the markerface - color so that any alpha set by markerfacecolor will respected. - - Thomas Caswell - -2012-11-13 Add a symmetric log normalization class to colors.py. - Also added some tests for the normalization class. - Till Stensitzki - -2012-11-12 Make axes.stem take at least one argument. - Uses a default range(n) when the first arg not provided. - Damon McDougall - -2012-11-09 Make plt.subplot() without arguments act as subplot(111) - PI - -2012-11-08 Replaced plt.figure and plt.subplot calls by the newer, more - convenient single call to plt.subplots() in the documentation - examples - PI - -2012-10-05 Add support for saving animations as animated GIFs. - JVDP - -2012-08-11 Fix path-closing bug in patches.Polygon, so that regardless - of whether the path is the initial one or was subsequently - set by set_xy(), get_xy() will return a closed path if and - only if get_closed() is True. Thanks to Jacob Vanderplas. - EF - -2012-08-05 When a norm is passed to contourf, either or both of the - vmin, vmax attributes of that norm are now respected. - Formerly they were respected only if both were - specified. In addition, vmin and/or vmax can now - be passed to contourf directly as kwargs. - EF - -2012-07-24 Contourf handles the extend kwarg by mapping the extended - ranges outside the normed 0-1 range so that they are - handled by colormap colors determined by the set_under - and set_over methods. Previously the extended ranges - were mapped to 0 or 1 so that the "under" and "over" - colormap colors were ignored. This change also increases - slightly the color contrast for a given set of contour - levels. - EF - -2012-06-24 Make use of mathtext in tick labels configurable - DSD - -2012-06-05 Images loaded through PIL are now ordered correctly - CG - -2012-06-02 Add new Axes method and pyplot function, hist2d. - PO - -2012-05-31 Remove support for 'cairo.' style of backend specification. - Deprecate 'cairo.format' and 'savefig.extension' rcParams and - replace with 'savefig.format'. - Martin Spacek - -2012-05-29 pcolormesh now obeys the passed in "edgecolor" kwarg. - To support this, the "shading" argument to pcolormesh now only - takes "flat" or "gouraud". To achieve the old "faceted" behavior, - pass "edgecolors='k'". - MGD - -2012-05-22 Added radius kwarg to pie charts. - HH - -2012-05-22 Collections now have a setting "offset_position" to select whether - the offsets are given in "screen" coordinates (default, - following the old behavior) or "data" coordinates. This is currently - used internally to improve the performance of hexbin. - - As a result, the "draw_path_collection" backend methods have grown - a new argument "offset_position". - MGD - -2012-05-04 Add a new argument to pie charts - startingangle - that - allows one to specify the angle offset for the first wedge - of the chart. - EP - -2012-05-03 symlog scale now obeys the logarithmic base. Previously, it was - completely ignored and always treated as base e. - MGD - -2012-05-03 Allow linscalex/y keyword to symlog scale that allows the size of - the linear portion relative to the logarithmic portion to be - adjusted. - MGD - -2012-04-14 Added new plot style: stackplot. This new feature supports stacked - area plots. - Damon McDougall - -2012-04-06 When path clipping changes a LINETO to a MOVETO, it also - changes any CLOSEPOLY command to a LINETO to the initial - point. This fixes a problem with pdf and svg where the - CLOSEPOLY would then draw a line to the latest MOVETO - position instead of the intended initial position. - JKS - -2012-03-27 Add support to ImageGrid for placing colorbars only at - one edge of each column/row. - RMM - -2012-03-07 Refactor movie writing into useful classes that make use - of pipes to write image data to ffmpeg or mencoder. Also - improve settings for these and the ability to pass custom - options. - RMM - -2012-02-29 errorevery keyword added to errorbar to enable errorbar - subsampling. fixes issue #600. - -2012-02-28 Added plot_trisurf to the mplot3d toolkit. This supports plotting - three dimensional surfaces on an irregular grid. - Damon McDougall - -2012-01-23 The radius labels in polar plots no longer use a fixed - padding, but use a different alignment depending on the - quadrant they are in. This fixes numerical problems when - (rmax - rmin) gets too small. - MGD - -2012-01-08 Add axes.streamplot to plot streamlines of a velocity field. - Adapted from Tom Flannaghan streamplot implementation. -TSY - -2011-12-29 ps and pdf markers are now stroked only if the line width - is nonzero for consistency with agg, fixes issue #621. - JKS - -2011-12-27 Work around an EINTR bug in some versions of subprocess. - JKS - -2011-10-25 added support for \operatorname to mathtext, - including the ability to insert spaces, such as - $\operatorname{arg\,max}$ - PI - -2011-08-18 Change api of Axes.get_tightbbox and add an optional - keyword parameter *call_axes_locator*. - JJL - -2011-07-29 A new rcParam "axes.formatter.use_locale" was added, that, - when True, will use the current locale to format tick - labels. This means that, for example, in the fr_FR locale, - ',' will be used as a decimal separator. - MGD - -2011-07-15 The set of markers available in the plot() and scatter() - commands has been unified. In general, this gives more - options to both than were previously available, however, - there is one backward-incompatible change to the markers in - scatter: - - "d" used to mean "diamond", it now means "narrow - diamond". "D" can be used for a "diamond". - - -MGD - -2011-07-13 Fix numerical problems in symlog scale, particularly when - linthresh <= 1.0. Symlog plots may look different if one - was depending on the old broken behavior - MGD - -2011-07-10 Fixed argument handling error in tripcolor/triplot/tricontour, - issue #203. - IMT - -2011-07-08 Many functions added to mplot3d.axes3d to bring Axes3D - objects more feature-parity with regular Axes objects. - Significant revisions to the documentation as well. - - BVR - -2011-07-07 Added compatibility with IPython strategy for picking - a version of Qt4 support, and an rcParam for making - the choice explicitly: backend.qt4. - EF - -2011-07-07 Modified AutoMinorLocator to improve automatic choice of - the number of minor intervals per major interval, and - to allow one to specify this number via a kwarg. - EF - -2011-06-28 3D versions of scatter, plot, plot_wireframe, plot_surface, - bar3d, and some other functions now support empty inputs. - BVR - -2011-06-22 Add set_theta_offset, set_theta_direction and - set_theta_zero_location to polar axes to control the - location of 0 and directionality of theta. - MGD - -2011-06-22 Add axes.labelweight parameter to set font weight to axis - labels - MGD. - -2011-06-20 Add pause function to pyplot. - EF - -2011-06-16 Added *bottom* keyword parameter for the stem command. - Also, implemented a legend handler for the stem plot. - - JJL - -2011-06-16 Added legend.frameon rcParams. - Mike Kaufman - -2011-05-31 Made backend_qt4 compatible with PySide . - Gerald Storer - -2011-04-17 Disable keyboard auto-repeat in qt4 backend by ignoring - key events resulting from auto-repeat. This makes - constrained zoom/pan work. - EF - -2011-04-14 interpolation="nearest" always interpolate images. A new - mode "none" is introduced for no interpolation - JJL - -2011-04-03 Fixed broken pick interface to AsteriskCollection objects - used by scatter. - EF - -2011-04-01 The plot directive Sphinx extension now supports all of the - features in the Numpy fork of that extension. These - include doctest formatting, an 'include-source' option, and - a number of new configuration options. - MGD - -2011-03-29 Wrapped ViewVCCachedServer definition in a factory function. - This class now inherits from urllib2.HTTPSHandler in order - to fetch data from github, but HTTPSHandler is not defined - if python was built without SSL support. - DSD - -2011-03-10 Update pytz version to 2011c, thanks to Simon Cross. - JKS - -2011-03-06 Add standalone tests.py test runner script. - JKS - -2011-03-06 Set edgecolor to 'face' for scatter asterisk-type - symbols; this fixes a bug in which these symbols were - not responding to the c kwarg. The symbols have no - face area, so only the edgecolor is visible. - EF - -2011-02-27 Support libpng version 1.5.x; suggestion by Michael - Albert. Changed installation specification to a - minimum of libpng version 1.2. - EF - -2011-02-20 clabel accepts a callable as an fmt kwarg; modified - patch by Daniel Hyams. - EF - -2011-02-18 scatter([], []) is now valid. Also fixed issues - with empty collections - BVR - -2011-02-07 Quick workaround for dviread bug #3175113 - JKS - -2011-02-05 Add cbook memory monitoring for Windows, using - tasklist. - EF - -2011-02-05 Speed up Normalize and LogNorm by using in-place - operations and by using float32 for float32 inputs - and for ints of 2 bytes or shorter; based on - patch by Christoph Gohlke. - EF - -2011-02-04 Changed imshow to use rgba as uint8 from start to - finish, instead of going through an intermediate - step as double precision; thanks to Christoph Gohlke. - EF - -2011-01-13 Added zdir and offset arguments to contourf3d to - bring contourf3d in feature parity with contour3d. - BVR - -2011-01-04 Tag 1.0.1 for release at r8896 - -2011-01-03 Added display of ticker offset to 3d plots. - BVR - -2011-01-03 Turn off tick labeling on interior subplots for - pyplots.subplots when sharex/sharey is True. - JDH - -2010-12-29 Implement axes_divider.HBox and VBox. -JJL - - -2010-11-22 Fixed error with Hammer projection. - BVR - -2010-11-12 Fixed the placement and angle of axis labels in 3D plots. - BVR - -2010-11-07 New rc parameters examples.download and examples.directory - allow bypassing the download mechanism in get_sample_data. - - JKS - -2010-10-04 Fix JPEG saving bug: only accept the kwargs documented - by PIL for JPEG files. - JKS - -2010-09-15 Remove unused _wxagg extension and numerix.h. - EF - -2010-08-25 Add new framework for doing animations with examples.- RM - -2010-08-21 Remove unused and inappropriate methods from Tick classes: - set_view_interval, get_minpos, and get_data_interval are - properly found in the Axis class and don't need to be - duplicated in XTick and YTick. - EF - -2010-08-21 Change Axis.set_view_interval() so that when updating an - existing interval, it respects the orientation of that - interval, and can enlarge but not reduce the interval. - This fixes a bug in which Axis.set_ticks would - change the view limits of an inverted axis. Whether - set_ticks should be affecting the viewLim at all remains - an open question. - EF - -2010-08-16 Handle NaN's correctly in path analysis routines. Fixes a - bug where the best location for a legend was not calculated - correctly when the line contains NaNs. - MGD - -2010-08-14 Fix bug in patch alpha handling, and in bar color kwarg - EF - -2010-08-12 Removed all traces of numerix module after 17 months of - deprecation warnings. - EF - -2010-08-05 Added keyword arguments 'thetaunits' and 'runits' for polar - plots. Fixed PolarAxes so that when it set default - Formatters, it marked them as such. Fixed semilogx and - semilogy to no longer blindly reset the ticker information - on the non-log axis. Axes.arrow can now accept unitized - data. - JRE - -2010-08-03 Add support for MPLSETUPCFG variable for custom setup.cfg - filename. Used by sage buildbot to build an mpl w/ no gui - support - JDH - -2010-08-01 Create directory specified by MPLCONFIGDIR if it does - not exist. - ADS - -2010-07-20 Return Qt4's default cursor when leaving the canvas - DSD - -2010-07-06 Tagging for mpl 1.0 at r8502 - - -2010-07-05 Added Ben Root's patch to put 3D plots in arbitrary axes, - allowing you to mix 3d and 2d in different axes/subplots or - to have multiple 3D plots in one figure. See - examples/mplot3d/subplot3d_demo.py - JDH - -2010-07-05 Preferred kwarg names in set_xlim are now 'left' and - 'right'; in set_ylim, 'bottom' and 'top'; original - kwargs are still accepted without complaint. - EF - -2010-07-05 TkAgg and FltkAgg backends are now consistent with other - interactive backends: when used in scripts from the - command line (not from ipython -pylab), show blocks, - and can be called more than once. - EF - -2010-07-02 Modified CXX/WrapPython.h to fix "swab bug" on solaris so - mpl can compile on Solaris with CXX6 in the trunk. Closes - tracker bug 3022815 - JDH - -2010-06-30 Added autoscale convenience method and corresponding - pyplot function for simplified control of autoscaling; - and changed axis, set_xlim, and set_ylim so that by - default, they turn off the autoscaling on the relevent - axis or axes. Therefore one can call set_xlim before - plotting a line, for example, and the limits will be - retained. - EF - -2010-06-20 Added Axes.tick_params and corresponding pyplot function - to control tick and tick label appearance after an Axes - has been created. - EF - -2010-06-09 Allow Axes.grid to control minor gridlines; allow - Axes.grid and Axis.grid to control major and minor - gridlines in the same method call. - EF - -2010-06-06 Change the way we do split/dividend adjustments in - finance.py to handle dividends and fix the zero division bug reported - in sf bug 2949906 and 2123566. Note that volume is not adjusted - because the Yahoo CSV does not distinguish between share - split and dividend adjustments making it near impossible to - get volume adjustement right (unless we want to guess based - on the size of the adjustment or scrape the html tables, - which we don't) - JDH - -2010-06-06 Updated dateutil to 1.5 and pytz to 2010h. - -2010-06-02 Add error_kw kwarg to Axes.bar(). - EF - -2010-06-01 Fix pcolormesh() and QuadMesh to pass on kwargs as - appropriate. - RM - -2010-05-18 Merge mpl_toolkits.gridspec into the main tree. - JJL - -2010-05-04 Improve backend_qt4 so it displays figures with the - correct size - DSD - -2010-04-20 Added generic support for connecting to a timer for events. This - adds TimerBase, TimerGTK, TimerQT, TimerWx, and TimerTk to - the backends and a new_timer() method to each backend's - canvas to allow ease of creating a new timer. - RM - -2010-04-20 Added margins() Axes method and pyplot function. - EF - -2010-04-18 update the axes_grid documentation. -JJL - -2010-04-18 Control MaxNLocator parameters after instantiation, - and via Axes.locator_params method, with corresponding - pyplot function. -EF - -2010-04-18 Control ScalarFormatter offsets directly and via the - Axes.ticklabel_format() method, and add that to pyplot. -EF - -2010-04-16 Add a close_event to the backends. -RM - -2010-04-06 modify axes_grid examples to use axes_grid1 and axisartist. -JJL - -2010-04-06 rebase axes_grid using axes_grid1 and axisartist modules. -JJL - -2010-04-06 axes_grid toolkit is splitted into two separate modules, - axes_grid1 and axisartist. -JJL - -2010-04-05 Speed up import: import pytz only if and when it is - needed. It is not needed if the rc timezone is UTC. - EF - -2010-04-03 Added color kwarg to Axes.hist(), based on work by - Jeff Klukas. - EF - -2010-03-24 refactor colorbar code so that no cla() is necessary when - mappable is changed. -JJL - -2010-03-22 fix incorrect rubber band during the zoom mode when mouse - leaves the axes. -JJL - -2010-03-21 x/y key during the zoom mode only changes the x/y limits. -JJL - -2010-03-20 Added pyplot.sca() function suggested by JJL. - EF - -2010-03-20 Added conditional support for new Tooltip API in gtk backend. - EF - -2010-03-20 Changed plt.fig_subplot() to plt.subplots() after discussion on - list, and changed its API to return axes as a numpy object array - (with control of dimensions via squeeze keyword). FP. - -2010-03-13 Manually brought in commits from branch - - ------------------------------------------------------------------------ - r8191 | leejjoon | 2010-03-13 17:27:57 -0500 (Sat, 13 Mar 2010) | 1 line - - fix the bug that handles for scatter are incorrectly set when dpi!=72. - Thanks to Ray Speth for the bug report. - - -2010-03-03 Manually brought in commits from branch via diff/patch - (svnmerge is broken) - - ------------------------------------------------------------------------ - r8175 | leejjoon | 2010-03-03 10:03:30 -0800 (Wed, 03 Mar 2010) | 1 line - - fix arguments of allow_rasterization.draw_wrapper - ------------------------------------------------------------------------ - r8174 | jdh2358 | 2010-03-03 09:15:58 -0800 (Wed, 03 Mar 2010) | 1 line - - added support for favicon in docs build - ------------------------------------------------------------------------ - r8173 | jdh2358 | 2010-03-03 08:56:16 -0800 (Wed, 03 Mar 2010) | 1 line - - applied Mattias get_bounds patch - ------------------------------------------------------------------------ - r8172 | jdh2358 | 2010-03-03 08:31:42 -0800 (Wed, 03 Mar 2010) | 1 line - - fix svnmerge download instructions - ------------------------------------------------------------------------ - r8171 | jdh2358 | 2010-03-03 07:47:48 -0800 (Wed, 03 Mar 2010) | 1 line - - - -2010-02-25 add annotation_demo3.py that demonstrates new functionality. -JJL - -2010-02-25 refactor Annotation to support arbitrary Transform as xycoords - or textcoords. Also, if a tuple of two coordinates is provided, - they are interpreted as coordinates for each x and y position. - -JJL - -2010-02-24 Added pyplot.fig_subplot(), to create a figure and a group of - subplots in a single call. This offers an easier pattern than - manually making figures and calling add_subplot() multiple times. FP - -2010-02-17 Added Gokhan's and Mattias' customizable keybindings patch - for the toolbar. You can now set the keymap.* properties - in the matplotlibrc file. Newbindings were added for - toggling log scaling on the x-axis. JDH - -2010-02-16 Committed TJ's filled marker patch for - left|right|bottom|top|full filled markers. See - examples/pylab_examples/filledmarker_demo.py. JDH - -2010-02-11 Added 'bootstrap' option to boxplot. This allows bootstrap - estimates of median confidence intervals. Based on an - initial patch by Paul Hobson. - ADS - -2010-02-06 Added setup.cfg "basedirlist" option to override setting - in setupext.py "basedir" dictionary; added "gnu0" - platform requested by Benjamin Drung. - EF - -2010-02-06 Added 'xy' scaling option to EllipseCollection. - EF - -2010-02-03 Made plot_directive use a custom PlotWarning category, so that - warnings can be turned into fatal errors easily if desired. - FP - -2010-01-29 Added draggable method to Legend to allow mouse drag - placement. Thanks Adam Fraser. JDH - -2010-01-25 Fixed a bug reported by Olle Engdegard, when using - histograms with stepfilled and log=True - MM - -2010-01-16 Upgraded CXX to 6.1.1 - JDH - -2009-01-16 Don't create minor ticks on top of existing major - ticks. Patch by Neil Crighton. -ADS - -2009-01-16 Ensure three minor ticks always drawn (SF# 2924245). Patch - by Neil Crighton. -ADS - -2010-01-16 Applied patch by Ian Thomas to fix two contouring - problems: now contourf handles interior masked regions, - and the boundaries of line and filled contours coincide. - EF - -2009-01-11 The color of legend patch follows the rc parameters - axes.facecolor and axes.edgecolor. -JJL - -2009-01-11 adjustable of Axes can be "box-forced" which allow - sharing axes. -JJL - -2009-01-11 Add add_click and pop_click methods in - BlockingContourLabeler. -JJL - - -2010-01-03 Added rcParams['axes.color_cycle'] - EF - -2010-01-03 Added Pierre's qt4 formlayout editor and toolbar button - JDH - -2009-12-31 Add support for using math text as marker symbols (Thanks to tcb) - - MGD - -2009-12-31 Commit a workaround for a regression in PyQt4-4.6.{0,1} - DSD - -2009-12-22 Fix cmap data for gist_earth_r, etc. -JJL - -2009-12-20 spines: put spines in data coordinates, add set_bounds() - call. -ADS - -2009-12-18 Don't limit notch size in boxplot to q1-q3 range, as this - is effectively making the data look better than it is. - ADS - -2009-12-18 mlab.prctile handles even-length data, such that the median - is the mean of the two middle values. - ADS - -2009-12-15 Add raw-image (unsampled) support for the ps backend. - JJL - -2009-12-14 Add patch_artist kwarg to boxplot, but keep old default. - Convert boxplot_demo2.py to use the new patch_artist. - ADS - -2009-12-06 axes_grid: reimplemented AxisArtist with FloatingAxes support. - Added new examples. - JJL - -2009-12-01 Applied Laurent Dufrechou's patch to improve blitting with - the qt4 backend - DSD - -2009-11-13 The pdf backend now allows changing the contents of - a pdf file's information dictionary via PdfPages.infodict. - JKS - -2009-11-12 font_manager.py should no longer cause EINTR on Python 2.6 - (but will on the 2.5 version of subprocess). Also the - fc-list command in that file was fixed so now it should - actually find the list of fontconfig fonts. - JKS - -2009-11-10 Single images, and all images in renderers with - option_image_nocomposite (i.e. agg, macosx and the svg - backend when rcParams['svg.image_noscale'] is True), are - now drawn respecting the zorder relative to other - artists. (Note that there may now be inconsistencies across - backends when more than one image is drawn at varying - zorders, but this change introduces correct behavior for - the backends in which it's easy to do so.) - -2009-10-21 Make AutoDateLocator more configurable by adding options - to control the maximum and minimum number of ticks. Also - add control of the intervals to be used for ticking. This - does not change behavior but opens previously hard-coded - behavior to runtime modification`. - RMM - -2009-10-19 Add "path_effects" support for Text and Patch. See - examples/pylab_examples/patheffect_demo.py -JJL - -2009-10-19 Add "use_clabeltext" option to clabel. If True, clabels - will be created with ClabelText class, which recalculates - rotation angle of the label during the drawing time. -JJL - -2009-10-16 Make AutoDateFormatter actually use any specified - timezone setting.This was only working correctly - when no timezone was specified. - RMM - -2009-09-27 Beginnings of a capability to test the pdf backend. - JKS - -2009-09-27 Add a savefig.extension rcparam to control the default - filename extension used by savefig. - JKS - -=============================================== -2009-09-21 Tagged for release 0.99.1 - -2009-09-20 Fix usetex spacing errors in pdf backend. - JKS - -2009-09-20 Add Sphinx extension to highlight IPython console sessions, - originally authored (I think) by Michael Droetboom. - FP - -2009-09-20 Fix off-by-one error in dviread.Tfm, and additionally protect - against exceptions in case a dvi font is missing some metrics. - JKS - -2009-09-15 Implement draw_text and draw_tex method of backend_base using - the textpath module. Implement draw_tex method of the svg - backend. - JJL - -2009-09-15 Don't fail on AFM files containing floating-point bounding boxes - JKS - -2009-09-13 AxesGrid : add modified version of colorbar. Add colorbar - location howto. - JJL - -2009-09-07 AxesGrid : implemented axisline style. - Added a demo examples/axes_grid/demo_axisline_style.py- JJL - -2009-09-04 Make the textpath class as a separate moduel - (textpath.py). Add support for mathtext and tex.- JJL - -2009-09-01 Added support for Gouraud interpolated triangles. - pcolormesh now accepts shading='gouraud' as an option. - MGD - -2009-08-29 Added matplotlib.testing package, which contains a Nose - plugin and a decorator that lets tests be marked as - KnownFailures - ADS - -2009-08-20 Added scaled dict to AutoDateFormatter for customized - scales - JDH - -2009-08-15 Pyplot interface: the current image is now tracked at the - figure and axes level, addressing tracker item 1656374. - EF - -2009-08-15 Docstrings are now manipulated with decorators defined - in a new module, docstring.py, thanks to Jason Coombs. - EF - -2009-08-14 Add support for image filtering for agg back end. See the example - demo_agg_filter.py. -JJL - -2009-08-09 AnnotationBbox added. Similar to Annotation, but works with - OffsetBox instead of Text. See the example - demo_annotation_box.py. -JJL - -2009-08-07 BboxImage implemented. Two examples, demo_bboximage.py and - demo_ribbon_box.py added. - JJL - -2009-08-07 In an effort to simplify the backend API, all clipping rectangles - and paths are now passed in using GraphicsContext objects, even - on collections and images. Therefore: - - draw_path_collection(self, master_transform, cliprect, clippath, - clippath_trans, paths, all_transforms, offsets, - offsetTrans, facecolors, edgecolors, linewidths, - linestyles, antialiaseds, urls) - - becomes: - - draw_path_collection(self, gc, master_transform, paths, all_transforms, - offsets, offsetTrans, facecolors, edgecolors, - linewidths, linestyles, antialiaseds, urls) - - - - draw_quad_mesh(self, master_transform, cliprect, clippath, - clippath_trans, meshWidth, meshHeight, coordinates, - offsets, offsetTrans, facecolors, antialiased, - showedges) - - becomes: - - draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight, - coordinates, offsets, offsetTrans, facecolors, - antialiased, showedges) - - - - draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None) - - becomes: - - draw_image(self, gc, x, y, im) - - - MGD - -2009-08-06 Tagging the 0.99.0 release at svn r7397 - JDH - - * fixed an alpha colormapping bug posted on sf 2832575 - - * fix typo in axes_divider.py. use nanmin, nanmax in angle_helper.py - (patch by Christoph Gohlke) - - * remove dup gui event in enter/leave events in gtk - - * lots of fixes for os x binaries (Thanks Russell Owen) - - * attach gtk events to mpl events -- fixes sf bug 2816580 - - * applied sf patch 2815064 (middle button events for wx) and - patch 2818092 (resize events for wx) - - * fixed boilerplate.py so it doesn't break the ReST docs. - - * removed a couple of cases of mlab.load - - * fixed rec2csv win32 file handle bug from sf patch 2831018 - - * added two examples from Josh Hemann: examples/pylab_examples/barchart_demo2.py - and examples/pylab_examples/boxplot_demo2.py - - * handled sf bugs 2831556 and 2830525; better bar error messages and - backend driver configs - - * added miktex win32 patch from sf patch 2820194 - - * apply sf patches 2830233 and 2823885 for osx setup and 64 bit; thanks Michiel - -2009-08-04 Made cbook.get_sample_data make use of the ETag and Last-Modified - headers of mod_dav_svn. - JKS - -2009-08-03 Add PathCollection; modify contourf to use complex - paths instead of simple paths with cuts. - EF - - -2009-08-03 Fixed boilerplate.py so it doesn't break the ReST docs. - JKS - -2009-08-03 pylab no longer provides a load and save function. These - are available in matplotlib.mlab, or you can use - numpy.loadtxt and numpy.savetxt for text files, or np.save - and np.load for binary numpy arrays. - JDH - -2009-07-31 Added cbook.get_sample_data for urllib enabled fetching and - cacheing of data needed for examples. See - examples/misc/sample_data_demo.py - JDH - -2009-07-31 Tagging 0.99.0.rc1 at 7314 - MGD - -2009-07-30 Add set_cmap and register_cmap, and improve get_cmap, - to provide convenient handling of user-generated - colormaps. Reorganized _cm and cm modules. - EF - -2009-07-28 Quiver speed improved, thanks to tip by Ray Speth. -EF - -2009-07-27 Simplify argument handling code for plot method. -EF - -2009-07-25 Allow "plot(1, 2, 'r*')" to work. - EF - -2009-07-22 Added an 'interp' keyword to griddata so the faster linear - interpolation method can be chosen. Default is 'nn', so - default behavior (using natural neighbor method) is unchanged (JSW) - -2009-07-22 Improved boilerplate.py so that it generates the correct - signatures for pyplot functions. - JKS - -2009-07-19 Fixed the docstring of Axes.step to reflect the correct - meaning of the kwargs "pre" and "post" - See SF bug - https://sourceforge.net/tracker/index.php?func=detail&aid=2823304&group_id=80706&atid=560720 - - JDH - -2009-07-18 Fix support for hatches without color fills to pdf and svg - backends. Add an example of that to hatch_demo.py. - JKS - -2009-07-17 Removed fossils from swig version of agg backend. - EF - -2009-07-14 initial submission of the annotation guide. -JJL - -2009-07-14 axes_grid : minor improvements in anchored_artists and - inset_locator. -JJL - -2009-07-14 Fix a few bugs in ConnectionStyle algorithms. Add - ConnectionPatch class. -JJL - -2009-07-11 Added a fillstyle Line2D property for half filled markers - -- see examples/pylab_examples/fillstyle_demo.py JDH - -2009-07-08 Attempt to improve performance of qt4 backend, do not call - qApp.processEvents while processing an event. Thanks Ole - Streicher for tracking this down - DSD - -2009-06-24 Add withheader option to mlab.rec2csv and changed - use_mrecords default to False in mlab.csv2rec since this is - partially broken - JDH - -2009-06-24 backend_agg.draw_marker quantizes the main path (as in the - draw_path). - JJL - -2009-06-24 axes_grid: floating axis support added. - JJL - -2009-06-14 Add new command line options to backend_driver.py to support - running only some directories of tests - JKS - -2009-06-13 partial cleanup of mlab and its importation in pylab - EF - -2009-06-13 Introduce a rotation_mode property for the Text artist. See - examples/pylab_examples/demo_text_rotation_mode.py -JJL - -2009-06-07 add support for bz2 files per sf support request 2794556 - - JDH - -2009-06-06 added a properties method to the artist and inspector to - return a dict mapping property name -> value; see sf - feature request 2792183 - JDH - -2009-06-06 added Neil's auto minor tick patch; sf patch #2789713 - JDH - -2009-06-06 do not apply alpha to rgba color conversion if input is - already rgba - JDH - -2009-06-03 axes_grid : Initial check-in of curvelinear grid support. See - examples/axes_grid/demo_curvelinear_grid.py - JJL - -2009-06-01 Add set_color method to Patch - EF - -2009-06-01 Spine is now derived from Patch - ADS - -2009-06-01 use cbook.is_string_like() instead of isinstance() for spines - ADS - -2009-06-01 cla() support for spines - ADS - -2009-06-01 Removed support for gtk < 2.4. - EF - -2009-05-29 Improved the animation_blit_qt4 example, which was a mix - of the object-oriented and pylab interfaces. It is now - strictly object-oriented - DSD - -2009-05-28 Fix axes_grid toolkit to work with spine patch by ADS. - JJL - -2009-05-28 Applied fbianco's patch to handle scroll wheel events in - the qt4 backend - DSD - -2009-05-26 Add support for "axis spines" to have arbitrary location. -ADS - -2009-05-20 Add an empty matplotlibrc to the tests/ directory so that running - tests will use the default set of rcparams rather than the user's - config. - RMM - -2009-05-19 Axis.grid(): allow use of which='major,minor' to have grid - on major and minor ticks. -ADS - -2009-05-18 Make psd(), csd(), and cohere() wrap properly for complex/two-sided - versions, like specgram() (SF #2791686) - RMM - -2009-05-18 Fix the linespacing bug of multiline text (#1239682). See - examples/pylab_examples/multiline.py -JJL - -2009-05-18 Add *annotation_clip* attr. for text.Annotation class. - If True, annotation is only drawn when the annotated point is - inside the axes area. -JJL - -2009-05-17 Fix bug(#2749174) that some properties of minor ticks are - not conserved -JJL - -2009-05-17 applied Michiel's sf patch 2790638 to turn off gtk event - loop in setupext for pygtk>=2.15.10 - JDH - -2009-05-17 applied Michiel's sf patch 2792742 to speed up Cairo and - macosx collections; speedups can be 20x. Also fixes some - bugs in which gc got into inconsistent state - -====================================================================== - -2008-05-17 Release 0.98.5.3 at r7107 from the branch - JDH - -2009-05-13 An optional offset and bbox support in restore_bbox. - Add animation_blit_gtk2.py. -JJL - -2009-05-13 psfrag in backend_ps now uses baseline-alignment - when preview.sty is used ((default is - bottom-alignment). Also, a small api imporvement - in OffsetBox-JJL - -2009-05-13 When the x-coordinate of a line is monotonically - increasing, it is now automatically clipped at - the stage of generating the transformed path in - the draw method; this greatly speeds up zooming and - panning when one is looking at a short segment of - a long time series, for example. - EF - -2009-05-11 aspect=1 in log-log plot gives square decades. -JJL - -2009-05-08 clabel takes new kwarg, rightside_up; if False, labels - will not be flipped to keep them rightside-up. This - allows the use of clabel to make streamfunction arrows, - as requested by Evan Mason. - EF - -2009-05-07 'labelpad' can now be passed when setting x/y labels. This - allows controlling the spacing between the label and its - axis. - RMM - -2009-05-06 print_ps now uses mixed-mode renderer. Axes.draw rasterize - artists whose zorder smaller than rasterization_zorder. - -JJL - -2009-05-06 Per-artist Rasterization, originally by Eric Bruning. -JJ - -2009-05-05 Add an example that shows how to make a plot that updates - using data from another process. Thanks to Robert - Cimrman - RMM - -2009-05-05 Add Axes.get_legend_handles_labels method. - JJL - -2009-05-04 Fix bug that Text.Annotation is still drawn while set to - not visible. - JJL - -2009-05-04 Added TJ's fill_betweenx patch - JDH - -2009-05-02 Added options to plotfile based on question from - Joseph Smidt and patch by Matthias Michler. - EF - - -2009-05-01 Changed add_artist and similar Axes methods to - return their argument. - EF - -2009-04-30 Incorrect eps bbox for landscape mode fixed - JJL - -2009-04-28 Fixed incorrect bbox of eps output when usetex=True. - JJL - -2009-04-24 Changed use of os.open* to instead use subprocess.Popen. - os.popen* are deprecated in 2.6 and are removed in 3.0. - RMM - -2009-04-20 Worked on axes_grid documentation. Added - axes_grid.inset_locator. - JJL - -2009-04-17 Initial check-in of the axes_grid toolkit. - JJL - -2009-04-17 Added a support for bbox_to_anchor in - offsetbox.AnchoredOffsetbox. Improved a documentation. - - JJL - -2009-04-16 Fixed a offsetbox bug that multiline texts are not - correctly aligned. - JJL - -2009-04-16 Fixed a bug in mixed mode renderer that images produced by - an rasterizing backend are placed with incorrect size. - - JJL - -2009-04-14 Added Jonathan Taylor's Reinier Heeres' port of John - Porters' mplot3d to svn trunk. Package in - mpl_toolkits.mplot3d and demo is examples/mplot3d/demo.py. - Thanks Reiner - -2009-04-06 The pdf backend now escapes newlines and linefeeds in strings. - Fixes sf bug #2708559; thanks to Tiago Pereira for the report. - -2009-04-06 texmanager.make_dvi now raises an error if LaTeX failed to - create an output file. Thanks to Joao Luis Silva for reporting - this. - JKS - -2009-04-05 _png.read_png() reads 12 bit PNGs (patch from - Tobias Wood) - ADS - -2009-04-04 Allow log axis scale to clip non-positive values to - small positive value; this is useful for errorbars. - EF - -2009-03-28 Make images handle nan in their array argument. - A helper, cbook.safe_masked_invalid() was added. - EF - -2009-03-25 Make contour and contourf handle nan in their Z argument. - EF - -2009-03-20 Add AuxTransformBox in offsetbox.py to support some transformation. - anchored_text.py example is enhanced and renamed - (anchored_artists.py). - JJL - -2009-03-20 Add "bar" connection style for annotation - JJL - -2009-03-17 Fix bugs in edge color handling by contourf, found - by Jae-Joon Lee. - EF - -2009-03-14 Added 'LightSource' class to colors module for - creating shaded relief maps. shading_example.py - added to illustrate usage. - JSW - -2009-03-11 Ensure wx version >= 2.8; thanks to Sandro Tosi and - Chris Barker. - EF - -2009-03-10 Fix join style bug in pdf. - JKS - -2009-03-07 Add pyplot access to figure number list - EF - -2009-02-28 hashing of FontProperties accounts current rcParams - JJL - -2009-02-28 Prevent double-rendering of shared axis in twinx, twiny - EF - -2009-02-26 Add optional bbox_to_anchor argument for legend class - JJL - -2009-02-26 Support image clipping in pdf backend. - JKS - -2009-02-25 Improve tick location subset choice in FixedLocator. - EF - -2009-02-24 Deprecate numerix, and strip out all but the numpy - part of the code. - EF - -2009-02-21 Improve scatter argument handling; add an early error - message, allow inputs to have more than one dimension. - EF - -2009-02-16 Move plot_directive.py to the installed source tree. Add - support for inline code content - MGD - -2009-02-16 Move mathmpl.py to the installed source tree so it is - available to other projects. - MGD - -2009-02-14 Added the legend title support - JJL - -2009-02-10 Fixed a bug in backend_pdf so it doesn't break when the setting - pdf.use14corefonts=True is used. Added test case in - unit/test_pdf_use14corefonts.py. - NGR - -2009-02-08 Added a new imsave function to image.py and exposed it in - the pyplot interface - GR - -2009-02-04 Some reorgnization of the legend code. anchored_text.py - added as an example. - JJL - -2009-02-04 Add extent keyword arg to hexbin - ADS - -2009-02-04 Fix bug in mathtext related to \dots and \ldots - MGD - -2009-02-03 Change default joinstyle to round - MGD - -2009-02-02 Reduce number of marker XObjects in pdf output - JKS - -2009-02-02 Change default resolution on polar plot to 1 - MGD - -2009-02-02 Avoid malloc errors in ttconv for fonts that don't have - e.g., PostName (a version of Tahoma triggered this) - JKS - -2009-01-30 Remove support for pyExcelerator in exceltools -- use xlwt - instead - JDH - -2009-01-29 Document 'resolution' kwarg for polar plots. Support it - when using pyplot.polar, not just Figure.add_axes. - MGD - -2009-01-29 Rework the nan-handling/clipping/quantizing/simplification - framework so each is an independent part of a pipeline. - Expose the C++-implementation of all of this so it can be - used from all Python backends. Add rcParam - "path.simplify_threshold" to control the threshold of - similarity below which vertices will be removed. - -2009-01-26 Improved tight bbox option of the savefig. - JJL - -2009-01-26 Make curves and NaNs play nice together - MGD - -2009-01-21 Changed the defaults of acorr and xcorr to use - usevlines=True, maxlags=10 and normed=True since these are - the best defaults - -2009-01-19 Fix bug in quiver argument handling. - EF - -2009-01-19 Fix bug in backend_gtk: don't delete nonexistent toolbar. - EF - -2009-01-16 Implement bbox_inches option for savefig. If bbox_inches is - "tight", try to determine the tight bounding box. - JJL - -2009-01-16 Fix bug in is_string_like so it doesn't raise an - unnecessary exception. - EF - -2009-01-16 Fix an infinite recursion in the unit registry when searching - for a converter for a sequence of strings. Add a corresponding - test. - RM - -2009-01-16 Bugfix of C typedef of MPL_Int64 that was failing on - Windows XP 64 bit, as reported by George Goussard on numpy - mailing list. - ADS - -2009-01-16 Added helper function LinearSegmentedColormap.from_list to - facilitate building simple custom colomaps. See - examples/pylab_examples/custom_cmap_fromlist.py - JDH - -2009-01-16 Applied Michiel's patch for macosx backend to fix rounding - bug. Closed sf bug 2508440 - JSW - -2009-01-10 Applied Michiel's hatch patch for macosx backend and - draw_idle patch for qt. Closes sf patched 2497785 and - 2468809 - JDH - -2009-01-10 Fix bug in pan/zoom with log coordinates. - EF - -2009-01-06 Fix bug in setting of dashed negative contours. - EF - -2009-01-06 Be fault tolerant when len(linestyles)>NLev in contour. - MM - -2009-01-06 Added marginals kwarg to hexbin to plot marginal densities - JDH - -2009-01-06 Change user-visible multipage pdf object to PdfPages to - avoid accidents with the file-like PdfFile. - JKS - -2009-01-05 Fix a bug in pdf usetex: allow using non-embedded fonts. - JKS - -2009-01-05 optional use of preview.sty in usetex mode. - JJL - -2009-01-02 Allow multipage pdf files. - JKS - -2008-12-31 Improve pdf usetex by adding support for font effects - (slanting and extending). - JKS - -2008-12-29 Fix a bug in pdf usetex support, which occurred if the same - Type-1 font was used with different encodings, e.g., with - Minion Pro and MnSymbol. - JKS - -2008-12-20 fix the dpi-dependent offset of Shadow. - JJL - -2008-12-20 fix the hatch bug in the pdf backend. minor update - in docs and example - JJL - -2008-12-19 Add axes_locator attribute in Axes. Two examples are added. - - JJL - -2008-12-19 Update Axes.legend documnetation. /api/api_changes.rst is also - updated to describe chages in keyword parameters. - Issue a warning if old keyword parameters are used. - JJL - -2008-12-18 add new arrow style, a line + filled triangles. -JJL - -================================================================== -2008-12-18 Re-Released 0.98.5.2 from v0_98_5_maint at r6679 - Released 0.98.5.2 from v0_98_5_maint at r6667 - -2008-12-18 Removed configobj, experimental traits and doc/mpl_data link - JDH - -2008-12-18 Fix bug where a line with NULL data limits prevents - subsequent data limits from calculating correctly - MGD - -2008-12-17 Major documentation generator changes - MGD - -2008-12-17 Applied macosx backend patch with support for path - collections, quadmesh, etc... - JDH - -2008-12-17 fix dpi-dependent behavior of text bbox and arrow in annotate - -JJL - -2008-12-17 Add group id support in artist. Two examples which - demostrate svg filter are added. -JJL - -2008-12-16 Another attempt to fix dpi-dependent behavior of Legend. -JJL - -2008-12-16 Fixed dpi-dependent behavior of Legend and fancybox in Text. - -2008-12-16 Added markevery property to Line2D to support subsampling - of markers - JDH -2008-12-15 Removed mpl_data symlink in docs. On platforms that do not - support symlinks, these become copies, and the font files - are large, so the distro becomes unneccessarily bloaded. - Keeping the mpl_examples dir because relative links are - harder for the plot directive and the *.py files are not so - large. - JDH - -2008-12-15 Fix \$ in non-math text with usetex off. Document - differences between usetex on/off - MGD - -2008-12-15 Fix anti-aliasing when auto-snapping - MGD - -2008-12-15 Fix grid lines not moving correctly during pan and zoom - MGD - -2008-12-12 Preparations to eliminate maskedarray rcParams key: its - use will now generate a warning. Similarly, importing - the obsolote numerix.npyma will generate a warning. - EF - -2008-12-12 Added support for the numpy.histogram() weights parameter - to the axes hist() method. Docs taken from numpy - MM - -2008-12-12 Fixed warning in hist() with numpy 1.2 - MM - -2008-12-12 Removed external packages: configobj and enthought.traits - which are only required by the experimental traited config - and are somewhat out of date. If needed, install them - independently, see: - - http://code.enthought.com/projects/traits - - and: - - http://www.voidspace.org.uk/python/configobj.html - -2008-12-12 Added support to asign labels to histograms of multiple - data. - MM - -================================================================= -2008-12-11 Released 0.98.5 at svn r6573 - -2008-12-11 Use subprocess.Popen instead of os.popen in dviread - (Windows problem reported by Jorgen Stenarson) - JKS - -2008-12-10 Added Michael's font_manager fix and Jae-Joon's - figure/subplot fix. Bumped version number to 0.98.5 - JDH - -================================================================= -2008-12-09 Released 0.98.4 at svn r6536 - -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 - 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 - difficult to use some of the interactive doc helpers, e.g., - setp and getp. Having all the rest markup in the ipython - shell also confused the docstrings. I added a new rc param - docstring.harcopy, to format the docstrings differently for - hardcopy and other use. Ther ArtistInspector could use a - little refactoring now since there is duplication of effort - between the rest out put and the non-rest output - JDH - -2008-12-08 Updated spectral methods (psd, csd, etc.) to scale one-sided - densities by a factor of 2 and, optionally, scale all densities - by the sampling frequency. This gives better MatLab - compatibility. -RM - -2008-12-08 Fixed alignment of ticks in colorbars. -MGD - -2008-12-07 drop the deprecated "new" keyword of np.histogram() for - numpy 1.2 or later. -JJL - -2008-12-06 Fixed a bug in svg backend that new_figure_manager() - ignores keywords arguments such as figsize, etc. -JJL - -2008-12-05 Fixed a bug that the handlelength of the new legend class - set too short when numpoints=1 -JJL - -2008-12-04 Added support for data with units (e.g., dates) to - Axes.fill_between. -RM - -2008-12-04 Added fancybox keyword to legend. Also applied some changes - for better look, including baseline adjustment of the - multiline texts so that it is center aligned. -JJL - -2008-12-02 The transmuter classes in the patches.py are reorganized as - subclasses of the Style classes. A few more box and arrow - styles are added. -JJL - -2008-12-02 Fixed a bug in the new legend class that didn't allowed - a tuple of coordinate vlaues as loc. -JJL - -2008-12-02 Improve checks for external dependencies, using subprocess - (instead of deprecated popen*) and distutils (for version - checking) - DSD - -2008-11-30 Reimplementaion of the legend which supports baseline alignement, - multi-column, and expand mode. - JJL - -2008-12-01 Fixed histogram autoscaling bug when bins or range are given - explicitly (fixes Debian bug 503148) - MM - -2008-11-25 Added rcParam axes.unicode_minus which allows plain hypen - for minus when False - JDH - -2008-11-25 Added scatterpoints support in Legend. patch by Erik - Tollerud - JJL - -2008-11-24 Fix crash in log ticking. - MGD - -2008-11-20 Added static helper method BrokenHBarCollection.span_where - and Axes/pyplot method fill_between. See - examples/pylab/fill_between.py - JDH - -2008-11-12 Add x_isdata and y_isdata attributes to Artist instances, - and use them to determine whether either or both - coordinates are used when updating dataLim. This is - used to fix autoscaling problems that had been triggered - by axhline, axhspan, axvline, axvspan. - EF - -2008-11-11 Update the psd(), csd(), cohere(), and specgram() methods - of Axes and the csd() cohere(), and specgram() functions - in mlab to be in sync with the changes to psd(). - In fact, under the hood, these all call the same core - to do computations. - RM - -2008-11-11 Add 'pad_to' and 'sides' parameters to mlab.psd() to - allow controlling of zero padding and returning of - negative frequency components, respecitively. These are - added in a way that does not change the API. - RM - -2008-11-10 Fix handling of c kwarg by scatter; generalize - is_string_like to accept numpy and numpy.ma string - array scalars. - RM and EF - -2008-11-09 Fix a possible EINTR problem in dviread, which might help - when saving pdf files from the qt backend. - JKS - -2008-11-05 Fix bug with zoom to rectangle and twin axes - MGD - -2008-10-24 Added Jae Joon's fancy arrow, box and annotation - enhancements -- see - examples/pylab_examples/annotation_demo2.py - -2008-10-23 Autoscaling is now supported with shared axes - EF - -2008-10-23 Fixed exception in dviread that happened with Minion - JKS - -2008-10-21 set_xlim, ylim now return a copy of the viewlim array to - avoid modify inplace surprises - -2008-10-20 Added image thumbnail generating function - matplotlib.image.thumbnail. See - examples/misc/image_thumbnail.py - JDH - -2008-10-20 Applied scatleg patch based on ideas and work by Erik - Tollerud and Jae-Joon Lee. - MM - -2008-10-11 Fixed bug in pdf backend: if you pass a file object for - output instead of a filename, e.g., in a wep app, we now - flush the object at the end. - JKS - -2008-10-08 Add path simplification support to paths with gaps. - EF - -2008-10-05 Fix problem with AFM files that don't specify the font's - full name or family name. - JKS - -2008-10-04 Added 'scilimits' kwarg to Axes.ticklabel_format() method, - for easy access to the set_powerlimits method of the - major ScalarFormatter. - EF - -2008-10-04 Experimental new kwarg borderpad to replace pad in legend, - based on suggestion by Jae-Joon Lee. - EF - -2008-09-27 Allow spy to ignore zero values in sparse arrays, based - on patch by Tony Yu. Also fixed plot to handle empty - data arrays, and fixed handling of markers in figlegend. - EF - -2008-09-24 Introduce drawstyles for lines. Transparently split linestyles - like 'steps--' into drawstyle 'steps' and linestyle '--'. - Legends always use drawstyle 'default'. - MM - -2008-09-18 Fixed quiver and quiverkey bugs (failure to scale properly - when resizing) and added additional methods for determining - the arrow angles - EF - -2008-09-18 Fix polar interpolation to handle negative values of theta - MGD - -2008-09-14 Reorganized cbook and mlab methods related to numerical - calculations that have little to do with the goals of those two - modules into a separate module numerical_methods.py - Also, added ability to select points and stop point selection - with keyboard in ginput and manual contour labeling code. - Finally, fixed contour labeling bug. - DMK - -2008-09-11 Fix backtick in Postscript output. - MGD - -2008-09-10 [ 2089958 ] Path simplification for vector output backends - Leverage the simplification code exposed through - path_to_polygons to simplify certain well-behaved paths in - the vector backends (PDF, PS and SVG). "path.simplify" - must be set to True in matplotlibrc for this to work. - - MGD - -2008-09-10 Add "filled" kwarg to Path.intersects_path and - Path.intersects_bbox. - MGD - -2008-09-07 Changed full arrows slightly to avoid an xpdf rendering - problem reported by Friedrich Hagedorn. - JKS - -2008-09-07 Fix conversion of quadratic to cubic Bezier curves in PDF - and PS backends. Patch by Jae-Joon Lee. - JKS - -2008-09-06 Added 5-point star marker to plot command - EF - -2008-09-05 Fix hatching in PS backend - MGD - -2008-09-03 Fix log with base 2 - MGD - -2008-09-01 Added support for bilinear interpolation in - NonUniformImage; patch by Gregory Lielens. - EF - -2008-08-28 Added support for multiple histograms with data of - different length - MM - -2008-08-28 Fix step plots with log scale - MGD - -2008-08-28 Fix masked arrays with markers in non-Agg backends - MGD - -2008-08-28 Fix clip_on kwarg so it actually works correctly - MGD - -2008-08-25 Fix locale problems in SVG backend - MGD - -2008-08-22 fix quiver so masked values are not plotted - JSW - -2008-08-18 improve interactive pan/zoom in qt4 backend on windows - DSD - -2008-08-11 Fix more bugs in NaN/inf handling. In particular, path simplification - (which does not handle NaNs or infs) will be turned off automatically - when infs or NaNs are present. Also masked arrays are now converted - to arrays with NaNs for consistent handling of masks and NaNs - - MGD and EF - -================================================================= -2008-08-03 Released 0.98.3 at svn r5947 - -2008-08-01 Backported memory leak fixes in _ttconv.cpp - MGD - -2008-07-31 Added masked array support to griddata. - JSW - -2008-07-26 Added optional C and reduce_C_function arguments to - axes.hexbin(). This allows hexbin to accumulate the values - of C based on the x,y coordinates and display in hexagonal - bins. - ADS - -2008-07-24 Deprecated (raise NotImplementedError) all the mlab2 - functions from matplotlib.mlab out of concern that some of - them were not clean room implementations. JDH - -2008-07-24 Rewrite of a significant portion of the clabel code (class - ContourLabeler) to improve inlining. - DMK - -2008-07-22 Added Barbs polygon collection (similar to Quiver) for plotting - wind barbs. Added corresponding helpers to Axes and pyplot as - well. (examples/pylab_examples/barb_demo.py shows it off.) - RMM - -2008-07-21 Added scikits.delaunay as matplotlib.delaunay. Added griddata - function in matplotlib.mlab, with example (griddata_demo.py) in - pylab_examples. griddata function will use mpl_toolkits._natgrid - if installed. - JSW - -2008-07-21 Re-introduced offset_copy that works in the context of the - new transforms. - MGD - -2008-07-21 Committed patch by Ryan May to add get_offsets and - set_offsets to Collections base class - EF - -2008-07-21 Changed the "asarray" strategy in image.py so that - colormapping of masked input should work for all - image types (thanks Klaus Zimmerman) - EF - -2008-07-20 Rewrote cbook.delete_masked_points and corresponding - unit test to support rgb color array inputs, datetime - inputs, etc. - EF - -2008-07-20 Renamed unit/axes_unit.py to cbook_unit.py and modified - in accord with Ryan's move of delete_masked_points from - axes to cbook. - EF - -2008-07-18 Check for nan and inf in axes.delete_masked_points(). - This should help hexbin and scatter deal with nans. - ADS - -2008-07-17 Added ability to manually select contour label locations. - Also added a waitforbuttonpress function. - DMK - -2008-07-17 Fix bug with NaNs at end of path (thanks, Andrew Straw for - the report) - MGD - -2008-07-16 Improve error handling in texmanager, thanks to Ian Henry - for reporting - DSD - -2008-07-12 Added support for external backends with the - "module://my_backend" syntax - JDH - -2008-07-11 Fix memory leak related to shared axes. Grouper should - store weak references. - MGD - -2008-07-10 Bugfix: crash displaying fontconfig pattern - MGD - -2008-07-10 Bugfix: [ 2013963 ] update_datalim_bounds in Axes not works - MGD - -2008-07-10 Bugfix: [ 2014183 ] multiple imshow() causes gray edges - MGD - -2008-07-09 Fix rectangular axes patch on polar plots bug - MGD - -2008-07-09 Improve mathtext radical rendering - MGD - -2008-07-08 Improve mathtext superscript placement - MGD - -2008-07-07 Fix custom scales in pcolormesh (thanks Matthew Turk) - MGD - -2008-07-03 Implemented findobj method for artist and pyplot - see - examples/pylab_examples/findobj_demo.py - JDH - -2008-06-30 Another attempt to fix TextWithDash - DSD - -2008-06-30 Removed Qt4 NavigationToolbar2.destroy -- it appears to - have been unnecessary and caused a bug reported by P. - Raybaut - DSD - -2008-06-27 Fixed tick positioning bug - MM - -2008-06-27 Fix dashed text bug where text was at the wrong end of the - dash - MGD - -2008-06-26 Fix mathtext bug for expressions like $x_{\leftarrow}$ - MGD - -2008-06-26 Fix direction of horizontal/vertical hatches - MGD - -2008-06-25 Figure.figurePatch renamed Figure.patch, Axes.axesPatch - renamed Axes.patch, Axes.axesFrame renamed Axes.frame, - Axes.get_frame, which returns Axes.patch, is deprecated. - Examples and users guide updated - JDH - -2008-06-25 Fix rendering quality of pcolor - MGD - -================================================================= -2008-06-24 Released 0.98.2 at svn r5667 - (source only for debian) JDH - -2008-06-24 Added "transparent" kwarg to savefig. - MGD - -2008-06-24 Applied Stefan's patch to draw a single centered marker over - a line with numpoints==1 - JDH - -2008-06-23 Use splines to render circles in scatter plots - MGD - -=============================================================== -2008-06-22 Released 0.98.1 at revision 5637 - -2008-06-22 Removed axes3d support and replaced it with a - NotImplementedError for one release cycle - -2008-06-21 fix marker placement bug in backend_ps - DSD - -2008-06-20 [ 1978629 ] scale documentation missing/incorrect for log - MGD - -2008-06-20 Added closed kwarg to PolyCollection. Fixes bug [ 1994535 - ] still missing lines on graph with svn (r 5548). - MGD - -2008-06-20 Added set/get_closed method to Polygon; fixes error - in hist - MM - -2008-06-19 Use relative font sizes (e.g., 'medium' and 'large') in - rcsetup.py and matplotlibrc.template so that text will - be scaled by default when changing rcParams['font.size'] - - EF - -2008-06-17 Add a generic PatchCollection class that can contain any - kind of patch. - MGD - -2008-06-13 Change pie chart label alignment to avoid having labels - overwrite the pie - MGD - -2008-06-12 Added some helper functions to the mathtext parser to - return bitmap arrays or write pngs to make it easier to use - mathtext outside the context of an mpl figure. modified - the mathpng sphinxext to use the mathtext png save - functionality - see examples/api/mathtext_asarray.py - JDH - -2008-06-11 Use matplotlib.mathtext to render math expressions in - online docs - MGD - -2008-06-11 Move PNG loading/saving to its own extension module, and - remove duplicate code in _backend_agg.cpp and _image.cpp - that does the same thing - MGD - -2008-06-11 Numerous mathtext bugfixes, primarily related to - dpi-independence - MGD - -2008-06-10 Bar now applies the label only to the first patch only, and - sets '_nolegend_' for the other patch labels. This lets - autolegend work as expected for hist and bar - see - https://sourceforge.net/tracker/index.php?func=detail&aid=1986597&group_id=80706&atid=560720 - JDH - -2008-06-10 Fix text baseline alignment bug. [ 1985420 ] Repair of - baseline alignment in Text._get_layout. Thanks Stan West - - MGD - -2008-06-09 Committed Gregor's image resample patch to downsampling - images with new rcparam image.resample - JDH - -2008-06-09 Don't install Enthought.Traits along with matplotlib. For - matplotlib developers convenience, it can still be - installed by setting an option in setup.cfg while we figure - decide if there is a future for the traited config - DSD - -2008-06-09 Added range keyword arg to hist() - MM - -2008-06-07 Moved list of backends to rcsetup.py; made use of lower - case for backend names consistent; use validate_backend - when importing backends subpackage - EF - -2008-06-06 hist() revision, applied ideas proposed by Erik Tollerud and - Olle Engdegard: make histtype='step' unfilled by default - and introduce histtype='stepfilled'; use default color - cycle; introduce reverse cumulative histogram; new align - keyword - MM - -2008-06-06 Fix closed polygon patch and also provide the option to - not close the polygon - MGD - -2008-06-05 Fix some dpi-changing-related problems with PolyCollection, - as called by Axes.scatter() - MGD - -2008-06-05 Fix image drawing so there is no extra space to the right - or bottom - MGD - -2006-06-04 Added a figure title command suptitle as a Figure method - and pyplot command -- see examples/figure_title.py - JDH - -2008-06-02 Added support for log to hist with histtype='step' and fixed - a bug for log-scale stacked histograms - MM - -=============================================================== -2008-05-29 Released 0.98.0 at revision 5314 - -2008-05-29 matplotlib.image.imread now no longer always returns RGBA - -- if the image is luminance or RGB, it will return a MxN - or MxNx3 array if possible. Also uint8 is no longer always - forced to float. - -2008-05-29 Implement path clipping in PS backend - JDH - -2008-05-29 Fixed two bugs in texmanager.py: - improved comparison of dvipng versions - fixed a bug introduced when get_grey method was added - - DSD - -2008-05-28 Fix crashing of PDFs in xpdf and ghostscript when two-byte - characters are used with Type 3 fonts - MGD - -2008-05-28 Allow keyword args to configure widget properties as - requested in - http://sourceforge.net/tracker/index.php?func=detail&aid=1866207&group_id=80706&atid=560722 - - JDH - -2008-05-28 Replaced '-' with u'\u2212' for minus sign as requested in - http://sourceforge.net/tracker/index.php?func=detail&aid=1962574&group_id=80706&atid=560720 - -2008-05-28 zero width/height Rectangles no longer influence the - autoscaler. Useful for log histograms with empty bins - - JDH - -2008-05-28 Fix rendering of composite glyphs in Type 3 conversion - (particularly as evidenced in the Eunjin.ttf Korean font) - Thanks Jae-Joon Lee for finding this! - -2008-05-27 Rewrote the cm.ScalarMappable callback infrastructure to - use cbook.CallbackRegistry rather than custom callback - handling. Amy users of add_observer/notify of the - cm.ScalarMappable should uae the - cm.ScalarMappable.callbacksSM CallbackRegistry instead. JDH - -2008-05-27 Fix TkAgg build on Ubuntu 8.04 (and hopefully a more - general solution for other platforms, too.) - -2008-05-24 Added PIL support for loading images to imread (if PIL is - available) - JDH - -2008-05-23 Provided a function and a method for controlling the - plot color cycle. - EF - -2008-05-23 Major revision of hist(). Can handle 2D arrays and create - stacked histogram plots; keyword 'width' deprecated and - rwidth (relative width) introduced; align='edge' changed - to center of bin - MM - -2008-05-22 Added support for ReST-based doumentation using Sphinx. - Documents are located in doc/, and are broken up into - a users guide and an API reference. To build, run the - make.py files. Sphinx-0.4 is needed to build generate xml, - which will be useful for rendering equations with mathml, - use sphinx from svn until 0.4 is released - DSD - -2008-05-21 Fix segfault in TkAgg backend - MGD - -2008-05-21 Fix a "local variable unreferenced" bug in plotfile - MM - -2008-05-19 Fix crash when Windows can not access the registry to - determine font path [Bug 1966974, thanks Patrik Simons] - MGD - -2008-05-16 removed some unneeded code w/ the python 2.4 requirement. - cbook no longer provides compatibility for reversed, - enumerate, set or izip. removed lib/subprocess, mpl1, - sandbox/units, and the swig code. This stuff should remain - on the maintenance branch for archival purposes. JDH - -2008-05-16 Reorganized examples dir - JDH - -2008-05-16 Added 'elinewidth' keyword arg to errorbar, based on patch - by Christopher Brown - MM - -2008-05-16 Added 'cumulative' keyword arg to hist to plot cumulative - histograms. For normed hists, this is normalized to one - MM - -2008-05-15 Fix Tk backend segfault on some machines - MGD - -2008-05-14 Don't use stat on Windows (fixes font embedding problem) - MGD - -2008-05-09 Fix /singlequote (') in Postscript backend - MGD - -2008-05-08 Fix kerning in SVG when embedding character outlines - MGD - -2008-05-07 Switched to future numpy histogram semantic in hist - MM - -2008-05-06 Fix strange colors when blitting in QtAgg and Qt4Agg - MGD - -2008-05-05 pass notify_axes_change to the figure's add_axobserver - in the qt backends, like we do for the other backends. - Thanks Glenn Jones for the report - DSD - -2008-05-02 Added step histograms, based on patch by Erik Tollerud. - MM - -2008-05-02 On PyQt <= 3.14 there is no way to determine the underlying - Qt version. [1851364] - MGD - -2008-05-02 Don't call sys.exit() when pyemf is not found [1924199] - - MGD - -2008-05-02 Update _subprocess.c from upstream Python 2.5.2 to get a - few memory and reference-counting-related bugfixes. See - bug 1949978. - MGD - -2008-04-30 Added some record array editing widgets for gtk -- see - examples/rec_edit*.py - JDH - -2008-04-29 Fix bug in mlab.sqrtm - MM - -2008-04-28 Fix bug in SVG text with Mozilla-based viewers (the symbol - tag is not supported) - MGD - -2008-04-27 Applied patch by Michiel de Hoon to add hexbin - axes method and pyplot function - EF - -2008-04-25 Enforce python >= 2.4; remove subprocess build - EF - -2008-04-25 Enforce the numpy requirement at build time - JDH - -2008-04-24 Make numpy 1.1 and python 2.3 required when importing - matplotlib - EF - -2008-04-24 Fix compilation issues on VS2003 (Thanks Martin Spacek for - all the help) - MGD - -2008-04-24 Fix sub/superscripts when the size of the font has been - changed - MGD - -2008-04-22 Use "svg.embed_char_paths" consistently everywhere - MGD - -2008-04-20 Add support to MaxNLocator for symmetric axis autoscaling. - EF - -2008-04-20 Fix double-zoom bug. - MM - -2008-04-15 Speed up color mapping. - EF - -2008-04-12 Speed up zooming and panning of dense images. - EF - -2008-04-11 Fix global font rcParam setting after initialization - time. - MGD - -2008-04-11 Revert commits 5002 and 5031, which were intended to - avoid an unnecessary call to draw(). 5002 broke saving - figures before show(). 5031 fixed the problem created in - 5002, but broke interactive plotting. Unnecessary call to - draw still needs resolution - DSD - -2008-04-07 Improve color validation in rc handling, suggested - by Lev Givon - EF - -2008-04-02 Allow to use both linestyle definition arguments, '-' and - 'solid' etc. in plots/collections - MM - -2008-03-27 Fix saving to Unicode filenames with Agg backend - (other backends appear to already work...) - (Thanks, Christopher Barker) - MGD - -2008-03-26 Fix SVG backend bug that prevents copying and pasting in - Inkscape (thanks Kaushik Ghose) - MGD - -2008-03-24 Removed an unnecessary call to draw() in the backend_qt* - mouseReleaseEvent. Thanks to Ted Drain - DSD - -2008-03-23 Fix a pdf backend bug which sometimes caused the outermost - gsave to not be balanced with a grestore. - JKS - -2008-03-20 Fixed a minor bug in ContourSet._process_linestyles when - len(linestyles)==Nlev - MM - -2008-03-19 Changed ma import statements to "from numpy import ma"; - this should work with past and future versions of - numpy, whereas "import numpy.ma as ma" will work only - with numpy >= 1.05, and "import numerix.npyma as ma" - is obsolete now that maskedarray is replacing the - earlier implementation, as of numpy 1.05. - -2008-03-14 Removed an apparently unnecessary call to - FigureCanvasAgg.draw in backend_qt*agg. Thanks to Ted - Drain - DSD - -2008-03-10 Workaround a bug in backend_qt4agg's blitting due to a - buffer width/bbox width mismatch in _backend_agg's - copy_from_bbox - DSD - -2008-02-29 Fix class Wx toolbar pan and zoom functions (Thanks Jeff - Peery) - MGD - -2008-02-16 Added some new rec array functionality to mlab - (rec_summarize, rec2txt and rec_groupby). See - examples/rec_groupby_demo.py. Thanks to Tim M for rec2txt. - -2008-02-12 Applied Erik Tollerud's span selector patch - JDH - -2008-02-11 Update plotting() doc string to refer to getp/setp. - JKS - -2008-02-10 Fixed a problem with square roots in the pdf backend with - usetex. - JKS - -2008-02-08 Fixed minor __str__ bugs so getp(gca()) works. - JKS - -2008-02-05 Added getters for title, xlabel, ylabel, as requested - by Brandon Kieth - EF - -2008-02-05 Applied Gael's ginput patch and created - examples/ginput_demo.py - JDH - -2008-02-03 Expose interpnames, a list of valid interpolation - methods, as an AxesImage class attribute. - EF - -2008-02-03 Added BoundaryNorm, with examples in colorbar_only.py - and image_masked.py. - EF - -2008-02-03 Force dpi=72 in pdf backend to fix picture size bug. - JKS - -2008-02-01 Fix doubly-included font problem in Postscript backend - MGD - -2008-02-01 Fix reference leak in ft2font Glyph objects. - MGD - -2008-01-31 Don't use unicode strings with usetex by default - DSD - -2008-01-31 Fix text spacing problems in PDF backend with *some* fonts, - such as STIXGeneral. - -2008-01-31 Fix \sqrt with radical number (broken by making [ and ] - work below) - MGD - -2008-01-27 Applied Martin Teichmann's patch to improve the Qt4 - backend. Uses Qt's builtin toolbars and statusbars. - See bug 1828848 - DSD - -2008-01-10 Moved toolkits to mpl_toolkits, made mpl_toolkits - a namespace package - JSWHIT - -2008-01-10 Use setup.cfg to set the default parameters (tkagg, - numpy) when building windows installers - DSD - -2008-01-10 Fix bug displaying [ and ] in mathtext - MGD - -2008-01-10 Fix bug when displaying a tick value offset with scientific - notation. (Manifests itself as a warning that the \times - symbol can not be found). - MGD - -2008-01-10 Use setup.cfg to set the default parameters (tkagg, - numpy) when building windows installers - DSD - -=============================================================== -2008-01-06 Released 0.91.2 at revision 4802 - -2007-12-26 Reduce too-late use of matplotlib.use() to a warning - instead of an exception, for backwards compatibility - EF - -2007-12-25 Fix bug in errorbar, identified by Noriko Minakawa - EF - -2007-12-25 Changed masked array importing to work with the upcoming - numpy 1.05 (now the maskedarray branch) as well as with - earlier versions. - EF - -2007-12-16 rec2csv saves doubles without losing precision. Also, it - does not close filehandles passed in open. - JDH,ADS - -2007-12-13 Moved rec2gtk to matplotlib.toolkits.gtktools and rec2excel - to matplotlib.toolkits.exceltools - JDH - -2007-12-12 Support alpha-blended text in the Agg and Svg backends - - MGD - -2007-12-10 Fix SVG text rendering bug. - MGD - -2007-12-10 Increase accuracy of circle and ellipse drawing by using an - 8-piece bezier approximation, rather than a 4-piece one. - Fix PDF, SVG and Cairo backends so they can draw paths - (meaning ellipses as well). - MGD - -2007-12-07 Issue a warning when drawing an image on a non-linear axis. - MGD - -2007-12-06 let widgets.Cursor initialize to the lower x and y bounds - rather than 0,0, which can cause havoc for dates and other - transforms - DSD - -2007-12-06 updated references to mpl data directories for py2exe - DSD - -2007-12-06 fixed a bug in rcsetup, see bug 1845057 - DSD - -2007-12-05 Fix how fonts are cached to avoid loading the same one multiple times. - (This was a regression since 0.90 caused by the refactoring of - font_manager.py) - MGD - -2007-12-05 Support arbitrary rotation of usetex text in Agg backend. - MGD - -2007-12-04 Support '|' as a character in mathtext - MGD - -=============================================================== -2007-11-27 Released 0.91.1 at revision 4517 - -=============================================================== -2007-11-27 Released 0.91.0 at revision 4478 - -2007-11-13 All backends now support writing to a file-like object, not - just a regular file. savefig() can be passed a file-like - object in place of a file path. - MGD - -2007-11-13 Improved the default backend selection at build time: - SVG -> Agg -> TkAgg -> WXAgg -> GTK -> GTKAgg. The last usable - backend in this progression will be chosen in the default - config file. If a backend is defined in setup.cfg, that will - be the default backend - DSD - -2007-11-13 Improved creation of default config files at build time for - traited config package - DSD - -2007-11-12 Exposed all the build options in setup.cfg. These options are - read into a dict called "options" by setupext.py. Also, added - "-mpl" tags to the version strings for packages provided by - matplotlib. Versions provided by mpl will be identified and - updated on subsequent installs - DSD - -2007-11-12 Added support for STIX fonts. A new rcParam, - mathtext.fontset, can be used to choose between: - - 'cm': - The TeX/LaTeX Computer Modern fonts - - 'stix': - The STIX fonts (see stixfonts.org) - - 'stixsans': - The STIX fonts, using sans-serif glyphs by default - - 'custom': - A generic Unicode font, in which case the mathtext font - must be specified using mathtext.bf, mathtext.it, - mathtext.sf etc. - - Added a new example, stix_fonts_demo.py to show how to access - different fonts and unusual symbols. - - - MGD - -2007-11-12 Options to disable building backend extension modules moved - from setup.py to setup.cfg - DSD - -2007-11-09 Applied Martin Teichmann's patch 1828813: a QPainter is used in - paintEvent, which has to be destroyed using the method end(). If - matplotlib raises an exception before the call to end - and it - does if you feed it with bad data - this method end() is never - called and Qt4 will start spitting error messages - -2007-11-09 Moved pyparsing back into matplotlib namespace. Don't use - system pyparsing, API is too variable from one release - to the next - DSD - -2007-11-08 Made pylab use straight numpy instead of oldnumeric - by default - EF - -2007-11-08 Added additional record array utilites to mlab (rec2excel, - rec2gtk, rec_join, rec_append_field, rec_drop_field) - JDH - -2007-11-08 Updated pytz to version 2007g - DSD - -2007-11-08 Updated pyparsing to version 1.4.8 - DSD - -2007-11-08 Moved csv2rec to recutils and added other record array - utilities - JDH - -2007-11-08 If available, use existing pyparsing installation - DSD - -2007-11-07 Removed old enthought.traits from lib/matplotlib, added - Gael Varoquaux's enthought.traits-2.6b1, which is stripped - of setuptools. The package is installed to site-packages - if not already available - DSD - -2007-11-05 Added easy access to minor tick properties; slight mod - of patch by Pierre G-M - EF - -2007-11-02 Commited Phil Thompson's patch 1599876, fixes to Qt4Agg - backend and qt4 blitting demo - DSD - -2007-11-02 Commited Phil Thompson's patch 1599876, fixes to Qt4Agg - backend and qt4 blitting demo - DSD - -2007-10-31 Made log color scale easier to use with contourf; - automatic level generation now works. - EF - -2007-10-29 TRANSFORMS REFACTORING - - The primary goal of this refactoring was to make it easier - to extend matplotlib to support new kinds of projections. - This is primarily an internal improvement, and the possible - user-visible changes it allows are yet to come. - - The transformation framework was completely rewritten in - Python (with Numpy). This will make it easier to add news - kinds of transformations without writing C/C++ code. - - Transforms are composed into a 'transform tree', made of - transforms whose value depends on other transforms (their - children). When the contents of children change, their - parents are automatically updated to reflect those changes. - To do this an "invalidation" method is used: when children - change, all of their ancestors are marked as "invalid". - When the value of a transform is accessed at a later time, - its value is recomputed only if it is invalid, otherwise a - cached value may be used. This prevents unnecessary - recomputations of transforms, and contributes to better - interactive performance. - - The framework can be used for both affine and non-affine - transformations. However, for speed, we want use the - backend renderers to perform affine transformations - whenever possible. Therefore, it is possible to perform - just the affine or non-affine part of a transformation on a - set of data. The affine is always assumed to occur after - the non-affine. For any transform: - - full transform == non-affine + affine - - Much of the drawing has been refactored in terms of - compound paths. Therefore, many methods have been removed - from the backend interface and replaced with a a handful to - draw compound paths. This will make updating the backends - easier, since there is less to update. It also should make - the backends more consistent in terms of functionality. - - User visible changes: - - - POLAR PLOTS: Polar plots are now interactively zoomable, - and the r-axis labels can be interactively rotated. - Straight line segments are now interpolated to follow the - curve of the r-axis. - - - Non-rectangular clipping works in more backends and with - more types of objects. - - - Sharing an axis across figures is now done in exactly - the same way as sharing an axis between two axes in the - same figure: - - fig1 = figure() - fig2 = figure() - - ax1 = fig1.add_subplot(111) - ax2 = fig2.add_subplot(111, sharex=ax1, sharey=ax1) - - - linestyles now include steps-pre, steps-post and - steps-mid. The old step still works and is equivalent to - step-pre. - - - Multiple line styles may be provided to a collection. - - See API_CHANGES for more low-level information about this - refactoring. - -2007-10-24 Added ax kwarg to Figure.colorbar and pyplot.colorbar - EF - -2007-10-19 Removed a gsave/grestore pair surrounding _draw_ps, which - was causing a loss graphics state info (see "EPS output - problem - scatter & edgecolors" on mpl-dev, 2007-10-29) - - DSD - -2007-10-15 Fixed a bug in patches.Ellipse that was broken for - aspect='auto'. Scale free ellipses now work properly for - equal and auto on Agg and PS, and they fall back on a - polygonal approximation for nonlinear transformations until - we convince oursleves that the spline approximation holds - for nonlinear transformations. Added - unit/ellipse_compare.py to compare spline with vertex - approx for both aspects. JDH - -2007-10-05 remove generator expressions from texmanager and mpltraits. - generator expressions are not supported by python-2.3 - DSD - -2007-10-01 Made matplotlib.use() raise an exception if called after - backends has been imported. - EF - -2007-09-30 Modified update* methods of Bbox and Interval so they - work with reversed axes. Prior to this, trying to - set the ticks on a reversed axis failed with an - uninformative error message. - EF - -2007-09-30 Applied patches to axes3d to fix index error problem - EF - -2007-09-24 Applied Eike Welk's patch reported on mpl-dev on 2007-09-22 - Fixes a bug with multiple plot windows in the qt backend, - ported the changes to backend_qt4 as well - DSD - -2007-09-21 Changed cbook.reversed to yield the same result as the - python reversed builtin - DSD - -2007-09-13 The usetex support in the pdf backend is more usable now, - so I am enabling it. - JKS - -2007-09-12 Fixed a Axes.bar unit bug - JDH - -2007-09-10 Made skiprows=1 the default on csv2rec - JDH - -2007-09-09 Split out the plotting part of pylab and put it in - pyplot.py; removed numerix from the remaining pylab.py, - which imports everything from pyplot.py. The intention - is that apart from cleanups, the result of importing - from pylab is nearly unchanged, but there is the - new alternative of importing from pyplot to get - the state-engine graphics without all the numeric - functions. - Numpified examples; deleted two that were obsolete; - modified some to use pyplot. - EF - -2007-09-08 Eliminated gd and paint backends - EF - -2007-09-06 .bmp file format is now longer an alias for .raw - -2007-09-07 Added clip path support to pdf backend. - JKS - -2007-09-06 Fixed a bug in the embedding of Type 1 fonts in PDF. - Now it doesn't crash Preview.app. - JKS - -2007-09-06 Refactored image saving code so that all GUI backends can - save most image types. See FILETYPES for a matrix of - backends and their supported file types. - Backend canvases should no longer write their own print_figure() - method -- instead they should write a print_xxx method for - each filetype they can output and add an entry to their - class-scoped filetypes dictionary. - MGD - -2007-09-05 Fixed Qt version reporting in setupext.py - DSD - -2007-09-04 Embedding Type 1 fonts in PDF, and thus usetex support - via dviread, sort of works. To test, enable it by - renaming _draw_tex to draw_tex. - JKS - -2007-09-03 Added ability of errorbar show limits via caret or - arrowhead ends on the bars; patch by Manual Metz. - EF - -2007-09-03 Created type1font.py, added features to AFM and FT2Font - (see API_CHANGES), started work on embedding Type 1 fonts - in pdf files. - JKS - -2007-09-02 Continued work on dviread.py. - JKS - -2007-08-16 Added a set_extent method to AxesImage, allow data extent - to be modified after initial call to imshow - DSD - -2007-08-14 Fixed a bug in pyqt4 subplots-adjust. Thanks to - Xavier Gnata for the report and suggested fix - DSD - -2007-08-13 Use pickle to cache entire fontManager; change to using - font_manager module-level function findfont wrapper for - the fontManager.findfont method - EF - -2007-08-11 Numpification and cleanup of mlab.py and some examples - EF - -2007-08-06 Removed mathtext2 - -2007-07-31 Refactoring of distutils scripts. - - Will not fail on the entire build if an optional Python - package (e.g., Tkinter) is installed but its development - headers are not (e.g., tk-devel). Instead, it will - continue to build all other extensions. - - Provide an overview at the top of the output to display - what dependencies and their versions were found, and (by - extension) what will be built. - - Use pkg-config, when available, to find freetype2, since - this was broken on Mac OS-X when using MacPorts in a non- - standard location. - -2007-07-30 Reorganized configuration code to work with traited config - objects. The new config system is located in the - matplotlib.config package, but it is disabled by default. - To enable it, set NEWCONFIG=True in matplotlib.__init__.py. - The new configuration system will still use the old - matplotlibrc files by default. To switch to the experimental, - traited configuration, set USE_TRAITED_CONFIG=True in - config.__init__.py. - -2007-07-29 Changed default pcolor shading to flat; added aliases - to make collection kwargs agree with setter names, so - updating works; related minor cleanups. - Removed quiver_classic, scatter_classic, pcolor_classic. - EF - -2007-07-26 Major rewrite of mathtext.py, using the TeX box layout model. - - There is one (known) backward incompatible change. The - font commands (\cal, \rm, \it, \tt) now behave as TeX does: - they are in effect until the next font change command or - the end of the grouping. Therefore uses of $\cal{R}$ - should be changed to ${\cal R}$. Alternatively, you may - use the new LaTeX-style font commands (\mathcal, \mathrm, - \mathit, \mathtt) which do affect the following group, - e.g., $\mathcal{R}$. - - Other new features include: - - - Math may be interspersed with non-math text. Any text - with an even number of $'s (non-escaped) will be sent to - the mathtext parser for layout. - - - Sub/superscripts are less likely to accidentally overlap. - - - Support for sub/superscripts in either order, e.g., $x^i_j$ - and $x_j^i$ are equivalent. - - - Double sub/superscripts (e.g., $x_i_j$) are considered - ambiguous and raise an exception. Use braces to disambiguate. - - - $\frac{x}{y}$ can be used for displaying fractions. - - - $\sqrt[3]{x}$ can be used to display the radical symbol - with a root number and body. - - - $\left(\frac{x}{y}\right)$ may be used to create - parentheses and other delimiters that automatically - resize to the height of their contents. - - - Spacing around operators etc. is now generally more like - TeX. - - - Added support (and fonts) for boldface (\bf) and - sans-serif (\sf) symbols. - - - Log-like function name shortcuts are supported. For - example, $\sin(x)$ may be used instead of ${\rm sin}(x)$ - - - Limited use of kerning for the easy case (same font) - - Behind the scenes, the pyparsing.py module used for doing - the math parsing was updated to the latest stable version - (1.4.6). A lot of duplicate code was refactored out of the - Font classes. - - - MGD - -2007-07-19 completed numpification of most trivial cases - NN - -2007-07-19 converted non-numpy relicts throughout the code - NN - -2007-07-19 replaced the Python code in numerix/ by a minimal wrapper around - numpy that explicitly mentions all symbols that need to be - addressed for further numpification - NN - -2007-07-18 make usetex respect changes to rcParams. texmanager used to - only configure itself when it was created, now it - reconfigures when rcParams are changed. Thank you Alexander - Schmolck for contributing a patch - DSD - -2007-07-17 added validation to setting and changing rcParams - DSD - -2007-07-17 bugfix segfault in transforms module. Thanks Ben North for - the patch. - ADS - -2007-07-16 clean up some code in ticker.ScalarFormatter, use unicode to - render multiplication sign in offset ticklabel - DSD - -2007-07-16 fixed a formatting bug in ticker.ScalarFormatter's scientific - notation (10^0 was being rendered as 10 in some cases) - DSD - -2007-07-13 Add MPL_isfinite64() and MPL_isinf64() for testing - doubles in (the now misnamed) MPL_isnan.h. - ADS - -2007-07-13 The matplotlib._isnan module removed (use numpy.isnan) - ADS - -2007-07-13 Some minor cleanups in _transforms.cpp - ADS - -2007-07-13 Removed the rest of the numerix extension code detritus, - numpified axes.py, and cleaned up the imports in axes.py - - JDH - -2007-07-13 Added legend.loc as configurable option that could in - future default to 'best'. - NN - -2007-07-12 Bugfixes in mlab.py to coerce inputs into numpy arrays. -ADS - -2007-07-11 Added linespacing kwarg to text.Text - EF - -2007-07-11 Added code to store font paths in SVG files. - MGD - -2007-07-10 Store subset of TTF font as a Type 3 font in PDF files. - MGD - -2007-07-09 Store subset of TTF font as a Type 3 font in PS files. - MGD - -2007-07-09 Applied Paul's pick restructure pick and add pickers, - sourceforge patch 1749829 - JDH - - -2007-07-09 Applied Allan's draw_lines agg optimization. JDH - - -2007-07-08 Applied Carl Worth's patch to fix cairo draw_arc - SC - -2007-07-07 fixed bug 1712099: xpdf distiller on windows - DSD - -2007-06-30 Applied patches to tkagg, gtk, and wx backends to reduce - memory leakage. Patches supplied by Mike Droettboom; - see tracker numbers 1745400, 1745406, 1745408. - Also made unit/memleak_gui.py more flexible with - command-line options. - EF - -2007-06-30 Split defaultParams into separate file rcdefaults (together with - validation code). Some heavy refactoring was necessary to do so, - but the overall behavior should be the same as before. - NN - -2007-06-27 Added MPLCONFIGDIR for the default location for mpl data - and configuration. useful for some apache installs where - HOME is not writable. Tried to clean up the logic in - _get_config_dir to support non-writable HOME where are - writable HOME/.matplotlib already exists - JDH - -2007-06-27 Fixed locale bug reported at - http://sourceforge.net/tracker/index.php?func=detail&aid=1744154&group_id=80706&atid=560720 - by adding a cbook.unicode_safe function - JDH - -2007-06-27 Applied Micheal's tk savefig bugfix described at - http://sourceforge.net/tracker/index.php?func=detail&aid=1716732&group_id=80706&atid=560720 - Thanks Michael! - - -2007-06-27 Patch for get_py2exe_datafiles() to work with new directory - layout. (Thanks Tocer and also Werner Bruhin.) -ADS - - -2007-06-27 Added a scroll event to the mpl event handling system and - implemented it for backends GTK* -- other backend - users/developers/maintainers, please add support for your - backend. - JDH - -2007-06-25 Changed default to clip=False in colors.Normalize; - modified ColorbarBase for easier colormap display - EF - -2007-06-13 Added maskedarray option to rc, numerix - EF - -2007-06-11 Python 2.5 compatibility fix for mlab.py - EF - -2007-06-10 In matplotlibrc file, use 'dashed' | 'solid' instead - of a pair of floats for contour.negative_linestyle - EF - -2007-06-08 Allow plot and fill fmt string to be any mpl string - colorspec - EF - -2007-06-08 Added gnuplot file plotfile function to pylab -- see - examples/plotfile_demo.py - JDH - -2007-06-07 Disable build of numarray and Numeric extensions for - internal MPL use and the numerix layer. - ADS - -2007-06-07 Added csv2rec to matplotlib.mlab to support automatically - converting csv files to record arrays using type - introspection, and turned on native datetime support using - the new units support in matplotlib.dates. See - examples/loadrec.py ! JDH - -2007-06-07 Simplified internal code of _auto_legend_data - NN - -2007-06-04 Added labeldistance arg to Axes.pie to control the raidal - distance of the wedge labels - JDH - -2007-06-03 Turned mathtext in SVG into single with multiple - objects (easier to edit in inkscape). - NN - -=============================================================== -2007-06-02 Released 0.90.1 at revision 3352 - -2007-06-02 Display only meaningful labels when calling legend() - without args. - NN - -2007-06-02 Have errorbar follow the color cycle even if line is not plotted. - Suppress plotting of errorbar caps for capsize=0. - NN - -2007-06-02 Set markers to same alpha value as line. - NN - -2007-06-02 Fix mathtext position in svg backend. - NN - -2007-06-01 Deprecate Numeric and numarray for use as numerix. Props to - Travis -- job well done. - ADS - -2007-05-18 Added LaTeX unicode support. Enable with the - 'text.latex.unicode' rcParam. This requires the ucs and - inputenc LaTeX packages. - ADS - -2007-04-23 Fixed some problems with polar -- added general polygon - clipping to clip the lines a nd grids to the polar axes. - Added support for set_rmax to easily change the maximum - radial grid. Added support for polar legend - JDH - -2007-04-16 Added Figure.autofmt_xdate to handle adjusting the bottom - and rotating the tick labels for date plots when the ticks - often overlap - JDH - -2007-04-09 Beginnings of usetex support for pdf backend. -JKS - -2007-04-07 Fixed legend/LineCollection bug. Added label support - to collections. - EF - -2007-04-06 Removed deprecated support for a float value as a gray-scale; - now it must be a string, like '0.5'. Added alpha kwarg to - ColorConverter.to_rgba_list. - EF - -2007-04-06 Fixed rotation of ellipses in pdf backend - (sf bug #1690559) -JKS - -2007-04-04 More matshow tweaks; documentation updates; new method - set_bounds() for formatters and locators. - EF - -2007-04-02 Fixed problem with imshow and matshow of integer arrays; - fixed problems with changes to color autoscaling. - EF - -2007-04-01 Made image color autoscaling work correctly with - a tracking colorbar; norm.autoscale now scales - unconditionally, while norm.autoscale_None changes - only None-valued vmin, vmax. - EF - -2007-03-31 Added a qt-based subplot-adjustment dialog - DSD - -2007-03-30 Fixed a bug in backend_qt4, reported on mpl-dev - DSD - -2007-03-26 Removed colorbar_classic from figure.py; fixed bug in - Figure.clf() in which _axobservers was not getting - cleared. Modernization and cleanups. - EF - -2007-03-26 Refactored some of the units support -- units now live in - the respective x and y Axis instances. See also - API_CHANGES for some alterations to the conversion - interface. JDH - -2007-03-25 Fix masked array handling in quiver.py for numpy. (Numeric - and numarray support for masked arrays is broken in other - ways when using quiver. I didn't pursue that.) - ADS - -2007-03-23 Made font_manager.py close opened files. - JKS - -2007-03-22 Made imshow default extent match matshow - EF - -2007-03-22 Some more niceties for xcorr -- a maxlags option, normed - now works for xcorr as well as axorr, usevlines is - supported, and a zero correlation hline is added. See - examples/xcorr_demo.py. Thanks Sameer for the patch. - - JDH - -2007-03-21 Axes.vlines and Axes.hlines now create and returns a - LineCollection, not a list of lines. This is much faster. - The kwarg signature has changed, so consult the docs. - Modified Axes.errorbar which uses vlines and hlines. See - API_CHANGES; the return signature for these three functions - is now different - -2007-03-20 Refactored units support and added new examples - JDH - -2007-03-19 Added Mike's units patch - JDH - -2007-03-18 Matshow as an Axes method; test version matshow1() in - pylab; added 'integer' Boolean kwarg to MaxNLocator - initializer to force ticks at integer locations. - EF - -2007-03-17 Preliminary support for clipping to paths agg - JDH - -2007-03-17 Text.set_text() accepts anything convertible with '%s' - EF - -2007-03-14 Add masked-array support to hist. - EF - -2007-03-03 Change barh to take a kwargs dict and pass it to bar. - Fixes sf bug #1669506. - -2007-03-02 Add rc parameter pdf.inheritcolor, which disables all - color-setting operations in the pdf backend. The idea is - that you include the resulting file in another program and - set the colors (both stroke and fill color) there, so you - can use the same pdf file for e.g., a paper and a - presentation and have them in the surrounding color. You - will probably not want to draw figure and axis frames in - that case, since they would be filled in the same color. - JKS - -2007-02-26 Prevent building _wxagg.so with broken Mac OS X wxPython. - ADS - -2007-02-23 Require setuptools for Python 2.3 - ADS - -2007-02-22 WXAgg accelerator updates - KM - WXAgg's C++ accelerator has been fixed to use the correct wxBitmap - constructor. - - The backend has been updated to use new wxPython functionality to - provide fast blit() animation without the C++ accelerator. This - requires wxPython 2.8 or later. Previous versions of wxPython can - use the C++ acclerator or the old pure Python routines. - - setup.py no longer builds the C++ accelerator when wxPython >= 2.8 - is present. - - The blit() method is now faster regardless of which agg/wxPython - conversion routines are used. - -2007-02-21 Applied the PDF backend patch by Nicolas Grilly. - This impacts several files and directories in matplotlib: - - - Created the directory lib/matplotlib/mpl-data/fonts/pdfcorefonts, - holding AFM files for the 14 PDF core fonts. These fonts are - embedded in every PDF viewing application. - - - setup.py: Added the directory pdfcorefonts to package_data. - - - lib/matplotlib/__init__.py: Added the default parameter - 'pdf.use14corefonts'. When True, the PDF backend uses - only the 14 PDF core fonts. - - - lib/matplotlib/afm.py: Added some keywords found in - recent AFM files. Added a little workaround to handle - Euro symbol. - - - lib/matplotlib/fontmanager.py: Added support for the 14 - PDF core fonts. These fonts have a dedicated cache (file - pdfcorefont.cache), not the same as for other AFM files - (file .afmfont.cache). Also cleaned comments to conform - to CODING_GUIDE. - - - lib/matplotlib/backends/backend_pdf.py: - Added support for 14 PDF core fonts. - Fixed some issues with incorrect character widths and - encodings (works only for the most common encoding, - WinAnsiEncoding, defined by the official PDF Reference). - Removed parameter 'dpi' because it causes alignment issues. - - -JKS (patch by Nicolas Grilly) - -2007-02-17 Changed ft2font.get_charmap, and updated all the files where - get_charmap is mentioned - ES - -2007-02-13 Added barcode demo- JDH - -2007-02-13 Added binary colormap to cm - JDH - -2007-02-13 Added twiny to pylab - JDH - -2007-02-12 Moved data files into lib/matplotlib so that setuptools' - develop mode works. Re-organized the mpl-data layout so - that this source structure is maintained in the - installation. (i.e., the 'fonts' and 'images' - sub-directories are maintained in site-packages.) Suggest - removing site-packages/matplotlib/mpl-data and - ~/.matplotlib/ttffont.cache before installing - ADS - -2007-02-07 Committed Rob Hetland's patch for qt4: remove - references to text()/latin1(), plus some improvements - to the toolbar layout - DSD - -=============================================================== -2007-02-06 Released 0.90.0 at revision 3003 - -2007-01-22 Extended the new picker API to text, patches and patch - collections. Added support for user customizable pick hit - testing and attribute tagging of the PickEvent - Details - and examples in examples/pick_event_demo.py - JDH - -2007-01-16 Begun work on a new pick API using the mpl event handling - frameowrk. Artists will define their own pick method with - a configurable epsilon tolerance and return pick attrs. - All artists that meet the tolerance threshold will fire a - PickEvent with artist dependent attrs; e.g., a Line2D can set - the indices attribute that shows the indices into the line - that are within epsilon of the pick point. See - examples/pick_event_demo.py. The implementation of pick - for the remaining Artists remains to be done, but the core - infrastructure at the level of event handling is in place - with a proof-of-concept implementation for Line2D - JDH - -2007-01-16 src/_image.cpp: update to use Py_ssize_t (for 64-bit systems). - Use return value of fread() to prevent warning messages - SC. - -2007-01-15 src/_image.cpp: combine buffer_argb32() and buffer_bgra32() into - a new method color_conv(format) - SC - -2007-01-14 backend_cairo.py: update draw_arc() so that - examples/arctest.py looks correct - SC - -2007-01-12 backend_cairo.py: enable clipping. Update draw_image() so that - examples/contour_demo.py looks correct - SC - -2007-01-12 backend_cairo.py: fix draw_image() so that examples/image_demo.py - now looks correct - SC - -2007-01-11 Added Axes.xcorr and Axes.acorr to plot the cross - correlation of x vs y or the autocorrelation of x. pylab - wrappers also provided. See examples/xcorr_demo.py - JDH - -2007-01-10 Added "Subplot.label_outer" method. It will set the - visibility of the ticklabels so that yticklabels are only - visible in the first column and xticklabels are only - visible in the last row - JDH - -2007-01-02 Added additional kwarg documentation - JDH - -2006-12-28 Improved error message for nonpositive input to log - transform; added log kwarg to bar, barh, and hist, - and modified bar method to behave sensibly by default - when the ordinate has a log scale. (This only works - if the log scale is set before or by the call to bar, - hence the utility of the log kwarg.) - EF - -2006-12-27 backend_cairo.py: update draw_image() and _draw_mathtext() to work - with numpy - SC - -2006-12-20 Fixed xpdf dependency check, which was failing on windows. - Removed ps2eps dependency check. - DSD - -2006-12-19 Added Tim Leslie's spectral patch - JDH - -2006-12-17 Added rc param 'axes.formatter.limits' to control - the default threshold for switching to scientific - notation. Added convenience method - Axes.ticklabel_format() for turning scientific notation - on or off on either or both axes. - EF - -2006-12-16 Added ability to turn control scientific notation - in ScalarFormatter - EF - -2006-12-16 Enhanced boxplot to handle more flexible inputs - EF - -2006-12-13 Replaced calls to where() in colors.py with much faster - clip() and putmask() calls; removed inappropriate - uses of getmaskorNone (which should be needed only - very rarely); all in response to profiling by - David Cournapeau. Also fixed bugs in my 2-D - array support from 12-09. - EF - -2006-12-09 Replaced spy and spy2 with the new spy that combines - marker and image capabilities - EF - -2006-12-09 Added support for plotting 2-D arrays with plot: - columns are plotted as in Matlab - EF - -2006-12-09 Added linewidth kwarg to bar and barh; fixed arg - checking bugs - EF - -2006-12-07 Made pcolormesh argument handling match pcolor; - fixed kwarg handling problem noted by Pierre GM - EF - -2006-12-06 Made pcolor support vector X and/or Y instead of - requiring 2-D arrays - EF - -2006-12-05 Made the default Artist._transform None (rather than - invoking identity_transform for each artist only to have it - overridden later). Use artist.get_transform() rather than - artist._transform, even in derived classes, so that the - default transform will be created lazily as needed - JDH - -2006-12-03 Added LogNorm to colors.py as illustrated by - examples/pcolor_log.py, based on suggestion by - Jim McDonald. Colorbar modified to handle LogNorm. - Norms have additional "inverse" method. - EF - -2006-12-02 Changed class names in colors.py to match convention: - normalize -> Normalize, no_norm -> NoNorm. Old names - are still available. - Changed __init__.py rc defaults to match those in - matplotlibrc - EF - -2006-11-22 Fixed bug in set_*lim that I had introduced on 11-15 - EF - -2006-11-22 Added examples/clippedline.py, which shows how to clip line - data based on view limits -- it also changes the marker - style when zoomed in - JDH - -2006-11-21 Some spy bug-fixes and added precision arg per Robert C's - suggestion - JDH - -2006-11-19 Added semi-automatic docstring generation detailing all the - kwargs that functions take using the artist introspection - tools; e.g., 'help text now details the scatter kwargs - that control the Text properties - JDH - -2006-11-17 Removed obsolete scatter_classic, leaving a stub to - raise NotImplementedError; same for pcolor_classic - EF - -2006-11-15 Removed obsolete pcolor_classic - EF - -2006-11-15 Fixed 1588908 reported by Russel Owen; factored - nonsingular method out of ticker.py, put it into - transforms.py as a function, and used it in - set_xlim and set_ylim. - EF - -2006-11-14 Applied patch 1591716 by Ulf Larssen to fix a bug in - apply_aspect. Modified and applied patch - 1594894 by mdehoon to fix bugs and improve - formatting in lines.py. Applied patch 1573008 - by Greg Willden to make psd etc. plot full frequency - range for complex inputs. - EF - -2006-11-14 Improved the ability of the colorbar to track - changes in corresponding image, pcolor, or - contourf. - EF - -2006-11-11 Fixed bug that broke Numeric compatibility; - added support for alpha to colorbar. The - alpha information is taken from the mappable - object, not specified as a kwarg. - EF - -2006-11-05 Added broken_barh function for makring a sequence of - horizontal bars broken by gaps -- see examples/broken_barh.py - -2006-11-05 Removed lineprops and markerprops from the Annotation code - and replaced them with an arrow configurable with kwarg - arrowprops. See examples/annotation_demo.py - JDH - -2006-11-02 Fixed a pylab subplot bug that was causing axes to be - deleted with hspace or wspace equals zero in - subplots_adjust - JDH - -2006-10-31 Applied axes3d patch 1587359 - http://sourceforge.net/tracker/index.php?func=detail&aid=1587359&group_id=80706&atid=560722 - JDH - -=============================================================== -2006-10-26 Released 0.87.7 at revision 2835 - -2006-10-25 Made "tiny" kwarg in Locator.nonsingular much smaller - EF - -2006-10-17 Closed sf bug 1562496 update line props dash/solid/cap/join - styles - JDH - -2006-10-17 Complete overhaul of the annotations API and example code - - See matplotlib.text.Annotation and - examples/annotation_demo.py JDH - -2006-10-12 Committed Manuel Metz's StarPolygon code and - examples/scatter_star_poly.py - JDH - - -2006-10-11 commented out all default values in matplotlibrc.template - Default values should generally be taken from defaultParam in - __init__.py - the file matplotlib should only contain those values - that the user wants to explicitly change from the default. - (see thread "marker color handling" on matplotlib-devel) - -2006-10-10 Changed default comment character for load to '#' - JDH - -2006-10-10 deactivated rcfile-configurability of markerfacecolor - and markeredgecolor. Both are now hardcoded to the special value - 'auto' to follow the line color. Configurability at run-time - (using function arguments) remains functional. - NN - -2006-10-07 introduced dummy argument magnification=1.0 to - FigImage.make_image to satisfy unit test figimage_demo.py - The argument is not yet handled correctly, which should only - show up when using non-standard DPI settings in PS backend, - introduced by patch #1562394. - NN - -2006-10-06 add backend-agnostic example: simple3d.py - NN - -2006-09-29 fix line-breaking for SVG-inline images (purely cosmetic) - NN - -2006-09-29 reworked set_linestyle and set_marker - markeredgecolor and markerfacecolor now default to - a special value "auto" that keeps the color in sync with - the line color - further, the intelligence of axes.plot is cleaned up, - improved and simplified. Complete compatibility cannot be - guaranteed, but the new behavior should be much more predictable - (see patch #1104615 for details) - NN - -2006-09-29 changed implementation of clip-path in SVG to work around a - limitation in inkscape - NN - -2006-09-29 added two options to matplotlibrc: - svg.image_inline - svg.image_noscale - see patch #1533010 for details - NN - -2006-09-29 axes.py: cleaned up kwargs checking - NN - -2006-09-29 setup.py: cleaned up setup logic - NN - -2006-09-29 setup.py: check for required pygtk versions, fixes bug #1460783 - SC - -=============================================================== -2006-09-27 Released 0.87.6 at revision 2783 - -2006-09-24 Added line pointers to the Annotation code, and a pylab - interface. See matplotlib.text.Annotation, - examples/annotation_demo.py and - examples/annotation_demo_pylab.py - JDH - -2006-09-18 mathtext2.py: The SVG backend now supports the same things that - the AGG backend does. Fixed some bugs with rendering, and out of - bounds errors in the AGG backend - ES. Changed the return values - of math_parse_s_ft2font_svg to support lines (fractions etc.) - -2006-09-17 Added an Annotation class to facilitate annotating objects - and an examples file examples/annotation_demo.py. I want - to add dash support as in TextWithDash, but haven't decided - yet whether inheriting from TextWithDash is the right base - class or if another approach is needed - JDH - -=============================================================== -2006-09-05 Released 0.87.5 at revision 2761 - -2006-09-04 Added nxutils for some numeric add-on extension code -- - specifically a better/more efficient inside polygon tester (see - unit/inside_poly_*.py) - JDH - -2006-09-04 Made bitstream fonts the rc default - JDH - -2006-08-31 Fixed alpha-handling bug in ColorConverter, affecting - collections in general and contour/contourf in - particular. - EF - -2006-08-30 ft2font.cpp: Added draw_rect_filled method (now used by mathtext2 - to draw the fraction bar) to FT2Font - ES - -2006-08-29 setupext.py: wrap calls to tk.getvar() with str(). On some - systems, getvar returns a Tcl_Obj instead of a string - DSD - -2006-08-28 mathtext2.py: Sub/superscripts can now be complex (i.e. - fractions etc.). The demo is also updated - ES - -2006-08-28 font_manager.py: Added /usr/local/share/fonts to list of - X11 font directories - DSD - -2006-08-28 mahtext2.py: Initial support for complex fractions. Also, - rendering is now completely separated from parsing. The - sub/superscripts now work better. - Updated the mathtext2_demo.py - ES - -2006-08-27 qt backends: don't create a QApplication when backend is - imported, do it when the FigureCanvasQt is created. Simplifies - applications where mpl is embedded in qt. Updated - embedding_in_qt* examples - DSD - -2006-08-27 mahtext2.py: Now the fonts are searched in the OS font dir and - in the mpl-data dir. Also env is not a dict anymore. - ES - -2006-08-26 minor changes to __init__.py, mathtex2_demo.py. Added matplotlibrc - key "mathtext.mathtext2" (removed the key "mathtext2") - ES - -2006-08-21 mathtext2.py: Initial support for fractions - Updated the mathtext2_demo.py - _mathtext_data.py: removed "\" from the unicode dicts - mathtext.py: Minor modification (because of _mathtext_data.py)- ES - -2006-08-20 Added mathtext2.py: Replacement for mathtext.py. Supports _ ^, - \rm, \cal etc., \sin, \cos etc., unicode, recursive nestings, - inline math mode. The only backend currently supported is Agg - __init__.py: added new rc params for mathtext2 - added mathtext2_demo.py example - ES - -2006-08-19 Added embedding_in_qt4.py example - DSD - -2006-08-11 Added scale free Ellipse patch for Agg - CM - -2006-08-10 Added converters to and from julian dates to matplotlib.dates - (num2julian and julian2num) - JDH - -2006-08-08 Fixed widget locking so multiple widgets could share the - event handling - JDH - -2006-08-07 Added scale free Ellipse patch to SVG and PS - CM - -2006-08-05 Re-organized imports in numerix for numpy 1.0b2 -- TEO - -2006-08-04 Added draw_markers to PDF backend. - JKS - -2006-08-01 Fixed a bug in postscript's rendering of dashed lines - DSD - -2006-08-01 figure.py: savefig() update docstring to add support for 'format' - argument. - backend_cairo.py: print_figure() add support 'format' argument. - SC - -2006-07-31 Don't let postscript's xpdf distiller compress images - DSD - -2006-07-31 Added shallowcopy() methods to all Transformations; - removed copy_bbox_transform and copy_bbox_transform_shallow - from transforms.py; - added offset_copy() function to transforms.py to - facilitate positioning artists with offsets. - See examples/transoffset.py. - EF - -2006-07-31 Don't let postscript's xpdf distiller compress images - DSD - -2006-07-29 Fixed numerix polygon bug reported by Nick Fotopoulos. - Added inverse_numerix_xy() transform method. - Made autoscale_view() preserve axis direction - (e.g., increasing down).- EF - -2006-07-28 Added shallow bbox copy routine for transforms -- mainly - useful for copying transforms to apply offset to. - JDH - -2006-07-28 Added resize method to FigureManager class - for Qt and Gtk backend - CM - -2006-07-28 Added subplots_adjust button to Qt backend - CM - -2006-07-26 Use numerix more in collections. - Quiver now handles masked arrays. - EF - -2006-07-22 Fixed bug #1209354 - DSD - -2006-07-22 make scatter() work with the kwarg "color". Closes bug - 1285750 - DSD - -2006-07-20 backend_cairo.py: require pycairo 1.2.0. - print_figure() update to output SVG using cairo. - -2006-07-19 Added blitting for Qt4Agg - CM - -2006-07-19 Added lasso widget and example examples/lasso_demo.py - JDH - -2006-07-18 Added blitting for QtAgg backend - CM - -2006-07-17 Fixed bug #1523585: skip nans in semilog plots - DSD - -2006-07-12 Add support to render the scientific notation label - over the right-side y-axis - DSD - -=============================================================== -2006-07-11 Released 0.87.4 at revision 2558 - -2006-07-07 Fixed a usetex bug with older versions of latex - DSD - -2006-07-07 Add compatibility for NumPy 1.0 - TEO - -2006-06-29 Added a Qt4Agg backend. Thank you James Amundson - DSD - -2006-06-26 Fixed a usetex bug. On windows, usetex will prcess - postscript output in the current directory rather than - in a temp directory. This is due to the use of spaces - and tildes in windows paths, which cause problems with - latex. The subprocess module is no longer used. - DSD - -2006-06-22 Various changes to bar(), barh(), and hist(). - Added 'edgecolor' keyword arg to bar() and barh(). - The x and y args in barh() have been renamed to width - and bottom respectively, and their order has been swapped - to maintain a (position, value) order ala matlab. left, - height, width and bottom args can now all be scalars or - sequences. barh() now defaults to edge alignment instead - of center alignment. Added a keyword arg 'align' to bar(), - barh() and hist() that controls between edge or center bar - alignment. Fixed ignoring the rcParams['patch.facecolor'] - for bar color in bar() and barh(). Fixed ignoring the - rcParams['lines.color'] for error bar color in bar() - and barh(). Fixed a bug where patches would be cleared - when error bars were plotted if rcParams['axes.hold'] - was False. - MAS - -2006-06-22 Added support for numerix 2-D arrays as alternatives to - a sequence of (x,y) tuples for specifying paths in - collections, quiver, contour, pcolor, transforms. - Fixed contour bug involving setting limits for - color mapping. Added numpy-style all() to numerix. - EF - -2006-06-20 Added custom FigureClass hook to pylab interface - see - examples/custom_figure_class.py - -2006-06-16 Added colormaps from gist (gist_earth, gist_stern, - gist_rainbow, gist_gray, gist_yarg, gist_heat, gist_ncar) - JW - -2006-06-16 Added a pointer to parent in figure canvas so you can - access the container with fig.canvas.manager. Useful if - you want to set the window title, e.g., in gtk - fig.canvas.manager.window.set_title, though a GUI neutral - method would be preferable JDH - -2006-06-16 Fixed colorbar.py to handle indexed colors (i.e., - norm = no_norm()) by centering each colored region - on its index. - EF - -2006-06-15 Added scalex and scaley to Axes.autoscale_view to support - selective autoscaling just the x or y axis, and supported - these command in plot so you can say plot(something, - scaley=False) and just the x axis will be autoscaled. - Modified axvline and axhline to support this, so for - example axvline will no longer autoscale the y axis. JDH - -2006-06-13 Fix so numpy updates are backward compatible - TEO - -2006-06-12 Updated numerix to handle numpy restructuring of - oldnumeric - TEO - -2006-06-12 Updated numerix.fft to handle numpy restructuring - Added ImportError to numerix.linear_algebra for numpy -TEO - -2006-06-11 Added quiverkey command to pylab and Axes, using - QuiverKey class in quiver.py. Changed pylab and Axes - to use quiver2 if possible, but drop back to the - newly-renamed quiver_classic if necessary. Modified - examples/quiver_demo.py to illustrate the new quiver - and quiverkey. Changed LineCollection implementation - slightly to improve compatibility with PolyCollection. - EF - -2006-06-11 Fixed a usetex bug for windows, running latex on files - with spaces in their names or paths was failing - DSD - -2006-06-09 Made additions to numerix, changes to quiver to make it - work with all numeric flavors. - EF - -2006-06-09 Added quiver2 function to pylab and method to axes, - with implementation via a Quiver class in quiver.py. - quiver2 will replace quiver before the next release; - it is placed alongside it initially to facilitate - testing and transition. See also - examples/quiver2_demo.py. - EF - -2006-06-08 Minor bug fix to make ticker.py draw proper minus signs - with usetex - DSD - -=============================================================== -2006-06-06 Released 0.87.3 at revision 2432 - -2006-05-30 More partial support for polygons with outline or fill, - but not both. Made LineCollection inherit from - ScalarMappable. - EF - -2006-05-29 Yet another revision of aspect-ratio handling. - EF - -2006-05-27 Committed a patch to prevent stroking zero-width lines in - the svg backend - DSD - -2006-05-24 Fixed colorbar positioning bug identified by Helge - Avlesen, and improved the algorithm; added a 'pad' - kwarg to control the spacing between colorbar and - parent axes. - EF - -2006-05-23 Changed color handling so that collection initializers - can take any mpl color arg or sequence of args; deprecated - float as grayscale, replaced by string representation of - float. - EF - -2006-05-19 Fixed bug: plot failed if all points were masked - EF - -2006-05-19 Added custom symbol option to scatter - JDH - -2006-05-18 New example, multi_image.py; colorbar fixed to show - offset text when the ScalarFormatter is used; FixedFormatter - augmented to accept and display offset text. - EF - -2006-05-14 New colorbar; old one is renamed to colorbar_classic. - New colorbar code is in colorbar.py, with wrappers in - figure.py and pylab.py. - Fixed aspect-handling bug reported by Michael Mossey. - Made backend_bases.draw_quad_mesh() run.- EF - -2006-05-08 Changed handling of end ranges in contourf: replaced - "clip-ends" kwarg with "extend". See docstring for - details. -EF - -2006-05-08 Added axisbelow to rc - JDH - -2006-05-08 If using PyGTK require version 2.2+ - SC - -2006-04-19 Added compression support to PDF backend, controlled by - new pdf.compression rc setting. - JKS - -2006-04-19 Added Jouni's PDF backend - -2006-04-18 Fixed a bug that caused agg to not render long lines - -2006-04-16 Masked array support for pcolormesh; made pcolormesh support the - same combinations of X,Y,C dimensions as pcolor does; - improved (I hope) description of grid used in pcolor, - pcolormesh. - EF - -2006-04-14 Reorganized axes.py - EF - -2006-04-13 Fixed a bug Ryan found using usetex with sans-serif fonts and - exponential tick labels - DSD - -2006-04-11 Refactored backend_ps and backend_agg to prevent module-level - texmanager imports. Now these imports only occur if text.usetex - rc setting is true - DSD - -2006-04-10 Committed changes required for building mpl on win32 - platforms with visual studio. This allows wxpython - blitting for fast animations. - CM - -2006-04-10 Fixed an off-by-one bug in Axes.change_geometry. - -2006-04-10 Fixed bug in pie charts where wedge wouldn't have label in - legend. Submitted by Simon Hildebrandt. - ADS - -2006-05-06 Usetex makes temporary latex and dvi files in a temporary - directory, rather than in the user's current working - directory - DSD - -2006-04-05 Apllied Ken's wx deprecation warning patch closing sf patch - #1465371 - JDH - -2006-04-05 Added support for the new API in the postscript backend. - Allows values to be masked using nan's, and faster file - creation - DSD - -2006-04-05 Use python's subprocess module for usetex calls to - external programs. subprocess catches when they exit - abnormally so an error can be raised. - DSD - -2006-04-03 Fixed the bug in which widgets would not respond to - events. This regressed the twinx functionality, so I - also updated subplots_adjust to update axes that share - an x or y with a subplot instance. - CM - -2006-04-02 Moved PBox class to transforms and deleted pbox.py; - made pylab axis command a thin wrapper for Axes.axis; - more tweaks to aspect-ratio handling; fixed Axes.specgram - to account for the new imshow default of unit aspect - ratio; made contour set the Axes.dataLim. - EF - -2006-03-31 Fixed the Qt "Underlying C/C++ object deleted" bug. - JRE - -2006-03-31 Applied Vasily Sulatskov's Qt Navigation Toolbar enhancement. - JRE - -2006-03-31 Ported Norbert's rewriting of Halldor's stineman_interp - algorithm to make it numerix compatible and added code to - matplotlib.mlab. See examples/interp_demo.py - JDH - -2006-03-30 Fixed a bug in aspect ratio handling; blocked potential - crashes when panning with button 3; added axis('image') - support. - EF - -2006-03-28 More changes to aspect ratio handling; new PBox class - in new file pbox.py to facilitate resizing and repositioning - axes; made PolarAxes maintain unit aspect ratio. - EF - -2006-03-23 Refactored TextWithDash class to inherit from, rather than - delegate to, the Text class. Improves object inspection - and closes bug # 1357969 - DSD - -2006-03-22 Improved aspect ratio handling, including pylab interface. - Interactive resizing, pan, zoom of images and plots - (including panels with a shared axis) should work. - Additions and possible refactoring are still likely. - EF - -2006-03-21 Added another colorbrewer colormap (RdYlBu) - JSWHIT - -2006-03-21 Fixed tickmarks for logscale plots over very large ranges. - Closes bug # 1232920 - DSD - -2006-03-21 Added Rob Knight's arrow code; see examples/arrow_demo.py - JDH - -2006-03-20 Added support for masking values with nan's, using ADS's - isnan module and the new API. Works for *Agg backends - DSD - -2006-03-20 Added contour.negative_linestyle rcParam - ADS - -2006-03-20 Added _isnan extension module to test for nan with Numeric - - ADS - -2006-03-17 Added Paul and Alex's support for faceting with quadmesh - in sf patch 1411223 - JDH - -2006-03-17 Added Charle Twardy's pie patch to support colors=None. - Closes sf patch 1387861 - JDH - -2006-03-17 Applied sophana's patch to support overlapping axes with - toolbar navigation by toggling activation with the 'a' key. - Closes sf patch 1432252 - JDH - -2006-03-17 Applied Aarre's linestyle patch for backend EMF; closes sf - patch 1449279 - JDH - -2006-03-17 Applied Jordan Dawe's patch to support kwarg properties - for grid lines in the grid command. Closes sf patch - 1451661 - JDH - -2006-03-17 Center postscript output on page when using usetex - DSD - -2006-03-17 subprocess module built if Python <2.4 even if subprocess - can be imported from an egg - ADS - -2006-03-17 Added _subprocess.c from Python upstream and hopefully - enabled building (without breaking) on Windows, although - not tested. - ADS - -2006-03-17 Updated subprocess.py to latest Python upstream and - reverted name back to subprocess.py - ADS - -2006-03-16 Added John Porter's 3D handling code - - -=============================================================== -2006-03-16 Released 0.87.2 at revision 2150 - -2006-03-15 Fixed bug in MaxNLocator revealed by daigos@infinito.it. - The main change is that Locator.nonsingular now adjusts - vmin and vmax if they are nearly the same, not just if - they are equal. A new kwarg, "tiny", sets the threshold. - - EF - -2006-03-14 Added import of compatibility library for newer numpy - linear_algebra - TEO - -2006-03-12 Extended "load" function to support individual columns and - moved "load" and "save" into matplotlib.mlab so they can be - used outside of pylab -- see examples/load_converter.py - - JDH - -2006-03-12 Added AutoDateFormatter and AutoDateLocator submitted - by James Evans. Try the load_converter.py example for a - demo. - ADS - -2006-03-11 Added subprocess module from python-2.4 - DSD - -2006-03-11 Fixed landscape orientation support with the usetex - option. The backend_ps print_figure method was - getting complicated, I added a _print_figure_tex - method to maintain some degree of sanity - DSD - -2006-03-11 Added "papertype" savefig kwarg for setting - postscript papersizes. papertype and ps.papersize - rc setting can also be set to "auto" to autoscale - pagesizes - DSD - -2006-03-09 Apply P-J's patch to make pstoeps work on windows - patch report # 1445612 - DSD - -2006-03-09 Make backend rc parameter case-insensitive - DSD - -2006-03-07 Fixed bug in backend_ps related to C0-C6 papersizes, - which were causing problems with postscript viewers. - Supported page sizes include letter, legal, ledger, - A0-A10, and B0-B10 - DSD - -=============================================================== -2006-03-07 Released 0.87.1 - -2006-03-04 backend_cairo.py: - fix get_rgb() bug reported by Keith Briggs. - Require pycairo 1.0.2. - Support saving png to file-like objects. - SC - -2006-03-03 Fixed pcolor handling of vmin, vmax - EF - -2006-03-02 improve page sizing with usetex with the latex - geometry package. Closes bug # 1441629 - DSD - -2006-03-02 Fixed dpi problem with usetex png output. Accepted a - modified version of patch # 1441809 - DSD - -2006-03-01 Fixed axis('scaled') to deal with case xmax < xmin - JSWHIT - -2006-03-01 Added reversed colormaps (with '_r' appended to name) - JSWHIT - -2006-02-27 Improved eps bounding boxes with usetex - DSD - -2006-02-27 Test svn commit, again! - -2006-02-27 Fixed two dependency checking bugs related to usetex - on Windows - DSD - -2006-02-27 Made the rc deprecation warnings a little more human - readable. - -2006-02-26 Update the previous gtk.main_quit() bug fix to use gtk.main_level() - - SC - -2006-02-24 Implemented alpha support in contour and contourf - EF - -2006-02-22 Fixed gtk main quit bug when quit was called before - mainloop. - JDH - -2006-02-22 Small change to colors.py to workaround apparent - bug in numpy masked array module - JSWHIT - -2006-02-22 Fixed bug in ScalarMappable.to_rgba() reported by - Ray Jones, and fixed incorrect fix found by Jeff - Whitaker - EF - -=============================================================== -2006-02-22 Released 0.87 - -2006-02-21 Fixed portrait/landscape orientation in postscript backend - DSD - -2006-02-21 Fix bug introduced in yesterday's bug fix - SC - -2006-02-20 backend_gtk.py FigureCanvasGTK.draw(): fix bug reported by - David Tremouilles - SC - -2006-02-20 Remove the "pygtk.require('2.4')" error from - examples/embedding_in_gtk2.py - SC - -2006-02-18 backend_gtk.py FigureCanvasGTK.draw(): simplify to use (rather than - duplicate) the expose_event() drawing code - SC - -2006-02-12 Added stagger or waterfall plot capability to LineCollection; - illustrated in examples/collections.py. - EF - -2006-02-11 Massive cleanup of the usetex code in the postscript backend. Possibly - fixed the clipping issue users were reporting with older versions of - ghostscript - DSD - -2006-02-11 Added autolim kwarg to axes.add_collection. Changed - collection get_verts() methods accordingly. - EF - -2006-02-09 added a temporary rc parameter text.dvipnghack, to allow Mac users to get nice - results with the usetex option. - DSD - -2006-02-09 Fixed a bug related to setting font sizes with the usetex option. - DSD - -2006-02-09 Fixed a bug related to usetex's latex code. - DSD - -2006-02-09 Modified behavior of font.size rc setting. You should define font.size in pts, - which will set the "medium" or default fontsize. Special text sizes like axis - labels or tick labels can be given relative font sizes like small, large, - x-large, etc. and will scale accordingly. - DSD - -2006-02-08 Added py2exe specific datapath check again. Also added new - py2exe helper function get_py2exe_datafiles for use in py2exe - setup.py scripts. - CM - -2006-02-02 Added box function to pylab - -2006-02-02 Fixed a problem in setupext.py, tk library formatted in unicode - caused build problems - DSD - -2006-02-01 Dropped TeX engine support in usetex to focus on LaTeX. - DSD - -2006-01-29 Improved usetex option to respect the serif, sans-serif, monospace, - and cursive rc settings. Removed the font.latex.package rc setting, - it is no longer required - DSD - -2006-01-29 Fixed tex's caching to include font.family rc information - DSD - -2006-01-29 Fixed subpixel rendering bug in *Agg that was causing - uneven gridlines - JDH - -2006-01-28 Added fontcmd to backend_ps's RendererPS.draw_tex, to support other - font families in eps output - DSD - -2006-01-28 Added MaxNLocator to ticker.py, and changed contour.py to - use it by default. - EF - -2006-01-28 Added fontcmd to backend_ps's RendererPS.draw_tex, to support other - font families in eps output - DSD - -2006-01-27 Buffered reading of matplotlibrc parameters in order to allow - 'verbose' settings to be processed first (allows verbose.report - during rc validation process) - DSD - -2006-01-27 Removed setuptools support from setup.py and created a - separate setupegg.py file to replace it. - CM - -2006-01-26 Replaced the ugly datapath logic with a cleaner approach from - http://wiki.python.org/moin/DistutilsInstallDataScattered. - Overrides the install_data command. - CM - -2006-01-24 Don't use character typecodes in cntr.c --- changed to use - defined typenumbers instead. - TEO - -2006-01-24 Fixed some bugs in usetex's and ps.usedistiller's dependency - -2006-01-24 Added masked array support to scatter - EF - -2006-01-24 Fixed some bugs in usetex's and ps.usedistiller's dependency - checking - DSD - -=============================================================== -2006-01-24 Released 0.86.2 - -2006-01-20 Added a converters dict to pylab load to convert selected - coloumns to float -- especially useful for files with date - strings, uses a datestr2num converter - JDH - -2006-01-20 Added datestr2num to matplotlib dates to convert a string - or sequence of strings to a matplotlib datenum - -2006-01-18 Added quadrilateral pcolormesh patch 1409190 by Alex Mont - and Paul Kienzle -- this is *Agg only for now. See - examples/quadmesh_demo.py - JDH - -2006-01-18 Added Jouni's boxplot patch - JDH - -2006-01-18 Added comma delimiter for pylab save - JDH - -2006-01-12 Added Ryan's legend patch - JDH - - -2006-1-12 Fixed numpy / numeric to use .dtype.char to keep in SYNC with numpy SVN - -=============================================================== -2006-1-11 Released 0.86.1 - -2006-1-11 Fixed setup.py for win32 build and added rc template to the MANIFEST.in - -2006-1-10 Added xpdf distiller option. matplotlibrc ps.usedistiller can now be - none, false, ghostscript, or xpdf. Validation checks for - dependencies. This needs testing, but the xpdf option should produce - the highest-quality output and small file sizes - DSD - -2006-01-10 For the usetex option, backend_ps now does all the LaTeX work in the - os's temp directory - DSD - -2006-1-10 Added checks for usetex dependencies. - DSD - -======================================================================= -2006-1-9 Released 0.86 - -2006-1-4 Changed to support numpy (new name for scipy_core) - TEO - -2006-1-4 Added Mark's scaled axes patch for shared axis - -2005-12-28 Added Chris Barker's build_wxagg patch - JDH - -2005-12-27 Altered numerix/scipy to support new scipy package - structure - TEO -2005-12-20 Fixed Jame's Boyles date tick reversal problem - JDH - -2005-12-20 Added Jouni's rc patch to support lists of keys to set on - - JDH - -2005-12-12 Updated pyparsing and mathtext for some speed enhancements - (Thanks Paul McGuire) and minor fixes to scipy numerix and - setuptools - -2005-12-12 Matplotlib data is now installed as package_data in - the matplotlib module. This gets rid of checking the - many possibilities in matplotlib._get_data_path() - CM - -2005-12-11 Support for setuptools/pkg_resources to build and use - matplotlib as an egg. Still allows matplotlib to exist - using a traditional distutils install. - ADS - -2005-12-03 Modified setup to build matplotlibrc based on compile time - findings. It will set numerix in the order of scipy, - numarray, Numeric depending on which are founds, and - backend as in preference order GTKAgg, WXAgg, TkAgg, GTK, - Agg, PS - -2005-12-03 Modified scipy patch to support Numeric, scipy and numarray - Some work remains to be done because some of the scipy - imports are broken if only the core is installed. e.g., - apparently we need from scipy.basic.fftpack import * rather - than from scipy.fftpack import * - -2005-12-03 Applied some fixes to Nicholas Young's nonuniform image - patch - -2005-12-01 Applied Alex Gontmakher hatch patch - PS only for now - -2005-11-30 Added Rob McMullen's EMF patch - -2005-11-30 Added Daishi's patch for scipy - -2005-11-30 Fixed out of bounds draw markers segfault in agg - -2005-11-28 Got TkAgg blitting working 100% (cross fingers) correctly. - CM - -2005-11-27 Multiple changes in cm.py, colors.py, figure.py, image.py, - contour.py, contour_demo.py; new _cm.py, examples/image_masked.py. - 1) Separated the color table data from cm.py out into - a new file, _cm.py, to make it easier to find the actual - code in cm.py and to add new colormaps. Also added - some line breaks to the color data dictionaries. Everything - from _cm.py is imported by cm.py, so the split should be - transparent. - 2) Enabled automatic generation of a colormap from - a list of colors in contour; see modified - examples/contour_demo.py. - 3) Support for imshow of a masked array, with the - ability to specify colors (or no color at all) for - masked regions, and for regions that are above or - below the normally mapped region. See - examples/image_masked.py. - 4) In support of the above, added two new classes, - ListedColormap, and no_norm, to colors.py, and modified - the Colormap class to include common functionality. Added - a clip kwarg to the normalize class. Reworked color - handling in contour.py, especially in the ContourLabeller - mixin. - - EF - -2005-11-25 Changed text.py to ensure color is hashable. EF - -======================================================================= -2005-11-16 Released 0.85 - -2005-11-16 Changed the default default linewidth in rc to 1.0 - -2005-11-16 Replaced agg_to_gtk_drawable with pure pygtk pixbuf code in - backend_gtkagg. When the equivalent is doe for blit, the - agg extension code will no longer be needed - -2005-11-16 Added a maxdict item to cbook to prevent caches from - growing w/o bounds - -2005-11-15 Fixed a colorup/colordown reversal bug in finance.py -- - Thanks Gilles - -2005-11-15 Applied Jouni K Steppanen's boxplot patch SF patch#1349997 - - JDH - - -2005-11-09 added axisbelow attr for Axes to determine whether ticks and such - are above or below the actors - -2005-11-08 Added Nicolas' irregularly spaced image patch - - -2005-11-08 Deprecated HorizontalSpanSelector and replaced with - SpanSelection that takes a third arg, direction. The - new SpanSelector supports horizontal and vertical span - selection, and the appropriate min/max is returned. - CM - -2005-11-08 Added lineprops dialog for gtk - -2005-11-03 Added FIFOBuffer class to mlab to support real time feeds - and examples/fifo_buffer.py - -2005-11-01 Contributed Nickolas Young's patch for afm mathtext to - support mathtext based upon the standard postscript Symbol - font when ps.usetex = True. - -2005-10-26 Added support for scatter legends - thanks John Gill - -2005-10-20 Fixed image clipping bug that made some tex labels - disappear. JDH - -2005-10-14 Removed sqrt from dvipng 1.6 alpha channel mask. - -2005-10-14 Added width kwarg to hist function - -2005-10-10 Replaced all instances of os.rename with shutil.move - -2005-10-05 Added Michael Brady's ydate patch - -2005-10-04 Added rkern's texmanager patch - -2005-09-25 contour.py modified to use a single ContourSet class - that handles filled contours, line contours, and labels; - added keyword arg (clip_ends) to contourf. - Colorbar modified to work with new ContourSet object; - if the ContourSet has lines rather than polygons, the - colorbar will follow suit. Fixed a bug introduced in - 0.84, in which contourf(...,colors=...) was broken - EF - -======================================================================= -2005-09-19 Released 0.84 - -2005-09-14 Added a new 'resize_event' which triggers a callback with a - backend_bases.ResizeEvent object - JDH - -2005-09-14 font_manager.py: removed chkfontpath from x11FontDirectory() - SC - -2005-09-14 Factored out auto date locator/formatter factory code into - matplotlib.date.date_ticker_factory; applies John Bryne's - quiver patch. - -2005-09-13 Added Mark's axes positions history patch #1286915 - -2005-09-09 Added support for auto canvas resizing with - fig.set_figsize_inches(9,5,forward=True) # inches - OR - fig.resize(400,300) # pixels - -2005-09-07 figure.py: update Figure.draw() to use the updated - renderer.draw_image() so that examples/figimage_demo.py works again. - examples/stock_demo.py: remove data_clipping (which no longer - exists) - SC - -2005-09-06 Added Eric's tick.direction patch: in or out in rc - -2005-09-06 Added Martin's rectangle selector widget - -2005-09-04 Fixed a logic err in text.py that was preventing rgxsuper - from matching - JDH - -2005-08-29 Committed Ken's wx blit patch #1275002 - -2005-08-26 colorbar modifications - now uses contourf instead of imshow - so that colors used by contourf are displayed correctly. - Added two new keyword args (cspacing and clabels) that are - only relevant for ContourMappable images - JSWHIT - -2005-08-24 Fixed a PS image bug reported by Darren - JDH - -2005-08-23 colors.py: change hex2color() to accept unicode strings as well as - normal strings. Use isinstance() instead of types.IntType etc - SC - -2005-08-16 removed data_clipping line and rc property - JDH - -2005-08-22 backend_svg.py: Remove redundant "x=0.0 y=0.0" from svg element. - Increase svg version from 1.0 to 1.1. Add viewBox attribute to svg - element to allow SVG documents to scale-to-fit into an arbitrary - viewport - SC - -2005-08-16 Added Eric's dot marker patch - JDH - -2005-08-08 Added blitting/animation for TkAgg - CM - -2005-08-05 Fixed duplicate tickline bug - JDH - -2005-08-05 Fixed a GTK animation bug that cropped up when doing - animations in gtk//gtkagg canvases that had widgets packed - above them - -2005-08-05 Added Clovis Goldemberg patch to the tk save dialog - -2005-08-04 Removed origin kwarg from backend.draw_image. origin is - handled entirely by the frontend now. - -2005-07-03 Fixed a bug related to TeX commands in backend_ps - -2005-08-03 Fixed SVG images to respect upper and lower origins. - -2005-08-03 Added flipud method to image and removed it from to_str. - -2005-07-29 Modified figure.figaspect to take an array or number; - modified backend_svg to write utf-8 - JDH - -2005-07-30 backend_svg.py: embed png image files in svg rather than linking - to a separate png file, fixes bug #1245306 (thanks to Norbert Nemec - for the patch) - SC - -======================================================================= - -2005-07-29 Released 0.83.2 - -2005-07-27 Applied SF patch 1242648: minor rounding error in - IndexDateFormatter in dates.py - -2005-07-27 Applied sf patch 1244732: Scale axis such that circle - looks like circle - JDH -2005-07-29 Improved message reporting in texmanager and backend_ps - DSD - -2005-07-28 backend_gtk.py: update FigureCanvasGTK.draw() (needed due to the - recent expose_event() change) so that examples/anim.py works in the - usual way - SC - -2005-07-26 Added new widgets Cursor and HorizontalSpanSelector to - matplotlib.widgets. See examples/widgets/cursor.py and - examples/widgets/span_selector.py - JDH - -2005-07-26 added draw event to mpl event hierarchy -- triggered on - figure.draw - -2005-07-26 backend_gtk.py: allow 'f' key to toggle window fullscreen mode - -2005-07-26 backend_svg.py: write "<.../>" elements all on one line and remove - surplus spaces - SC - -2005-07-25 backend_svg.py: simplify code by deleting GraphicsContextSVG and - RendererSVG.new_gc(), and moving the gc.get_capstyle() code into - RendererSVG._get_gc_props_svg() - SC - -2005-07-24 backend_gtk.py: call FigureCanvasBase.motion_notify_event() on - all motion-notify-events, not just ones where a modifier key or - button has been pressed (fixes bug report from Niklas Volbers) - SC - -2005-07-24 backend_gtk.py: modify print_figure() use own pixmap, fixing - problems where print_figure() overwrites the display pixmap. - return False from all button/key etc events - to allow the event - to propagate further - SC - -2005-07-23 backend_gtk.py: change expose_event from using set_back_pixmap(); - clear() to draw_drawable() - SC - -2005-07-23 backend_gtk.py: removed pygtk.require() - matplotlib/__init__.py: delete 'FROZEN' and 'McPLError' which are - no longer used - SC - -2005-07-22 backend_gdk.py: removed pygtk.require() - SC - -2005-07-21 backend_svg.py: Remove unused imports. Remove methods doc strings - which just duplicate the docs from backend_bases.py. Rename - draw_mathtext to _draw_mathtext. - SC - -2005-07-17 examples/embedding_in_gtk3.py: new example demonstrating placing - a FigureCanvas in a gtk.ScrolledWindow - SC - -2005-07-14 Fixed a Windows related bug (#1238412) in texmanager - DSD - -2005-07-11 Fixed color kwarg bug, setting color=1 or 0 caused an - exception - DSD - -2005-07-07 Added Eric's MA set_xdata Line2D fix - JDH - -2005-07-06 Made HOME/.matplotlib the new config dir where the - matplotlibrc file, the ttf.cache, and the tex.cache live. - The new default filenames in .matplotlib have no leading - dot and are not hidden. e.g., the new names are matplotlibrc - tex.cache ttffont.cache. This is how ipython does it so it - must be right. If old files are found, a warning is issued - and they are moved to the new location. Also fixed - texmanager to put all files, including temp files in - ~/.matplotlib/tex.cache, which allows you to usetex in - non-writable dirs. - -2005-07-05 Fixed bug #1231611 in subplots adjust layout. The problem - was that the text cacheing mechanism was not using the - transformation affine in the key. - JDH - -2005-07-05 Fixed default backend import problem when using API (SF bug - # 1209354 - see API_CHANGES for more info - JDH - -2005-07-04 backend_gtk.py: require PyGTK version 2.0.0 or higher - SC - -2005-06-30 setupext.py: added numarray_inc_dirs for building against - numarray when not installed in standard location - ADS - -2005-06-27 backend_svg.py: write figure width, height as int, not float. - Update to fix some of the pychecker warnings - SC - -2005-06-23 Updated examples/agg_test.py to demonstrate curved paths - and fills - JDH - -2005-06-21 Moved some texmanager and backend_agg tex caching to class - level rather than instance level - JDH - -2005-06-20 setupext.py: fix problem where _nc_backend_gdk is installed to the - wrong directory - SC - -2005-06-19 Added 10.4 support for CocoaAgg. - CM - -2005-06-18 Move Figure.get_width_height() to FigureCanvasBase and return - int instead of float. - SC - -2005-06-18 Applied Ted Drain's QtAgg patch: 1) Changed the toolbar to - be a horizontal bar of push buttons instead of a QToolbar - and updated the layout algorithms in the main window - accordingly. This eliminates the ability to drag and drop - the toolbar and detach it from the window. 2) Updated the - resize algorithm in the main window to show the correct - size for the plot widget as requested. This works almost - correctly right now. It looks to me like the final size of - the widget is off by the border of the main window but I - haven't figured out a way to get that information yet. We - could just add a small margin to the new size but that - seems a little hacky. 3) Changed the x/y location label to - be in the toolbar like the Tk backend instead of as a - status line at the bottom of the widget. 4) Changed the - toolbar pixmaps to use the ppm files instead of the png - files. I noticed that the Tk backend buttons looked much - nicer and it uses the ppm files so I switched them. - -2005-06-17 Modified the gtk backend to not queue mouse motion events. - This allows for live updates when dragging a slider. - CM - -2005-06-17 Added starter CocoaAgg backend. Only works on OS 10.3 for - now and requires PyObjC. (10.4 is high priority) - CM - -2005-06-17 Upgraded pyparsing and applied Paul McGuire's suggestions - for speeding things up. This more than doubles the speed - of mathtext in my simple tests. JDH - -2005-06-16 Applied David Cooke's subplot make_key patch - -======================================================== - -2005-06-15 0.82 released - -2005-06-15 Added subplot config tool to GTK* backends -- note you must - now import the NavigationToolbar2 from your backend of - choice rather than from backend_gtk because it needs to - know about the backend specific canvas -- see - examples/embedding_in_gtk2.py. Ditto for wx backend -- see - examples/embedding_in_wxagg.py - -2005-06-15 backend_cairo.py: updated to use pycairo 0.5.0 - SC - -2005-06-14 Wrote some GUI neutral widgets (Button, Slider, - RadioButtons, CheckButtons) in matplotlib.widgets. See - examples/widgets/*.py - JDH - -2005-06-14 Exposed subplot parameters as rc vars and as the fig - SubplotParams instance subplotpars. See - figure.SubplotParams, figure.Figure.subplots_adjust and the - pylab method subplots_adjust and - examples/subplots_adjust.py . Also added a GUI neutral - widget for adjusting subplots, see - examples/subplot_toolbar.py - JDH - -2005-06-13 Exposed cap and join style for lines with new rc params and - line properties - - lines.dash_joinstyle : miter # miter|round|bevel - lines.dash_capstyle : butt # butt|round|projecting - lines.solid_joinstyle : miter # miter|round|bevel - lines.solid_capstyle : projecting # butt|round|projecting - - -2005-06-13 Added kwargs to Axes init - -2005-06-13 Applied Baptiste's tick patch - JDH - -2005-06-13 Fixed rc alias 'l' bug reported by Fernando by removing - aliases for mainlevel rc options. - JDH - -2005-06-10 Fixed bug #1217637 in ticker.py - DSD - -2005-06-07 Fixed a bug in texmanager.py: .aux files not being removed - DSD - -2005-06-08 Added Sean Richard's hist binning fix -- see API_CHANGES - JDH - -2005-06-07 Fixed a bug in texmanager.py: .aux files not being removed - - DSD - - -===================================================================== - -2005-06-07 matplotlib-0.81 released - -2005-06-06 Added autoscale_on prop to axes - -2005-06-06 Added Nick's picker "among" patch - JDH - -2005-06-05 Fixed a TeX/LaTeX font discrepency in backend_ps. - DSD - -2005-06-05 Added a ps.distill option in rc settings. If True, postscript - output will be distilled using ghostscript, which should trim - the file size and allow it to load more quickly. Hopefully this - will address the issue of large ps files due to font - definitions. Tested with gnu-ghostscript-8.16. - DSD - -2005-06-03 Improved support for tex handling of text in backend_ps. - DSD - -2005-06-03 Added rc options to render text with tex or latex, and to select - the latex font package. - DSD - -2005-06-03 Fixed a bug in ticker.py causing a ZeroDivisionError - -2005-06-02 backend_gtk.py remove DBL_BUFFER, add line to expose_event to - try to fix pygtk 2.6 redraw problem - SC - -2005-06-01 The default behavior of ScalarFormatter now renders scientific - notation and large numerical offsets in a label at the end of - the axis. - DSD - -2005-06-01 Added Nicholas' frombyte image patch - JDH - -2005-05-31 Added vertical TeX support for agg - JDH - -2005-05-31 Applied Eric's cntr patch - JDH - -2005-05-27 Finally found the pesky agg bug (which Maxim was kind - enough to fix within hours) that was causing a segfault in - the win32 cached marker drawing. Now windows users can get - the enormouse performance benefits of caced markers w/o - those occasional pesy screenshots. - JDH - -2005-05-27 Got win32 build system working again, using a more recent - version of gtk and pygtk in the win32 build, gtk 2.6 from - http://www.gimp.org/~tml/gimp/win32/downloads.html (you - will also need libpng12.dll to use these). I haven't - tested whether this binary build of mpl for win32 will work - with older gtk runtimes, so you may need to upgrade. - -2005-05-27 Fixed bug where 2nd wxapp could be started if using wxagg - backend. - ADS - -2005-05-26 Added Daishi text with dash patch -- see examples/dashtick.py - -2005-05-26 Moved backend_latex functionality into backend_ps. If - text.usetex=True, the PostScript backend will use LaTeX to - generate the .ps or .eps file. Ghostscript is required for - eps output. - DSD - -2005-05-24 Fixed alignment and color issues in latex backend. - DSD - -2005-05-21 Fixed raster problem for small rasters with dvipng -- looks - like it was a premultipled alpha problem - JDH - -2005-05-20 Added linewidth and faceted kwarg to scatter to control - edgewidth and color. Also added autolegend patch to - inspect line segments. - -2005-05-18 Added Orsay and JPL qt fixes - JDH - -2005-05-17 Added a psfrag latex backend -- some alignment issues need - to be worked out. Run with -dLaTeX and a *.tex file and - *.eps file are generated. latex and dvips the generated - latex file to get ps output. Note xdvi *does* not work, - you must generate ps.- JDH - -2005-05-13 Added Florent Rougon's Axis set_label1 - patch - -2005-05-17 pcolor optimization, fixed bug in previous pcolor patch - JSWHIT - -2005-05-16 Added support for masked arrays in pcolor - JSWHIT - - -2005-05-12 Started work on TeX text for antigrain using pngdvi -- see - examples/tex_demo.py and the new module - matplotlib.texmanager. Rotated text not supported and - rendering small glyps is not working right yet. BUt large - fontsizes and/or high dpi saved figs work great. - -2005-05-10 New image resize options interpolation options. New values - for the interp kwarg are - - 'nearest', 'bilinear', 'bicubic', 'spline16', 'spline36', - 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric', - 'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc', - 'lanczos', 'blackman' - - See help(imshow) for details, particularly the - interpolation, filternorm and filterrad kwargs - - -2005-05-10 Applied Eric's contour mem leak fixes - JDH - -2005-05-10 Extended python agg wrapper and started implementing - backend_agg2, an agg renderer based on the python wrapper. - This will be more flexible and easier to extend than the - current backend_agg. See also examples/agg_test.py - JDH - -2005-05-09 Added Marcin's no legend patch to exclude lines from the - autolegend builder - - plot(x, y, label='nolegend') - -2005-05-05 Upgraded to agg23 - -2005-05-05 Added newscalarformatter_demo.py to examples. -DSD - -2005-05-04 Added NewScalarFormatter. Improved formatting of ticklabels, - scientific notation, and the ability to plot large large - numbers with small ranges, by determining a numerical offset. - See ticker.NewScalarFormatter for more details. -DSD - -2005-05-03 Added the option to specify a delimiter in pylab.load -DSD - -2005-04-28 Added Darren's line collection example - -2005-04-28 Fixed aa property in agg - JDH - -2005-04-27 Set postscript page size in .matplotlibrc - DSD - -2005-04-26 Added embedding in qt example. - JDH - -2005-04-14 Applied Michael Brady's qt backend patch: 1) fix a bug - where keyboard input was grabbed by the figure and not - released 2) turn on cursor changes 3) clean up a typo - and commented-out print statement. - JDH - - -2005-04-14 Applied Eric Firing's masked data lines patch and contour - patch. Support for masked arrays has been added to the - plot command and to the Line2D object. Only the valid - points are plotted. A "valid_only" kwarg was added to the - get_xdata() and get_ydata() methods of Line2D; by default - it is False, so that the original data arrays are - returned. Setting it to True returns the plottable points. - - see examples/masked_demo.py - JDH - -2005-04-13 Applied Tim Leslie's arrow key event handling patch - JDH - - -================================================================= -0.80 released - -2005-04-11 Applied a variant of rick's xlim/ylim/axis patch. These - functions now take kwargs to let you selectively alter only - the min or max if desired. e.g., xlim(xmin=2) or - axis(ymax=3). They always return the new lim. - JDH - - -2005-04-11 Incorporated Werner's wx patch -- wx backend should be - compatible with wxpython2.4 and recent versions of 2.5. - Some early versions of wxpython 2.5 will not work because - there was a temporary change in the dc API that was rolled - back to make it 2.4 compliant - -2005-04-11 modified tkagg show so that new figure window pops up on - call to figure - -2005-04-11 fixed wxapp init bug - -2005-04-02 updated backend_ps.draw_lines, draw_markers for use with the - new API - DSD - -2005-04-01 Added editable polygon example - -========================================================================== - -2005-03-31 0.74 released - -2005-03-30 Fixed and added checks for floating point inaccuracy in - ticker.Base - DSD - -2005-03-30 updated /ellipse definition in backend_ps.py to address bug - #1122041 - DSD - -2005-03-29 Added unicode support for Agg and PS - JDH - -2005-03-28 Added Jarrod's svg patch for text - JDH - -2005-03-28 Added Ludal's arrow and quiver patch - JDH - -2005-03-28 Added label kwarg to Axes to facilitate forcing the - creation of new Axes with otherwise identical attributes - -2005-03-28 Applied boxplot and OSX font search patches - -2005-03-27 Added ft2font NULL check to fix Japanase font bug - JDH - -2005-03-27 Added sprint legend patch plus John Gill's tests and fix -- - see examples/legend_auto.py - JDH - -========================================================================== - -2005-03-19 0.73.1 released - -2005-03-19 Reverted wxapp handling because it crashed win32 - JDH - -2005-03-18 Add .number attribute to figure objects returned by figure() - FP - -=========================================================================== -2005-03-18 0.73 released - -2005-03-16 Fixed labelsep bug - -2005-03-16 Applied Darren's ticker fix for small ranges - JDH - -2005-03-16 Fixed tick on horiz colorbar - JDH - -2005-03-16 Added Japanses winreg patch - JDH - -2005-03-15 backend_gtkagg.py: changed to use double buffering, this fixes - the problem reported Joachim Berdal Haga - "Parts of plot lagging - from previous frame in animation". Tested with anim.py and it makes - no noticable difference to performance (23.7 before, 23.6 after) - - SC - -2005-03-14 add src/_backend_gdk.c extension to provide a substitute function - for pixbuf.get_pixels_array(). Currently pixbuf.get_pixels_array() - only works with Numeric, and then only works if pygtk has been - compiled with Numeric support. The change provides a function - pixbuf_get_pixels_array() which works with Numeric and numarray and - is always available. It means that backend_gtk should be able to - display images and mathtext in all circumstances. - SC - -2005-03-11 Upgraded CXX to 5.3.1 - -2005-03-10 remove GraphicsContextPS.set_linestyle() - and GraphicsContextSVG.set_linestyle() since they do no more than - the base class GraphicsContext.set_linestyle() - SC - -2005-03-09 Refactored contour functionality into dedicated module - -2005-03-09 Added Eric's contourf updates and Nadia's clabel functionality - -2005-03-09 Moved colorbar to figure.Figure to expose it for API developers - - JDH - -2005-03-09 backend_cairo.py: implemented draw_markers() - SC - -2005-03-09 cbook.py: only use enumerate() (the python version) if the builtin - version is not available. - Add new function 'izip' which is set to itertools.izip if available - and the python equivalent if not available. - SC - -2005-03-07 backend_gdk.py: remove PIXELS_PER_INCH from points_to_pixels(), but - still use it to adjust font sizes. This allows the GTK version of - line_styles.py to more closely match GTKAgg, previously the markers - were being drawn too large. - SC - -2005-03-01 Added Eric's contourf routines - -2005-03-01 Added start of proper agg SWIG wrapper. I would like to - expose agg functionality directly a the user level and this - module will serve that purpose eventually, and will - hopefully take over most of the functionality of the - current _image and _backend_agg modules. - JDH - -2005-02-28 Fixed polyfit / polyval to convert input args to float - arrays - JDH - - -2005-02-25 Add experimental feature to backend_gtk.py to enable/disable - double buffering (DBL_BUFFER=True/False) - SC - -2005-02-24 colors.py change ColorConverter.to_rgb() so it always returns rgb - (and not rgba), allow cnames keys to be cached, change the exception - raised from RuntimeError to ValueError (like hex2color()) - hex2color() use a regular expression to check the color string is - valid - SC - - -2005-02-23 Added rc param ps.useafm so backend ps can use native afm - fonts or truetype. afme breaks mathtext but causes much - smaller font sizes and may result in images that display - better in some contexts (e.g., pdfs incorporated into latex - docs viewed in acrobat reader). I would like to extend - this approach to allow the user to use truetype only for - mathtext, which should be easy. - -2005-02-23 Used sequence protocol rather than tuple in agg collection - drawing routines for greater flexibility - JDH - - -=========================================================== -2005-02-22 0.72.1 released - -2005-02-21 fixed linestyles for collections -- contour now dashes for - levels <0 - -2005-02-21 fixed ps color bug - JDH - -2005-02-15 fixed missing qt file - -2005-02-15 banished error_msg and report_error. Internal backend - methods like error_msg_gtk are preserved. backend writers, - check your backends, and diff against 0.72 to make sure I - did the right thing! - JDH - - -2005-02-14 Added enthought traits to matplotlib tree - JDH - -=========================================================== - -2005-02-14 0.72 released - -2005-02-14 fix bug in cbook alltrue() and onetrue() - SC - -2005-02-11 updated qtagg backend from Ted - JDH - -2005-02-11 matshow fixes for figure numbering, return value and docs - FP - -2005-02-09 new zorder example for fine control in zorder_demo.py - FP - -2005-02-09 backend renderer draw_lines now has transform in backend, - as in draw_markers; use numerix in _backend_agg, aded small - line optimization to agg - -2005-02-09 subplot now deletes axes that it overlaps - -2005-02-08 Added transparent support for gzipped files in load/save - Fernando - Perez (FP from now on). - -2005-02-08 Small optimizations in PS backend. They may have a big impact for - large plots, otherwise they don't hurt - FP - -2005-02-08 Added transparent support for gzipped files in load/save - Fernando - Perez (FP from now on). - -2005-02-07 Added newstyle path drawing for markers - only implemented - in agg currently - JDH - -2005-02-05 Some superscript text optimizations for ticking log plots - -2005-02-05 Added some default key press events to pylab figures: 'g' - toggles grid - JDH - -2005-02-05 Added some support for handling log switching for lines - that have nonpos data - JDH - -2005-02-04 Added Nadia's contour patch - contour now has matlab - compatible syntax; this also fixed an unequal sized contour - array bug- JDH - -2005-02-04 Modified GTK backends to allow the FigureCanvas to be resized - smaller than its original size - SC - -2005-02-02 Fixed a bug in dates mx2num - JDH - -2005-02-02 Incorporated Fernando's matshow - JDH - -2005-02-01 Added Fernando's figure num patch, including experemental - support for pylab backend switching, LineCOllection.color - warns, savefig now a figure method, fixed a close(fig) bug - - JDH - -2005-01-31 updated datalim in contour - JDH - -2005-01-30 Added backend_qtagg.py provided by Sigve Tjora - SC - -2005-01-28 Added tk.inspect rc param to .matplotlibrc. IDLE users - should set tk.pythoninspect:True and interactive:True and - backend:TkAgg - -2005-01-28 Replaced examples/interactive.py with an updated script from - Fernando Perez - SC - -2005-01-27 Added support for shared x or y axes. See - examples/shared_axis_demo.py and examples/ganged_plots.py - -2005-01-27 Added Lee's patch for missing symbols \leq and \LEFTbracket - to _mathtext_data - JDH - -2005-01-26 Added Baptiste's two scales patch -- see help(twinx) in the - pylab interface for more info. See also - examples/two_scales.py - -2005-01-24 Fixed a mathtext parser bug that prevented font changes in - sub/superscripts - JDH - -2005-01-24 Fixed contour to work w/ interactive changes in colormaps, - clim, etc - JDH - -=============================================================== - -2005-01-21 matplotlib-0.71 released - -2005-01-21 Refactored numerix to solve vexing namespace issues - JDH - -2005-01-21 Applied Nadia's contour bug fix - JDH - -2005-01-20 Made some changes to the contour routine - particularly - region=1 seems t fix a lot of the zigzag strangeness. - Added colormaps as default for contour - JDH - -2005-01-19 Restored builtin names which were overridden (min, max, - abs, round, and sum) in pylab. This is a potentially - significant change for those who were relying on an array - version of those functions that previously overrode builtin - function names. - ADS - -2005-01-18 Added accents to mathtext: \hat, \breve, \grave, \bar, - \acute, \tilde, \vec, \dot, \ddot. All of them have the - same syntax, e.g., to make an overbar you do \bar{o} or to - make an o umlaut you do \ddot{o}. The shortcuts are also - provided, e.g., \"o \'e \`e \~n \.x \^y - JDH - -2005-01-18 Plugged image resize memory leaks - JDH - -2005-01-18 Fixed some mathtext parser problems relating to superscripts - -2005-01-17 Fixed a yticklabel problem for colorbars under change of - clim - JDH - -2005-01-17 Cleaned up Destroy handling in wx reducing memleak/fig from - approx 800k to approx 6k- JDH - -2005-01-17 Added kappa to latex_to_bakoma - JDH - -2005-01-15 Support arbitrary colorbar axes and horizontal colorbars - JDH - -2005-01-15 Fixed colormap number of colors bug so that the colorbar - has the same discretization as the image - JDH - -2005-01-15 Added Nadia's x,y contour fix - JDH - -2005-01-15 backend_cairo: added PDF support which requires pycairo 0.1.4. - Its not usable yet, but is ready for when the Cairo PDF backend - matures - SC - -2005-01-15 Added Nadia's x,y contour fix - -2005-01-12 Fixed set clip_on bug in artist - JDH - -2005-01-11 Reverted pythoninspect in tkagg - JDH - -2005-01-09 Fixed a backend_bases event bug caused when an event is - triggered when location is None - JDH - -2005-01-07 Add patch from Stephen Walton to fix bug in pylab.load() - when the % character is included in a comment. - ADS - -2005-01-07 Added markerscale attribute to Legend class. This allows - the marker size in the legend to be adjusted relative to - that in the plot. - ADS - -2005-01-06 Add patch from Ben Vanhaeren to make the FigureManagerGTK vbox a - public attribute - SC - -==================================================================== -2004-12-30 Release 0.70 - -2004-12-28 Added coord location to key press and added a - examples/picker_demo.py - -2004-12-28 Fixed coords notification in wx toolbar - JDH - -2004-12-28 Moved connection and disconnection event handling to the - FigureCanvasBase. Backends now only need to connect one - time for each of the button press, button release and key - press/release functions. The base class deals with - callbacks and multiple connections. This fixes flakiness - on some backends (tk, wx) in the presence of multiple - connections and/or disconnect - JDH - -2004-12-27 Fixed PS mathtext bug where color was not set - Jochen - please verify correct - JDH - -2004-12-27 Added Shadow class and added shadow kwarg to legend and pie - for shadow effect - JDH - -2004-12-27 Added pie charts and new example/pie_demo.py - -2004-12-23 Fixed an agg text rotation alignment bug, fixed some text - kwarg processing bugs, and added examples/text_rotation.py - to explain and demonstrate how text rotations and alignment - work in matplotlib. - JDH - -====================================================================== - -2004-12-22 0.65.1 released - JDH - -2004-12-22 Fixed colorbar bug which caused colorbar not to respond to - changes in colormap in some instances - JDH - -2004-12-22 Refactored NavigationToolbar in tkagg to support app - embedding , init now takes (canvas, window) rather than - (canvas, figman) - JDH - -2004-12-21 Refactored axes and subplot management - removed - add_subplot and add_axes from the FigureManager. classic - toolbar updates are done via an observer pattern on the - figure using add_axobserver. Figure now maintains the axes - stack (for gca) and supports axes deletion. Ported changes - to GTK, Tk, Wx, and FLTK. Please test! Added delaxes - JDH - -2004-12-21 Lots of image optimizations - 4x performance boost over - 0.65 JDH - -2004-12-20 Fixed a figimage bug where the axes is shown and modified - tkagg to move the destroy binding into the show method. - -2004-12-18 Minor refactoring of NavigationToolbar2 to support - embedding in an application - JDH - -2004-12-14 Added linestyle to collections (currently broken) - JDH - -2004-12-14 Applied Nadia's setupext patch to fix libstdc++ link - problem with contour and solaris -JDH - -2004-12-14 A number of pychecker inspired fixes, including removal of - True and False from cbook which I erroneously thought was - needed for python2.2 - JDH - -2004-12-14 Finished porting doc strings for set introspection. - Used silent_list for many get funcs that return - lists. JDH - -2004-12-13 dates.py: removed all timezone() calls, except for UTC - SC - -====================================================================== - -2004-12-13 0.65 released - JDH - -2004-12-13 colors.py: rgb2hex(), hex2color() made simpler (and faster), also - rgb2hex() - added round() instead of integer truncation - hex2color() - changed 256.0 divisor to 255.0, so now - '#ffffff' becomes (1.0,1.0,1.0) not (0.996,0.996,0.996) - SC - -2004-12-11 Added ion and ioff to pylab interface - JDH - -2004-12-11 backend_template.py: delete FigureCanvasTemplate.realize() - most - backends don't use it and its no longer needed - - backend_ps.py, backend_svg.py: delete show() and - draw_if_interactive() - they are not needed for image backends - - backend_svg.py: write direct to file instead of StringIO - - SC - -2004-12-10 Added zorder to artists to control drawing order of lines, - patches and text in axes. See examples/zoder_demo.py - JDH - -2004-12-10 Fixed colorbar bug with scatter - JDH - -2004-12-10 Added Nadia Dencheva contour code - JDH - -2004-12-10 backend_cairo.py: got mathtext working - SC - -2004-12-09 Added Norm Peterson's svg clipping patch - -2004-12-09 Added Matthew Newville's wx printing patch - -2004-12-09 Migrated matlab to pylab - JDH - -2004-12-09 backend_gtk.py: split into two parts - - backend_gdk.py - an image backend - - backend_gtk.py - A GUI backend that uses GDK - SC - -2004-12-08 backend_gtk.py: remove quit_after_print_xvfb(*args), show_xvfb(), - Dialog_MeasureTool(gtk.Dialog) one month after sending mail to - matplotlib-users asking if anyone still uses these functions - SC - -2004-12-02 backend_bases.py, backend_template.py: updated some of the method - documentation to make them consistent with each other - SC - -2004-12-04 Fixed multiple bindings per event for TkAgg mpl_connect and - mpl_disconnect. Added a "test_disconnect" command line - parameter to coords_demo.py JTM - -2004-12-04 Fixed some legend bugs JDH - -2004-11-30 Added over command for oneoff over plots. e.g., over(plot, x, - y, lw=2). Works with any plot function. - -2004-11-30 Added bbox property to text - JDH - -2004-11-29 Zoom to rect now respect reversed axes limits (for both - linear and log axes). - GL - -2004-11-29 Added the over command to the matlab interface. over - allows you to add an overlay plot regardless of hold - state. - JDH - -2004-11-25 Added Printf to mplutils for printf style format string - formatting in C++ (should help write better exceptions) - -2004-11-24 IMAGE_FORMAT: remove from agg and gtkagg backends as its no longer - used - SC - -2004-11-23 Added matplotlib compatible set and get introspection. See - set_and_get.py - -2004-11-23 applied Norbert's patched and exposed legend configuration - to kwargs - JDH - -2004-11-23 backend_gtk.py: added a default exception handler - SC - -2004-11-18 backend_gtk.py: change so that the backend knows about all image - formats and does not need to use IMAGE_FORMAT in other backends - SC - -2004-11-18 Fixed some report_error bugs in string interpolation as - reported on SF bug tracker- JDH - -2004-11-17 backend_gtkcairo.py: change so all print_figure() calls render using - Cairo and get saved using backend_gtk.print_figure() - SC - -2004-11-13 backend_cairo.py: Discovered the magic number (96) required for - Cairo PS plots to come out the right size. Restored Cairo PS output - and added support for landscape mode - SC - -2004-11-13 Added ishold - JDH - -2004-11-12 Added many new matlab colormaps - autumn bone cool copper - flag gray hot hsv jet pink prism spring summer winter - PG - -2004-11-11 greatly simplify the emitted postscript code - JV - -2004-11-12 Added new plotting functions spy, spy2 for sparse matrix - visualization - JDH - -2004-11-11 Added rgrids, thetragrids for customizing the grid - locations and labels for polar plots - JDH - -2004-11-11 make the Gtk backends build without an X-server connection - JV - -2004-11-10 matplotlib/__init__.py: Added FROZEN to signal we are running under - py2exe (or similar) - is used by backend_gtk.py - SC - -2004-11-09 backend_gtk.py: Made fix suggested by maffew@cat.org.au - to prevent problems when py2exe calls pygtk.require(). - SC - -2004-11-09 backend_cairo.py: Added support for printing to a fileobject. - Disabled cairo PS output which is not working correctly. - SC - -============================================================== -2004-11-08 matplotlib-0.64 released - -2004-11-04 Changed -dbackend processing to only use known backends, so - we don't clobber other non-matplotlib uses of -d, like -debug. - -2004-11-04 backend_agg.py: added IMAGE_FORMAT to list the formats that the - backend can save to. - backend_gtkagg.py: added support for saving JPG files by using the - GTK backend - SC - -2004-10-31 backend_cairo.py: now produces png and ps files (although the figure - sizing needs some work). pycairo did not wrap all the necessary - functions, so I wrapped them myself, they are included in the - backend_cairo.py doc string. - SC - -2004-10-31 backend_ps.py: clean up the generated PostScript code, use - the PostScript stack to hold itermediate values instead of - storing them in the dictionary. - JV - -2004-10-30 backend_ps.py, ft2font.cpp, ft2font.h: fix the position of - text in the PostScript output. The new FT2Font method - get_descent gives the distance between the lower edge of - the bounding box and the baseline of a string. In - backend_ps the text is shifted upwards by this amount. - JV - -2004-10-30 backend_ps.py: clean up the code a lot. Change the - PostScript output to be more DSC compliant. All - definitions for the generated PostScript are now in a - PostScript dictionary 'mpldict'. Moved the long comment - about drawing ellipses from the PostScript output into a - Python comment. - JV - -2004-10-30 backend_gtk.py: removed FigureCanvasGTK.realize() as its no longer - needed. Merged ColorManager into GraphicsContext - backend_bases.py: For set_capstyle/joinstyle() only set cap or - joinstyle if there is no error. - SC - -2004-10-30 backend_gtk.py: tidied up print_figure() and removed some of the - dependency on widget events - SC - -2004-10-28 backend_cairo.py: The renderer is complete except for mathtext, - draw_image() and clipping. gtkcairo works reasonably well. cairo - does not yet create any files since I can't figure how to set the - 'target surface', I don't think pycairo wraps the required functions - - SC - -2004-10-28 backend_gtk.py: Improved the save dialog (GTK 2.4 only) so it - presents the user with a menu of supported image formats - SC - -2004-10-28 backend_svg.py: change print_figure() to restore original face/edge - color - backend_ps.py : change print_figure() to ensure original face/edge - colors are restored even if there's an IOError - SC - -2004-10-27 Applied Norbert's errorbar patch to support barsabove kwarg - -2004-10-27 Applied Norbert's legend patch to support None handles - -2004-10-27 Added two more backends: backend_cairo.py, backend_gtkcairo.py - They are not complete yet, currently backend_gtkcairo just renders - polygons, rectangles and lines - SC - -2004-10-21 Added polar axes and plots - JDH - -2004-10-20 Fixed corrcoef bug exposed by corrcoef(X) where X is matrix - - JDH - -2004-10-19 Added kwarg support to xticks and yticks to set ticklabel - text properties -- thanks to T. Edward Whalen for the suggestion - -2004-10-19 Added support for PIL images in imshow(), image.py - ADS - -2004-10-19 Re-worked exception handling in _image.py and _transforms.py - to avoid masking problems with shared libraries. - JTM - -2004-10-16 Streamlined the matlab interface wrapper, removed the - noplot option to hist - just use mlab.hist instead. - -2004-09-30 Added Andrew Dalke's strftime code to extend the range of - dates supported by the DateFormatter - JDH - -2004-09-30 Added barh - JDH - -2004-09-30 Removed fallback to alternate array package from numerix - so that ImportErrors are easier to debug. JTM - -2004-09-30 Add GTK+ 2.4 support for the message in the toolbar. SC - -2004-09-30 Made some changes to support python22 - lots of doc - fixes. - JDH - -2004-09-29 Added a Verbose class for reporting - JDH - -============================================================== - -2004-09-28 Released 0.63.0 - -2004-09-28 Added save to file object for agg - see - examples/print_stdout.py - -2004-09-24 Reorganized all py code to lib subdir - -2004-09-24 Fixed axes resize image edge effects on interpolation - - required upgrade to agg22 which fixed an agg bug related to - this problem - -2004-09-20 Added toolbar2 message display for backend_tkagg. JTM - - -2004-09-17 Added coords formatter attributes. These must be callable, - and return a string for the x or y data. These will be used - to format the x and y data for the coords box. Default is - the axis major formatter. e.g.: - - # format the coords message box - def price(x): return '$%1.2f'%x - ax.format_xdata = DateFormatter('%Y-%m-%d') - ax.format_ydata = price - - -2004-09-17 Total rewrite of dates handling to use python datetime with - num2date, date2num and drange. pytz for timezone handling, - dateutils for spohisticated ticking. date ranges from - 0001-9999 are supported. rrules allow arbitrary date - ticking. examples/date_demo*.py converted to show new - usage. new example examples/date_demo_rrule.py shows how - to use rrules in date plots. The date locators are much - more general and almost all of them have different - constructors. See matplotlib.dates for more info. - -2004-09-15 Applied Fernando's backend __init__ patch to support easier - backend maintenance. Added his numutils to mlab. JDH - -2004-09-16 Re-designated all files in matplotlib/images as binary and - w/o keyword substitution using "cvs admin -kb *.svg ...". - See binary files in "info cvs" under Linux. This was messing - up builds from CVS on windows since CVS was doing lf -> cr/lf - and keyword substitution on the bitmaps. - JTM - -2004-09-15 Modified setup to build array-package-specific extensions - for those extensions which are array-aware. Setup builds - extensions automatically for either Numeric, numarray, or - both, depending on what you have installed. Python proxy - modules for the array-aware extensions import the version - optimized for numarray or Numeric determined by numerix. - - JTM - -2004-09-15 Moved definitions of infinity from mlab to numerix to avoid - divide by zero warnings for numarray - JTM - -2004-09-09 Added axhline, axvline, axhspan and axvspan - -============================================================== -2004-08-30 matplotlib 0.62.4 released - -2004-08-30 Fixed a multiple images with different extent bug, - Fixed markerfacecolor as RGB tuple - -2004-08-27 Mathtext now more than 5x faster. Thanks to Paul Mcguire - for fixes both to pyparsing and to the matplotlib grammar! - mathtext broken on python2.2 - -2004-08-25 Exposed Darren's and Greg's log ticking and formatting - options to semilogx and friends - -2004-08-23 Fixed grid w/o args to toggle grid state - JDH - -2004-08-11 Added Gregory's log patches for major and minor ticking - -2004-08-18 Some pixel edge effects fixes for images - -2004-08-18 Fixed TTF files reads in backend_ps on win32. - -2004-08-18 Added base and subs properties for logscale plots, user - modifiable using - set_[x,y]scale('log',base=b,subs=[mt1,mt2,...]) - GL - -2004-08-18 fixed a bug exposed by trying to find the HOME dir on win32 - thanks to Alan Issac for pointing to the light - JDH - -2004-08-18 fixed errorbar bug in setting ecolor - JDH - -2004-08-12 Added Darren Dale's exponential ticking patch - -2004-08-11 Added Gregory's fltkagg backend - -========================================================================== -2004-08-09 matplotlib-0.61.0 released - -2004-08-08 backend_gtk.py: get rid of the final PyGTK deprecation warning by - replacing gtkOptionMenu with gtkMenu in the 2.4 version of the - classic toolbar. - -2004-08-06 Added Tk zoom to rect rectangle, proper idle drawing, and - keybinding - JDH - -2004-08-05 Updated installing.html and INSTALL - JDH - -2004-08-01 backend_gtk.py: move all drawing code into the expose_event() - -2004-07-28 Added Greg's toolbar2 and backend_*agg patches - JDH - -2004-07-28 Added image.imread with support for loading png into - numerix arrays - -2004-07-28 Added key modifiers to events - implemented dynamic updates - and rubber banding for interactive pan/zoom - JDH - -2004-07-27 did a readthrough of SVG, replacing all the string - additions with string interps for efficiency, fixed some - layout problems, added font and image support (through - external pngs) - JDH - -2004-07-25 backend_gtk.py: modify toolbar2 to make it easier to support GTK+ - 2.4. Add GTK+ 2.4 toolbar support. - SC - -2004-07-24 backend_gtk.py: Simplified classic toolbar creation - SC - -2004-07-24 Added images/matplotlib.svg to be used when GTK+ windows are - minimised - SC - -2004-07-22 Added right mouse click zoom for NavigationToolbar2 panning - mode. - JTM - -2004-07-22 Added NavigationToolbar2 support to backend_tkagg. - Minor tweak to backend_bases. - JTM - -2004-07-22 Incorporated Gergory's renderer cache and buffer object - cache - JDH - -2004-07-22 Backend_gtk.py: Added support for GtkFileChooser, changed - FileSelection/FileChooser so that only one instance pops up, - and made them both modal. - SC - -2004-07-21 Applied backend_agg memory leak patch from hayden - - jocallo@online.no. Found and fixed a leak in binary - operations on transforms. Moral of the story: never incref - where you meant to decref! Fixed several leaks in ft2font: - moral of story: almost always return Py::asObject over - Py::Object - JDH - -2004-07-21 Fixed a to string memory allocation bug in agg and image - modules - JDH - -2004-07-21 Added mpl_connect and mpl_disconnect to matlab interface - - JDH - -2004-07-21 Added beginnings of users_guide to CVS - JDH - -2004-07-20 ported toolbar2 to wx - -2004-07-20 upgraded to agg21 - JDH - -2004-07-20 Added new icons for toolbar2 - JDH - -2004-07-19 Added vertical mathtext for *Agg and GTK - thanks Jim - Benson! - JDH - -2004-07-16 Added ps/eps/svg savefig options to wx and gtk JDH - -2004-07-15 Fixed python framework tk finder in setupext.py - JDH - -2004-07-14 Fixed layer images demo which was broken by the 07/12 image - extent fixes - JDH - -2004-07-13 Modified line collections to handle arbitrary length - segments for each line segment. - JDH - -2004-07-13 Fixed problems with image extent and origin - - set_image_extent deprecated. Use imshow(blah, blah, - extent=(xmin, xmax, ymin, ymax) instead - JDH - -2004-07-12 Added prototype for new nav bar with codifed event - handling. Use mpl_connect rather than connect for - matplotlib event handling. toolbar style determined by rc - toolbar param. backend status: gtk: prototype, wx: in - progress, tk: not started - JDH - -2004-07-11 backend_gtk.py: use builtin round() instead of redefining it. - - SC - -2004-07-10 Added embedding_in_wx3 example - ADS - -2004-07-09 Added dynamic_image_wxagg to examples - ADS - -2004-07-09 added support for embedding TrueType fonts in PS files - PEB - -2004-07-09 fixed a sfnt bug exposed if font cache is not built - -2004-07-09 added default arg None to matplotlib.matlab grid command to - toggle current grid state - -============================ - -2004-07-08 0.60.2 released - -2004-07-08 fixed a mathtext bug for '6' - -2004-07-08 added some numarray bug workarounds - -======= - -2004-07-07 0.60 released - -2004-07-07 Fixed a bug in dynamic_demo_wx - - -2004-07-07 backend_gtk.py: raise SystemExit immediately if - 'import pygtk' fails - SC - -2004-07-05 Added new mathtext commands \over{sym1}{sym2} and - \under{sym1}{sym2} - -2004-07-05 Unified image and patch collections colormapping and - scaling args. Updated docstrings for all - JDH - -2004-07-05 Fixed a figure legend bug and added - examples/figlegend_demo.py - JDH - -2004-07-01 Fixed a memory leak in image and agg to string methods - -2004-06-25 Fixed fonts_demo spacing problems and added a kwargs - version of the fonts_demo fonts_demo_kw.py - JDH - -2004-06-25 finance.py: handle case when urlopen() fails - SC - -2004-06-24 Support for multiple images on axes and figure, with - blending. Support for upper and lower image origins. - clim, jet and gray functions in matlab interface operate on - current image - JDH - -2004-06-23 ported code to Perry's new colormap and norm scheme. Added - new rc attributes image.aspect, image.interpolation, - image.cmap, image.lut, image.origin - -2004-06-20 backend_gtk.py: replace gtk.TRUE/FALSE with True/False. - simplified _make_axis_menu(). - SC - -2004-06-19 anim_tk.py: Updated to use TkAgg by default (not GTK) - backend_gtk_py: Added '_' in front of private widget - creation functions - SC - -2004-06-17 backend_gtk.py: Create a GC once in realise(), not every - time draw() is called. - SC - -2004-06-16 Added new py2exe FAQ entry and added frozen support in - get_data_path for py2exe - JDH - -2004-06-16 Removed GTKGD, which was always just a proof-of-concept - backend - JDH - -2004-06-16 backend_gtk.py updates to replace deprecated functions - gtk.mainquit(), gtk.mainloop(). - Update NavigationToolbar to use the new GtkToolbar API - SC - -2004-06-15 removed set_default_font from font_manager to unify font - customization using the new function rc. See API_CHANGES - for more info. The examples fonts_demo.py and - fonts_demo_kw.py are ported to the new API - JDH - -2004-06-15 Improved (yet again!) axis scaling to properly handle - singleton plots - JDH - -2004-06-15 Restored the old FigureCanvasGTK.draw() - SC - -2004-06-11 More memory leak fixes in transforms and ft2font - JDH - -2004-06-11 Eliminated numerix .numerix file and environment variable - NUMERIX. Fixed bug which prevented command line overrides: - --numarray or --numeric. - JTM - -2004-06-10 Added rc configuration function rc; deferred all rc param - setting until object creation time; added new rc attrs: - lines.markerfacecolor, lines.markeredgecolor, - lines.markeredgewidth, patch.linewidth, patch.facecolor, - patch.edgecolor, patch.antialiased; see - examples/customize_rc.py for usage - JDH - - ---------------------------------------------------------------- -2004-06-09 0.54.2 released - -2004-06-08 Rewrote ft2font using CXX as part of general memory leak - fixes; also fixed transform memory leaks - JDH - -2004-06-07 Fixed several problems with log ticks and scaling - JDH - -2004-06-07 Fixed width/height issues for images - JDH - -2004-06-03 Fixed draw_if_interactive bug for semilogx; - -2004-06-02 Fixed text clipping to clip to axes - JDH - -2004-06-02 Fixed leading newline text and multiple newline text - JDH - -2004-06-02 Fixed plot_date to return lines - JDH - -2004-06-01 Fixed plot to work with x or y having shape N,1 or 1,N - JDH - -2004-05-31 Added renderer markeredgewidth attribute of Line2D. - ADS - -2004-05-29 Fixed tick label clipping to work with navigation. - -2004-05-28 Added renderer grouping commands to support groups in - SVG/PS. - JDH - -2004-05-28 Fixed, this time I really mean it, the singleton plot - plot([0]) scaling bug; Fixed Flavio's shape = N,1 bug - JDH - -2004-05-28 added colorbar - JDH - -2004-05-28 Made some changes to the matplotlib.colors.Colormap to - propertly support clim - JDH - ------------------------------------------------------------------ -2004-05-27 0.54.1 released - -2004-05-27 Lots of small bug fixes: rotated text at negative angles, - errorbar capsize and autoscaling, right tick label - position, gtkagg on win98, alpha of figure background, - singleton plots - JDH - -2004-05-26 Added Gary's errorbar stuff and made some fixes for length - one plots and constant data plots - JDH - -2004-05-25 Tweaked TkAgg backend so that canvas.draw() works - more like the other backends. Fixed a bug resulting - in 2 draws per figure mangager show(). - JTM - ------------------------------------------------------------- -2004-05-19 0.54 released - -2004-05-18 Added newline seperated text with rotations to text.Text - layout - JDH - -2004-05-16 Added fast pcolor using PolyCollections. - JDH - -2004-05-14 Added fast polygon collections - changed scatter to use - them. Added multiple symbols to scatter. 10x speedup on - large scatters using *Agg and 5X speedup for ps. - JDH - -2004-05-14 On second thought... created an "nx" namespace in - in numerix which maps type names onto typecodes - the same way for both numarray and Numeric. This - undoes my previous change immediately below. To get a - typename for Int16 useable in a Numeric extension: - say nx.Int16. - JTM - -2004-05-15 Rewrote transformation class in extension code, simplified - all the artist constructors - JDH - -2004-05-14 Modified the type definitions in the numarray side of - numerix so that they are Numeric typecodes and can be - used with Numeric compilex extensions. The original - numarray types were renamed to type. - JTM - -2004-05-06 Gary Ruben sent me a bevy of new plot symbols and markers. - See matplotlib.matlab.plot - JDH - -2004-05-06 Total rewrite of mathtext - factored ft2font stuff out of - layout engine and defined abstract class for font handling - to lay groundwork for ps mathtext. Rewrote parser and made - layout engine much more precise. Fixed all the layout - hacks. Added spacing commands \/ and \hspace. Added - composite chars and defined angstrom. - JDH - -2004-05-05 Refactored text instances out of backend; aligned - text with arbitrary rotations is now supported - JDH - -2004-05-05 Added a Matrix capability for numarray to numerix. JTM - -2004-05-04 Updated whats_new.html.template to use dictionary and - template loop, added anchors for all versions and items; - updated goals.txt to use those for links. PG - -2004-05-04 Added fonts_demo.py to backend_driver, and AFM and TTF font - caches to font_manager.py - PEB - -2004-05-03 Redid goals.html.template to use a goals.txt file that - has a pseudo restructured text organization. PG - -2004-05-03 Removed the close buttons on all GUIs and added the python - #! bang line to the examples following Steve Chaplin's - advice on matplotlib dev - -2004-04-29 Added CXX and rewrote backend_agg using it; tracked down - and fixed agg memory leak - JDH - -2004-04-29 Added stem plot command - JDH - -2004-04-28 Fixed PS scaling and centering bug - JDH - -2004-04-26 Fixed errorbar autoscale problem - JDH - -2004-04-22 Fixed copy tick attribute bug, fixed singular datalim - ticker bug; fixed mathtext fontsize interactive bug. - JDH - -2004-04-21 Added calls to draw_if_interactive to axes(), legend(), - and pcolor(). Deleted duplicate pcolor(). - JTM - ------------------------------------------------------------- -2004-04-21 matplotlib 0.53 release - -2004-04-19 Fixed vertical alignment bug in PS backend - JDH - -2004-04-17 Added support for two scales on the "same axes" with tick - different ticking and labeling left right or top bottom. - See examples/two_scales.py - JDH - -2004-04-17 Added default dirs as list rather than single dir in - setupext.py - JDH - -2004-04-16 Fixed wx exception swallowing bug (and there was much - rejoicing!) - JDH - -2004-04-16 Added new ticker locator a formatter, fixed default font - return - JDH - -2004-04-16 Added get_name method to FontProperties class. Fixed font lookup - in GTK and WX backends. - PEB - -2004-04-16 Added get- and set_fontstyle msethods. - PEB - -2004-04-10 Mathtext fixes: scaling with dpi, - JDH - -2004-04-09 Improved font detection algorithm. - PEB - -2004-04-09 Move deprecation warnings from text.py to __init__.py - PEB - -2004-04-09 Added default font customization - JDH - -2004-04-08 Fixed viewlim set problem on axes and axis. - JDH - -2004-04-07 Added validate_comma_sep_str and font properties paramaters to - __init__. Removed font families and added rcParams to - FontProperties __init__ arguments in font_manager. Added - default font property parameters to .matplotlibrc file with - descriptions. Added deprecation warnings to the get_- and - set_fontXXX methods of the Text object. - PEB - -2004-04-06 Added load and save commands for ASCII data - JDH - -2004-04-05 Improved font caching by not reading AFM fonts until needed. - Added better documentation. Changed the behaviour of the - get_family, set_family, and set_name methods of FontProperties. - - PEB - -2004-04-05 Added WXAgg backend - JDH - -2004-04-04 Improved font caching in backend_agg with changes to - font_manager - JDH - -2004-03-29 Fixed fontdicts and kwargs to work with new font manager - - JDH - - - - - - - - --------------------------------------------- -This is the Old, stale, never used changelog - -2002-12-10 - Added a TODO file and CHANGELOG. Lots to do -- get - crackin'! - - - Fixed y zoom tool bug - - - Adopted a compromise fix for the y data clipping problem. - The problem was that for solid lines, the y data clipping - (as opposed to the gc clipping) caused artifactual - horizontal solid lines near the ylim boundaries. I did a - 5% offset hack in Axes set_ylim functions which helped, - but didn't cure the problem for very high gain y zooms. - So I disabled y data clipping for connected lines . If - you need extensive y clipping, either plot(y,x) because x - data clipping is always enabled, or change the _set_clip - code to 'if 1' as indicated in the lines.py src. See - _set_clip in lines.py and set_ylim in figure.py for more - information. - - -2002-12-11 - Added a measurement dialog to the figure window to - measure axes position and the delta x delta y with a left - mouse drag. These defaults can be overridden by deriving - from Figure and overrriding button_press_event, - button_release_event, and motion_notify_event, - and _dialog_measure_tool. - - - fixed the navigation dialog so you can check the axes the - navigation buttons apply to. - - - -2003-04-23 Released matplotlib v0.1 - -2003-04-24 Added a new line style PixelLine2D which is the plots the - markers as pixels (as small as possible) with format - symbol ',' - - Added a new class Patch with derived classes Rectangle, - RegularPolygon and Circle - -2003-04-25 Implemented new functions errorbar, scatter and hist - - Added a new line type '|' which is a vline. syntax is - plot(x, Y, '|') where y.shape = len(x),2 and each row gives - the ymin,ymax for the respective values of x. Previously I - had implemented vlines as a list of lines, but I needed the - efficientcy of the numeric clipping for large numbers of - vlines outside the viewport, so I wrote a dedicated class - Vline2D which derives from Line2D - - -2003-05-01 - - Fixed ytick bug where grid and tick show outside axis viewport with gc clip - -2003-05-14 - - Added new ways to specify colors 1) matlab format string 2) - html-style hex string, 3) rgb tuple. See examples/color_demo.py - -2003-05-28 - - Changed figure rendering to draw form a pixmap to reduce flicker. - See examples/system_monitor.py for an example where the plot is - continusouly updated w/o flicker. This example is meant to - simulate a system monitor that shows free CPU, RAM, etc... - -2003-08-04 - - Added Jon Anderson's GTK shell, which doesn't require pygtk to - have threading built-in and looks nice! - -2003-08-25 - - Fixed deprecation warnings for python2.3 and pygtk-1.99.18 - -2003-08-26 - - Added figure text with new example examples/figtext.py - - -2003-08-27 - - Fixed bugs i figure text with font override dictionairies and fig - text that was placed outside the window bounding box - -2003-09-1 thru 2003-09-15 - - Added a postscript and a GD module backend - -2003-09-16 - - Fixed font scaling and point scaling so circles, squares, etc on - lines will scale with DPI as will fonts. Font scaling is not fully - implemented on the gtk backend because I have not figured out how - to scale fonts to arbitrary sizes with GTK - -2003-09-17 - - Fixed figure text bug which crashed X windows on long figure text - extending beyond display area. This was, I believe, due to the - vestigial erase functionality that was no longer needed since I - began rendering to a pixmap - -2003-09-30 Added legend - -2003-10-01 Fixed bug when colors are specified with rgb tuple or hex - string. - - -2003-10-21 Andrew Straw provided some legend code which I modified - and incorporated. Thanks Andrew! - -2003-10-27 Fixed a bug in axis.get_view_distance that affected zoom in - versus out with interactive scrolling, and a bug in the axis text - reset system that prevented the text from being redrawn on a - interactive gtk view lim set with the widget - - Fixed a bug in that prevented the manual setting of ticklabel - strings from working properly - -2003-11-02 - Do a nearest neighbor color pick on GD when - allocate fails - -2003-11-02 - - Added pcolor plot - - Added MRI example - - Fixed bug that screwed up label position if xticks or yticks were - empty - - added nearest neighbor color picker when GD max colors exceeded - - fixed figure background color bug in GD backend - -2003-11-10 - 2003-11-11 - - major refactoring. - * Ticks (with labels, lines and grid) handled by dedicated class - * Artist now know bounding box and dpi - * Bounding boxes and transforms handled by dedicated classes - * legend in dedicated class. Does a better job of alignment and - bordering. Can be initialized with specific line instances. - See examples/legend_demo2.py - - -2003-11-14 Fixed legend positioning bug and added new position args - -2003-11-16 Finsihed porting GD to new axes API - - -2003-11-20 - add TM for matlab on website and in docs - - -2003-11-20 - make a nice errorbar and scatter screenshot - -2003-11-20 - auto line style cycling for multiple line types - broken - -2003-11-18 (using inkrect) :logical rect too big on gtk backend - -2003-11-18 ticks don't reach edge of axes in gtk mode -- - rounding error? - -2003-11-20 - port Gary's errorbar code to new API before 0.40 - -2003-11-20 - problem with stale _set_font. legend axes box - doesn't resize on save in GTK backend -- see htdocs legend_demo.py - -2003-11-21 - make a dash-dot dict for the GC - -2003-12-15 - fix install path bug diff --git a/_static/contour_frontpage.png b/_static/contour_frontpage.png deleted file mode 100644 index 95be3ba8619..00000000000 Binary files a/_static/contour_frontpage.png and /dev/null differ diff --git a/_static/histogram_frontpage.png b/_static/histogram_frontpage.png deleted file mode 100644 index b434ab86454..00000000000 Binary files a/_static/histogram_frontpage.png and /dev/null differ diff --git a/_static/membrane_frontpage.png b/_static/membrane_frontpage.png deleted file mode 100644 index 2aee3c2cfc5..00000000000 Binary files a/_static/membrane_frontpage.png and /dev/null differ diff --git a/_static/surface3d_frontpage.png b/_static/surface3d_frontpage.png deleted file mode 100644 index 8ef7cf53def..00000000000 Binary files a/_static/surface3d_frontpage.png and /dev/null differ diff --git a/api/_as_gen/matplotlib.animation.Animation.save.html b/api/_as_gen/matplotlib.animation.Animation.save.html deleted file mode 100644 index e0939983d60..00000000000 --- a/api/_as_gen/matplotlib.animation.Animation.save.html +++ /dev/null @@ -1,398 +0,0 @@ - - - - - - - - matplotlib.animation.Animation.save — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

matplotlib.animation.Animation.save

-
-
-Animation.save(filename, writer=None, fps=None, dpi=None, codec=None, bitrate=None, extra_args=None, metadata=None, extra_anim=None, savefig_kwargs=None)
-

Saves a movie file by drawing every frame.

- --- - - - -
Parameters:

filename : str

-
-

The output filename, e.g., mymovie.mp4

-
-

writer : MovieWriter or str, optional

-
-

A MovieWriter instance to use or a key that identifies a -class to use, such as ‘ffmpeg’ or ‘mencoder’. If None, -defaults to rcParams['animation.writer']

-
-

fps : number, optional

-
-

frames per second in the movie. Defaults to None, -which will use the animation’s specified interval to set -the frames per second.

-
-

dpi : number, optional

-
-

Controls the dots per inch for the movie frames. This -combined with the figure’s size in inches controls the size of -the movie. If None, defaults to rcparam['savefig.dpi']

-
-

codec : str, optional

-
-

The video codec to be used. Not all codecs are supported by -a given MovieWriter. If None, -default to rcParams['animation.codec']

-
-

bitrate : number, optional

-
-

Specifies the number of bits used per second in the -compressed movie, in kilobits per second. A higher number -means a higher quality movie, but at the cost of increased -file size. If None, defaults to -rcParam['animation.bitrate']

-
-

extra_args : list, optional

-
-

List of extra string arguments to be passed to the -underlying movie utility. If None, defaults to -rcParams['animation.extra_args']

-
-

metadata : dict, optional

-
-

Dictionary of keys and values for metadata to include in -the output file. Some keys that may be of use include: -title, artist, genre, subject, copyright, srcform, comment.

-
-

extra_anim : list, optional

-
-

Additional Animation objects that should be included in -the saved movie file. These need to be from the same -matplotlib.Figure instance. Also, animation frames will -just be simply combined, so there should be a 1:1 -correspondence between the frames from the different -animations.

-
-

savefig_kwargs : dict, optional

-
-

Is a dictionary containing keyword arguments to be passed -on to the ‘savefig’ command which is called repeatedly to -save the individual frames.

-
-
-

Notes

-

fps, codec, bitrate, extra_args, metadata are used to -construct a MovieWriter instance and can only be -passed if writer is a string. If they are passed as -non-None and writer is a MovieWriter, a -RuntimeError will be raised.

-
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/api/_as_gen/matplotlib.animation.Animation.to_html5_video.html b/api/_as_gen/matplotlib.animation.Animation.to_html5_video.html deleted file mode 100644 index e72f7d1adf2..00000000000 --- a/api/_as_gen/matplotlib.animation.Animation.to_html5_video.html +++ /dev/null @@ -1,326 +0,0 @@ - - - - - - - - matplotlib.animation.Animation.to_html5_video — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

matplotlib.animation.Animation.to_html5_video

-
-
-Animation.to_html5_video()
-

Returns animation as an HTML5 video tag.

-

This saves the animation as an h264 video, encoded in base64 -directly into the HTML5 video tag. This respects the rc parameters -for the writer as well as the bitrate. This also makes use of the -interval to control the speed, and uses the repeat -parameter to decide whether to loop.

-
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/api/_as_gen/matplotlib.animation.FileMovieWriter.setup.html b/api/_as_gen/matplotlib.animation.FileMovieWriter.setup.html deleted file mode 100644 index e7f3f8d09c2..00000000000 --- a/api/_as_gen/matplotlib.animation.FileMovieWriter.setup.html +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - matplotlib.animation.FileMovieWriter.setup — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

matplotlib.animation.FileMovieWriter.setup

-
-
-FileMovieWriter.setup(fig, outfile, dpi, frame_prefix='_tmp', clear_temp=True)
-

Perform setup for writing the movie file.

- --- - - - -
Parameters:

fig : matplotlib.figure.Figure

-
-

The figure to grab the rendered frames from.

-
-

outfile : str

-
-

The filename of the resulting movie file.

-
-

dpi : number

-
-

The dpi of the output file. This, with the figure size, -controls the size in pixels of the resulting movie file.

-
-

frame_prefix : str, optional

-
-

The filename prefix to use for temporary files. Defaults to -‘_tmp’.

-
-

clear_temp : bool, optional

-
-

If the temporary files should be deleted after stitching -the final result. Setting this to False can be useful for -debugging. Defaults to True.

-
-
-
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/api/_as_gen/matplotlib.animation.MovieWriter.finish.html b/api/_as_gen/matplotlib.animation.MovieWriter.finish.html deleted file mode 100644 index dcc6acee2ff..00000000000 --- a/api/_as_gen/matplotlib.animation.MovieWriter.finish.html +++ /dev/null @@ -1,321 +0,0 @@ - - - - - - - - matplotlib.animation.MovieWriter.finish — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

matplotlib.animation.MovieWriter.finish

-
-
-MovieWriter.finish()
-

Finish any processing for writing the movie.

-
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/api/_as_gen/matplotlib.animation.MovieWriter.grab_frame.html b/api/_as_gen/matplotlib.animation.MovieWriter.grab_frame.html deleted file mode 100644 index 8db9f1b781d..00000000000 --- a/api/_as_gen/matplotlib.animation.MovieWriter.grab_frame.html +++ /dev/null @@ -1,323 +0,0 @@ - - - - - - - - matplotlib.animation.MovieWriter.grab_frame — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

matplotlib.animation.MovieWriter.grab_frame

-
-
-MovieWriter.grab_frame(**savefig_kwargs)
-

Grab the image information from the figure and save as a movie frame.

-

All keyword arguments in savefig_kwargs are passed on to the ‘savefig’ -command that saves the figure.

-
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/api/_as_gen/matplotlib.animation.MovieWriter.saving.html b/api/_as_gen/matplotlib.animation.MovieWriter.saving.html deleted file mode 100644 index 94a35090979..00000000000 --- a/api/_as_gen/matplotlib.animation.MovieWriter.saving.html +++ /dev/null @@ -1,322 +0,0 @@ - - - - - - - - matplotlib.animation.MovieWriter.saving — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

matplotlib.animation.MovieWriter.saving

-
-
-MovieWriter.saving(*args, **kw)
-

Context manager to facilitate writing the movie file.

-

*args, **kw are any parameters that should be passed to setup.

-
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/api/_as_gen/matplotlib.animation.MovieWriter.setup.html b/api/_as_gen/matplotlib.animation.MovieWriter.setup.html deleted file mode 100644 index f4796633506..00000000000 --- a/api/_as_gen/matplotlib.animation.MovieWriter.setup.html +++ /dev/null @@ -1,342 +0,0 @@ - - - - - - - - matplotlib.animation.MovieWriter.setup — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

matplotlib.animation.MovieWriter.setup

-
-
-MovieWriter.setup(fig, outfile, dpi)
-

Perform setup for writing the movie file.

- --- - - - -
Parameters:

fig : matplotlib.Figure instance

-
-

The figure object that contains the information for frames

-
-

outfile : string

-
-

The filename of the resulting movie file

-
-

dpi : int

-
-

The DPI (or resolution) for the file. This controls the size -in pixels of the resulting movie file.

-
-
-
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/api/_as_gen/matplotlib.artist.Artist.get_axes.html b/api/_as_gen/matplotlib.artist.Artist.get_axes.html deleted file mode 100644 index ba1312c946d..00000000000 --- a/api/_as_gen/matplotlib.artist.Artist.get_axes.html +++ /dev/null @@ -1,324 +0,0 @@ - - - - - - - - matplotlib.artist.Artist.get_axes — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

matplotlib.artist.Artist.get_axes

-
-
-Artist.get_axes()
-

Return the Axes instance the artist -resides in, or None.

-

This has been deprecated in mpl 1.5, please use the -axes property. Will be removed in 1.7 or 2.0.

-
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/api/_as_gen/matplotlib.artist.Artist.set_axes.html b/api/_as_gen/matplotlib.artist.Artist.set_axes.html deleted file mode 100644 index 6fd400e99f7..00000000000 --- a/api/_as_gen/matplotlib.artist.Artist.set_axes.html +++ /dev/null @@ -1,325 +0,0 @@ - - - - - - - - matplotlib.artist.Artist.set_axes — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

matplotlib.artist.Artist.set_axes

-
-
-Artist.set_axes(axes)
-

Set the Axes instance in which the -artist resides, if any.

-

This has been deprecated in mpl 1.5, please use the -axes property. Will be removed in 1.7 or 2.0.

-

ACCEPTS: an Axes instance

-
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/api/_as_gen/matplotlib.axes.Axes.get_axes.html b/api/_as_gen/matplotlib.axes.Axes.get_axes.html deleted file mode 100644 index 2e859b79b41..00000000000 --- a/api/_as_gen/matplotlib.axes.Axes.get_axes.html +++ /dev/null @@ -1,324 +0,0 @@ - - - - - - - - matplotlib.axes.Axes.get_axes — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

matplotlib.axes.Axes.get_axes

-
-
-Axes.get_axes()
-

Return the Axes instance the artist -resides in, or None.

-

This has been deprecated in mpl 1.5, please use the -axes property. Will be removed in 1.7 or 2.0.

-
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/api/_as_gen/matplotlib.axes.Axes.set_axes.html b/api/_as_gen/matplotlib.axes.Axes.set_axes.html deleted file mode 100644 index 34194809b9c..00000000000 --- a/api/_as_gen/matplotlib.axes.Axes.set_axes.html +++ /dev/null @@ -1,325 +0,0 @@ - - - - - - - - matplotlib.axes.Axes.set_axes — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

matplotlib.axes.Axes.set_axes

-
-
-Axes.set_axes(axes)
-

Set the Axes instance in which the -artist resides, if any.

-

This has been deprecated in mpl 1.5, please use the -axes property. Will be removed in 1.7 or 2.0.

-

ACCEPTS: an Axes instance

-
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/api/_as_gen/matplotlib.axis.Axis.get_axes.html b/api/_as_gen/matplotlib.axis.Axis.get_axes.html deleted file mode 100644 index 6e23844243a..00000000000 --- a/api/_as_gen/matplotlib.axis.Axis.get_axes.html +++ /dev/null @@ -1,324 +0,0 @@ - - - - - - - - matplotlib.axis.Axis.get_axes — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

matplotlib.axis.Axis.get_axes

-
-
-Axis.get_axes()
-

Return the Axes instance the artist -resides in, or None.

-

This has been deprecated in mpl 1.5, please use the -axes property. Will be removed in 1.7 or 2.0.

-
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/api/_as_gen/matplotlib.axis.Axis.set_axes.html b/api/_as_gen/matplotlib.axis.Axis.set_axes.html deleted file mode 100644 index 87b91731d5f..00000000000 --- a/api/_as_gen/matplotlib.axis.Axis.set_axes.html +++ /dev/null @@ -1,325 +0,0 @@ - - - - - - - - matplotlib.axis.Axis.set_axes — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

matplotlib.axis.Axis.set_axes

-
-
-Axis.set_axes(axes)
-

Set the Axes instance in which the -artist resides, if any.

-

This has been deprecated in mpl 1.5, please use the -axes property. Will be removed in 1.7 or 2.0.

-

ACCEPTS: an Axes instance

-
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/api/_as_gen/matplotlib.axis.Tick.get_axes.html b/api/_as_gen/matplotlib.axis.Tick.get_axes.html deleted file mode 100644 index 2e8f5ea726b..00000000000 --- a/api/_as_gen/matplotlib.axis.Tick.get_axes.html +++ /dev/null @@ -1,324 +0,0 @@ - - - - - - - - matplotlib.axis.Tick.get_axes — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

matplotlib.axis.Tick.get_axes

-
-
-Tick.get_axes()
-

Return the Axes instance the artist -resides in, or None.

-

This has been deprecated in mpl 1.5, please use the -axes property. Will be removed in 1.7 or 2.0.

-
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/api/_as_gen/matplotlib.axis.Tick.set_axes.html b/api/_as_gen/matplotlib.axis.Tick.set_axes.html deleted file mode 100644 index 494c3be5ded..00000000000 --- a/api/_as_gen/matplotlib.axis.Tick.set_axes.html +++ /dev/null @@ -1,325 +0,0 @@ - - - - - - - - matplotlib.axis.Tick.set_axes — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

matplotlib.axis.Tick.set_axes

-
-
-Tick.set_axes(axes)
-

Set the Axes instance in which the -artist resides, if any.

-

This has been deprecated in mpl 1.5, please use the -axes property. Will be removed in 1.7 or 2.0.

-

ACCEPTS: an Axes instance

-
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/api/_as_gen/matplotlib.axis.XAxis.get_axes.html b/api/_as_gen/matplotlib.axis.XAxis.get_axes.html deleted file mode 100644 index cedd9a79fdd..00000000000 --- a/api/_as_gen/matplotlib.axis.XAxis.get_axes.html +++ /dev/null @@ -1,324 +0,0 @@ - - - - - - - - matplotlib.axis.XAxis.get_axes — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

matplotlib.axis.XAxis.get_axes

-
-
-XAxis.get_axes()
-

Return the Axes instance the artist -resides in, or None.

-

This has been deprecated in mpl 1.5, please use the -axes property. Will be removed in 1.7 or 2.0.

-
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/api/_as_gen/matplotlib.axis.XAxis.set_axes.html b/api/_as_gen/matplotlib.axis.XAxis.set_axes.html deleted file mode 100644 index 44c14ad4051..00000000000 --- a/api/_as_gen/matplotlib.axis.XAxis.set_axes.html +++ /dev/null @@ -1,325 +0,0 @@ - - - - - - - - matplotlib.axis.XAxis.set_axes — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

matplotlib.axis.XAxis.set_axes

-
-
-XAxis.set_axes(axes)
-

Set the Axes instance in which the -artist resides, if any.

-

This has been deprecated in mpl 1.5, please use the -axes property. Will be removed in 1.7 or 2.0.

-

ACCEPTS: an Axes instance

-
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/api/_as_gen/matplotlib.axis.XTick.get_axes.html b/api/_as_gen/matplotlib.axis.XTick.get_axes.html deleted file mode 100644 index ab2196aa98e..00000000000 --- a/api/_as_gen/matplotlib.axis.XTick.get_axes.html +++ /dev/null @@ -1,324 +0,0 @@ - - - - - - - - matplotlib.axis.XTick.get_axes — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

matplotlib.axis.XTick.get_axes

-
-
-XTick.get_axes()
-

Return the Axes instance the artist -resides in, or None.

-

This has been deprecated in mpl 1.5, please use the -axes property. Will be removed in 1.7 or 2.0.

-
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/api/_as_gen/matplotlib.axis.XTick.set_axes.html b/api/_as_gen/matplotlib.axis.XTick.set_axes.html deleted file mode 100644 index e04d19e1ed6..00000000000 --- a/api/_as_gen/matplotlib.axis.XTick.set_axes.html +++ /dev/null @@ -1,325 +0,0 @@ - - - - - - - - matplotlib.axis.XTick.set_axes — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

matplotlib.axis.XTick.set_axes

-
-
-XTick.set_axes(axes)
-

Set the Axes instance in which the -artist resides, if any.

-

This has been deprecated in mpl 1.5, please use the -axes property. Will be removed in 1.7 or 2.0.

-

ACCEPTS: an Axes instance

-
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/api/_as_gen/matplotlib.axis.YAxis.get_axes.html b/api/_as_gen/matplotlib.axis.YAxis.get_axes.html deleted file mode 100644 index baefc52b692..00000000000 --- a/api/_as_gen/matplotlib.axis.YAxis.get_axes.html +++ /dev/null @@ -1,324 +0,0 @@ - - - - - - - - matplotlib.axis.YAxis.get_axes — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

matplotlib.axis.YAxis.get_axes

-
-
-YAxis.get_axes()
-

Return the Axes instance the artist -resides in, or None.

-

This has been deprecated in mpl 1.5, please use the -axes property. Will be removed in 1.7 or 2.0.

-
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/api/_as_gen/matplotlib.axis.YAxis.set_axes.html b/api/_as_gen/matplotlib.axis.YAxis.set_axes.html deleted file mode 100644 index 37c78251229..00000000000 --- a/api/_as_gen/matplotlib.axis.YAxis.set_axes.html +++ /dev/null @@ -1,325 +0,0 @@ - - - - - - - - matplotlib.axis.YAxis.set_axes — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

matplotlib.axis.YAxis.set_axes

-
-
-YAxis.set_axes(axes)
-

Set the Axes instance in which the -artist resides, if any.

-

This has been deprecated in mpl 1.5, please use the -axes property. Will be removed in 1.7 or 2.0.

-

ACCEPTS: an Axes instance

-
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/api/_as_gen/matplotlib.axis.YTick.get_axes.html b/api/_as_gen/matplotlib.axis.YTick.get_axes.html deleted file mode 100644 index aa83af9ce3b..00000000000 --- a/api/_as_gen/matplotlib.axis.YTick.get_axes.html +++ /dev/null @@ -1,324 +0,0 @@ - - - - - - - - matplotlib.axis.YTick.get_axes — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

matplotlib.axis.YTick.get_axes

-
-
-YTick.get_axes()
-

Return the Axes instance the artist -resides in, or None.

-

This has been deprecated in mpl 1.5, please use the -axes property. Will be removed in 1.7 or 2.0.

-
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/api/_as_gen/matplotlib.axis.YTick.set_axes.html b/api/_as_gen/matplotlib.axis.YTick.set_axes.html deleted file mode 100644 index 92fdd3e267a..00000000000 --- a/api/_as_gen/matplotlib.axis.YTick.set_axes.html +++ /dev/null @@ -1,325 +0,0 @@ - - - - - - - - matplotlib.axis.YTick.set_axes — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

matplotlib.axis.YTick.set_axes

-
-
-YTick.set_axes(axes)
-

Set the Axes instance in which the -artist resides, if any.

-

This has been deprecated in mpl 1.5, please use the -axes property. Will be removed in 1.7 or 2.0.

-

ACCEPTS: an Axes instance

-
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/api/pyplot_api.html b/api/pyplot_api.html deleted file mode 100644 index c209dff6cd7..00000000000 --- a/api/pyplot_api.html +++ /dev/null @@ -1,12803 +0,0 @@ - - - - - - - - pyplot — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-

Table Of Contents

- -
-

Related Topics

- -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplot

-
-

matplotlib.pyplot

-

Provides a MATLAB-like plotting framework.

-

pylab combines pyplot with numpy into a single namespace. -This is convenient for interactive work, but for programming it -is recommended that the namespaces be kept separate, e.g.:

-
import numpy as np
-import matplotlib.pyplot as plt
-
-x = np.arange(0, 5, 0.1);
-y = np.sin(x)
-plt.plot(x, y)
-
-
-
-
-matplotlib.pyplot.acorr(x, hold=None, data=None, **kwargs)
-

Plot the autocorrelation of x.

- --- - - - - - - - - -
Parameters:

x : sequence of scalar

-

hold : boolean, optional, deprecated, default: True

-

detrend : callable, optional, default: mlab.detrend_none

-
-

x is detrended by the detrend callable. Default is no -normalization.

-
-

normed : boolean, optional, default: True

-
-

if True, input vectors are normalised to unit length.

-
-

usevlines : boolean, optional, default: True

-
-

if True, Axes.vlines is used to plot the vertical lines from the -origin to the acorr. Otherwise, Axes.plot is used.

-
-

maxlags : integer, optional, default: 10

-
-

number of lags to show. If None, will return all 2 * len(x) - 1 -lags.

-
-
Returns:

(lags, c, line, b) : where:

-
-
    -
  • lags are a length 2`maxlags+1 lag vector.
  • -
  • c is the 2`maxlags+1 auto correlation vectorI
  • -
  • line is a Line2D instance returned by -plot.
  • -
  • b is the x-axis.
  • -
-
-
Other Parameters:
 

linestyle : Line2D prop, optional, default: None

-
-

Only used if usevlines is False.

-
-

marker : string, optional, default: ‘o’

-
-

Notes

-

The cross correlation is performed with numpy.correlate() with -mode = 2.

-

Examples

-

xcorr is top graph, and -acorr is bottom graph.

-

(Source code, png, pdf)

-
-../_images/xcorr_demo2.png -
-
-

Note

-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All arguments with the following names: ‘x’.
  • -
-
-
- -
-
-matplotlib.pyplot.angle_spectrum(x, Fs=None, Fc=None, window=None, pad_to=None, sides=None, hold=None, data=None, **kwargs)
-

Plot the angle spectrum.

-

Call signature:

-
angle_spectrum(x, Fs=2, Fc=0,  window=mlab.window_hanning,
-               pad_to=None, sides='default', **kwargs)
-
-
-

Compute the angle spectrum (wrapped phase spectrum) of x. -Data is padded to a length of pad_to and the windowing function -window is applied to the signal.

- --- - - - - - -
Parameters:

x : 1-D array or sequence

-
-

Array or sequence containing the data

-
-

Fs : scalar

-
-

The sampling frequency (samples per time unit). It is used -to calculate the Fourier frequencies, freqs, in cycles per time -unit. The default value is 2.

-
-

window : callable or ndarray

-
-

A function or a vector of length NFFT. To create window -vectors see window_hanning(), window_none(), -numpy.blackman(), numpy.hamming(), -numpy.bartlett(), scipy.signal(), -scipy.signal.get_window(), etc. The default is -window_hanning(). If a function is passed as the -argument, it must take a data segment as an argument and -return the windowed version of the segment.

-
-

sides : [ ‘default’ | ‘onesided’ | ‘twosided’ ]

-
-

Specifies which sides of the spectrum to return. Default gives the -default behavior, which returns one-sided for real data and both -for complex data. ‘onesided’ forces the return of a one-sided -spectrum, while ‘twosided’ forces two-sided.

-
-

pad_to : integer

-
-

The number of points to which the data segment is padded when -performing the FFT. While not increasing the actual resolution of -the spectrum (the minimum distance between resolvable peaks), -this can give more points in the plot, allowing for more -detail. This corresponds to the n parameter in the call to fft(). -The default is None, which sets pad_to equal to the length of the -input signal (i.e. no padding).

-
-

Fc : integer

-
-

The center frequency of x (defaults to 0), which offsets -the x extents of the plot to reflect the frequency range used -when a signal is acquired and then filtered and downsampled to -baseband.

-
-

**kwargs :

-
-
-

Keyword arguments control the Line2D -properties:

-
- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat (0.0 transparent through 1.0 opaque)
animated[True | False]
antialiased or aa[True | False]
axesan Axes instance
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
color or cany matplotlib color
containsa callable function
dash_capstyle[‘butt’ | ‘round’ | ‘projecting’]
dash_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
dashessequence of on/off ink in points
drawstyle[‘default’ | ‘steps’ | ‘steps-pre’ | ‘steps-mid’ | ‘steps-post’]
figurea matplotlib.figure.Figure instance
fillstyle[‘full’ | ‘left’ | ‘right’ | ‘bottom’ | ‘top’ | ‘none’]
gidan id string
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or lwfloat value in points
markerA valid marker style
markeredgecolor or mecany matplotlib color
markeredgewidth or mewfloat value in points
markerfacecolor or mfcany matplotlib color
markerfacecoloralt or mfcaltany matplotlib color
markersize or msfloat
markevery[None | int | length-2 tuple of int | slice | list/array of int | float | length-2 tuple of float]
path_effectsunknown
pickerfloat distance in points or callable pick function fn(artist, event)
pickradiusfloat distance in points
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
solid_capstyle[‘butt’ | ‘round’ | ‘projecting’]
solid_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
transforma matplotlib.transforms.Transform instance
urla url string
visible[True | False]
xdata1D array
ydata1D array
zorderany number
-
-
Returns:

spectrum : 1-D array

-
-

The values for the angle spectrum in radians (real valued)

-
-

freqs : 1-D array

-
-

The frequencies corresponding to the elements in spectrum

-
-

line : a Line2D instance

-
-

The line created by this function

-
-
-
-

See also

-
-
magnitude_spectrum()
-
angle_spectrum() plots the magnitudes of the corresponding frequencies.
-
phase_spectrum()
-
phase_spectrum() plots the unwrapped version of this function.
-
specgram()
-
specgram() can plot the angle spectrum of segments within the signal in a colormap.
-
-
In addition to the above described arguments, this function can take a data keyword argument. If such a data argument is given, the following arguments are replaced by data[<arg>]: * All arguments with the following names: ‘x’.
-
-
-

Examples

-

(Source code, png, pdf)

-
-../_images/spectrum_demo2.png -
-
- -
-
-matplotlib.pyplot.annotate(*args, **kwargs)
-

Annotate the point xy with text s.

-

Additional kwargs are passed to Text.

- --- - - - - - -
Parameters:

s : str

-
-

The text of the annotation

-
-

xy : iterable

-
-

Length 2 sequence specifying the (x,y) point to annotate

-
-

xytext : iterable, optional

-
-

Length 2 sequence specifying the (x,y) to place the text -at. If None, defaults to xy.

-
-

xycoords : str, Artist, Transform, callable or tuple, optional

-
-

The coordinate system that xy is given in.

-

For a str the allowed values are:

- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
‘figure points’points from the lower left of the figure
‘figure pixels’pixels from the lower left of the figure
‘figure fraction’fraction of figure from lower left
‘axes points’points from lower left corner of axes
‘axes pixels’pixels from lower left corner of axes
‘axes fraction’fraction of axes from lower left
‘data’use the coordinate system of the object being -annotated (default)
‘polar’(theta,r) if not native ‘data’ coordinates
-

If a Artist object is passed in the units are -fraction if it’s bounding box.

-

If a Transform object is passed -in use that to transform xy to screen coordinates

-

If a callable it must take a -RendererBase object as input -and return a Transform or -Bbox object

-

If a tuple must be length 2 tuple of str, Artist, -Transform or callable objects. The first transform is -used for the x coordinate and the second for y.

-

See Advanced Annotation for more details.

-

Defaults to 'data'

-
-

textcoords : str, Artist, Transform, callable or tuple, optional

-
-

The coordinate system that xytext is given, which -may be different than the coordinate system used for -xy.

-

All xycoords values are valid as well as the following -strings:

- ---- - - - - - - - - - - - - - -
PropertyDescription
‘offset points’offset (in points) from the xy value
‘offset pixels’offset (in pixels) from the xy value
-

defaults to the input of xycoords

-
-

arrowprops : dict, optional

-
-

If not None, properties used to draw a -FancyArrowPatch arrow between xy and -xytext.

-

If arrowprops does not contain the key 'arrowstyle' the -allowed keys are:

- ---- - - - - - - - - - - - - - - - - - - - - - - -
KeyDescription
widththe width of the arrow in points
headwidththe width of the base of the arrow head in points
headlengththe length of the arrow head in points
shrinkfraction of total length to ‘shrink’ from both ends
?any key to matplotlib.patches.FancyArrowPatch
-

If the arrowprops contains the key 'arrowstyle' the -above keys are forbidden. The allowed values of -'arrowstyle' are:

- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameAttrs
'-'None
'->'head_length=0.4,head_width=0.2
'-['widthB=1.0,lengthB=0.2,angleB=None
'|-|'widthA=1.0,widthB=1.0
'-|>'head_length=0.4,head_width=0.2
'<-'head_length=0.4,head_width=0.2
'<->'head_length=0.4,head_width=0.2
'<|-'head_length=0.4,head_width=0.2
'<|-|>'head_length=0.4,head_width=0.2
'fancy'head_length=0.4,head_width=0.4,tail_width=0.4
'simple'head_length=0.5,head_width=0.5,tail_width=0.2
'wedge'tail_width=0.3,shrink_factor=0.5
-

Valid keys for FancyArrowPatch are:

- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyDescription
arrowstylethe arrow style
connectionstylethe connection style
relposdefault is (0.5, 0.5)
patchAdefault is bounding box of the text
patchBdefault is None
shrinkAdefault is 2 points
shrinkBdefault is 2 points
mutation_scaledefault is text size (in points)
mutation_aspectdefault is 1.
?any key for matplotlib.patches.PathPatch
-

Defaults to None

-
-

annotation_clip : bool, optional

-
-

Controls the visibility of the annotation when it goes -outside the axes area.

-

If True, the annotation will only be drawn when the -xy is inside the axes. If False, the annotation will -always be drawn regardless of its position.

-

The default is None, which behave as True only if -xycoords is “data”.

-
-
Returns:

Annotation

-
-
- -
-
-matplotlib.pyplot.arrow(x, y, dx, dy, hold=None, **kwargs)
-

Add an arrow to the axes.

-

Draws arrow on specified axis from (x, y) to (x + dx, -y + dy). Uses FancyArrow patch to construct the arrow.

- --- - - - - - - - - -
Parameters:

x : float

-
-

X-coordinate of the arrow base

-
-

y : float

-
-

Y-coordinate of the arrow base

-
-

dx : float

-
-

Length of arrow along x-coordinate

-
-

dy : float

-
-

Length of arrow along y-coordinate

-
-
Returns:

a : FancyArrow

-
-

patches.FancyArrow object

-
-
Other Parameters:
 

Optional kwargs (inherited from FancyArrow patch) control the arrow

-

construction and properties:

-

Constructor arguments

-
-
-
width: float (default: 0.001)
-

width of full arrow tail

-
-
length_includes_head: [True | False] (default: False)
-

True if head is to be counted in calculating the length.

-
-
head_width: float or None (default: 3*width)
-

total width of the full arrow head

-
-
head_length: float or None (default: 1.5 * head_width)
-

length of arrow head

-
-
shape: [‘full’, ‘left’, ‘right’] (default: ‘full’)
-

draw the left-half, right-half, or full arrow

-
-
overhang: float (default: 0)
-

fraction that the arrow is swept back (0 overhang means -triangular shape). Can be negative or greater than one.

-
-
head_starts_at_zero: [True | False] (default: False)
-

if True, the head starts being drawn at coordinate 0 -instead of ending at coordinate 0.

-
-
-
-

Other valid kwargs (inherited from :class:`Patch`) are:

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or aa[True | False] or None for default
axesan Axes instance
capstyle[‘butt’ | ‘round’ | ‘projecting’]
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
colormatplotlib color spec
containsa callable function
edgecolor or ecmpl color spec, None, ‘none’, or ‘auto’
facecolor or fcmpl color spec, or None for default, or ‘none’ for no color
figurea matplotlib.figure.Figure instance
fill[True | False]
gidan id string
hatch[‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
joinstyle[‘miter’ | ‘round’ | ‘bevel’]
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or lwfloat or None for default
path_effectsunknown
picker[None|float|boolean|callable]
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
visible[True | False]
zorderany number
-
-
-

Notes

-

The resulting arrow is affected by the axes aspect ratio and limits. -This may produce an arrow whose head is not square with its stem. To -create an arrow whose head is square with its stem, use -annotate() for example:

-
ax.annotate("", xy=(0.5, 0.5), xytext=(0, 0),
-    arrowprops=dict(arrowstyle="->"))
-
-
-

Examples

-

(Source code, png, pdf)

-
-../_images/arrow_demo2.png -
-
- -
-
-matplotlib.pyplot.autoscale(enable=True, axis='both', tight=None)
-

Autoscale the axis view to the data (toggle).

-

Convenience method for simple axis view autoscaling. -It turns autoscaling on or off, and then, -if autoscaling for either axis is on, it performs -the autoscaling on the specified axis or axes.

-
-
enable: [True | False | None]
-
True (default) turns autoscaling on, False turns it off. -None leaves the autoscaling state unchanged.
-
axis: [‘x’ | ‘y’ | ‘both’]
-
which axis to operate on; default is ‘both’
-
tight: [True | False | None]
-
If True, set view limits to data limits; -if False, let the locator and margins expand the view limits; -if None, use tight scaling if the only artist is an image, -otherwise treat tight as False. -The tight setting is retained for future autoscaling -until it is explicitly changed.
-
-

Returns None.

-
- -
-
-matplotlib.pyplot.autumn()
-

set the default colormap to autumn and apply to current image if any. -See help(colormaps) for more information

-
- -
-
-matplotlib.pyplot.axes(*args, **kwargs)
-

Add an axes to the figure.

-

The axes is added at position rect specified by:

-
    -
  • axes() by itself creates a default full subplot(111) window axis.
  • -
  • axes(rect, facecolor='w') where rect = [left, bottom, width, -height] in normalized (0, 1) units. facecolor is the background -color for the axis, default white.
  • -
  • axes(h) where h is an axes instance makes h the current -axis. An Axes instance is returned.
  • -
- ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
kwargAcceptsDescription
facecolorcolorthe axes background color
frameon[True|False]display the frame?
sharexotheraxcurrent axes shares xaxis attribute -with otherax
shareyotheraxcurrent axes shares yaxis attribute -with otherax
polar[True|False]use a polar axes?
aspect[str | num][‘equal’, ‘auto’] or a number. If a number -the ratio of x-unit/y-unit in screen-space. -Also see -set_aspect().
-

Examples:

-
    -
  • examples/pylab_examples/axes_demo.py places custom axes.
  • -
  • examples/pylab_examples/shared_axis_demo.py uses -sharex and sharey.
  • -
-
- -
-
-matplotlib.pyplot.axhline(y=0, xmin=0, xmax=1, hold=None, **kwargs)
-

Add a horizontal line across the axis.

- --- - - - - - -
Parameters:

y : scalar, optional, default: 0

-
-

y position in data coordinates of the horizontal line.

-
-

xmin : scalar, optional, default: 0

-
-

Should be between 0 and 1, 0 being the far left of the plot, 1 the -far right of the plot.

-
-

xmax : scalar, optional, default: 1

-
-

Should be between 0 and 1, 0 being the far left of the plot, 1 the -far right of the plot.

-
-
Returns:

Line2D

-
-
-

See also

-
-
axhspan
-
for example plot and source code
-
-
-

Notes

-

kwargs are passed to Line2D and can be used -to control the line properties.

-

Examples

-
    -
  • draw a thick red hline at ‘y’ = 0 that spans the xrange:

    -
    >>> axhline(linewidth=4, color='r')
    -
    -
    -
  • -
  • draw a default hline at ‘y’ = 1 that spans the xrange:

    -
    >>> axhline(y=1)
    -
    -
    -
  • -
  • draw a default hline at ‘y’ = .5 that spans the middle half of -the xrange:

    -
    >>> axhline(y=.5, xmin=0.25, xmax=0.75)
    -
    -
    -
  • -
-

Valid kwargs are Line2D properties, -with the exception of ‘transform’:

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat (0.0 transparent through 1.0 opaque)
animated[True | False]
antialiased or aa[True | False]
axesan Axes instance
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
color or cany matplotlib color
containsa callable function
dash_capstyle[‘butt’ | ‘round’ | ‘projecting’]
dash_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
dashessequence of on/off ink in points
drawstyle[‘default’ | ‘steps’ | ‘steps-pre’ | ‘steps-mid’ | ‘steps-post’]
figurea matplotlib.figure.Figure instance
fillstyle[‘full’ | ‘left’ | ‘right’ | ‘bottom’ | ‘top’ | ‘none’]
gidan id string
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or lwfloat value in points
markerA valid marker style
markeredgecolor or mecany matplotlib color
markeredgewidth or mewfloat value in points
markerfacecolor or mfcany matplotlib color
markerfacecoloralt or mfcaltany matplotlib color
markersize or msfloat
markevery[None | int | length-2 tuple of int | slice | list/array of int | float | length-2 tuple of float]
path_effectsunknown
pickerfloat distance in points or callable pick function fn(artist, event)
pickradiusfloat distance in points
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
solid_capstyle[‘butt’ | ‘round’ | ‘projecting’]
solid_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
transforma matplotlib.transforms.Transform instance
urla url string
visible[True | False]
xdata1D array
ydata1D array
zorderany number
-
-
- -
-
-matplotlib.pyplot.axhspan(ymin, ymax, xmin=0, xmax=1, hold=None, **kwargs)
-

Add a horizontal span (rectangle) across the axis.

-

Draw a horizontal span (rectangle) from ymin to ymax. -With the default values of xmin = 0 and xmax = 1, this -always spans the xrange, regardless of the xlim settings, even -if you change them, e.g., with the set_xlim() command. -That is, the horizontal extent is in axes coords: 0=left, -0.5=middle, 1.0=right but the y location is in data -coordinates.

- --- - - - - - - - - -
Parameters:

ymin : float

-
-

Lower limit of the horizontal span in data units.

-
-

ymax : float

-
-

Upper limit of the horizontal span in data units.

-
-

xmin : float, optional, default: 0

-
-

Lower limit of the vertical span in axes (relative -0-1) units.

-
-

xmax : float, optional, default: 1

-
-

Upper limit of the vertical span in axes (relative -0-1) units.

-
-
Returns:

Polygon : Polygon

-
Other Parameters:
 

kwargs : Polygon properties.

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or aa[True | False] or None for default
axesan Axes instance
capstyle[‘butt’ | ‘round’ | ‘projecting’]
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
colormatplotlib color spec
containsa callable function
edgecolor or ecmpl color spec, None, ‘none’, or ‘auto’
facecolor or fcmpl color spec, or None for default, or ‘none’ for no color
figurea matplotlib.figure.Figure instance
fill[True | False]
gidan id string
hatch[‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
joinstyle[‘miter’ | ‘round’ | ‘bevel’]
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or lwfloat or None for default
path_effectsunknown
picker[None|float|boolean|callable]
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
visible[True | False]
zorderany number
-
-
-
-

See also

-
-
axvspan
-
Add a vertical span (rectangle) across the axes.
-
-
-

Examples

-

(Source code, png, pdf)

-
-../_images/axhspan_demo2.png -
-
- -
-
-matplotlib.pyplot.axis(*v, **kwargs)
-

Convenience method to get or set axis properties.

-

Calling with no arguments:

-
>>> axis()
-
-
-

returns the current axes limits [xmin, xmax, ymin, ymax].:

-
>>> axis(v)
-
-
-

sets the min and max of the x and y axes, with -v = [xmin, xmax, ymin, ymax].:

-
>>> axis('off')
-
-
-

turns off the axis lines and labels.:

-
>>> axis('equal')
-
-
-

changes limits of x or y axis so that equal increments of x -and y have the same length; a circle is circular.:

-
>>> axis('scaled')
-
-
-

achieves the same result by changing the dimensions of the plot box instead -of the axis data limits.:

-
>>> axis('tight')
-
-
-

changes x and y axis limits such that all data is shown. If -all data is already shown, it will move it to the center of the -figure without modifying (xmax - xmin) or (ymax - -ymin). Note this is slightly different than in MATLAB.:

-
>>> axis('image')
-
-
-

is ‘scaled’ with the axis limits equal to the data limits.:

-
>>> axis('auto')
-
-
-

and:

-
>>> axis('normal')
-
-
-

are deprecated. They restore default behavior; axis limits are automatically -scaled to make the data fit comfortably within the plot box.

-

if len(*v)==0, you can pass in xmin, xmax, ymin, ymax -as kwargs selectively to alter just those limits without changing -the others.

-
>>> axis('square')
-
-
-

changes the limit ranges (xmax-xmin) and (ymax-ymin) of -the x and y axes to be the same, and have the same scaling, -resulting in a square plot.

-

The xmin, xmax, ymin, ymax tuple is returned

-
-

See also

-
-
xlim(), ylim()
-
For setting the x- and y-limits individually.
-
-
-
- -
-
-matplotlib.pyplot.axvline(x=0, ymin=0, ymax=1, hold=None, **kwargs)
-

Add a vertical line across the axes.

- --- - - - - - -
Parameters:

x : scalar, optional, default: 0

-
-

x position in data coordinates of the vertical line.

-
-

ymin : scalar, optional, default: 0

-
-

Should be between 0 and 1, 0 being the bottom of the plot, 1 the -top of the plot.

-
-

ymax : scalar, optional, default: 1

-
-

Should be between 0 and 1, 0 being the bottom of the plot, 1 the -top of the plot.

-
-
Returns:

Line2D

-
-
-

See also

-
-
axhspan
-
for example plot and source code
-
-
-

Examples

-
    -
  • draw a thick red vline at x = 0 that spans the yrange:

    -
    >>> axvline(linewidth=4, color='r')
    -
    -
    -
  • -
  • draw a default vline at x = 1 that spans the yrange:

    -
    >>> axvline(x=1)
    -
    -
    -
  • -
  • draw a default vline at x = .5 that spans the middle half of -the yrange:

    -
    >>> axvline(x=.5, ymin=0.25, ymax=0.75)
    -
    -
    -
  • -
-

Valid kwargs are Line2D properties, -with the exception of ‘transform’:

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat (0.0 transparent through 1.0 opaque)
animated[True | False]
antialiased or aa[True | False]
axesan Axes instance
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
color or cany matplotlib color
containsa callable function
dash_capstyle[‘butt’ | ‘round’ | ‘projecting’]
dash_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
dashessequence of on/off ink in points
drawstyle[‘default’ | ‘steps’ | ‘steps-pre’ | ‘steps-mid’ | ‘steps-post’]
figurea matplotlib.figure.Figure instance
fillstyle[‘full’ | ‘left’ | ‘right’ | ‘bottom’ | ‘top’ | ‘none’]
gidan id string
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or lwfloat value in points
markerA valid marker style
markeredgecolor or mecany matplotlib color
markeredgewidth or mewfloat value in points
markerfacecolor or mfcany matplotlib color
markerfacecoloralt or mfcaltany matplotlib color
markersize or msfloat
markevery[None | int | length-2 tuple of int | slice | list/array of int | float | length-2 tuple of float]
path_effectsunknown
pickerfloat distance in points or callable pick function fn(artist, event)
pickradiusfloat distance in points
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
solid_capstyle[‘butt’ | ‘round’ | ‘projecting’]
solid_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
transforma matplotlib.transforms.Transform instance
urla url string
visible[True | False]
xdata1D array
ydata1D array
zorderany number
-
-
- -
-
-matplotlib.pyplot.axvspan(xmin, xmax, ymin=0, ymax=1, hold=None, **kwargs)
-

Add a vertical span (rectangle) across the axes.

-

Draw a vertical span (rectangle) from xmin to xmax. With -the default values of ymin = 0 and ymax = 1. This always -spans the yrange, regardless of the ylim settings, even if you -change them, e.g., with the set_ylim() command. That is, -the vertical extent is in axes coords: 0=bottom, 0.5=middle, -1.0=top but the y location is in data coordinates.

- --- - - - - - - - - -
Parameters:

xmin : scalar

-
-

Number indicating the first X-axis coordinate of the vertical -span rectangle in data units.

-
-

xmax : scalar

-
-

Number indicating the second X-axis coordinate of the vertical -span rectangle in data units.

-
-

ymin : scalar, optional

-
-

Number indicating the first Y-axis coordinate of the vertical -span rectangle in relative Y-axis units (0-1). Default to 0.

-
-

ymax : scalar, optional

-
-

Number indicating the second Y-axis coordinate of the vertical -span rectangle in relative Y-axis units (0-1). Default to 1.

-
-
Returns:

rectangle : matplotlib.patches.Polygon

-
-

Vertical span (rectangle) from (xmin, ymin) to (xmax, ymax).

-
-
Other Parameters:
 

**kwargs

-
-

Optional parameters are properties of the class -matplotlib.patches.Polygon.

-
-
-
-

See also

-

axhspan

-
-

Examples

-

Draw a vertical, green, translucent rectangle from x = 1.25 to -x = 1.55 that spans the yrange of the axes.

-
>>> axvspan(1.25, 1.55, facecolor='g', alpha=0.5)
-
-
-
- -
-
-matplotlib.pyplot.bar(left, height, width=0.8, bottom=None, hold=None, data=None, **kwargs)
-

Make a bar plot.

-

Make a bar plot with rectangles bounded by:

-
-
-
left, left + width, bottom, bottom + height
-
(left, right, bottom and top edges)
-
-
- --- - - - - - -
Parameters:

left : sequence of scalars

-
-

the x coordinates of the left sides of the bars

-
-

height : sequence of scalars

-
-

the heights of the bars

-
-

width : scalar or array-like, optional

-
-

the width(s) of the bars -default: 0.8

-
-

bottom : scalar or array-like, optional

-
-

the y coordinate(s) of the bars -default: None

-
-

color : scalar or array-like, optional

-
-

the colors of the bar faces

-
-

edgecolor : scalar or array-like, optional

-
-

the colors of the bar edges

-
-

linewidth : scalar or array-like, optional

-
-

width of bar edge(s). If None, use default -linewidth; If 0, don’t draw edges. -default: None

-
-

tick_label : string or array-like, optional

-
-

the tick labels of the bars -default: None

-
-

xerr : scalar or array-like, optional

-
-

if not None, will be used to generate errorbar(s) on the bar chart -default: None

-
-

yerr : scalar or array-like, optional

-
-

if not None, will be used to generate errorbar(s) on the bar chart -default: None

-
-

ecolor : scalar or array-like, optional

-
-

specifies the color of errorbar(s) -default: None

-
-

capsize : scalar, optional

-
-

determines the length in points of the error bar caps -default: None, which will take the value from the -errorbar.capsize rcParam.

-
-

error_kw : dict, optional

-
-

dictionary of kwargs to be passed to errorbar method. ecolor and -capsize may be specified here rather than as independent kwargs.

-
-

align : {‘center’, ‘edge’}, optional

-
-

If ‘edge’, aligns bars by their left edges (for vertical bars) and -by their bottom edges (for horizontal bars). If ‘center’, interpret -the left argument as the coordinates of the centers of the bars. -To align on the align bars on the right edge pass a negative -width.

-
-

orientation : {‘vertical’, ‘horizontal’}, optional

-
-

The orientation of the bars.

-
-

log : boolean, optional

-
-

If true, sets the axis to be log scale. -default: False

-
-
Returns:

bars : matplotlib.container.BarContainer

-
-

Container with all of the bars + errorbars

-
-
-
-

See also

-
-
barh
-
Plot a horizontal bar plot.
-
-
-

Notes

-

The optional arguments color, edgecolor, linewidth, -xerr, and yerr can be either scalars or sequences of -length equal to the number of bars. This enables you to use -bar as the basis for stacked bar charts, or candlestick plots. -Detail: xerr and yerr are passed directly to -errorbar(), so they can also have shape 2xN for -independent specification of lower and upper errors.

-

Other optional kwargs:

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or aa[True | False] or None for default
axesan Axes instance
capstyle[‘butt’ | ‘round’ | ‘projecting’]
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
colormatplotlib color spec
containsa callable function
edgecolor or ecmpl color spec, None, ‘none’, or ‘auto’
facecolor or fcmpl color spec, or None for default, or ‘none’ for no color
figurea matplotlib.figure.Figure instance
fill[True | False]
gidan id string
hatch[‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
joinstyle[‘miter’ | ‘round’ | ‘bevel’]
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or lwfloat or None for default
path_effectsunknown
picker[None|float|boolean|callable]
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
visible[True | False]
zorderany number
-
-

Examples

-

Example: A stacked bar chart.

-

(Source code, png, pdf)

-
-../_images/bar_stacked2.png -
-
-

Note

-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All arguments with the following names: ‘bottom’, ‘color’, ‘ecolor’, ‘edgecolor’, ‘height’, ‘left’, ‘linewidth’, ‘tick_label’, ‘width’, ‘xerr’, ‘yerr’.
  • -
-
-
- -
-
-matplotlib.pyplot.barbs(*args, **kw)
-

Plot a 2-D field of barbs.

-

Call signatures:

-
barb(U, V, **kw)
-barb(U, V, C, **kw)
-barb(X, Y, U, V, **kw)
-barb(X, Y, U, V, C, **kw)
-
-
-

Arguments:

-
-
-
X, Y:
-
The x and y coordinates of the barb locations -(default is head of barb; see pivot kwarg)
-
U, V:
-
Give the x and y components of the barb shaft
-
C:
-
An optional array used to map colors to the barbs
-
-
-

All arguments may be 1-D or 2-D arrays or sequences. If X and Y -are absent, they will be generated as a uniform grid. If U and V -are 2-D arrays but X and Y are 1-D, and if len(X) and len(Y) -match the column and row dimensions of U, then X and Y will be -expanded with numpy.meshgrid().

-

U, V, C may be masked arrays, but masked X, Y are not -supported at present.

-

Keyword arguments:

-
-
-
length:
-
Length of the barb in points; the other parts of the barb -are scaled against this. -Default is 9
-
pivot: [ ‘tip’ | ‘middle’ ]
-
The part of the arrow that is at the grid point; the arrow rotates -about this point, hence the name pivot. Default is ‘tip’
-
barbcolor: [ color | color sequence ]
-
Specifies the color all parts of the barb except any flags. This -parameter is analagous to the edgecolor parameter for polygons, -which can be used instead. However this parameter will override -facecolor.
-
flagcolor: [ color | color sequence ]
-
Specifies the color of any flags on the barb. This parameter is -analagous to the facecolor parameter for polygons, which can be -used instead. However this parameter will override facecolor. If -this is not set (and C has not either) then flagcolor will be -set to match barbcolor so that the barb has a uniform color. If -C has been set, flagcolor has no effect.
-
sizes:
-

A dictionary of coefficients specifying the ratio of a given -feature to the length of the barb. Only those values one wishes to -override need to be included. These features include:

-
-
    -
  • ‘spacing’ - space between features (flags, full/half barbs)
  • -
  • ‘height’ - height (distance from shaft to top) of a flag or -full barb
  • -
  • ‘width’ - width of a flag, twice the width of a full barb
  • -
  • ‘emptybarb’ - radius of the circle used for low magnitudes
  • -
-
-
-
fill_empty:
-
A flag on whether the empty barbs (circles) that are drawn should -be filled with the flag color. If they are not filled, they will -be drawn such that no color is applied to the center. Default is -False
-
rounding:
-
A flag to indicate whether the vector magnitude should be rounded -when allocating barb components. If True, the magnitude is -rounded to the nearest multiple of the half-barb increment. If -False, the magnitude is simply truncated to the next lowest -multiple. Default is True
-
barb_increments:
-

A dictionary of increments specifying values to associate with -different parts of the barb. Only those values one wishes to -override need to be included.

-
-
    -
  • ‘half’ - half barbs (Default is 5)
  • -
  • ‘full’ - full barbs (Default is 10)
  • -
  • ‘flag’ - flags (default is 50)
  • -
-
-
-
flip_barb:
-
Either a single boolean flag or an array of booleans. Single -boolean indicates whether the lines and flags should point -opposite to normal for all barbs. An array (which should be the -same size as the other data arrays) indicates whether to flip for -each individual barb. Normal behavior is for the barbs and lines -to point right (comes from wind barbs having these features point -towards low pressure in the Northern Hemisphere.) Default is -False
-
-
-

Barbs are traditionally used in meteorology as a way to plot the speed -and direction of wind observations, but can technically be used to -plot any two dimensional vector quantity. As opposed to arrows, which -give vector magnitude by the length of the arrow, the barbs give more -quantitative information about the vector magnitude by putting slanted -lines or a triangle for various increments in magnitude, as show -schematically below:

-
:     /\    \
-:    /  \    \
-:   /    \    \    \
-:  /      \    \    \
-: ------------------------------
-
-
-

The largest increment is given by a triangle (or “flag”). After those -come full lines (barbs). The smallest increment is a half line. There -is only, of course, ever at most 1 half line. If the magnitude is -small and only needs a single half-line and no full lines or -triangles, the half-line is offset from the end of the barb so that it -can be easily distinguished from barbs with a single full line. The -magnitude for the barb shown above would nominally be 65, using the -standard increments of 50, 10, and 5.

-

linewidths and edgecolors can be used to customize the barb. -Additional PolyCollection keyword -arguments:

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or antialiasedsBoolean or sequence of booleans
arrayunknown
axesan Axes instance
clima length 2 sequence of floats
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
cmapa colormap or registered colormap name
colormatplotlib color arg or sequence of rgba tuples
containsa callable function
edgecolor or edgecolorsmatplotlib color spec or sequence of specs
facecolor or facecolorsmatplotlib color spec or sequence of specs
figurea matplotlib.figure.Figure instance
gidan id string
hatch[ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
labelstring or anything printable with ‘%s’ conversion.
linestyle or dashes or linestyles[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or linewidths or lwfloat or sequence of floats
normunknown
offset_positionunknown
offsetsfloat or sequence of floats
path_effectsunknown
picker[None|float|boolean|callable]
pickradiusunknown
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
urlsunknown
visible[True | False]
zorderany number
-
-

Example:

-

(Source code)

-
-../_images/barb_demo_002.png -

(png, pdf)

-
-
-../_images/barb_demo_012.png -

(png, pdf)

-
-
-

Note

-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All positional and all keyword arguments.
  • -
-
-
- -
-
-matplotlib.pyplot.barh(bottom, width, height=0.8, left=None, hold=None, **kwargs)
-

Make a horizontal bar plot.

-

Make a horizontal bar plot with rectangles bounded by:

-
-
-
left, left + width, bottom, bottom + height
-
(left, right, bottom and top edges)
-
-
-

bottom, width, height, and left can be either scalars -or sequences

- --- - - - - - - - - -
Parameters:

bottom : scalar or array-like

-
-

the y coordinate(s) of the bars

-
-

width : scalar or array-like

-
-

the width(s) of the bars

-
-

height : sequence of scalars, optional, default: 0.8

-
-

the heights of the bars

-
-

left : sequence of scalars

-
-

the x coordinates of the left sides of the bars

-
-
Returns:

matplotlib.patches.Rectangle instances.

-
Other Parameters:
 

color : scalar or array-like, optional

-
-

the colors of the bars

-
-

edgecolor : scalar or array-like, optional

-
-

the colors of the bar edges

-
-

linewidth : scalar or array-like, optional, default: None

-
-

width of bar edge(s). If None, use default -linewidth; If 0, don’t draw edges.

-
-

tick_label : string or array-like, optional, default: None

-
-

the tick labels of the bars

-
-

xerr : scalar or array-like, optional, default: None

-
-

if not None, will be used to generate errorbar(s) on the bar chart

-
-

yerr : scalar or array-like, optional, default: None

-
-

if not None, will be used to generate errorbar(s) on the bar chart

-
-

ecolor : scalar or array-like, optional, default: None

-
-

specifies the color of errorbar(s)

-
-

capsize : scalar, optional

-
-

determines the length in points of the error bar caps -default: None, which will take the value from the -errorbar.capsize rcParam.

-
-

error_kw :

-
-

dictionary of kwargs to be passed to errorbar method. ecolor and -capsize may be specified here rather than as independent kwargs.

-
-

align : {‘center’, ‘edge’}, optional

-
-

If ‘edge’, aligns bars by their left edges (for vertical -bars) and by their bottom edges (for horizontal bars). If -‘center’, interpret the bottom argument as the -coordinates of the centers of the bars. To align on the -align bars on the top edge pass a negative ‘height’.

-
-

log : boolean, optional, default: False

-
-

If true, sets the axis to be log scale

-
-
-
-

See also

-
-
bar
-
Plot a vertical bar plot.
-
-
-

Notes

-

The optional arguments color, edgecolor, linewidth, -xerr, and yerr can be either scalars or sequences of -length equal to the number of bars. This enables you to use -bar as the basis for stacked bar charts, or candlestick plots. -Detail: xerr and yerr are passed directly to -errorbar(), so they can also have shape 2xN for -independent specification of lower and upper errors.

-

Other optional kwargs:

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or aa[True | False] or None for default
axesan Axes instance
capstyle[‘butt’ | ‘round’ | ‘projecting’]
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
colormatplotlib color spec
containsa callable function
edgecolor or ecmpl color spec, None, ‘none’, or ‘auto’
facecolor or fcmpl color spec, or None for default, or ‘none’ for no color
figurea matplotlib.figure.Figure instance
fill[True | False]
gidan id string
hatch[‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
joinstyle[‘miter’ | ‘round’ | ‘bevel’]
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or lwfloat or None for default
path_effectsunknown
picker[None|float|boolean|callable]
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
visible[True | False]
zorderany number
-
-
- -
-
-matplotlib.pyplot.bone()
-

set the default colormap to bone and apply to current image if any. -See help(colormaps) for more information

-
- -
-
-matplotlib.pyplot.box(on=None)
-

Turn the axes box on or off. on may be a boolean or a string, -‘on’ or ‘off’.

-

If on is None, toggle state.

-
- -
-
-matplotlib.pyplot.boxplot(x, notch=None, sym=None, vert=None, whis=None, positions=None, widths=None, patch_artist=None, bootstrap=None, usermedians=None, conf_intervals=None, meanline=None, showmeans=None, showcaps=None, showbox=None, showfliers=None, boxprops=None, labels=None, flierprops=None, medianprops=None, meanprops=None, capprops=None, whiskerprops=None, manage_xticks=True, autorange=False, zorder=None, hold=None, data=None)
-

Make a box and whisker plot.

-

Make a box and whisker plot for each column of x or each -vector in sequence x. The box extends from the lower to -upper quartile values of the data, with a line at the median. -The whiskers extend from the box to show the range of the -data. Flier points are those past the end of the whiskers.

- --- - - - - - - - - -
Parameters:

x : Array or a sequence of vectors.

-
-

The input data.

-
-

notch : bool, optional (False)

-
-

If True, will produce a notched box plot. Otherwise, a -rectangular boxplot is produced. The notches represent the -confidence interval (CI) around the median. See the entry -for the bootstrap parameter for information regarding -how the locations of the notches are computed.

-
-

Note

-

In cases where the values of the CI are less than the -lower quartile or greater than the upper quartile, the -notches will extend beyond the box, giving it a -distinctive “flipped” appearance. This is expected -behavior and consistent with other statistical -visualization packages.

-
-
-

sym : str, optional

-
-

The default symbol for flier points. Enter an empty string -(‘’) if you don’t want to show fliers. If None, then the -fliers default to ‘b+’ If you want more control use the -flierprops kwarg.

-
-

vert : bool, optional (True)

-
-

If True (default), makes the boxes vertical. If False, -everything is drawn horizontally.

-
-

whis : float, sequence, or string (default = 1.5)

-
-

As a float, determines the reach of the whiskers to the beyond the -first and third quartiles. In other words, where IQR is the -interquartile range (Q3-Q1), the upper whisker will extend to -last datum less than Q3 + whis*IQR). Similarly, the lower whisker -will extend to the first datum greater than Q1 - whis*IQR. -Beyond the whiskers, data -are considered outliers and are plotted as individual -points. Set this to an unreasonably high value to force the -whiskers to show the min and max values. Alternatively, set -this to an ascending sequence of percentile (e.g., [5, 95]) -to set the whiskers at specific percentiles of the data. -Finally, whis can be the string 'range' to force the -whiskers to the min and max of the data.

-
-

bootstrap : int, optional

-
-

Specifies whether to bootstrap the confidence intervals -around the median for notched boxplots. If bootstrap is -None, no bootstrapping is performed, and notches are -calculated using a Gaussian-based asymptotic approximation -(see McGill, R., Tukey, J.W., and Larsen, W.A., 1978, and -Kendall and Stuart, 1967). Otherwise, bootstrap specifies -the number of times to bootstrap the median to determine its -95% confidence intervals. Values between 1000 and 10000 are -recommended.

-
-

usermedians : array-like, optional

-
-

An array or sequence whose first dimension (or length) is -compatible with x. This overrides the medians computed -by matplotlib for each element of usermedians that is not -None. When an element of usermedians is None, the median -will be computed by matplotlib as normal.

-
-

conf_intervals : array-like, optional

-
-

Array or sequence whose first dimension (or length) is -compatible with x and whose second dimension is 2. When -the an element of conf_intervals is not None, the -notch locations computed by matplotlib are overridden -(provided notch is True). When an element of -conf_intervals is None, the notches are computed by the -method specified by the other kwargs (e.g., bootstrap).

-
-

positions : array-like, optional

-
-

Sets the positions of the boxes. The ticks and limits are -automatically set to match the positions. Defaults to -range(1, N+1) where N is the number of boxes to be drawn.

-
-

widths : scalar or array-like

-
-

Sets the width of each box either with a scalar or a -sequence. The default is 0.5, or 0.15*(distance between -extreme positions), if that is smaller.

-
-

patch_artist : bool, optional (False)

-
-

If False produces boxes with the Line2D artist. Otherwise, -boxes and drawn with Patch artists.

-
-

labels : sequence, optional

-
-

Labels for each dataset. Length must be compatible with -dimensions of x.

-
-

manage_xticks : bool, optional (True)

-
-

If the function should adjust the xlim and xtick locations.

-
-

autorange : bool, optional (False)

-
-

When True and the data are distributed such that the 25th and -75th percentiles are equal, whis is set to 'range' such -that the whisker ends are at the minimum and maximum of the -data.

-
-

meanline : bool, optional (False)

-
-

If True (and showmeans is True), will try to render -the mean as a line spanning the full width of the box -according to meanprops (see below). Not recommended if -shownotches is also True. Otherwise, means will be shown -as points.

-
-

zorder : scalar, optional (None)

-
-

Sets the zorder of the boxplot.

-
-
Returns:

result : dict

-
-

A dictionary mapping each component of the boxplot to a list -of the matplotlib.lines.Line2D instances -created. That dictionary has the following keys (assuming -vertical boxplots):

-
    -
  • boxes: the main body of the boxplot showing the -quartiles and the median’s confidence intervals if -enabled.
  • -
  • medians: horizontal lines at the median of each box.
  • -
  • whiskers: the vertical lines extending to the most -extreme, non-outlier data points.
  • -
  • caps: the horizontal lines at the ends of the -whiskers.
  • -
  • fliers: points representing data that extend beyond -the whiskers (fliers).
  • -
  • means: points or lines representing the means.
  • -
-
-
Other Parameters:
 

showcaps : bool, optional (True)

-
-

Show the caps on the ends of whiskers.

-
-

showbox : bool, optional (True)

-
-

Show the central box.

-
-

showfliers : bool, optional (True)

-
-

Show the outliers beyond the caps.

-
-

showmeans : bool, optional (False)

-
-

Show the arithmetic means.

-
-

capprops : dict, optional (None)

-
-

Specifies the style of the caps.

-
-

boxprops : dict, optional (None)

-
-

Specifies the style of the box.

-
-

whiskerprops : dict, optional (None)

-
-

Specifies the style of the whiskers.

-
-

flierprops : dict, optional (None)

-
-

Specifies the style of the fliers.

-
-

medianprops : dict, optional (None)

-
-

Specifies the style of the median.

-
-

meanprops : dict, optional (None)

-
-

Specifies the style of the mean.

-
-
-

Examples

-

(Source code, png, pdf)

-
-../_images/boxplot_demo_00_002.png -
-

(png, pdf)

-
-../_images/boxplot_demo_01_002.png -
-
-

Note

-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All positional and all keyword arguments.
  • -
-
-
- -
-
-matplotlib.pyplot.broken_barh(xranges, yrange, hold=None, data=None, **kwargs)
-

Plot horizontal bars.

-

A collection of horizontal bars spanning yrange with a sequence of -xranges.

-

Required arguments:

-
-
---- - - - - - - - - - - - - - -
ArgumentDescription
xrangessequence of (xmin, xwidth)
yrangesequence of (ymin, ywidth)
-
-

kwargs are -matplotlib.collections.BrokenBarHCollection -properties:

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or antialiasedsBoolean or sequence of booleans
arrayunknown
axesan Axes instance
clima length 2 sequence of floats
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
cmapa colormap or registered colormap name
colormatplotlib color arg or sequence of rgba tuples
containsa callable function
edgecolor or edgecolorsmatplotlib color spec or sequence of specs
facecolor or facecolorsmatplotlib color spec or sequence of specs
figurea matplotlib.figure.Figure instance
gidan id string
hatch[ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
labelstring or anything printable with ‘%s’ conversion.
linestyle or dashes or linestyles[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or linewidths or lwfloat or sequence of floats
normunknown
offset_positionunknown
offsetsfloat or sequence of floats
path_effectsunknown
picker[None|float|boolean|callable]
pickradiusunknown
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
urlsunknown
visible[True | False]
zorderany number
-
-

these can either be a single argument, i.e.,:

-
facecolors = 'black'
-
-
-

or a sequence of arguments for the various bars, i.e.,:

-
facecolors = ('black', 'red', 'green')
-
-
-

Example:

-

(Source code, png, pdf)

-
-../_images/broken_barh2.png -
-
-

Note

-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All positional and all keyword arguments.
  • -
-
-
- -
-
-matplotlib.pyplot.cla()
-

Clear the current axes.

-
- -
-
-matplotlib.pyplot.clabel(CS, *args, **kwargs)
-

Label a contour plot.

-

Call signature:

-
clabel(cs, **kwargs)
-
-
-

Adds labels to line contours in cs, where cs is a -ContourSet object returned by -contour.

-
clabel(cs, v, **kwargs)
-
-
-

only labels contours listed in v.

-

Optional keyword arguments:

-
-
-
fontsize:
-
size in points or relative size e.g., ‘smaller’, ‘x-large’
-
colors:
-
    -
  • if None, the color of each label matches the color of -the corresponding contour
  • -
  • if one string color, e.g., colors = ‘r’ or colors = -‘red’, all labels will be plotted in this color
  • -
  • if a tuple of matplotlib color args (string, float, rgb, etc), -different labels will be plotted in different colors in the order -specified
  • -
-
-
inline:
-
controls whether the underlying contour is removed or -not. Default is True.
-
inline_spacing:
-
space in pixels to leave on each side of label when -placing inline. Defaults to 5. This spacing will be -exact for labels at locations where the contour is -straight, less so for labels on curved contours.
-
fmt:
-
a format string for the label. Default is ‘%1.3f’ -Alternatively, this can be a dictionary matching contour -levels with arbitrary strings to use for each contour level -(i.e., fmt[level]=string), or it can be any callable, such -as a Formatter instance, that -returns a string when called with a numeric contour level.
-
manual:
-

if True, contour labels will be placed manually using -mouse clicks. Click the first button near a contour to -add a label, click the second button (or potentially both -mouse buttons at once) to finish adding labels. The third -button can be used to remove the last label added, but -only if labels are not inline. Alternatively, the keyboard -can be used to select label locations (enter to end label -placement, delete or backspace act like the third mouse button, -and any other key will select a label location).

-

manual can be an iterable object of x,y tuples. Contour labels -will be created as if mouse is clicked at each x,y positions.

-
-
rightside_up:
-
if True (default), label rotations will always be plus -or minus 90 degrees from level.
-
use_clabeltext:
-
if True (default is False), ClabelText class (instead of -matplotlib.Text) is used to create labels. ClabelText -recalculates rotation angles of texts during the drawing time, -therefore this can be used if aspect of the axes changes.
-
-
-

(Source code)

-
-../_images/contour_demo_002.png -

(png, pdf)

-
-
-../_images/contour_demo_012.png -

(png, pdf)

-
-
-../_images/contour_demo_022.png -

(png, pdf)

-
-
-../_images/contour_demo_032.png -

(png, pdf)

-
-
-../_images/contour_demo_042.png -

(png, pdf)

-
-
-../_images/contour_demo_052.png -

(png, pdf)

-
-
- -
-
-matplotlib.pyplot.clf()
-

Clear the current figure.

-
- -
-
-matplotlib.pyplot.clim(vmin=None, vmax=None)
-

Set the color limits of the current image.

-

To apply clim to all axes images do:

-
clim(0, 0.5)
-
-
-

If either vmin or vmax is None, the image min/max respectively -will be used for color scaling.

-

If you want to set the clim of multiple images, -use, for example:

-
for im in gca().get_images():
-    im.set_clim(0, 0.05)
-
-
-
- -
-
-matplotlib.pyplot.close(*args)
-

Close a figure window.

-

close() by itself closes the current figure

-

close(h) where h is a Figure instance, closes that figure

-

close(num) closes figure number num

-

close(name) where name is a string, closes figure with that label

-

close('all') closes all the figure windows

-
- -
-
-matplotlib.pyplot.cohere(x, y, NFFT=256, Fs=2, Fc=0, detrend=<function detrend_none>, window=<function window_hanning>, noverlap=0, pad_to=None, sides='default', scale_by_freq=None, hold=None, data=None, **kwargs)
-

Plot the coherence between x and y.

-

Plot the coherence between x and y. Coherence is the -normalized cross spectral density:

- --- - - - - - -
Parameters:

Fs : scalar

-
-

The sampling frequency (samples per time unit). It is used -to calculate the Fourier frequencies, freqs, in cycles per time -unit. The default value is 2.

-
-

window : callable or ndarray

-
-

A function or a vector of length NFFT. To create window -vectors see window_hanning(), window_none(), -numpy.blackman(), numpy.hamming(), -numpy.bartlett(), scipy.signal(), -scipy.signal.get_window(), etc. The default is -window_hanning(). If a function is passed as the -argument, it must take a data segment as an argument and -return the windowed version of the segment.

-
-

sides : [ ‘default’ | ‘onesided’ | ‘twosided’ ]

-
-

Specifies which sides of the spectrum to return. Default gives the -default behavior, which returns one-sided for real data and both -for complex data. ‘onesided’ forces the return of a one-sided -spectrum, while ‘twosided’ forces two-sided.

-
-

pad_to : integer

-
-

The number of points to which the data segment is padded when -performing the FFT. This can be different from NFFT, which -specifies the number of data points used. While not increasing -the actual resolution of the spectrum (the minimum distance between -resolvable peaks), this can give more points in the plot, -allowing for more detail. This corresponds to the n parameter -in the call to fft(). The default is None, which sets pad_to -equal to NFFT

-
-

NFFT : integer

-
-

The number of data points used in each block for the FFT. -A power 2 is most efficient. The default value is 256. -This should NOT be used to get zero padding, or the scaling of the -result will be incorrect. Use pad_to for this instead.

-
-

detrend : {‘default’, ‘constant’, ‘mean’, ‘linear’, ‘none’} or callable

-
-

The function applied to each segment before fft-ing, -designed to remove the mean or linear trend. Unlike in -MATLAB, where the detrend parameter is a vector, in -matplotlib is it a function. The pylab -module defines detrend_none(), -detrend_mean(), and -detrend_linear(), but you can use -a custom function as well. You can also use a string to choose -one of the functions. ‘default’, ‘constant’, and ‘mean’ call -detrend_mean(). ‘linear’ calls -detrend_linear(). ‘none’ calls -detrend_none().

-
-

scale_by_freq : boolean, optional

-
-

Specifies whether the resulting density values should be scaled -by the scaling frequency, which gives density in units of Hz^-1. -This allows for integration over the returned frequency values. -The default is True for MATLAB compatibility.

-
-

noverlap : integer

-
-

The number of points of overlap between blocks. The -default value is 0 (no overlap).

-
-

Fc : integer

-
-

The center frequency of x (defaults to 0), which offsets -the x extents of the plot to reflect the frequency range used -when a signal is acquired and then filtered and downsampled to -baseband.

-
-

**kwargs :

-
-
-

Keyword arguments control the Line2D -properties of the coherence plot:

-
- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat (0.0 transparent through 1.0 opaque)
animated[True | False]
antialiased or aa[True | False]
axesan Axes instance
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
color or cany matplotlib color
containsa callable function
dash_capstyle[‘butt’ | ‘round’ | ‘projecting’]
dash_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
dashessequence of on/off ink in points
drawstyle[‘default’ | ‘steps’ | ‘steps-pre’ | ‘steps-mid’ | ‘steps-post’]
figurea matplotlib.figure.Figure instance
fillstyle[‘full’ | ‘left’ | ‘right’ | ‘bottom’ | ‘top’ | ‘none’]
gidan id string
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or lwfloat value in points
markerA valid marker style
markeredgecolor or mecany matplotlib color
markeredgewidth or mewfloat value in points
markerfacecolor or mfcany matplotlib color
markerfacecoloralt or mfcaltany matplotlib color
markersize or msfloat
markevery[None | int | length-2 tuple of int | slice | list/array of int | float | length-2 tuple of float]
path_effectsunknown
pickerfloat distance in points or callable pick function fn(artist, event)
pickradiusfloat distance in points
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
solid_capstyle[‘butt’ | ‘round’ | ‘projecting’]
solid_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
transforma matplotlib.transforms.Transform instance
urla url string
visible[True | False]
xdata1D array
ydata1D array
zorderany number
-
-
Returns:

The return value is a tuple (Cxy, f), where f are the

-

frequencies of the coherence vector.

-

kwargs are applied to the lines.

-
-

References

-

Bendat & Piersol – Random Data: Analysis and Measurement Procedures, -John Wiley & Sons (1986)

-

Examples

-

(Source code, png, pdf)

-
-../_images/cohere_demo2.png -
-
-

Note

-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All arguments with the following names: ‘x’, ‘y’.
  • -
-
-
- -
-
-matplotlib.pyplot.colorbar(mappable=None, cax=None, ax=None, **kw)
-

Add a colorbar to a plot.

-

Function signatures for the pyplot interface; all -but the first are also method signatures for the -colorbar() method:

-
colorbar(**kwargs)
-colorbar(mappable, **kwargs)
-colorbar(mappable, cax=cax, **kwargs)
-colorbar(mappable, ax=ax, **kwargs)
-
-
-

arguments:

-
-
-
mappable
-
the Image, -ContourSet, etc. to -which the colorbar applies; this argument is mandatory for the -colorbar() method but optional for the -colorbar() function, which sets the -default to the current image.
-
-
-

keyword arguments:

-
-
-
cax
-
None | axes object into which the colorbar will be drawn
-
ax
-
None | parent axes object(s) from which space for a new -colorbar axes will be stolen. If a list of axes is given -they will all be resized to make room for the colorbar axes.
-
use_gridspec
-
False | If cax is None, a new cax is created as an instance of -Axes. If ax is an instance of Subplot and use_gridspec is True, -cax is created as an instance of Subplot using the -grid_spec module.
-
-
-

Additional keyword arguments are of two kinds:

-
-

axes properties:

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
orientationvertical or horizontal
fraction0.15; fraction of original axes to use for colorbar
pad0.05 if vertical, 0.15 if horizontal; fraction -of original axes between colorbar and new image axes
shrink1.0; fraction by which to shrink the colorbar
aspect20; ratio of long to short dimensions
anchor(0.0, 0.5) if vertical; (0.5, 1.0) if horizontal; -the anchor point of the colorbar axes
panchor(1.0, 0.5) if vertical; (0.5, 0.0) if horizontal; -the anchor point of the colorbar parent axes. If -False, the parent axes’ anchor will be unchanged
-
-

colorbar properties:

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
extend[ ‘neither’ | ‘both’ | ‘min’ | ‘max’ ] -If not ‘neither’, make pointed end(s) for out-of- -range values. These are set for a given colormap -using the colormap set_under and set_over methods.
extendfrac[ None | ‘auto’ | length | lengths ] -If set to None, both the minimum and maximum -triangular colorbar extensions with have a length of -5% of the interior colorbar length (this is the -default setting). If set to ‘auto’, makes the -triangular colorbar extensions the same lengths as -the interior boxes (when spacing is set to -‘uniform’) or the same lengths as the respective -adjacent interior boxes (when spacing is set to -‘proportional’). If a scalar, indicates the length -of both the minimum and maximum triangular colorbar -extensions as a fraction of the interior colorbar -length. A two-element sequence of fractions may also -be given, indicating the lengths of the minimum and -maximum colorbar extensions respectively as a -fraction of the interior colorbar length.
extendrect[ False | True ] -If False the minimum and maximum colorbar extensions -will be triangular (the default). If True the -extensions will be rectangular.
spacing[ ‘uniform’ | ‘proportional’ ] -Uniform spacing gives each discrete color the same -space; proportional makes the space proportional to -the data interval.
ticks[ None | list of ticks | Locator object ] -If None, ticks are determined automatically from the -input.
format[ None | format string | Formatter object ] -If None, the -ScalarFormatter is used. -If a format string is given, e.g., ‘%.3f’, that is -used. An alternative -Formatter object may be -given instead.
drawedges[ False | True ] If true, draw lines at color -boundaries.
-

The following will probably be useful only in the context of -indexed colors (that is, when the mappable has norm=NoNorm()), -or other unusual circumstances.

- ---- - - - - - - - - - - - - - -
PropertyDescription
boundariesNone or a sequence
valuesNone or a sequence which must be of length 1 less -than the sequence of boundaries. For each region -delimited by adjacent entries in boundaries, the -color mapped to the corresponding value in values -will be used.
-
-
-

If mappable is a ContourSet, its extend -kwarg is included automatically.

-

Note that the shrink kwarg provides a simple way to keep a vertical -colorbar, for example, from being taller than the axes of the mappable -to which the colorbar is attached; but it is a manual method requiring -some trial and error. If the colorbar is too tall (or a horizontal -colorbar is too wide) use a smaller value of shrink.

-

For more precise control, you can manually specify the positions of -the axes objects in which the mappable and the colorbar are drawn. In -this case, do not use any of the axes properties kwargs.

-

It is known that some vector graphics viewer (svg and pdf) renders white gaps -between segments of the colorbar. This is due to bugs in the viewers not -matplotlib. As a workaround the colorbar can be rendered with overlapping -segments:

-
cbar = colorbar()
-cbar.solids.set_edgecolor("face")
-draw()
-
-
-

However this has negative consequences in other circumstances. Particularly -with semi transparent images (alpha < 1) and colorbar extensions and is not -enabled by default see (issue #1188).

-
-
returns:
-
Colorbar instance; see also its base class, -ColorbarBase. Call the -set_label() method -to label the colorbar.
-
-
- -
-
-matplotlib.pyplot.colors()
-

This is a do-nothing function to provide you with help on how -matplotlib handles colors.

-

Commands which take color arguments can use several formats to -specify the colors. For the basic built-in colors, you can use a -single letter

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AliasColor
‘b’blue
‘g’green
‘r’red
‘c’cyan
‘m’magenta
‘y’yellow
‘k’black
‘w’white
-
-

For a greater range of colors, you have two options. You can -specify the color using an html hex string, as in:

-
color = '#eeefff'
-
-
-

or you can pass an R,G,B tuple, where each of R,G,B are in the -range [0,1].

-

You can also use any legal html name for a color, for example:

-
color = 'red'
-color = 'burlywood'
-color = 'chartreuse'
-
-
-

The example below creates a subplot with a dark -slate gray background:

-
subplot(111, facecolor=(0.1843, 0.3098, 0.3098))
-
-
-

Here is an example that creates a pale turquoise title:

-
title('Is this the best color?', color='#afeeee')
-
-
-
- -
-
-matplotlib.pyplot.connect(s, func)
-

Connect event with string s to func. The signature of func is:

-
def func(event)
-
-
-

where event is a matplotlib.backend_bases.Event. The -following events are recognized

-
    -
  • ‘button_press_event’
  • -
  • ‘button_release_event’
  • -
  • ‘draw_event’
  • -
  • ‘key_press_event’
  • -
  • ‘key_release_event’
  • -
  • ‘motion_notify_event’
  • -
  • ‘pick_event’
  • -
  • ‘resize_event’
  • -
  • ‘scroll_event’
  • -
  • ‘figure_enter_event’,
  • -
  • ‘figure_leave_event’,
  • -
  • ‘axes_enter_event’,
  • -
  • ‘axes_leave_event’
  • -
  • ‘close_event’
  • -
-

For the location events (button and key press/release), if the -mouse is over the axes, the variable event.inaxes will be -set to the Axes the event occurs is -over, and additionally, the variables event.xdata and -event.ydata will be defined. This is the mouse location -in data coords. See -KeyEvent and -MouseEvent for more info.

-

Return value is a connection id that can be used with -mpl_disconnect().

-

Example usage:

-
def on_press(event):
-    print('you pressed', event.button, event.xdata, event.ydata)
-
-cid = canvas.mpl_connect('button_press_event', on_press)
-
-
-
- -
-
-matplotlib.pyplot.contour(*args, **kwargs)
-

Plot contours.

-

contour() and -contourf() draw contour lines and -filled contours, respectively. Except as noted, function -signatures and return values are the same for both versions.

-

contourf() differs from the MATLAB -version in that it does not draw the polygon edges. -To draw edges, add line contours with -calls to contour().

-

Call signatures:

-
contour(Z)
-
-
-

make a contour plot of an array Z. The level values are chosen -automatically.

-
contour(X,Y,Z)
-
-
-

X, Y specify the (x, y) coordinates of the surface

-
contour(Z,N)
-contour(X,Y,Z,N)
-
-
-

contour up to N automatically-chosen levels.

-
contour(Z,V)
-contour(X,Y,Z,V)
-
-
-

draw contour lines at the values specified in sequence V, -which must be in increasing order.

-
contourf(..., V)
-
-
-

fill the len(V)-1 regions between the values in V, -which must be in increasing order.

-
contour(Z, **kwargs)
-
-
-

Use keyword args to control colors, linewidth, origin, cmap ... see -below for more details.

-

X and Y must both be 2-D with the same shape as Z, or they -must both be 1-D such that len(X) is the number of columns in -Z and len(Y) is the number of rows in Z.

-

C = contour(...) returns a -QuadContourSet object.

-

Optional keyword arguments:

-
-
-
corner_mask: [ True | False | ‘legacy’ ]
-

Enable/disable corner masking, which only has an effect if Z is -a masked array. If False, any quad touching a masked point is -masked out. If True, only the triangular corners of quads -nearest those points are always masked out, other triangular -corners comprising three unmasked points are contoured as usual. -If ‘legacy’, the old contouring algorithm is used, which is -equivalent to False and is deprecated, only remaining whilst the -new algorithm is tested fully.

-

If not specified, the default is taken from -rcParams[‘contour.corner_mask’], which is True unless it has -been modified.

-
-
colors: [ None | string | (mpl_colors) ]
-

If None, the colormap specified by cmap will be used.

-

If a string, like ‘r’ or ‘red’, all levels will be plotted in this -color.

-

If a tuple of matplotlib color args (string, float, rgb, etc), -different levels will be plotted in different colors in the order -specified.

-
-
alpha: float
-
The alpha blending value
-
cmap: [ None | Colormap ]
-
A cm Colormap instance or -None. If cmap is None and colors is None, a -default Colormap is used.
-
norm: [ None | Normalize ]
-
A matplotlib.colors.Normalize instance for -scaling data values to colors. If norm is None and -colors is None, the default linear scaling is used.
-
vmin, vmax: [ None | scalar ]
-
If not None, either or both of these values will be -supplied to the matplotlib.colors.Normalize -instance, overriding the default color scaling based on -levels.
-
levels: [level0, level1, ..., leveln]
-
A list of floating point numbers indicating the level -curves to draw, in increasing order; e.g., to draw just -the zero contour pass levels=[0]
-
origin: [ None | ‘upper’ | ‘lower’ | ‘image’ ]
-

If None, the first value of Z will correspond to the -lower left corner, location (0,0). If ‘image’, the rc -value for image.origin will be used.

-

This keyword is not active if X and Y are specified in -the call to contour.

-
-
-

extent: [ None | (x0,x1,y0,y1) ]

-
-

If origin is not None, then extent is interpreted as -in matplotlib.pyplot.imshow(): it gives the outer -pixel boundaries. In this case, the position of Z[0,0] -is the center of the pixel, not a corner. If origin is -None, then (x0, y0) is the position of Z[0,0], and -(x1, y1) is the position of Z[-1,-1].

-

This keyword is not active if X and Y are specified in -the call to contour.

-
-
-
locator: [ None | ticker.Locator subclass ]
-
If locator is None, the default -MaxNLocator is used. The -locator is used to determine the contour levels if they -are not given explicitly via the V argument.
-
extend: [ ‘neither’ | ‘both’ | ‘min’ | ‘max’ ]
-
Unless this is ‘neither’, contour levels are automatically -added to one or both ends of the range so that all data -are included. These added ranges are then mapped to the -special colormap values which default to the ends of the -colormap range, but can be set via -matplotlib.colors.Colormap.set_under() and -matplotlib.colors.Colormap.set_over() methods.
-
xunits, yunits: [ None | registered units ]
-
Override axis units by specifying an instance of a -matplotlib.units.ConversionInterface.
-
antialiased: [ True | False ]
-
enable antialiasing, overriding the defaults. For -filled contours, the default is True. For line contours, -it is taken from rcParams[‘lines.antialiased’].
-
nchunk: [ 0 | integer ]
-
If 0, no subdivision of the domain. Specify a positive integer to -divide the domain into subdomains of nchunk by nchunk quads. -Chunking reduces the maximum length of polygons generated by the -contouring algorithm which reduces the rendering workload passed -on to the backend and also requires slightly less RAM. It can -however introduce rendering artifacts at chunk boundaries depending -on the backend, the antialiased flag and value of alpha.
-
-
-

contour-only keyword arguments:

-
-
-
linewidths: [ None | number | tuple of numbers ]
-

If linewidths is None, the default width in -lines.linewidth in matplotlibrc is used.

-

If a number, all levels will be plotted with this linewidth.

-

If a tuple, different levels will be plotted with different -linewidths in the order specified.

-
-
linestyles: [ None | ‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’ ]
-

If linestyles is None, the default is ‘solid’ unless -the lines are monochrome. In that case, negative -contours will take their linestyle from the matplotlibrc -contour.negative_linestyle setting.

-

linestyles can also be an iterable of the above strings -specifying a set of linestyles to be used. If this -iterable is shorter than the number of contour levels -it will be repeated as necessary.

-
-
-
-

contourf-only keyword arguments:

-
-
-
hatches:
-
A list of cross hatch patterns to use on the filled areas. -If None, no hatching will be added to the contour. -Hatching is supported in the PostScript, PDF, SVG and Agg -backends only.
-
-
-

Note: contourf fills intervals that are closed at the top; that -is, for boundaries z1 and z2, the filled region is:

-
z1 < z <= z2
-
-
-

There is one exception: if the lowest boundary coincides with -the minimum value of the z array, then that minimum value -will be included in the lowest interval.

-

Examples:

-

(Source code)

-
-../_images/contour_demo_002.png -

(png, pdf)

-
-
-../_images/contour_demo_012.png -

(png, pdf)

-
-
-../_images/contour_demo_022.png -

(png, pdf)

-
-
-../_images/contour_demo_032.png -

(png, pdf)

-
-
-../_images/contour_demo_042.png -

(png, pdf)

-
-
-../_images/contour_demo_052.png -

(png, pdf)

-
-

(Source code)

-
-../_images/contourf_demo_002.png -

(png, pdf)

-
-
-../_images/contourf_demo_012.png -

(png, pdf)

-
-
-../_images/contourf_demo_022.png -

(png, pdf)

-
-

(Source code, png, pdf)

-
-../_images/contour_corner_mask3.png -
-
- -
-
-matplotlib.pyplot.contourf(*args, **kwargs)
-

Plot contours.

-

contour() and -contourf() draw contour lines and -filled contours, respectively. Except as noted, function -signatures and return values are the same for both versions.

-

contourf() differs from the MATLAB -version in that it does not draw the polygon edges. -To draw edges, add line contours with -calls to contour().

-

Call signatures:

-
contour(Z)
-
-
-

make a contour plot of an array Z. The level values are chosen -automatically.

-
contour(X,Y,Z)
-
-
-

X, Y specify the (x, y) coordinates of the surface

-
contour(Z,N)
-contour(X,Y,Z,N)
-
-
-

contour up to N automatically-chosen levels.

-
contour(Z,V)
-contour(X,Y,Z,V)
-
-
-

draw contour lines at the values specified in sequence V, -which must be in increasing order.

-
contourf(..., V)
-
-
-

fill the len(V)-1 regions between the values in V, -which must be in increasing order.

-
contour(Z, **kwargs)
-
-
-

Use keyword args to control colors, linewidth, origin, cmap ... see -below for more details.

-

X and Y must both be 2-D with the same shape as Z, or they -must both be 1-D such that len(X) is the number of columns in -Z and len(Y) is the number of rows in Z.

-

C = contour(...) returns a -QuadContourSet object.

-

Optional keyword arguments:

-
-
-
corner_mask: [ True | False | ‘legacy’ ]
-

Enable/disable corner masking, which only has an effect if Z is -a masked array. If False, any quad touching a masked point is -masked out. If True, only the triangular corners of quads -nearest those points are always masked out, other triangular -corners comprising three unmasked points are contoured as usual. -If ‘legacy’, the old contouring algorithm is used, which is -equivalent to False and is deprecated, only remaining whilst the -new algorithm is tested fully.

-

If not specified, the default is taken from -rcParams[‘contour.corner_mask’], which is True unless it has -been modified.

-
-
colors: [ None | string | (mpl_colors) ]
-

If None, the colormap specified by cmap will be used.

-

If a string, like ‘r’ or ‘red’, all levels will be plotted in this -color.

-

If a tuple of matplotlib color args (string, float, rgb, etc), -different levels will be plotted in different colors in the order -specified.

-
-
alpha: float
-
The alpha blending value
-
cmap: [ None | Colormap ]
-
A cm Colormap instance or -None. If cmap is None and colors is None, a -default Colormap is used.
-
norm: [ None | Normalize ]
-
A matplotlib.colors.Normalize instance for -scaling data values to colors. If norm is None and -colors is None, the default linear scaling is used.
-
vmin, vmax: [ None | scalar ]
-
If not None, either or both of these values will be -supplied to the matplotlib.colors.Normalize -instance, overriding the default color scaling based on -levels.
-
levels: [level0, level1, ..., leveln]
-
A list of floating point numbers indicating the level -curves to draw, in increasing order; e.g., to draw just -the zero contour pass levels=[0]
-
origin: [ None | ‘upper’ | ‘lower’ | ‘image’ ]
-

If None, the first value of Z will correspond to the -lower left corner, location (0,0). If ‘image’, the rc -value for image.origin will be used.

-

This keyword is not active if X and Y are specified in -the call to contour.

-
-
-

extent: [ None | (x0,x1,y0,y1) ]

-
-

If origin is not None, then extent is interpreted as -in matplotlib.pyplot.imshow(): it gives the outer -pixel boundaries. In this case, the position of Z[0,0] -is the center of the pixel, not a corner. If origin is -None, then (x0, y0) is the position of Z[0,0], and -(x1, y1) is the position of Z[-1,-1].

-

This keyword is not active if X and Y are specified in -the call to contour.

-
-
-
locator: [ None | ticker.Locator subclass ]
-
If locator is None, the default -MaxNLocator is used. The -locator is used to determine the contour levels if they -are not given explicitly via the V argument.
-
extend: [ ‘neither’ | ‘both’ | ‘min’ | ‘max’ ]
-
Unless this is ‘neither’, contour levels are automatically -added to one or both ends of the range so that all data -are included. These added ranges are then mapped to the -special colormap values which default to the ends of the -colormap range, but can be set via -matplotlib.colors.Colormap.set_under() and -matplotlib.colors.Colormap.set_over() methods.
-
xunits, yunits: [ None | registered units ]
-
Override axis units by specifying an instance of a -matplotlib.units.ConversionInterface.
-
antialiased: [ True | False ]
-
enable antialiasing, overriding the defaults. For -filled contours, the default is True. For line contours, -it is taken from rcParams[‘lines.antialiased’].
-
nchunk: [ 0 | integer ]
-
If 0, no subdivision of the domain. Specify a positive integer to -divide the domain into subdomains of nchunk by nchunk quads. -Chunking reduces the maximum length of polygons generated by the -contouring algorithm which reduces the rendering workload passed -on to the backend and also requires slightly less RAM. It can -however introduce rendering artifacts at chunk boundaries depending -on the backend, the antialiased flag and value of alpha.
-
-
-

contour-only keyword arguments:

-
-
-
linewidths: [ None | number | tuple of numbers ]
-

If linewidths is None, the default width in -lines.linewidth in matplotlibrc is used.

-

If a number, all levels will be plotted with this linewidth.

-

If a tuple, different levels will be plotted with different -linewidths in the order specified.

-
-
linestyles: [ None | ‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’ ]
-

If linestyles is None, the default is ‘solid’ unless -the lines are monochrome. In that case, negative -contours will take their linestyle from the matplotlibrc -contour.negative_linestyle setting.

-

linestyles can also be an iterable of the above strings -specifying a set of linestyles to be used. If this -iterable is shorter than the number of contour levels -it will be repeated as necessary.

-
-
-
-

contourf-only keyword arguments:

-
-
-
hatches:
-
A list of cross hatch patterns to use on the filled areas. -If None, no hatching will be added to the contour. -Hatching is supported in the PostScript, PDF, SVG and Agg -backends only.
-
-
-

Note: contourf fills intervals that are closed at the top; that -is, for boundaries z1 and z2, the filled region is:

-
z1 < z <= z2
-
-
-

There is one exception: if the lowest boundary coincides with -the minimum value of the z array, then that minimum value -will be included in the lowest interval.

-

Examples:

-

(Source code)

-
-../_images/contour_demo_002.png -

(png, pdf)

-
-
-../_images/contour_demo_012.png -

(png, pdf)

-
-
-../_images/contour_demo_022.png -

(png, pdf)

-
-
-../_images/contour_demo_032.png -

(png, pdf)

-
-
-../_images/contour_demo_042.png -

(png, pdf)

-
-
-../_images/contour_demo_052.png -

(png, pdf)

-
-

(Source code)

-
-../_images/contourf_demo_002.png -

(png, pdf)

-
-
-../_images/contourf_demo_012.png -

(png, pdf)

-
-
-../_images/contourf_demo_022.png -

(png, pdf)

-
-

(Source code, png, pdf)

-
-../_images/contour_corner_mask3.png -
-
- -
-
-matplotlib.pyplot.cool()
-

set the default colormap to cool and apply to current image if any. -See help(colormaps) for more information

-
- -
-
-matplotlib.pyplot.copper()
-

set the default colormap to copper and apply to current image if any. -See help(colormaps) for more information

-
- -
-
-matplotlib.pyplot.csd(x, y, NFFT=None, Fs=None, Fc=None, detrend=None, window=None, noverlap=None, pad_to=None, sides=None, scale_by_freq=None, return_line=None, hold=None, data=None, **kwargs)
-

Plot the cross-spectral density.

-

Call signature:

-
csd(x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
-    window=mlab.window_hanning, noverlap=0, pad_to=None,
-    sides='default', scale_by_freq=None, return_line=None, **kwargs)
-
-
-

The cross spectral density by Welch’s average -periodogram method. The vectors x and y are divided into -NFFT length segments. Each segment is detrended by function -detrend and windowed by function window. noverlap gives -the length of the overlap between segments. The product of -the direct FFTs of x and y are averaged over each segment -to compute , with a scaling to correct for power -loss due to windowing.

-

If len(x) < NFFT or len(y) < NFFT, they will be zero -padded to NFFT.

- --- - - - - - -
Parameters:

x, y : 1-D arrays or sequences

-
-

Arrays or sequences containing the data

-
-

Fs : scalar

-
-

The sampling frequency (samples per time unit). It is used -to calculate the Fourier frequencies, freqs, in cycles per time -unit. The default value is 2.

-
-

window : callable or ndarray

-
-

A function or a vector of length NFFT. To create window -vectors see window_hanning(), window_none(), -numpy.blackman(), numpy.hamming(), -numpy.bartlett(), scipy.signal(), -scipy.signal.get_window(), etc. The default is -window_hanning(). If a function is passed as the -argument, it must take a data segment as an argument and -return the windowed version of the segment.

-
-

sides : [ ‘default’ | ‘onesided’ | ‘twosided’ ]

-
-

Specifies which sides of the spectrum to return. Default gives the -default behavior, which returns one-sided for real data and both -for complex data. ‘onesided’ forces the return of a one-sided -spectrum, while ‘twosided’ forces two-sided.

-
-

pad_to : integer

-
-

The number of points to which the data segment is padded when -performing the FFT. This can be different from NFFT, which -specifies the number of data points used. While not increasing -the actual resolution of the spectrum (the minimum distance between -resolvable peaks), this can give more points in the plot, -allowing for more detail. This corresponds to the n parameter -in the call to fft(). The default is None, which sets pad_to -equal to NFFT

-
-

NFFT : integer

-
-

The number of data points used in each block for the FFT. -A power 2 is most efficient. The default value is 256. -This should NOT be used to get zero padding, or the scaling of the -result will be incorrect. Use pad_to for this instead.

-
-

detrend : {‘default’, ‘constant’, ‘mean’, ‘linear’, ‘none’} or callable

-
-

The function applied to each segment before fft-ing, -designed to remove the mean or linear trend. Unlike in -MATLAB, where the detrend parameter is a vector, in -matplotlib is it a function. The pylab -module defines detrend_none(), -detrend_mean(), and -detrend_linear(), but you can use -a custom function as well. You can also use a string to choose -one of the functions. ‘default’, ‘constant’, and ‘mean’ call -detrend_mean(). ‘linear’ calls -detrend_linear(). ‘none’ calls -detrend_none().

-
-

scale_by_freq : boolean, optional

-
-

Specifies whether the resulting density values should be scaled -by the scaling frequency, which gives density in units of Hz^-1. -This allows for integration over the returned frequency values. -The default is True for MATLAB compatibility.

-
-

noverlap : integer

-
-

The number of points of overlap between segments. -The default value is 0 (no overlap).

-
-

Fc : integer

-
-

The center frequency of x (defaults to 0), which offsets -the x extents of the plot to reflect the frequency range used -when a signal is acquired and then filtered and downsampled to -baseband.

-
-

return_line : bool

-
-

Whether to include the line object plotted in the returned values. -Default is False.

-
-

**kwargs :

-
-
-

Keyword arguments control the Line2D -properties:

-
- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat (0.0 transparent through 1.0 opaque)
animated[True | False]
antialiased or aa[True | False]
axesan Axes instance
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
color or cany matplotlib color
containsa callable function
dash_capstyle[‘butt’ | ‘round’ | ‘projecting’]
dash_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
dashessequence of on/off ink in points
drawstyle[‘default’ | ‘steps’ | ‘steps-pre’ | ‘steps-mid’ | ‘steps-post’]
figurea matplotlib.figure.Figure instance
fillstyle[‘full’ | ‘left’ | ‘right’ | ‘bottom’ | ‘top’ | ‘none’]
gidan id string
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or lwfloat value in points
markerA valid marker style
markeredgecolor or mecany matplotlib color
markeredgewidth or mewfloat value in points
markerfacecolor or mfcany matplotlib color
markerfacecoloralt or mfcaltany matplotlib color
markersize or msfloat
markevery[None | int | length-2 tuple of int | slice | list/array of int | float | length-2 tuple of float]
path_effectsunknown
pickerfloat distance in points or callable pick function fn(artist, event)
pickradiusfloat distance in points
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
solid_capstyle[‘butt’ | ‘round’ | ‘projecting’]
solid_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
transforma matplotlib.transforms.Transform instance
urla url string
visible[True | False]
xdata1D array
ydata1D array
zorderany number
-
-
Returns:

Pxy : 1-D array

-
-

The values for the cross spectrum P_{xy} before scaling -(complex valued)

-
-

freqs : 1-D array

-
-

The frequencies corresponding to the elements in Pxy

-
-

line : a Line2D instance

-
-

The line created by this function. -Only returned if return_line is True.

-
-
-
-

See also

-
-
psd()
-
psd() is the equivalent to setting y=x.
-
-
In addition to the above described arguments, this function can take a data keyword argument. If such a data argument is given, the following arguments are replaced by data[<arg>]: * All arguments with the following names: ‘x’, ‘y’.
-
-
-

Notes

-

For plotting, the power is plotted as - for decibels, though P_{xy} itself -is returned.

-

References

-

Bendat & Piersol – Random Data: Analysis and Measurement Procedures, -John Wiley & Sons (1986)

-

Examples

-

(Source code, png, pdf)

-
-../_images/csd_demo2.png -
-
- -
-
-matplotlib.pyplot.delaxes(*args)
-

Remove an axes from the current figure. If ax -doesn’t exist, an error will be raised.

-

delaxes(): delete the current axes

-
- -
-
-matplotlib.pyplot.disconnect(cid)
-

Disconnect callback id cid

-

Example usage:

-
cid = canvas.mpl_connect('button_press_event', on_press)
-#...later
-canvas.mpl_disconnect(cid)
-
-
-
- -
-
-matplotlib.pyplot.draw()
-

Redraw the current figure.

-

This is used to update a figure that has been altered, but not -automatically re-drawn. If interactive mode is on (ion()), this -should be only rarely needed, but there may be ways to modify the state of -a figure without marking it as stale. Please report these cases as -bugs.

-

A more object-oriented alternative, given any -Figure instance, fig, that -was created using a pyplot function, is:

-
fig.canvas.draw_idle()
-
-
-
- -
-
-matplotlib.pyplot.errorbar(x, y, yerr=None, xerr=None, fmt='', ecolor=None, elinewidth=None, capsize=None, barsabove=False, lolims=False, uplims=False, xlolims=False, xuplims=False, errorevery=1, capthick=None, hold=None, data=None, **kwargs)
-

Plot an errorbar graph.

-

Plot x versus y with error deltas in yerr and xerr. -Vertical errorbars are plotted if yerr is not None. -Horizontal errorbars are plotted if xerr is not None.

-

x, y, xerr, and yerr can all be scalars, which plots a -single error bar at x, y.

- --- - - - - - - - - -
Parameters:

x : scalar or array-like

-

y : scalar or array-like

-

xerr/yerr : scalar or array-like, shape(N,) or shape(2,N), optional

-
-

If a scalar number, len(N) array-like object, or a N-element -array-like object, errorbars are drawn at +/-value relative -to the data. Default is None.

-

If a sequence of shape 2xN, errorbars are drawn at -row1 -and +row2 relative to the data.

-
-

fmt : plot format string, optional, default: None

-
-

The plot format symbol. If fmt is ‘none’ (case-insensitive), -only the errorbars are plotted. This is used for adding -errorbars to a bar plot, for example. Default is ‘’, -an empty plot format string; properties are -then identical to the defaults for plot().

-
-

ecolor : mpl color, optional, default: None

-
-

A matplotlib color arg which gives the color the errorbar lines; -if None, use the color of the line connecting the markers.

-
-

elinewidth : scalar, optional, default: None

-
-

The linewidth of the errorbar lines. If None, use the linewidth.

-
-

capsize : scalar, optional, default: None

-
-

The length of the error bar caps in points; if None, it will -take the value from errorbar.capsize -rcParam.

-
-

capthick : scalar, optional, default: None

-
-

An alias kwarg to markeredgewidth (a.k.a. - mew). This -setting is a more sensible name for the property that -controls the thickness of the error bar cap in points. For -backwards compatibility, if mew or markeredgewidth are given, -then they will over-ride capthick. This may change in future -releases.

-
-

barsabove : bool, optional, default: False

-
-

if True , will plot the errorbars above the plot -symbols. Default is below.

-
-

lolims / uplims / xlolims / xuplims : bool, optional, default:None

-
-

These arguments can be used to indicate that a value gives -only upper/lower limits. In that case a caret symbol is -used to indicate this. lims-arguments may be of the same -type as xerr and yerr. To use limits with inverted -axes, set_xlim() or set_ylim() must be called -before errorbar().

-
-

errorevery : positive integer, optional, default:1

-
-

subsamples the errorbars. e.g., if errorevery=5, errorbars for -every 5-th datapoint will be plotted. The data plot itself still -shows all data points.

-
-
Returns:

plotline : Line2D instance

-
-

x, y plot markers and/or line

-
-

caplines : list of Line2D instances

-
-

error bar cap

-
-

barlinecols : list of LineCollection

-
-

horizontal and vertical error ranges.

-
-
Other Parameters:
 

kwargs : All other keyword arguments are passed on to the plot

-
-
-

command for the markers. For example, this code makes big red -squares with thick green edges:

-
x,y,yerr = rand(3,10)
-errorbar(x, y, yerr, marker='s', mfc='red',
-         mec='green', ms=20, mew=4)
-
-
-

where mfc, mec, ms and mew are aliases for the longer -property names, markerfacecolor, markeredgecolor, markersize -and markeredgewidth.

-

valid kwargs for the marker properties are

-
- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat (0.0 transparent through 1.0 opaque)
animated[True | False]
antialiased or aa[True | False]
axesan Axes instance
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
color or cany matplotlib color
containsa callable function
dash_capstyle[‘butt’ | ‘round’ | ‘projecting’]
dash_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
dashessequence of on/off ink in points
drawstyle[‘default’ | ‘steps’ | ‘steps-pre’ | ‘steps-mid’ | ‘steps-post’]
figurea matplotlib.figure.Figure instance
fillstyle[‘full’ | ‘left’ | ‘right’ | ‘bottom’ | ‘top’ | ‘none’]
gidan id string
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or lwfloat value in points
markerA valid marker style
markeredgecolor or mecany matplotlib color
markeredgewidth or mewfloat value in points
markerfacecolor or mfcany matplotlib color
markerfacecoloralt or mfcaltany matplotlib color
markersize or msfloat
markevery[None | int | length-2 tuple of int | slice | list/array of int | float | length-2 tuple of float]
path_effectsunknown
pickerfloat distance in points or callable pick function fn(artist, event)
pickradiusfloat distance in points
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
solid_capstyle[‘butt’ | ‘round’ | ‘projecting’]
solid_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
transforma matplotlib.transforms.Transform instance
urla url string
visible[True | False]
xdata1D array
ydata1D array
zorderany number
-
-
-

Examples

-

(Source code, png, pdf)

-
-../_images/errorbar_demo2.png -
-
-

Note

-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All arguments with the following names: ‘x’, ‘xerr’, ‘y’, ‘yerr’.
  • -
-
-
- -
-
-matplotlib.pyplot.eventplot(positions, orientation='horizontal', lineoffsets=1, linelengths=1, linewidths=None, colors=None, linestyles='solid', hold=None, data=None, **kwargs)
-

Plot identical parallel lines at specific positions.

-

Plot parallel lines at the given positions. positions should be a 1D -or 2D array-like object, with each row corresponding to a row or column -of lines.

-

This type of plot is commonly used in neuroscience for representing -neural events, where it is commonly called a spike raster, dot raster, -or raster plot.

-

However, it is useful in any situation where you wish to show the -timing or position of multiple sets of discrete events, such as the -arrival times of people to a business on each day of the month or the -date of hurricanes each year of the last century.

-
-
orientation : [ ‘horizontal’ | ‘vertical’ ]
-
‘horizontal’ : the lines will be vertical and arranged in rows -‘vertical’ : lines will be horizontal and arranged in columns
-
lineoffsets :
-
A float or array-like containing floats.
-
linelengths :
-
A float or array-like containing floats.
-
linewidths :
-
A float or array-like containing floats.
-
colors
-
must be a sequence of RGBA tuples (e.g., arbitrary color -strings, etc, not allowed) or a list of such sequences
-
linestyles :
-
[ ‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’ ] or an array of these -values
-
-

For linelengths, linewidths, colors, and linestyles, if only a single -value is given, that value is applied to all lines. If an array-like -is given, it must have the same length as positions, and each value -will be applied to the corresponding row or column in positions.

-

Returns a list of matplotlib.collections.EventCollection -objects that were added.

-

kwargs are LineCollection properties:

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or antialiasedsBoolean or sequence of booleans
arrayunknown
axesan Axes instance
clima length 2 sequence of floats
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
cmapa colormap or registered colormap name
colormatplotlib color arg or sequence of rgba tuples
containsa callable function
edgecolor or edgecolorsmatplotlib color spec or sequence of specs
facecolor or facecolorsmatplotlib color spec or sequence of specs
figurea matplotlib.figure.Figure instance
gidan id string
hatch[ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
labelstring or anything printable with ‘%s’ conversion.
linestyle or dashes or linestyles[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or linewidths or lwfloat or sequence of floats
normunknown
offset_positionunknown
offsetsfloat or sequence of floats
path_effectsunknown
pathsunknown
picker[None|float|boolean|callable]
pickradiusunknown
rasterized[True | False | None]
segmentsunknown
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
urlsunknown
vertsunknown
visible[True | False]
zorderany number
-
-

Example:

-

(Source code, png, pdf)

-
-../_images/eventplot_demo3.png -
-
-

Note

-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All arguments with the following names: ‘colors’, ‘linelengths’, ‘lineoffsets’, ‘linestyles’, ‘linewidths’, ‘positions’.
  • -
-
-
- -
-
-matplotlib.pyplot.figimage(*args, **kwargs)
-

Adds a non-resampled image to the figure.

-

call signatures:

-
figimage(X, **kwargs)
-
-
-

adds a non-resampled array X to the figure.

-
figimage(X, xo, yo)
-
-
-

with pixel offsets xo, yo,

-

X must be a float array:

-
    -
  • If X is MxN, assume luminance (grayscale)
  • -
  • If X is MxNx3, assume RGB
  • -
  • If X is MxNx4, assume RGBA
  • -
-

Optional keyword arguments:

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeywordDescription
resizea boolean, True or False. If “True”, then re-size the -Figure to match the given image size.
xo or yoAn integer, the x and y image offset in pixels
cmapa matplotlib.colors.Colormap instance, e.g., -cm.jet. If None, default to the rc image.cmap -value
norma matplotlib.colors.Normalize instance. The -default is normalization(). This scales luminance -> 0-1
vmin|vmaxare used to scale a luminance image to 0-1. If either -is None, the min and max of the luminance values will -be used. Note if you pass a norm instance, the settings -for vmin and vmax will be ignored.
alphathe alpha blending value, default is None
origin[ ‘upper’ | ‘lower’ ] Indicates where the [0,0] index of -the array is in the upper left or lower left corner of -the axes. Defaults to the rc image.origin value
-
-

figimage complements the axes image -(imshow()) which will be resampled -to fit the current axes. If you want a resampled image to -fill the entire figure, you can define an -Axes with extent [0,0,1,1].

-

An matplotlib.image.FigureImage instance is returned.

-

(Source code, png, pdf)

-
-../_images/figimage_demo1.png -
-

Additional kwargs are Artist kwargs passed on to -FigureImage

-
- -
-
-matplotlib.pyplot.figlegend(handles, labels, loc, **kwargs)
-

Place a legend in the figure.

-
-
labels
-
a sequence of strings
-
handles
-
a sequence of Line2D or -Patch instances
-
loc
-
can be a string or an integer specifying the legend -location
-
-

A matplotlib.legend.Legend instance is returned.

-

Example:

-
figlegend( (line1, line2, line3),
-           ('label1', 'label2', 'label3'),
-           'upper right' )
-
-
-
-

See also

-

legend()

-
-
- -
-
-matplotlib.pyplot.fignum_exists(num)
-
- -
-
-matplotlib.pyplot.figtext(*args, **kwargs)
-

Add text to figure.

-

Call signature:

-
text(x, y, s, fontdict=None, **kwargs)
-
-
-

Add text to figure at location x, y (relative 0-1 -coords). See text() for the meaning -of the other arguments.

-

kwargs control the Text properties:

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat (0.0 transparent through 1.0 opaque)
animated[True | False]
axesan Axes instance
backgroundcolorany matplotlib color
bboxFancyBboxPatch prop dict
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
colorany matplotlib color
containsa callable function
family or fontfamily or fontname or name[FONTNAME | ‘serif’ | ‘sans-serif’ | ‘cursive’ | ‘fantasy’ | ‘monospace’ ]
figurea matplotlib.figure.Figure instance
fontproperties or font_propertiesa matplotlib.font_manager.FontProperties instance
gidan id string
horizontalalignment or ha[ ‘center’ | ‘right’ | ‘left’ ]
labelstring or anything printable with ‘%s’ conversion.
linespacingfloat (multiple of font size)
multialignment[‘left’ | ‘right’ | ‘center’ ]
path_effectsunknown
picker[None|float|boolean|callable]
position(x,y)
rasterized[True | False | None]
rotation[ angle in degrees | ‘vertical’ | ‘horizontal’ ]
rotation_modeunknown
size or fontsize[size in points | ‘xx-small’ | ‘x-small’ | ‘small’ | ‘medium’ | ‘large’ | ‘x-large’ | ‘xx-large’ ]
sketch_paramsunknown
snapunknown
stretch or fontstretch[a numeric value in range 0-1000 | ‘ultra-condensed’ | ‘extra-condensed’ | ‘condensed’ | ‘semi-condensed’ | ‘normal’ | ‘semi-expanded’ | ‘expanded’ | ‘extra-expanded’ | ‘ultra-expanded’ ]
style or fontstyle[ ‘normal’ | ‘italic’ | ‘oblique’]
textstring or anything printable with ‘%s’ conversion.
transformTransform instance
urla url string
usetexunknown
variant or fontvariant[ ‘normal’ | ‘small-caps’ ]
verticalalignment or ma or va[ ‘center’ | ‘top’ | ‘bottom’ | ‘baseline’ ]
visible[True | False]
weight or fontweight[a numeric value in range 0-1000 | ‘ultralight’ | ‘light’ | ‘normal’ | ‘regular’ | ‘book’ | ‘medium’ | ‘roman’ | ‘semibold’ | ‘demibold’ | ‘demi’ | ‘bold’ | ‘heavy’ | ‘extra bold’ | ‘black’ ]
wrapunknown
xfloat
yfloat
zorderany number
-
-
- -
-
-matplotlib.pyplot.figure(num=None, figsize=None, dpi=None, facecolor=None, edgecolor=None, frameon=True, FigureClass=<class 'matplotlib.figure.Figure'>, **kwargs)
-

Creates a new figure.

- --- - - - - - -
Parameters:

num : integer or string, optional, default: none

-
-

If not provided, a new figure will be created, and the figure number -will be incremented. The figure objects holds this number in a number -attribute. -If num is provided, and a figure with this id already exists, make -it active, and returns a reference to it. If this figure does not -exists, create it and returns it. -If num is a string, the window title will be set to this figure’s -num.

-
-

figsize : tuple of integers, optional, default: None

-
-

width, height in inches. If not provided, defaults to rc -figure.figsize.

-
-

dpi : integer, optional, default: None

-
-

resolution of the figure. If not provided, defaults to rc figure.dpi.

-
-

facecolor :

-
-

the background color. If not provided, defaults to rc figure.facecolor

-
-

edgecolor :

-
-

the border color. If not provided, defaults to rc figure.edgecolor

-
-
Returns:

figure : Figure

-
-

The Figure instance returned will also be passed to new_figure_manager -in the backends, which allows to hook custom Figure classes into the -pylab interface. Additional kwargs will be passed to the figure init -function.

-
-
-

Notes

-

If you are creating many figures, make sure you explicitly call “close” -on the figures you are not using, because this will enable pylab -to properly clean up the memory.

-

rcParams defines the default values, which can be modified in the -matplotlibrc file

-
- -
-
-matplotlib.pyplot.fill(*args, **kwargs)
-

Plot filled polygons.

- --- - - - - - - - - -
Parameters:

args : a variable length argument

-
-

It allowing for multiple -x, y pairs with an optional color format string; see -plot() for details on the argument -parsing. For example, each of the following is legal:

-
ax.fill(x, y)
-ax.fill(x, y, "b")
-ax.fill(x, y, "b", x, y, "r")
-
-
-

An arbitrary number of x, y, color groups can be specified:: -ax.fill(x1, y1, ‘g’, x2, y2, ‘r’)

-
-
Returns:

a list of Patch

-
Other Parameters:
 

kwargs : Polygon properties

-
-

Notes

-

The same color strings that plot() -supports are supported by the fill format string.

-

If you would like to fill below a curve, e.g., shade a region -between 0 and y along x, use fill_between()

-

Examples

-

(Source code, png, pdf)

-
-../_images/fill_demo3.png -
-
-

Note

-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All arguments with the following names: ‘x’, ‘y’.
  • -
-
-
- -
-
-matplotlib.pyplot.fill_between(x, y1, y2=0, where=None, interpolate=False, step=None, hold=None, data=None, **kwargs)
-

Make filled polygons between two curves.

-

Create a PolyCollection -filling the regions between y1 and y2 where -where==True

- --- - - - -
Parameters:

x : array

-
-

An N-length array of the x data

-
-

y1 : array

-
-

An N-length array (or scalar) of the y data

-
-

y2 : array

-
-

An N-length array (or scalar) of the y data

-
-

where : array, optional

-
-

If None, default to fill between everywhere. If not None, -it is an N-length numpy boolean array and the fill will -only happen over the regions where where==True.

-
-

interpolate : bool, optional

-
-

If True, interpolate between the two lines to find the -precise point of intersection. Otherwise, the start and -end points of the filled region will only occur on explicit -values in the x array.

-
-

step : {‘pre’, ‘post’, ‘mid’}, optional

-
-

If not None, fill with step logic.

-
-
-
-

See also

-
-
-
In addition to the above described arguments, this function can take a data keyword argument. If such a data argument is given, the following arguments are replaced by data[<arg>]: * All arguments with the following names: ‘where’, ‘x’, ‘y1’, ‘y2’.
-
-
-

Notes

-

Additional Keyword args passed on to the -PolyCollection.

-

kwargs control the Polygon properties:

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or antialiasedsBoolean or sequence of booleans
arrayunknown
axesan Axes instance
clima length 2 sequence of floats
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
cmapa colormap or registered colormap name
colormatplotlib color arg or sequence of rgba tuples
containsa callable function
edgecolor or edgecolorsmatplotlib color spec or sequence of specs
facecolor or facecolorsmatplotlib color spec or sequence of specs
figurea matplotlib.figure.Figure instance
gidan id string
hatch[ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
labelstring or anything printable with ‘%s’ conversion.
linestyle or dashes or linestyles[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or linewidths or lwfloat or sequence of floats
normunknown
offset_positionunknown
offsetsfloat or sequence of floats
path_effectsunknown
picker[None|float|boolean|callable]
pickradiusunknown
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
urlsunknown
visible[True | False]
zorderany number
-
-

Examples

-

(Source code)

-
-../_images/fill_between_demo_002.png -

(png, pdf)

-
-
-../_images/fill_between_demo_012.png -

(png, pdf)

-
-
-../_images/fill_between_demo_022.png -

(png, pdf)

-
-
- -
-
-matplotlib.pyplot.fill_betweenx(y, x1, x2=0, where=None, step=None, hold=None, data=None, **kwargs)
-

Make filled polygons between two horizontal curves.

-

Create a PolyCollection -filling the regions between x1 and x2 where -where==True

- --- - - - -
Parameters:

y : array

-
-

An N-length array of the y data

-
-

x1 : array

-
-

An N-length array (or scalar) of the x data

-
-

x2 : array, optional

-
-

An N-length array (or scalar) of the x data

-
-

where : array, optional

-
-

If None, default to fill between everywhere. If not None, -it is a N length numpy boolean array and the fill will -only happen over the regions where where==True

-
-

step : {‘pre’, ‘post’, ‘mid’}, optional

-
-

If not None, fill with step logic.

-
-
-
-

See also

-
-
-
In addition to the above described arguments, this function can take a data keyword argument. If such a data argument is given, the following arguments are replaced by data[<arg>]: * All arguments with the following names: ‘where’, ‘x1’, ‘x2’, ‘y’.
-
-
-

Notes

-
-
keyword args passed on to the
-
PolyCollection
-
-

kwargs control the Polygon properties:

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or antialiasedsBoolean or sequence of booleans
arrayunknown
axesan Axes instance
clima length 2 sequence of floats
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
cmapa colormap or registered colormap name
colormatplotlib color arg or sequence of rgba tuples
containsa callable function
edgecolor or edgecolorsmatplotlib color spec or sequence of specs
facecolor or facecolorsmatplotlib color spec or sequence of specs
figurea matplotlib.figure.Figure instance
gidan id string
hatch[ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
labelstring or anything printable with ‘%s’ conversion.
linestyle or dashes or linestyles[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or linewidths or lwfloat or sequence of floats
normunknown
offset_positionunknown
offsetsfloat or sequence of floats
path_effectsunknown
picker[None|float|boolean|callable]
pickradiusunknown
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
urlsunknown
visible[True | False]
zorderany number
-
-

Examples

-

(Source code)

-
-../_images/fill_betweenx_demo_002.png -

(png, pdf)

-
-
-../_images/fill_betweenx_demo_012.png -

(png, pdf)

-
-
- -
-
-matplotlib.pyplot.findobj(o=None, match=None, include_self=True)
-

Find artist objects.

-

Recursively find all Artist instances -contained in self.

-

match can be

-
-
    -
  • None: return all objects contained in artist.
  • -
  • function with signature boolean = match(artist) -used to filter matches
  • -
  • class instance: e.g., Line2D. Only return artists of class type.
  • -
-
-

If include_self is True (default), include self in the list to be -checked for a match.

-
- -
-
-matplotlib.pyplot.flag()
-

set the default colormap to flag and apply to current image if any. -See help(colormaps) for more information

-
- -
-
-matplotlib.pyplot.gca(**kwargs)
-

Get the current Axes instance on the -current figure matching the given keyword args, or create one.

-
-

See also

-
-
matplotlib.figure.Figure.gca
-
The figure’s gca method.
-
-
-

Examples

-

To get the current polar axes on the current figure:

-
plt.gca(projection='polar')
-
-
-

If the current axes doesn’t exist, or isn’t a polar one, the appropriate -axes will be created and then returned.

-
- -
-
-matplotlib.pyplot.gcf()
-

Get a reference to the current figure.

-
- -
-
-matplotlib.pyplot.gci()
-

Get the current colorable artist. Specifically, returns the -current ScalarMappable instance (image or -patch collection), or None if no images or patch collections -have been defined. The commands imshow() -and figimage() create -Image instances, and the commands -pcolor() and -scatter() create -Collection instances. The -current image is an attribute of the current axes, or the nearest -earlier axes in the current figure that contains an image.

-
- -
-
-matplotlib.pyplot.get_current_fig_manager()
-
- -
-
-matplotlib.pyplot.get_figlabels()
-

Return a list of existing figure labels.

-
- -
-
-matplotlib.pyplot.get_fignums()
-

Return a list of existing figure numbers.

-
- -
-
-matplotlib.pyplot.get_plot_commands()
-

Get a sorted list of all of the plotting commands.

-
- -
-
-matplotlib.pyplot.ginput(*args, **kwargs)
-

Blocking call to interact with the figure.

-

This will wait for n clicks from the user and return a list of the -coordinates of each click.

-

If timeout is zero or negative, does not timeout.

-

If n is zero or negative, accumulate clicks until a middle click -(or potentially both mouse buttons at once) terminates the input.

-

Right clicking cancels last input.

-

The buttons used for the various actions (adding points, removing -points, terminating the inputs) can be overriden via the -arguments mouse_add, mouse_pop and mouse_stop, that give -the associated mouse button: 1 for left, 2 for middle, 3 for -right.

-

The keyboard can also be used to select points in case your mouse -does not have one or more of the buttons. The delete and backspace -keys act like right clicking (i.e., remove last point), the enter key -terminates input and any other key (not already used by the window -manager) selects a point.

-
- -
-
-matplotlib.pyplot.gray()
-

set the default colormap to gray and apply to current image if any. -See help(colormaps) for more information

-
- -
-
-matplotlib.pyplot.grid(b=None, which='major', axis='both', **kwargs)
-

Turn the axes grids on or off.

-

Set the axes grids on or off; b is a boolean. (For MATLAB -compatibility, b may also be a string, ‘on’ or ‘off’.)

-

If b is None and len(kwargs)==0, toggle the grid state. If -kwargs are supplied, it is assumed that you want a grid and b -is thus set to True.

-

which can be ‘major’ (default), ‘minor’, or ‘both’ to control -whether major tick grids, minor tick grids, or both are affected.

-

axis can be ‘both’ (default), ‘x’, or ‘y’ to control which -set of gridlines are drawn.

-

kwargs are used to set the grid line properties, e.g.,:

-
ax.grid(color='r', linestyle='-', linewidth=2)
-
-
-

Valid Line2D kwargs are

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat (0.0 transparent through 1.0 opaque)
animated[True | False]
antialiased or aa[True | False]
axesan Axes instance
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
color or cany matplotlib color
containsa callable function
dash_capstyle[‘butt’ | ‘round’ | ‘projecting’]
dash_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
dashessequence of on/off ink in points
drawstyle[‘default’ | ‘steps’ | ‘steps-pre’ | ‘steps-mid’ | ‘steps-post’]
figurea matplotlib.figure.Figure instance
fillstyle[‘full’ | ‘left’ | ‘right’ | ‘bottom’ | ‘top’ | ‘none’]
gidan id string
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or lwfloat value in points
markerA valid marker style
markeredgecolor or mecany matplotlib color
markeredgewidth or mewfloat value in points
markerfacecolor or mfcany matplotlib color
markerfacecoloralt or mfcaltany matplotlib color
markersize or msfloat
markevery[None | int | length-2 tuple of int | slice | list/array of int | float | length-2 tuple of float]
path_effectsunknown
pickerfloat distance in points or callable pick function fn(artist, event)
pickradiusfloat distance in points
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
solid_capstyle[‘butt’ | ‘round’ | ‘projecting’]
solid_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
transforma matplotlib.transforms.Transform instance
urla url string
visible[True | False]
xdata1D array
ydata1D array
zorderany number
-
-
- -
-
-matplotlib.pyplot.hexbin(x, y, C=None, gridsize=100, bins=None, xscale='linear', yscale='linear', extent=None, cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, edgecolors='none', reduce_C_function=<function mean>, mincnt=None, marginals=False, hold=None, data=None, **kwargs)
-

Make a hexagonal binning plot.

-

Make a hexagonal binning plot of x versus y, where x, -y are 1-D sequences of the same length, N. If C is None -(the default), this is a histogram of the number of occurences -of the observations at (x[i],y[i]).

-

If C is specified, it specifies values at the coordinate -(x[i],y[i]). These values are accumulated for each hexagonal -bin and then reduced according to reduce_C_function, which -defaults to numpy’s mean function (np.mean). (If C is -specified, it must also be a 1-D sequence of the same length -as x and y.)

- --- - - - - - - - - -
Parameters:

x, y : array or masked array

-

C : array or masked array, optional, default is None

-

gridsize : int or (int, int), optional, default is 100

-
-

The number of hexagons in the x-direction, default is -100. The corresponding number of hexagons in the -y-direction is chosen such that the hexagons are -approximately regular. Alternatively, gridsize can be a -tuple with two elements specifying the number of hexagons -in the x-direction and the y-direction.

-
-

bins : {‘log’} or int or sequence, optional, default is None

-
-

If None, no binning is applied; the color of each hexagon -directly corresponds to its count value.

-

If ‘log’, use a logarithmic scale for the color -map. Internally, is used to -determine the hexagon color.

-

If an integer, divide the counts in the specified number -of bins, and color the hexagons accordingly.

-

If a sequence of values, the values of the lower bound of -the bins to be used.

-
-

xscale : {‘linear’, ‘log’}, optional, default is ‘linear’

-
-

Use a linear or log10 scale on the horizontal axis.

-
-

yscale : {‘linear’, ‘log’}, optional, default is ‘linear’

-
-

Use a linear or log10 scale on the vertical axis.

-
-

mincnt : int > 0, optional, default is None

-
-

If not None, only display cells with more than mincnt -number of points in the cell

-
-

marginals : bool, optional, default is False

-
-

if marginals is True, plot the marginal density as -colormapped rectagles along the bottom of the x-axis and -left of the y-axis

-
-

extent : scalar, optional, default is None

-
-

The limits of the bins. The default assigns the limits -based on gridsize, x, y, xscale and yscale.

-

If xscale or yscale is set to ‘log’, the limits are -expected to be the exponent for a power of 10. E.g. for -x-limits of 1 and 50 in ‘linear’ scale and y-limits -of 10 and 1000 in ‘log’ scale, enter (1, 50, 1, 3).

-

Order of scalars is (left, right, bottom, top).

-
-
Returns:

object

-
-

a PolyCollection instance; use -get_array() on -this PolyCollection to get -the counts in each hexagon.

-

If marginals is True, horizontal -bar and vertical bar (both PolyCollections) will be attached -to the return collection as attributes hbar and vbar.

-
-
Other Parameters:
 

cmap : object, optional, default is None

-
-

a matplotlib.colors.Colormap instance. If None, -defaults to rc image.cmap.

-
-

norm : object, optional, default is None

-
-

matplotlib.colors.Normalize instance is used to -scale luminance data to 0,1.

-
-

vmin, vmax : scalar, optional, default is None

-
-

vmin and vmax are used in conjunction with norm to -normalize luminance data. If None, the min and max of the -color array C are used. Note if you pass a norm instance -your settings for vmin and vmax will be ignored.

-
-

alpha : scalar between 0 and 1, optional, default is None

-
-

the alpha value for the patches

-
-

linewidths : scalar, optional, default is None

-
-

If None, defaults to 1.0.

-
-

edgecolors : {‘none’} or mpl color, optional, default is ‘none’

-
-

If ‘none’, draws the edges in the same color as the fill color. -This is the default, as it avoids unsightly unpainted pixels -between the hexagons.

-

If None, draws outlines in the default color.

-

If a matplotlib color arg, draws outlines in the specified color.

-
-
-

Notes

-

The standard descriptions of all the -Collection parameters:

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or antialiasedsBoolean or sequence of booleans
arrayunknown
axesan Axes instance
clima length 2 sequence of floats
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
cmapa colormap or registered colormap name
colormatplotlib color arg or sequence of rgba tuples
containsa callable function
edgecolor or edgecolorsmatplotlib color spec or sequence of specs
facecolor or facecolorsmatplotlib color spec or sequence of specs
figurea matplotlib.figure.Figure instance
gidan id string
hatch[ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
labelstring or anything printable with ‘%s’ conversion.
linestyle or dashes or linestyles[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or linewidths or lwfloat or sequence of floats
normunknown
offset_positionunknown
offsetsfloat or sequence of floats
path_effectsunknown
picker[None|float|boolean|callable]
pickradiusunknown
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
urlsunknown
visible[True | False]
zorderany number
-
-
-

Note

-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All arguments with the following names: ‘x’, ‘y’.
  • -
-
-

Examples

-

(Source code, png, pdf)

-
-../_images/hexbin_demo3.png -
-
- -
-
-matplotlib.pyplot.hist(x, bins=None, range=None, normed=False, weights=None, cumulative=False, bottom=None, histtype='bar', align='mid', orientation='vertical', rwidth=None, log=False, color=None, label=None, stacked=False, hold=None, data=None, **kwargs)
-

Plot a histogram.

-

Compute and draw the histogram of x. The return value is a -tuple (n, bins, patches) or ([n0, n1, ...], bins, -[patches0, patches1,...]) if the input contains multiple -data.

-

Multiple data can be provided via x as a list of datasets -of potentially different length ([x0, x1, ...]), or as -a 2-D ndarray in which each column is a dataset. Note that -the ndarray form is transposed relative to the list form.

-

Masked arrays are not supported at present.

- --- - - - - - - - - -
Parameters:

x : (n,) array or sequence of (n,) arrays

-
-

Input values, this takes either a single array or a sequency of -arrays which are not required to be of the same length

-
-

bins : integer or array_like or ‘auto’, optional

-
-

If an integer is given, bins + 1 bin edges are returned, -consistently with numpy.histogram() for numpy version >= -1.3.

-

Unequally spaced bins are supported if bins is a sequence.

-

If Numpy 1.11 is installed, may also be 'auto'.

-

Default is taken from the rcParam hist.bins.

-
-

range : tuple or None, optional

-
-

The lower and upper range of the bins. Lower and upper outliers -are ignored. If not provided, range is (x.min(), x.max()). Range -has no effect if bins is a sequence.

-

If bins is a sequence or range is specified, autoscaling -is based on the specified bin range instead of the -range of x.

-

Default is None

-
-

normed : boolean, optional

-
-

If True, the first element of the return tuple will -be the counts normalized to form a probability density, i.e., -n/(len(x)`dbin), i.e., the integral of the histogram will sum -to 1. If stacked is also True, the sum of the histograms is -normalized to 1.

-

Default is False

-
-

weights : (n, ) array_like or None, optional

-
-

An array of weights, of the same shape as x. Each value in x -only contributes its associated weight towards the bin count -(instead of 1). If normed is True, the weights are normalized, -so that the integral of the density over the range remains 1.

-

Default is None

-
-

cumulative : boolean, optional

-
-

If True, then a histogram is computed where each bin gives the -counts in that bin plus all bins for smaller values. The last bin -gives the total number of datapoints. If normed is also True -then the histogram is normalized such that the last bin equals 1. -If cumulative evaluates to less than 0 (e.g., -1), the direction -of accumulation is reversed. In this case, if normed is also -True, then the histogram is normalized such that the first bin -equals 1.

-

Default is False

-
-

bottom : array_like, scalar, or None

-
-

Location of the bottom baseline of each bin. If a scalar, -the base line for each bin is shifted by the same amount. -If an array, each bin is shifted independently and the length -of bottom must match the number of bins. If None, defaults to 0.

-

Default is None

-
-

histtype : {‘bar’, ‘barstacked’, ‘step’, ‘stepfilled’}, optional

-
-

The type of histogram to draw.

-
    -
  • ‘bar’ is a traditional bar-type histogram. If multiple data -are given the bars are aranged side by side.
  • -
  • ‘barstacked’ is a bar-type histogram where multiple -data are stacked on top of each other.
  • -
  • ‘step’ generates a lineplot that is by default -unfilled.
  • -
  • ‘stepfilled’ generates a lineplot that is by default -filled.
  • -
-

Default is ‘bar’

-
-

align : {‘left’, ‘mid’, ‘right’}, optional

-
-

Controls how the histogram is plotted.

-
-
    -
  • ‘left’: bars are centered on the left bin edges.
  • -
  • ‘mid’: bars are centered between the bin edges.
  • -
  • ‘right’: bars are centered on the right bin edges.
  • -
-
-

Default is ‘mid’

-
-

orientation : {‘horizontal’, ‘vertical’}, optional

-
-

If ‘horizontal’, barh will be used for -bar-type histograms and the bottom kwarg will be the left edges.

-
-

rwidth : scalar or None, optional

-
-

The relative width of the bars as a fraction of the bin width. If -None, automatically compute the width.

-

Ignored if histtype is ‘step’ or ‘stepfilled’.

-

Default is None

-
-

log : boolean, optional

-
-

If True, the histogram axis will be set to a log scale. If log -is True and x is a 1D array, empty bins will be filtered out -and only the non-empty (n, bins, patches) will be returned.

-

Default is False

-
-

color : color or array_like of colors or None, optional

-
-

Color spec or sequence of color specs, one per dataset. Default -(None) uses the standard line color sequence.

-

Default is None

-
-

label : string or None, optional

-
-

String, or sequence of strings to match multiple datasets. Bar -charts yield multiple patches per dataset, but only the first gets -the label, so that the legend command will work as expected.

-

default is None

-
-

stacked : boolean, optional

-
-

If True, multiple data are stacked on top of each other If -False multiple data are aranged side by side if histtype is -‘bar’ or on top of each other if histtype is ‘step’

-

Default is False

-
-
Returns:

n : array or list of arrays

-
-

The values of the histogram bins. See normed and weights -for a description of the possible semantics. If input x is an -array, then this is an array of length nbins. If input is a -sequence arrays [data1, data2,..], then this is a list of -arrays with the values of the histograms for each of the arrays -in the same order.

-
-

bins : array

-
-

The edges of the bins. Length nbins + 1 (nbins left edges and right -edge of last bin). Always a single array even when multiple data -sets are passed in.

-
-

patches : list or list of lists

-
-

Silent list of individual patches used to create the histogram -or list of such list if multiple input datasets.

-
-
Other Parameters:
 

kwargs : Patch properties

-
-
-

See also

-
-
hist2d
-
2D histograms
-
-
-

Notes

-

Until numpy release 1.5, the underlying numpy histogram function was -incorrect with normed`=`True if bin sizes were unequal. MPL -inherited that error. It is now corrected within MPL when using -earlier numpy versions.

-

Examples

-

(Source code, png, pdf)

-
-../_images/histogram_demo_features3.png -
-
-

Note

-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All arguments with the following names: ‘weights’, ‘x’.
  • -
-
-
- -
-
-matplotlib.pyplot.hist2d(x, y, bins=10, range=None, normed=False, weights=None, cmin=None, cmax=None, hold=None, data=None, **kwargs)
-

Make a 2D histogram plot.

- --- - - - - - - - - -
Parameters:

x, y: array_like, shape (n, )

-
-

Input values

-
-

bins: [None | int | [int, int] | array_like | [array, array]]

-
-

The bin specification:

-
-
    -
  • If int, the number of bins for the two dimensions -(nx=ny=bins).
  • -
  • If [int, int], the number of bins in each dimension -(nx, ny = bins).
  • -
  • If array_like, the bin edges for the two dimensions -(x_edges=y_edges=bins).
  • -
  • If [array, array], the bin edges in each dimension -(x_edges, y_edges = bins).
  • -
-
-

The default value is 10.

-
-

range : array_like shape(2, 2), optional, default: None

-
-

The leftmost and rightmost edges of the bins along each dimension -(if not specified explicitly in the bins parameters): [[xmin, -xmax], [ymin, ymax]]. All values outside of this range will be -considered outliers and not tallied in the histogram.

-
-

normed : boolean, optional, default: False

-
-

Normalize histogram.

-
-

weights : array_like, shape (n, ), optional, default: None

-
-

An array of values w_i weighing each sample (x_i, y_i).

-
-

cmin : scalar, optional, default: None

-
-

All bins that has count less than cmin will not be displayed and -these count values in the return value count histogram will also -be set to nan upon return

-
-

cmax : scalar, optional, default: None

-
-

All bins that has count more than cmax will not be displayed (set -to none before passing to imshow) and these count values in the -return value count histogram will also be set to nan upon return

-
-
Returns:

The return value is (counts, xedges, yedges, Image).

-
Other Parameters:
 

cmap : {Colormap, string}, optional

-
-

A matplotlib.colors.Colormap instance. If not set, use rc -settings.

-
-

norm : Normalize, optional

-
-

A matplotlib.colors.Normalize instance is used to -scale luminance data to [0, 1]. If not set, defaults to -Normalize().

-
-

vmin/vmax : {None, scalar}, optional

-
-

Arguments passed to the Normalize instance.

-
-

alpha : 0 <= scalar <= 1 or None, optional

-
-

The alpha blending value.

-
-
-
-

See also

-
-
hist
-
1D histogram
-
-
-

Notes

-

Rendering the histogram with a logarithmic color scale is -accomplished by passing a colors.LogNorm instance to -the norm keyword argument. Likewise, power-law normalization -(similar in effect to gamma correction) can be accomplished with -colors.PowerNorm.

-

Examples

-

(Source code, png, pdf)

-
-../_images/hist2d_demo2.png -
-
-

Note

-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All arguments with the following names: ‘weights’, ‘x’, ‘y’.
  • -
-
-
- -
-
-matplotlib.pyplot.hlines(y, xmin, xmax, colors='k', linestyles='solid', label='', hold=None, data=None, **kwargs)
-

Plot horizontal lines at each y from xmin to xmax.

- --- - - - - - - - - -
Parameters:

y : scalar or sequence of scalar

-
-

y-indexes where to plot the lines.

-
-

xmin, xmax : scalar or 1D array_like

-
-

Respective beginning and end of each line. If scalars are -provided, all lines will have same length.

-
-

colors : array_like of colors, optional, default: ‘k’

-

linestyles : [‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’], optional

-

label : string, optional, default: ‘’

-
Returns:

lines : LineCollection

-
Other Parameters:
 

kwargs : LineCollection properties.

-
-
-

See also

-
-
vlines
-
vertical lines
-
-
-

Examples

-

(Source code, png, pdf)

-
-../_images/vline_hline_demo2.png -
-
-

Note

-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All arguments with the following names: ‘xmax’, ‘xmin’, ‘y’.
  • -
-
-
- -
-
-matplotlib.pyplot.hold(b=None)
-
-

Deprecated since version 2.0: pyplot.hold is deprecated. -Future behavior will be consistent with the long-time default: -plot commands add elements without first clearing the -Axes and/or Figure.

-
-

Set the hold state. If b is None (default), toggle the -hold state, else set the hold state to boolean value b:

-
hold()      # toggle hold
-hold(True)  # hold is on
-hold(False) # hold is off
-
-
-

When hold is True, subsequent plot commands will add elements to -the current axes. When hold is False, the current axes and -figure will be cleared on the next plot command.

-
- -
-
-matplotlib.pyplot.hot()
-

set the default colormap to hot and apply to current image if any. -See help(colormaps) for more information

-
- -
-
-matplotlib.pyplot.hsv()
-

set the default colormap to hsv and apply to current image if any. -See help(colormaps) for more information

-
- -
-
-matplotlib.pyplot.imread(*args, **kwargs)
-

Read an image from a file into an array.

-

fname may be a string path, a valid URL, or a Python -file-like object. If using a file object, it must be opened in binary -mode.

-

If format is provided, will try to read file of that type, -otherwise the format is deduced from the filename. If nothing can -be deduced, PNG is tried.

-

Return value is a numpy.array. For grayscale images, the -return array is MxN. For RGB images, the return value is MxNx3. -For RGBA images the return value is MxNx4.

-

matplotlib can only read PNGs natively, but if PIL is installed, it will -use it to load the image and return an array (if possible) which -can be used with imshow(). Note, URL strings -may not be compatible with PIL. Check the PIL documentation for more -information.

-
- -
-
-matplotlib.pyplot.imsave(*args, **kwargs)
-

Save an array as in image file.

-

The output formats available depend on the backend being used.

-
-
Arguments:
-
-
fname:
-
A string containing a path to a filename, or a Python file-like object. -If format is None and fname is a string, the output -format is deduced from the extension of the filename.
-
arr:
-
An MxN (luminance), MxNx3 (RGB) or MxNx4 (RGBA) array.
-
-
-
Keyword arguments:
-
-
vmin/vmax: [ None | scalar ]
-
vmin and vmax set the color scaling for the image by fixing the -values that map to the colormap color limits. If either vmin -or vmax is None, that limit is determined from the arr -min/max value.
-
cmap:
-
cmap is a colors.Colormap instance, e.g., cm.jet. -If None, default to the rc image.cmap value.
-
format:
-
One of the file extensions supported by the active -backend. Most backends support png, pdf, ps, eps and svg.
-
origin
-
[ ‘upper’ | ‘lower’ ] Indicates where the [0,0] index of -the array is in the upper left or lower left corner of -the axes. Defaults to the rc image.origin value.
-
dpi
-
The DPI to store in the metadata of the file. This does not affect the -resolution of the output image.
-
-
-
-
- -
-
-matplotlib.pyplot.imshow(X, cmap=None, norm=None, aspect=None, interpolation=None, alpha=None, vmin=None, vmax=None, origin=None, extent=None, shape=None, filternorm=1, filterrad=4.0, imlim=None, resample=None, url=None, hold=None, data=None, **kwargs)
-

Display an image on the axes.

- --- - - - - - - - - -
Parameters:

X : array_like, shape (n, m) or (n, m, 3) or (n, m, 4)

-
-

Display the image in X to current axes. X may be an -array or a PIL image. If X is an array, it -can have the following shapes and types:

-
    -
  • MxN – values to be mapped (float or int)
  • -
  • MxNx3 – RGB (float or uint8)
  • -
  • MxNx4 – RGBA (float or uint8)
  • -
-

The value for each component of MxNx3 and MxNx4 float arrays -should be in the range 0.0 to 1.0. MxN arrays are mapped -to colors based on the norm (mapping scalar to scalar) -and the cmap (mapping the normed scalar to a color).

-
-

cmap : Colormap, optional, default: None

-
-

If None, default to rc image.cmap value. cmap is ignored -if X is 3-D, directly specifying RGB(A) values.

-
-

aspect : [‘auto’ | ‘equal’ | scalar], optional, default: None

-
-

If ‘auto’, changes the image aspect ratio to match that of the -axes.

-

If ‘equal’, and extent is None, changes the axes aspect ratio to -match that of the image. If extent is not None, the axes -aspect ratio is changed to match that of the extent.

-

If None, default to rc image.aspect value.

-
-

interpolation : string, optional, default: None

-
-

Acceptable values are ‘none’, ‘nearest’, ‘bilinear’, ‘bicubic’, -‘spline16’, ‘spline36’, ‘hanning’, ‘hamming’, ‘hermite’, ‘kaiser’, -‘quadric’, ‘catrom’, ‘gaussian’, ‘bessel’, ‘mitchell’, ‘sinc’, -‘lanczos’

-

If interpolation is None, default to rc image.interpolation. -See also the filternorm and filterrad parameters. -If interpolation is ‘none’, then no interpolation is performed -on the Agg, ps and pdf backends. Other backends will fall back to -‘nearest’.

-
-

norm : Normalize, optional, default: None

-
-

A Normalize instance is used to scale -a 2-D float X input to the (0, 1) range for input to the -cmap. If norm is None, use the default func:normalize. -If norm is an instance of NoNorm, -X must be an array of integers that index directly into -the lookup table of the cmap.

-
-

vmin, vmax : scalar, optional, default: None

-
-

vmin and vmax are used in conjunction with norm to normalize -luminance data. Note if you pass a norm instance, your -settings for vmin and vmax will be ignored.

-
-

alpha : scalar, optional, default: None

-
-

The alpha blending value, between 0 (transparent) and 1 (opaque)

-
-

origin : [‘upper’ | ‘lower’], optional, default: None

-
-

Place the [0,0] index of the array in the upper left or lower left -corner of the axes. If None, default to rc image.origin.

-
-

extent : scalars (left, right, bottom, top), optional, default: None

-
-

The location, in data-coordinates, of the lower-left and -upper-right corners. If None, the image is positioned such that -the pixel centers fall on zero-based (row, column) indices.

-
-

shape : scalars (columns, rows), optional, default: None

-
-

For raw buffer images

-
-

filternorm : scalar, optional, default: 1

-
-

A parameter for the antigrain image resize filter. From the -antigrain documentation, if filternorm = 1, the filter -normalizes integer values and corrects the rounding errors. It -doesn’t do anything with the source floating point values, it -corrects only integers according to the rule of 1.0 which means -that any sum of pixel weights must be equal to 1.0. So, the -filter function must produce a graph of the proper shape.

-
-

filterrad : scalar, optional, default: 4.0

-
-

The filter radius for filters that have a radius parameter, i.e. -when interpolation is one of: ‘sinc’, ‘lanczos’ or ‘blackman’

-
-
Returns:

image : AxesImage

-
Other Parameters:
 

kwargs : Artist properties.

-
-
-

See also

-
-
matshow
-
Plot a matrix or an array as an image.
-
-
-

Notes

-

Unless extent is used, pixel centers will be located at integer -coordinates. In other words: the origin will coincide with the center -of pixel (0, 0).

-

Examples

-

(Source code, png, pdf)

-
-../_images/image_demo4.png -
-
-

Note

-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All positional and all keyword arguments.
  • -
-
-
- -
-
-matplotlib.pyplot.inferno()
-

set the default colormap to inferno and apply to current image if any. -See help(colormaps) for more information

-
- -
-
-matplotlib.pyplot.install_repl_displayhook()
-

Install a repl display hook so that any stale figure are automatically -redrawn when control is returned to the repl.

-

This works with IPython terminals and kernels, -as well as vanilla python shells.

-
- -
-
-matplotlib.pyplot.ioff()
-

Turn interactive mode off.

-
- -
-
-matplotlib.pyplot.ion()
-

Turn interactive mode on.

-
- -
-
-matplotlib.pyplot.ishold()
-
-

Deprecated since version 2.0: pyplot.hold is deprecated. -Future behavior will be consistent with the long-time default: -plot commands add elements without first clearing the -Axes and/or Figure.

-
-

Return the hold status of the current axes.

-
- -
-
-matplotlib.pyplot.isinteractive()
-

Return status of interactive mode.

-
- -
-
-matplotlib.pyplot.jet()
-

set the default colormap to jet and apply to current image if any. -See help(colormaps) for more information

-
- -
-
-matplotlib.pyplot.legend(*args, **kwargs)
-

Places a legend on the axes.

-

To make a legend for lines which already exist on the axes -(via plot for instance), simply call this function with an iterable -of strings, one for each legend item. For example:

-
ax.plot([1, 2, 3])
-ax.legend(['A simple line'])
-
-
-

However, in order to keep the “label” and the legend element -instance together, it is preferable to specify the label either at -artist creation, or by calling the -set_label() method on the artist:

-
line, = ax.plot([1, 2, 3], label='Inline label')
-# Overwrite the label by calling the method.
-line.set_label('Label via method')
-ax.legend()
-
-
-

Specific lines can be excluded from the automatic legend element -selection by defining a label starting with an underscore. -This is default for all artists, so calling legend() without -any arguments and without setting the labels manually will result in -no legend being drawn.

-

For full control of which artists have a legend entry, it is possible -to pass an iterable of legend artists followed by an iterable of -legend labels respectively:

-
legend((line1, line2, line3), ('label1', 'label2', 'label3'))
-
-
- --- - - - -
Parameters:

loc : int or string or pair of floats, default: ‘upper right’

-
-

The location of the legend. Possible codes are:

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Location StringLocation Code
‘best’0
‘upper right’1
‘upper left’2
‘lower left’3
‘lower right’4
‘right’5
‘center left’6
‘center right’7
‘lower center’8
‘upper center’9
‘center’10
-
-

Alternatively can be a 2-tuple giving x, y of the lower-left -corner of the legend in axes coordinates (in which case -bbox_to_anchor will be ignored).

-
-

bbox_to_anchor : matplotlib.transforms.BboxBase instance or tuple of floats

-
-

Specify any arbitrary location for the legend in bbox_transform -coordinates (default Axes coordinates).

-

For example, to put the legend’s upper right hand corner in the -center of the axes the following keywords can be used:

-
loc='upper right', bbox_to_anchor=(0.5, 0.5)
-
-
-
-

ncol : integer

-
-

The number of columns that the legend has. Default is 1.

-
-

prop : None or matplotlib.font_manager.FontProperties or dict

-
-

The font properties of the legend. If None (default), the current -matplotlib.rcParams will be used.

-
-

fontsize : int or float or {‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’}

-
-

Controls the font size of the legend. If the value is numeric the -size will be the absolute font size in points. String values are -relative to the current default font size. This argument is only -used if prop is not specified.

-
-

numpoints : None or int

-
-

The number of marker points in the legend when creating a legend -entry for a line/matplotlib.lines.Line2D. -Default is None which will take the value from the -legend.numpoints rcParam.

-
-

scatterpoints : None or int

-
-

The number of marker points in the legend when creating a legend -entry for a scatter plot/ -matplotlib.collections.PathCollection. -Default is None which will take the value from the -legend.scatterpoints rcParam.

-
-

scatteryoffsets : iterable of floats

-
-

The vertical offset (relative to the font size) for the markers -created for a scatter plot legend entry. 0.0 is at the base the -legend text, and 1.0 is at the top. To draw all markers at the -same height, set to [0.5]. Default [0.375, 0.5, 0.3125].

-
-

markerscale : None or int or float

-
-

The relative size of legend markers compared with the originally -drawn ones. Default is None which will take the value from -the legend.markerscale rcParam.

-
-

markerfirst : bool

-
-

if True, legend marker is placed to the left of the legend label -if False, legend marker is placed to the right of the legend -label

-
-

frameon : None or bool

-
-

Control whether the legend should be drawn on a patch (frame). -Default is None which will take the value from the -legend.frameon rcParam.

-
-

fancybox : None or bool

-
-

Control whether round edges should be enabled around -the FancyBboxPatch which -makes up the legend’s background. -Default is None which will take the value from the -legend.fancybox rcParam.

-
-

shadow : None or bool

-
-

Control whether to draw a shadow behind the legend. -Default is None which will take the value from the -legend.shadow rcParam.

-
-

framealpha : None or float

-
-

Control the alpha transparency of the legend’s background. -Default is None which will take the value from the -legend.framealpha rcParam.

-
-

facecolor : None or “inherit” or a color spec

-
-

Control the legend’s background color. -Default is None which will take the value from the -legend.facecolor rcParam. -If "inherit", it will take the axes.facecolor -rcParam.

-
-

edgecolor : None or “inherit” or a color spec

-
-

Control the legend’s background patch edge color. -Default is None which will take the value from the -legend.edgecolor rcParam. -If "inherit", it will take the axes.edgecolor -rcParam.

-
-

mode : {“expand”, None}

-
-

If mode is set to "expand" the legend will be horizontally -expanded to fill the axes area (or bbox_to_anchor if defines -the legend’s size).

-
-

bbox_transform : None or matplotlib.transforms.Transform

-
-

The transform for the bounding box (bbox_to_anchor). For a value -of None (default) the Axes’ -transAxes transform will be used.

-
-

title : str or None

-
-

The legend’s title. Default is no title (None).

-
-

borderpad : float or None

-
-

The fractional whitespace inside the legend border. -Measured in font-size units. -Default is None which will take the value from the -legend.borderpad rcParam.

-
-

labelspacing : float or None

-
-

The vertical space between the legend entries. -Measured in font-size units. -Default is None which will take the value from the -legend.labelspacing rcParam.

-
-

handlelength : float or None

-
-

The length of the legend handles. -Measured in font-size units. -Default is None which will take the value from the -legend.handlelength rcParam.

-
-

handletextpad : float or None

-
-

The pad between the legend handle and text. -Measured in font-size units. -Default is None which will take the value from the -legend.handletextpad rcParam.

-
-

borderaxespad : float or None

-
-

The pad between the axes and legend border. -Measured in font-size units. -Default is None which will take the value from the -legend.borderaxespad rcParam.

-
-

columnspacing : float or None

-
-

The spacing between columns. -Measured in font-size units. -Default is None which will take the value from the -legend.columnspacing rcParam.

-
-

handler_map : dict or None

-
-

The custom dictionary mapping instances or types to a legend -handler. This handler_map updates the default handler map -found at matplotlib.legend.Legend.get_legend_handler_map().

-
-
-

Notes

-

Not all kinds of artist are supported by the legend command. -See Legend guide for details.

-

Examples

-

(Source code, png, pdf)

-
-../_images/legend_demo7.png -
-
- -
-
-matplotlib.pyplot.locator_params(axis='both', tight=None, **kwargs)
-

Control behavior of tick locators.

-

Keyword arguments:

-
-
axis
-
[‘x’ | ‘y’ | ‘both’] Axis on which to operate; -default is ‘both’.
-
tight
-
[True | False | None] Parameter passed to autoscale_view(). -Default is None, for no change.
-
-

Remaining keyword arguments are passed to directly to the -set_params() method.

-

Typically one might want to reduce the maximum number -of ticks and use tight bounds when plotting small -subplots, for example:

-
ax.locator_params(tight=True, nbins=4)
-
-
-

Because the locator is involved in autoscaling, -autoscale_view() is called automatically after -the parameters are changed.

-

This presently works only for the -MaxNLocator used -by default on linear axes, but it may be generalized.

-
- -
-
-matplotlib.pyplot.loglog(*args, **kwargs)
-

Make a plot with log scaling on both the x and y axis.

-

loglog() supports all the keyword -arguments of plot() and -matplotlib.axes.Axes.set_xscale() / -matplotlib.axes.Axes.set_yscale().

-

Notable keyword arguments:

-
-
-
basex/basey: scalar > 1
-
Base of the x/y logarithm
-
subsx/subsy: [ None | sequence ]
-
The location of the minor x/y ticks; None defaults -to autosubs, which depend on the number of decades in the -plot; see matplotlib.axes.Axes.set_xscale() / -matplotlib.axes.Axes.set_yscale() for details
-
nonposx/nonposy: [‘mask’ | ‘clip’ ]
-
Non-positive values in x or y can be masked as -invalid, or clipped to a very small positive number
-
-
-

The remaining valid kwargs are -Line2D properties:

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat (0.0 transparent through 1.0 opaque)
animated[True | False]
antialiased or aa[True | False]
axesan Axes instance
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
color or cany matplotlib color
containsa callable function
dash_capstyle[‘butt’ | ‘round’ | ‘projecting’]
dash_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
dashessequence of on/off ink in points
drawstyle[‘default’ | ‘steps’ | ‘steps-pre’ | ‘steps-mid’ | ‘steps-post’]
figurea matplotlib.figure.Figure instance
fillstyle[‘full’ | ‘left’ | ‘right’ | ‘bottom’ | ‘top’ | ‘none’]
gidan id string
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or lwfloat value in points
markerA valid marker style
markeredgecolor or mecany matplotlib color
markeredgewidth or mewfloat value in points
markerfacecolor or mfcany matplotlib color
markerfacecoloralt or mfcaltany matplotlib color
markersize or msfloat
markevery[None | int | length-2 tuple of int | slice | list/array of int | float | length-2 tuple of float]
path_effectsunknown
pickerfloat distance in points or callable pick function fn(artist, event)
pickradiusfloat distance in points
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
solid_capstyle[‘butt’ | ‘round’ | ‘projecting’]
solid_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
transforma matplotlib.transforms.Transform instance
urla url string
visible[True | False]
xdata1D array
ydata1D array
zorderany number
-
-

Example:

-

(Source code, png, pdf)

-
-../_images/log_demo3.png -
-
- -
-
-matplotlib.pyplot.magma()
-

set the default colormap to magma and apply to current image if any. -See help(colormaps) for more information

-
- -
-
-matplotlib.pyplot.magnitude_spectrum(x, Fs=None, Fc=None, window=None, pad_to=None, sides=None, scale=None, hold=None, data=None, **kwargs)
-

Plot the magnitude spectrum.

-

Call signature:

-
magnitude_spectrum(x, Fs=2, Fc=0,  window=mlab.window_hanning,
-                   pad_to=None, sides='default', **kwargs)
-
-
-

Compute the magnitude spectrum of x. Data is padded to a -length of pad_to and the windowing function window is applied to -the signal.

- --- - - - - - -
Parameters:

x : 1-D array or sequence

-
-

Array or sequence containing the data

-
-

Fs : scalar

-
-

The sampling frequency (samples per time unit). It is used -to calculate the Fourier frequencies, freqs, in cycles per time -unit. The default value is 2.

-
-

window : callable or ndarray

-
-

A function or a vector of length NFFT. To create window -vectors see window_hanning(), window_none(), -numpy.blackman(), numpy.hamming(), -numpy.bartlett(), scipy.signal(), -scipy.signal.get_window(), etc. The default is -window_hanning(). If a function is passed as the -argument, it must take a data segment as an argument and -return the windowed version of the segment.

-
-

sides : [ ‘default’ | ‘onesided’ | ‘twosided’ ]

-
-

Specifies which sides of the spectrum to return. Default gives the -default behavior, which returns one-sided for real data and both -for complex data. ‘onesided’ forces the return of a one-sided -spectrum, while ‘twosided’ forces two-sided.

-
-

pad_to : integer

-
-

The number of points to which the data segment is padded when -performing the FFT. While not increasing the actual resolution of -the spectrum (the minimum distance between resolvable peaks), -this can give more points in the plot, allowing for more -detail. This corresponds to the n parameter in the call to fft(). -The default is None, which sets pad_to equal to the length of the -input signal (i.e. no padding).

-
-

scale : [ ‘default’ | ‘linear’ | ‘dB’ ]

-
-

The scaling of the values in the spec. ‘linear’ is no scaling. -‘dB’ returns the values in dB scale. When mode is ‘density’, -this is dB power (10 * log10). Otherwise this is dB amplitude -(20 * log10). ‘default’ is ‘linear’.

-
-

Fc : integer

-
-

The center frequency of x (defaults to 0), which offsets -the x extents of the plot to reflect the frequency range used -when a signal is acquired and then filtered and downsampled to -baseband.

-
-

**kwargs :

-
-
-

Keyword arguments control the Line2D -properties:

-
- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat (0.0 transparent through 1.0 opaque)
animated[True | False]
antialiased or aa[True | False]
axesan Axes instance
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
color or cany matplotlib color
containsa callable function
dash_capstyle[‘butt’ | ‘round’ | ‘projecting’]
dash_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
dashessequence of on/off ink in points
drawstyle[‘default’ | ‘steps’ | ‘steps-pre’ | ‘steps-mid’ | ‘steps-post’]
figurea matplotlib.figure.Figure instance
fillstyle[‘full’ | ‘left’ | ‘right’ | ‘bottom’ | ‘top’ | ‘none’]
gidan id string
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or lwfloat value in points
markerA valid marker style
markeredgecolor or mecany matplotlib color
markeredgewidth or mewfloat value in points
markerfacecolor or mfcany matplotlib color
markerfacecoloralt or mfcaltany matplotlib color
markersize or msfloat
markevery[None | int | length-2 tuple of int | slice | list/array of int | float | length-2 tuple of float]
path_effectsunknown
pickerfloat distance in points or callable pick function fn(artist, event)
pickradiusfloat distance in points
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
solid_capstyle[‘butt’ | ‘round’ | ‘projecting’]
solid_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
transforma matplotlib.transforms.Transform instance
urla url string
visible[True | False]
xdata1D array
ydata1D array
zorderany number
-
-
Returns:

spectrum : 1-D array

-
-

The values for the magnitude spectrum before scaling (real valued)

-
-

freqs : 1-D array

-
-

The frequencies corresponding to the elements in spectrum

-
-

line : a Line2D instance

-
-

The line created by this function

-
-
-
-

See also

-
-
psd()
-
psd() plots the power spectral density.`.
-
angle_spectrum()
-
angle_spectrum() plots the angles of the corresponding frequencies.
-
phase_spectrum()
-
phase_spectrum() plots the phase (unwrapped angle) of the corresponding frequencies.
-
specgram()
-
specgram() can plot the magnitude spectrum of segments within the signal in a colormap.
-
-
In addition to the above described arguments, this function can take a data keyword argument. If such a data argument is given, the following arguments are replaced by data[<arg>]: * All arguments with the following names: ‘x’.
-
-
-

Examples

-

(Source code, png, pdf)

-
-../_images/spectrum_demo2.png -
-
- -
-
-matplotlib.pyplot.margins(*args, **kw)
-

Set or retrieve autoscaling margins.

-

signatures:

-
margins()
-
-
-

returns xmargin, ymargin

-
margins(margin)
-
-margins(xmargin, ymargin)
-
-margins(x=xmargin, y=ymargin)
-
-margins(..., tight=False)
-
-
-

All three forms above set the xmargin and ymargin parameters. -All keyword parameters are optional. A single argument -specifies both xmargin and ymargin. The tight parameter -is passed to autoscale_view(), which is executed after -a margin is changed; the default here is True, on the -assumption that when margins are specified, no additional -padding to match tick marks is usually desired. Setting -tight to None will preserve the previous setting.

-

Specifying any margin changes only the autoscaling; for example, -if xmargin is not None, then xmargin times the X data -interval will be added to each end of that interval before -it is used in autoscaling.

-
- -
-
-matplotlib.pyplot.matshow(A, fignum=None, **kw)
-

Display an array as a matrix in a new figure window.

-

The origin is set at the upper left hand corner and rows (first -dimension of the array) are displayed horizontally. The aspect -ratio of the figure window is that of the array, unless this would -make an excessively short or narrow figure.

-

Tick labels for the xaxis are placed on top.

-

With the exception of fignum, keyword arguments are passed to -imshow(). You may set the origin -kwarg to “lower” if you want the first row in the array to be -at the bottom instead of the top.

-
-
fignum: [ None | integer | False ]
-

By default, matshow() creates a new figure window with -automatic numbering. If fignum is given as an integer, the -created figure will use this figure number. Because of how -matshow() tries to set the figure aspect ratio to be the -one of the array, if you provide the number of an already -existing figure, strange things may happen.

-

If fignum is False or 0, a new figure window will NOT be created.

-
-
-
- -
-
-matplotlib.pyplot.minorticks_off()
-

Remove minor ticks from the current plot.

-
- -
-
-matplotlib.pyplot.minorticks_on()
-

Display minor ticks on the current plot.

-

Displaying minor ticks reduces performance; turn them off using -minorticks_off() if drawing speed is a problem.

-
- -
-
-matplotlib.pyplot.nipy_spectral()
-

set the default colormap to nipy_spectral and apply to current image if any. -See help(colormaps) for more information

-
- -
-
-matplotlib.pyplot.over(func, *args, **kwargs)
-
-

Deprecated since version 2.0: pyplot.hold is deprecated. -Future behavior will be consistent with the long-time default: -plot commands add elements without first clearing the -Axes and/or Figure.

-
-

Call a function with hold(True).

-

Calls:

-
func(*args, **kwargs)
-
-
-

with hold(True) and then restores the hold state.

-
- -
-
-matplotlib.pyplot.pause(interval)
-

Pause for interval seconds.

-

If there is an active figure it will be updated and displayed, -and the GUI event loop will run during the pause.

-

If there is no active figure, or if a non-interactive backend -is in use, this executes time.sleep(interval).

-

This can be used for crude animation. For more complex -animation, see matplotlib.animation.

-

This function is experimental; its behavior may be changed -or extended in a future release.

-
- -
-
-matplotlib.pyplot.pcolor(*args, **kwargs)
-

Create a pseudocolor plot of a 2-D array.

-
-

Note

-

pcolor can be very slow for large arrays; consider -using the similar but much faster -pcolormesh() instead.

-
-

Call signatures:

-
pcolor(C, **kwargs)
-pcolor(X, Y, C, **kwargs)
-
-
-

C is the array of color values.

-

X and Y, if given, specify the (x, y) coordinates of -the colored quadrilaterals; the quadrilateral for C[i,j] has -corners at:

-
(X[i,   j],   Y[i,   j]),
-(X[i,   j+1], Y[i,   j+1]),
-(X[i+1, j],   Y[i+1, j]),
-(X[i+1, j+1], Y[i+1, j+1]).
-
-
-

Ideally the dimensions of X and Y should be one greater -than those of C; if the dimensions are the same, then the -last row and column of C will be ignored.

-

Note that the column index corresponds to the -x-coordinate, and the row index corresponds to y; for -details, see the Grid Orientation section below.

-

If either or both of X and Y are 1-D arrays or column vectors, -they will be expanded as needed into the appropriate 2-D arrays, -making a rectangular grid.

-

X, Y and C may be masked arrays. If either C[i, j], or one -of the vertices surrounding C[i,j] (X or Y at [i, j], [i+1, j], -[i, j+1],[i+1, j+1]) is masked, nothing is plotted.

-

Keyword arguments:

-
-
-
cmap: [ None | Colormap ]
-
A matplotlib.colors.Colormap instance. If None, use -rc settings.
-
norm: [ None | Normalize ]
-
An matplotlib.colors.Normalize instance is used -to scale luminance data to 0,1. If None, defaults to -normalize().
-
vmin/vmax: [ None | scalar ]
-
vmin and vmax are used in conjunction with norm to -normalize luminance data. If either is None, it -is autoscaled to the respective min or max -of the color array C. If not None, vmin or -vmax passed in here override any pre-existing values -supplied in the norm instance.
-
shading: [ ‘flat’ | ‘faceted’ ]
-

If ‘faceted’, a black grid is drawn around each rectangle; if -‘flat’, edges are not drawn. Default is ‘flat’, contrary to -MATLAB.

-
-
This kwarg is deprecated; please use ‘edgecolors’ instead:
-
    -
  • shading=’flat’ – edgecolors=’none’
  • -
  • shading=’faceted – edgecolors=’k’
  • -
-
-
-
-
edgecolors: [ None | 'none' | color | color sequence]
-

If None, the rc setting is used by default.

-

If 'none', edges will not be visible.

-

An mpl color or sequence of colors will set the edge color

-
-
alpha: 0 <= scalar <= 1 or None
-
the alpha blending value
-
snap: bool
-
Whether to snap the mesh to pixel boundaries.
-
-
-

Return value is a matplotlib.collections.Collection -instance.

-

The grid orientation follows the MATLAB convention: an -array C with shape (nrows, ncolumns) is plotted with -the column number as X and the row number as Y, increasing -up; hence it is plotted the way the array would be printed, -except that the Y axis is reversed. That is, C is taken -as C*(*y, x).

-

Similarly for meshgrid():

-
x = np.arange(5)
-y = np.arange(3)
-X, Y = np.meshgrid(x, y)
-
-
-

is equivalent to:

-
X = array([[0, 1, 2, 3, 4],
-           [0, 1, 2, 3, 4],
-           [0, 1, 2, 3, 4]])
-
-Y = array([[0, 0, 0, 0, 0],
-           [1, 1, 1, 1, 1],
-           [2, 2, 2, 2, 2]])
-
-
-

so if you have:

-
C = rand(len(x), len(y))
-
-
-

then you need to transpose C:

-
pcolor(X, Y, C.T)
-
-
-

or:

-
pcolor(C.T)
-
-
-

MATLAB pcolor() always discards the last row and column -of C, but matplotlib displays the last row and column if X and -Y are not specified, or if X and Y have one more row and -column than C.

-

kwargs can be used to control the -PolyCollection properties:

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or antialiasedsBoolean or sequence of booleans
arrayunknown
axesan Axes instance
clima length 2 sequence of floats
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
cmapa colormap or registered colormap name
colormatplotlib color arg or sequence of rgba tuples
containsa callable function
edgecolor or edgecolorsmatplotlib color spec or sequence of specs
facecolor or facecolorsmatplotlib color spec or sequence of specs
figurea matplotlib.figure.Figure instance
gidan id string
hatch[ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
labelstring or anything printable with ‘%s’ conversion.
linestyle or dashes or linestyles[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or linewidths or lwfloat or sequence of floats
normunknown
offset_positionunknown
offsetsfloat or sequence of floats
path_effectsunknown
picker[None|float|boolean|callable]
pickradiusunknown
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
urlsunknown
visible[True | False]
zorderany number
-
-
-

Note

-

The default antialiaseds is False if the default -edgecolors*=”none” is used. This eliminates artificial lines -at patch boundaries, and works regardless of the value of -alpha. If *edgecolors is not “none”, then the default -antialiaseds is taken from -rcParams[‘patch.antialiased’], which defaults to True. -Stroking the edges may be preferred if alpha is 1, but -will cause artifacts otherwise.

-
-
-

See also

-
-
pcolormesh()
-
For an explanation of the differences between -pcolor and pcolormesh.
-
-
-
-

Note

-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All positional and all keyword arguments.
  • -
-
-
- -
-
-matplotlib.pyplot.pcolormesh(*args, **kwargs)
-

Plot a quadrilateral mesh.

-

Call signatures:

-
pcolormesh(C)
-pcolormesh(X, Y, C)
-pcolormesh(C, **kwargs)
-
-
-

Create a pseudocolor plot of a 2-D array.

-

pcolormesh is similar to pcolor(), -but uses a different mechanism and returns a different -object; pcolor returns a -PolyCollection but pcolormesh -returns a -QuadMesh. It is much faster, -so it is almost always preferred for large arrays.

-

C may be a masked array, but X and Y may not. Masked -array support is implemented via cmap and norm; in -contrast, pcolor() simply does not -draw quadrilaterals with masked colors or vertices.

-

Keyword arguments:

-
-
-
cmap: [ None | Colormap ]
-
A matplotlib.colors.Colormap instance. If None, use -rc settings.
-
norm: [ None | Normalize ]
-
A matplotlib.colors.Normalize instance is used to -scale luminance data to 0,1. If None, defaults to -normalize().
-
vmin/vmax: [ None | scalar ]
-
vmin and vmax are used in conjunction with norm to -normalize luminance data. If either is None, it -is autoscaled to the respective min or max -of the color array C. If not None, vmin or -vmax passed in here override any pre-existing values -supplied in the norm instance.
-
shading: [ ‘flat’ | ‘gouraud’ ]
-
‘flat’ indicates a solid color for each quad. When -‘gouraud’, each quad will be Gouraud shaded. When gouraud -shading, edgecolors is ignored.
-
edgecolors: [None | 'None' | 'face' | color |
-
-
color sequence]
-

If None, the rc setting is used by default.

-

If 'None', edges will not be visible.

-

If 'face', edges will have the same color as the faces.

-

An mpl color or sequence of colors will set the edge color

-
-
alpha: 0 <= scalar <= 1 or None
-
the alpha blending value
-
-
-

Return value is a matplotlib.collections.QuadMesh -object.

-

kwargs can be used to control the -matplotlib.collections.QuadMesh properties:

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or antialiasedsBoolean or sequence of booleans
arrayunknown
axesan Axes instance
clima length 2 sequence of floats
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
cmapa colormap or registered colormap name
colormatplotlib color arg or sequence of rgba tuples
containsa callable function
edgecolor or edgecolorsmatplotlib color spec or sequence of specs
facecolor or facecolorsmatplotlib color spec or sequence of specs
figurea matplotlib.figure.Figure instance
gidan id string
hatch[ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
labelstring or anything printable with ‘%s’ conversion.
linestyle or dashes or linestyles[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or linewidths or lwfloat or sequence of floats
normunknown
offset_positionunknown
offsetsfloat or sequence of floats
path_effectsunknown
picker[None|float|boolean|callable]
pickradiusunknown
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
urlsunknown
visible[True | False]
zorderany number
-
-
-

See also

-
-
pcolor()
-
For an explanation of the grid orientation -(Grid Orientation) -and the expansion of 1-D X and/or Y to 2-D arrays.
-
-
-
-

Note

-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All positional and all keyword arguments.
  • -
-
-
- -
-
-matplotlib.pyplot.phase_spectrum(x, Fs=None, Fc=None, window=None, pad_to=None, sides=None, hold=None, data=None, **kwargs)
-

Plot the phase spectrum.

-

Call signature:

-
phase_spectrum(x, Fs=2, Fc=0,  window=mlab.window_hanning,
-               pad_to=None, sides='default', **kwargs)
-
-
-

Compute the phase spectrum (unwrapped angle spectrum) of x. -Data is padded to a length of pad_to and the windowing function -window is applied to the signal.

- --- - - - - - -
Parameters:

x : 1-D array or sequence

-
-

Array or sequence containing the data

-
-

Fs : scalar

-
-

The sampling frequency (samples per time unit). It is used -to calculate the Fourier frequencies, freqs, in cycles per time -unit. The default value is 2.

-
-

window : callable or ndarray

-
-

A function or a vector of length NFFT. To create window -vectors see window_hanning(), window_none(), -numpy.blackman(), numpy.hamming(), -numpy.bartlett(), scipy.signal(), -scipy.signal.get_window(), etc. The default is -window_hanning(). If a function is passed as the -argument, it must take a data segment as an argument and -return the windowed version of the segment.

-
-

sides : [ ‘default’ | ‘onesided’ | ‘twosided’ ]

-
-

Specifies which sides of the spectrum to return. Default gives the -default behavior, which returns one-sided for real data and both -for complex data. ‘onesided’ forces the return of a one-sided -spectrum, while ‘twosided’ forces two-sided.

-
-

pad_to : integer

-
-

The number of points to which the data segment is padded when -performing the FFT. While not increasing the actual resolution of -the spectrum (the minimum distance between resolvable peaks), -this can give more points in the plot, allowing for more -detail. This corresponds to the n parameter in the call to fft(). -The default is None, which sets pad_to equal to the length of the -input signal (i.e. no padding).

-
-

Fc : integer

-
-

The center frequency of x (defaults to 0), which offsets -the x extents of the plot to reflect the frequency range used -when a signal is acquired and then filtered and downsampled to -baseband.

-
-

**kwargs :

-
-
-

Keyword arguments control the Line2D -properties:

-
- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat (0.0 transparent through 1.0 opaque)
animated[True | False]
antialiased or aa[True | False]
axesan Axes instance
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
color or cany matplotlib color
containsa callable function
dash_capstyle[‘butt’ | ‘round’ | ‘projecting’]
dash_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
dashessequence of on/off ink in points
drawstyle[‘default’ | ‘steps’ | ‘steps-pre’ | ‘steps-mid’ | ‘steps-post’]
figurea matplotlib.figure.Figure instance
fillstyle[‘full’ | ‘left’ | ‘right’ | ‘bottom’ | ‘top’ | ‘none’]
gidan id string
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or lwfloat value in points
markerA valid marker style
markeredgecolor or mecany matplotlib color
markeredgewidth or mewfloat value in points
markerfacecolor or mfcany matplotlib color
markerfacecoloralt or mfcaltany matplotlib color
markersize or msfloat
markevery[None | int | length-2 tuple of int | slice | list/array of int | float | length-2 tuple of float]
path_effectsunknown
pickerfloat distance in points or callable pick function fn(artist, event)
pickradiusfloat distance in points
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
solid_capstyle[‘butt’ | ‘round’ | ‘projecting’]
solid_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
transforma matplotlib.transforms.Transform instance
urla url string
visible[True | False]
xdata1D array
ydata1D array
zorderany number
-
-
Returns:

spectrum : 1-D array

-
-

The values for the phase spectrum in radians (real valued)

-
-

freqs : 1-D array

-
-

The frequencies corresponding to the elements in spectrum

-
-

line : a Line2D instance

-
-

The line created by this function

-
-
-
-

See also

-
-
magnitude_spectrum()
-
magnitude_spectrum() plots the magnitudes of the corresponding frequencies.
-
angle_spectrum()
-
angle_spectrum() plots the wrapped version of this function.
-
specgram()
-
specgram() can plot the phase spectrum of segments within the signal in a colormap.
-
-
In addition to the above described arguments, this function can take a data keyword argument. If such a data argument is given, the following arguments are replaced by data[<arg>]: * All arguments with the following names: ‘x’.
-
-
-

Examples

-

(Source code, png, pdf)

-
-../_images/spectrum_demo2.png -
-
- -
-
-matplotlib.pyplot.pie(x, explode=None, labels=None, colors=None, autopct=None, pctdistance=0.6, shadow=False, labeldistance=1.1, startangle=None, radius=None, counterclock=True, wedgeprops=None, textprops=None, center=(0, 0), frame=False, hold=None, data=None)
-

Plot a pie chart.

-

Make a pie chart of array x. The fractional area of each -wedge is given by x/sum(x). If sum(x) <= 1, then the -values of x give the fractional area directly and the array -will not be normalized. The wedges are plotted -counterclockwise, by default starting from the x-axis.

- --- - - - - - -
Parameters:

x : array-like

-
-

The input array used to make the pie chart.

-
-

explode : array-like, optional, default: None

-
-

If not None, is a len(x) array which specifies the -fraction of the radius with which to offset each wedge.

-
-

labels : list, optional, default: None

-
-

A sequence of strings providing the labels for each wedge

-
-

colors : array-like, optional, default: None

-
-

A sequence of matplotlib color args through which the pie chart -will cycle. If None, will use the colors in the currently -active cycle.

-
-

autopct : None (default), string, or function, optional

-
-

If not None, is a string or function used to label the wedges -with their numeric value. The label will be placed inside the -wedge. If it is a format string, the label will be fmt%pct. -If it is a function, it will be called.

-
-

pctdistance : float, optional, default: 0.6

-
-

The ratio between the center of each pie slice and the -start of the text generated by autopct. Ignored if -autopct is None.

-
-

shadow : bool, optional, default: False

-
-

Draw a shadow beneath the pie.

-
-

labeldistance : float, optional, default: 1.1

-
-

The radial distance at which the pie labels are drawn

-
-

startangle : float, optional, default: None

-
-

If not None, rotates the start of the pie chart by angle -degrees counterclockwise from the x-axis.

-
-

radius : float, optional, default: None

-
-

The radius of the pie, if radius is None it will be set to 1.

-
-

counterclock : bool, optional, default: True

-
-

Specify fractions direction, clockwise or counterclockwise.

-
-

wedgeprops : dict, optional, default: None

-
-

Dict of arguments passed to the wedge objects making the pie. -For example, you can pass in``wedgeprops = {‘linewidth’: 3}`` -to set the width of the wedge border lines equal to 3. -For more details, look at the doc/arguments of the wedge object. -By default clip_on=False.

-
-

textprops : dict, optional, default: None

-
-

Dict of arguments to pass to the text objects.

-
-

center : list of float, optional, default: (0, 0)

-
-

Center position of the chart. Takes value (0, 0) or is a -sequence of 2 scalars.

-
-

frame : bool, optional, default: False

-
-

Plot axes frame with the chart if true.

-
-
Returns:

patches : list

-
-

A sequence of matplotlib.patches.Wedge instances

-
-

texts : list

-
-

A is a list of the label matplotlib.text.Text instances.

-
-

autotexts : list

-
-

A is a list of Text instances for the -numeric labels. Is returned only if parameter autopct is -not None.

-
-
-

Notes

-

The pie chart will probably look best if the figure and axes are -square, or the Axes aspect is equal.

-

Examples

-

(Source code, png, pdf)

-
-../_images/pie_demo_features3.png -
-
-

Note

-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All arguments with the following names: ‘colors’, ‘explode’, ‘labels’, ‘x’.
  • -
-
-
- -
-
-matplotlib.pyplot.pink()
-

set the default colormap to pink and apply to current image if any. -See help(colormaps) for more information

-
- -
-
-matplotlib.pyplot.plasma()
-

set the default colormap to plasma and apply to current image if any. -See help(colormaps) for more information

-
- -
-
-matplotlib.pyplot.plot(*args, **kwargs)
-

Plot lines and/or markers to the -Axes. args is a variable length -argument, allowing for multiple x, y pairs with an -optional format string. For example, each of the following is -legal:

-
plot(x, y)        # plot x and y using default line style and color
-plot(x, y, 'bo')  # plot x and y using blue circle markers
-plot(y)           # plot y using x as index array 0..N-1
-plot(y, 'r+')     # ditto, but with red plusses
-
-
-

If x and/or y is 2-dimensional, then the corresponding columns -will be plotted.

-

If used with labeled data, make sure that the color spec is not -included as an element in data, as otherwise the last case -plot("v","r", data={"v":..., "r":...) -can be interpreted as the first case which would do plot(v, r) -using the default line style and color.

-

If not used with labeled data (i.e., without a data argument), -an arbitrary number of x, y, fmt groups can be specified, as in:

-
a.plot(x1, y1, 'g^', x2, y2, 'g-')
-
-
-

Return value is a list of lines that were added.

-

By default, each line is assigned a different style specified by a -‘style cycle’. To change this behavior, you can edit the -axes.prop_cycle rcParam.

-

The following format string characters are accepted to control -the line style or marker:

- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
characterdescription
'-'solid line style
'--'dashed line style
'-.'dash-dot line style
':'dotted line style
'.'point marker
','pixel marker
'o'circle marker
'v'triangle_down marker
'^'triangle_up marker
'<'triangle_left marker
'>'triangle_right marker
'1'tri_down marker
'2'tri_up marker
'3'tri_left marker
'4'tri_right marker
's'square marker
'p'pentagon marker
'*'star marker
'h'hexagon1 marker
'H'hexagon2 marker
'+'plus marker
'x'x marker
'D'diamond marker
'd'thin_diamond marker
'|'vline marker
'_'hline marker
-

The following color abbreviations are supported:

- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
charactercolor
‘b’blue
‘g’green
‘r’red
‘c’cyan
‘m’magenta
‘y’yellow
‘k’black
‘w’white
-

In addition, you can specify colors in many weird and -wonderful ways, including full names ('green'), hex -strings ('#008000'), RGB or RGBA tuples ((0,1,0,1)) or -grayscale intensities as a string ('0.8'). Of these, the -string specifications can be used in place of a fmt group, -but the tuple forms can be used only as kwargs.

-

Line styles and colors are combined in a single format string, as in -'bo' for blue circles.

-

The kwargs can be used to set line properties (any property that has -a set_* method). You can use this to set a line label (for auto -legends), linewidth, anitialising, marker face color, etc. Here is an -example:

-
plot([1,2,3], [1,2,3], 'go-', label='line 1', linewidth=2)
-plot([1,2,3], [1,4,9], 'rs',  label='line 2')
-axis([0, 4, 0, 10])
-legend()
-
-
-

If you make multiple lines with one plot command, the kwargs -apply to all those lines, e.g.:

-
plot(x1, y1, x2, y2, antialiased=False)
-
-
-

Neither line will be antialiased.

-

You do not need to use format strings, which are just -abbreviations. All of the line properties can be controlled -by keyword arguments. For example, you can set the color, -marker, linestyle, and markercolor with:

-
plot(x, y, color='green', linestyle='dashed', marker='o',
-     markerfacecolor='blue', markersize=12).
-
-
-

See Line2D for details.

-

The kwargs are Line2D properties:

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat (0.0 transparent through 1.0 opaque)
animated[True | False]
antialiased or aa[True | False]
axesan Axes instance
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
color or cany matplotlib color
containsa callable function
dash_capstyle[‘butt’ | ‘round’ | ‘projecting’]
dash_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
dashessequence of on/off ink in points
drawstyle[‘default’ | ‘steps’ | ‘steps-pre’ | ‘steps-mid’ | ‘steps-post’]
figurea matplotlib.figure.Figure instance
fillstyle[‘full’ | ‘left’ | ‘right’ | ‘bottom’ | ‘top’ | ‘none’]
gidan id string
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or lwfloat value in points
markerA valid marker style
markeredgecolor or mecany matplotlib color
markeredgewidth or mewfloat value in points
markerfacecolor or mfcany matplotlib color
markerfacecoloralt or mfcaltany matplotlib color
markersize or msfloat
markevery[None | int | length-2 tuple of int | slice | list/array of int | float | length-2 tuple of float]
path_effectsunknown
pickerfloat distance in points or callable pick function fn(artist, event)
pickradiusfloat distance in points
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
solid_capstyle[‘butt’ | ‘round’ | ‘projecting’]
solid_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
transforma matplotlib.transforms.Transform instance
urla url string
visible[True | False]
xdata1D array
ydata1D array
zorderany number
-
-

kwargs scalex and scaley, if defined, are passed on to -autoscale_view() to determine -whether the x and y axes are autoscaled; the default is -True.

-
-

Note

-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All arguments with the following names: ‘x’, ‘y’.
  • -
-
-
- -
-
-matplotlib.pyplot.plot_date(x, y, fmt='o', tz=None, xdate=True, ydate=False, hold=None, data=None, **kwargs)
-

A plot with data that contains dates.

-

Similar to the plot() command, except -the x or y (or both) data is considered to be dates, and the -axis is labeled accordingly.

-

x and/or y can be a sequence of dates represented as float -days since 0001-01-01 UTC.

-

Note if you are using custom date tickers and formatters, it -may be necessary to set the formatters/locators after the call -to meth:plot_date since meth:plot_date will set the -default tick locator to -class:matplotlib.dates.AutoDateLocator (if the tick -locator is not already set to a -class:matplotlib.dates.DateLocator instance) and the -default tick formatter to -class:matplotlib.dates.AutoDateFormatter (if the tick -formatter is not already set to a -class:matplotlib.dates.DateFormatter instance).

- --- - - - - - - - - -
Parameters:

fmt : string

-
-

The plot format string.

-
-

tz : [ None | timezone string | tzinfo instance]

-
-

The time zone to use in labeling dates. If None, defaults to rc -value.

-
-

xdate : boolean

-
-

If True, the x-axis will be labeled with dates.

-
-

ydate : boolean

-
-

If True, the y-axis will be labeled with dates.

-
-
Returns:

lines

-
Other Parameters:
 

kwargs : matplotlib.lines.Line2D

-

properties :

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat (0.0 transparent through 1.0 opaque)
animated[True | False]
antialiased or aa[True | False]
axesan Axes instance
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
color or cany matplotlib color
containsa callable function
dash_capstyle[‘butt’ | ‘round’ | ‘projecting’]
dash_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
dashessequence of on/off ink in points
drawstyle[‘default’ | ‘steps’ | ‘steps-pre’ | ‘steps-mid’ | ‘steps-post’]
figurea matplotlib.figure.Figure instance
fillstyle[‘full’ | ‘left’ | ‘right’ | ‘bottom’ | ‘top’ | ‘none’]
gidan id string
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or lwfloat value in points
markerA valid marker style
markeredgecolor or mecany matplotlib color
markeredgewidth or mewfloat value in points
markerfacecolor or mfcany matplotlib color
markerfacecoloralt or mfcaltany matplotlib color
markersize or msfloat
markevery[None | int | length-2 tuple of int | slice | list/array of int | float | length-2 tuple of float]
path_effectsunknown
pickerfloat distance in points or callable pick function fn(artist, event)
pickradiusfloat distance in points
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
solid_capstyle[‘butt’ | ‘round’ | ‘projecting’]
solid_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
transforma matplotlib.transforms.Transform instance
urla url string
visible[True | False]
xdata1D array
ydata1D array
zorderany number
-
-

.. note::

-
-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All arguments with the following names: ‘x’, ‘y’.
  • -
-
-
-
-

See also

-
-
matplotlib.dates
-
helper functions on dates
-
matplotlib.dates.date2num
-
how to convert dates to num
-
matplotlib.dates.num2date
-
how to convert num to dates
-
matplotlib.dates.drange
-
how floating point dates
-
-
-
- -
-
-matplotlib.pyplot.plotfile(fname, cols=(0, ), plotfuncs=None, comments='#', skiprows=0, checkrows=5, delimiter=', ', names=None, subplots=True, newfig=True, **kwargs)
-

Plot the data in in a file.

-

cols is a sequence of column identifiers to plot. An identifier -is either an int or a string. If it is an int, it indicates the -column number. If it is a string, it indicates the column header. -matplotlib will make column headers lower case, replace spaces with -underscores, and remove all illegal characters; so 'Adj Close*' -will have name 'adj_close'.

-
    -
  • If len(cols) == 1, only that column will be plotted on the y axis.
  • -
  • If len(cols) > 1, the first element will be an identifier for -data for the x axis and the remaining elements will be the -column indexes for multiple subplots if subplots is True -(the default), or for lines in a single subplot if subplots -is False.
  • -
-

plotfuncs, if not None, is a dictionary mapping identifier to -an Axes plotting function as a string. -Default is ‘plot’, other choices are ‘semilogy’, ‘fill’, ‘bar’, -etc. You must use the same type of identifier in the cols -vector as you use in the plotfuncs dictionary, e.g., integer -column numbers in both or column names in both. If subplots -is False, then including any function such as ‘semilogy’ -that changes the axis scaling will set the scaling for all -columns.

-

comments, skiprows, checkrows, delimiter, and names -are all passed on to matplotlib.pylab.csv2rec() to -load the data into a record array.

-

If newfig is True, the plot always will be made in a new figure; -if False, it will be made in the current figure if one exists, -else in a new figure.

-

kwargs are passed on to plotting functions.

-

Example usage:

-
# plot the 2nd and 4th column against the 1st in two subplots
-plotfile(fname, (0,1,3))
-
-# plot using column names; specify an alternate plot type for volume
-plotfile(fname, ('date', 'volume', 'adj_close'),
-                              plotfuncs={'volume': 'semilogy'})
-
-
-

Note: plotfile is intended as a convenience for quickly plotting -data from flat files; it is not intended as an alternative -interface to general plotting with pyplot or matplotlib.

-
- -
-
-matplotlib.pyplot.polar(*args, **kwargs)
-

Make a polar plot.

-

call signature:

-
polar(theta, r, **kwargs)
-
-
-

Multiple theta, r arguments are supported, with format -strings, as in plot().

-
- -
-
-matplotlib.pyplot.prism()
-

set the default colormap to prism and apply to current image if any. -See help(colormaps) for more information

-
- -
-
-matplotlib.pyplot.psd(x, NFFT=None, Fs=None, Fc=None, detrend=None, window=None, noverlap=None, pad_to=None, sides=None, scale_by_freq=None, return_line=None, hold=None, data=None, **kwargs)
-

Plot the power spectral density.

-

Call signature:

-
psd(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
-    window=mlab.window_hanning, noverlap=0, pad_to=None,
-    sides='default', scale_by_freq=None, return_line=None, **kwargs)
-
-
-

The power spectral density by Welch’s average -periodogram method. The vector x is divided into NFFT length -segments. Each segment is detrended by function detrend and -windowed by function window. noverlap gives the length of -the overlap between segments. The -of each segment are averaged to compute , -with a scaling to correct for power loss due to windowing.

-

If len(x) < NFFT, it will be zero padded to NFFT.

- --- - - - - - -
Parameters:

x : 1-D array or sequence

-
-

Array or sequence containing the data

-
-

Fs : scalar

-
-

The sampling frequency (samples per time unit). It is used -to calculate the Fourier frequencies, freqs, in cycles per time -unit. The default value is 2.

-
-

window : callable or ndarray

-
-

A function or a vector of length NFFT. To create window -vectors see window_hanning(), window_none(), -numpy.blackman(), numpy.hamming(), -numpy.bartlett(), scipy.signal(), -scipy.signal.get_window(), etc. The default is -window_hanning(). If a function is passed as the -argument, it must take a data segment as an argument and -return the windowed version of the segment.

-
-

sides : [ ‘default’ | ‘onesided’ | ‘twosided’ ]

-
-

Specifies which sides of the spectrum to return. Default gives the -default behavior, which returns one-sided for real data and both -for complex data. ‘onesided’ forces the return of a one-sided -spectrum, while ‘twosided’ forces two-sided.

-
-

pad_to : integer

-
-

The number of points to which the data segment is padded when -performing the FFT. This can be different from NFFT, which -specifies the number of data points used. While not increasing -the actual resolution of the spectrum (the minimum distance between -resolvable peaks), this can give more points in the plot, -allowing for more detail. This corresponds to the n parameter -in the call to fft(). The default is None, which sets pad_to -equal to NFFT

-
-

NFFT : integer

-
-

The number of data points used in each block for the FFT. -A power 2 is most efficient. The default value is 256. -This should NOT be used to get zero padding, or the scaling of the -result will be incorrect. Use pad_to for this instead.

-
-

detrend : {‘default’, ‘constant’, ‘mean’, ‘linear’, ‘none’} or callable

-
-

The function applied to each segment before fft-ing, -designed to remove the mean or linear trend. Unlike in -MATLAB, where the detrend parameter is a vector, in -matplotlib is it a function. The pylab -module defines detrend_none(), -detrend_mean(), and -detrend_linear(), but you can use -a custom function as well. You can also use a string to choose -one of the functions. ‘default’, ‘constant’, and ‘mean’ call -detrend_mean(). ‘linear’ calls -detrend_linear(). ‘none’ calls -detrend_none().

-
-

scale_by_freq : boolean, optional

-
-

Specifies whether the resulting density values should be scaled -by the scaling frequency, which gives density in units of Hz^-1. -This allows for integration over the returned frequency values. -The default is True for MATLAB compatibility.

-
-

noverlap : integer

-
-

The number of points of overlap between segments. -The default value is 0 (no overlap).

-
-

Fc : integer

-
-

The center frequency of x (defaults to 0), which offsets -the x extents of the plot to reflect the frequency range used -when a signal is acquired and then filtered and downsampled to -baseband.

-
-

return_line : bool

-
-

Whether to include the line object plotted in the returned values. -Default is False.

-
-

**kwargs :

-
-
-

Keyword arguments control the Line2D -properties:

-
- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat (0.0 transparent through 1.0 opaque)
animated[True | False]
antialiased or aa[True | False]
axesan Axes instance
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
color or cany matplotlib color
containsa callable function
dash_capstyle[‘butt’ | ‘round’ | ‘projecting’]
dash_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
dashessequence of on/off ink in points
drawstyle[‘default’ | ‘steps’ | ‘steps-pre’ | ‘steps-mid’ | ‘steps-post’]
figurea matplotlib.figure.Figure instance
fillstyle[‘full’ | ‘left’ | ‘right’ | ‘bottom’ | ‘top’ | ‘none’]
gidan id string
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or lwfloat value in points
markerA valid marker style
markeredgecolor or mecany matplotlib color
markeredgewidth or mewfloat value in points
markerfacecolor or mfcany matplotlib color
markerfacecoloralt or mfcaltany matplotlib color
markersize or msfloat
markevery[None | int | length-2 tuple of int | slice | list/array of int | float | length-2 tuple of float]
path_effectsunknown
pickerfloat distance in points or callable pick function fn(artist, event)
pickradiusfloat distance in points
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
solid_capstyle[‘butt’ | ‘round’ | ‘projecting’]
solid_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
transforma matplotlib.transforms.Transform instance
urla url string
visible[True | False]
xdata1D array
ydata1D array
zorderany number
-
-
Returns:

Pxx : 1-D array

-
-

The values for the power spectrum P_{xx} before scaling -(real valued)

-
-

freqs : 1-D array

-
-

The frequencies corresponding to the elements in Pxx

-
-

line : a Line2D instance

-
-

The line created by this function. -Only returned if return_line is True.

-
-
-
-

See also

-
-
specgram()
-
specgram() differs in the default overlap; in not returning the mean of the segment periodograms; in returning the times of the segments; and in plotting a colormap instead of a line.
-
magnitude_spectrum()
-
magnitude_spectrum() plots the magnitude spectrum.
-
csd()
-
csd() plots the spectral density between two signals.
-
-
In addition to the above described arguments, this function can take a data keyword argument. If such a data argument is given, the following arguments are replaced by data[<arg>]: * All arguments with the following names: ‘x’.
-
-
-

Notes

-

For plotting, the power is plotted as - for decibels, though Pxx itself -is returned.

-

References

-

Bendat & Piersol – Random Data: Analysis and Measurement Procedures, -John Wiley & Sons (1986)

-

Examples

-

(Source code, png, pdf)

-
-../_images/psd_demo_00_002.png -
-
- -
-
-matplotlib.pyplot.quiver(*args, **kw)
-

Plot a 2-D field of arrows.

-

Call signatures:

-
quiver(U, V, **kw)
-quiver(U, V, C, **kw)
-quiver(X, Y, U, V, **kw)
-quiver(X, Y, U, V, C, **kw)
-
-
-

U and V are the arrow data, X and Y set the locaiton of the -arrows, and C sets the color of the arrows. These arguments may be 1-D or -2-D arrays or sequences.

-

If X and Y are absent, they will be generated as a uniform grid. -If U and V are 2-D arrays and X and Y are 1-D, and if len(X) and -len(Y) match the column and row dimensions of U, then X and Y will be -expanded with numpy.meshgrid().

-

The default settings auto-scales the length of the arrows to a reasonable size. -To change this behavior see the scale and scale_units kwargs.

-

The defaults give a slightly swept-back arrow; to make the head a -triangle, make headaxislength the same as headlength. To make the -arrow more pointed, reduce headwidth or increase headlength and -headaxislength. To make the head smaller relative to the shaft, -scale down all the head parameters. You will probably do best to leave -minshaft alone.

-

linewidths and edgecolors can be used to customize the arrow -outlines.

- --- - - - -
Parameters:

X : 1D or 2D array, sequence, optional

-
-

The x coordinates of the arrow locations

-
-

Y : 1D or 2D array, sequence, optional

-
-

The y coordinates of the arrow locations

-
-

U : 1D or 2D array or masked array, sequence

-
-

The x components of the arrow vectors

-
-

V : 1D or 2D array or masked array, sequence

-
-

The y components of the arrow vectors

-
-

C : 1D or 2D array, sequence, optional

-
-

The arrow colors

-
-

units : [ ‘width’ | ‘height’ | ‘dots’ | ‘inches’ | ‘x’ | ‘y’ | ‘xy’ ]

-
-

The arrow dimensions (except for length) are measured in multiples of -this unit.

-

‘width’ or ‘height’: the width or height of the axis

-

‘dots’ or ‘inches’: pixels or inches, based on the figure dpi

-

‘x’, ‘y’, or ‘xy’: respectively X, Y, or -in data units

-

The arrows scale differently depending on the units. For -‘x’ or ‘y’, the arrows get larger as one zooms in; for other -units, the arrow size is independent of the zoom state. For -‘width or ‘height’, the arrow size increases with the width and -height of the axes, respectively, when the window is resized; -for ‘dots’ or ‘inches’, resizing does not change the arrows.

-
-

angles : [ ‘uv’ | ‘xy’ ], array, optional

-
-

Method for determining the angle of the arrows. Default is ‘uv’.

-

‘uv’: the arrow axis aspect ratio is 1 so that -if U*==*V the orientation of the arrow on the plot is 45 degrees -counter-clockwise from the horizontal axis (positive to the right).

-

‘xy’: arrows point from (x,y) to (x+u, y+v). -Use this for plotting a gradient field, for example.

-

Alternatively, arbitrary angles may be specified as an array -of values in degrees, counter-clockwise from the horizontal axis.

-

Note: inverting a data axis will correspondingly invert the -arrows only with angles='xy'.

-
-

scale : None, float, optional

-
-

Number of data units per arrow length unit, e.g., m/s per plot width; a -smaller scale parameter makes the arrow longer. Default is None.

-

If None, a simple autoscaling algorithm is used, based on the average -vector length and the number of vectors. The arrow length unit is given by -the scale_units parameter

-
-

scale_units : [ ‘width’ | ‘height’ | ‘dots’ | ‘inches’ | ‘x’ | ‘y’ | ‘xy’ ], None, optional

-
-

If the scale kwarg is None, the arrow length unit. Default is None.

-

e.g. scale_units is ‘inches’, scale is 2.0, and -(u,v) = (1,0), then the vector will be 0.5 inches long.

-

If scale_units is ‘width’/’height’, then the vector will be half the -width/height of the axes.

-

If scale_units is ‘x’ then the vector will be 0.5 x-axis -units. To plot vectors in the x-y plane, with u and v having -the same units as x and y, use -angles='xy', scale_units='xy', scale=1.

-
-

width : scalar, optional

-
-

Shaft width in arrow units; default depends on choice of units, -above, and number of vectors; a typical starting value is about -0.005 times the width of the plot.

-
-

headwidth : scalar, optional

-
-

Head width as multiple of shaft width, default is 3

-
-

headlength : scalar, optional

-
-

Head length as multiple of shaft width, default is 5

-
-

headaxislength : scalar, optional

-
-

Head length at shaft intersection, default is 4.5

-
-

minshaft : scalar, optional

-
-

Length below which arrow scales, in units of head length. Do not -set this to less than 1, or small arrows will look terrible! -Default is 1

-
-

minlength : scalar, optional

-
-

Minimum length as a multiple of shaft width; if an arrow length -is less than this, plot a dot (hexagon) of this diameter instead. -Default is 1.

-
-

pivot : [ ‘tail’ | ‘mid’ | ‘middle’ | ‘tip’ ], optional

-
-

The part of the arrow that is at the grid point; the arrow rotates -about this point, hence the name pivot.

-
-

color : [ color | color sequence ], optional

-
-

This is a synonym for the -PolyCollection facecolor kwarg. -If C has been set, color has no effect.

-
-
-
-

See also

-
-
quiverkey
-
Add a key to a quiver plot
-
-
-

Notes

-

Additional PolyCollection -keyword arguments:

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or antialiasedsBoolean or sequence of booleans
arrayunknown
axesan Axes instance
clima length 2 sequence of floats
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
cmapa colormap or registered colormap name
colormatplotlib color arg or sequence of rgba tuples
containsa callable function
edgecolor or edgecolorsmatplotlib color spec or sequence of specs
facecolor or facecolorsmatplotlib color spec or sequence of specs
figurea matplotlib.figure.Figure instance
gidan id string
hatch[ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
labelstring or anything printable with ‘%s’ conversion.
linestyle or dashes or linestyles[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or linewidths or lwfloat or sequence of floats
normunknown
offset_positionunknown
offsetsfloat or sequence of floats
path_effectsunknown
picker[None|float|boolean|callable]
pickradiusunknown
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
urlsunknown
visible[True | False]
zorderany number
-
-

Examples

-

(Source code, png, pdf)

-
-../_images/quiver_simple_demo2.png -
-
- -
-
-matplotlib.pyplot.quiverkey(*args, **kw)
-

Add a key to a quiver plot.

-

Call signature:

-
quiverkey(Q, X, Y, U, label, **kw)
-
-
-

Arguments:

-
-
-
Q:
-
The Quiver instance returned by a call to quiver.
-
X, Y:
-
The location of the key; additional explanation follows.
-
U:
-
The length of the key
-
label:
-
A string with the length and units of the key
-
-
-

Keyword arguments:

-
-
-
coordinates = [ ‘axes’ | ‘figure’ | ‘data’ | ‘inches’ ]
-
Coordinate system and units for X, Y: ‘axes’ and ‘figure’ are -normalized coordinate systems with 0,0 in the lower left and 1,1 -in the upper right; ‘data’ are the axes data coordinates (used for -the locations of the vectors in the quiver plot itself); ‘inches’ -is position in the figure in inches, with 0,0 at the lower left -corner.
-
color:
-
overrides face and edge colors from Q.
-
labelpos = [ ‘N’ | ‘S’ | ‘E’ | ‘W’ ]
-
Position the label above, below, to the right, to the left of the -arrow, respectively.
-
labelsep:
-
Distance in inches between the arrow and the label. Default is -0.1
-
labelcolor:
-
defaults to default Text color.
-
fontproperties:
-
A dictionary with keyword arguments accepted by the -FontProperties initializer: -family, style, variant, size, weight
-
-
-

Any additional keyword arguments are used to override vector -properties taken from Q.

-

The positioning of the key depends on X, Y, coordinates, and -labelpos. If labelpos is ‘N’ or ‘S’, X, Y give the position -of the middle of the key arrow. If labelpos is ‘E’, X, Y -positions the head, and if labelpos is ‘W’, X, Y positions the -tail; in either of these two cases, X, Y is somewhere in the -middle of the arrow+label key object.

-
- -
-
-matplotlib.pyplot.rc(*args, **kwargs)
-

Set the current rc params. Group is the grouping for the rc, e.g., -for lines.linewidth the group is lines, for -axes.facecolor, the group is axes, and so on. Group may -also be a list or tuple of group names, e.g., (xtick, ytick). -kwargs is a dictionary attribute name/value pairs, e.g.,:

-
rc('lines', linewidth=2, color='r')
-
-
-

sets the current rc params and is equivalent to:

-
rcParams['lines.linewidth'] = 2
-rcParams['lines.color'] = 'r'
-
-
-

The following aliases are available to save typing for interactive -users:

- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AliasProperty
‘lw’‘linewidth’
‘ls’‘linestyle’
‘c’‘color’
‘fc’‘facecolor’
‘ec’‘edgecolor’
‘mew’‘markeredgewidth’
‘aa’‘antialiased’
-

Thus you could abbreviate the above rc command as:

-
rc('lines', lw=2, c='r')
-
-
-

Note you can use python’s kwargs dictionary facility to store -dictionaries of default parameters. e.g., you can customize the -font rc as follows:

-
font = {'family' : 'monospace',
-        'weight' : 'bold',
-        'size'   : 'larger'}
-
-rc('font', **font)  # pass in the font dict as kwargs
-
-
-

This enables you to easily switch between several configurations. Use -matplotlib.style.use('default') or rcdefaults() to -restore the default rc params after changes.

-
- -
-
-matplotlib.pyplot.rc_context(rc=None, fname=None)
-

Return a context manager for managing rc settings.

-

This allows one to do:

-
with mpl.rc_context(fname='screen.rc'):
-    plt.plot(x, a)
-    with mpl.rc_context(fname='print.rc'):
-        plt.plot(x, b)
-    plt.plot(x, c)
-
-
-

The ‘a’ vs ‘x’ and ‘c’ vs ‘x’ plots would have settings from -‘screen.rc’, while the ‘b’ vs ‘x’ plot would have settings from -‘print.rc’.

-

A dictionary can also be passed to the context manager:

-
with mpl.rc_context(rc={'text.usetex': True}, fname='screen.rc'):
-    plt.plot(x, a)
-
-
-

The ‘rc’ dictionary takes precedence over the settings loaded from -‘fname’. Passing a dictionary only is also valid.

-
- -
-
-matplotlib.pyplot.rcdefaults()
-

Restore the rc params from Matplotlib’s internal defaults.

-
-

See also

-
-
rc_file_defaults
-
Restore the rc params from the rc file originally loaded by Matplotlib.
-
matplotlib.style.use
-
Use a specific style file. Call style.use('default') to restore the default style.
-
-
-
- -
-
-matplotlib.pyplot.rgrids(*args, **kwargs)
-

Get or set the radial gridlines on a polar plot.

-

call signatures:

-
lines, labels = rgrids()
-lines, labels = rgrids(radii, labels=None, angle=22.5, **kwargs)
-
-
-

When called with no arguments, rgrid() simply returns the -tuple (lines, labels), where lines is an array of radial -gridlines (Line2D instances) and -labels is an array of tick labels -(Text instances). When called with -arguments, the labels will appear at the specified radial -distances and angles.

-

labels, if not None, is a len(radii) list of strings of the -labels to use at each angle.

-

If labels is None, the rformatter will be used

-

Examples:

-
# set the locations of the radial gridlines and labels
-lines, labels = rgrids( (0.25, 0.5, 1.0) )
-
-# set the locations and labels of the radial gridlines and labels
-lines, labels = rgrids( (0.25, 0.5, 1.0), ('Tom', 'Dick', 'Harry' )
-
-
-
- -
-
-matplotlib.pyplot.savefig(*args, **kwargs)
-

Save the current figure.

-

Call signature:

-
savefig(fname, dpi=None, facecolor='w', edgecolor='w',
-        orientation='portrait', papertype=None, format=None,
-        transparent=False, bbox_inches=None, pad_inches=0.1,
-        frameon=None)
-
-
-

The output formats available depend on the backend being used.

-

Arguments:

-
-
-
fname:
-

A string containing a path to a filename, or a Python -file-like object, or possibly some backend-dependent object -such as PdfPages.

-

If format is None and fname is a string, the output -format is deduced from the extension of the filename. If -the filename has no extension, the value of the rc parameter -savefig.format is used.

-

If fname is not a string, remember to specify format to -ensure that the correct backend is used.

-
-
-
-

Keyword arguments:

-
-
-
dpi: [ None | scalar > 0 | ‘figure’]
-
The resolution in dots per inch. If None it will default to -the value savefig.dpi in the matplotlibrc file. If ‘figure’ -it will set the dpi to be the value of the figure.
-
facecolor, edgecolor:
-
the colors of the figure rectangle
-
orientation: [ ‘landscape’ | ‘portrait’ ]
-
not supported on all backends; currently only on postscript output
-
papertype:
-
One of ‘letter’, ‘legal’, ‘executive’, ‘ledger’, ‘a0’ through -‘a10’, ‘b0’ through ‘b10’. Only supported for postscript -output.
-
format:
-
One of the file extensions supported by the active -backend. Most backends support png, pdf, ps, eps and svg.
-
transparent:
-
If True, the axes patches will all be transparent; the -figure patch will also be transparent unless facecolor -and/or edgecolor are specified via kwargs. -This is useful, for example, for displaying -a plot on top of a colored background on a web page. The -transparency of these patches will be restored to their -original values upon exit of this function.
-
frameon:
-
If True, the figure patch will be colored, if False, the -figure background will be transparent. If not provided, the -rcParam ‘savefig.frameon’ will be used.
-
bbox_inches:
-
Bbox in inches. Only the given portion of the figure is -saved. If ‘tight’, try to figure out the tight bbox of -the figure.
-
pad_inches:
-
Amount of padding around the figure when bbox_inches is -‘tight’.
-
bbox_extra_artists:
-
A list of extra artists that will be considered when the -tight bbox is calculated.
-
-
-
- -
-
-matplotlib.pyplot.sca(ax)
-

Set the current Axes instance to ax.

-

The current Figure is updated to the parent of ax.

-
- -
-
-matplotlib.pyplot.scatter(x, y, s=None, c=None, marker=None, cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, verts=None, edgecolors=None, hold=None, data=None, **kwargs)
-

Make a scatter plot of x vs y

-

Marker size is scaled by s and marker color is mapped to c

- --- - - - - - - - - -
Parameters:

x, y : array_like, shape (n, )

-
-

Input data

-
-

s : scalar or array_like, shape (n, ), optional

-
-

size in points^2. Default is rcParams['lines.markersize'] ** 2.

-
-

c : color, sequence, or sequence of color, optional, default: ‘b’

-
-

c can be a single color format string, or a sequence of color -specifications of length N, or a sequence of N numbers to be -mapped to colors using the cmap and norm specified via kwargs -(see below). Note that c should not be a single numeric RGB or -RGBA sequence because that is indistinguishable from an array of -values to be colormapped. c can be a 2-D array in which the -rows are RGB or RGBA, however, including the case of a single -row to specify the same color for all points.

-
-

marker : MarkerStyle, optional, default: ‘o’

-
-

See markers for more information on the different -styles of markers scatter supports. marker can be either -an instance of the class or the text shorthand for a particular -marker.

-
-

cmap : Colormap, optional, default: None

-
-

A Colormap instance or registered name. -cmap is only used if c is an array of floats. If None, -defaults to rc image.cmap.

-
-

norm : Normalize, optional, default: None

-
-

A Normalize instance is used to scale -luminance data to 0, 1. norm is only used if c is an array of -floats. If None, use the default normalize().

-
-

vmin, vmax : scalar, optional, default: None

-
-

vmin and vmax are used in conjunction with norm to normalize -luminance data. If either are None, the min and max of the -color array is used. Note if you pass a norm instance, your -settings for vmin and vmax will be ignored.

-
-

alpha : scalar, optional, default: None

-
-

The alpha blending value, between 0 (transparent) and 1 (opaque)

-
-

linewidths : scalar or array_like, optional, default: None

-
-

If None, defaults to (lines.linewidth,).

-
-

verts : sequence of (x, y), optional

-
-

If marker is None, these vertices will be used to -construct the marker. The center of the marker is located -at (0,0) in normalized units. The overall marker is rescaled -by s.

-
-

edgecolors : color or sequence of color, optional, default: None

-
-

If None, defaults to ‘face’

-

If ‘face’, the edge color will always be the same as -the face color.

-

If it is ‘none’, the patch boundary will not -be drawn.

-

For non-filled markers, the edgecolors kwarg -is ignored and forced to ‘face’ internally.

-
-
Returns:

paths : PathCollection

-
Other Parameters:
 

kwargs : Collection properties

-
-
-

See also

-
-
plot
-
to plot scatter plots when markers are identical in size and color
-
-
-

Notes

-
    -
  • The plot function will be faster for scatterplots where markers -don’t vary in size or color.

    -
  • -
  • Any or all of x, y, s, and c may be masked arrays, in which -case all masks will be combined and only unmasked points will be -plotted.

    -

    Fundamentally, scatter works with 1-D arrays; x, y, s, and c -may be input as 2-D arrays, but within scatter they will be -flattened. The exception is c, which will be flattened only if its -size matches the size of x and y.

    -
  • -
-

Examples

-

(Source code, png, pdf)

-
-../_images/scatter_demo3.png -
-
-

Note

-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All arguments with the following names: ‘c’, ‘color’, ‘edgecolors’, ‘facecolor’, ‘facecolors’, ‘linewidths’, ‘s’, ‘x’, ‘y’.
  • -
-
-
- -
-
-matplotlib.pyplot.sci(im)
-

Set the current image. This image will be the target of colormap -commands like jet(), -hot() or -clim()). The current image is an -attribute of the current axes.

-
- -
-
-matplotlib.pyplot.semilogx(*args, **kwargs)
-

Make a plot with log scaling on the x axis.

- --- - - - - - - - - -
Parameters:

basex : float, optional

-
-

Base of the x logarithm. The scalar should be larger -than 1.

-
-

subsx : array_like, optional

-
-

The location of the minor xticks; None defaults to -autosubs, which depend on the number of decades in the -plot; see set_xscale() for -details.

-
-

nonposx : string, optional, {‘mask’, ‘clip’}

-
-

Non-positive values in x can be masked as -invalid, or clipped to a very small positive number.

-
-
Returns:

plot

-
-

Log-scaled plot on the x axis.

-
-
Other Parameters:
 

:class:`~matplotlib.lines.Line2D` properties:

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat (0.0 transparent through 1.0 opaque)
animated[True | False]
antialiased or aa[True | False]
axesan Axes instance
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
color or cany matplotlib color
containsa callable function
dash_capstyle[‘butt’ | ‘round’ | ‘projecting’]
dash_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
dashessequence of on/off ink in points
drawstyle[‘default’ | ‘steps’ | ‘steps-pre’ | ‘steps-mid’ | ‘steps-post’]
figurea matplotlib.figure.Figure instance
fillstyle[‘full’ | ‘left’ | ‘right’ | ‘bottom’ | ‘top’ | ‘none’]
gidan id string
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or lwfloat value in points
markerA valid marker style
markeredgecolor or mecany matplotlib color
markeredgewidth or mewfloat value in points
markerfacecolor or mfcany matplotlib color
markerfacecoloralt or mfcaltany matplotlib color
markersize or msfloat
markevery[None | int | length-2 tuple of int | slice | list/array of int | float | length-2 tuple of float]
path_effectsunknown
pickerfloat distance in points or callable pick function fn(artist, event)
pickradiusfloat distance in points
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
solid_capstyle[‘butt’ | ‘round’ | ‘projecting’]
solid_joinstyle[‘miter’ | ‘round’ | ‘bevel’]
transforma matplotlib.transforms.Transform instance
urla url string
visible[True | False]
xdata1D array
ydata1D array
zorderany number
-
-
-
-

See also

-
-
loglog
-
For example code and figure.
-
-
-

Notes

-

This function supports all the keyword arguments of -plot() and -matplotlib.axes.Axes.set_xscale().

-
- -
-
-matplotlib.pyplot.semilogy(*args, **kwargs)
-

Make a plot with log scaling on the y axis.

- --- - - - - - - - - -
Parameters:

basey : scalar > 1

-
-
-

Base of the y logarithm.

-
-
-
subsy : None or iterable
-

The location of the minor yticks. None defaults to -autosubs, which depend on the number of decades in the -plot. See set_yscale() for -details.

-
-
nonposy : {‘mask’ | ‘clip’} str
-

Non-positive values in y can be masked as -invalid, or clipped to a very small positive number.

-
-
-
-
Returns:

Line2D

-
-

Line instance of the plot.

-
-
Other Parameters:
 

kwargs : Line2D properties,

-
-

plot and -matplotlib.axes.Axes.set_yscale arguments.

-
-

===================================================================================== ===============================================================================================================================================

-

Property Description

-

===================================================================================== ===============================================================================================================================================

-

:meth:`agg_filter <matplotlib.artist.Artist.set_agg_filter>` unknown

-

:meth:`alpha <matplotlib.artist.Artist.set_alpha>` float (0.0 transparent through 1.0 opaque)

-

:meth:`animated <matplotlib.artist.Artist.set_animated>` [True | False]

-

:meth:`antialiased <matplotlib.lines.Line2D.set_antialiased>` or aa [True | False]

-

:meth:`axes <matplotlib.artist.Artist.set_axes>` an :class:`~matplotlib.axes.Axes` instance

-

:meth:`clip_box <matplotlib.artist.Artist.set_clip_box>` a :class:`matplotlib.transforms.Bbox` instance

-

:meth:`clip_on <matplotlib.artist.Artist.set_clip_on>` [True | False]

-

:meth:`clip_path <matplotlib.artist.Artist.set_clip_path>` [ (:class:`~matplotlib.path.Path`, :class:`~matplotlib.transforms.Transform`) | :class:`~matplotlib.patches.Patch` | None ]

-

:meth:`color <matplotlib.lines.Line2D.set_color>` or c any matplotlib color

-

:meth:`contains <matplotlib.artist.Artist.set_contains>` a callable function

-

:meth:`dash_capstyle <matplotlib.lines.Line2D.set_dash_capstyle>` [‘butt’ | ‘round’ | ‘projecting’]

-

:meth:`dash_joinstyle <matplotlib.lines.Line2D.set_dash_joinstyle>` [‘miter’ | ‘round’ | ‘bevel’]

-

:meth:`dashes <matplotlib.lines.Line2D.set_dashes>` sequence of on/off ink in points

-

:meth:`drawstyle <matplotlib.lines.Line2D.set_drawstyle>` [‘default’ | ‘steps’ | ‘steps-pre’ | ‘steps-mid’ | ‘steps-post’]

-

:meth:`figure <matplotlib.artist.Artist.set_figure>` a :class:`matplotlib.figure.Figure` instance

-

:meth:`fillstyle <matplotlib.lines.Line2D.set_fillstyle>` [‘full’ | ‘left’ | ‘right’ | ‘bottom’ | ‘top’ | ‘none’]

-

:meth:`gid <matplotlib.artist.Artist.set_gid>` an id string

-

:meth:`label <matplotlib.artist.Artist.set_label>` string or anything printable with ‘%s’ conversion.

-

:meth:`linestyle <matplotlib.lines.Line2D.set_linestyle>` or ls [‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | ``’-‘`` | ``’–’`` | ``’-.’`` | ``’:’`` | ``’None’`` | ``’ ‘`` | ``’‘``]

-

:meth:`linewidth <matplotlib.lines.Line2D.set_linewidth>` or lw float value in points

-

:meth:`marker <matplotlib.lines.Line2D.set_marker>` :mod:`A valid marker style <matplotlib.markers>`

-

:meth:`markeredgecolor <matplotlib.lines.Line2D.set_markeredgecolor>` or mec any matplotlib color

-

:meth:`markeredgewidth <matplotlib.lines.Line2D.set_markeredgewidth>` or mew float value in points

-

:meth:`markerfacecolor <matplotlib.lines.Line2D.set_markerfacecolor>` or mfc any matplotlib color

-

:meth:`markerfacecoloralt <matplotlib.lines.Line2D.set_markerfacecoloralt>` or mfcalt any matplotlib color

-

:meth:`markersize <matplotlib.lines.Line2D.set_markersize>` or ms float

-

:meth:`markevery <matplotlib.lines.Line2D.set_markevery>` [None | int | length-2 tuple of int | slice | list/array of int | float | length-2 tuple of float]

-

:meth:`path_effects <matplotlib.artist.Artist.set_path_effects>` unknown

-

:meth:`picker <matplotlib.lines.Line2D.set_picker>` float distance in points or callable pick function ``fn(artist, event)``

-

:meth:`pickradius <matplotlib.lines.Line2D.set_pickradius>` float distance in points

-

:meth:`rasterized <matplotlib.artist.Artist.set_rasterized>` [True | False | None]

-

:meth:`sketch_params <matplotlib.artist.Artist.set_sketch_params>` unknown

-

:meth:`snap <matplotlib.artist.Artist.set_snap>` unknown

-

:meth:`solid_capstyle <matplotlib.lines.Line2D.set_solid_capstyle>` [‘butt’ | ‘round’ | ‘projecting’]

-

:meth:`solid_joinstyle <matplotlib.lines.Line2D.set_solid_joinstyle>` [‘miter’ | ‘round’ | ‘bevel’]

-

:meth:`transform <matplotlib.lines.Line2D.set_transform>` a :class:`matplotlib.transforms.Transform` instance

-

:meth:`url <matplotlib.artist.Artist.set_url>` a url string

-

:meth:`visible <matplotlib.artist.Artist.set_visible>` [True | False]

-

:meth:`xdata <matplotlib.lines.Line2D.set_xdata>` 1D array

-

:meth:`ydata <matplotlib.lines.Line2D.set_ydata>` 1D array

-

:meth:`zorder <matplotlib.artist.Artist.set_zorder>` any number

-

===================================================================================== ===============================================================================================================================================

-
-
-

See also

-
-
loglog()
-
For example code and figure.
-
-
-
- -
-
-matplotlib.pyplot.set_cmap(cmap)
-

Set the default colormap. Applies to the current image if any. -See help(colormaps) for more information.

-

cmap must be a Colormap instance, or -the name of a registered colormap.

-

See matplotlib.cm.register_cmap() and -matplotlib.cm.get_cmap().

-
- -
-
-matplotlib.pyplot.setp(*args, **kwargs)
-

Set a property on an artist object.

-

matplotlib supports the use of setp() (“set property”) and -getp() to set and get object properties, as well as to do -introspection on the object. For example, to set the linestyle of a -line to be dashed, you can do:

-
>>> line, = plot([1,2,3])
->>> setp(line, linestyle='--')
-
-
-

If you want to know the valid types of arguments, you can provide the -name of the property you want to set without a value:

-
>>> setp(line, 'linestyle')
-    linestyle: [ '-' | '--' | '-.' | ':' | 'steps' | 'None' ]
-
-
-

If you want to see all the properties that can be set, and their -possible values, you can do:

-
>>> setp(line)
-    ... long output listing omitted
-
-
-

setp() operates on a single instance or a list of instances. -If you are in query mode introspecting the possible values, only -the first instance in the sequence is used. When actually setting -values, all the instances will be set. e.g., suppose you have a -list of two lines, the following will make both lines thicker and -red:

-
>>> x = arange(0,1.0,0.01)
->>> y1 = sin(2*pi*x)
->>> y2 = sin(4*pi*x)
->>> lines = plot(x, y1, x, y2)
->>> setp(lines, linewidth=2, color='r')
-
-
-

setp() works with the MATLAB style string/value pairs or -with python kwargs. For example, the following are equivalent:

-
>>> setp(lines, 'linewidth', 2, 'color', 'r')  # MATLAB style
->>> setp(lines, linewidth=2, color='r')        # python style
-
-
-
- -
-
-matplotlib.pyplot.show(*args, **kw)
-

Display a figure. -When running in ipython with its pylab mode, display all -figures and return to the ipython prompt.

-

In non-interactive mode, display all figures and block until -the figures have been closed; in interactive mode it has no -effect unless figures were created prior to a change from -non-interactive to interactive mode (not recommended). In -that case it displays the figures but does not block.

-

A single experimental keyword argument, block, may be -set to True or False to override the blocking behavior -described above.

-
- -
-
-matplotlib.pyplot.specgram(x, NFFT=None, Fs=None, Fc=None, detrend=None, window=None, noverlap=None, cmap=None, xextent=None, pad_to=None, sides=None, scale_by_freq=None, mode=None, scale=None, vmin=None, vmax=None, hold=None, data=None, **kwargs)
-

Plot a spectrogram.

-

Call signature:

-
specgram(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
-         window=mlab.window_hanning, noverlap=128,
-         cmap=None, xextent=None, pad_to=None, sides='default',
-         scale_by_freq=None, mode='default', scale='default',
-         **kwargs)
-
-
-

Compute and plot a spectrogram of data in x. Data are split into -NFFT length segments and the spectrum of each section is -computed. The windowing function window is applied to each -segment, and the amount of overlap of each segment is -specified with noverlap. The spectrogram is plotted as a colormap -(using imshow).

- --- - - - - - -
Parameters:

x : 1-D array or sequence

-
-

Array or sequence containing the data.

-
-

Fs : scalar

-
-

The sampling frequency (samples per time unit). It is used -to calculate the Fourier frequencies, freqs, in cycles per time -unit. The default value is 2.

-
-

window : callable or ndarray

-
-

A function or a vector of length NFFT. To create window -vectors see window_hanning(), window_none(), -numpy.blackman(), numpy.hamming(), -numpy.bartlett(), scipy.signal(), -scipy.signal.get_window(), etc. The default is -window_hanning(). If a function is passed as the -argument, it must take a data segment as an argument and -return the windowed version of the segment.

-
-

sides : [ ‘default’ | ‘onesided’ | ‘twosided’ ]

-
-

Specifies which sides of the spectrum to return. Default gives the -default behavior, which returns one-sided for real data and both -for complex data. ‘onesided’ forces the return of a one-sided -spectrum, while ‘twosided’ forces two-sided.

-
-

pad_to : integer

-
-

The number of points to which the data segment is padded when -performing the FFT. This can be different from NFFT, which -specifies the number of data points used. While not increasing -the actual resolution of the spectrum (the minimum distance between -resolvable peaks), this can give more points in the plot, -allowing for more detail. This corresponds to the n parameter -in the call to fft(). The default is None, which sets pad_to -equal to NFFT

-
-

NFFT : integer

-
-

The number of data points used in each block for the FFT. -A power 2 is most efficient. The default value is 256. -This should NOT be used to get zero padding, or the scaling of the -result will be incorrect. Use pad_to for this instead.

-
-

detrend : {‘default’, ‘constant’, ‘mean’, ‘linear’, ‘none’} or callable

-
-

The function applied to each segment before fft-ing, -designed to remove the mean or linear trend. Unlike in -MATLAB, where the detrend parameter is a vector, in -matplotlib is it a function. The pylab -module defines detrend_none(), -detrend_mean(), and -detrend_linear(), but you can use -a custom function as well. You can also use a string to choose -one of the functions. ‘default’, ‘constant’, and ‘mean’ call -detrend_mean(). ‘linear’ calls -detrend_linear(). ‘none’ calls -detrend_none().

-
-

scale_by_freq : boolean, optional

-
-

Specifies whether the resulting density values should be scaled -by the scaling frequency, which gives density in units of Hz^-1. -This allows for integration over the returned frequency values. -The default is True for MATLAB compatibility.

-
-

mode : [ ‘default’ | ‘psd’ | ‘magnitude’ | ‘angle’ | ‘phase’ ]

-
-

What sort of spectrum to use. Default is ‘psd’, which takes -the power spectral density. ‘complex’ returns the complex-valued -frequency spectrum. ‘magnitude’ returns the magnitude spectrum. -‘angle’ returns the phase spectrum without unwrapping. ‘phase’ -returns the phase spectrum with unwrapping.

-
-

noverlap : integer

-
-

The number of points of overlap between blocks. The -default value is 128.

-
-

scale : [ ‘default’ | ‘linear’ | ‘dB’ ]

-
-

The scaling of the values in the spec. ‘linear’ is no scaling. -‘dB’ returns the values in dB scale. When mode is ‘psd’, -this is dB power (10 * log10). Otherwise this is dB amplitude -(20 * log10). ‘default’ is ‘dB’ if mode is ‘psd’ or -‘magnitude’ and ‘linear’ otherwise. This must be ‘linear’ -if mode is ‘angle’ or ‘phase’.

-
-

Fc : integer

-
-

The center frequency of x (defaults to 0), which offsets -the x extents of the plot to reflect the frequency range used -when a signal is acquired and then filtered and downsampled to -baseband.

-
-

cmap :

-
-

A matplotlib.colors.Colormap instance; if None, use -default determined by rc

-
-

xextent : [None | (xmin, xmax)]

-
-

The image extent along the x-axis. The default sets xmin to the -left border of the first bin (spectrum column) and xmax to the -right border of the last bin. Note that for noverlap>0 the width -of the bins is smaller than those of the segments.

-
-

**kwargs :

-
-

Additional kwargs are passed on to imshow which makes the -specgram image

-
-
Returns:

spectrum : 2-D array

-
-

Columns are the periodograms of successive segments.

-
-

freqs : 1-D array

-
-

The frequencies corresponding to the rows in spectrum.

-
-

t : 1-D array

-
-

The times corresponding to midpoints of segments (i.e., the columns -in spectrum).

-
-

im : instance of class AxesImage

-
-

The image created by imshow containing the spectrogram

-
-
-
-

See also

-
-
psd()
-
psd() differs in the default overlap; in returning the mean of the segment periodograms; in not returning times; and in generating a line plot instead of colormap.
-
magnitude_spectrum()
-
A single spectrum, similar to having a single segment when mode is ‘magnitude’. Plots a line instead of a colormap.
-
angle_spectrum()
-
A single spectrum, similar to having a single segment when mode is ‘angle’. Plots a line instead of a colormap.
-
phase_spectrum()
-
A single spectrum, similar to having a single segment when mode is ‘phase’. Plots a line instead of a colormap.
-
-
In addition to the above described arguments, this function can take a data keyword argument. If such a data argument is given, the following arguments are replaced by data[<arg>]: * All arguments with the following names: ‘x’.
-
-
-

Notes

-

detrend and scale_by_freq only apply when mode is set to -‘psd’

-

Examples

-

(Source code, png, pdf)

-
-../_images/specgram_demo2.png -
-
- -
-
-matplotlib.pyplot.spectral()
-

set the default colormap to spectral and apply to current image if any. -See help(colormaps) for more information

-
- -
-
-matplotlib.pyplot.spring()
-

set the default colormap to spring and apply to current image if any. -See help(colormaps) for more information

-
- -
-
-matplotlib.pyplot.spy(Z, precision=0, marker=None, markersize=None, aspect='equal', **kwargs)
-

Plot the sparsity pattern on a 2-D array.

-

spy(Z) plots the sparsity pattern of the 2-D array Z.

- --- - - - -
Parameters:

Z : sparse array (n, m)

-
-

The array to be plotted.

-
-

precision : float, optional, default: 0

-
-

If precision is 0, any non-zero value will be plotted; else, -values of will be plotted.

-

For scipy.sparse.spmatrix instances, there is a special -case: if precision is ‘present’, any value present in the array -will be plotted, even if it is identically zero.

-
-

origin : [“upper”, “lower”], optional, default: “upper”

-
-

Place the [0,0] index of the array in the upper left or lower left -corner of the axes.

-
-

aspect : [‘auto’ | ‘equal’ | scalar], optional, default: “equal”

-
-

If ‘equal’, and extent is None, changes the axes aspect ratio to -match that of the image. If extent is not None, the axes -aspect ratio is changed to match that of the extent.

-

If ‘auto’, changes the image aspect ratio to match that of the -axes.

-

If None, default to rc image.aspect value.

-
-

Two plotting styles are available: image or marker. Both

-

are available for full arrays, but only the marker style

-

works for :class:`scipy.sparse.spmatrix` instances.

-

If *marker* and *markersize* are *None*, an image will be

-

returned and any remaining kwargs are passed to

-

:func:`~matplotlib.pyplot.imshow`; else, a

-

:class:`~matplotlib.lines.Line2D` object will be returned with

-

the value of marker determining the marker type, and any

-

remaining kwargs passed to the

-

:meth:`~matplotlib.axes.Axes.plot` method.

-

If *marker* and *markersize* are *None*, useful kwargs include:

-

* *cmap*

-

* *alpha*

-
-
-

See also

-
-
imshow
-
for image options.
-
plot
-
for plotting options
-
-
-
- -
-
-matplotlib.pyplot.stackplot(x, *args, **kwargs)
-

Draws a stacked area plot.

-

x : 1d array of dimension N

-
-
y : 2d array of dimension MxN, OR any number 1d arrays each of dimension
-

1xN. The data is assumed to be unstacked. Each of the following -calls is legal:

-
stackplot(x, y)               # where y is MxN
-stackplot(x, y1, y2, y3, y4)  # where y1, y2, y3, y4, are all 1xNm
-
-
-
-
-

Keyword arguments:

-
-
baseline : [‘zero’, ‘sym’, ‘wiggle’, ‘weighted_wiggle’]
-
Method used to calculate the baseline. ‘zero’ is just a -simple stacked plot. ‘sym’ is symmetric around zero and -is sometimes called ThemeRiver. ‘wiggle’ minimizes the -sum of the squared slopes. ‘weighted_wiggle’ does the -same but weights to account for size of each layer. -It is also called Streamgraph-layout. More details -can be found at http://leebyron.com/streamgraph/.
-
-

labels : A list or tuple of labels to assign to each data series.

-
-
colors : A list or tuple of colors. These will be cycled through and
-
used to colour the stacked areas. -All other keyword arguments are passed to -fill_between()
-
-

Returns r : A list of -PolyCollection, one for each -element in the stacked area plot.

-
- -
-
-matplotlib.pyplot.stem(*args, **kwargs)
-

Create a stem plot.

-

Call signatures:

-
stem(y, linefmt='b-', markerfmt='bo', basefmt='r-')
-stem(x, y, linefmt='b-', markerfmt='bo', basefmt='r-')
-
-
-

A stem plot plots vertical lines (using linefmt) at each x -location from the baseline to y, and places a marker there -using markerfmt. A horizontal line at 0 is is plotted using -basefmt.

-

If no x values are provided, the default is (0, 1, ..., len(y) - 1)

-

Return value is a tuple (markerline, stemlines, -baseline).

-
-

See also

-

This -document -for details.

-
-

Example:

-

(Source code, png, pdf)

-
-../_images/stem_plot2.png -
-
-

Note

-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All positional and all keyword arguments.
  • -
-
-
- -
-
-matplotlib.pyplot.step(x, y, *args, **kwargs)
-

Make a step plot.

- --- - - - - - - - - -
Parameters:

x : array_like

-
-

1-D sequence, and it is assumed, but not checked, -that it is uniformly increasing.

-
-

y : array_like

-
-

1-D sequence, and it is assumed, but not checked, -that it is uniformly increasing.

-
-
Returns:

list

-
-

List of lines that were added.

-
-
Other Parameters:
 

where : [ ‘pre’ | ‘post’ | ‘mid’ ]

-
-

If ‘pre’ (the default), the interval from -x[i] to x[i+1] has level y[i+1].

-

If ‘post’, that interval has level y[i].

-

If ‘mid’, the jumps in y occur half-way between the -x-values.

-
-
-

Notes

-

Additional parameters are the same as those for -plot().

-
-

Note

-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All arguments with the following names: ‘x’, ‘y’.
  • -
-
-
- -
-
-matplotlib.pyplot.streamplot(x, y, u, v, density=1, linewidth=None, color=None, cmap=None, norm=None, arrowsize=1, arrowstyle='-|>', minlength=0.1, transform=None, zorder=None, start_points=None, hold=None, data=None)
-

Draws streamlines of a vector flow.

-
-
x, y : 1d arrays
-
an evenly spaced grid.
-
u, v : 2d arrays
-
x and y-velocities. Number of rows should match length of y, and -the number of columns should match x.
-
density : float or 2-tuple
-
Controls the closeness of streamlines. When density = 1, the domain -is divided into a 30x30 grid—density linearly scales this grid. -Each cell in the grid can have, at most, one traversing streamline. -For different densities in each direction, use [density_x, density_y].
-
linewidth : numeric or 2d array
-
vary linewidth when given a 2d array with the same shape as velocities.
-
color : matplotlib color code, or 2d array
-
Streamline color. When given an array with the same shape as -velocities, color values are converted to colors using cmap.
-
cmap : Colormap
-
Colormap used to plot streamlines and arrows. Only necessary when using -an array input for color.
-
norm : Normalize
-
Normalize object used to scale luminance data to 0, 1. If None, stretch -(min, max) to (0, 1). Only necessary when color is an array.
-
arrowsize : float
-
Factor scale arrow size.
-
arrowstyle : str
-
Arrow style specification. -See FancyArrowPatch.
-
minlength : float
-
Minimum length of streamline in axes coordinates.
-
start_points: Nx2 array
-
Coordinates of starting points for the streamlines. -In data coordinates, the same as the x and y arrays.
-
zorder : int
-
any number
-
-

Returns:

-
-
-
stream_container : StreamplotSet
-

Container object with attributes

-
-
-
-

This container will probably change in the future to allow changes -to the colormap, alpha, etc. for both lines and arrows, but these -changes should be backward compatible.

-
-
-
-
- -
-
-matplotlib.pyplot.subplot(*args, **kwargs)
-

Return a subplot axes positioned by the given grid definition.

-

Typical call signature:

-
subplot(nrows, ncols, plot_number)
-
-
-

Where nrows and ncols are used to notionally split the figure -into nrows * ncols sub-axes, and plot_number is used to identify -the particular subplot that this function is to create within the notional -grid. plot_number starts at 1, increments across rows first and has a -maximum of nrows * ncols.

-

In the case when nrows, ncols and plot_number are all less than 10, -a convenience exists, such that the a 3 digit number can be given instead, -where the hundreds represent nrows, the tens represent ncols and the -units represent plot_number. For instance:

-
subplot(211)
-
-
-

produces a subaxes in a figure which represents the top plot (i.e. the -first) in a 2 row by 1 column notional grid (no grid actually exists, -but conceptually this is how the returned subplot has been positioned).

-
-

Note

-

Creating a subplot will delete any pre-existing subplot that overlaps -with it beyond sharing a boundary:

-
import matplotlib.pyplot as plt
-# plot a line, implicitly creating a subplot(111)
-plt.plot([1,2,3])
-# now create a subplot which represents the top plot of a grid
-# with 2 rows and 1 column. Since this subplot will overlap the
-# first, the plot (and its axes) previously created, will be removed
-plt.subplot(211)
-plt.plot(range(12))
-plt.subplot(212, facecolor='y') # creates 2nd subplot with yellow background
-
-
-

If you do not want this behavior, use the -add_subplot() method or the -axes() function instead.

-
-

Keyword arguments:

-
-
-
facecolor:
-
The background color of the subplot, which can be any valid -color specifier. See matplotlib.colors for more -information.
-
polar:
-
A boolean flag indicating whether the subplot plot should be -a polar projection. Defaults to False.
-
projection:
-
A string giving the name of a custom projection to be used -for the subplot. This projection must have been previously -registered. See matplotlib.projections.
-
-
-
-

See also

-
-
axes()
-
For additional information on axes() and -subplot() keyword arguments.
-
examples/pie_and_polar_charts/polar_scatter_demo.py
-
For an example
-
-
-

Example:

-

(Source code, png, pdf)

-
-../_images/subplot_demo3.png -
-
- -
-
-matplotlib.pyplot.subplot2grid(shape, loc, rowspan=1, colspan=1, **kwargs)
-

Create a subplot in a grid. The grid is specified by shape, at -location of loc, spanning rowspan, colspan cells in each -direction. The index for loc is 0-based.

-
subplot2grid(shape, loc, rowspan=1, colspan=1)
-
-
-

is identical to

-
gridspec=GridSpec(shape[0], shape[1])
-subplotspec=gridspec.new_subplotspec(loc, rowspan, colspan)
-subplot(subplotspec)
-
-
-
- -
-
-matplotlib.pyplot.subplot_tool(targetfig=None)
-

Launch a subplot tool window for a figure.

-

A matplotlib.widgets.SubplotTool instance is returned.

-
- -
-
-matplotlib.pyplot.subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True, subplot_kw=None, gridspec_kw=None, **fig_kw)
-

Create a figure and a set of subplots

-

This utility wrapper makes it convenient to create common layouts of -subplots, including the enclosing figure object, in a single call.

- --- - - - - - -
Parameters:

nrows, ncols : int, optional, default: 1

-
-

Number of rows/columns of the subplot grid.

-
-

sharex, sharey : bool or {‘none’, ‘all’, ‘row’, ‘col’}, default: False

-
-

Controls sharing of properties among x (sharex) or y (sharey) -axes:

-
-
    -
  • True or ‘all’: x- or y-axis will be shared among all -subplots.
  • -
  • False or ‘none’: each subplot x- or y-axis will be -independent.
  • -
  • ‘row’: each subplot row will share an x- or y-axis.
  • -
  • ‘col’: each subplot column will share an x- or y-axis.
  • -
-
-

When subplots have a shared x-axis along a column, only the x tick -labels of the bottom subplot are visible. Similarly, when subplots -have a shared y-axis along a row, only the y tick labels of the first -column subplot are visible.

-
-

squeeze : bool, optional, default: True

-
-
    -
  • If True, extra dimensions are squeezed out from the returned Axes -object:

    -
    -
      -
    • if only one subplot is constructed (nrows=ncols=1), the -resulting single Axes object is returned as a scalar.
    • -
    • for Nx1 or 1xN subplots, the returned object is a 1D numpy -object array of Axes objects are returned as numpy 1D arrays.
    • -
    • for NxM, subplots with N>1 and M>1 are returned as a 2D arrays.
    • -
    -
    -
  • -
  • If False, no squeezing at all is done: the returned Axes object is -always a 2D array containing Axes instances, even if it ends up -being 1x1.

    -
  • -
-
-

subplot_kw : dict, optional

-
-

Dict with keywords passed to the -add_subplot() call used to create each -subplot.

-
-

gridspec_kw : dict, optional

-
-

Dict with keywords passed to the -GridSpec constructor used to create the -grid the subplots are placed on.

-
-

**fig_kw :

-
-

All additional keyword arguments are passed to the figure() call.

-
-
Returns:

fig : matplotlib.figure.Figure object

-

ax : Axes object or array of Axes objects.

-
-

ax can be either a single matplotlib.axes.Axes object or an -array of Axes objects if more than one subplot was created. The -dimensions of the resulting array can be controlled with the squeeze -keyword, see above.

-
-
-
-

See also

-

figure, subplot

-
-

Examples

-

First create some toy data:

-
>>> x = np.linspace(0, 2*np.pi, 400)
->>> y = np.sin(x**2)
-
-
-

Creates just a figure and only one subplot

-
>>> fig, ax = plt.subplots()
->>> ax.plot(x, y)
->>> ax.set_title('Simple plot')
-
-
-

Creates two subplots and unpacks the output array immediately

-
>>> f, (ax1, ax2) = plt.subplots(1, 2, sharey=True)
->>> ax1.plot(x, y)
->>> ax1.set_title('Sharing Y axis')
->>> ax2.scatter(x, y)
-
-
-

Creates four polar axes, and accesses them through the returned array

-
>>> fig, axes = plt.subplots(2, 2, subplot_kw=dict(polar=True))
->>> axes[0, 0].plot(x, y)
->>> axes[1, 1].scatter(x, y)
-
-
-

Share a X axis with each column of subplots

-
>>> plt.subplots(2, 2, sharex='col')
-
-
-

Share a Y axis with each row of subplots

-
>>> plt.subplots(2, 2, sharey='row')
-
-
-

Share both X and Y axes with all subplots

-
>>> plt.subplots(2, 2, sharex='all', sharey='all')
-
-
-

Note that this is the same as

-
>>> plt.subplots(2, 2, sharex=True, sharey=True)
-
-
-
- -
-
-matplotlib.pyplot.subplots_adjust(*args, **kwargs)
-

Tune the subplot layout.

-

call signature:

-
subplots_adjust(left=None, bottom=None, right=None, top=None,
-                wspace=None, hspace=None)
-
-
-

The parameter meanings (and suggested defaults) are:

-
left  = 0.125  # the left side of the subplots of the figure
-right = 0.9    # the right side of the subplots of the figure
-bottom = 0.1   # the bottom of the subplots of the figure
-top = 0.9      # the top of the subplots of the figure
-wspace = 0.2   # the amount of width reserved for blank space between subplots,
-               # expressed as a fraction of the average axis width
-hspace = 0.2   # the amount of height reserved for white space between subplots,
-               # expressed as a fraction of the average axis height
-
-
-

The actual defaults are controlled by the rc file

-
- -
-
-matplotlib.pyplot.summer()
-

set the default colormap to summer and apply to current image if any. -See help(colormaps) for more information

-
- -
-
-matplotlib.pyplot.suptitle(*args, **kwargs)
-

Add a centered title to the figure.

-

kwargs are matplotlib.text.Text properties. Using figure -coordinates, the defaults are:

-
-
-
x : 0.5
-
The x location of the text in figure coords
-
y : 0.98
-
The y location of the text in figure coords
-
horizontalalignment : ‘center’
-
The horizontal alignment of the text
-
verticalalignment : ‘top’
-
The vertical alignment of the text
-
-
-

If the fontproperties keyword argument is given then the -rcParams defaults for fontsize (figure.titlesize) and -fontweight (figure.titleweight) will be ignored in favour -of the FontProperties defaults.

-

A matplotlib.text.Text instance is returned.

-

Example:

-
fig.suptitle('this is the figure title', fontsize=12)
-
-
-
- -
-
-matplotlib.pyplot.switch_backend(newbackend)
-

Switch the default backend. This feature is experimental, and -is only expected to work switching to an image backend. e.g., if -you have a bunch of PostScript scripts that you want to run from -an interactive ipython session, you may want to switch to the PS -backend before running them to avoid having a bunch of GUI windows -popup. If you try to interactively switch from one GUI backend to -another, you will explode.

-

Calling this command will close all open windows.

-
- -
-
-matplotlib.pyplot.table(**kwargs)
-

Add a table to the current axes.

-

Call signature:

-
table(cellText=None, cellColours=None,
-      cellLoc='right', colWidths=None,
-      rowLabels=None, rowColours=None, rowLoc='left',
-      colLabels=None, colColours=None, colLoc='center',
-      loc='bottom', bbox=None):
-
-
-

Returns a matplotlib.table.Table instance. Either cellText -or cellColours must be provided. For finer grained control over -tables, use the Table class and add it to -the axes with add_table().

-

Thanks to John Gill for providing the class and table.

-

kwargs control the Table -properties:

-
-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
agg_filterunknown
alphafloat (0.0 transparent through 1.0 opaque)
animated[True | False]
axesan Axes instance
clip_boxa matplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path, Transform) | Patch | None ]
containsa callable function
figurea matplotlib.figure.Figure instance
fontsizea float in points
gidan id string
labelstring or anything printable with ‘%s’ conversion.
path_effectsunknown
picker[None|float|boolean|callable]
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
visible[True | False]
zorderany number
-
-
- -
-
-matplotlib.pyplot.text(x, y, s, fontdict=None, withdash=False, **kwargs)
-

Add text to the axes.

-

Add text in string s to axis at location x, y, data -coordinates.

- --- - - - - - - -
Parameters:

x, y : scalars

-
-

data coordinates

-
-

s : string

-
-

text

-
-

fontdict : dictionary, optional, default: None

-
-

A dictionary to override the default text properties. If fontdict -is None, the defaults are determined by your rc parameters.

-
-

withdash : boolean, optional, default: False

-
-

Creates a TextWithDash instance instead of a -Text instance.

-
-
Other Parameters:
 

kwargs : Text properties.

-
-

Other miscellaneous text parameters.

-
-
-

Examples

-

Individual keyword arguments can be used to override any given -parameter:

-
>>> text(x, y, s, fontsize=12)
-
-
-

The default transform specifies that text is in data coords, -alternatively, you can specify text in axis coords (0,0 is -lower-left and 1,1 is upper-right). The example below places -text in the center of the axes:

-
>>> text(0.5, 0.5,'matplotlib', horizontalalignment='center',
-...      verticalalignment='center',
-...      transform=ax.transAxes)
-
-
-

You can put a rectangular box around the text instance (e.g., to -set a background color) by using the keyword bbox. bbox is -a dictionary of Rectangle -properties. For example:

-
>>> text(x, y, s, bbox=dict(facecolor='red', alpha=0.5))
-
-
-
- -
-
-matplotlib.pyplot.thetagrids(*args, **kwargs)
-

Get or set the theta locations of the gridlines in a polar plot.

-

If no arguments are passed, return a tuple (lines, labels) -where lines is an array of radial gridlines -(Line2D instances) and labels is an -array of tick labels (Text instances):

-
lines, labels = thetagrids()
-
-
-

Otherwise the syntax is:

-
lines, labels = thetagrids(angles, labels=None, fmt='%d', frac = 1.1)
-
-
-

set the angles at which to place the theta grids (these gridlines -are equal along the theta dimension).

-

angles is in degrees.

-

labels, if not None, is a len(angles) list of strings of the -labels to use at each angle.

-

If labels is None, the labels will be fmt%angle.

-

frac is the fraction of the polar axes radius at which to place -the label (1 is the edge). e.g., 1.05 is outside the axes and 0.95 -is inside the axes.

-

Return value is a list of tuples (lines, labels):

-
-
    -
  • lines are Line2D instances
  • -
  • labels are Text instances.
  • -
-
-

Note that on input, the labels argument is a list of strings, -and on output it is a list of Text -instances.

-

Examples:

-
# set the locations of the radial gridlines and labels
-lines, labels = thetagrids( range(45,360,90) )
-
-# set the locations and labels of the radial gridlines and labels
-lines, labels = thetagrids( range(45,360,90), ('NE', 'NW', 'SW','SE') )
-
-
-
- -
-
-matplotlib.pyplot.tick_params(axis='both', **kwargs)
-

Change the appearance of ticks and tick labels.

- --- - - - - - - -
Parameters:

axis : {‘x’, ‘y’, ‘both’}, optional

-
-

Which axis to apply the parameters to.

-
-
Other Parameters:
 

axis : {‘x’, ‘y’, ‘both’}

-
-

Axis on which to operate; default is ‘both’.

-
-

reset : bool

-
-

If True, set all parameters to defaults -before processing other keyword arguments. Default is -False.

-
-

which : {‘major’, ‘minor’, ‘both’}

-
-

Default is ‘major’; apply arguments to which ticks.

-
-

direction : {‘in’, ‘out’, ‘inout’}

-
-

Puts ticks inside the axes, outside the axes, or both.

-
-

length : float

-
-

Tick length in points.

-
-

width : float

-
-

Tick width in points.

-
-

color : color

-
-

Tick color; accepts any mpl color spec.

-
-

pad : float

-
-

Distance in points between tick and label.

-
-

labelsize : float or str

-
-

Tick label font size in points or as a string (e.g., ‘large’).

-
-

labelcolor : color

-
-

Tick label color; mpl color spec.

-
-

colors : color

-
-

Changes the tick color and the label color to the same value: -mpl color spec.

-
-

zorder : float

-
-

Tick and label zorder.

-
-

bottom, top, left, right : bool or {‘on’, ‘off’}

-
-

controls whether to draw the respective ticks.

-
-

labelbottom, labeltop, labelleft, labelright : bool or {‘on’, ‘off’}

-
-

controls whether to draw the -respective tick labels.

-
-
-

Examples

-

Usage

-
ax.tick_params(direction='out', length=6, width=2, colors='r')
-
-
-

This will make all major ticks be red, pointing out of the box, -and with dimensions 6 points by 2 points. Tick labels will -also be red.

-
- -
-
-matplotlib.pyplot.ticklabel_format(**kwargs)
-

Change the ScalarFormatter used by -default for linear axes.

-

Optional keyword arguments:

-
-
---- - - - - - - - - - - - - - - - - - - - - - - -
KeywordDescription
style[ ‘sci’ (or ‘scientific’) | ‘plain’ ] -plain turns off scientific notation
scilimits(m, n), pair of integers; if style -is ‘sci’, scientific notation will -be used for numbers outside the range -10`m`:sup: to 10`n`:sup:. -Use (0,0) to include all numbers.
useOffset[True | False | offset]; if True, -the offset will be calculated as needed; -if False, no offset will be used; if a -numeric offset is specified, it will be -used.
axis[ ‘x’ | ‘y’ | ‘both’ ]
useLocaleIf True, format the number according to -the current locale. This affects things -such as the character used for the -decimal separator. If False, use -C-style (English) formatting. The -default setting is controlled by the -axes.formatter.use_locale rcparam.
-
-

Only the major ticks are affected. -If the method is called when the -ScalarFormatter is not the -Formatter being used, an -AttributeError will be raised.

-
- -
-
-matplotlib.pyplot.tight_layout(pad=1.08, h_pad=None, w_pad=None, rect=None)
-

Automatically adjust subplot parameters to give specified padding.

-

Parameters:

-
-
pad : float
-
padding between the figure edge and the edges of subplots, as a fraction of the font-size.
-
h_pad, w_pad : float
-
padding (height/width) between edges of adjacent subplots. -Defaults to pad_inches.
-
rect : if rect is given, it is interpreted as a rectangle
-
(left, bottom, right, top) in the normalized figure -coordinate that the whole subplots area (including -labels) will fit into. Default is (0, 0, 1, 1).
-
-
- -
-
-matplotlib.pyplot.title(s, *args, **kwargs)
-

Set a title of the current axes.

-

Set one of the three available axes titles. The available titles are -positioned above the axes in the center, flush with the left edge, -and flush with the right edge.

-
-

See also

-

See text() for adding text -to the current axes

-
- --- - - - - - - - - -
Parameters:

label : str

-
-

Text to use for the title

-
-

fontdict : dict

-
-

A dictionary controlling the appearance of the title text, -the default fontdict is:

-
-

{‘fontsize’: rcParams[‘axes.titlesize’], -‘fontweight’ : rcParams[‘axes.titleweight’], -‘verticalalignment’: ‘baseline’, -‘horizontalalignment’: loc}

-
-
-

loc : {‘center’, ‘left’, ‘right’}, str, optional

-
-

Which title to set, defaults to ‘center’

-
-
Returns:

text : Text

-
-

The matplotlib text instance representing the title

-
-
Other Parameters:
 

kwargs : text properties

-
-

Other keyword arguments are text properties, see -Text for a list of valid text -properties.

-
-
-
- -
-
-matplotlib.pyplot.tricontour(*args, **kwargs)
-

Draw contours on an unstructured triangular grid. -tricontour() and -tricontourf() draw contour lines and -filled contours, respectively. Except as noted, function -signatures and return values are the same for both versions.

-

The triangulation can be specified in one of two ways; either:

-
tricontour(triangulation, ...)
-
-
-

where triangulation is a matplotlib.tri.Triangulation -object, or

-
tricontour(x, y, ...)
-tricontour(x, y, triangles, ...)
-tricontour(x, y, triangles=triangles, ...)
-tricontour(x, y, mask=mask, ...)
-tricontour(x, y, triangles, mask=mask, ...)
-
-
-

in which case a Triangulation object will be created. See -Triangulation for a explanation of -these possibilities.

-

The remaining arguments may be:

-
tricontour(..., Z)
-
-
-

where Z is the array of values to contour, one per point -in the triangulation. The level values are chosen -automatically.

-
tricontour(..., Z, N)
-
-
-

contour N automatically-chosen levels.

-
tricontour(..., Z, V)
-
-
-

draw contour lines at the values specified in sequence V, -which must be in increasing order.

-
tricontourf(..., Z, V)
-
-
-

fill the (len(V)-1) regions between the values in V, -which must be in increasing order.

-
tricontour(Z, **kwargs)
-
-
-

Use keyword args to control colors, linewidth, origin, cmap ... see -below for more details.

-

C = tricontour(...) returns a -TriContourSet object.

-

Optional keyword arguments:

-
-
-
colors: [ None | string | (mpl_colors) ]
-

If None, the colormap specified by cmap will be used.

-

If a string, like ‘r’ or ‘red’, all levels will be plotted in this -color.

-

If a tuple of matplotlib color args (string, float, rgb, etc), -different levels will be plotted in different colors in the order -specified.

-
-
alpha: float
-
The alpha blending value
-
cmap: [ None | Colormap ]
-
A cm Colormap instance or -None. If cmap is None and colors is None, a -default Colormap is used.
-
norm: [ None | Normalize ]
-
A matplotlib.colors.Normalize instance for -scaling data values to colors. If norm is None and -colors is None, the default linear scaling is used.
-
levels [level0, level1, ..., leveln]
-
A list of floating point numbers indicating the level -curves to draw, in increasing order; e.g., to draw just -the zero contour pass levels=[0]
-
origin: [ None | ‘upper’ | ‘lower’ | ‘image’ ]
-

If None, the first value of Z will correspond to the -lower left corner, location (0,0). If ‘image’, the rc -value for image.origin will be used.

-

This keyword is not active if X and Y are specified in -the call to contour.

-
-
-

extent: [ None | (x0,x1,y0,y1) ]

-
-

If origin is not None, then extent is interpreted as -in matplotlib.pyplot.imshow(): it gives the outer -pixel boundaries. In this case, the position of Z[0,0] -is the center of the pixel, not a corner. If origin is -None, then (x0, y0) is the position of Z[0,0], and -(x1, y1) is the position of Z[-1,-1].

-

This keyword is not active if X and Y are specified in -the call to contour.

-
-
-
locator: [ None | ticker.Locator subclass ]
-
If locator is None, the default -MaxNLocator is used. The -locator is used to determine the contour levels if they -are not given explicitly via the V argument.
-
extend: [ ‘neither’ | ‘both’ | ‘min’ | ‘max’ ]
-
Unless this is ‘neither’, contour levels are automatically -added to one or both ends of the range so that all data -are included. These added ranges are then mapped to the -special colormap values which default to the ends of the -colormap range, but can be set via -matplotlib.colors.Colormap.set_under() and -matplotlib.colors.Colormap.set_over() methods.
-
xunits, yunits: [ None | registered units ]
-
Override axis units by specifying an instance of a -matplotlib.units.ConversionInterface.
-
-
-

tricontour-only keyword arguments:

-
-
-
linewidths: [ None | number | tuple of numbers ]
-

If linewidths is None, the default width in -lines.linewidth in matplotlibrc is used.

-

If a number, all levels will be plotted with this linewidth.

-

If a tuple, different levels will be plotted with different -linewidths in the order specified

-
-
linestyles: [ None | ‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’ ]
-

If linestyles is None, the ‘solid’ is used.

-

linestyles can also be an iterable of the above strings -specifying a set of linestyles to be used. If this -iterable is shorter than the number of contour levels -it will be repeated as necessary.

-

If contour is using a monochrome colormap and the contour -level is less than 0, then the linestyle specified -in contour.negative_linestyle in matplotlibrc -will be used.

-
-
-
-

tricontourf-only keyword arguments:

-
-
-
antialiased: [ True | False ]
-
enable antialiasing
-
-
-

Note: tricontourf fills intervals that are closed at the top; that -is, for boundaries z1 and z2, the filled region is:

-
z1 < z <= z2
-
-
-

There is one exception: if the lowest boundary coincides with -the minimum value of the z array, then that minimum value -will be included in the lowest interval.

-

Examples:

-

(Source code)

-
-../_images/tricontour_demo_002.png -

(png, pdf)

-
-
-../_images/tricontour_demo_012.png -

(png, pdf)

-
-
- -
-
-matplotlib.pyplot.tricontourf(*args, **kwargs)
-

Draw contours on an unstructured triangular grid. -tricontour() and -tricontourf() draw contour lines and -filled contours, respectively. Except as noted, function -signatures and return values are the same for both versions.

-

The triangulation can be specified in one of two ways; either:

-
tricontour(triangulation, ...)
-
-
-

where triangulation is a matplotlib.tri.Triangulation -object, or

-
tricontour(x, y, ...)
-tricontour(x, y, triangles, ...)
-tricontour(x, y, triangles=triangles, ...)
-tricontour(x, y, mask=mask, ...)
-tricontour(x, y, triangles, mask=mask, ...)
-
-
-

in which case a Triangulation object will be created. See -Triangulation for a explanation of -these possibilities.

-

The remaining arguments may be:

-
tricontour(..., Z)
-
-
-

where Z is the array of values to contour, one per point -in the triangulation. The level values are chosen -automatically.

-
tricontour(..., Z, N)
-
-
-

contour N automatically-chosen levels.

-
tricontour(..., Z, V)
-
-
-

draw contour lines at the values specified in sequence V, -which must be in increasing order.

-
tricontourf(..., Z, V)
-
-
-

fill the (len(V)-1) regions between the values in V, -which must be in increasing order.

-
tricontour(Z, **kwargs)
-
-
-

Use keyword args to control colors, linewidth, origin, cmap ... see -below for more details.

-

C = tricontour(...) returns a -TriContourSet object.

-

Optional keyword arguments:

-
-
-
colors: [ None | string | (mpl_colors) ]
-

If None, the colormap specified by cmap will be used.

-

If a string, like ‘r’ or ‘red’, all levels will be plotted in this -color.

-

If a tuple of matplotlib color args (string, float, rgb, etc), -different levels will be plotted in different colors in the order -specified.

-
-
alpha: float
-
The alpha blending value
-
cmap: [ None | Colormap ]
-
A cm Colormap instance or -None. If cmap is None and colors is None, a -default Colormap is used.
-
norm: [ None | Normalize ]
-
A matplotlib.colors.Normalize instance for -scaling data values to colors. If norm is None and -colors is None, the default linear scaling is used.
-
levels [level0, level1, ..., leveln]
-
A list of floating point numbers indicating the level -curves to draw, in increasing order; e.g., to draw just -the zero contour pass levels=[0]
-
origin: [ None | ‘upper’ | ‘lower’ | ‘image’ ]
-

If None, the first value of Z will correspond to the -lower left corner, location (0,0). If ‘image’, the rc -value for image.origin will be used.

-

This keyword is not active if X and Y are specified in -the call to contour.

-
-
-

extent: [ None | (x0,x1,y0,y1) ]

-
-

If origin is not None, then extent is interpreted as -in matplotlib.pyplot.imshow(): it gives the outer -pixel boundaries. In this case, the position of Z[0,0] -is the center of the pixel, not a corner. If origin is -None, then (x0, y0) is the position of Z[0,0], and -(x1, y1) is the position of Z[-1,-1].

-

This keyword is not active if X and Y are specified in -the call to contour.

-
-
-
locator: [ None | ticker.Locator subclass ]
-
If locator is None, the default -MaxNLocator is used. The -locator is used to determine the contour levels if they -are not given explicitly via the V argument.
-
extend: [ ‘neither’ | ‘both’ | ‘min’ | ‘max’ ]
-
Unless this is ‘neither’, contour levels are automatically -added to one or both ends of the range so that all data -are included. These added ranges are then mapped to the -special colormap values which default to the ends of the -colormap range, but can be set via -matplotlib.colors.Colormap.set_under() and -matplotlib.colors.Colormap.set_over() methods.
-
xunits, yunits: [ None | registered units ]
-
Override axis units by specifying an instance of a -matplotlib.units.ConversionInterface.
-
-
-

tricontour-only keyword arguments:

-
-
-
linewidths: [ None | number | tuple of numbers ]
-

If linewidths is None, the default width in -lines.linewidth in matplotlibrc is used.

-

If a number, all levels will be plotted with this linewidth.

-

If a tuple, different levels will be plotted with different -linewidths in the order specified

-
-
linestyles: [ None | ‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’ ]
-

If linestyles is None, the ‘solid’ is used.

-

linestyles can also be an iterable of the above strings -specifying a set of linestyles to be used. If this -iterable is shorter than the number of contour levels -it will be repeated as necessary.

-

If contour is using a monochrome colormap and the contour -level is less than 0, then the linestyle specified -in contour.negative_linestyle in matplotlibrc -will be used.

-
-
-
-

tricontourf-only keyword arguments:

-
-
-
antialiased: [ True | False ]
-
enable antialiasing
-
-
-

Note: tricontourf fills intervals that are closed at the top; that -is, for boundaries z1 and z2, the filled region is:

-
z1 < z <= z2
-
-
-

There is one exception: if the lowest boundary coincides with -the minimum value of the z array, then that minimum value -will be included in the lowest interval.

-

Examples:

-

(Source code)

-
-../_images/tricontour_demo_002.png -

(png, pdf)

-
-
-../_images/tricontour_demo_012.png -

(png, pdf)

-
-
- -
-
-matplotlib.pyplot.tripcolor(*args, **kwargs)
-

Create a pseudocolor plot of an unstructured triangular grid.

-

The triangulation can be specified in one of two ways; either:

-
tripcolor(triangulation, ...)
-
-
-

where triangulation is a matplotlib.tri.Triangulation -object, or

-
tripcolor(x, y, ...)
-tripcolor(x, y, triangles, ...)
-tripcolor(x, y, triangles=triangles, ...)
-tripcolor(x, y, mask=mask, ...)
-tripcolor(x, y, triangles, mask=mask, ...)
-
-
-

in which case a Triangulation object will be created. See -Triangulation for a explanation of these -possibilities.

-

The next argument must be C, the array of color values, either -one per point in the triangulation if color values are defined at -points, or one per triangle in the triangulation if color values -are defined at triangles. If there are the same number of points -and triangles in the triangulation it is assumed that color -values are defined at points; to force the use of color values at -triangles use the kwarg facecolors*=C instead of just *C.

-

shading may be ‘flat’ (the default) or ‘gouraud’. If shading -is ‘flat’ and C values are defined at points, the color values -used for each triangle are from the mean C of the triangle’s -three points. If shading is ‘gouraud’ then color values must be -defined at points.

-

The remaining kwargs are the same as for -pcolor().

-

Example:

-
-

(Source code)

-
-../_images/tripcolor_demo_002.png -

(png, pdf)

-
-
-../_images/tripcolor_demo_012.png -

(png, pdf)

-
-
-../_images/tripcolor_demo_022.png -

(png, pdf)

-
-
-
- -
-
-matplotlib.pyplot.triplot(*args, **kwargs)
-

Draw a unstructured triangular grid as lines and/or markers.

-

The triangulation to plot can be specified in one of two ways; -either:

-
triplot(triangulation, ...)
-
-
-

where triangulation is a matplotlib.tri.Triangulation -object, or

-
triplot(x, y, ...)
-triplot(x, y, triangles, ...)
-triplot(x, y, triangles=triangles, ...)
-triplot(x, y, mask=mask, ...)
-triplot(x, y, triangles, mask=mask, ...)
-
-
-

in which case a Triangulation object will be created. See -Triangulation for a explanation of these -possibilities.

-

The remaining args and kwargs are the same as for -plot().

-

Return a list of 2 Line2D containing -respectively:

-
-
    -
  • the lines plotted for triangles edges
  • -
  • the markers plotted for triangles nodes
  • -
-
-

Example:

-
-

(Source code)

-
-../_images/triplot_demo_002.png -

(png, pdf)

-
-
-../_images/triplot_demo_012.png -

(png, pdf)

-
-
-
- -
-
-matplotlib.pyplot.twinx(ax=None)
-

Make a second axes that shares the x-axis. The new axes will -overlay ax (or the current axes if ax is None). The ticks -for ax2 will be placed on the right, and the ax2 instance is -returned.

-
-

See also

-
-
examples/api_examples/two_scales.py
-
For an example
-
-
-
- -
-
-matplotlib.pyplot.twiny(ax=None)
-

Make a second axes that shares the y-axis. The new axis will -overlay ax (or the current axes if ax is None). The ticks -for ax2 will be placed on the top, and the ax2 instance is -returned.

-
- -
-
-matplotlib.pyplot.uninstall_repl_displayhook()
-

Uninstalls the matplotlib display hook.

-
- -
-
-matplotlib.pyplot.violinplot(dataset, positions=None, vert=True, widths=0.5, showmeans=False, showextrema=True, showmedians=False, points=100, bw_method=None, hold=None, data=None)
-

Make a violin plot.

-

Make a violin plot for each column of dataset or each vector in -sequence dataset. Each filled area extends to represent the -entire data range, with optional lines at the mean, the median, -the minimum, and the maximum.

- --- - - - - - -
Parameters:

dataset : Array or a sequence of vectors.

-
-

The input data.

-
-

positions : array-like, default = [1, 2, ..., n]

-
-

Sets the positions of the violins. The ticks and limits are -automatically set to match the positions.

-
-

vert : bool, default = True.

-
-

If true, creates a vertical violin plot. -Otherwise, creates a horizontal violin plot.

-
-

widths : array-like, default = 0.5

-
-

Either a scalar or a vector that sets the maximal width of -each violin. The default is 0.5, which uses about half of the -available horizontal space.

-
-

showmeans : bool, default = False

-
-

If True, will toggle rendering of the means.

-
-

showextrema : bool, default = True

-
-

If True, will toggle rendering of the extrema.

-
-

showmedians : bool, default = False

-
-

If True, will toggle rendering of the medians.

-
-

points : scalar, default = 100

-
-

Defines the number of points to evaluate each of the -gaussian kernel density estimations at.

-
-

bw_method : str, scalar or callable, optional

-
-

The method used to calculate the estimator bandwidth. This can be -‘scott’, ‘silverman’, a scalar constant or a callable. If a -scalar, this will be used directly as kde.factor. If a -callable, it should take a GaussianKDE instance as its only -parameter and return a scalar. If None (default), ‘scott’ is used.

-
-
Returns:

result : dict

-
-

A dictionary mapping each component of the violinplot to a -list of the corresponding collection instances created. The -dictionary has the following keys:

-
-
-
-
-
-

Note

-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All arguments with the following names: ‘dataset’.
  • -
-
-
-
- -
-
-matplotlib.pyplot.viridis()
-

set the default colormap to viridis and apply to current image if any. -See help(colormaps) for more information

-
- -
-
-matplotlib.pyplot.vlines(x, ymin, ymax, colors='k', linestyles='solid', label='', hold=None, data=None, **kwargs)
-

Plot vertical lines.

-

Plot vertical lines at each x from ymin to ymax.

- --- - - - - - - - - -
Parameters:

x : scalar or 1D array_like

-
-

x-indexes where to plot the lines.

-
-

ymin, ymax : scalar or 1D array_like

-
-

Respective beginning and end of each line. If scalars are -provided, all lines will have same length.

-
-

colors : array_like of colors, optional, default: ‘k’

-

linestyles : [‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’], optional

-

label : string, optional, default: ‘’

-
Returns:

lines : LineCollection

-
Other Parameters:
 

kwargs : LineCollection properties.

-
-
-

See also

-
-
hlines
-
horizontal lines
-
-
-

Examples

-

(Source code, png, pdf)

-
-../_images/vline_hline_demo2.png -
-
-

Note

-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All arguments with the following names: ‘colors’, ‘x’, ‘ymax’, ‘ymin’.
  • -
-
-
- -
-
-matplotlib.pyplot.waitforbuttonpress(*args, **kwargs)
-

Blocking call to interact with the figure.

-

This will return True is a key was pressed, False if a mouse -button was pressed and None if timeout was reached without -either being pressed.

-

If timeout is negative, does not timeout.

-
- -
-
-matplotlib.pyplot.winter()
-

set the default colormap to winter and apply to current image if any. -See help(colormaps) for more information

-
- -
-
-matplotlib.pyplot.xcorr(x, y, normed=True, detrend=<function detrend_none>, usevlines=True, maxlags=10, hold=None, data=None, **kwargs)
-

Plot the cross correlation between x and y.

-

The correlation with lag k is defined as sum_n x[n+k] * conj(y[n]).

- --- - - - - - - - - -
Parameters:

x : sequence of scalars of length n

-

y : sequence of scalars of length n

-

hold : boolean, optional, deprecated, default: True

-

detrend : callable, optional, default: mlab.detrend_none

-
-

x is detrended by the detrend callable. Default is no -normalization.

-
-

normed : boolean, optional, default: True

-
-

if True, input vectors are normalised to unit length.

-
-

usevlines : boolean, optional, default: True

-
-

if True, Axes.vlines is used to plot the vertical lines from the -origin to the acorr. Otherwise, Axes.plot is used.

-
-

maxlags : integer, optional, default: 10

-
-

number of lags to show. If None, will return all 2 * len(x) - 1 -lags.

-
-
Returns:

(lags, c, line, b) : where:

-
-
    -
  • lags are a length 2`maxlags+1 lag vector.
  • -
  • c is the 2`maxlags+1 auto correlation vectorI
  • -
  • line is a Line2D instance returned by -plot.
  • -
  • b is the x-axis (none, if plot is used).
  • -
-
-
Other Parameters:
 

linestyle : Line2D prop, optional, default: None

-
-

Only used if usevlines is False.

-
-

marker : string, optional, default: ‘o’

-
-

Notes

-

The cross correlation is performed with numpy.correlate() with -mode = 2.

-
-

Note

-

In addition to the above described arguments, this function can take a -data keyword argument. If such a data argument is given, the -following arguments are replaced by data[<arg>]:

-
    -
  • All arguments with the following names: ‘x’, ‘y’.
  • -
-
-
- -
-
-matplotlib.pyplot.xkcd(scale=1, length=100, randomness=2)
-

Turns on xkcd sketch-style drawing mode. -This will only have effect on things drawn after this function is -called.

-

For best results, the “Humor Sans” font should be installed: it is -not included with matplotlib.

- --- - - - -
Parameters:

scale : float, optional

-
-

The amplitude of the wiggle perpendicular to the source line.

-
-

length : float, optional

-
-

The length of the wiggle along the line.

-
-

randomness : float, optional

-
-

The scale factor by which the length is shrunken or expanded.

-
-
-

Notes

-

This function works by a number of rcParams, so it will probably -override others you have set before.

-

If you want the effects of this function to be temporary, it can -be used as a context manager, for example:

-
with plt.xkcd():
-    # This figure will be in XKCD-style
-    fig1 = plt.figure()
-    # ...
-
-# This figure will be in regular style
-fig2 = plt.figure()
-
-
-
- -
-
-matplotlib.pyplot.xlabel(s, *args, **kwargs)
-

Set the x axis label of the current axis.

-

Default override is:

-
override = {
-    'fontsize'            : 'small',
-    'verticalalignment'   : 'top',
-    'horizontalalignment' : 'center'
-    }
-
-
-
-

See also

-
-
text()
-
For information on how override and the optional args work
-
-
-
- -
-
-matplotlib.pyplot.xlim(*args, **kwargs)
-

Get or set the x limits of the current axes.

-
xmin, xmax = xlim()   # return the current xlim
-xlim( (xmin, xmax) )  # set the xlim to xmin, xmax
-xlim( xmin, xmax )    # set the xlim to xmin, xmax
-
-
-

If you do not specify args, you can pass the xmin and xmax as -kwargs, e.g.:

-
xlim(xmax=3) # adjust the max leaving min unchanged
-xlim(xmin=1) # adjust the min leaving max unchanged
-
-
-

Setting limits turns autoscaling off for the x-axis.

-

The new axis limits are returned as a length 2 tuple.

-
- -
-
-matplotlib.pyplot.xscale(*args, **kwargs)
-

Set the scaling of the x-axis.

-

call signature:

-
xscale(scale, **kwargs)
-
-
-

The available scales are: ‘linear’ | ‘log’ | ‘logit’ | ‘symlog’

-

Different keywords may be accepted, depending on the scale:

-
-

‘linear’

-

‘log’

-
-
-
basex/basey:
-
The base of the logarithm
-
nonposx/nonposy: [‘mask’ | ‘clip’ ]
-
non-positive values in x or y can be masked as -invalid, or clipped to a very small positive number
-
subsx/subsy:
-

Where to place the subticks between each major tick. -Should be a sequence of integers. For example, in a log10 -scale: [2, 3, 4, 5, 6, 7, 8, 9]

-

will place 8 logarithmically spaced minor ticks between -each major tick.

-
-
-
-

‘logit’

-
-
-
nonpos: [‘mask’ | ‘clip’ ]
-
values beyond ]0, 1[ can be masked as invalid, or clipped to a number -very close to 0 or 1
-
-
-

‘symlog’

-
-
-
basex/basey:
-
The base of the logarithm
-
linthreshx/linthreshy:
-
The range (-x, x) within which the plot is linear (to -avoid having the plot go to infinity around zero).
-
subsx/subsy:
-

Where to place the subticks between each major tick. -Should be a sequence of integers. For example, in a log10 -scale: [2, 3, 4, 5, 6, 7, 8, 9]

-

will place 8 logarithmically spaced minor ticks between -each major tick.

-
-
linscalex/linscaley:
-
This allows the linear range (-linthresh to linthresh) -to be stretched relative to the logarithmic range. Its -value is the number of decades to use for each half of the -linear range. For example, when linscale == 1.0 (the -default), the space used for the positive and negative -halves of the linear range will be equal to one decade in -the logarithmic range.
-
-
-
-
- -
-
-matplotlib.pyplot.xticks(*args, **kwargs)
-

Get or set the x-limits of the current tick locations and labels.

-
# return locs, labels where locs is an array of tick locations and
-# labels is an array of tick labels.
-locs, labels = xticks()
-
-# set the locations of the xticks
-xticks( arange(6) )
-
-# set the locations and labels of the xticks
-xticks( arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue') )
-
-
-

The keyword args, if any, are Text -properties. For example, to rotate long labels:

-
xticks( arange(12), calendar.month_name[1:13], rotation=17 )
-
-
-
- -
-
-matplotlib.pyplot.ylabel(s, *args, **kwargs)
-

Set the y axis label of the current axis.

-

Defaults override is:

-
override = {
-   'fontsize'            : 'small',
-   'verticalalignment'   : 'center',
-   'horizontalalignment' : 'right',
-   'rotation'='vertical' : }
-
-
-
-

See also

-
-
text()
-
For information on how override and the optional args -work.
-
-
-
- -
-
-matplotlib.pyplot.ylim(*args, **kwargs)
-

Get or set the y-limits of the current axes.

-
ymin, ymax = ylim()   # return the current ylim
-ylim( (ymin, ymax) )  # set the ylim to ymin, ymax
-ylim( ymin, ymax )    # set the ylim to ymin, ymax
-
-
-

If you do not specify args, you can pass the ymin and ymax as -kwargs, e.g.:

-
ylim(ymax=3) # adjust the max leaving min unchanged
-ylim(ymin=1) # adjust the min leaving max unchanged
-
-
-

Setting limits turns autoscaling off for the y-axis.

-

The new axis limits are returned as a length 2 tuple.

-
- -
-
-matplotlib.pyplot.yscale(*args, **kwargs)
-

Set the scaling of the y-axis.

-

call signature:

-
yscale(scale, **kwargs)
-
-
-

The available scales are: ‘linear’ | ‘log’ | ‘logit’ | ‘symlog’

-

Different keywords may be accepted, depending on the scale:

-
-

‘linear’

-

‘log’

-
-
-
basex/basey:
-
The base of the logarithm
-
nonposx/nonposy: [‘mask’ | ‘clip’ ]
-
non-positive values in x or y can be masked as -invalid, or clipped to a very small positive number
-
subsx/subsy:
-

Where to place the subticks between each major tick. -Should be a sequence of integers. For example, in a log10 -scale: [2, 3, 4, 5, 6, 7, 8, 9]

-

will place 8 logarithmically spaced minor ticks between -each major tick.

-
-
-
-

‘logit’

-
-
-
nonpos: [‘mask’ | ‘clip’ ]
-
values beyond ]0, 1[ can be masked as invalid, or clipped to a number -very close to 0 or 1
-
-
-

‘symlog’

-
-
-
basex/basey:
-
The base of the logarithm
-
linthreshx/linthreshy:
-
The range (-x, x) within which the plot is linear (to -avoid having the plot go to infinity around zero).
-
subsx/subsy:
-

Where to place the subticks between each major tick. -Should be a sequence of integers. For example, in a log10 -scale: [2, 3, 4, 5, 6, 7, 8, 9]

-

will place 8 logarithmically spaced minor ticks between -each major tick.

-
-
linscalex/linscaley:
-
This allows the linear range (-linthresh to linthresh) -to be stretched relative to the logarithmic range. Its -value is the number of decades to use for each half of the -linear range. For example, when linscale == 1.0 (the -default), the space used for the positive and negative -halves of the linear range will be equal to one decade in -the logarithmic range.
-
-
-
-
- -
-
-matplotlib.pyplot.yticks(*args, **kwargs)
-

Get or set the y-limits of the current tick locations and labels.

-
# return locs, labels where locs is an array of tick locations and
-# labels is an array of tick labels.
-locs, labels = yticks()
-
-# set the locations of the yticks
-yticks( arange(6) )
-
-# set the locations and labels of the yticks
-yticks( arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue') )
-
-
-

The keyword args, if any, are Text -properties. For example, to rotate long labels:

-
yticks( arange(12), calendar.month_name[1:13], rotation=45 )
-
-
-
- -
-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/animation/animate_decay.html b/examples/animation/animate_decay.html deleted file mode 100644 index b7824709b1f..00000000000 --- a/examples/animation/animate_decay.html +++ /dev/null @@ -1,372 +0,0 @@ - - - - - - - - animation example code: animate_decay.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

animation example code: animate_decay.py

-

[source code]

-
"""
-=====
-Decay
-=====
-
-This example showcases a sinusoidal decay animation.
-"""
-
-
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.animation as animation
-
-
-def data_gen(t=0):
-    cnt = 0
-    while cnt < 1000:
-        cnt += 1
-        t += 0.1
-        yield t, np.sin(2*np.pi*t) * np.exp(-t/10.)
-
-
-def init():
-    ax.set_ylim(-1.1, 1.1)
-    ax.set_xlim(0, 10)
-    del xdata[:]
-    del ydata[:]
-    line.set_data(xdata, ydata)
-    return line,
-
-fig, ax = plt.subplots()
-line, = ax.plot([], [], lw=2)
-ax.grid()
-xdata, ydata = [], []
-
-
-def run(data):
-    # update the data
-    t, y = data
-    xdata.append(t)
-    ydata.append(y)
-    xmin, xmax = ax.get_xlim()
-
-    if t >= xmax:
-        ax.set_xlim(xmin, 2*xmax)
-        ax.figure.canvas.draw()
-    line.set_data(xdata, ydata)
-
-    return line,
-
-ani = animation.FuncAnimation(fig, run, data_gen, blit=False, interval=10,
-                              repeat=False, init_func=init)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/animation/animate_decay.py b/examples/animation/animate_decay.py deleted file mode 100644 index 271dc6a3339..00000000000 --- a/examples/animation/animate_decay.py +++ /dev/null @@ -1,53 +0,0 @@ -""" -===== -Decay -===== - -This example showcases a sinusoidal decay animation. -""" - - -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.animation as animation - - -def data_gen(t=0): - cnt = 0 - while cnt < 1000: - cnt += 1 - t += 0.1 - yield t, np.sin(2*np.pi*t) * np.exp(-t/10.) - - -def init(): - ax.set_ylim(-1.1, 1.1) - ax.set_xlim(0, 10) - del xdata[:] - del ydata[:] - line.set_data(xdata, ydata) - return line, - -fig, ax = plt.subplots() -line, = ax.plot([], [], lw=2) -ax.grid() -xdata, ydata = [], [] - - -def run(data): - # update the data - t, y = data - xdata.append(t) - ydata.append(y) - xmin, xmax = ax.get_xlim() - - if t >= xmax: - ax.set_xlim(xmin, 2*xmax) - ax.figure.canvas.draw() - line.set_data(xdata, ydata) - - return line, - -ani = animation.FuncAnimation(fig, run, data_gen, blit=False, interval=10, - repeat=False, init_func=init) -plt.show() diff --git a/examples/animation/animate_decay_tk_blit.html b/examples/animation/animate_decay_tk_blit.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/animation/animate_decay_tk_blit.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/animation/animation_blit_fltk.html b/examples/animation/animation_blit_fltk.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/animation/animation_blit_fltk.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/animation/animation_blit_gtk.html b/examples/animation/animation_blit_gtk.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/animation/animation_blit_gtk.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/animation/animation_blit_gtk2.html b/examples/animation/animation_blit_gtk2.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/animation/animation_blit_gtk2.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/animation/animation_blit_qt.html b/examples/animation/animation_blit_qt.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/animation/animation_blit_qt.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/animation/animation_blit_qt4.html b/examples/animation/animation_blit_qt4.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/animation/animation_blit_qt4.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/animation/animation_blit_tk.html b/examples/animation/animation_blit_tk.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/animation/animation_blit_tk.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/animation/animation_blit_wx.html b/examples/animation/animation_blit_wx.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/animation/animation_blit_wx.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/animation/basic_example.html b/examples/animation/basic_example.html deleted file mode 100644 index 18d46a272c8..00000000000 --- a/examples/animation/basic_example.html +++ /dev/null @@ -1,365 +0,0 @@ - - - - - - - - animation example code: basic_example.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

animation example code: basic_example.py

-

[source code]

-
"""
-=========================
-Simple animation examples
-=========================
-
-This example contains two animations. The first is a random walk plot. The
-second is an image animation.
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.animation as animation
-
-
-def update_line(num, data, line):
-    line.set_data(data[..., :num])
-    return line,
-
-fig1 = plt.figure()
-
-data = np.random.rand(2, 25)
-l, = plt.plot([], [], 'r-')
-plt.xlim(0, 1)
-plt.ylim(0, 1)
-plt.xlabel('x')
-plt.title('test')
-line_ani = animation.FuncAnimation(fig1, update_line, 25, fargs=(data, l),
-                                   interval=50, blit=True)
-
-# To save the animation, use the command: line_ani.save('lines.mp4')
-
-fig2 = plt.figure()
-
-x = np.arange(-9, 10)
-y = np.arange(-9, 10).reshape(-1, 1)
-base = np.hypot(x, y)
-ims = []
-for add in np.arange(15):
-    ims.append((plt.pcolor(x, y, base + add, norm=plt.Normalize(0, 30)),))
-
-im_ani = animation.ArtistAnimation(fig2, ims, interval=50, repeat_delay=3000,
-                                   blit=True)
-# To save this second animation with some metadata, use the following command:
-# im_ani.save('im.mp4', metadata={'artist':'Guido'})
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/animation/basic_example.py b/examples/animation/basic_example.py deleted file mode 100644 index 4a9c0f6e624..00000000000 --- a/examples/animation/basic_example.py +++ /dev/null @@ -1,46 +0,0 @@ -""" -========================= -Simple animation examples -========================= - -This example contains two animations. The first is a random walk plot. The -second is an image animation. -""" - -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.animation as animation - - -def update_line(num, data, line): - line.set_data(data[..., :num]) - return line, - -fig1 = plt.figure() - -data = np.random.rand(2, 25) -l, = plt.plot([], [], 'r-') -plt.xlim(0, 1) -plt.ylim(0, 1) -plt.xlabel('x') -plt.title('test') -line_ani = animation.FuncAnimation(fig1, update_line, 25, fargs=(data, l), - interval=50, blit=True) - -# To save the animation, use the command: line_ani.save('lines.mp4') - -fig2 = plt.figure() - -x = np.arange(-9, 10) -y = np.arange(-9, 10).reshape(-1, 1) -base = np.hypot(x, y) -ims = [] -for add in np.arange(15): - ims.append((plt.pcolor(x, y, base + add, norm=plt.Normalize(0, 30)),)) - -im_ani = animation.ArtistAnimation(fig2, ims, interval=50, repeat_delay=3000, - blit=True) -# To save this second animation with some metadata, use the following command: -# im_ani.save('im.mp4', metadata={'artist':'Guido'}) - -plt.show() diff --git a/examples/animation/basic_example_writer.html b/examples/animation/basic_example_writer.html deleted file mode 100644 index 8762f336364..00000000000 --- a/examples/animation/basic_example_writer.html +++ /dev/null @@ -1,370 +0,0 @@ - - - - - - - - animation example code: basic_example_writer.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

animation example code: basic_example_writer.py

-

[source code]

-
"""
-===================
-Saving an animation
-===================
-
-This example showcases the same animations as `basic_example.py`, but instead
-of displaying the animation to the user, it writes to files using a
-MovieWriter instance.
-"""
-
-# -*- noplot -*-
-import numpy as np
-import matplotlib
-matplotlib.use("Agg")
-import matplotlib.pyplot as plt
-import matplotlib.animation as animation
-
-
-def update_line(num, data, line):
-    line.set_data(data[..., :num])
-    return line,
-
-# Set up formatting for the movie files
-Writer = animation.writers['ffmpeg']
-writer = Writer(fps=15, metadata=dict(artist='Me'), bitrate=1800)
-
-
-fig1 = plt.figure()
-
-data = np.random.rand(2, 25)
-l, = plt.plot([], [], 'r-')
-plt.xlim(0, 1)
-plt.ylim(0, 1)
-plt.xlabel('x')
-plt.title('test')
-line_ani = animation.FuncAnimation(fig1, update_line, 25, fargs=(data, l),
-                                   interval=50, blit=True)
-line_ani.save('lines.mp4', writer=writer)
-
-fig2 = plt.figure()
-
-x = np.arange(-9, 10)
-y = np.arange(-9, 10).reshape(-1, 1)
-base = np.hypot(x, y)
-ims = []
-for add in np.arange(15):
-    ims.append((plt.pcolor(x, y, base + add, norm=plt.Normalize(0, 30)),))
-
-im_ani = animation.ArtistAnimation(fig2, ims, interval=50, repeat_delay=3000,
-                                   blit=True)
-im_ani.save('im.mp4', writer=writer)
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/animation/basic_example_writer.py b/examples/animation/basic_example_writer.py deleted file mode 100644 index 31146900f1c..00000000000 --- a/examples/animation/basic_example_writer.py +++ /dev/null @@ -1,51 +0,0 @@ -""" -=================== -Saving an animation -=================== - -This example showcases the same animations as `basic_example.py`, but instead -of displaying the animation to the user, it writes to files using a -MovieWriter instance. -""" - -# -*- noplot -*- -import numpy as np -import matplotlib -matplotlib.use("Agg") -import matplotlib.pyplot as plt -import matplotlib.animation as animation - - -def update_line(num, data, line): - line.set_data(data[..., :num]) - return line, - -# Set up formatting for the movie files -Writer = animation.writers['ffmpeg'] -writer = Writer(fps=15, metadata=dict(artist='Me'), bitrate=1800) - - -fig1 = plt.figure() - -data = np.random.rand(2, 25) -l, = plt.plot([], [], 'r-') -plt.xlim(0, 1) -plt.ylim(0, 1) -plt.xlabel('x') -plt.title('test') -line_ani = animation.FuncAnimation(fig1, update_line, 25, fargs=(data, l), - interval=50, blit=True) -line_ani.save('lines.mp4', writer=writer) - -fig2 = plt.figure() - -x = np.arange(-9, 10) -y = np.arange(-9, 10).reshape(-1, 1) -base = np.hypot(x, y) -ims = [] -for add in np.arange(15): - ims.append((plt.pcolor(x, y, base + add, norm=plt.Normalize(0, 30)),)) - -im_ani = animation.ArtistAnimation(fig2, ims, interval=50, repeat_delay=3000, - blit=True) -im_ani.save('im.mp4', writer=writer) diff --git a/examples/animation/bayes_update.html b/examples/animation/bayes_update.html deleted file mode 100644 index c0cf25568a9..00000000000 --- a/examples/animation/bayes_update.html +++ /dev/null @@ -1,377 +0,0 @@ - - - - - - - - animation example code: bayes_update.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

animation example code: bayes_update.py

-

[source code]

-
"""
-================
-The Bayes update
-================
-
-This animation displays the posterior estimate updates as it is refitted when
-new data arrives.
-The vertical line represents the theoretical value to which the plotted
-distribution should converge.
-"""
-
-# update a distribution based on new data.
-import numpy as np
-import matplotlib.pyplot as plt
-import scipy.stats as ss
-from matplotlib.animation import FuncAnimation
-
-
-class UpdateDist(object):
-    def __init__(self, ax, prob=0.5):
-        self.success = 0
-        self.prob = prob
-        self.line, = ax.plot([], [], 'k-')
-        self.x = np.linspace(0, 1, 200)
-        self.ax = ax
-
-        # Set up plot parameters
-        self.ax.set_xlim(0, 1)
-        self.ax.set_ylim(0, 15)
-        self.ax.grid(True)
-
-        # This vertical line represents the theoretical value, to
-        # which the plotted distribution should converge.
-        self.ax.axvline(prob, linestyle='--', color='black')
-
-    def init(self):
-        self.success = 0
-        self.line.set_data([], [])
-        return self.line,
-
-    def __call__(self, i):
-        # This way the plot can continuously run and we just keep
-        # watching new realizations of the process
-        if i == 0:
-            return self.init()
-
-        # Choose success based on exceed a threshold with a uniform pick
-        if np.random.rand(1,) < self.prob:
-            self.success += 1
-        y = ss.beta.pdf(self.x, self.success + 1, (i - self.success) + 1)
-        self.line.set_data(self.x, y)
-        return self.line,
-
-fig, ax = plt.subplots()
-ud = UpdateDist(ax, prob=0.7)
-anim = FuncAnimation(fig, ud, frames=np.arange(100), init_func=ud.init,
-                     interval=100, blit=True)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/animation/bayes_update.py b/examples/animation/bayes_update.py deleted file mode 100644 index a29420d977f..00000000000 --- a/examples/animation/bayes_update.py +++ /dev/null @@ -1,58 +0,0 @@ -""" -================ -The Bayes update -================ - -This animation displays the posterior estimate updates as it is refitted when -new data arrives. -The vertical line represents the theoretical value to which the plotted -distribution should converge. -""" - -# update a distribution based on new data. -import numpy as np -import matplotlib.pyplot as plt -import scipy.stats as ss -from matplotlib.animation import FuncAnimation - - -class UpdateDist(object): - def __init__(self, ax, prob=0.5): - self.success = 0 - self.prob = prob - self.line, = ax.plot([], [], 'k-') - self.x = np.linspace(0, 1, 200) - self.ax = ax - - # Set up plot parameters - self.ax.set_xlim(0, 1) - self.ax.set_ylim(0, 15) - self.ax.grid(True) - - # This vertical line represents the theoretical value, to - # which the plotted distribution should converge. - self.ax.axvline(prob, linestyle='--', color='black') - - def init(self): - self.success = 0 - self.line.set_data([], []) - return self.line, - - def __call__(self, i): - # This way the plot can continuously run and we just keep - # watching new realizations of the process - if i == 0: - return self.init() - - # Choose success based on exceed a threshold with a uniform pick - if np.random.rand(1,) < self.prob: - self.success += 1 - y = ss.beta.pdf(self.x, self.success + 1, (i - self.success) + 1) - self.line.set_data(self.x, y) - return self.line, - -fig, ax = plt.subplots() -ud = UpdateDist(ax, prob=0.7) -anim = FuncAnimation(fig, ud, frames=np.arange(100), init_func=ud.init, - interval=100, blit=True) -plt.show() diff --git a/examples/animation/double_pendulum_animated.html b/examples/animation/double_pendulum_animated.html deleted file mode 100644 index 4027ebc15fe..00000000000 --- a/examples/animation/double_pendulum_animated.html +++ /dev/null @@ -1,416 +0,0 @@ - - - - - - - - animation example code: double_pendulum_animated.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

animation example code: double_pendulum_animated.py

-

[source code]

-
"""
-===========================
-The double pendulum problem
-===========================
-
-This animation illustrates the double pendulum problem.
-"""
-
-# Double pendulum formula translated from the C code at
-# http://www.physics.usyd.edu.au/~wheat/dpend_html/solve_dpend.c
-
-from numpy import sin, cos
-import numpy as np
-import matplotlib.pyplot as plt
-import scipy.integrate as integrate
-import matplotlib.animation as animation
-
-G = 9.8  # acceleration due to gravity, in m/s^2
-L1 = 1.0  # length of pendulum 1 in m
-L2 = 1.0  # length of pendulum 2 in m
-M1 = 1.0  # mass of pendulum 1 in kg
-M2 = 1.0  # mass of pendulum 2 in kg
-
-
-def derivs(state, t):
-
-    dydx = np.zeros_like(state)
-    dydx[0] = state[1]
-
-    del_ = state[2] - state[0]
-    den1 = (M1 + M2)*L1 - M2*L1*cos(del_)*cos(del_)
-    dydx[1] = (M2*L1*state[1]*state[1]*sin(del_)*cos(del_) +
-               M2*G*sin(state[2])*cos(del_) +
-               M2*L2*state[3]*state[3]*sin(del_) -
-               (M1 + M2)*G*sin(state[0]))/den1
-
-    dydx[2] = state[3]
-
-    den2 = (L2/L1)*den1
-    dydx[3] = (-M2*L2*state[3]*state[3]*sin(del_)*cos(del_) +
-               (M1 + M2)*G*sin(state[0])*cos(del_) -
-               (M1 + M2)*L1*state[1]*state[1]*sin(del_) -
-               (M1 + M2)*G*sin(state[2]))/den2
-
-    return dydx
-
-# create a time array from 0..100 sampled at 0.05 second steps
-dt = 0.05
-t = np.arange(0.0, 20, dt)
-
-# th1 and th2 are the initial angles (degrees)
-# w10 and w20 are the initial angular velocities (degrees per second)
-th1 = 120.0
-w1 = 0.0
-th2 = -10.0
-w2 = 0.0
-
-# initial state
-state = np.radians([th1, w1, th2, w2])
-
-# integrate your ODE using scipy.integrate.
-y = integrate.odeint(derivs, state, t)
-
-x1 = L1*sin(y[:, 0])
-y1 = -L1*cos(y[:, 0])
-
-x2 = L2*sin(y[:, 2]) + x1
-y2 = -L2*cos(y[:, 2]) + y1
-
-fig = plt.figure()
-ax = fig.add_subplot(111, autoscale_on=False, xlim=(-2, 2), ylim=(-2, 2))
-ax.grid()
-
-line, = ax.plot([], [], 'o-', lw=2)
-time_template = 'time = %.1fs'
-time_text = ax.text(0.05, 0.9, '', transform=ax.transAxes)
-
-
-def init():
-    line.set_data([], [])
-    time_text.set_text('')
-    return line, time_text
-
-
-def animate(i):
-    thisx = [0, x1[i], x2[i]]
-    thisy = [0, y1[i], y2[i]]
-
-    line.set_data(thisx, thisy)
-    time_text.set_text(time_template % (i*dt))
-    return line, time_text
-
-ani = animation.FuncAnimation(fig, animate, np.arange(1, len(y)),
-                              interval=25, blit=True, init_func=init)
-
-# ani.save('double_pendulum.mp4', fps=15)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/animation/double_pendulum_animated.py b/examples/animation/double_pendulum_animated.py deleted file mode 100644 index 372bbc2d56a..00000000000 --- a/examples/animation/double_pendulum_animated.py +++ /dev/null @@ -1,97 +0,0 @@ -""" -=========================== -The double pendulum problem -=========================== - -This animation illustrates the double pendulum problem. -""" - -# Double pendulum formula translated from the C code at -# http://www.physics.usyd.edu.au/~wheat/dpend_html/solve_dpend.c - -from numpy import sin, cos -import numpy as np -import matplotlib.pyplot as plt -import scipy.integrate as integrate -import matplotlib.animation as animation - -G = 9.8 # acceleration due to gravity, in m/s^2 -L1 = 1.0 # length of pendulum 1 in m -L2 = 1.0 # length of pendulum 2 in m -M1 = 1.0 # mass of pendulum 1 in kg -M2 = 1.0 # mass of pendulum 2 in kg - - -def derivs(state, t): - - dydx = np.zeros_like(state) - dydx[0] = state[1] - - del_ = state[2] - state[0] - den1 = (M1 + M2)*L1 - M2*L1*cos(del_)*cos(del_) - dydx[1] = (M2*L1*state[1]*state[1]*sin(del_)*cos(del_) + - M2*G*sin(state[2])*cos(del_) + - M2*L2*state[3]*state[3]*sin(del_) - - (M1 + M2)*G*sin(state[0]))/den1 - - dydx[2] = state[3] - - den2 = (L2/L1)*den1 - dydx[3] = (-M2*L2*state[3]*state[3]*sin(del_)*cos(del_) + - (M1 + M2)*G*sin(state[0])*cos(del_) - - (M1 + M2)*L1*state[1]*state[1]*sin(del_) - - (M1 + M2)*G*sin(state[2]))/den2 - - return dydx - -# create a time array from 0..100 sampled at 0.05 second steps -dt = 0.05 -t = np.arange(0.0, 20, dt) - -# th1 and th2 are the initial angles (degrees) -# w10 and w20 are the initial angular velocities (degrees per second) -th1 = 120.0 -w1 = 0.0 -th2 = -10.0 -w2 = 0.0 - -# initial state -state = np.radians([th1, w1, th2, w2]) - -# integrate your ODE using scipy.integrate. -y = integrate.odeint(derivs, state, t) - -x1 = L1*sin(y[:, 0]) -y1 = -L1*cos(y[:, 0]) - -x2 = L2*sin(y[:, 2]) + x1 -y2 = -L2*cos(y[:, 2]) + y1 - -fig = plt.figure() -ax = fig.add_subplot(111, autoscale_on=False, xlim=(-2, 2), ylim=(-2, 2)) -ax.grid() - -line, = ax.plot([], [], 'o-', lw=2) -time_template = 'time = %.1fs' -time_text = ax.text(0.05, 0.9, '', transform=ax.transAxes) - - -def init(): - line.set_data([], []) - time_text.set_text('') - return line, time_text - - -def animate(i): - thisx = [0, x1[i], x2[i]] - thisy = [0, y1[i], y2[i]] - - line.set_data(thisx, thisy) - time_text.set_text(time_template % (i*dt)) - return line, time_text - -ani = animation.FuncAnimation(fig, animate, np.arange(1, len(y)), - interval=25, blit=True, init_func=init) - -# ani.save('double_pendulum.mp4', fps=15) -plt.show() diff --git a/examples/animation/draggable_legend.html b/examples/animation/draggable_legend.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/animation/draggable_legend.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/animation/dynamic_collection.html b/examples/animation/dynamic_collection.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/animation/dynamic_collection.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/animation/dynamic_image.html b/examples/animation/dynamic_image.html deleted file mode 100644 index 4dccc8bf4da..00000000000 --- a/examples/animation/dynamic_image.html +++ /dev/null @@ -1,351 +0,0 @@ - - - - - - - - animation example code: dynamic_image.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

animation example code: dynamic_image.py

-

[source code]

-
"""
-=================
-An animated image
-=================
-
-This example demonstrates how to animate an image.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.animation as animation
-
-fig = plt.figure()
-
-
-def f(x, y):
-    return np.sin(x) + np.cos(y)
-
-x = np.linspace(0, 2 * np.pi, 120)
-y = np.linspace(0, 2 * np.pi, 100).reshape(-1, 1)
-
-im = plt.imshow(f(x, y), animated=True)
-
-
-def updatefig(*args):
-    global x, y
-    x += np.pi / 15.
-    y += np.pi / 20.
-    im.set_array(f(x, y))
-    return im,
-
-ani = animation.FuncAnimation(fig, updatefig, interval=50, blit=True)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/animation/dynamic_image.py b/examples/animation/dynamic_image.py deleted file mode 100644 index cea3327209d..00000000000 --- a/examples/animation/dynamic_image.py +++ /dev/null @@ -1,32 +0,0 @@ -""" -================= -An animated image -================= - -This example demonstrates how to animate an image. -""" -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.animation as animation - -fig = plt.figure() - - -def f(x, y): - return np.sin(x) + np.cos(y) - -x = np.linspace(0, 2 * np.pi, 120) -y = np.linspace(0, 2 * np.pi, 100).reshape(-1, 1) - -im = plt.imshow(f(x, y), animated=True) - - -def updatefig(*args): - global x, y - x += np.pi / 15. - y += np.pi / 20. - im.set_array(f(x, y)) - return im, - -ani = animation.FuncAnimation(fig, updatefig, interval=50, blit=True) -plt.show() diff --git a/examples/animation/dynamic_image2.html b/examples/animation/dynamic_image2.html deleted file mode 100644 index c03b91dbe17..00000000000 --- a/examples/animation/dynamic_image2.html +++ /dev/null @@ -1,355 +0,0 @@ - - - - - - - - animation example code: dynamic_image2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

animation example code: dynamic_image2.py

-

[source code]

-
"""
-========================================
-An animated image using a list of images
-========================================
-
-This examples demonstrates how to animate an image from a list of images (or
-Artists).
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.animation as animation
-
-fig = plt.figure()
-
-
-def f(x, y):
-    return np.sin(x) + np.cos(y)
-
-x = np.linspace(0, 2 * np.pi, 120)
-y = np.linspace(0, 2 * np.pi, 100).reshape(-1, 1)
-# ims is a list of lists, each row is a list of artists to draw in the
-# current frame; here we are just animating one artist, the image, in
-# each frame
-ims = []
-for i in range(60):
-    x += np.pi / 15.
-    y += np.pi / 20.
-    im = plt.imshow(f(x, y), animated=True)
-    ims.append([im])
-
-ani = animation.ArtistAnimation(fig, ims, interval=50, blit=True,
-                                repeat_delay=1000)
-
-# ani.save('dynamic_images.mp4')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/animation/dynamic_image2.py b/examples/animation/dynamic_image2.py deleted file mode 100644 index 7fd635b6569..00000000000 --- a/examples/animation/dynamic_image2.py +++ /dev/null @@ -1,36 +0,0 @@ -""" -======================================== -An animated image using a list of images -======================================== - -This examples demonstrates how to animate an image from a list of images (or -Artists). -""" -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.animation as animation - -fig = plt.figure() - - -def f(x, y): - return np.sin(x) + np.cos(y) - -x = np.linspace(0, 2 * np.pi, 120) -y = np.linspace(0, 2 * np.pi, 100).reshape(-1, 1) -# ims is a list of lists, each row is a list of artists to draw in the -# current frame; here we are just animating one artist, the image, in -# each frame -ims = [] -for i in range(60): - x += np.pi / 15. - y += np.pi / 20. - im = plt.imshow(f(x, y), animated=True) - ims.append([im]) - -ani = animation.ArtistAnimation(fig, ims, interval=50, blit=True, - repeat_delay=1000) - -# ani.save('dynamic_images.mp4') - -plt.show() diff --git a/examples/animation/dynamic_image_gtkagg.html b/examples/animation/dynamic_image_gtkagg.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/animation/dynamic_image_gtkagg.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/animation/dynamic_image_wxagg2.html b/examples/animation/dynamic_image_wxagg2.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/animation/dynamic_image_wxagg2.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/animation/gtk_timeout.html b/examples/animation/gtk_timeout.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/animation/gtk_timeout.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/animation/histogram.html b/examples/animation/histogram.html deleted file mode 100644 index 2cf993c873d..00000000000 --- a/examples/animation/histogram.html +++ /dev/null @@ -1,388 +0,0 @@ - - - - - - - - animation example code: histogram.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

animation example code: histogram.py

-

[source code]

-
"""
-==================
-Animated histogram
-==================
-
-This example shows how to use a path patch to draw a bunch of
-rectangles for an animated histogram.
-
-"""
-import numpy as np
-
-import matplotlib.pyplot as plt
-import matplotlib.patches as patches
-import matplotlib.path as path
-import matplotlib.animation as animation
-
-fig, ax = plt.subplots()
-
-# histogram our data with numpy
-data = np.random.randn(1000)
-n, bins = np.histogram(data, 100)
-
-# get the corners of the rectangles for the histogram
-left = np.array(bins[:-1])
-right = np.array(bins[1:])
-bottom = np.zeros(len(left))
-top = bottom + n
-nrects = len(left)
-
-# here comes the tricky part -- we have to set up the vertex and path
-# codes arrays using moveto, lineto and closepoly
-
-# for each rect: 1 for the MOVETO, 3 for the LINETO, 1 for the
-# CLOSEPOLY; the vert for the closepoly is ignored but we still need
-# it to keep the codes aligned with the vertices
-nverts = nrects*(1 + 3 + 1)
-verts = np.zeros((nverts, 2))
-codes = np.ones(nverts, int) * path.Path.LINETO
-codes[0::5] = path.Path.MOVETO
-codes[4::5] = path.Path.CLOSEPOLY
-verts[0::5, 0] = left
-verts[0::5, 1] = bottom
-verts[1::5, 0] = left
-verts[1::5, 1] = top
-verts[2::5, 0] = right
-verts[2::5, 1] = top
-verts[3::5, 0] = right
-verts[3::5, 1] = bottom
-
-barpath = path.Path(verts, codes)
-patch = patches.PathPatch(
-    barpath, facecolor='green', edgecolor='yellow', alpha=0.5)
-ax.add_patch(patch)
-
-ax.set_xlim(left[0], right[-1])
-ax.set_ylim(bottom.min(), top.max())
-
-
-def animate(i):
-    # simulate new data coming in
-    data = np.random.randn(1000)
-    n, bins = np.histogram(data, 100)
-    top = bottom + n
-    verts[1::5, 1] = top
-    verts[2::5, 1] = top
-    return [patch, ]
-
-ani = animation.FuncAnimation(fig, animate, 100, repeat=False, blit=True)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/animation/histogram.py b/examples/animation/histogram.py deleted file mode 100644 index 810a9756d1c..00000000000 --- a/examples/animation/histogram.py +++ /dev/null @@ -1,69 +0,0 @@ -""" -================== -Animated histogram -================== - -This example shows how to use a path patch to draw a bunch of -rectangles for an animated histogram. - -""" -import numpy as np - -import matplotlib.pyplot as plt -import matplotlib.patches as patches -import matplotlib.path as path -import matplotlib.animation as animation - -fig, ax = plt.subplots() - -# histogram our data with numpy -data = np.random.randn(1000) -n, bins = np.histogram(data, 100) - -# get the corners of the rectangles for the histogram -left = np.array(bins[:-1]) -right = np.array(bins[1:]) -bottom = np.zeros(len(left)) -top = bottom + n -nrects = len(left) - -# here comes the tricky part -- we have to set up the vertex and path -# codes arrays using moveto, lineto and closepoly - -# for each rect: 1 for the MOVETO, 3 for the LINETO, 1 for the -# CLOSEPOLY; the vert for the closepoly is ignored but we still need -# it to keep the codes aligned with the vertices -nverts = nrects*(1 + 3 + 1) -verts = np.zeros((nverts, 2)) -codes = np.ones(nverts, int) * path.Path.LINETO -codes[0::5] = path.Path.MOVETO -codes[4::5] = path.Path.CLOSEPOLY -verts[0::5, 0] = left -verts[0::5, 1] = bottom -verts[1::5, 0] = left -verts[1::5, 1] = top -verts[2::5, 0] = right -verts[2::5, 1] = top -verts[3::5, 0] = right -verts[3::5, 1] = bottom - -barpath = path.Path(verts, codes) -patch = patches.PathPatch( - barpath, facecolor='green', edgecolor='yellow', alpha=0.5) -ax.add_patch(patch) - -ax.set_xlim(left[0], right[-1]) -ax.set_ylim(bottom.min(), top.max()) - - -def animate(i): - # simulate new data coming in - data = np.random.randn(1000) - n, bins = np.histogram(data, 100) - top = bottom + n - verts[1::5, 1] = top - verts[2::5, 1] = top - return [patch, ] - -ani = animation.FuncAnimation(fig, animate, 100, repeat=False, blit=True) -plt.show() diff --git a/examples/animation/histogram_tkagg.html b/examples/animation/histogram_tkagg.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/animation/histogram_tkagg.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/animation/index.html b/examples/animation/index.html deleted file mode 100644 index c53446cf4be..00000000000 --- a/examples/animation/index.html +++ /dev/null @@ -1,342 +0,0 @@ - - - - - - - - animation Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
- - -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/animation/movie_demo.html b/examples/animation/movie_demo.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/animation/movie_demo.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/animation/moviewriter.html b/examples/animation/moviewriter.html deleted file mode 100644 index 29aa75172e6..00000000000 --- a/examples/animation/moviewriter.html +++ /dev/null @@ -1,357 +0,0 @@ - - - - - - - - animation example code: moviewriter.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

animation example code: moviewriter.py

-

[source code]

-
"""
-===========
-MovieWriter
-===========
-
-This example uses a MovieWriter directly to grab individual frames and write
-them to a file. This avoids any event loop integration, but has the advantage
-of working with even the Agg backend. This is not recommended for use in an
-interactive setting.
-
-"""
-# -*- noplot -*-
-
-import numpy as np
-import matplotlib
-matplotlib.use("Agg")
-import matplotlib.pyplot as plt
-import matplotlib.animation as manimation
-
-FFMpegWriter = manimation.writers['ffmpeg']
-metadata = dict(title='Movie Test', artist='Matplotlib',
-                comment='Movie support!')
-writer = FFMpegWriter(fps=15, metadata=metadata)
-
-fig = plt.figure()
-l, = plt.plot([], [], 'k-o')
-
-plt.xlim(-5, 5)
-plt.ylim(-5, 5)
-
-x0, y0 = 0, 0
-
-with writer.saving(fig, "writer_test.mp4", 100):
-    for i in range(100):
-        x0 += 0.1 * np.random.randn()
-        y0 += 0.1 * np.random.randn()
-        l.set_data(x0, y0)
-        writer.grab_frame()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/animation/moviewriter.py b/examples/animation/moviewriter.py deleted file mode 100644 index afe200ad574..00000000000 --- a/examples/animation/moviewriter.py +++ /dev/null @@ -1,38 +0,0 @@ -""" -=========== -MovieWriter -=========== - -This example uses a MovieWriter directly to grab individual frames and write -them to a file. This avoids any event loop integration, but has the advantage -of working with even the Agg backend. This is not recommended for use in an -interactive setting. - -""" -# -*- noplot -*- - -import numpy as np -import matplotlib -matplotlib.use("Agg") -import matplotlib.pyplot as plt -import matplotlib.animation as manimation - -FFMpegWriter = manimation.writers['ffmpeg'] -metadata = dict(title='Movie Test', artist='Matplotlib', - comment='Movie support!') -writer = FFMpegWriter(fps=15, metadata=metadata) - -fig = plt.figure() -l, = plt.plot([], [], 'k-o') - -plt.xlim(-5, 5) -plt.ylim(-5, 5) - -x0, y0 = 0, 0 - -with writer.saving(fig, "writer_test.mp4", 100): - for i in range(100): - x0 += 0.1 * np.random.randn() - y0 += 0.1 * np.random.randn() - l.set_data(x0, y0) - writer.grab_frame() diff --git a/examples/animation/rain.html b/examples/animation/rain.html deleted file mode 100644 index 9d41c649370..00000000000 --- a/examples/animation/rain.html +++ /dev/null @@ -1,387 +0,0 @@ - - - - - - - - animation example code: rain.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

animation example code: rain.py

-

[source code]

-
"""
-===============
-Rain simulation
-===============
-
-Simulates rain drops on a surface by animating the scale and opacity
-of 50 scatter points.
-
-Author: Nicolas P. Rougier
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.animation import FuncAnimation
-
-
-# Create new Figure and an Axes which fills it.
-fig = plt.figure(figsize=(7, 7))
-ax = fig.add_axes([0, 0, 1, 1], frameon=False)
-ax.set_xlim(0, 1), ax.set_xticks([])
-ax.set_ylim(0, 1), ax.set_yticks([])
-
-# Create rain data
-n_drops = 50
-rain_drops = np.zeros(n_drops, dtype=[('position', float, 2),
-                                      ('size',     float, 1),
-                                      ('growth',   float, 1),
-                                      ('color',    float, 4)])
-
-# Initialize the raindrops in random positions and with
-# random growth rates.
-rain_drops['position'] = np.random.uniform(0, 1, (n_drops, 2))
-rain_drops['growth'] = np.random.uniform(50, 200, n_drops)
-
-# Construct the scatter which we will update during animation
-# as the raindrops develop.
-scat = ax.scatter(rain_drops['position'][:, 0], rain_drops['position'][:, 1],
-                  s=rain_drops['size'], lw=0.5, edgecolors=rain_drops['color'],
-                  facecolors='none')
-
-
-def update(frame_number):
-    # Get an index which we can use to re-spawn the oldest raindrop.
-    current_index = frame_number % n_drops
-
-    # Make all colors more transparent as time progresses.
-    rain_drops['color'][:, 3] -= 1.0/len(rain_drops)
-    rain_drops['color'][:, 3] = np.clip(rain_drops['color'][:, 3], 0, 1)
-
-    # Make all circles bigger.
-    rain_drops['size'] += rain_drops['growth']
-
-    # Pick a new position for oldest rain drop, resetting its size,
-    # color and growth factor.
-    rain_drops['position'][current_index] = np.random.uniform(0, 1, 2)
-    rain_drops['size'][current_index] = 5
-    rain_drops['color'][current_index] = (0, 0, 0, 1)
-    rain_drops['growth'][current_index] = np.random.uniform(50, 200)
-
-    # Update the scatter collection, with the new colors, sizes and positions.
-    scat.set_edgecolors(rain_drops['color'])
-    scat.set_sizes(rain_drops['size'])
-    scat.set_offsets(rain_drops['position'])
-
-
-# Construct the animation, using the update function as the animation
-# director.
-animation = FuncAnimation(fig, update, interval=10)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/animation/rain.py b/examples/animation/rain.py deleted file mode 100644 index db7af8ec879..00000000000 --- a/examples/animation/rain.py +++ /dev/null @@ -1,68 +0,0 @@ -""" -=============== -Rain simulation -=============== - -Simulates rain drops on a surface by animating the scale and opacity -of 50 scatter points. - -Author: Nicolas P. Rougier -""" -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.animation import FuncAnimation - - -# Create new Figure and an Axes which fills it. -fig = plt.figure(figsize=(7, 7)) -ax = fig.add_axes([0, 0, 1, 1], frameon=False) -ax.set_xlim(0, 1), ax.set_xticks([]) -ax.set_ylim(0, 1), ax.set_yticks([]) - -# Create rain data -n_drops = 50 -rain_drops = np.zeros(n_drops, dtype=[('position', float, 2), - ('size', float, 1), - ('growth', float, 1), - ('color', float, 4)]) - -# Initialize the raindrops in random positions and with -# random growth rates. -rain_drops['position'] = np.random.uniform(0, 1, (n_drops, 2)) -rain_drops['growth'] = np.random.uniform(50, 200, n_drops) - -# Construct the scatter which we will update during animation -# as the raindrops develop. -scat = ax.scatter(rain_drops['position'][:, 0], rain_drops['position'][:, 1], - s=rain_drops['size'], lw=0.5, edgecolors=rain_drops['color'], - facecolors='none') - - -def update(frame_number): - # Get an index which we can use to re-spawn the oldest raindrop. - current_index = frame_number % n_drops - - # Make all colors more transparent as time progresses. - rain_drops['color'][:, 3] -= 1.0/len(rain_drops) - rain_drops['color'][:, 3] = np.clip(rain_drops['color'][:, 3], 0, 1) - - # Make all circles bigger. - rain_drops['size'] += rain_drops['growth'] - - # Pick a new position for oldest rain drop, resetting its size, - # color and growth factor. - rain_drops['position'][current_index] = np.random.uniform(0, 1, 2) - rain_drops['size'][current_index] = 5 - rain_drops['color'][current_index] = (0, 0, 0, 1) - rain_drops['growth'][current_index] = np.random.uniform(50, 200) - - # Update the scatter collection, with the new colors, sizes and positions. - scat.set_edgecolors(rain_drops['color']) - scat.set_sizes(rain_drops['size']) - scat.set_offsets(rain_drops['position']) - - -# Construct the animation, using the update function as the animation -# director. -animation = FuncAnimation(fig, update, interval=10) -plt.show() diff --git a/examples/animation/random_data.html b/examples/animation/random_data.html deleted file mode 100644 index 37126a8c824..00000000000 --- a/examples/animation/random_data.html +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - animation example code: random_data.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

animation example code: random_data.py

-

[source code]

-
"""
-===========
-Random data
-===========
-
-An animation of random data.
-
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.animation as animation
-
-fig, ax = plt.subplots()
-line, = ax.plot(np.random.rand(10))
-ax.set_ylim(0, 1)
-
-
-def update(data):
-    line.set_ydata(data)
-    return line,
-
-
-def data_gen():
-    while True:
-        yield np.random.rand(10)
-
-ani = animation.FuncAnimation(fig, update, data_gen, interval=100)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/animation/random_data.py b/examples/animation/random_data.py deleted file mode 100644 index e638768f9ff..00000000000 --- a/examples/animation/random_data.py +++ /dev/null @@ -1,29 +0,0 @@ -""" -=========== -Random data -=========== - -An animation of random data. - -""" - -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.animation as animation - -fig, ax = plt.subplots() -line, = ax.plot(np.random.rand(10)) -ax.set_ylim(0, 1) - - -def update(data): - line.set_ydata(data) - return line, - - -def data_gen(): - while True: - yield np.random.rand(10) - -ani = animation.FuncAnimation(fig, update, data_gen, interval=100) -plt.show() diff --git a/examples/animation/simple_3danim.html b/examples/animation/simple_3danim.html deleted file mode 100644 index 07cc0a90590..00000000000 --- a/examples/animation/simple_3danim.html +++ /dev/null @@ -1,387 +0,0 @@ - - - - - - - - animation example code: simple_3danim.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

animation example code: simple_3danim.py

-

[source code]

-
"""
-============
-3D animation
-============
-
-A simple example of an animated plot... In 3D!
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-import mpl_toolkits.mplot3d.axes3d as p3
-import matplotlib.animation as animation
-
-
-def Gen_RandLine(length, dims=2):
-    """
-    Create a line using a random walk algorithm
-
-    length is the number of points for the line.
-    dims is the number of dimensions the line has.
-    """
-    lineData = np.empty((dims, length))
-    lineData[:, 0] = np.random.rand(dims)
-    for index in range(1, length):
-        # scaling the random numbers by 0.1 so
-        # movement is small compared to position.
-        # subtraction by 0.5 is to change the range to [-0.5, 0.5]
-        # to allow a line to move backwards.
-        step = ((np.random.rand(dims) - 0.5) * 0.1)
-        lineData[:, index] = lineData[:, index - 1] + step
-
-    return lineData
-
-
-def update_lines(num, dataLines, lines):
-    for line, data in zip(lines, dataLines):
-        # NOTE: there is no .set_data() for 3 dim data...
-        line.set_data(data[0:2, :num])
-        line.set_3d_properties(data[2, :num])
-    return lines
-
-# Attaching 3D axis to the figure
-fig = plt.figure()
-ax = p3.Axes3D(fig)
-
-# Fifty lines of random 3-D lines
-data = [Gen_RandLine(25, 3) for index in range(50)]
-
-# Creating fifty line objects.
-# NOTE: Can't pass empty arrays into 3d version of plot()
-lines = [ax.plot(dat[0, 0:1], dat[1, 0:1], dat[2, 0:1])[0] for dat in data]
-
-# Setting the axes properties
-ax.set_xlim3d([0.0, 1.0])
-ax.set_xlabel('X')
-
-ax.set_ylim3d([0.0, 1.0])
-ax.set_ylabel('Y')
-
-ax.set_zlim3d([0.0, 1.0])
-ax.set_zlabel('Z')
-
-ax.set_title('3D Test')
-
-# Creating the Animation object
-line_ani = animation.FuncAnimation(fig, update_lines, 25, fargs=(data, lines),
-                                   interval=50, blit=False)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/animation/simple_3danim.py b/examples/animation/simple_3danim.py deleted file mode 100644 index 6c3c536d31d..00000000000 --- a/examples/animation/simple_3danim.py +++ /dev/null @@ -1,68 +0,0 @@ -""" -============ -3D animation -============ - -A simple example of an animated plot... In 3D! -""" -import numpy as np -import matplotlib.pyplot as plt -import mpl_toolkits.mplot3d.axes3d as p3 -import matplotlib.animation as animation - - -def Gen_RandLine(length, dims=2): - """ - Create a line using a random walk algorithm - - length is the number of points for the line. - dims is the number of dimensions the line has. - """ - lineData = np.empty((dims, length)) - lineData[:, 0] = np.random.rand(dims) - for index in range(1, length): - # scaling the random numbers by 0.1 so - # movement is small compared to position. - # subtraction by 0.5 is to change the range to [-0.5, 0.5] - # to allow a line to move backwards. - step = ((np.random.rand(dims) - 0.5) * 0.1) - lineData[:, index] = lineData[:, index - 1] + step - - return lineData - - -def update_lines(num, dataLines, lines): - for line, data in zip(lines, dataLines): - # NOTE: there is no .set_data() for 3 dim data... - line.set_data(data[0:2, :num]) - line.set_3d_properties(data[2, :num]) - return lines - -# Attaching 3D axis to the figure -fig = plt.figure() -ax = p3.Axes3D(fig) - -# Fifty lines of random 3-D lines -data = [Gen_RandLine(25, 3) for index in range(50)] - -# Creating fifty line objects. -# NOTE: Can't pass empty arrays into 3d version of plot() -lines = [ax.plot(dat[0, 0:1], dat[1, 0:1], dat[2, 0:1])[0] for dat in data] - -# Setting the axes properties -ax.set_xlim3d([0.0, 1.0]) -ax.set_xlabel('X') - -ax.set_ylim3d([0.0, 1.0]) -ax.set_ylabel('Y') - -ax.set_zlim3d([0.0, 1.0]) -ax.set_zlabel('Z') - -ax.set_title('3D Test') - -# Creating the Animation object -line_ani = animation.FuncAnimation(fig, update_lines, 25, fargs=(data, lines), - interval=50, blit=False) - -plt.show() diff --git a/examples/animation/simple_anim.html b/examples/animation/simple_anim.html deleted file mode 100644 index 9c65c3b85f5..00000000000 --- a/examples/animation/simple_anim.html +++ /dev/null @@ -1,345 +0,0 @@ - - - - - - - - animation example code: simple_anim.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

animation example code: simple_anim.py

-

[source code]

-
"""
-A simple example of an animated plot
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.animation as animation
-
-fig, ax = plt.subplots()
-
-x = np.arange(0, 2*np.pi, 0.01)
-line, = ax.plot(x, np.sin(x))
-
-
-def animate(i):
-    line.set_ydata(np.sin(x + i/10.0))  # update the data
-    return line,
-
-
-# Init only required for blitting to give a clean slate.
-def init():
-    line.set_ydata(np.ma.array(x, mask=True))
-    return line,
-
-ani = animation.FuncAnimation(fig, animate, np.arange(1, 200), init_func=init,
-                              interval=25, blit=True)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/animation/simple_anim.py b/examples/animation/simple_anim.py deleted file mode 100644 index 730ad926868..00000000000 --- a/examples/animation/simple_anim.py +++ /dev/null @@ -1,26 +0,0 @@ -""" -A simple example of an animated plot -""" -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.animation as animation - -fig, ax = plt.subplots() - -x = np.arange(0, 2*np.pi, 0.01) -line, = ax.plot(x, np.sin(x)) - - -def animate(i): - line.set_ydata(np.sin(x + i/10.0)) # update the data - return line, - - -# Init only required for blitting to give a clean slate. -def init(): - line.set_ydata(np.ma.array(x, mask=True)) - return line, - -ani = animation.FuncAnimation(fig, animate, np.arange(1, 200), init_func=init, - interval=25, blit=True) -plt.show() diff --git a/examples/animation/simple_anim_gtk.html b/examples/animation/simple_anim_gtk.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/animation/simple_anim_gtk.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/animation/simple_anim_tkagg.html b/examples/animation/simple_anim_tkagg.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/animation/simple_anim_tkagg.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/animation/simple_idle_wx.html b/examples/animation/simple_idle_wx.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/animation/simple_idle_wx.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/animation/simple_timer_wx.html b/examples/animation/simple_timer_wx.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/animation/simple_timer_wx.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/animation/strip_chart_demo.html b/examples/animation/strip_chart_demo.html deleted file mode 100644 index db093ef4ce4..00000000000 --- a/examples/animation/strip_chart_demo.html +++ /dev/null @@ -1,377 +0,0 @@ - - - - - - - - animation example code: strip_chart_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

animation example code: strip_chart_demo.py

-

[source code]

-
"""
-============
-Oscilloscope
-============
-
-Emulates an oscilloscope.
-"""
-import numpy as np
-from matplotlib.lines import Line2D
-import matplotlib.pyplot as plt
-import matplotlib.animation as animation
-
-
-class Scope(object):
-    def __init__(self, ax, maxt=2, dt=0.02):
-        self.ax = ax
-        self.dt = dt
-        self.maxt = maxt
-        self.tdata = [0]
-        self.ydata = [0]
-        self.line = Line2D(self.tdata, self.ydata)
-        self.ax.add_line(self.line)
-        self.ax.set_ylim(-.1, 1.1)
-        self.ax.set_xlim(0, self.maxt)
-
-    def update(self, y):
-        lastt = self.tdata[-1]
-        if lastt > self.tdata[0] + self.maxt:  # reset the arrays
-            self.tdata = [self.tdata[-1]]
-            self.ydata = [self.ydata[-1]]
-            self.ax.set_xlim(self.tdata[0], self.tdata[0] + self.maxt)
-            self.ax.figure.canvas.draw()
-
-        t = self.tdata[-1] + self.dt
-        self.tdata.append(t)
-        self.ydata.append(y)
-        self.line.set_data(self.tdata, self.ydata)
-        return self.line,
-
-
-def emitter(p=0.03):
-    'return a random value with probability p, else 0'
-    while True:
-        v = np.random.rand(1)
-        if v > p:
-            yield 0.
-        else:
-            yield np.random.rand(1)
-
-fig, ax = plt.subplots()
-scope = Scope(ax)
-
-# pass a generator in "emitter" to produce data for the update func
-ani = animation.FuncAnimation(fig, scope.update, emitter, interval=10,
-                              blit=True)
-
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/animation/strip_chart_demo.py b/examples/animation/strip_chart_demo.py deleted file mode 100644 index 6beeaa99ba0..00000000000 --- a/examples/animation/strip_chart_demo.py +++ /dev/null @@ -1,58 +0,0 @@ -""" -============ -Oscilloscope -============ - -Emulates an oscilloscope. -""" -import numpy as np -from matplotlib.lines import Line2D -import matplotlib.pyplot as plt -import matplotlib.animation as animation - - -class Scope(object): - def __init__(self, ax, maxt=2, dt=0.02): - self.ax = ax - self.dt = dt - self.maxt = maxt - self.tdata = [0] - self.ydata = [0] - self.line = Line2D(self.tdata, self.ydata) - self.ax.add_line(self.line) - self.ax.set_ylim(-.1, 1.1) - self.ax.set_xlim(0, self.maxt) - - def update(self, y): - lastt = self.tdata[-1] - if lastt > self.tdata[0] + self.maxt: # reset the arrays - self.tdata = [self.tdata[-1]] - self.ydata = [self.ydata[-1]] - self.ax.set_xlim(self.tdata[0], self.tdata[0] + self.maxt) - self.ax.figure.canvas.draw() - - t = self.tdata[-1] + self.dt - self.tdata.append(t) - self.ydata.append(y) - self.line.set_data(self.tdata, self.ydata) - return self.line, - - -def emitter(p=0.03): - 'return a random value with probability p, else 0' - while True: - v = np.random.rand(1) - if v > p: - yield 0. - else: - yield np.random.rand(1) - -fig, ax = plt.subplots() -scope = Scope(ax) - -# pass a generator in "emitter" to produce data for the update func -ani = animation.FuncAnimation(fig, scope.update, emitter, interval=10, - blit=True) - - -plt.show() diff --git a/examples/animation/subplots.html b/examples/animation/subplots.html deleted file mode 100644 index 5ddf32665b0..00000000000 --- a/examples/animation/subplots.html +++ /dev/null @@ -1,423 +0,0 @@ - - - - - - - - animation example code: subplots.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

animation example code: subplots.py

-

[source code]

-
"""
-=================
-Animated subplots
-=================
-
-This example uses subclassing, but there is no reason that the proper function
-couldn't be set up and then use FuncAnimation. The code is long, but not
-really complex. The length is due solely to the fact that there are a total of
-9 lines that need to be changed for the animation as well as 3 subplots that
-need initial set up.
-
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.lines import Line2D
-import matplotlib.animation as animation
-
-
-class SubplotAnimation(animation.TimedAnimation):
-    def __init__(self):
-        fig = plt.figure()
-        ax1 = fig.add_subplot(1, 2, 1)
-        ax2 = fig.add_subplot(2, 2, 2)
-        ax3 = fig.add_subplot(2, 2, 4)
-
-        self.t = np.linspace(0, 80, 400)
-        self.x = np.cos(2 * np.pi * self.t / 10.)
-        self.y = np.sin(2 * np.pi * self.t / 10.)
-        self.z = 10 * self.t
-
-        ax1.set_xlabel('x')
-        ax1.set_ylabel('y')
-        self.line1 = Line2D([], [], color='black')
-        self.line1a = Line2D([], [], color='red', linewidth=2)
-        self.line1e = Line2D(
-            [], [], color='red', marker='o', markeredgecolor='r')
-        ax1.add_line(self.line1)
-        ax1.add_line(self.line1a)
-        ax1.add_line(self.line1e)
-        ax1.set_xlim(-1, 1)
-        ax1.set_ylim(-2, 2)
-        ax1.set_aspect('equal', 'datalim')
-
-        ax2.set_xlabel('y')
-        ax2.set_ylabel('z')
-        self.line2 = Line2D([], [], color='black')
-        self.line2a = Line2D([], [], color='red', linewidth=2)
-        self.line2e = Line2D(
-            [], [], color='red', marker='o', markeredgecolor='r')
-        ax2.add_line(self.line2)
-        ax2.add_line(self.line2a)
-        ax2.add_line(self.line2e)
-        ax2.set_xlim(-1, 1)
-        ax2.set_ylim(0, 800)
-
-        ax3.set_xlabel('x')
-        ax3.set_ylabel('z')
-        self.line3 = Line2D([], [], color='black')
-        self.line3a = Line2D([], [], color='red', linewidth=2)
-        self.line3e = Line2D(
-            [], [], color='red', marker='o', markeredgecolor='r')
-        ax3.add_line(self.line3)
-        ax3.add_line(self.line3a)
-        ax3.add_line(self.line3e)
-        ax3.set_xlim(-1, 1)
-        ax3.set_ylim(0, 800)
-
-        animation.TimedAnimation.__init__(self, fig, interval=50, blit=True)
-
-    def _draw_frame(self, framedata):
-        i = framedata
-        head = i - 1
-        head_slice = (self.t > self.t[i] - 1.0) & (self.t < self.t[i])
-
-        self.line1.set_data(self.x[:i], self.y[:i])
-        self.line1a.set_data(self.x[head_slice], self.y[head_slice])
-        self.line1e.set_data(self.x[head], self.y[head])
-
-        self.line2.set_data(self.y[:i], self.z[:i])
-        self.line2a.set_data(self.y[head_slice], self.z[head_slice])
-        self.line2e.set_data(self.y[head], self.z[head])
-
-        self.line3.set_data(self.x[:i], self.z[:i])
-        self.line3a.set_data(self.x[head_slice], self.z[head_slice])
-        self.line3e.set_data(self.x[head], self.z[head])
-
-        self._drawn_artists = [self.line1, self.line1a, self.line1e,
-                               self.line2, self.line2a, self.line2e,
-                               self.line3, self.line3a, self.line3e]
-
-    def new_frame_seq(self):
-        return iter(range(self.t.size))
-
-    def _init_draw(self):
-        lines = [self.line1, self.line1a, self.line1e,
-                 self.line2, self.line2a, self.line2e,
-                 self.line3, self.line3a, self.line3e]
-        for l in lines:
-            l.set_data([], [])
-
-ani = SubplotAnimation()
-# ani.save('test_sub.mp4')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/animation/subplots.py b/examples/animation/subplots.py deleted file mode 100644 index 9af8296471a..00000000000 --- a/examples/animation/subplots.py +++ /dev/null @@ -1,104 +0,0 @@ -""" -================= -Animated subplots -================= - -This example uses subclassing, but there is no reason that the proper function -couldn't be set up and then use FuncAnimation. The code is long, but not -really complex. The length is due solely to the fact that there are a total of -9 lines that need to be changed for the animation as well as 3 subplots that -need initial set up. - -""" - -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.lines import Line2D -import matplotlib.animation as animation - - -class SubplotAnimation(animation.TimedAnimation): - def __init__(self): - fig = plt.figure() - ax1 = fig.add_subplot(1, 2, 1) - ax2 = fig.add_subplot(2, 2, 2) - ax3 = fig.add_subplot(2, 2, 4) - - self.t = np.linspace(0, 80, 400) - self.x = np.cos(2 * np.pi * self.t / 10.) - self.y = np.sin(2 * np.pi * self.t / 10.) - self.z = 10 * self.t - - ax1.set_xlabel('x') - ax1.set_ylabel('y') - self.line1 = Line2D([], [], color='black') - self.line1a = Line2D([], [], color='red', linewidth=2) - self.line1e = Line2D( - [], [], color='red', marker='o', markeredgecolor='r') - ax1.add_line(self.line1) - ax1.add_line(self.line1a) - ax1.add_line(self.line1e) - ax1.set_xlim(-1, 1) - ax1.set_ylim(-2, 2) - ax1.set_aspect('equal', 'datalim') - - ax2.set_xlabel('y') - ax2.set_ylabel('z') - self.line2 = Line2D([], [], color='black') - self.line2a = Line2D([], [], color='red', linewidth=2) - self.line2e = Line2D( - [], [], color='red', marker='o', markeredgecolor='r') - ax2.add_line(self.line2) - ax2.add_line(self.line2a) - ax2.add_line(self.line2e) - ax2.set_xlim(-1, 1) - ax2.set_ylim(0, 800) - - ax3.set_xlabel('x') - ax3.set_ylabel('z') - self.line3 = Line2D([], [], color='black') - self.line3a = Line2D([], [], color='red', linewidth=2) - self.line3e = Line2D( - [], [], color='red', marker='o', markeredgecolor='r') - ax3.add_line(self.line3) - ax3.add_line(self.line3a) - ax3.add_line(self.line3e) - ax3.set_xlim(-1, 1) - ax3.set_ylim(0, 800) - - animation.TimedAnimation.__init__(self, fig, interval=50, blit=True) - - def _draw_frame(self, framedata): - i = framedata - head = i - 1 - head_slice = (self.t > self.t[i] - 1.0) & (self.t < self.t[i]) - - self.line1.set_data(self.x[:i], self.y[:i]) - self.line1a.set_data(self.x[head_slice], self.y[head_slice]) - self.line1e.set_data(self.x[head], self.y[head]) - - self.line2.set_data(self.y[:i], self.z[:i]) - self.line2a.set_data(self.y[head_slice], self.z[head_slice]) - self.line2e.set_data(self.y[head], self.z[head]) - - self.line3.set_data(self.x[:i], self.z[:i]) - self.line3a.set_data(self.x[head_slice], self.z[head_slice]) - self.line3e.set_data(self.x[head], self.z[head]) - - self._drawn_artists = [self.line1, self.line1a, self.line1e, - self.line2, self.line2a, self.line2e, - self.line3, self.line3a, self.line3e] - - def new_frame_seq(self): - return iter(range(self.t.size)) - - def _init_draw(self): - lines = [self.line1, self.line1a, self.line1e, - self.line2, self.line2a, self.line2e, - self.line3, self.line3a, self.line3e] - for l in lines: - l.set_data([], []) - -ani = SubplotAnimation() -# ani.save('test_sub.mp4') -plt.show() diff --git a/examples/animation/unchained.html b/examples/animation/unchained.html deleted file mode 100644 index 9c9bb9d104a..00000000000 --- a/examples/animation/unchained.html +++ /dev/null @@ -1,388 +0,0 @@ - - - - - - - - animation example code: unchained.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

animation example code: unchained.py

-

[source code]

-
"""
-========================
-MATPLOTLIB **UNCHAINED**
-========================
-
-Comparative path demonstration of frequency from a fake signal of a pulsar.
-(mostly known because of the cover for Joy Division's Unknown Pleasures)
-
-Author: Nicolas P. Rougier
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.animation as animation
-
-# Create new Figure with black background
-fig = plt.figure(figsize=(8, 8), facecolor='black')
-
-# Add a subplot with no frame
-ax = plt.subplot(111, frameon=False)
-
-# Generate random data
-data = np.random.uniform(0, 1, (64, 75))
-X = np.linspace(-1, 1, data.shape[-1])
-G = 1.5 * np.exp(-4 * X * X)
-
-# Generate line plots
-lines = []
-for i in range(len(data)):
-    # Small reduction of the X extents to get a cheap perspective effect
-    xscale = 1 - i / 200.
-    # Same for linewidth (thicker strokes on bottom)
-    lw = 1.5 - i / 100.0
-    line, = ax.plot(xscale * X, i + G * data[i], color="w", lw=lw)
-    lines.append(line)
-
-# Set y limit (or first line is cropped because of thickness)
-ax.set_ylim(-1, 70)
-
-# No ticks
-ax.set_xticks([])
-ax.set_yticks([])
-
-# 2 part titles to get different font weights
-ax.text(0.5, 1.0, "MATPLOTLIB ", transform=ax.transAxes,
-        ha="right", va="bottom", color="w",
-        family="sans-serif", fontweight="light", fontsize=16)
-ax.text(0.5, 1.0, "UNCHAINED", transform=ax.transAxes,
-        ha="left", va="bottom", color="w",
-        family="sans-serif", fontweight="bold", fontsize=16)
-
-
-def update(*args):
-    # Shift all data to the right
-    data[:, 1:] = data[:, :-1]
-
-    # Fill-in new values
-    data[:, 0] = np.random.uniform(0, 1, len(data))
-
-    # Update data
-    for i in range(len(data)):
-        lines[i].set_ydata(i + G * data[i])
-
-    # Return modified artists
-    return lines
-
-# Construct the animation, using the update function as the animation
-# director.
-anim = animation.FuncAnimation(fig, update, interval=10)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/animation/unchained.py b/examples/animation/unchained.py deleted file mode 100644 index c7af4896136..00000000000 --- a/examples/animation/unchained.py +++ /dev/null @@ -1,69 +0,0 @@ -""" -======================== -MATPLOTLIB **UNCHAINED** -======================== - -Comparative path demonstration of frequency from a fake signal of a pulsar. -(mostly known because of the cover for Joy Division's Unknown Pleasures) - -Author: Nicolas P. Rougier -""" -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.animation as animation - -# Create new Figure with black background -fig = plt.figure(figsize=(8, 8), facecolor='black') - -# Add a subplot with no frame -ax = plt.subplot(111, frameon=False) - -# Generate random data -data = np.random.uniform(0, 1, (64, 75)) -X = np.linspace(-1, 1, data.shape[-1]) -G = 1.5 * np.exp(-4 * X * X) - -# Generate line plots -lines = [] -for i in range(len(data)): - # Small reduction of the X extents to get a cheap perspective effect - xscale = 1 - i / 200. - # Same for linewidth (thicker strokes on bottom) - lw = 1.5 - i / 100.0 - line, = ax.plot(xscale * X, i + G * data[i], color="w", lw=lw) - lines.append(line) - -# Set y limit (or first line is cropped because of thickness) -ax.set_ylim(-1, 70) - -# No ticks -ax.set_xticks([]) -ax.set_yticks([]) - -# 2 part titles to get different font weights -ax.text(0.5, 1.0, "MATPLOTLIB ", transform=ax.transAxes, - ha="right", va="bottom", color="w", - family="sans-serif", fontweight="light", fontsize=16) -ax.text(0.5, 1.0, "UNCHAINED", transform=ax.transAxes, - ha="left", va="bottom", color="w", - family="sans-serif", fontweight="bold", fontsize=16) - - -def update(*args): - # Shift all data to the right - data[:, 1:] = data[:, :-1] - - # Fill-in new values - data[:, 0] = np.random.uniform(0, 1, len(data)) - - # Update data - for i in range(len(data)): - lines[i].set_ydata(i + G * data[i]) - - # Return modified artists - return lines - -# Construct the animation, using the update function as the animation -# director. -anim = animation.FuncAnimation(fig, update, interval=10) -plt.show() diff --git a/examples/api/agg_oo.html b/examples/api/agg_oo.html deleted file mode 100644 index c09d1c47c50..00000000000 --- a/examples/api/agg_oo.html +++ /dev/null @@ -1,339 +0,0 @@ - - - - - - - - api example code: agg_oo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: agg_oo.py

-

[source code]

-
# -*- noplot -*-
-"""
-=============================
-The object-oriented interface
-=============================
-
-A pure OO (look Ma, no pylab!) example using the agg backend
-"""
-from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
-from matplotlib.figure import Figure
-
-fig = Figure()
-canvas = FigureCanvas(fig)
-ax = fig.add_subplot(111)
-ax.plot([1, 2, 3])
-ax.set_title('hi mom')
-ax.grid(True)
-ax.set_xlabel('time')
-ax.set_ylabel('volts')
-canvas.print_figure('test')
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/agg_oo.py b/examples/api/agg_oo.py deleted file mode 100644 index c5832a213e5..00000000000 --- a/examples/api/agg_oo.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- noplot -*- -""" -============================= -The object-oriented interface -============================= - -A pure OO (look Ma, no pylab!) example using the agg backend -""" -from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas -from matplotlib.figure import Figure - -fig = Figure() -canvas = FigureCanvas(fig) -ax = fig.add_subplot(111) -ax.plot([1, 2, 3]) -ax.set_title('hi mom') -ax.grid(True) -ax.set_xlabel('time') -ax.set_ylabel('volts') -canvas.print_figure('test') diff --git a/examples/api/barchart_demo.html b/examples/api/barchart_demo.html deleted file mode 100644 index aa1a9997a46..00000000000 --- a/examples/api/barchart_demo.html +++ /dev/null @@ -1,369 +0,0 @@ - - - - - - - - api example code: barchart_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: barchart_demo.py

-

(Source code, png, pdf)

-
-../../_images/barchart_demo1.png -
-
"""
-========
-Barchart
-========
-
-A bar plot with errorbars and height labels on individual bars
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-N = 5
-men_means = (20, 35, 30, 35, 27)
-men_std = (2, 3, 4, 1, 2)
-
-ind = np.arange(N)  # the x locations for the groups
-width = 0.35       # the width of the bars
-
-fig, ax = plt.subplots()
-rects1 = ax.bar(ind, men_means, width, color='r', yerr=men_std)
-
-women_means = (25, 32, 34, 20, 25)
-women_std = (3, 5, 2, 3, 3)
-rects2 = ax.bar(ind + width, women_means, width, color='y', yerr=women_std)
-
-# add some text for labels, title and axes ticks
-ax.set_ylabel('Scores')
-ax.set_title('Scores by group and gender')
-ax.set_xticks(ind + width / 2)
-ax.set_xticklabels(('G1', 'G2', 'G3', 'G4', 'G5'))
-
-ax.legend((rects1[0], rects2[0]), ('Men', 'Women'))
-
-
-def autolabel(rects):
-    """
-    Attach a text label above each bar displaying its height
-    """
-    for rect in rects:
-        height = rect.get_height()
-        ax.text(rect.get_x() + rect.get_width()/2., 1.05*height,
-                '%d' % int(height),
-                ha='center', va='bottom')
-
-autolabel(rects1)
-autolabel(rects2)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/bbox_intersect.html b/examples/api/bbox_intersect.html deleted file mode 100644 index cef923d8a3a..00000000000 --- a/examples/api/bbox_intersect.html +++ /dev/null @@ -1,355 +0,0 @@ - - - - - - - - api example code: bbox_intersect.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: bbox_intersect.py

-

(Source code, png, pdf)

-
-../../_images/bbox_intersect.png -
-
"""
-===========================================
-Changing colors of lines intersecting a box
-===========================================
-
-The lines intersecting the rectangle are colored in red, while the others
-are left as blue lines. This example showcases the `intersect_bbox` function.
-
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.transforms import Bbox
-from matplotlib.path import Path
-
-left, bottom, width, height = (-1, -1, 2, 2)
-rect = plt.Rectangle((left, bottom), width, height, facecolor="#aaaaaa")
-
-fig, ax = plt.subplots()
-ax.add_patch(rect)
-
-bbox = Bbox.from_bounds(left, bottom, width, height)
-
-for i in range(12):
-    vertices = (np.random.random((2, 2)) - 0.5) * 6.0
-    path = Path(vertices)
-    if path.intersects_bbox(bbox):
-        color = 'r'
-    else:
-        color = 'b'
-    ax.plot(vertices[:, 0], vertices[:, 1], color=color)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/collections_demo.html b/examples/api/collections_demo.html deleted file mode 100644 index 8c20f10f803..00000000000 --- a/examples/api/collections_demo.html +++ /dev/null @@ -1,450 +0,0 @@ - - - - - - - - api example code: collections_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: collections_demo.py

-

(Source code, png, pdf)

-
-../../_images/collections_demo.png -
-
'''
-=========================================================
-Line, Poly and RegularPoly Collection with autoscaling
-=========================================================
-
-For the first two subplots, we will use spirals.  Their
-size will be set in plot units, not data units.  Their positions
-will be set in data units by using the "offsets" and "transOffset"
-kwargs of the LineCollection and PolyCollection.
-
-The third subplot will make regular polygons, with the same
-type of scaling and positioning as in the first two.
-
-The last subplot illustrates the use of "offsets=(xo,yo)",
-that is, a single tuple instead of a list of tuples, to generate
-successively offset curves, with the offset given in data
-units.  This behavior is available only for the LineCollection.
-
-'''
-
-import matplotlib.pyplot as plt
-from matplotlib import collections, colors, transforms
-import numpy as np
-
-nverts = 50
-npts = 100
-
-# Make some spirals
-r = np.arange(nverts)
-theta = np.linspace(0, 2*np.pi, nverts)
-xx = r * np.sin(theta)
-yy = r * np.cos(theta)
-spiral = list(zip(xx, yy))
-
-# Make some offsets
-rs = np.random.RandomState([12345678])
-xo = rs.randn(npts)
-yo = rs.randn(npts)
-xyo = list(zip(xo, yo))
-
-# Make a list of colors cycling through the default series.
-colors = [colors.to_rgba(c)
-          for c in plt.rcParams['axes.prop_cycle'].by_key()['color']]
-
-fig, axes = plt.subplots(2, 2)
-fig.subplots_adjust(top=0.92, left=0.07, right=0.97,
-                    hspace=0.3, wspace=0.3)
-((ax1, ax2), (ax3, ax4)) = axes  # unpack the axes
-
-
-col = collections.LineCollection([spiral], offsets=xyo,
-                                 transOffset=ax1.transData)
-trans = fig.dpi_scale_trans + transforms.Affine2D().scale(1.0/72.0)
-col.set_transform(trans)  # the points to pixels transform
-# Note: the first argument to the collection initializer
-# must be a list of sequences of x,y tuples; we have only
-# one sequence, but we still have to put it in a list.
-ax1.add_collection(col, autolim=True)
-# autolim=True enables autoscaling.  For collections with
-# offsets like this, it is neither efficient nor accurate,
-# but it is good enough to generate a plot that you can use
-# as a starting point.  If you know beforehand the range of
-# x and y that you want to show, it is better to set them
-# explicitly, leave out the autolim kwarg (or set it to False),
-# and omit the 'ax1.autoscale_view()' call below.
-
-# Make a transform for the line segments such that their size is
-# given in points:
-col.set_color(colors)
-
-ax1.autoscale_view()  # See comment above, after ax1.add_collection.
-ax1.set_title('LineCollection using offsets')
-
-
-# The same data as above, but fill the curves.
-col = collections.PolyCollection([spiral], offsets=xyo,
-                                 transOffset=ax2.transData)
-trans = transforms.Affine2D().scale(fig.dpi/72.0)
-col.set_transform(trans)  # the points to pixels transform
-ax2.add_collection(col, autolim=True)
-col.set_color(colors)
-
-
-ax2.autoscale_view()
-ax2.set_title('PolyCollection using offsets')
-
-# 7-sided regular polygons
-
-col = collections.RegularPolyCollection(7,
-                                        sizes=np.fabs(xx) * 10.0, offsets=xyo,
-                                        transOffset=ax3.transData)
-trans = transforms.Affine2D().scale(fig.dpi / 72.0)
-col.set_transform(trans)  # the points to pixels transform
-ax3.add_collection(col, autolim=True)
-col.set_color(colors)
-ax3.autoscale_view()
-ax3.set_title('RegularPolyCollection using offsets')
-
-
-# Simulate a series of ocean current profiles, successively
-# offset by 0.1 m/s so that they form what is sometimes called
-# a "waterfall" plot or a "stagger" plot.
-
-nverts = 60
-ncurves = 20
-offs = (0.1, 0.0)
-
-yy = np.linspace(0, 2*np.pi, nverts)
-ym = np.amax(yy)
-xx = (0.2 + (ym - yy)/ym)**2 * np.cos(yy - 0.4)*0.5
-segs = []
-for i in range(ncurves):
-    xxx = xx + 0.02*rs.randn(nverts)
-    curve = list(zip(xxx, yy*100))
-    segs.append(curve)
-
-col = collections.LineCollection(segs, offsets=offs)
-ax4.add_collection(col, autolim=True)
-col.set_color(colors)
-ax4.autoscale_view()
-ax4.set_title('Successive data offsets')
-ax4.set_xlabel('Zonal velocity component (m/s)')
-ax4.set_ylabel('Depth (m)')
-# Reverse the y-axis so depth increases downward
-ax4.set_ylim(ax4.get_ylim()[::-1])
-
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/colorbar_basics.html b/examples/api/colorbar_basics.html deleted file mode 100644 index 7a9d8a42e80..00000000000 --- a/examples/api/colorbar_basics.html +++ /dev/null @@ -1,359 +0,0 @@ - - - - - - - - api example code: colorbar_basics.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: colorbar_basics.py

-

(Source code, png, pdf)

-
-../../_images/colorbar_basics.png -
-
"""
-========
-Colorbar
-========
-
-This example shows how to use colorbar by specifying the mappable object (here
-the imshow returned object) and the axes to attach the colorbar to.
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-
-# setup some generic data
-N = 37
-x, y = np.mgrid[:N, :N]
-Z = (np.cos(x*0.2) + np.sin(y*0.3))
-
-# mask out the negative and positve values, respectively
-Zpos = np.ma.masked_less(Z, 0)
-Zneg = np.ma.masked_greater(Z, 0)
-
-fig, (ax1, ax2) = plt.subplots(figsize=(8, 3), ncols=2)
-
-# plot just the positive data and save the
-# color "mappable" object returned by ax1.imshow
-pos = ax1.imshow(Zpos, cmap='Blues', interpolation='none')
-
-# add the colorbar using the figure's method,
-# telling which mappable we're talking about and
-# which axes object it should be near
-fig.colorbar(pos, ax=ax1)
-
-# repeat everything above for the the negative data
-neg = ax2.imshow(Zneg, cmap='Reds_r', interpolation='none')
-fig.colorbar(neg, ax=ax2)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/colorbar_only.html b/examples/api/colorbar_only.html deleted file mode 100644 index d7f07787e90..00000000000 --- a/examples/api/colorbar_only.html +++ /dev/null @@ -1,400 +0,0 @@ - - - - - - - - api example code: colorbar_only.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: colorbar_only.py

-

(Source code, png, pdf)

-
-../../_images/colorbar_only.png -
-
'''
-====================
-Customized colorbars
-====================
-
-This example shows how to build colorbars without an attached mappable.
-'''
-
-import matplotlib.pyplot as plt
-import matplotlib as mpl
-
-# Make a figure and axes with dimensions as desired.
-fig = plt.figure(figsize=(8, 3))
-ax1 = fig.add_axes([0.05, 0.80, 0.9, 0.15])
-ax2 = fig.add_axes([0.05, 0.475, 0.9, 0.15])
-ax3 = fig.add_axes([0.05, 0.15, 0.9, 0.15])
-
-# Set the colormap and norm to correspond to the data for which
-# the colorbar will be used.
-cmap = mpl.cm.cool
-norm = mpl.colors.Normalize(vmin=5, vmax=10)
-
-# ColorbarBase derives from ScalarMappable and puts a colorbar
-# in a specified axes, so it has everything needed for a
-# standalone colorbar.  There are many more kwargs, but the
-# following gives a basic continuous colorbar with ticks
-# and labels.
-cb1 = mpl.colorbar.ColorbarBase(ax1, cmap=cmap,
-                                norm=norm,
-                                orientation='horizontal')
-cb1.set_label('Some Units')
-
-# The second example illustrates the use of a ListedColormap, a
-# BoundaryNorm, and extended ends to show the "over" and "under"
-# value colors.
-cmap = mpl.colors.ListedColormap(['r', 'g', 'b', 'c'])
-cmap.set_over('0.25')
-cmap.set_under('0.75')
-
-# If a ListedColormap is used, the length of the bounds array must be
-# one greater than the length of the color list.  The bounds must be
-# monotonically increasing.
-bounds = [1, 2, 4, 7, 8]
-norm = mpl.colors.BoundaryNorm(bounds, cmap.N)
-cb2 = mpl.colorbar.ColorbarBase(ax2, cmap=cmap,
-                                norm=norm,
-                                # to use 'extend', you must
-                                # specify two extra boundaries:
-                                boundaries=[0] + bounds + [13],
-                                extend='both',
-                                ticks=bounds,  # optional
-                                spacing='proportional',
-                                orientation='horizontal')
-cb2.set_label('Discrete intervals, some other units')
-
-# The third example illustrates the use of custom length colorbar
-# extensions, used on a colorbar with discrete intervals.
-cmap = mpl.colors.ListedColormap([[0., .4, 1.], [0., .8, 1.],
-                                  [1., .8, 0.], [1., .4, 0.]])
-cmap.set_over((1., 0., 0.))
-cmap.set_under((0., 0., 1.))
-
-bounds = [-1., -.5, 0., .5, 1.]
-norm = mpl.colors.BoundaryNorm(bounds, cmap.N)
-cb3 = mpl.colorbar.ColorbarBase(ax3, cmap=cmap,
-                                norm=norm,
-                                boundaries=[-10] + bounds + [10],
-                                extend='both',
-                                # Make the length of each extension
-                                # the same as the length of the
-                                # interior colors:
-                                extendfrac='auto',
-                                ticks=bounds,
-                                spacing='uniform',
-                                orientation='horizontal')
-cb3.set_label('Custom extension lengths, some other units')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/compound_path.html b/examples/api/compound_path.html deleted file mode 100644 index 68d181bb926..00000000000 --- a/examples/api/compound_path.html +++ /dev/null @@ -1,360 +0,0 @@ - - - - - - - - api example code: compound_path.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: compound_path.py

-

(Source code, png, pdf)

-
-../../_images/compound_path.png -
-
"""
-=============
-Compound path
-=============
-
-Make a compound path -- in this case two simple polygons, a rectangle
-and a triangle.  Use CLOSEPOLY and MOVETO for the different parts of
-the compound path
-"""
-import numpy as np
-from matplotlib.path import Path
-from matplotlib.patches import PathPatch
-import matplotlib.pyplot as plt
-
-
-vertices = []
-codes = []
-
-codes = [Path.MOVETO] + [Path.LINETO]*3 + [Path.CLOSEPOLY]
-vertices = [(1, 1), (1, 2), (2, 2), (2, 1), (0, 0)]
-
-codes += [Path.MOVETO] + [Path.LINETO]*2 + [Path.CLOSEPOLY]
-vertices += [(4, 4), (5, 5), (5, 4), (0, 0)]
-
-vertices = np.array(vertices, float)
-path = Path(vertices, codes)
-
-pathpatch = PathPatch(path, facecolor='None', edgecolor='green')
-
-fig, ax = plt.subplots()
-ax.add_patch(pathpatch)
-ax.set_title('A compound path')
-
-ax.dataLim.update_from_data_xy(vertices)
-ax.autoscale_view()
-
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/custom_projection_example.html b/examples/api/custom_projection_example.html deleted file mode 100644 index e91489b5061..00000000000 --- a/examples/api/custom_projection_example.html +++ /dev/null @@ -1,799 +0,0 @@ - - - - - - - - api example code: custom_projection_example.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: custom_projection_example.py

-

(Source code, png, pdf)

-
-../../_images/custom_projection_example.png -
-
"""
-=================
-Custom projection
-=================
-
-This example showcases the Hammer projection by alleviating many features of
-matplotlib.
-"""
-
-
-from __future__ import unicode_literals
-
-import matplotlib
-from matplotlib.axes import Axes
-from matplotlib.patches import Circle
-from matplotlib.path import Path
-from matplotlib.ticker import NullLocator, Formatter, FixedLocator
-from matplotlib.transforms import Affine2D, BboxTransformTo, Transform
-from matplotlib.projections import register_projection
-import matplotlib.spines as mspines
-import matplotlib.axis as maxis
-import numpy as np
-
-rcParams = matplotlib.rcParams
-
-# This example projection class is rather long, but it is designed to
-# illustrate many features, not all of which will be used every time.
-# It is also common to factor out a lot of these methods into common
-# code used by a number of projections with similar characteristics
-# (see geo.py).
-
-
-class GeoAxes(Axes):
-    """
-    An abstract base class for geographic projections
-    """
-    class ThetaFormatter(Formatter):
-        """
-        Used to format the theta tick labels.  Converts the native
-        unit of radians into degrees and adds a degree symbol.
-        """
-        def __init__(self, round_to=1.0):
-            self._round_to = round_to
-
-        def __call__(self, x, pos=None):
-            degrees = (x / np.pi) * 180.0
-            degrees = np.round(degrees / self._round_to) * self._round_to
-            if rcParams['text.usetex'] and not rcParams['text.latex.unicode']:
-                return r"$%0.0f^\circ$" % degrees
-            else:
-                return "%0.0f\u00b0" % degrees
-
-    RESOLUTION = 75
-
-    def _init_axis(self):
-        self.xaxis = maxis.XAxis(self)
-        self.yaxis = maxis.YAxis(self)
-        # Do not register xaxis or yaxis with spines -- as done in
-        # Axes._init_axis() -- until GeoAxes.xaxis.cla() works.
-        # self.spines['geo'].register_axis(self.yaxis)
-        self._update_transScale()
-
-    def cla(self):
-        Axes.cla(self)
-
-        self.set_longitude_grid(30)
-        self.set_latitude_grid(15)
-        self.set_longitude_grid_ends(75)
-        self.xaxis.set_minor_locator(NullLocator())
-        self.yaxis.set_minor_locator(NullLocator())
-        self.xaxis.set_ticks_position('none')
-        self.yaxis.set_ticks_position('none')
-        self.yaxis.set_tick_params(label1On=True)
-        # Why do we need to turn on yaxis tick labels, but
-        # xaxis tick labels are already on?
-
-        self.grid(rcParams['axes.grid'])
-
-        Axes.set_xlim(self, -np.pi, np.pi)
-        Axes.set_ylim(self, -np.pi / 2.0, np.pi / 2.0)
-
-    def _set_lim_and_transforms(self):
-        # A (possibly non-linear) projection on the (already scaled) data
-
-        # There are three important coordinate spaces going on here:
-        #
-        #    1. Data space: The space of the data itself
-        #
-        #    2. Axes space: The unit rectangle (0, 0) to (1, 1)
-        #       covering the entire plot area.
-        #
-        #    3. Display space: The coordinates of the resulting image,
-        #       often in pixels or dpi/inch.
-
-        # This function makes heavy use of the Transform classes in
-        # ``lib/matplotlib/transforms.py.`` For more information, see
-        # the inline documentation there.
-
-        # The goal of the first two transformations is to get from the
-        # data space (in this case longitude and latitude) to axes
-        # space.  It is separated into a non-affine and affine part so
-        # that the non-affine part does not have to be recomputed when
-        # a simple affine change to the figure has been made (such as
-        # resizing the window or changing the dpi).
-
-        # 1) The core transformation from data space into
-        # rectilinear space defined in the HammerTransform class.
-        self.transProjection = self._get_core_transform(self.RESOLUTION)
-
-        # 2) The above has an output range that is not in the unit
-        # rectangle, so scale and translate it so it fits correctly
-        # within the axes.  The peculiar calculations of xscale and
-        # yscale are specific to a Aitoff-Hammer projection, so don't
-        # worry about them too much.
-        self.transAffine = self._get_affine_transform()
-
-        # 3) This is the transformation from axes space to display
-        # space.
-        self.transAxes = BboxTransformTo(self.bbox)
-
-        # Now put these 3 transforms together -- from data all the way
-        # to display coordinates.  Using the '+' operator, these
-        # transforms will be applied "in order".  The transforms are
-        # automatically simplified, if possible, by the underlying
-        # transformation framework.
-        self.transData = \
-            self.transProjection + \
-            self.transAffine + \
-            self.transAxes
-
-        # The main data transformation is set up.  Now deal with
-        # gridlines and tick labels.
-
-        # Longitude gridlines and ticklabels.  The input to these
-        # transforms are in display space in x and axes space in y.
-        # Therefore, the input values will be in range (-xmin, 0),
-        # (xmax, 1).  The goal of these transforms is to go from that
-        # space to display space.  The tick labels will be offset 4
-        # pixels from the equator.
-        self._xaxis_pretransform = \
-            Affine2D() \
-            .scale(1.0, self._longitude_cap * 2.0) \
-            .translate(0.0, -self._longitude_cap)
-        self._xaxis_transform = \
-            self._xaxis_pretransform + \
-            self.transData
-        self._xaxis_text1_transform = \
-            Affine2D().scale(1.0, 0.0) + \
-            self.transData + \
-            Affine2D().translate(0.0, 4.0)
-        self._xaxis_text2_transform = \
-            Affine2D().scale(1.0, 0.0) + \
-            self.transData + \
-            Affine2D().translate(0.0, -4.0)
-
-        # Now set up the transforms for the latitude ticks.  The input to
-        # these transforms are in axes space in x and display space in
-        # y.  Therefore, the input values will be in range (0, -ymin),
-        # (1, ymax).  The goal of these transforms is to go from that
-        # space to display space.  The tick labels will be offset 4
-        # pixels from the edge of the axes ellipse.
-        yaxis_stretch = Affine2D().scale(np.pi*2, 1).translate(-np.pi, 0)
-        yaxis_space = Affine2D().scale(1.0, 1.1)
-        self._yaxis_transform = \
-            yaxis_stretch + \
-            self.transData
-        yaxis_text_base = \
-            yaxis_stretch + \
-            self.transProjection + \
-            (yaxis_space +
-             self.transAffine +
-             self.transAxes)
-        self._yaxis_text1_transform = \
-            yaxis_text_base + \
-            Affine2D().translate(-8.0, 0.0)
-        self._yaxis_text2_transform = \
-            yaxis_text_base + \
-            Affine2D().translate(8.0, 0.0)
-
-    def _get_affine_transform(self):
-        transform = self._get_core_transform(1)
-        xscale, _ = transform.transform_point((np.pi, 0))
-        _, yscale = transform.transform_point((0, np.pi / 2.0))
-        return Affine2D() \
-            .scale(0.5 / xscale, 0.5 / yscale) \
-            .translate(0.5, 0.5)
-
-    def get_xaxis_transform(self, which='grid'):
-        """
-        Override this method to provide a transformation for the
-        x-axis tick labels.
-
-        Returns a tuple of the form (transform, valign, halign)
-        """
-        if which not in ['tick1', 'tick2', 'grid']:
-            msg = "'which' must be on of [ 'tick1' | 'tick2' | 'grid' ]"
-            raise ValueError(msg)
-        return self._xaxis_transform
-
-    def get_xaxis_text1_transform(self, pad):
-        return self._xaxis_text1_transform, 'bottom', 'center'
-
-    def get_xaxis_text2_transform(self, pad):
-        """
-        Override this method to provide a transformation for the
-        secondary x-axis tick labels.
-
-        Returns a tuple of the form (transform, valign, halign)
-        """
-        return self._xaxis_text2_transform, 'top', 'center'
-
-    def get_yaxis_transform(self, which='grid'):
-        """
-        Override this method to provide a transformation for the
-        y-axis grid and ticks.
-        """
-        if which not in ['tick1', 'tick2', 'grid']:
-            msg = "'which' must be one of [ 'tick1' | 'tick2' | 'grid' ]"
-            raise ValueError(msg)
-        return self._yaxis_transform
-
-    def get_yaxis_text1_transform(self, pad):
-        """
-        Override this method to provide a transformation for the
-        y-axis tick labels.
-
-        Returns a tuple of the form (transform, valign, halign)
-        """
-        return self._yaxis_text1_transform, 'center', 'right'
-
-    def get_yaxis_text2_transform(self, pad):
-        """
-        Override this method to provide a transformation for the
-        secondary y-axis tick labels.
-
-        Returns a tuple of the form (transform, valign, halign)
-        """
-        return self._yaxis_text2_transform, 'center', 'left'
-
-    def _gen_axes_patch(self):
-        """
-        Override this method to define the shape that is used for the
-        background of the plot.  It should be a subclass of Patch.
-
-        In this case, it is a Circle (that may be warped by the axes
-        transform into an ellipse).  Any data and gridlines will be
-        clipped to this shape.
-        """
-        return Circle((0.5, 0.5), 0.5)
-
-    def _gen_axes_spines(self):
-        return {'geo': mspines.Spine.circular_spine(self, (0.5, 0.5), 0.5)}
-
-    def set_yscale(self, *args, **kwargs):
-        if args[0] != 'linear':
-            raise NotImplementedError
-
-    # Prevent the user from applying scales to one or both of the
-    # axes.  In this particular case, scaling the axes wouldn't make
-    # sense, so we don't allow it.
-    set_xscale = set_yscale
-
-    # Prevent the user from changing the axes limits.  In our case, we
-    # want to display the whole sphere all the time, so we override
-    # set_xlim and set_ylim to ignore any input.  This also applies to
-    # interactive panning and zooming in the GUI interfaces.
-    def set_xlim(self, *args, **kwargs):
-        raise TypeError("It is not possible to change axes limits "
-                        "for geographic projections. Please consider "
-                        "using Basemap or Cartopy.")
-
-    set_ylim = set_xlim
-
-    def format_coord(self, lon, lat):
-        """
-        Override this method to change how the values are displayed in
-        the status bar.
-
-        In this case, we want them to be displayed in degrees N/S/E/W.
-        """
-        lon = lon * (180.0 / np.pi)
-        lat = lat * (180.0 / np.pi)
-        if lat >= 0.0:
-            ns = 'N'
-        else:
-            ns = 'S'
-        if lon >= 0.0:
-            ew = 'E'
-        else:
-            ew = 'W'
-        return '%f\u00b0%s, %f\u00b0%s' % (abs(lat), ns, abs(lon), ew)
-
-    def set_longitude_grid(self, degrees):
-        """
-        Set the number of degrees between each longitude grid.
-
-        This is an example method that is specific to this projection
-        class -- it provides a more convenient interface to set the
-        ticking than set_xticks would.
-        """
-        number = (360.0 / degrees) + 1
-        self.xaxis.set_major_locator(
-            FixedLocator(
-                np.linspace(-np.pi, np.pi, number, True)[1:-1]))
-        self.xaxis.set_major_formatter(self.ThetaFormatter(degrees))
-
-    def set_latitude_grid(self, degrees):
-        """
-        Set the number of degrees between each longitude grid.
-
-        This is an example method that is specific to this projection
-        class -- it provides a more convenient interface than
-        set_yticks would.
-        """
-        number = (180.0 / degrees) + 1
-        self.yaxis.set_major_locator(
-            FixedLocator(
-                np.linspace(-np.pi / 2.0, np.pi / 2.0, number, True)[1:-1]))
-        self.yaxis.set_major_formatter(self.ThetaFormatter(degrees))
-
-    def set_longitude_grid_ends(self, degrees):
-        """
-        Set the latitude(s) at which to stop drawing the longitude grids.
-
-        Often, in geographic projections, you wouldn't want to draw
-        longitude gridlines near the poles.  This allows the user to
-        specify the degree at which to stop drawing longitude grids.
-
-        This is an example method that is specific to this projection
-        class -- it provides an interface to something that has no
-        analogy in the base Axes class.
-        """
-        self._longitude_cap = degrees * (np.pi / 180.0)
-        self._xaxis_pretransform \
-            .clear() \
-            .scale(1.0, self._longitude_cap * 2.0) \
-            .translate(0.0, -self._longitude_cap)
-
-    def get_data_ratio(self):
-        """
-        Return the aspect ratio of the data itself.
-
-        This method should be overridden by any Axes that have a
-        fixed data ratio.
-        """
-        return 1.0
-
-    # Interactive panning and zooming is not supported with this projection,
-    # so we override all of the following methods to disable it.
-    def can_zoom(self):
-        """
-        Return *True* if this axes supports the zoom box button functionality.
-        This axes object does not support interactive zoom box.
-        """
-        return False
-
-    def can_pan(self):
-        """
-        Return *True* if this axes supports the pan/zoom button functionality.
-        This axes object does not support interactive pan/zoom.
-        """
-        return False
-
-    def start_pan(self, x, y, button):
-        pass
-
-    def end_pan(self):
-        pass
-
-    def drag_pan(self, button, key, x, y):
-        pass
-
-
-class HammerAxes(GeoAxes):
-    """
-    A custom class for the Aitoff-Hammer projection, an equal-area map
-    projection.
-
-    https://en.wikipedia.org/wiki/Hammer_projection
-    """
-
-    # The projection must specify a name. This will be used by the
-    # user to select the projection,
-    # i.e. ``subplot(111, projection='custom_hammer')``.
-    name = 'custom_hammer'
-
-    class HammerTransform(Transform):
-        """
-        The base Hammer transform.
-        """
-        input_dims = 2
-        output_dims = 2
-        is_separable = False
-
-        def __init__(self, resolution):
-            """
-            Create a new Hammer transform.  Resolution is the number of steps
-            to interpolate between each input line segment to approximate its
-            path in curved Hammer space.
-            """
-            Transform.__init__(self)
-            self._resolution = resolution
-
-        def transform_non_affine(self, ll):
-            longitude = ll[:, 0:1]
-            latitude = ll[:, 1:2]
-
-            # Pre-compute some values
-            half_long = longitude / 2.0
-            cos_latitude = np.cos(latitude)
-            sqrt2 = np.sqrt(2.0)
-
-            alpha = np.sqrt(1.0 + cos_latitude * np.cos(half_long))
-            x = (2.0 * sqrt2) * (cos_latitude * np.sin(half_long)) / alpha
-            y = (sqrt2 * np.sin(latitude)) / alpha
-            return np.concatenate((x, y), 1)
-        transform_non_affine.__doc__ = Transform.transform_non_affine.__doc__
-
-        def transform_path_non_affine(self, path):
-            # vertices = path.vertices
-            ipath = path.interpolated(self._resolution)
-            return Path(self.transform(ipath.vertices), ipath.codes)
-        transform_path_non_affine.__doc__ = \
-            Transform.transform_path_non_affine.__doc__
-
-        def inverted(self):
-            return HammerAxes.InvertedHammerTransform(self._resolution)
-        inverted.__doc__ = Transform.inverted.__doc__
-
-    class InvertedHammerTransform(Transform):
-        input_dims = 2
-        output_dims = 2
-        is_separable = False
-
-        def __init__(self, resolution):
-            Transform.__init__(self)
-            self._resolution = resolution
-
-        def transform_non_affine(self, xy):
-            x = xy[:, 0:1]
-            y = xy[:, 1:2]
-
-            quarter_x = 0.25 * x
-            half_y = 0.5 * y
-            z = np.sqrt(1.0 - quarter_x*quarter_x - half_y*half_y)
-            longitude = 2 * np.arctan((z*x) / (2.0 * (2.0*z*z - 1.0)))
-            latitude = np.arcsin(y*z)
-            return np.concatenate((longitude, latitude), 1)
-        transform_non_affine.__doc__ = Transform.transform_non_affine.__doc__
-
-        def inverted(self):
-            return HammerAxes.HammerTransform(self._resolution)
-        inverted.__doc__ = Transform.inverted.__doc__
-
-    def __init__(self, *args, **kwargs):
-        self._longitude_cap = np.pi / 2.0
-        GeoAxes.__init__(self, *args, **kwargs)
-        self.set_aspect(0.5, adjustable='box', anchor='C')
-        self.cla()
-
-    def _get_core_transform(self, resolution):
-        return self.HammerTransform(resolution)
-
-
-# Now register the projection with matplotlib so the user can select
-# it.
-register_projection(HammerAxes)
-
-
-if __name__ == '__main__':
-    import matplotlib.pyplot as plt
-    # Now make a simple example using the custom projection.
-    plt.subplot(111, projection="custom_hammer")
-    p = plt.plot([-1, 1, 1], [-1, -1, 1], "o-")
-    plt.grid(True)
-
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/custom_scale_example.html b/examples/api/custom_scale_example.html deleted file mode 100644 index eae79e861f8..00000000000 --- a/examples/api/custom_scale_example.html +++ /dev/null @@ -1,508 +0,0 @@ - - - - - - - - api example code: custom_scale_example.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: custom_scale_example.py

-

(Source code, png, pdf)

-
-../../_images/custom_scale_example.png -
-
"""
-============
-Custom scale
-============
-
-This example showcases how to create a custom scale, by implementing the
-scaling use for latitude data in a Mercator Projection.
-"""
-
-
-from __future__ import unicode_literals
-
-import numpy as np
-from numpy import ma
-from matplotlib import scale as mscale
-from matplotlib import transforms as mtransforms
-from matplotlib.ticker import Formatter, FixedLocator
-from matplotlib import rcParams
-
-
-# BUG: this example fails with any other setting of axisbelow
-rcParams['axes.axisbelow'] = False
-
-
-class MercatorLatitudeScale(mscale.ScaleBase):
-    """
-    Scales data in range -pi/2 to pi/2 (-90 to 90 degrees) using
-    the system used to scale latitudes in a Mercator projection.
-
-    The scale function:
-      ln(tan(y) + sec(y))
-
-    The inverse scale function:
-      atan(sinh(y))
-
-    Since the Mercator scale tends to infinity at +/- 90 degrees,
-    there is user-defined threshold, above and below which nothing
-    will be plotted.  This defaults to +/- 85 degrees.
-
-    source:
-    http://en.wikipedia.org/wiki/Mercator_projection
-    """
-
-    # The scale class must have a member ``name`` that defines the
-    # string used to select the scale.  For example,
-    # ``gca().set_yscale("mercator")`` would be used to select this
-    # scale.
-    name = 'mercator'
-
-    def __init__(self, axis, **kwargs):
-        """
-        Any keyword arguments passed to ``set_xscale`` and
-        ``set_yscale`` will be passed along to the scale's
-        constructor.
-
-        thresh: The degree above which to crop the data.
-        """
-        mscale.ScaleBase.__init__(self)
-        thresh = kwargs.pop("thresh", np.radians(85))
-        if thresh >= np.pi / 2.0:
-            raise ValueError("thresh must be less than pi/2")
-        self.thresh = thresh
-
-    def get_transform(self):
-        """
-        Override this method to return a new instance that does the
-        actual transformation of the data.
-
-        The MercatorLatitudeTransform class is defined below as a
-        nested class of this one.
-        """
-        return self.MercatorLatitudeTransform(self.thresh)
-
-    def set_default_locators_and_formatters(self, axis):
-        """
-        Override to set up the locators and formatters to use with the
-        scale.  This is only required if the scale requires custom
-        locators and formatters.  Writing custom locators and
-        formatters is rather outside the scope of this example, but
-        there are many helpful examples in ``ticker.py``.
-
-        In our case, the Mercator example uses a fixed locator from
-        -90 to 90 degrees and a custom formatter class to put convert
-        the radians to degrees and put a degree symbol after the
-        value::
-        """
-        class DegreeFormatter(Formatter):
-            def __call__(self, x, pos=None):
-                # \u00b0 : degree symbol
-                return "%d\u00b0" % (np.degrees(x))
-
-        axis.set_major_locator(FixedLocator(
-            np.radians(np.arange(-90, 90, 10))))
-        axis.set_major_formatter(DegreeFormatter())
-        axis.set_minor_formatter(DegreeFormatter())
-
-    def limit_range_for_scale(self, vmin, vmax, minpos):
-        """
-        Override to limit the bounds of the axis to the domain of the
-        transform.  In the case of Mercator, the bounds should be
-        limited to the threshold that was passed in.  Unlike the
-        autoscaling provided by the tick locators, this range limiting
-        will always be adhered to, whether the axis range is set
-        manually, determined automatically or changed through panning
-        and zooming.
-        """
-        return max(vmin, -self.thresh), min(vmax, self.thresh)
-
-    class MercatorLatitudeTransform(mtransforms.Transform):
-        # There are two value members that must be defined.
-        # ``input_dims`` and ``output_dims`` specify number of input
-        # dimensions and output dimensions to the transformation.
-        # These are used by the transformation framework to do some
-        # error checking and prevent incompatible transformations from
-        # being connected together.  When defining transforms for a
-        # scale, which are, by definition, separable and have only one
-        # dimension, these members should always be set to 1.
-        input_dims = 1
-        output_dims = 1
-        is_separable = True
-
-        def __init__(self, thresh):
-            mtransforms.Transform.__init__(self)
-            self.thresh = thresh
-
-        def transform_non_affine(self, a):
-            """
-            This transform takes an Nx1 ``numpy`` array and returns a
-            transformed copy.  Since the range of the Mercator scale
-            is limited by the user-specified threshold, the input
-            array must be masked to contain only valid values.
-            ``matplotlib`` will handle masked arrays and remove the
-            out-of-range data from the plot.  Importantly, the
-            ``transform`` method *must* return an array that is the
-            same shape as the input array, since these values need to
-            remain synchronized with values in the other dimension.
-            """
-            masked = ma.masked_where((a < -self.thresh) | (a > self.thresh), a)
-            if masked.mask.any():
-                return ma.log(np.abs(ma.tan(masked) + 1.0 / ma.cos(masked)))
-            else:
-                return np.log(np.abs(np.tan(a) + 1.0 / np.cos(a)))
-
-        def inverted(self):
-            """
-            Override this method so matplotlib knows how to get the
-            inverse transform for this transform.
-            """
-            return MercatorLatitudeScale.InvertedMercatorLatitudeTransform(
-                self.thresh)
-
-    class InvertedMercatorLatitudeTransform(mtransforms.Transform):
-        input_dims = 1
-        output_dims = 1
-        is_separable = True
-
-        def __init__(self, thresh):
-            mtransforms.Transform.__init__(self)
-            self.thresh = thresh
-
-        def transform_non_affine(self, a):
-            return np.arctan(np.sinh(a))
-
-        def inverted(self):
-            return MercatorLatitudeScale.MercatorLatitudeTransform(self.thresh)
-
-# Now that the Scale class has been defined, it must be registered so
-# that ``matplotlib`` can find it.
-mscale.register_scale(MercatorLatitudeScale)
-
-
-if __name__ == '__main__':
-    import matplotlib.pyplot as plt
-
-    t = np.arange(-180.0, 180.0, 0.1)
-    s = np.radians(t)/2.
-
-    plt.plot(t, s, '-', lw=2)
-    plt.gca().set_yscale('mercator')
-
-    plt.xlabel('Longitude')
-    plt.ylabel('Latitude')
-    plt.title('Mercator: Projection of the Oppressor')
-    plt.grid(True)
-
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/date_demo.html b/examples/api/date_demo.html deleted file mode 100644 index 174f580d596..00000000000 --- a/examples/api/date_demo.html +++ /dev/null @@ -1,388 +0,0 @@ - - - - - - - - api example code: date_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: date_demo.py

-

(Source code, png, pdf)

-
-../../_images/date_demo.png -
-
"""
-================
-Date tick labels
-================
-
-Show how to make date plots in matplotlib using date tick locators and
-formatters.  See major_minor_demo1.py for more information on
-controlling major and minor ticks
-
-All matplotlib date plotting is done by converting date instances into
-days since the 0001-01-01 UTC.  The conversion, tick locating and
-formatting is done behind the scenes so this is most transparent to
-you.  The dates module provides several converter functions date2num
-and num2date
-
-"""
-import datetime
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.dates as mdates
-import matplotlib.cbook as cbook
-
-years = mdates.YearLocator()   # every year
-months = mdates.MonthLocator()  # every month
-yearsFmt = mdates.DateFormatter('%Y')
-
-# load a numpy record array from yahoo csv data with fields date,
-# open, close, volume, adj_close from the mpl-data/example directory.
-# The record array stores python datetime.date as an object array in
-# the date column
-datafile = cbook.get_sample_data('goog.npy')
-try:
-    # Python3 cannot load python2 .npy files with datetime(object) arrays
-    # unless the encoding is set to bytes. However this option was
-    # not added until numpy 1.10 so this example will only work with
-    # python 2 or with numpy 1.10 and later.
-    r = np.load(datafile, encoding='bytes').view(np.recarray)
-except TypeError:
-    r = np.load(datafile).view(np.recarray)
-
-fig, ax = plt.subplots()
-ax.plot(r.date, r.adj_close)
-
-
-# format the ticks
-ax.xaxis.set_major_locator(years)
-ax.xaxis.set_major_formatter(yearsFmt)
-ax.xaxis.set_minor_locator(months)
-
-datemin = datetime.date(r.date.min().year, 1, 1)
-datemax = datetime.date(r.date.max().year + 1, 1, 1)
-ax.set_xlim(datemin, datemax)
-
-
-# format the coords message box
-def price(x):
-    return '$%1.2f' % x
-ax.format_xdata = mdates.DateFormatter('%Y-%m-%d')
-ax.format_ydata = price
-ax.grid(True)
-
-# rotates and right aligns the x labels, and moves the bottom of the
-# axes up to make room for them
-fig.autofmt_xdate()
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/date_index_formatter.html b/examples/api/date_index_formatter.html deleted file mode 100644 index a49f4d1b788..00000000000 --- a/examples/api/date_index_formatter.html +++ /dev/null @@ -1,369 +0,0 @@ - - - - - - - - api example code: date_index_formatter.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: date_index_formatter.py

-

(Source code, png, pdf)

-
-../../_images/date_index_formatter1.png -
-
"""
-=====================================
-Custom tick formatter for time series
-=====================================
-
-When plotting time series, e.g., financial time series, one often wants
-to leave out days on which there is no data, i.e. weekends.  The example
-below shows how to use an 'index formatter' to achieve the desired plot
-"""
-from __future__ import print_function
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.mlab as mlab
-import matplotlib.cbook as cbook
-import matplotlib.ticker as ticker
-
-datafile = cbook.get_sample_data('aapl.csv', asfileobj=False)
-print('loading %s' % datafile)
-r = mlab.csv2rec(datafile)
-
-r.sort()
-r = r[-30:]  # get the last 30 days
-
-
-# first we'll do it the default way, with gaps on weekends
-fig, axes = plt.subplots(ncols=2, figsize=(8, 4))
-ax = axes[0]
-ax.plot(r.date, r.adj_close, 'o-')
-ax.set_title("Default")
-fig.autofmt_xdate()
-
-# next we'll write a custom formatter
-N = len(r)
-ind = np.arange(N)  # the evenly spaced plot indices
-
-
-def format_date(x, pos=None):
-    thisind = np.clip(int(x + 0.5), 0, N - 1)
-    return r.date[thisind].strftime('%Y-%m-%d')
-
-ax = axes[1]
-ax.plot(ind, r.adj_close, 'o-')
-ax.xaxis.set_major_formatter(ticker.FuncFormatter(format_date))
-ax.set_title("Custom tick formatter")
-fig.autofmt_xdate()
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/demo_affine_image.html b/examples/api/demo_affine_image.html deleted file mode 100644 index 7756df0d1f1..00000000000 --- a/examples/api/demo_affine_image.html +++ /dev/null @@ -1,382 +0,0 @@ - - - - - - - - api example code: demo_affine_image.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: demo_affine_image.py

-

(Source code, png, pdf)

-
-../../_images/demo_affine_image.png -
-
"""
-============================
-Affine transform of an image
-============================
-
-For the backends that support draw_image with optional affine
-transform (e.g., agg, ps backend), the image of the output should
-have its boundary match the dashed yellow rectangle.
-"""
-
-import numpy as np
-import matplotlib.mlab as mlab
-import matplotlib.pyplot as plt
-import matplotlib.transforms as mtransforms
-
-
-def get_image():
-    delta = 0.25
-    x = y = np.arange(-3.0, 3.0, delta)
-    X, Y = np.meshgrid(x, y)
-    Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
-    Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
-    Z = Z2 - Z1  # difference of Gaussians
-    return Z
-
-
-def do_plot(ax, Z, transform):
-    im = ax.imshow(Z, interpolation='none',
-                   origin='lower',
-                   extent=[-2, 4, -3, 2], clip_on=True)
-
-    trans_data = transform + ax.transData
-    im.set_transform(trans_data)
-
-    # display intended extent of the image
-    x1, x2, y1, y2 = im.get_extent()
-    ax.plot([x1, x2, x2, x1, x1], [y1, y1, y2, y2, y1], "y--",
-            transform=trans_data)
-    ax.set_xlim(-5, 5)
-    ax.set_ylim(-4, 4)
-
-
-# prepare image and figure
-fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2)
-Z = get_image()
-
-# image rotation
-do_plot(ax1, Z, mtransforms.Affine2D().rotate_deg(30))
-
-# image skew
-do_plot(ax2, Z, mtransforms.Affine2D().skew_deg(30, 15))
-
-# scale and reflection
-do_plot(ax3, Z, mtransforms.Affine2D().scale(-1, .5))
-
-# everything and a translation
-do_plot(ax4, Z, mtransforms.Affine2D().
-        rotate_deg(30).skew_deg(30, 15).scale(-1, .5).translate(.5, -1))
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/donut_demo.html b/examples/api/donut_demo.html deleted file mode 100644 index 1abcbf81822..00000000000 --- a/examples/api/donut_demo.html +++ /dev/null @@ -1,384 +0,0 @@ - - - - - - - - api example code: donut_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: donut_demo.py

-

(Source code, png, pdf)

-
-../../_images/donut_demo.png -
-
"""
-=============
-Mmh Donuts!!!
-=============
-
-This example draws donuts (miam!) using Path and Patches.
-"""
-
-import numpy as np
-import matplotlib.path as mpath
-import matplotlib.patches as mpatches
-import matplotlib.pyplot as plt
-
-
-def wise(v):
-    if v == 1:
-        return "CCW"
-    else:
-        return "CW"
-
-
-def make_circle(r):
-    t = np.arange(0, np.pi * 2.0, 0.01)
-    t = t.reshape((len(t), 1))
-    x = r * np.cos(t)
-    y = r * np.sin(t)
-    return np.hstack((x, y))
-
-Path = mpath.Path
-
-fig, ax = plt.subplots()
-
-inside_vertices = make_circle(0.5)
-outside_vertices = make_circle(1.0)
-codes = np.ones(
-    len(inside_vertices), dtype=mpath.Path.code_type) * mpath.Path.LINETO
-codes[0] = mpath.Path.MOVETO
-
-for i, (inside, outside) in enumerate(((1, 1), (1, -1), (-1, 1), (-1, -1))):
-    # Concatenate the inside and outside subpaths together, changing their
-    # order as needed
-    vertices = np.concatenate((outside_vertices[::outside],
-                               inside_vertices[::inside]))
-    # Shift the path
-    vertices[:, 0] += i * 2.5
-    # The codes will be all "LINETO" commands, except for "MOVETO"s at the
-    # beginning of each subpath
-    all_codes = np.concatenate((codes, codes))
-    # Create the Path object
-    path = mpath.Path(vertices, all_codes)
-    # Add plot it
-    patch = mpatches.PathPatch(path, facecolor='#885500', edgecolor='black')
-    ax.add_patch(patch)
-
-    ax.annotate("Outside %s,\nInside %s" % (wise(outside), wise(inside)),
-                (i * 2.5, -1.5), va="top", ha="center")
-
-ax.set_xlim(-2, 10)
-ax.set_ylim(-3, 2)
-ax.set_title('Mmm, donuts!')
-ax.set_aspect(1.0)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/engineering_formatter.html b/examples/api/engineering_formatter.html deleted file mode 100644 index 28f3ceb78c4..00000000000 --- a/examples/api/engineering_formatter.html +++ /dev/null @@ -1,347 +0,0 @@ - - - - - - - - api example code: engineering_formatter.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: engineering_formatter.py

-

(Source code, png, pdf)

-
-../../_images/engineering_formatter.png -
-
'''
-=========================================
-Labeling ticks using engineering notation
-=========================================
-
-Demo to show use of the engineering Formatter.
-'''
-
-import matplotlib.pyplot as plt
-import numpy as np
-
-from matplotlib.ticker import EngFormatter
-
-prng = np.random.RandomState(123)
-
-fig, ax = plt.subplots()
-ax.set_xscale('log')
-formatter = EngFormatter(unit='Hz')
-ax.xaxis.set_major_formatter(formatter)
-
-xs = np.logspace(1, 9, 100)
-ys = (0.8 + 0.4 * prng.uniform(size=100)) * np.log10(xs)**2
-ax.plot(xs, ys)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/fahrenheit_celsius_scales.html b/examples/api/fahrenheit_celsius_scales.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/api/fahrenheit_celsius_scales.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/api/filled_step.html b/examples/api/filled_step.html deleted file mode 100644 index 35b0c188228..00000000000 --- a/examples/api/filled_step.html +++ /dev/null @@ -1,548 +0,0 @@ - - - - - - - - api example code: filled_step.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: filled_step.py

-

(Source code)

-
-../../_images/filled_step_00.png -

(png, pdf)

-
-
-../../_images/filled_step_01.png -

(png, pdf)

-
-
"""
-=========================
-Hatch-filled histograms
-=========================
-
-This example showcases the hatching capabilities of matplotlib by plotting
-various histograms.
-"""
-
-import itertools
-from collections import OrderedDict
-from functools import partial
-
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.ticker as mticker
-from cycler import cycler
-from six.moves import zip
-
-
-def filled_hist(ax, edges, values, bottoms=None, orientation='v',
-                **kwargs):
-    """
-    Draw a histogram as a stepped patch.
-
-    Extra kwargs are passed through to `fill_between`
-
-    Parameters
-    ----------
-    ax : Axes
-        The axes to plot to
-
-    edges : array
-        A length n+1 array giving the left edges of each bin and the
-        right edge of the last bin.
-
-    values : array
-        A length n array of bin counts or values
-
-    bottoms : scalar or array, optional
-        A length n array of the bottom of the bars.  If None, zero is used.
-
-    orientation : {'v', 'h'}
-       Orientation of the histogram.  'v' (default) has
-       the bars increasing in the positive y-direction.
-
-    Returns
-    -------
-    ret : PolyCollection
-        Artist added to the Axes
-    """
-    print(orientation)
-    if orientation not in set('hv'):
-        raise ValueError("orientation must be in {{'h', 'v'}} "
-                         "not {o}".format(o=orientation))
-
-    kwargs.setdefault('step', 'post')
-    edges = np.asarray(edges)
-    values = np.asarray(values)
-    if len(edges) - 1 != len(values):
-        raise ValueError('Must provide one more bin edge than value not: '
-                         'len(edges): {lb} len(values): {lv}'.format(
-                             lb=len(edges), lv=len(values)))
-
-    if bottoms is None:
-        bottoms = np.zeros_like(values)
-    if np.isscalar(bottoms):
-        bottoms = np.ones_like(values) * bottoms
-
-    values = np.r_[values, values[-1]]
-    bottoms = np.r_[bottoms, bottoms[-1]]
-    if orientation == 'h':
-        return ax.fill_betweenx(edges, values, bottoms,
-                                **kwargs)
-    elif orientation == 'v':
-        return ax.fill_between(edges, values, bottoms,
-                               **kwargs)
-    else:
-        raise AssertionError("you should never be here")
-
-
-def stack_hist(ax, stacked_data, sty_cycle, bottoms=None,
-               hist_func=None, labels=None,
-               plot_func=None, plot_kwargs=None):
-    """
-    ax : axes.Axes
-        The axes to add artists too
-
-    stacked_data : array or Mapping
-        A (N, M) shaped array.  The first dimension will be iterated over to
-        compute histograms row-wise
-
-    sty_cycle : Cycler or operable of dict
-        Style to apply to each set
-
-    bottoms : array, optional
-        The initial positions of the bottoms, defaults to 0
-
-    hist_func : callable, optional
-        Must have signature `bin_vals, bin_edges = f(data)`.
-        `bin_edges` expected to be one longer than `bin_vals`
-
-    labels : list of str, optional
-        The label for each set.
-
-        If not given and stacked data is an array defaults to 'default set {n}'
-
-        If stacked_data is a mapping, and labels is None, default to the keys
-        (which may come out in a random order).
-
-        If stacked_data is a mapping and labels is given then only
-        the columns listed by be plotted.
-
-    plot_func : callable, optional
-        Function to call to draw the histogram must have signature:
-
-          ret = plot_func(ax, edges, top, bottoms=bottoms,
-                          label=label, **kwargs)
-
-    plot_kwargs : dict, optional
-        Any extra kwargs to pass through to the plotting function.  This
-        will be the same for all calls to the plotting function and will
-        over-ride the values in cycle.
-
-    Returns
-    -------
-    arts : dict
-        Dictionary of artists keyed on their labels
-    """
-    # deal with default binning function
-    if hist_func is None:
-        hist_func = np.histogram
-
-    # deal with default plotting function
-    if plot_func is None:
-        plot_func = filled_hist
-
-    # deal with default
-    if plot_kwargs is None:
-        plot_kwargs = {}
-    print(plot_kwargs)
-    try:
-        l_keys = stacked_data.keys()
-        label_data = True
-        if labels is None:
-            labels = l_keys
-
-    except AttributeError:
-        label_data = False
-        if labels is None:
-            labels = itertools.repeat(None)
-
-    if label_data:
-        loop_iter = enumerate((stacked_data[lab], lab, s) for lab, s in
-                              zip(labels, sty_cycle))
-    else:
-        loop_iter = enumerate(zip(stacked_data, labels, sty_cycle))
-
-    arts = {}
-    for j, (data, label, sty) in loop_iter:
-        if label is None:
-            label = 'dflt set {n}'.format(n=j)
-        label = sty.pop('label', label)
-        vals, edges = hist_func(data)
-        if bottoms is None:
-            bottoms = np.zeros_like(vals)
-        top = bottoms + vals
-        print(sty)
-        sty.update(plot_kwargs)
-        print(sty)
-        ret = plot_func(ax, edges, top, bottoms=bottoms,
-                        label=label, **sty)
-        bottoms = top
-        arts[label] = ret
-    ax.legend(fontsize=10)
-    return arts
-
-
-# set up histogram function to fixed bins
-edges = np.linspace(-3, 3, 20, endpoint=True)
-hist_func = partial(np.histogram, bins=edges)
-
-# set up style cycles
-color_cycle = cycler(facecolor=plt.rcParams['axes.prop_cycle'][:4])
-label_cycle = cycler('label', ['set {n}'.format(n=n) for n in range(4)])
-hatch_cycle = cycler('hatch', ['/', '*', '+', '|'])
-
-# make some synthetic data
-np.random.seed(0)
-stack_data = np.random.randn(4, 12250)
-dict_data = OrderedDict(zip((c['label'] for c in label_cycle), stack_data))
-
-# work with plain arrays
-fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(9, 4.5), tight_layout=True)
-arts = stack_hist(ax1, stack_data, color_cycle + label_cycle + hatch_cycle,
-                  hist_func=hist_func)
-
-arts = stack_hist(ax2, stack_data, color_cycle,
-                  hist_func=hist_func,
-                  plot_kwargs=dict(edgecolor='w', orientation='h'))
-ax1.set_ylabel('counts')
-ax1.set_xlabel('x')
-ax2.set_xlabel('counts')
-ax2.set_ylabel('x')
-
-# work with labeled data
-
-fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(9, 4.5),
-                               tight_layout=True, sharey=True)
-
-arts = stack_hist(ax1, dict_data, color_cycle + hatch_cycle,
-                  hist_func=hist_func)
-
-arts = stack_hist(ax2, dict_data, color_cycle + hatch_cycle,
-                  hist_func=hist_func, labels=['set 0', 'set 3'])
-ax1.xaxis.set_major_locator(mticker.MaxNLocator(5))
-ax1.set_xlabel('counts')
-ax1.set_ylabel('x')
-ax2.set_ylabel('x')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/font_family_rc.html b/examples/api/font_family_rc.html deleted file mode 100644 index a6190cccd26..00000000000 --- a/examples/api/font_family_rc.html +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - api example code: font_family_rc.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: font_family_rc.py

-

[source code]

-
"""
-===========================
-Configuring the font family
-===========================
-
-You can explicitly set which font family is picked up for a given font
-style (e.g., 'serif', 'sans-serif', or 'monospace').
-
-In the example below, we only allow one font family (Tahoma) for the
-san-serif font style.  You the default family with the font.family rc
-param, e.g.,::
-
-  rcParams['font.family'] = 'sans-serif'
-
-and for the font.family you set a list of font styles to try to find
-in order::
-
-  rcParams['font.sans-serif'] = ['Tahoma', 'DejaVu Sans',
-                                 'Lucida Grande', 'Verdana']
-
-"""
-
-# -*- noplot -*-
-
-from matplotlib import rcParams
-rcParams['font.family'] = 'sans-serif'
-rcParams['font.sans-serif'] = ['Tahoma']
-import matplotlib.pyplot as plt
-
-fig, ax = plt.subplots()
-ax.plot([1, 2, 3], label='test')
-
-ax.legend()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/font_family_rc.py b/examples/api/font_family_rc.py deleted file mode 100644 index 1e0a17a0be5..00000000000 --- a/examples/api/font_family_rc.py +++ /dev/null @@ -1,34 +0,0 @@ -""" -=========================== -Configuring the font family -=========================== - -You can explicitly set which font family is picked up for a given font -style (e.g., 'serif', 'sans-serif', or 'monospace'). - -In the example below, we only allow one font family (Tahoma) for the -san-serif font style. You the default family with the font.family rc -param, e.g.,:: - - rcParams['font.family'] = 'sans-serif' - -and for the font.family you set a list of font styles to try to find -in order:: - - rcParams['font.sans-serif'] = ['Tahoma', 'DejaVu Sans', - 'Lucida Grande', 'Verdana'] - -""" - -# -*- noplot -*- - -from matplotlib import rcParams -rcParams['font.family'] = 'sans-serif' -rcParams['font.sans-serif'] = ['Tahoma'] -import matplotlib.pyplot as plt - -fig, ax = plt.subplots() -ax.plot([1, 2, 3], label='test') - -ax.legend() -plt.show() diff --git a/examples/api/font_file.html b/examples/api/font_file.html deleted file mode 100644 index 204ef2fceee..00000000000 --- a/examples/api/font_file.html +++ /dev/null @@ -1,361 +0,0 @@ - - - - - - - - api example code: font_file.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: font_file.py

-

[source code]

-
# -*- noplot -*-
-"""
-===================================
-Using a ttf font file in matplotlib
-===================================
-
-Although it is usually not a good idea to explicitly point to a single
-ttf file for a font instance, you can do so using the
-font_manager.FontProperties fname argument (for a more flexible
-solution, see the font_family_rc.py and fonts_demo.py examples).
-"""
-import sys
-import os
-import matplotlib.font_manager as fm
-
-import matplotlib.pyplot as plt
-
-fig, ax = plt.subplots()
-ax.plot([1, 2, 3])
-
-if sys.platform == 'win32':
-    fpath = 'C:\\Windows\\Fonts\\Tahoma.ttf'
-elif sys.platform.startswith('linux'):
-    basedir = '/usr/share/fonts/truetype'
-    fonts = ['freefont/FreeSansBoldOblique.ttf',
-             'ttf-liberation/LiberationSans-BoldItalic.ttf',
-             'msttcorefonts/Comic_Sans_MS.ttf']
-    for fpath in fonts:
-        if os.path.exists(os.path.join(basedir, fpath)):
-            break
-else:
-    fpath = '/Library/Fonts/Tahoma.ttf'
-
-if os.path.exists(fpath):
-    prop = fm.FontProperties(fname=fpath)
-    fname = os.path.split(fpath)[1]
-    ax.set_title('this is a special font: %s' % fname, fontproperties=prop)
-else:
-    ax.set_title('Demo fails--cannot find a demo font')
-ax.set_xlabel('This is the default font')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/font_file.py b/examples/api/font_file.py deleted file mode 100644 index d35e50dae16..00000000000 --- a/examples/api/font_file.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- noplot -*- -""" -=================================== -Using a ttf font file in matplotlib -=================================== - -Although it is usually not a good idea to explicitly point to a single -ttf file for a font instance, you can do so using the -font_manager.FontProperties fname argument (for a more flexible -solution, see the font_family_rc.py and fonts_demo.py examples). -""" -import sys -import os -import matplotlib.font_manager as fm - -import matplotlib.pyplot as plt - -fig, ax = plt.subplots() -ax.plot([1, 2, 3]) - -if sys.platform == 'win32': - fpath = 'C:\\Windows\\Fonts\\Tahoma.ttf' -elif sys.platform.startswith('linux'): - basedir = '/usr/share/fonts/truetype' - fonts = ['freefont/FreeSansBoldOblique.ttf', - 'ttf-liberation/LiberationSans-BoldItalic.ttf', - 'msttcorefonts/Comic_Sans_MS.ttf'] - for fpath in fonts: - if os.path.exists(os.path.join(basedir, fpath)): - break -else: - fpath = '/Library/Fonts/Tahoma.ttf' - -if os.path.exists(fpath): - prop = fm.FontProperties(fname=fpath) - fname = os.path.split(fpath)[1] - ax.set_title('this is a special font: %s' % fname, fontproperties=prop) -else: - ax.set_title('Demo fails--cannot find a demo font') -ax.set_xlabel('This is the default font') - -plt.show() diff --git a/examples/api/histogram_path_demo.html b/examples/api/histogram_path_demo.html deleted file mode 100644 index ea5958382c2..00000000000 --- a/examples/api/histogram_path_demo.html +++ /dev/null @@ -1,372 +0,0 @@ - - - - - - - - api example code: histogram_path_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: histogram_path_demo.py

-

(Source code, png, pdf)

-
-../../_images/histogram_path_demo.png -
-
"""
-========================================================
-Building histograms using Rectangles and PolyCollections
-========================================================
-
-This example shows how to use a path patch to draw a bunch of
-rectangles.  The technique of using lots of Rectangle instances, or
-the faster method of using PolyCollections, were implemented before we
-had proper paths with moveto/lineto, closepoly etc in mpl.  Now that
-we have them, we can draw collections of regularly shaped objects with
-homogeneous properties more efficiently with a PathCollection.  This
-example makes a histogram -- its more work to set up the vertex arrays
-at the outset, but it should be much faster for large numbers of
-objects
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.patches as patches
-import matplotlib.path as path
-
-fig, ax = plt.subplots()
-
-# histogram our data with numpy
-data = np.random.randn(1000)
-n, bins = np.histogram(data, 50)
-
-# get the corners of the rectangles for the histogram
-left = np.array(bins[:-1])
-right = np.array(bins[1:])
-bottom = np.zeros(len(left))
-top = bottom + n
-
-
-# we need a (numrects x numsides x 2) numpy array for the path helper
-# function to build a compound path
-XY = np.array([[left, left, right, right], [bottom, top, top, bottom]]).T
-
-# get the Path object
-barpath = path.Path.make_compound_path_from_polys(XY)
-
-# make a patch out of it
-patch = patches.PathPatch(barpath)
-ax.add_patch(patch)
-
-# update the view limits
-ax.set_xlim(left[0], right[-1])
-ax.set_ylim(bottom.min(), top.max())
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/image_zcoord.html b/examples/api/image_zcoord.html deleted file mode 100644 index 5ead6c3b3db..00000000000 --- a/examples/api/image_zcoord.html +++ /dev/null @@ -1,352 +0,0 @@ - - - - - - - - api example code: image_zcoord.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: image_zcoord.py

-

(Source code, png, pdf)

-
-../../_images/image_zcoord.png -
-
"""
-==================================
-Modifying the coordinate formatter
-==================================
-
-Show how to modify the coordinate formatter to report the image "z"
-value of the nearest pixel given x and y
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-X = 10*np.random.rand(5, 3)
-
-fig, ax = plt.subplots()
-ax.imshow(X, interpolation='nearest')
-
-numrows, numcols = X.shape
-
-
-def format_coord(x, y):
-    col = int(x + 0.5)
-    row = int(y + 0.5)
-    if col >= 0 and col < numcols and row >= 0 and row < numrows:
-        z = X[row, col]
-        return 'x=%1.4f, y=%1.4f, z=%1.4f' % (x, y, z)
-    else:
-        return 'x=%1.4f, y=%1.4f' % (x, y)
-
-ax.format_coord = format_coord
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/index.html b/examples/api/index.html deleted file mode 100644 index 5f27762249e..00000000000 --- a/examples/api/index.html +++ /dev/null @@ -1,365 +0,0 @@ - - - - - - - - api Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- - - - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/joinstyle.html b/examples/api/joinstyle.html deleted file mode 100644 index fdf9b603ead..00000000000 --- a/examples/api/joinstyle.html +++ /dev/null @@ -1,355 +0,0 @@ - - - - - - - - api example code: joinstyle.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: joinstyle.py

-

(Source code, png, pdf)

-
-../../_images/joinstyle.png -
-
"""
-===========
-Join styles
-===========
-
-Illustrate the three different join styles
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-def plot_angle(ax, x, y, angle, style):
-    phi = np.radians(angle)
-    xx = [x + .5, x, x + .5*np.cos(phi)]
-    yy = [y, y, y + .5*np.sin(phi)]
-    ax.plot(xx, yy, lw=8, color='blue', solid_joinstyle=style)
-    ax.plot(xx[1:], yy[1:], lw=1, color='black')
-    ax.plot(xx[1::-1], yy[1::-1], lw=1, color='black')
-    ax.plot(xx[1:2], yy[1:2], 'o', color='red', markersize=3)
-    ax.text(x, y + .2, '%.0f degrees' % angle)
-
-fig, ax = plt.subplots()
-ax.set_title('Join style')
-
-for x, style in enumerate((('miter', 'round', 'bevel'))):
-    ax.text(x, 5, style)
-    for i in range(5):
-        plot_angle(ax, x, i, pow(2.0, 3 + i), style)
-
-ax.set_xlim(-.5, 2.75)
-ax.set_ylim(-.5, 5.5)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/legend_demo.html b/examples/api/legend_demo.html deleted file mode 100644 index 6072371ee5e..00000000000 --- a/examples/api/legend_demo.html +++ /dev/null @@ -1,351 +0,0 @@ - - - - - - - - api example code: legend_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: legend_demo.py

-

(Source code, png, pdf)

-
-../../_images/legend_demo1.png -
-
"""
-===============================
-Legend using pre-defined labels
-===============================
-
-Notice how the legend labels are defined with the plots!
-"""
-
-
-import numpy as np
-import matplotlib.pyplot as plt
-
-# Make some fake data.
-a = b = np.arange(0, 3, .02)
-c = np.exp(a)
-d = c[::-1]
-
-# Create plots with pre-defined labels.
-fig, ax = plt.subplots()
-ax.plot(a, c, 'k--', label='Model length')
-ax.plot(a, d, 'k:', label='Data length')
-ax.plot(a, c + d, 'k', label='Total message length')
-
-legend = ax.legend(loc='upper center', shadow=True, fontsize='x-large')
-
-# Put a nicer background color on the legend.
-legend.get_frame().set_facecolor('#00FFCC')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/line_with_text.html b/examples/api/line_with_text.html deleted file mode 100644 index a53db0ec5cb..00000000000 --- a/examples/api/line_with_text.html +++ /dev/null @@ -1,385 +0,0 @@ - - - - - - - - api example code: line_with_text.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: line_with_text.py

-

(Source code, png, pdf)

-
-../../_images/line_with_text.png -
-
"""
-=======================
-Artist within an artist
-=======================
-
-Show how to override basic methods so an artist can contain another
-artist.  In this case, the line contains a Text instance to label it.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.lines as lines
-import matplotlib.transforms as mtransforms
-import matplotlib.text as mtext
-
-
-class MyLine(lines.Line2D):
-    def __init__(self, *args, **kwargs):
-        # we'll update the position when the line data is set
-        self.text = mtext.Text(0, 0, '')
-        lines.Line2D.__init__(self, *args, **kwargs)
-
-        # we can't access the label attr until *after* the line is
-        # inited
-        self.text.set_text(self.get_label())
-
-    def set_figure(self, figure):
-        self.text.set_figure(figure)
-        lines.Line2D.set_figure(self, figure)
-
-    def set_axes(self, axes):
-        self.text.set_axes(axes)
-        lines.Line2D.set_axes(self, axes)
-
-    def set_transform(self, transform):
-        # 2 pixel offset
-        texttrans = transform + mtransforms.Affine2D().translate(2, 2)
-        self.text.set_transform(texttrans)
-        lines.Line2D.set_transform(self, transform)
-
-    def set_data(self, x, y):
-        if len(x):
-            self.text.set_position((x[-1], y[-1]))
-
-        lines.Line2D.set_data(self, x, y)
-
-    def draw(self, renderer):
-        # draw my label at the end of the line with 2 pixel offset
-        lines.Line2D.draw(self, renderer)
-        self.text.draw(renderer)
-
-
-fig, ax = plt.subplots()
-x, y = np.random.rand(2, 20)
-line = MyLine(x, y, mfc='red', ms=12, label='line label')
-#line.text.set_text('line label')
-line.text.set_color('red')
-line.text.set_fontsize(16)
-
-
-ax.add_line(line)
-
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/logo2.html b/examples/api/logo2.html deleted file mode 100644 index 87caeb3f4da..00000000000 --- a/examples/api/logo2.html +++ /dev/null @@ -1,411 +0,0 @@ - - - - - - - - api example code: logo2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: logo2.py

-

(Source code, png, pdf)

-
-../../_images/logo2.png -
-
"""
-==========
-matplotlib
-==========
-
-Thanks to Tony Yu <tsyu80@gmail.com> for the logo design
-"""
-
-import numpy as np
-import matplotlib as mpl
-import matplotlib.pyplot as plt
-import matplotlib.cm as cm
-
-mpl.rcParams['xtick.labelsize'] = 10
-mpl.rcParams['ytick.labelsize'] = 12
-mpl.rcParams['axes.edgecolor'] = 'gray'
-
-
-axalpha = 0.05
-figcolor = 'white'
-dpi = 80
-fig = plt.figure(figsize=(6, 1.1), dpi=dpi)
-fig.figurePatch.set_edgecolor(figcolor)
-fig.figurePatch.set_facecolor(figcolor)
-
-
-def add_math_background():
-    ax = fig.add_axes([0., 0., 1., 1.])
-
-    text = []
-    text.append(
-        (r"$W^{3\beta}_{\delta_1 \rho_1 \sigma_2} = "
-         r"U^{3\beta}_{\delta_1 \rho_1} + \frac{1}{8 \pi 2}"
-         r"\int^{\alpha_2}_{\alpha_2} d \alpha^\prime_2 "
-         r"\left[\frac{ U^{2\beta}_{\delta_1 \rho_1} - "
-         r"\alpha^\prime_2U^{1\beta}_{\rho_1 \sigma_2} "
-         r"}{U^{0\beta}_{\rho_1 \sigma_2}}\right]$", (0.7, 0.2), 20))
-    text.append((r"$\frac{d\rho}{d t} + \rho \vec{v}\cdot\nabla\vec{v} "
-                 r"= -\nabla p + \mu\nabla^2 \vec{v} + \rho \vec{g}$",
-                 (0.35, 0.9), 20))
-    text.append((r"$\int_{-\infty}^\infty e^{-x^2}dx=\sqrt{\pi}$",
-                 (0.15, 0.3), 25))
-    text.append((r"$F_G = G\frac{m_1m_2}{r^2}$",
-                 (0.85, 0.7), 30))
-    for eq, (x, y), size in text:
-        ax.text(x, y, eq, ha='center', va='center', color="#11557c",
-                alpha=0.25, transform=ax.transAxes, fontsize=size)
-    ax.set_axis_off()
-    return ax
-
-
-def add_matplotlib_text(ax):
-    ax.text(0.95, 0.5, 'matplotlib', color='#11557c', fontsize=65,
-            ha='right', va='center', alpha=1.0, transform=ax.transAxes)
-
-
-def add_polar_bar():
-    ax = fig.add_axes([0.025, 0.075, 0.2, 0.85], projection='polar')
-
-    ax.axesPatch.set_alpha(axalpha)
-    ax.set_axisbelow(True)
-    N = 7
-    arc = 2. * np.pi
-    theta = np.arange(0.0, arc, arc/N)
-    radii = 10 * np.array([0.2, 0.6, 0.8, 0.7, 0.4, 0.5, 0.8])
-    width = np.pi / 4 * np.array([0.4, 0.4, 0.6, 0.8, 0.2, 0.5, 0.3])
-    bars = ax.bar(theta, radii, width=width, bottom=0.0)
-    for r, bar in zip(radii, bars):
-        bar.set_facecolor(cm.jet(r/10.))
-        bar.set_alpha(0.6)
-
-    for label in ax.get_xticklabels() + ax.get_yticklabels():
-        label.set_visible(False)
-
-    for line in ax.get_ygridlines() + ax.get_xgridlines():
-        line.set_lw(0.8)
-        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)
-
-
-if __name__ == '__main__':
-    main_axes = add_math_background()
-    add_polar_bar()
-    add_matplotlib_text(main_axes)
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/mathtext_asarray.html b/examples/api/mathtext_asarray.html deleted file mode 100644 index 33210d0151c..00000000000 --- a/examples/api/mathtext_asarray.html +++ /dev/null @@ -1,350 +0,0 @@ - - - - - - - - api example code: mathtext_asarray.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: mathtext_asarray.py

-

(Source code, png, pdf)

-
-../../_images/mathtext_asarray.png -
-
"""
-===============================
-A mathtext image as numpy array
-===============================
-
-This example shows how to make images from LaTeX strings.
-"""
-
-import matplotlib.mathtext as mathtext
-import matplotlib.pyplot as plt
-import matplotlib
-matplotlib.rc('image', origin='upper')
-
-parser = mathtext.MathTextParser("Bitmap")
-parser.to_png('test2.png',
-              r'$\left[\left\lfloor\frac{5}{\frac{\left(3\right)}{4}} '
-              r'y\right)\right]$', color='green', fontsize=14, dpi=100)
-
-rgba1, depth1 = parser.to_rgba(
-    r'IQ: $\sigma_i=15$', color='blue', fontsize=20, dpi=200)
-rgba2, depth2 = parser.to_rgba(
-    r'some other string', color='red', fontsize=20, dpi=200)
-
-fig = plt.figure()
-fig.figimage(rgba1.astype(float)/255., 100, 100)
-fig.figimage(rgba2.astype(float)/255., 100, 300)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/patch_collection.html b/examples/api/patch_collection.html deleted file mode 100644 index 582cfb42c34..00000000000 --- a/examples/api/patch_collection.html +++ /dev/null @@ -1,375 +0,0 @@ - - - - - - - - api example code: patch_collection.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: patch_collection.py

-

(Source code, png, pdf)

-
-../../_images/patch_collection.png -
-
"""
-============================
-Circles, Wedges and Polygons
-============================
-"""
-
-import numpy as np
-import matplotlib
-from matplotlib.patches import Circle, Wedge, Polygon
-from matplotlib.collections import PatchCollection
-import matplotlib.pyplot as plt
-
-
-fig, ax = plt.subplots()
-
-resolution = 50  # the number of vertices
-N = 3
-x = np.random.rand(N)
-y = np.random.rand(N)
-radii = 0.1*np.random.rand(N)
-patches = []
-for x1, y1, r in zip(x, y, radii):
-    circle = Circle((x1, y1), r)
-    patches.append(circle)
-
-x = np.random.rand(N)
-y = np.random.rand(N)
-radii = 0.1*np.random.rand(N)
-theta1 = 360.0*np.random.rand(N)
-theta2 = 360.0*np.random.rand(N)
-for x1, y1, r, t1, t2 in zip(x, y, radii, theta1, theta2):
-    wedge = Wedge((x1, y1), r, t1, t2)
-    patches.append(wedge)
-
-# Some limiting conditions on Wedge
-patches += [
-    Wedge((.3, .7), .1, 0, 360),             # Full circle
-    Wedge((.7, .8), .2, 0, 360, width=0.05),  # Full ring
-    Wedge((.8, .3), .2, 0, 45),              # Full sector
-    Wedge((.8, .3), .2, 45, 90, width=0.10),  # Ring sector
-]
-
-for i in range(N):
-    polygon = Polygon(np.random.rand(N, 2), True)
-    patches.append(polygon)
-
-colors = 100*np.random.rand(len(patches))
-p = PatchCollection(patches, alpha=0.4)
-p.set_array(np.array(colors))
-ax.add_collection(p)
-fig.colorbar(p, ax=ax)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/power_norm_demo.html b/examples/api/power_norm_demo.html deleted file mode 100644 index ddffcb00c70..00000000000 --- a/examples/api/power_norm_demo.html +++ /dev/null @@ -1,356 +0,0 @@ - - - - - - - - api example code: power_norm_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: power_norm_demo.py

-

(Source code, png, pdf)

-
-../../_images/power_norm_demo.png -
-
"""
-========================
-Exploring normalizations
-========================
-
-Let's explore various normalization on a multivariate normal distribution.
-
-"""
-
-from matplotlib import pyplot as plt
-import matplotlib.colors as mcolors
-import numpy as np
-from numpy.random import multivariate_normal
-
-data = np.vstack([
-    multivariate_normal([10, 10], [[3, 2], [2, 3]], size=100000),
-    multivariate_normal([30, 20], [[2, 3], [1, 3]], size=1000)
-])
-
-gammas = [0.8, 0.5, 0.3]
-
-fig, axes = plt.subplots(nrows=2, ncols=2)
-
-axes[0, 0].set_title('Linear normalization')
-axes[0, 0].hist2d(data[:, 0], data[:, 1], bins=100)
-
-for ax, gamma in zip(axes.flat[1:], gammas):
-    ax.set_title('Power law $(\gamma=%1.1f)$' % gamma)
-    ax.hist2d(data[:, 0], data[:, 1],
-              bins=100, norm=mcolors.PowerNorm(gamma))
-
-fig.tight_layout()
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/quad_bezier.html b/examples/api/quad_bezier.html deleted file mode 100644 index ce5f59811d9..00000000000 --- a/examples/api/quad_bezier.html +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - api example code: quad_bezier.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: quad_bezier.py

-

(Source code, png, pdf)

-
-../../_images/quad_bezier.png -
-
"""
-============
-Bezier Curve
-============
-
-This example showcases the PathPatch object to create a Bezier polycurve path
-patch.
-"""
-
-import matplotlib.path as mpath
-import matplotlib.patches as mpatches
-import matplotlib.pyplot as plt
-
-Path = mpath.Path
-
-fig, ax = plt.subplots()
-pp1 = mpatches.PathPatch(
-    Path([(0, 0), (1, 0), (1, 1), (0, 0)],
-         [Path.MOVETO, Path.CURVE3, Path.CURVE3, Path.CLOSEPOLY]),
-    fc="none", transform=ax.transData)
-
-ax.add_patch(pp1)
-ax.plot([0.75], [0.25], "ro")
-ax.set_title('The red point should be on the path')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/radar_chart.html b/examples/api/radar_chart.html deleted file mode 100644 index e10119e017b..00000000000 --- a/examples/api/radar_chart.html +++ /dev/null @@ -1,523 +0,0 @@ - - - - - - - - api example code: radar_chart.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: radar_chart.py

-

(Source code, png, pdf)

-
-../../_images/radar_chart.png -
-
"""
-======================================
-Radar chart (aka spider or star chart)
-======================================
-
-This example creates a radar chart, also known as a spider or star chart [1]_.
-
-Although this example allows a frame of either 'circle' or 'polygon', polygon
-frames don't have proper gridlines (the lines are circles instead of polygons).
-It's possible to get a polygon grid by setting GRIDLINE_INTERPOLATION_STEPS in
-matplotlib.axis to the desired number of vertices, but the orientation of the
-polygon is not aligned with the radial axes.
-
-.. [1] http://en.wikipedia.org/wiki/Radar_chart
-"""
-import numpy as np
-
-import matplotlib.pyplot as plt
-from matplotlib.path import Path
-from matplotlib.spines import Spine
-from matplotlib.projections.polar import PolarAxes
-from matplotlib.projections import register_projection
-
-
-def radar_factory(num_vars, frame='circle'):
-    """Create a radar chart with `num_vars` axes.
-
-    This function creates a RadarAxes projection and registers it.
-
-    Parameters
-    ----------
-    num_vars : int
-        Number of variables for radar chart.
-    frame : {'circle' | 'polygon'}
-        Shape of frame surrounding axes.
-
-    """
-    # calculate evenly-spaced axis angles
-    theta = np.linspace(0, 2*np.pi, num_vars, endpoint=False)
-    # rotate theta such that the first axis is at the top
-    theta += np.pi/2
-
-    def draw_poly_patch(self):
-        verts = unit_poly_verts(theta)
-        return plt.Polygon(verts, closed=True, edgecolor='k')
-
-    def draw_circle_patch(self):
-        # unit circle centered on (0.5, 0.5)
-        return plt.Circle((0.5, 0.5), 0.5)
-
-    patch_dict = {'polygon': draw_poly_patch, 'circle': draw_circle_patch}
-    if frame not in patch_dict:
-        raise ValueError('unknown value for `frame`: %s' % frame)
-
-    class RadarAxes(PolarAxes):
-
-        name = 'radar'
-        # use 1 line segment to connect specified points
-        RESOLUTION = 1
-        # define draw_frame method
-        draw_patch = patch_dict[frame]
-
-        def fill(self, *args, **kwargs):
-            """Override fill so that line is closed by default"""
-            closed = kwargs.pop('closed', True)
-            return super(RadarAxes, self).fill(closed=closed, *args, **kwargs)
-
-        def plot(self, *args, **kwargs):
-            """Override plot so that line is closed by default"""
-            lines = super(RadarAxes, self).plot(*args, **kwargs)
-            for line in lines:
-                self._close_line(line)
-
-        def _close_line(self, line):
-            x, y = line.get_data()
-            # FIXME: markers at x[0], y[0] get doubled-up
-            if x[0] != x[-1]:
-                x = np.concatenate((x, [x[0]]))
-                y = np.concatenate((y, [y[0]]))
-                line.set_data(x, y)
-
-        def set_varlabels(self, labels):
-            self.set_thetagrids(np.degrees(theta), labels)
-
-        def _gen_axes_patch(self):
-            return self.draw_patch()
-
-        def _gen_axes_spines(self):
-            if frame == 'circle':
-                return PolarAxes._gen_axes_spines(self)
-            # The following is a hack to get the spines (i.e. the axes frame)
-            # to draw correctly for a polygon frame.
-
-            # spine_type must be 'left', 'right', 'top', 'bottom', or `circle`.
-            spine_type = 'circle'
-            verts = unit_poly_verts(theta)
-            # close off polygon by repeating first vertex
-            verts.append(verts[0])
-            path = Path(verts)
-
-            spine = Spine(self, spine_type, path)
-            spine.set_transform(self.transAxes)
-            return {'polar': spine}
-
-    register_projection(RadarAxes)
-    return theta
-
-
-def unit_poly_verts(theta):
-    """Return vertices of polygon for subplot axes.
-
-    This polygon is circumscribed by a unit circle centered at (0.5, 0.5)
-    """
-    x0, y0, r = [0.5] * 3
-    verts = [(r*np.cos(t) + x0, r*np.sin(t) + y0) for t in theta]
-    return verts
-
-
-def example_data():
-    # The following data is from the Denver Aerosol Sources and Health study.
-    # See  doi:10.1016/j.atmosenv.2008.12.017
-    #
-    # The data are pollution source profile estimates for five modeled
-    # pollution sources (e.g., cars, wood-burning, etc) that emit 7-9 chemical
-    # species. The radar charts are experimented with here to see if we can
-    # nicely visualize how the modeled source profiles change across four
-    # scenarios:
-    #  1) No gas-phase species present, just seven particulate counts on
-    #     Sulfate
-    #     Nitrate
-    #     Elemental Carbon (EC)
-    #     Organic Carbon fraction 1 (OC)
-    #     Organic Carbon fraction 2 (OC2)
-    #     Organic Carbon fraction 3 (OC3)
-    #     Pyrolized Organic Carbon (OP)
-    #  2)Inclusion of gas-phase specie carbon monoxide (CO)
-    #  3)Inclusion of gas-phase specie ozone (O3).
-    #  4)Inclusion of both gas-phase species is present...
-    data = [
-        ['Sulfate', 'Nitrate', 'EC', 'OC1', 'OC2', 'OC3', 'OP', 'CO', 'O3'],
-        ('Basecase', [
-            [0.88, 0.01, 0.03, 0.03, 0.00, 0.06, 0.01, 0.00, 0.00],
-            [0.07, 0.95, 0.04, 0.05, 0.00, 0.02, 0.01, 0.00, 0.00],
-            [0.01, 0.02, 0.85, 0.19, 0.05, 0.10, 0.00, 0.00, 0.00],
-            [0.02, 0.01, 0.07, 0.01, 0.21, 0.12, 0.98, 0.00, 0.00],
-            [0.01, 0.01, 0.02, 0.71, 0.74, 0.70, 0.00, 0.00, 0.00]]),
-        ('With CO', [
-            [0.88, 0.02, 0.02, 0.02, 0.00, 0.05, 0.00, 0.05, 0.00],
-            [0.08, 0.94, 0.04, 0.02, 0.00, 0.01, 0.12, 0.04, 0.00],
-            [0.01, 0.01, 0.79, 0.10, 0.00, 0.05, 0.00, 0.31, 0.00],
-            [0.00, 0.02, 0.03, 0.38, 0.31, 0.31, 0.00, 0.59, 0.00],
-            [0.02, 0.02, 0.11, 0.47, 0.69, 0.58, 0.88, 0.00, 0.00]]),
-        ('With O3', [
-            [0.89, 0.01, 0.07, 0.00, 0.00, 0.05, 0.00, 0.00, 0.03],
-            [0.07, 0.95, 0.05, 0.04, 0.00, 0.02, 0.12, 0.00, 0.00],
-            [0.01, 0.02, 0.86, 0.27, 0.16, 0.19, 0.00, 0.00, 0.00],
-            [0.01, 0.03, 0.00, 0.32, 0.29, 0.27, 0.00, 0.00, 0.95],
-            [0.02, 0.00, 0.03, 0.37, 0.56, 0.47, 0.87, 0.00, 0.00]]),
-        ('CO & O3', [
-            [0.87, 0.01, 0.08, 0.00, 0.00, 0.04, 0.00, 0.00, 0.01],
-            [0.09, 0.95, 0.02, 0.03, 0.00, 0.01, 0.13, 0.06, 0.00],
-            [0.01, 0.02, 0.71, 0.24, 0.13, 0.16, 0.00, 0.50, 0.00],
-            [0.01, 0.03, 0.00, 0.28, 0.24, 0.23, 0.00, 0.44, 0.88],
-            [0.02, 0.00, 0.18, 0.45, 0.64, 0.55, 0.86, 0.00, 0.16]])
-    ]
-    return data
-
-
-if __name__ == '__main__':
-    N = 9
-    theta = radar_factory(N, frame='polygon')
-
-    data = example_data()
-    spoke_labels = data.pop(0)
-
-    fig, axes = plt.subplots(figsize=(9, 9), nrows=2, ncols=2,
-                             subplot_kw=dict(projection='radar'))
-    fig.subplots_adjust(wspace=0.25, hspace=0.20, top=0.85, bottom=0.05)
-
-    colors = ['b', 'r', 'g', 'm', 'y']
-    # Plot the four cases from the example data on separate axes
-    for ax, (title, case_data) in zip(axes.flatten(), data):
-        ax.set_rgrids([0.2, 0.4, 0.6, 0.8])
-        ax.set_title(title, weight='bold', size='medium', position=(0.5, 1.1),
-                     horizontalalignment='center', verticalalignment='center')
-        for d, color in zip(case_data, colors):
-            ax.plot(theta, d, color=color)
-            ax.fill(theta, d, facecolor=color, alpha=0.25)
-        ax.set_varlabels(spoke_labels)
-
-    # add legend relative to top-left plot
-    ax = axes[0, 0]
-    labels = ('Factor 1', 'Factor 2', 'Factor 3', 'Factor 4', 'Factor 5')
-    legend = ax.legend(labels, loc=(0.9, .95),
-                       labelspacing=0.1, fontsize='small')
-
-    fig.text(0.5, 0.965, '5-Factor Solution Profiles Across Four Scenarios',
-             horizontalalignment='center', color='black', weight='bold',
-             size='large')
-
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/sankey_demo_basics.html b/examples/api/sankey_demo_basics.html deleted file mode 100644 index 68316c59416..00000000000 --- a/examples/api/sankey_demo_basics.html +++ /dev/null @@ -1,412 +0,0 @@ - - - - - - - - api example code: sankey_demo_basics.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: sankey_demo_basics.py

-

(Source code)

-
-../../_images/sankey_demo_basics_00.png -

(png, pdf)

-
-
-../../_images/sankey_demo_basics_01.png -

(png, pdf)

-
-
-../../_images/sankey_demo_basics_02.png -

(png, pdf)

-
-
"""
-================
-The Sankey class
-================
-
-Demonstrate the Sankey class by producing three basic diagrams.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-from matplotlib.sankey import Sankey
-
-
-# Example 1 -- Mostly defaults
-# This demonstrates how to create a simple diagram by implicitly calling the
-# Sankey.add() method and by appending finish() to the call to the class.
-Sankey(flows=[0.25, 0.15, 0.60, -0.20, -0.15, -0.05, -0.50, -0.10],
-       labels=['', '', '', 'First', 'Second', 'Third', 'Fourth', 'Fifth'],
-       orientations=[-1, 1, 0, 1, 1, 1, 0, -1]).finish()
-plt.title("The default settings produce a diagram like this.")
-# Notice:
-#   1. Axes weren't provided when Sankey() was instantiated, so they were
-#      created automatically.
-#   2. The scale argument wasn't necessary since the data was already
-#      normalized.
-#   3. By default, the lengths of the paths are justified.
-
-# Example 2
-# This demonstrates:
-#   1. Setting one path longer than the others
-#   2. Placing a label in the middle of the diagram
-#   3. Using the scale argument to normalize the flows
-#   4. Implicitly passing keyword arguments to PathPatch()
-#   5. Changing the angle of the arrow heads
-#   6. Changing the offset between the tips of the paths and their labels
-#   7. Formatting the numbers in the path labels and the associated unit
-#   8. Changing the appearance of the patch and the labels after the figure is
-#      created
-fig = plt.figure()
-ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[],
-                     title="Flow Diagram of a Widget")
-sankey = Sankey(ax=ax, scale=0.01, offset=0.2, head_angle=180,
-                format='%.0f', unit='%')
-sankey.add(flows=[25, 0, 60, -10, -20, -5, -15, -10, -40],
-           labels=['', '', '', 'First', 'Second', 'Third', 'Fourth',
-                   'Fifth', 'Hurray!'],
-           orientations=[-1, 1, 0, 1, 1, 1, -1, -1, 0],
-           pathlengths=[0.25, 0.25, 0.25, 0.25, 0.25, 0.6, 0.25, 0.25,
-                        0.25],
-           patchlabel="Widget\nA")  # Arguments to matplotlib.patches.PathPatch()
-diagrams = sankey.finish()
-diagrams[0].texts[-1].set_color('r')
-diagrams[0].text.set_fontweight('bold')
-# Notice:
-#   1. Since the sum of the flows is nonzero, the width of the trunk isn't
-#      uniform.  If verbose.level is helpful (in matplotlibrc), a message is
-#      given in the terminal window.
-#   2. The second flow doesn't appear because its value is zero.  Again, if
-#      verbose.level is helpful, a message is given in the terminal window.
-
-# Example 3
-# This demonstrates:
-#   1. Connecting two systems
-#   2. Turning off the labels of the quantities
-#   3. Adding a legend
-fig = plt.figure()
-ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[], title="Two Systems")
-flows = [0.25, 0.15, 0.60, -0.10, -0.05, -0.25, -0.15, -0.10, -0.35]
-sankey = Sankey(ax=ax, unit=None)
-sankey.add(flows=flows, label='one',
-           orientations=[-1, 1, 0, 1, 1, 1, -1, -1, 0])
-sankey.add(flows=[-0.25, 0.15, 0.1], label='two',
-           orientations=[-1, -1, -1], prior=0, connect=(0, 0))
-diagrams = sankey.finish()
-diagrams[-1].patch.set_hatch('/')
-plt.legend(loc='best')
-# Notice that only one connection is specified, but the systems form a
-# circuit since: (1) the lengths of the paths are justified and (2) the
-# orientation and ordering of the flows is mirrored.
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/sankey_demo_links.html b/examples/api/sankey_demo_links.html deleted file mode 100644 index e96f7dd594c..00000000000 --- a/examples/api/sankey_demo_links.html +++ /dev/null @@ -1,380 +0,0 @@ - - - - - - - - api example code: sankey_demo_links.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- - - - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/sankey_demo_old.html b/examples/api/sankey_demo_old.html deleted file mode 100644 index d34cc0d3bb6..00000000000 --- a/examples/api/sankey_demo_old.html +++ /dev/null @@ -1,522 +0,0 @@ - - - - - - - - api example code: sankey_demo_old.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: sankey_demo_old.py

-

(Source code, png, pdf)

-
-../../_images/sankey_demo_old.png -
-
"""
-==========================
-Yet another Sankey diagram
-==========================
-
-This example showcases a more complex sankey diagram.
-"""
-
-from __future__ import print_function
-
-__author__ = "Yannick Copin <ycopin@ipnl.in2p3.fr>"
-__version__ = "Time-stamp: <10/02/2010 16:49 ycopin@lyopc548.in2p3.fr>"
-
-import numpy as np
-
-
-def sankey(ax,
-           outputs=[100.], outlabels=None,
-           inputs=[100.], inlabels='',
-           dx=40, dy=10, outangle=45, w=3, inangle=30, offset=2, **kwargs):
-    """Draw a Sankey diagram.
-
-    outputs: array of outputs, should sum up to 100%
-    outlabels: output labels (same length as outputs),
-    or None (use default labels) or '' (no labels)
-    inputs and inlabels: similar for inputs
-    dx: horizontal elongation
-    dy: vertical elongation
-    outangle: output arrow angle [deg]
-    w: output arrow shoulder
-    inangle: input dip angle
-    offset: text offset
-    **kwargs: propagated to Patch (e.g., fill=False)
-
-    Return (patch,[intexts,outtexts]).
-    """
-    import matplotlib.patches as mpatches
-    from matplotlib.path import Path
-
-    outs = np.absolute(outputs)
-    outsigns = np.sign(outputs)
-    outsigns[-1] = 0  # Last output
-
-    ins = np.absolute(inputs)
-    insigns = np.sign(inputs)
-    insigns[0] = 0  # First input
-
-    assert sum(outs) == 100, "Outputs don't sum up to 100%"
-    assert sum(ins) == 100, "Inputs don't sum up to 100%"
-
-    def add_output(path, loss, sign=1):
-        # Arrow tip height
-        h = (loss/2 + w) * np.tan(np.radians(outangle))
-        move, (x, y) = path[-1]  # Use last point as reference
-        if sign == 0:  # Final loss (horizontal)
-            path.extend([(Path.LINETO, [x + dx, y]),
-                         (Path.LINETO, [x + dx, y + w]),
-                         (Path.LINETO, [x + dx + h, y - loss/2]),  # Tip
-                         (Path.LINETO, [x + dx, y - loss - w]),
-                         (Path.LINETO, [x + dx, y - loss])])
-            outtips.append((sign, path[-3][1]))
-        else:  # Intermediate loss (vertical)
-            path.extend([(Path.CURVE4, [x + dx/2, y]),
-                         (Path.CURVE4, [x + dx, y]),
-                         (Path.CURVE4, [x + dx, y + sign*dy]),
-                         (Path.LINETO, [x + dx - w, y + sign*dy]),
-                         # Tip
-                         (Path.LINETO, [
-                          x + dx + loss/2, y + sign*(dy + h)]),
-                         (Path.LINETO, [x + dx + loss + w, y + sign*dy]),
-                         (Path.LINETO, [x + dx + loss, y + sign*dy]),
-                         (Path.CURVE3, [x + dx + loss, y - sign*loss]),
-                         (Path.CURVE3, [x + dx/2 + loss, y - sign*loss])])
-            outtips.append((sign, path[-5][1]))
-
-    def add_input(path, gain, sign=1):
-        h = (gain / 2) * np.tan(np.radians(inangle))  # Dip depth
-        move, (x, y) = path[-1]  # Use last point as reference
-        if sign == 0:  # First gain (horizontal)
-            path.extend([(Path.LINETO, [x - dx, y]),
-                         (Path.LINETO, [x - dx + h, y + gain/2]),  # Dip
-                         (Path.LINETO, [x - dx, y + gain])])
-            xd, yd = path[-2][1]  # Dip position
-            indips.append((sign, [xd - h, yd]))
-        else:  # Intermediate gain (vertical)
-            path.extend([(Path.CURVE4, [x - dx/2, y]),
-                         (Path.CURVE4, [x - dx, y]),
-                         (Path.CURVE4, [x - dx, y + sign*dy]),
-                         # Dip
-                         (Path.LINETO, [
-                          x - dx - gain / 2, y + sign*(dy - h)]),
-                         (Path.LINETO, [x - dx - gain, y + sign*dy]),
-                         (Path.CURVE3, [x - dx - gain, y - sign*gain]),
-                         (Path.CURVE3, [x - dx/2 - gain, y - sign*gain])])
-            xd, yd = path[-4][1]  # Dip position
-            indips.append((sign, [xd, yd + sign*h]))
-
-    outtips = []  # Output arrow tip dir. and positions
-    urpath = [(Path.MOVETO, [0, 100])]  # 1st point of upper right path
-    lrpath = [(Path.LINETO, [0, 0])]  # 1st point of lower right path
-    for loss, sign in zip(outs, outsigns):
-        add_output(sign >= 0 and urpath or lrpath, loss, sign=sign)
-
-    indips = []  # Input arrow tip dir. and positions
-    llpath = [(Path.LINETO, [0, 0])]  # 1st point of lower left path
-    ulpath = [(Path.MOVETO, [0, 100])]  # 1st point of upper left path
-    for gain, sign in reversed(list(zip(ins, insigns))):
-        add_input(sign <= 0 and llpath or ulpath, gain, sign=sign)
-
-    def revert(path):
-        """A path is not just revertable by path[::-1] because of Bezier
-        curves."""
-        rpath = []
-        nextmove = Path.LINETO
-        for move, pos in path[::-1]:
-            rpath.append((nextmove, pos))
-            nextmove = move
-        return rpath
-
-    # Concatenate subpathes in correct order
-    path = urpath + revert(lrpath) + llpath + revert(ulpath)
-
-    codes, verts = zip(*path)
-    verts = np.array(verts)
-
-    # Path patch
-    path = Path(verts, codes)
-    patch = mpatches.PathPatch(path, **kwargs)
-    ax.add_patch(patch)
-
-    if False:  # DEBUG
-        print("urpath", urpath)
-        print("lrpath", revert(lrpath))
-        print("llpath", llpath)
-        print("ulpath", revert(ulpath))
-        xs, ys = zip(*verts)
-        ax.plot(xs, ys, 'go-')
-
-    # Labels
-
-    def set_labels(labels, values):
-        """Set or check labels according to values."""
-        if labels == '':  # No labels
-            return labels
-        elif labels is None:  # Default labels
-            return ['%2d%%' % val for val in values]
-        else:
-            assert len(labels) == len(values)
-            return labels
-
-    def put_labels(labels, positions, output=True):
-        """Put labels to positions."""
-        texts = []
-        lbls = output and labels or labels[::-1]
-        for i, label in enumerate(lbls):
-            s, (x, y) = positions[i]  # Label direction and position
-            if s == 0:
-                t = ax.text(x + offset, y, label,
-                            ha=output and 'left' or 'right', va='center')
-            elif s > 0:
-                t = ax.text(x, y + offset, label, ha='center', va='bottom')
-            else:
-                t = ax.text(x, y - offset, label, ha='center', va='top')
-            texts.append(t)
-        return texts
-
-    outlabels = set_labels(outlabels, outs)
-    outtexts = put_labels(outlabels, outtips, output=True)
-
-    inlabels = set_labels(inlabels, ins)
-    intexts = put_labels(inlabels, indips, output=False)
-
-    # Axes management
-    ax.set_xlim(verts[:, 0].min() - dx, verts[:, 0].max() + dx)
-    ax.set_ylim(verts[:, 1].min() - dy, verts[:, 1].max() + dy)
-    ax.set_aspect('equal', adjustable='datalim')
-
-    return patch, [intexts, outtexts]
-
-
-if __name__ == '__main__':
-
-    import matplotlib.pyplot as plt
-
-    outputs = [10., -20., 5., 15., -10., 40.]
-    outlabels = ['First', 'Second', 'Third', 'Fourth', 'Fifth', 'Hurray!']
-    outlabels = [s + '\n%d%%' % abs(l) for l, s in zip(outputs, outlabels)]
-
-    inputs = [60., -25., 15.]
-
-    fig = plt.figure()
-    ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[], title="Sankey diagram")
-
-    patch, (intexts, outtexts) = sankey(ax, outputs=outputs,
-                                        outlabels=outlabels, inputs=inputs,
-                                        inlabels=None)
-    outtexts[1].set_color('r')
-    outtexts[-1].set_fontweight('bold')
-
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/sankey_demo_rankine.html b/examples/api/sankey_demo_rankine.html deleted file mode 100644 index ce4ed9bd535..00000000000 --- a/examples/api/sankey_demo_rankine.html +++ /dev/null @@ -1,406 +0,0 @@ - - - - - - - - api example code: sankey_demo_rankine.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: sankey_demo_rankine.py

-

(Source code, png, pdf)

-
-../../_images/sankey_demo_rankine.png -
-
"""
-===================
-Rankine power cycle
-===================
-
-Demonstrate the Sankey class with a practical example of a Rankine power
-cycle.
-
-"""
-import matplotlib.pyplot as plt
-
-from matplotlib.sankey import Sankey
-
-fig = plt.figure(figsize=(8, 9))
-ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[],
-                     title="Rankine Power Cycle: Example 8.6 from Moran and "
-                     "Shapiro\n\x22Fundamentals of Engineering Thermodynamics "
-                     "\x22, 6th ed., 2008")
-Hdot = [260.431, 35.078, 180.794, 221.115, 22.700,
-        142.361, 10.193, 10.210, 43.670, 44.312,
-        68.631, 10.758, 10.758, 0.017, 0.642,
-        232.121, 44.559, 100.613, 132.168]  # MW
-sankey = Sankey(ax=ax, format='%.3G', unit=' MW', gap=0.5, scale=1.0/Hdot[0])
-sankey.add(patchlabel='\n\nPump 1', rotation=90, facecolor='#37c959',
-           flows=[Hdot[13], Hdot[6], -Hdot[7]],
-           labels=['Shaft power', '', None],
-           pathlengths=[0.4, 0.883, 0.25],
-           orientations=[1, -1, 0])
-sankey.add(patchlabel='\n\nOpen\nheater', facecolor='#37c959',
-           flows=[Hdot[11], Hdot[7], Hdot[4], -Hdot[8]],
-           labels=[None, '', None, None],
-           pathlengths=[0.25, 0.25, 1.93, 0.25],
-           orientations=[1, 0, -1, 0], prior=0, connect=(2, 1))
-sankey.add(patchlabel='\n\nPump 2', facecolor='#37c959',
-           flows=[Hdot[14], Hdot[8], -Hdot[9]],
-           labels=['Shaft power', '', None],
-           pathlengths=[0.4, 0.25, 0.25],
-           orientations=[1, 0, 0], prior=1, connect=(3, 1))
-sankey.add(patchlabel='Closed\nheater', trunklength=2.914, fc='#37c959',
-           flows=[Hdot[9], Hdot[1], -Hdot[11], -Hdot[10]],
-           pathlengths=[0.25, 1.543, 0.25, 0.25],
-           labels=['', '', None, None],
-           orientations=[0, -1, 1, -1], prior=2, connect=(2, 0))
-sankey.add(patchlabel='Trap', facecolor='#37c959', trunklength=5.102,
-           flows=[Hdot[11], -Hdot[12]],
-           labels=['\n', None],
-           pathlengths=[1.0, 1.01],
-           orientations=[1, 1], prior=3, connect=(2, 0))
-sankey.add(patchlabel='Steam\ngenerator', facecolor='#ff5555',
-           flows=[Hdot[15], Hdot[10], Hdot[2], -Hdot[3], -Hdot[0]],
-           labels=['Heat rate', '', '', None, None],
-           pathlengths=0.25,
-           orientations=[1, 0, -1, -1, -1], prior=3, connect=(3, 1))
-sankey.add(patchlabel='\n\n\nTurbine 1', facecolor='#37c959',
-           flows=[Hdot[0], -Hdot[16], -Hdot[1], -Hdot[2]],
-           labels=['', None, None, None],
-           pathlengths=[0.25, 0.153, 1.543, 0.25],
-           orientations=[0, 1, -1, -1], prior=5, connect=(4, 0))
-sankey.add(patchlabel='\n\n\nReheat', facecolor='#37c959',
-           flows=[Hdot[2], -Hdot[2]],
-           labels=[None, None],
-           pathlengths=[0.725, 0.25],
-           orientations=[-1, 0], prior=6, connect=(3, 0))
-sankey.add(patchlabel='Turbine 2', trunklength=3.212, facecolor='#37c959',
-           flows=[Hdot[3], Hdot[16], -Hdot[5], -Hdot[4], -Hdot[17]],
-           labels=[None, 'Shaft power', None, '', 'Shaft power'],
-           pathlengths=[0.751, 0.15, 0.25, 1.93, 0.25],
-           orientations=[0, -1, 0, -1, 1], prior=6, connect=(1, 1))
-sankey.add(patchlabel='Condenser', facecolor='#58b1fa', trunklength=1.764,
-           flows=[Hdot[5], -Hdot[18], -Hdot[6]],
-           labels=['', 'Heat rate', None],
-           pathlengths=[0.45, 0.25, 0.883],
-           orientations=[-1, 1, 0], prior=8, connect=(2, 0))
-diagrams = sankey.finish()
-for diagram in diagrams:
-    diagram.text.set_fontweight('bold')
-    diagram.text.set_fontsize('10')
-    for text in diagram.texts:
-        text.set_fontsize('10')
-# Notice that the explicit connections are handled automatically, but the
-# implicit ones currently are not.  The lengths of the paths and the trunks
-# must be adjusted manually, and that is a bit tricky.
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/scatter_piecharts.html b/examples/api/scatter_piecharts.html deleted file mode 100644 index e39e600a7ff..00000000000 --- a/examples/api/scatter_piecharts.html +++ /dev/null @@ -1,372 +0,0 @@ - - - - - - - - api example code: scatter_piecharts.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: scatter_piecharts.py

-

(Source code, png, pdf)

-
-../../_images/scatter_piecharts.png -
-
"""
-===================================
-Scatter plot with pie chart markers
-===================================
-
-This example makes custom 'pie charts' as the markers for a scatter plot.
-
-Thanks to Manuel Metz for the example
-"""
-import math
-import numpy as np
-import matplotlib.pyplot as plt
-
-# first define the ratios
-r1 = 0.2       # 20%
-r2 = r1 + 0.4  # 40%
-
-# define some sizes of the scatter marker
-sizes = [60, 80, 120]
-
-# calculate the points of the first pie marker
-#
-# these are just the origin (0,0) +
-# some points on a circle cos,sin
-x = [0] + np.cos(np.linspace(0, 2*math.pi*r1, 10)).tolist()
-y = [0] + np.sin(np.linspace(0, 2*math.pi*r1, 10)).tolist()
-
-xy1 = list(zip(x, y))
-s1 = max(max(x), max(y))
-
-# ...
-x = [0] + np.cos(np.linspace(2*math.pi*r1, 2*math.pi*r2, 10)).tolist()
-y = [0] + np.sin(np.linspace(2*math.pi*r1, 2*math.pi*r2, 10)).tolist()
-xy2 = list(zip(x, y))
-s2 = max(max(x), max(y))
-
-x = [0] + np.cos(np.linspace(2*math.pi*r2, 2*math.pi, 10)).tolist()
-y = [0] + np.sin(np.linspace(2*math.pi*r2, 2*math.pi, 10)).tolist()
-xy3 = list(zip(x, y))
-s3 = max(max(x), max(y))
-
-fig, ax = plt.subplots()
-ax.scatter(np.arange(3), np.arange(3), marker=(xy1, 0),
-           s=[s1*s1*_ for _ in sizes], facecolor='blue')
-ax.scatter(np.arange(3), np.arange(3), marker=(xy2, 0),
-           s=[s2*s2*_ for _ in sizes], facecolor='green')
-ax.scatter(np.arange(3), np.arange(3), marker=(xy3, 0),
-           s=[s3*s3*_ for _ in sizes], facecolor='red')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/skewt.html b/examples/api/skewt.html deleted file mode 100644 index 127fc2a8548..00000000000 --- a/examples/api/skewt.html +++ /dev/null @@ -1,615 +0,0 @@ - - - - - - - - api example code: skewt.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: skewt.py

-

(Source code, png, pdf)

-
-../../_images/skewt1.png -
-
"""
-===========================================================
-SkewT-logP diagram: using transforms and custom projections
-===========================================================
-
-This serves as an intensive exercise of matplotlib's transforms and custom
-projection API. This example produces a so-called SkewT-logP diagram, which is
-a common plot in meteorology for displaying vertical profiles of temperature.
-As far as matplotlib is concerned, the complexity comes from having X and Y
-axes that are not orthogonal. This is handled by including a skew component to
-the basic Axes transforms. Additional complexity comes in handling the fact
-that the upper and lower X-axes have different data ranges, which necessitates
-a bunch of custom classes for ticks,spines, and the axis to handle this.
-
-"""
-
-from matplotlib.axes import Axes
-import matplotlib.transforms as transforms
-import matplotlib.axis as maxis
-import matplotlib.spines as mspines
-from matplotlib.projections import register_projection
-
-
-# The sole purpose of this class is to look at the upper, lower, or total
-# interval as appropriate and see what parts of the tick to draw, if any.
-class SkewXTick(maxis.XTick):
-    def update_position(self, loc):
-        # This ensures that the new value of the location is set before
-        # any other updates take place
-        self._loc = loc
-        super(SkewXTick, self).update_position(loc)
-
-    def _has_default_loc(self):
-        return self.get_loc() is None
-
-    def _need_lower(self):
-        return (self._has_default_loc() or
-                transforms.interval_contains(self.axes.lower_xlim,
-                                             self.get_loc()))
-
-    def _need_upper(self):
-        return (self._has_default_loc() or
-                transforms.interval_contains(self.axes.upper_xlim,
-                                             self.get_loc()))
-
-    @property
-    def gridOn(self):
-        return (self._gridOn and (self._has_default_loc() or
-                transforms.interval_contains(self.get_view_interval(),
-                                             self.get_loc())))
-
-    @gridOn.setter
-    def gridOn(self, value):
-        self._gridOn = value
-
-    @property
-    def tick1On(self):
-        return self._tick1On and self._need_lower()
-
-    @tick1On.setter
-    def tick1On(self, value):
-        self._tick1On = value
-
-    @property
-    def label1On(self):
-        return self._label1On and self._need_lower()
-
-    @label1On.setter
-    def label1On(self, value):
-        self._label1On = value
-
-    @property
-    def tick2On(self):
-        return self._tick2On and self._need_upper()
-
-    @tick2On.setter
-    def tick2On(self, value):
-        self._tick2On = value
-
-    @property
-    def label2On(self):
-        return self._label2On and self._need_upper()
-
-    @label2On.setter
-    def label2On(self, value):
-        self._label2On = value
-
-    def get_view_interval(self):
-        return self.axes.xaxis.get_view_interval()
-
-
-# This class exists to provide two separate sets of intervals to the tick,
-# as well as create instances of the custom tick
-class SkewXAxis(maxis.XAxis):
-    def _get_tick(self, major):
-        return SkewXTick(self.axes, None, '', major=major)
-
-    def get_view_interval(self):
-        return self.axes.upper_xlim[0], self.axes.lower_xlim[1]
-
-
-# This class exists to calculate the separate data range of the
-# upper X-axis and draw the spine there. It also provides this range
-# to the X-axis artist for ticking and gridlines
-class SkewSpine(mspines.Spine):
-    def _adjust_location(self):
-        pts = self._path.vertices
-        if self.spine_type == 'top':
-            pts[:, 0] = self.axes.upper_xlim
-        else:
-            pts[:, 0] = self.axes.lower_xlim
-
-
-# This class handles registration of the skew-xaxes as a projection as well
-# as setting up the appropriate transformations. It also overrides standard
-# spines and axes instances as appropriate.
-class SkewXAxes(Axes):
-    # The projection must specify a name.  This will be used be the
-    # user to select the projection, i.e. ``subplot(111,
-    # projection='skewx')``.
-    name = 'skewx'
-
-    def _init_axis(self):
-        # Taken from Axes and modified to use our modified X-axis
-        self.xaxis = SkewXAxis(self)
-        self.spines['top'].register_axis(self.xaxis)
-        self.spines['bottom'].register_axis(self.xaxis)
-        self.yaxis = maxis.YAxis(self)
-        self.spines['left'].register_axis(self.yaxis)
-        self.spines['right'].register_axis(self.yaxis)
-
-    def _gen_axes_spines(self):
-        spines = {'top': SkewSpine.linear_spine(self, 'top'),
-                  'bottom': mspines.Spine.linear_spine(self, 'bottom'),
-                  'left': mspines.Spine.linear_spine(self, 'left'),
-                  'right': mspines.Spine.linear_spine(self, 'right')}
-        return spines
-
-    def _set_lim_and_transforms(self):
-        """
-        This is called once when the plot is created to set up all the
-        transforms for the data, text and grids.
-        """
-        rot = 30
-
-        # Get the standard transform setup from the Axes base class
-        Axes._set_lim_and_transforms(self)
-
-        # Need to put the skew in the middle, after the scale and limits,
-        # but before the transAxes. This way, the skew is done in Axes
-        # coordinates thus performing the transform around the proper origin
-        # We keep the pre-transAxes transform around for other users, like the
-        # spines for finding bounds
-        self.transDataToAxes = self.transScale + \
-            self.transLimits + transforms.Affine2D().skew_deg(rot, 0)
-
-        # Create the full transform from Data to Pixels
-        self.transData = self.transDataToAxes + self.transAxes
-
-        # Blended transforms like this need to have the skewing applied using
-        # both axes, in axes coords like before.
-        self._xaxis_transform = (transforms.blended_transform_factory(
-            self.transScale + self.transLimits,
-            transforms.IdentityTransform()) +
-            transforms.Affine2D().skew_deg(rot, 0)) + self.transAxes
-
-    @property
-    def lower_xlim(self):
-        return self.axes.viewLim.intervalx
-
-    @property
-    def upper_xlim(self):
-        pts = [[0., 1.], [1., 1.]]
-        return self.transDataToAxes.inverted().transform(pts)[:, 0]
-
-
-# Now register the projection with matplotlib so the user can select
-# it.
-register_projection(SkewXAxes)
-
-if __name__ == '__main__':
-    # Now make a simple example using the custom projection.
-    from matplotlib.ticker import (MultipleLocator, NullFormatter,
-                                   ScalarFormatter)
-    import matplotlib.pyplot as plt
-    from six import StringIO
-    import numpy as np
-
-    # Some examples data
-    data_txt = '''
-  978.0    345    7.8    0.8     61   4.16    325     14  282.7  294.6  283.4
-  971.0    404    7.2    0.2     61   4.01    327     17  282.7  294.2  283.4
-  946.7    610    5.2   -1.8     61   3.56    335     26  282.8  293.0  283.4
-  944.0    634    5.0   -2.0     61   3.51    336     27  282.8  292.9  283.4
-  925.0    798    3.4   -2.6     65   3.43    340     32  282.8  292.7  283.4
-  911.8    914    2.4   -2.7     69   3.46    345     37  282.9  292.9  283.5
-  906.0    966    2.0   -2.7     71   3.47    348     39  283.0  293.0  283.6
-  877.9   1219    0.4   -3.2     77   3.46      0     48  283.9  293.9  284.5
-  850.0   1478   -1.3   -3.7     84   3.44      0     47  284.8  294.8  285.4
-  841.0   1563   -1.9   -3.8     87   3.45    358     45  285.0  295.0  285.6
-  823.0   1736    1.4   -0.7     86   4.44    353     42  290.3  303.3  291.0
-  813.6   1829    4.5    1.2     80   5.17    350     40  294.5  309.8  295.4
-  809.0   1875    6.0    2.2     77   5.57    347     39  296.6  313.2  297.6
-  798.0   1988    7.4   -0.6     57   4.61    340     35  299.2  313.3  300.1
-  791.0   2061    7.6   -1.4     53   4.39    335     33  300.2  313.6  301.0
-  783.9   2134    7.0   -1.7     54   4.32    330     31  300.4  313.6  301.2
-  755.1   2438    4.8   -3.1     57   4.06    300     24  301.2  313.7  301.9
-  727.3   2743    2.5   -4.4     60   3.81    285     29  301.9  313.8  302.6
-  700.5   3048    0.2   -5.8     64   3.57    275     31  302.7  313.8  303.3
-  700.0   3054    0.2   -5.8     64   3.56    280     31  302.7  313.8  303.3
-  698.0   3077    0.0   -6.0     64   3.52    280     31  302.7  313.7  303.4
-  687.0   3204   -0.1   -7.1     59   3.28    281     31  304.0  314.3  304.6
-  648.9   3658   -3.2  -10.9     55   2.59    285     30  305.5  313.8  305.9
-  631.0   3881   -4.7  -12.7     54   2.29    289     33  306.2  313.6  306.6
-  600.7   4267   -6.4  -16.7     44   1.73    295     39  308.6  314.3  308.9
-  592.0   4381   -6.9  -17.9     41   1.59    297     41  309.3  314.6  309.6
-  577.6   4572   -8.1  -19.6     39   1.41    300     44  310.1  314.9  310.3
-  555.3   4877  -10.0  -22.3     36   1.16    295     39  311.3  315.3  311.5
-  536.0   5151  -11.7  -24.7     33   0.97    304     39  312.4  315.8  312.6
-  533.8   5182  -11.9  -25.0     33   0.95    305     39  312.5  315.8  312.7
-  500.0   5680  -15.9  -29.9     29   0.64    290     44  313.6  315.9  313.7
-  472.3   6096  -19.7  -33.4     28   0.49    285     46  314.1  315.8  314.1
-  453.0   6401  -22.4  -36.0     28   0.39    300     50  314.4  315.8  314.4
-  400.0   7310  -30.7  -43.7     27   0.20    285     44  315.0  315.8  315.0
-  399.7   7315  -30.8  -43.8     27   0.20    285     44  315.0  315.8  315.0
-  387.0   7543  -33.1  -46.1     26   0.16    281     47  314.9  315.5  314.9
-  382.7   7620  -33.8  -46.8     26   0.15    280     48  315.0  315.6  315.0
-  342.0   8398  -40.5  -53.5     23   0.08    293     52  316.1  316.4  316.1
-  320.4   8839  -43.7  -56.7     22   0.06    300     54  317.6  317.8  317.6
-  318.0   8890  -44.1  -57.1     22   0.05    301     55  317.8  318.0  317.8
-  310.0   9060  -44.7  -58.7     19   0.04    304     61  319.2  319.4  319.2
-  306.1   9144  -43.9  -57.9     20   0.05    305     63  321.5  321.7  321.5
-  305.0   9169  -43.7  -57.7     20   0.05    303     63  322.1  322.4  322.1
-  300.0   9280  -43.5  -57.5     20   0.05    295     64  323.9  324.2  323.9
-  292.0   9462  -43.7  -58.7     17   0.05    293     67  326.2  326.4  326.2
-  276.0   9838  -47.1  -62.1     16   0.03    290     74  326.6  326.7  326.6
-  264.0  10132  -47.5  -62.5     16   0.03    288     79  330.1  330.3  330.1
-  251.0  10464  -49.7  -64.7     16   0.03    285     85  331.7  331.8  331.7
-  250.0  10490  -49.7  -64.7     16   0.03    285     85  332.1  332.2  332.1
-  247.0  10569  -48.7  -63.7     16   0.03    283     88  334.7  334.8  334.7
-  244.0  10649  -48.9  -63.9     16   0.03    280     91  335.6  335.7  335.6
-  243.3  10668  -48.9  -63.9     16   0.03    280     91  335.8  335.9  335.8
-  220.0  11327  -50.3  -65.3     15   0.03    280     85  343.5  343.6  343.5
-  212.0  11569  -50.5  -65.5     15   0.03    280     83  346.8  346.9  346.8
-  210.0  11631  -49.7  -64.7     16   0.03    280     83  349.0  349.1  349.0
-  200.0  11950  -49.9  -64.9     15   0.03    280     80  353.6  353.7  353.6
-  194.0  12149  -49.9  -64.9     15   0.03    279     78  356.7  356.8  356.7
-  183.0  12529  -51.3  -66.3     15   0.03    278     75  360.4  360.5  360.4
-  164.0  13233  -55.3  -68.3     18   0.02    277     69  365.2  365.3  365.2
-  152.0  13716  -56.5  -69.5     18   0.02    275     65  371.1  371.2  371.1
-  150.0  13800  -57.1  -70.1     18   0.02    275     64  371.5  371.6  371.5
-  136.0  14414  -60.5  -72.5     19   0.02    268     54  376.0  376.1  376.0
-  132.0  14600  -60.1  -72.1     19   0.02    265     51  380.0  380.1  380.0
-  131.4  14630  -60.2  -72.2     19   0.02    265     51  380.3  380.4  380.3
-  128.0  14792  -60.9  -72.9     19   0.02    266     50  381.9  382.0  381.9
-  125.0  14939  -60.1  -72.1     19   0.02    268     49  385.9  386.0  385.9
-  119.0  15240  -62.2  -73.8     20   0.01    270     48  387.4  387.5  387.4
-  112.0  15616  -64.9  -75.9     21   0.01    265     53  389.3  389.3  389.3
-  108.0  15838  -64.1  -75.1     21   0.01    265     58  394.8  394.9  394.8
-  107.8  15850  -64.1  -75.1     21   0.01    265     58  395.0  395.1  395.0
-  105.0  16010  -64.7  -75.7     21   0.01    272     50  396.9  396.9  396.9
-  103.0  16128  -62.9  -73.9     21   0.02    277     45  402.5  402.6  402.5
-  100.0  16310  -62.5  -73.5     21   0.02    285     36  406.7  406.8  406.7
-    '''
-
-    # Parse the data
-    sound_data = StringIO(data_txt)
-    p, h, T, Td = np.loadtxt(sound_data, usecols=range(0, 4), unpack=True)
-
-    # Create a new figure. The dimensions here give a good aspect ratio
-    fig = plt.figure(figsize=(6.5875, 6.2125))
-    ax = fig.add_subplot(111, projection='skewx')
-
-    plt.grid(True)
-
-    # Plot the data using normal plotting functions, in this case using
-    # log scaling in Y, as dictated by the typical meteorological plot
-    ax.semilogy(T, p, color='C3')
-    ax.semilogy(Td, p, color='C2')
-
-    # An example of a slanted line at constant X
-    l = ax.axvline(0, color='C0')
-
-    # Disables the log-formatting that comes with semilogy
-    ax.yaxis.set_major_formatter(ScalarFormatter())
-    ax.yaxis.set_minor_formatter(NullFormatter())
-    ax.set_yticks(np.linspace(100, 1000, 10))
-    ax.set_ylim(1050, 100)
-
-    ax.xaxis.set_major_locator(MultipleLocator(10))
-    ax.set_xlim(-50, 50)
-
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/span_regions.html b/examples/api/span_regions.html deleted file mode 100644 index 760a90d27c1..00000000000 --- a/examples/api/span_regions.html +++ /dev/null @@ -1,357 +0,0 @@ - - - - - - - - api example code: span_regions.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: span_regions.py

-

(Source code, png, pdf)

-
-../../_images/span_regions.png -
-
"""
-================
-Using span_where
-================
-
-Illustrate some helper functions for shading regions where a logical
-mask is True
-
-See :meth:`matplotlib.collections.BrokenBarHCollection.span_where`
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.collections as collections
-
-
-t = np.arange(0.0, 2, 0.01)
-s1 = np.sin(2*np.pi*t)
-s2 = 1.2*np.sin(4*np.pi*t)
-
-
-fig, ax = plt.subplots()
-ax.set_title('using span_where')
-ax.plot(t, s1, color='black')
-ax.axhline(0, color='black', lw=2)
-
-collection = collections.BrokenBarHCollection.span_where(
-    t, ymin=0, ymax=1, where=s1 > 0, facecolor='green', alpha=0.5)
-ax.add_collection(collection)
-
-collection = collections.BrokenBarHCollection.span_where(
-    t, ymin=-1, ymax=0, where=s1 < 0, facecolor='red', alpha=0.5)
-ax.add_collection(collection)
-
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/two_scales.html b/examples/api/two_scales.html deleted file mode 100644 index b7e2d65539c..00000000000 --- a/examples/api/two_scales.html +++ /dev/null @@ -1,362 +0,0 @@ - - - - - - - - api example code: two_scales.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: two_scales.py

-

(Source code, png, pdf)

-
-../../_images/two_scales.png -
-
"""
-===========================
-Plots with different scales
-===========================
-
-Demonstrate how to do two plots on the same axes with different left and
-right scales.
-
-The trick is to use *two different axes* that share the same *x* axis.
-You can use separate `matplotlib.ticker` formatters and locators as
-desired since the two axes are independent.
-
-Such axes are generated by calling the `Axes.twinx` method.  Likewise,
-`Axes.twiny` is available to generate axes that share a *y* axis but
-have different top and bottom scales.
-
-The twinx and twiny methods are also exposed as pyplot functions.
-
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-
-fig, ax1 = plt.subplots()
-t = np.arange(0.01, 10.0, 0.01)
-s1 = np.exp(t)
-ax1.plot(t, s1, 'b-')
-ax1.set_xlabel('time (s)')
-# Make the y-axis label, ticks and tick labels match the line color.
-ax1.set_ylabel('exp', color='b')
-ax1.tick_params('y', colors='b')
-
-ax2 = ax1.twinx()
-s2 = np.sin(2 * np.pi * t)
-ax2.plot(t, s2, 'r.')
-ax2.set_ylabel('sin', color='r')
-ax2.tick_params('y', colors='r')
-
-fig.tight_layout()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/unicode_minus.html b/examples/api/unicode_minus.html deleted file mode 100644 index 2366e300c87..00000000000 --- a/examples/api/unicode_minus.html +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - - - api example code: unicode_minus.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: unicode_minus.py

-

(Source code, png, pdf)

-
-../../_images/unicode_minus.png -
-
"""
-=============
-Unicode minus
-=============
-
-You can use the proper typesetting Unicode minus (see
-https://en.wikipedia.org/wiki/Plus_sign#Plus_sign) or the ASCII hyphen
-for minus, which some people prefer.  The matplotlibrc param
-axes.unicode_minus controls the default behavior.
-
-The default is to use the Unicode minus.
-"""
-import numpy as np
-import matplotlib
-import matplotlib.pyplot as plt
-
-matplotlib.rcParams['axes.unicode_minus'] = False
-fig, ax = plt.subplots()
-ax.plot(10*np.random.randn(100), 10*np.random.randn(100), 'o')
-ax.set_title('Using hyphen instead of Unicode minus')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/watermark_image.html b/examples/api/watermark_image.html deleted file mode 100644 index a22d32215d2..00000000000 --- a/examples/api/watermark_image.html +++ /dev/null @@ -1,347 +0,0 @@ - - - - - - - - api example code: watermark_image.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: watermark_image.py

-

(Source code, png, pdf)

-
-../../_images/watermark_image.png -
-
"""
-===============
-Watermark image
-===============
-
-Use a PNG file as a watermark
-"""
-from __future__ import print_function
-import numpy as np
-import matplotlib.cbook as cbook
-import matplotlib.image as image
-import matplotlib.pyplot as plt
-
-datafile = cbook.get_sample_data('logo2.png', asfileobj=False)
-print('loading %s' % datafile)
-im = image.imread(datafile)
-im[:, :, -1] = 0.5  # set the alpha channel
-
-fig, ax = plt.subplots()
-
-ax.plot(np.random.rand(20), '-o', ms=20, lw=2, alpha=0.7, mfc='orange')
-ax.grid()
-fig.figimage(im, 10, 10, zorder=3)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/api/watermark_text.html b/examples/api/watermark_text.html deleted file mode 100644 index 41354052a23..00000000000 --- a/examples/api/watermark_text.html +++ /dev/null @@ -1,345 +0,0 @@ - - - - - - - - api example code: watermark_text.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

api example code: watermark_text.py

-

(Source code, png, pdf)

-
-../../_images/watermark_text.png -
-
"""
-==============
-Text watermark
-==============
-
-Use a Text as a watermark
-"""
-import numpy as np
-#import matplotlib
-#matplotlib.use('Agg')
-
-import matplotlib.pyplot as plt
-
-fig, ax = plt.subplots()
-ax.plot(np.random.rand(20), '-o', ms=20, lw=2, alpha=0.7, mfc='orange')
-ax.grid()
-
-# position bottom right
-fig.text(0.95, 0.05, 'Property of MPL',
-         fontsize=50, color='gray',
-         ha='right', va='bottom', alpha=0.5)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/axes_grid/demo_axes_divider.html b/examples/axes_grid/demo_axes_divider.html deleted file mode 100644 index a06e80c9d33..00000000000 --- a/examples/axes_grid/demo_axes_divider.html +++ /dev/null @@ -1,451 +0,0 @@ - - - - - - - - axes_grid example code: demo_axes_divider.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

axes_grid example code: demo_axes_divider.py

-

(Source code)

-

(png, pdf)

-
-../../_images/demo_axes_divider_01_00.png -
-
import matplotlib.pyplot as plt
-
-
-def get_demo_image():
-    import numpy as np
-    from matplotlib.cbook import get_sample_data
-    f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False)
-    z = np.load(f)
-    # z is a numpy array of 15x15
-    return z, (-3, 4, -4, 3)
-
-
-def demo_simple_image(ax):
-    Z, extent = get_demo_image()
-
-    im = ax.imshow(Z, extent=extent, interpolation="nearest")
-    cb = plt.colorbar(im)
-    plt.setp(cb.ax.get_yticklabels(), visible=False)
-
-
-def demo_locatable_axes_hard(fig1):
-
-    from mpl_toolkits.axes_grid1 \
-        import SubplotDivider, LocatableAxes, Size
-
-    divider = SubplotDivider(fig1, 2, 2, 2, aspect=True)
-
-    # axes for image
-    ax = LocatableAxes(fig1, divider.get_position())
-
-    # axes for colorbar
-    ax_cb = LocatableAxes(fig1, divider.get_position())
-
-    h = [Size.AxesX(ax),  # main axes
-         Size.Fixed(0.05),  # padding, 0.1 inch
-         Size.Fixed(0.2),  # colorbar, 0.3 inch
-         ]
-
-    v = [Size.AxesY(ax)]
-
-    divider.set_horizontal(h)
-    divider.set_vertical(v)
-
-    ax.set_axes_locator(divider.new_locator(nx=0, ny=0))
-    ax_cb.set_axes_locator(divider.new_locator(nx=2, ny=0))
-
-    fig1.add_axes(ax)
-    fig1.add_axes(ax_cb)
-
-    ax_cb.axis["left"].toggle(all=False)
-    ax_cb.axis["right"].toggle(ticks=True)
-
-    Z, extent = get_demo_image()
-
-    im = ax.imshow(Z, extent=extent, interpolation="nearest")
-    plt.colorbar(im, cax=ax_cb)
-    plt.setp(ax_cb.get_yticklabels(), visible=False)
-
-
-def demo_locatable_axes_easy(ax):
-    from mpl_toolkits.axes_grid1 import make_axes_locatable
-
-    divider = make_axes_locatable(ax)
-
-    ax_cb = divider.new_horizontal(size="5%", pad=0.05)
-    fig1 = ax.get_figure()
-    fig1.add_axes(ax_cb)
-
-    Z, extent = get_demo_image()
-    im = ax.imshow(Z, extent=extent, interpolation="nearest")
-
-    plt.colorbar(im, cax=ax_cb)
-    ax_cb.yaxis.tick_right()
-    for tl in ax_cb.get_yticklabels():
-        tl.set_visible(False)
-    ax_cb.yaxis.tick_right()
-
-
-def demo_images_side_by_side(ax):
-    from mpl_toolkits.axes_grid1 import make_axes_locatable
-
-    divider = make_axes_locatable(ax)
-
-    Z, extent = get_demo_image()
-    ax2 = divider.new_horizontal(size="100%", pad=0.05)
-    fig1 = ax.get_figure()
-    fig1.add_axes(ax2)
-
-    ax.imshow(Z, extent=extent, interpolation="nearest")
-    ax2.imshow(Z, extent=extent, interpolation="nearest")
-    for tl in ax2.get_yticklabels():
-        tl.set_visible(False)
-
-
-def demo():
-
-    fig1 = plt.figure(1, (6, 6))
-    fig1.clf()
-
-    # PLOT 1
-    # simple image & colorbar
-    ax = fig1.add_subplot(2, 2, 1)
-    demo_simple_image(ax)
-
-    # PLOT 2
-    # image and colorbar whose location is adjusted in the drawing time.
-    # a hard way
-
-    demo_locatable_axes_hard(fig1)
-
-    # PLOT 3
-    # image and colorbar whose location is adjusted in the drawing time.
-    # a easy way
-
-    ax = fig1.add_subplot(2, 2, 3)
-    demo_locatable_axes_easy(ax)
-
-    # PLOT 4
-    # two images side by side with fixed padding.
-
-    ax = fig1.add_subplot(2, 2, 4)
-    demo_images_side_by_side(ax)
-
-    plt.draw()
-    plt.show()
-
-
-demo()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/axes_grid/demo_axes_grid.html b/examples/axes_grid/demo_axes_grid.html deleted file mode 100644 index 975f011b26b..00000000000 --- a/examples/axes_grid/demo_axes_grid.html +++ /dev/null @@ -1,455 +0,0 @@ - - - - - - - - axes_grid example code: demo_axes_grid.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

axes_grid example code: demo_axes_grid.py

-

(Source code, png, pdf)

-
-../../_images/demo_axes_grid.png -
-
import matplotlib.pyplot as plt
-from mpl_toolkits.axes_grid1 import AxesGrid
-
-
-def get_demo_image():
-    import numpy as np
-    from matplotlib.cbook import get_sample_data
-    f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False)
-    z = np.load(f)
-    # z is a numpy array of 15x15
-    return z, (-3, 4, -4, 3)
-
-
-def demo_simple_grid(fig):
-    """
-    A grid of 2x2 images with 0.05 inch pad between images and only
-    the lower-left axes is labeled.
-    """
-    grid = AxesGrid(fig, 141,  # similar to subplot(141)
-                    nrows_ncols=(2, 2),
-                    axes_pad=0.05,
-                    label_mode="1",
-                    )
-
-    Z, extent = get_demo_image()
-    for i in range(4):
-        im = grid[i].imshow(Z, extent=extent, interpolation="nearest")
-
-    # This only affects axes in first column and second row as share_all =
-    # False.
-    grid.axes_llc.set_xticks([-2, 0, 2])
-    grid.axes_llc.set_yticks([-2, 0, 2])
-
-
-def demo_grid_with_single_cbar(fig):
-    """
-    A grid of 2x2 images with a single colorbar
-    """
-    grid = AxesGrid(fig, 142,  # similar to subplot(142)
-                    nrows_ncols=(2, 2),
-                    axes_pad=0.0,
-                    share_all=True,
-                    label_mode="L",
-                    cbar_location="top",
-                    cbar_mode="single",
-                    )
-
-    Z, extent = get_demo_image()
-    for i in range(4):
-        im = grid[i].imshow(Z, extent=extent, interpolation="nearest")
-    #plt.colorbar(im, cax = grid.cbar_axes[0])
-    grid.cbar_axes[0].colorbar(im)
-
-    for cax in grid.cbar_axes:
-        cax.toggle_label(False)
-
-    # This affects all axes as share_all = True.
-    grid.axes_llc.set_xticks([-2, 0, 2])
-    grid.axes_llc.set_yticks([-2, 0, 2])
-
-
-def demo_grid_with_each_cbar(fig):
-    """
-    A grid of 2x2 images. Each image has its own colorbar.
-    """
-
-    grid = AxesGrid(fig, 143,  # similar to subplot(143)
-                    nrows_ncols=(2, 2),
-                    axes_pad=0.1,
-                    label_mode="1",
-                    share_all=True,
-                    cbar_location="top",
-                    cbar_mode="each",
-                    cbar_size="7%",
-                    cbar_pad="2%",
-                    )
-    Z, extent = get_demo_image()
-    for i in range(4):
-        im = grid[i].imshow(Z, extent=extent, interpolation="nearest")
-        grid.cbar_axes[i].colorbar(im)
-
-    for cax in grid.cbar_axes:
-        cax.toggle_label(False)
-
-    # This affects all axes because we set share_all = True.
-    grid.axes_llc.set_xticks([-2, 0, 2])
-    grid.axes_llc.set_yticks([-2, 0, 2])
-
-
-def demo_grid_with_each_cbar_labelled(fig):
-    """
-    A grid of 2x2 images. Each image has its own colorbar.
-    """
-
-    grid = AxesGrid(fig, 144,  # similar to subplot(144)
-                    nrows_ncols=(2, 2),
-                    axes_pad=(0.45, 0.15),
-                    label_mode="1",
-                    share_all=True,
-                    cbar_location="right",
-                    cbar_mode="each",
-                    cbar_size="7%",
-                    cbar_pad="2%",
-                    )
-    Z, extent = get_demo_image()
-
-    # Use a different colorbar range every time
-    limits = ((0, 1), (-2, 2), (-1.7, 1.4), (-1.5, 1))
-    for i in range(4):
-        im = grid[i].imshow(Z, extent=extent, interpolation="nearest",
-                            vmin=limits[i][0], vmax=limits[i][1])
-        grid.cbar_axes[i].colorbar(im)
-
-    for i, cax in enumerate(grid.cbar_axes):
-        cax.set_yticks((limits[i][0], limits[i][1]))
-
-    # This affects all axes because we set share_all = True.
-    grid.axes_llc.set_xticks([-2, 0, 2])
-    grid.axes_llc.set_yticks([-2, 0, 2])
-
-
-if 1:
-    F = plt.figure(1, (10.5, 2.5))
-
-    F.subplots_adjust(left=0.05, right=0.95)
-
-    demo_simple_grid(F)
-    demo_grid_with_single_cbar(F)
-    demo_grid_with_each_cbar(F)
-    demo_grid_with_each_cbar_labelled(F)
-
-    plt.draw()
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/axes_grid/demo_axes_grid2.html b/examples/axes_grid/demo_axes_grid2.html deleted file mode 100644 index 58061bc4e29..00000000000 --- a/examples/axes_grid/demo_axes_grid2.html +++ /dev/null @@ -1,435 +0,0 @@ - - - - - - - - axes_grid example code: demo_axes_grid2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

axes_grid example code: demo_axes_grid2.py

-

(Source code, png, pdf)

-
-../../_images/demo_axes_grid2.png -
-
import matplotlib.pyplot as plt
-from mpl_toolkits.axes_grid1 import ImageGrid
-import numpy as np
-
-
-def get_demo_image():
-    from matplotlib.cbook import get_sample_data
-    f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False)
-    z = np.load(f)
-    # z is a numpy array of 15x15
-    return z, (-3, 4, -4, 3)
-
-
-def add_inner_title(ax, title, loc, size=None, **kwargs):
-    from matplotlib.offsetbox import AnchoredText
-    from matplotlib.patheffects import withStroke
-    if size is None:
-        size = dict(size=plt.rcParams['legend.fontsize'])
-    at = AnchoredText(title, loc=loc, prop=size,
-                      pad=0., borderpad=0.5,
-                      frameon=False, **kwargs)
-    ax.add_artist(at)
-    at.txt._text.set_path_effects([withStroke(foreground="w", linewidth=3)])
-    return at
-
-if 1:
-    F = plt.figure(1, (6, 6))
-    F.clf()
-
-    # prepare images
-    Z, extent = get_demo_image()
-    ZS = [Z[i::3, :] for i in range(3)]
-    extent = extent[0], extent[1]/3., extent[2], extent[3]
-
-    # demo 1 : colorbar at each axes
-
-    grid = ImageGrid(F, 211,  # similar to subplot(111)
-                     nrows_ncols=(1, 3),
-                     direction="row",
-                     axes_pad=0.05,
-                     add_all=True,
-                     label_mode="1",
-                     share_all=True,
-                     cbar_location="top",
-                     cbar_mode="each",
-                     cbar_size="7%",
-                     cbar_pad="1%",
-                     )
-
-    for ax, z in zip(grid, ZS):
-        im = ax.imshow(
-            z, origin="lower", extent=extent, interpolation="nearest")
-        ax.cax.colorbar(im)
-
-    for ax, im_title in zip(grid, ["Image 1", "Image 2", "Image 3"]):
-        t = add_inner_title(ax, im_title, loc=3)
-        t.patch.set_alpha(0.5)
-
-    for ax, z in zip(grid, ZS):
-        ax.cax.toggle_label(True)
-        #axis = ax.cax.axis[ax.cax.orientation]
-        #axis.label.set_text("counts s$^{-1}$")
-        #axis.label.set_size(10)
-        #axis.major_ticklabels.set_size(6)
-
-    # changing the colorbar ticks
-    grid[1].cax.set_xticks([-1, 0, 1])
-    grid[2].cax.set_xticks([-1, 0, 1])
-
-    grid[0].set_xticks([-2, 0])
-    grid[0].set_yticks([-2, 0, 2])
-
-    # demo 2 : shared colorbar
-
-    grid2 = ImageGrid(F, 212,
-                      nrows_ncols=(1, 3),
-                      direction="row",
-                      axes_pad=0.05,
-                      add_all=True,
-                      label_mode="1",
-                      share_all=True,
-                      cbar_location="right",
-                      cbar_mode="single",
-                      cbar_size="10%",
-                      cbar_pad=0.05,
-                      )
-
-    grid2[0].set_xlabel("X")
-    grid2[0].set_ylabel("Y")
-
-    vmax, vmin = np.max(ZS), np.min(ZS)
-    import matplotlib.colors
-    norm = matplotlib.colors.Normalize(vmax=vmax, vmin=vmin)
-
-    for ax, z in zip(grid2, ZS):
-        im = ax.imshow(z, norm=norm,
-                       origin="lower", extent=extent,
-                       interpolation="nearest")
-
-    # With cbar_mode="single", cax attribute of all axes are identical.
-    ax.cax.colorbar(im)
-    ax.cax.toggle_label(True)
-
-    for ax, im_title in zip(grid2, ["(a)", "(b)", "(c)"]):
-        t = add_inner_title(ax, im_title, loc=2)
-        t.patch.set_ec("none")
-        t.patch.set_alpha(0.5)
-
-    grid2[0].set_xticks([-2, 0])
-    grid2[0].set_yticks([-2, 0, 2])
-
-    plt.draw()
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/axes_grid/demo_axes_hbox_divider.html b/examples/axes_grid/demo_axes_hbox_divider.html deleted file mode 100644 index 4921a1972d5..00000000000 --- a/examples/axes_grid/demo_axes_hbox_divider.html +++ /dev/null @@ -1,371 +0,0 @@ - - - - - - - - axes_grid example code: demo_axes_hbox_divider.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

axes_grid example code: demo_axes_hbox_divider.py

-

(Source code, png, pdf)

-
-../../_images/demo_axes_hbox_divider.png -
-
import numpy as np
-import matplotlib.pyplot as plt
-from mpl_toolkits.axes_grid1.axes_divider import HBoxDivider
-import mpl_toolkits.axes_grid1.axes_size as Size
-
-
-def make_heights_equal(fig, rect, ax1, ax2, pad):
-    # pad in inches
-
-    h1, v1 = Size.AxesX(ax1), Size.AxesY(ax1)
-    h2, v2 = Size.AxesX(ax2), Size.AxesY(ax2)
-
-    pad_v = Size.Scaled(1)
-    pad_h = Size.Fixed(pad)
-
-    my_divider = HBoxDivider(fig, rect,
-                             horizontal=[h1, pad_h, h2],
-                             vertical=[v1, pad_v, v2])
-
-    ax1.set_axes_locator(my_divider.new_locator(0))
-    ax2.set_axes_locator(my_divider.new_locator(2))
-
-
-if __name__ == "__main__":
-
-    arr1 = np.arange(20).reshape((4, 5))
-    arr2 = np.arange(20).reshape((5, 4))
-
-    fig, (ax1, ax2) = plt.subplots(1, 2)
-    ax1.imshow(arr1, interpolation="nearest")
-    ax2.imshow(arr2, interpolation="nearest")
-
-    rect = 111  # subplot param for combined axes
-    make_heights_equal(fig, rect, ax1, ax2, pad=0.5)  # pad in inches
-
-    for ax in [ax1, ax2]:
-        ax.locator_params(nbins=4)
-
-    # annotate
-    ax3 = plt.axes([0.5, 0.5, 0.001, 0.001], frameon=False)
-    ax3.xaxis.set_visible(False)
-    ax3.yaxis.set_visible(False)
-    ax3.annotate("Location of two axes are adjusted\n"
-                 "so that they have equal heights\n"
-                 "while maintaining their aspect ratios", (0.5, 0.5),
-                 xycoords="axes fraction", va="center", ha="center",
-                 bbox=dict(boxstyle="round, pad=1", fc="w"))
-
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/axes_grid/demo_axes_rgb.html b/examples/axes_grid/demo_axes_rgb.html deleted file mode 100644 index 2bfc59f3640..00000000000 --- a/examples/axes_grid/demo_axes_rgb.html +++ /dev/null @@ -1,411 +0,0 @@ - - - - - - - - axes_grid example code: demo_axes_rgb.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

axes_grid example code: demo_axes_rgb.py

-

(Source code)

-
-../../_images/demo_axes_rgb_00.png -

(png, pdf)

-
-
-../../_images/demo_axes_rgb_01.png -

(png, pdf)

-
-
import numpy as np
-import matplotlib.pyplot as plt
-
-from mpl_toolkits.axes_grid1.axes_rgb import make_rgb_axes, RGBAxes
-
-
-def get_demo_image():
-    from matplotlib.cbook import get_sample_data
-    f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False)
-    z = np.load(f)
-    # z is a numpy array of 15x15
-    return z, (-3, 4, -4, 3)
-
-
-def get_rgb():
-    Z, extent = get_demo_image()
-
-    Z[Z < 0] = 0.
-    Z = Z/Z.max()
-
-    R = Z[:13, :13]
-    G = Z[2:, 2:]
-    B = Z[:13, 2:]
-
-    return R, G, B
-
-
-def make_cube(r, g, b):
-    ny, nx = r.shape
-    R = np.zeros([ny, nx, 3], dtype="d")
-    R[:, :, 0] = r
-    G = np.zeros_like(R)
-    G[:, :, 1] = g
-    B = np.zeros_like(R)
-    B[:, :, 2] = b
-
-    RGB = R + G + B
-
-    return R, G, B, RGB
-
-
-def demo_rgb():
-    fig, ax = plt.subplots()
-    ax_r, ax_g, ax_b = make_rgb_axes(ax, pad=0.02)
-    #fig.add_axes(ax_r)
-    #fig.add_axes(ax_g)
-    #fig.add_axes(ax_b)
-
-    r, g, b = get_rgb()
-    im_r, im_g, im_b, im_rgb = make_cube(r, g, b)
-    kwargs = dict(origin="lower", interpolation="nearest")
-    ax.imshow(im_rgb, **kwargs)
-    ax_r.imshow(im_r, **kwargs)
-    ax_g.imshow(im_g, **kwargs)
-    ax_b.imshow(im_b, **kwargs)
-
-
-def demo_rgb2():
-    fig = plt.figure(2)
-    ax = RGBAxes(fig, [0.1, 0.1, 0.8, 0.8], pad=0.0)
-    #fig.add_axes(ax)
-    #ax.add_RGB_to_figure()
-
-    r, g, b = get_rgb()
-    kwargs = dict(origin="lower", interpolation="nearest")
-    ax.imshow_rgb(r, g, b, **kwargs)
-
-    ax.RGB.set_xlim(0., 9.5)
-    ax.RGB.set_ylim(0.9, 10.6)
-
-    for ax1 in [ax.RGB, ax.R, ax.G, ax.B]:
-        for sp1 in ax1.spines.values():
-            sp1.set_color("w")
-        for tick in ax1.xaxis.get_major_ticks() + ax1.yaxis.get_major_ticks():
-            tick.tick1line.set_mec("w")
-            tick.tick2line.set_mec("w")
-
-    return ax
-
-
-demo_rgb()
-ax = demo_rgb2()
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/axes_grid/demo_axisline_style.html b/examples/axes_grid/demo_axisline_style.html deleted file mode 100644 index 028863c606f..00000000000 --- a/examples/axes_grid/demo_axisline_style.html +++ /dev/null @@ -1,342 +0,0 @@ - - - - - - - - axes_grid example code: demo_axisline_style.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

axes_grid example code: demo_axisline_style.py

-

(Source code, png, pdf)

-
-../../_images/demo_axisline_style.png -
-
from mpl_toolkits.axes_grid.axislines import SubplotZero
-import matplotlib.pyplot as plt
-import numpy as np
-
-if 1:
-    fig = plt.figure(1)
-    ax = SubplotZero(fig, 111)
-    fig.add_subplot(ax)
-
-    for direction in ["xzero", "yzero"]:
-        ax.axis[direction].set_axisline_style("-|>")
-        ax.axis[direction].set_visible(True)
-
-    for direction in ["left", "right", "bottom", "top"]:
-        ax.axis[direction].set_visible(False)
-
-    x = np.linspace(-0.5, 1., 100)
-    ax.plot(x, np.sin(x*np.pi))
-
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/axes_grid/demo_colorbar_with_inset_locator.html b/examples/axes_grid/demo_colorbar_with_inset_locator.html deleted file mode 100644 index 7b156fd911a..00000000000 --- a/examples/axes_grid/demo_colorbar_with_inset_locator.html +++ /dev/null @@ -1,355 +0,0 @@ - - - - - - - - axes_grid example code: demo_colorbar_with_inset_locator.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

axes_grid example code: demo_colorbar_with_inset_locator.py

-

(Source code, png, pdf)

-
-../../_images/demo_colorbar_with_inset_locator.png -
-
import matplotlib.pyplot as plt
-
-from mpl_toolkits.axes_grid1.inset_locator import inset_axes
-
-fig, (ax1, ax2) = plt.subplots(1, 2, figsize=[6, 3])
-
-axins1 = inset_axes(ax1,
-                    width="50%",  # width = 10% of parent_bbox width
-                    height="5%",  # height : 50%
-                    loc=1)
-
-im1 = ax1.imshow([[1, 2], [2, 3]])
-plt.colorbar(im1, cax=axins1, orientation="horizontal", ticks=[1, 2, 3])
-axins1.xaxis.set_ticks_position("bottom")
-
-axins = inset_axes(ax2,
-                   width="5%",  # width = 10% of parent_bbox width
-                   height="50%",  # height : 50%
-                   loc=3,
-                   bbox_to_anchor=(1.05, 0., 1, 1),
-                   bbox_transform=ax2.transAxes,
-                   borderpad=0,
-                   )
-
-# Controlling the placement of the inset axes is basically same as that
-# of the legend.  you may want to play with the borderpad value and
-# the bbox_to_anchor coordinate.
-
-im = ax2.imshow([[1, 2], [2, 3]])
-plt.colorbar(im, cax=axins, ticks=[1, 2, 3])
-
-plt.draw()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/axes_grid/demo_curvelinear_grid.html b/examples/axes_grid/demo_curvelinear_grid.html deleted file mode 100644 index 864b8d3e1ec..00000000000 --- a/examples/axes_grid/demo_curvelinear_grid.html +++ /dev/null @@ -1,459 +0,0 @@ - - - - - - - - axes_grid example code: demo_curvelinear_grid.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

axes_grid example code: demo_curvelinear_grid.py

-

(Source code, png, pdf)

-
-../../_images/demo_curvelinear_grid.png -
-
"""
-Custom grid and ticklines.
-
-This example demonstrates how to use GridHelperCurveLinear to define
-custom grids and ticklines by applying a transformation on the grid.
-This can be used, as showcase on the second plot, to create polar
-projections in a rectangular box.
-"""
-
-import numpy as np
-
-import matplotlib.pyplot as plt
-import matplotlib.cbook as cbook
-
-from mpl_toolkits.axisartist import Subplot
-from mpl_toolkits.axisartist import SubplotHost, \
-    ParasiteAxesAuxTrans
-from mpl_toolkits.axisartist.grid_helper_curvelinear import \
-    GridHelperCurveLinear
-
-
-def curvelinear_test1(fig):
-    """
-    grid for custom transform.
-    """
-
-    def tr(x, y):
-        x, y = np.asarray(x), np.asarray(y)
-        return x, y - x
-
-    def inv_tr(x, y):
-        x, y = np.asarray(x), np.asarray(y)
-        return x, y + x
-
-    grid_helper = GridHelperCurveLinear((tr, inv_tr))
-
-    ax1 = Subplot(fig, 1, 2, 1, grid_helper=grid_helper)
-    # ax1 will have a ticks and gridlines defined by the given
-    # transform (+ transData of the Axes). Note that the transform of
-    # the Axes itself (i.e., transData) is not affected by the given
-    # transform.
-
-    fig.add_subplot(ax1)
-
-    xx, yy = tr([3, 6], [5.0, 10.])
-    ax1.plot(xx, yy, linewidth=2.0)
-
-    ax1.set_aspect(1.)
-    ax1.set_xlim(0, 10.)
-    ax1.set_ylim(0, 10.)
-
-    ax1.axis["t"] = ax1.new_floating_axis(0, 3.)
-    ax1.axis["t2"] = ax1.new_floating_axis(1, 7.)
-    ax1.grid(True, zorder=0)
-
-
-import mpl_toolkits.axisartist.angle_helper as angle_helper
-
-from matplotlib.projections import PolarAxes
-from matplotlib.transforms import Affine2D
-
-
-def curvelinear_test2(fig):
-    """
-    polar projection, but in a rectangular box.
-    """
-
-    # PolarAxes.PolarTransform takes radian. However, we want our coordinate
-    # system in degree
-    tr = Affine2D().scale(np.pi/180., 1.) + PolarAxes.PolarTransform()
-
-    # polar projection, which involves cycle, and also has limits in
-    # its coordinates, needs a special method to find the extremes
-    # (min, max of the coordinate within the view).
-
-    # 20, 20 : number of sampling points along x, y direction
-    extreme_finder = angle_helper.ExtremeFinderCycle(20, 20,
-                                                     lon_cycle=360,
-                                                     lat_cycle=None,
-                                                     lon_minmax=None,
-                                                     lat_minmax=(0, np.inf),
-                                                     )
-
-    grid_locator1 = angle_helper.LocatorDMS(12)
-    # Find a grid values appropriate for the coordinate (degree,
-    # minute, second).
-
-    tick_formatter1 = angle_helper.FormatterDMS()
-    # And also uses an appropriate formatter.  Note that,the
-    # acceptable Locator and Formatter class is a bit different than
-    # that of mpl's, and you cannot directly use mpl's Locator and
-    # Formatter here (but may be possible in the future).
-
-    grid_helper = GridHelperCurveLinear(tr,
-                                        extreme_finder=extreme_finder,
-                                        grid_locator1=grid_locator1,
-                                        tick_formatter1=tick_formatter1
-                                        )
-
-    ax1 = SubplotHost(fig, 1, 2, 2, grid_helper=grid_helper)
-
-    # make ticklabels of right and top axis visible.
-    ax1.axis["right"].major_ticklabels.set_visible(True)
-    ax1.axis["top"].major_ticklabels.set_visible(True)
-
-    # let right axis shows ticklabels for 1st coordinate (angle)
-    ax1.axis["right"].get_helper().nth_coord_ticks = 0
-    # let bottom axis shows ticklabels for 2nd coordinate (radius)
-    ax1.axis["bottom"].get_helper().nth_coord_ticks = 1
-
-    fig.add_subplot(ax1)
-
-    # A parasite axes with given transform
-    ax2 = ParasiteAxesAuxTrans(ax1, tr, "equal")
-    # note that ax2.transData == tr + ax1.transData
-    # Anything you draw in ax2 will match the ticks and grids of ax1.
-    ax1.parasites.append(ax2)
-    intp = cbook.simple_linear_interpolation
-    ax2.plot(intp(np.array([0, 30]), 50),
-             intp(np.array([10., 10.]), 50),
-             linewidth=2.0)
-
-    ax1.set_aspect(1.)
-    ax1.set_xlim(-5, 12)
-    ax1.set_ylim(-5, 10)
-
-    ax1.grid(True, zorder=0)
-
-if 1:
-    fig = plt.figure(1, figsize=(7, 4))
-    fig.clf()
-
-    curvelinear_test1(fig)
-    curvelinear_test2(fig)
-
-    plt.draw()
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/axes_grid/demo_curvelinear_grid2.html b/examples/axes_grid/demo_curvelinear_grid2.html deleted file mode 100644 index b5aa1ea428d..00000000000 --- a/examples/axes_grid/demo_curvelinear_grid2.html +++ /dev/null @@ -1,390 +0,0 @@ - - - - - - - - axes_grid example code: demo_curvelinear_grid2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

axes_grid example code: demo_curvelinear_grid2.py

-

(Source code, png, pdf)

-
-../../_images/demo_curvelinear_grid2.png -
-
"""
-Custom grid and ticklines.
-
-This example demonstrates how to use GridHelperCurveLinear to define
-custom grids and ticklines by applying a transformation on the grid.
-As showcase on the plot, a 5x5 matrix is displayed on the axes.
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-
-from mpl_toolkits.axes_grid.grid_helper_curvelinear import \
-    GridHelperCurveLinear
-from mpl_toolkits.axes_grid.axislines import Subplot
-
-import mpl_toolkits.axes_grid.angle_helper as angle_helper
-
-
-def curvelinear_test1(fig):
-    """
-    grid for custom transform.
-    """
-
-    def tr(x, y):
-        sgn = np.sign(x)
-        x, y = np.abs(np.asarray(x)), np.asarray(y)
-        return sgn*x**.5, y
-
-    def inv_tr(x, y):
-        sgn = np.sign(x)
-        x, y = np.asarray(x), np.asarray(y)
-        return sgn*x**2, y
-
-    extreme_finder = angle_helper.ExtremeFinderCycle(20, 20,
-                                                     lon_cycle=None,
-                                                     lat_cycle=None,
-                                                     # (0, np.inf),
-                                                     lon_minmax=None,
-                                                     lat_minmax=None,
-                                                     )
-
-    grid_helper = GridHelperCurveLinear((tr, inv_tr),
-                                        extreme_finder=extreme_finder)
-
-    ax1 = Subplot(fig, 111, grid_helper=grid_helper)
-    # ax1 will have a ticks and gridlines defined by the given
-    # transform (+ transData of the Axes). Note that the transform of
-    # the Axes itself (i.e., transData) is not affected by the given
-    # transform.
-
-    fig.add_subplot(ax1)
-
-    ax1.imshow(np.arange(25).reshape(5, 5),
-               vmax=50, cmap=plt.cm.gray_r,
-               interpolation="nearest",
-               origin="lower")
-
-    # tick density
-    grid_helper.grid_finder.grid_locator1._nbins = 6
-    grid_helper.grid_finder.grid_locator2._nbins = 6
-
-
-if 1:
-    fig = plt.figure(1, figsize=(7, 4))
-    fig.clf()
-
-    curvelinear_test1(fig)
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/axes_grid/demo_edge_colorbar.html b/examples/axes_grid/demo_edge_colorbar.html deleted file mode 100644 index 3ae7e5ad3e3..00000000000 --- a/examples/axes_grid/demo_edge_colorbar.html +++ /dev/null @@ -1,410 +0,0 @@ - - - - - - - - axes_grid example code: demo_edge_colorbar.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

axes_grid example code: demo_edge_colorbar.py

-

(Source code, png, pdf)

-
-../../_images/demo_edge_colorbar.png -
-
import matplotlib.pyplot as plt
-from mpl_toolkits.axes_grid1 import AxesGrid
-
-
-def get_demo_image():
-    import numpy as np
-    from matplotlib.cbook import get_sample_data
-    f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False)
-    z = np.load(f)
-    # z is a numpy array of 15x15
-    return z, (-3, 4, -4, 3)
-
-
-def demo_bottom_cbar(fig):
-    """
-    A grid of 2x2 images with a colorbar for each column.
-    """
-    grid = AxesGrid(fig, 121,  # similar to subplot(132)
-                    nrows_ncols=(2, 2),
-                    axes_pad=0.10,
-                    share_all=True,
-                    label_mode="1",
-                    cbar_location="bottom",
-                    cbar_mode="edge",
-                    cbar_pad=0.25,
-                    cbar_size="15%",
-                    direction="column"
-                    )
-
-    Z, extent = get_demo_image()
-    cmaps = [plt.get_cmap("autumn"), plt.get_cmap("summer")]
-    for i in range(4):
-        im = grid[i].imshow(Z, extent=extent, interpolation="nearest",
-                            cmap=cmaps[i//2])
-        if i % 2:
-            cbar = grid.cbar_axes[i//2].colorbar(im)
-
-    for cax in grid.cbar_axes:
-        cax.toggle_label(True)
-        cax.axis[cax.orientation].set_label("Bar")
-
-    # This affects all axes as share_all = True.
-    grid.axes_llc.set_xticks([-2, 0, 2])
-    grid.axes_llc.set_yticks([-2, 0, 2])
-
-
-def demo_right_cbar(fig):
-    """
-    A grid of 2x2 images. Each row has its own colorbar.
-    """
-
-    grid = AxesGrid(F, 122,  # similar to subplot(122)
-                    nrows_ncols=(2, 2),
-                    axes_pad=0.10,
-                    label_mode="1",
-                    share_all=True,
-                    cbar_location="right",
-                    cbar_mode="edge",
-                    cbar_size="7%",
-                    cbar_pad="2%",
-                    )
-    Z, extent = get_demo_image()
-    cmaps = [plt.get_cmap("spring"), plt.get_cmap("winter")]
-    for i in range(4):
-        im = grid[i].imshow(Z, extent=extent, interpolation="nearest",
-                            cmap=cmaps[i//2])
-        if i % 2:
-            grid.cbar_axes[i//2].colorbar(im)
-
-    for cax in grid.cbar_axes:
-        cax.toggle_label(True)
-        cax.axis[cax.orientation].set_label('Foo')
-
-    # This affects all axes because we set share_all = True.
-    grid.axes_llc.set_xticks([-2, 0, 2])
-    grid.axes_llc.set_yticks([-2, 0, 2])
-
-
-if 1:
-    F = plt.figure(1, (5.5, 2.5))
-
-    F.subplots_adjust(left=0.05, right=0.93)
-
-    demo_bottom_cbar(F)
-    demo_right_cbar(F)
-
-    plt.draw()
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/axes_grid/demo_floating_axes.html b/examples/axes_grid/demo_floating_axes.html deleted file mode 100644 index 5655ea92d7a..00000000000 --- a/examples/axes_grid/demo_floating_axes.html +++ /dev/null @@ -1,476 +0,0 @@ - - - - - - - - axes_grid example code: demo_floating_axes.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

axes_grid example code: demo_floating_axes.py

-

(Source code, png, pdf)

-
-../../_images/demo_floating_axes.png -
-
"""
-Demo of the floating axes.
-
-This demo shows features of functions in floating_axes:
-    * Using scatter function and bar function with changing the
-      shape of the plot.
-    * Using GridHelperCurveLinear to rotate the plot and set the
-      boundary of the plot.
-    * Using FloatingSubplot to create a subplot using the return
-      value from GridHelperCurveLinear.
-    * Making sector plot by adding more features to GridHelperCurveLinear.
-"""
-from matplotlib.transforms import Affine2D
-import mpl_toolkits.axisartist.floating_axes as floating_axes
-import numpy as np
-import mpl_toolkits.axisartist.angle_helper as angle_helper
-from matplotlib.projections import PolarAxes
-from mpl_toolkits.axisartist.grid_finder import (FixedLocator, MaxNLocator,
-                                                 DictFormatter)
-import matplotlib.pyplot as plt
-
-
-def setup_axes1(fig, rect):
-    """
-    A simple one.
-    """
-    tr = Affine2D().scale(2, 1).rotate_deg(30)
-
-    grid_helper = floating_axes.GridHelperCurveLinear(
-        tr, extremes=(-0.5, 3.5, 0, 4))
-
-    ax1 = floating_axes.FloatingSubplot(fig, rect, grid_helper=grid_helper)
-    fig.add_subplot(ax1)
-
-    aux_ax = ax1.get_aux_axes(tr)
-
-    grid_helper.grid_finder.grid_locator1._nbins = 4
-    grid_helper.grid_finder.grid_locator2._nbins = 4
-
-    return ax1, aux_ax
-
-
-def setup_axes2(fig, rect):
-    """
-    With custom locator and formatter.
-    Note that the extreme values are swapped.
-    """
-    tr = PolarAxes.PolarTransform()
-
-    pi = np.pi
-    angle_ticks = [(0, r"$0$"),
-                   (.25*pi, r"$\frac{1}{4}\pi$"),
-                   (.5*pi, r"$\frac{1}{2}\pi$")]
-    grid_locator1 = FixedLocator([v for v, s in angle_ticks])
-    tick_formatter1 = DictFormatter(dict(angle_ticks))
-
-    grid_locator2 = MaxNLocator(2)
-
-    grid_helper = floating_axes.GridHelperCurveLinear(
-        tr, extremes=(.5*pi, 0, 2, 1),
-        grid_locator1=grid_locator1,
-        grid_locator2=grid_locator2,
-        tick_formatter1=tick_formatter1,
-        tick_formatter2=None)
-
-    ax1 = floating_axes.FloatingSubplot(fig, rect, grid_helper=grid_helper)
-    fig.add_subplot(ax1)
-
-    # create a parasite axes whose transData in RA, cz
-    aux_ax = ax1.get_aux_axes(tr)
-
-    aux_ax.patch = ax1.patch  # for aux_ax to have a clip path as in ax
-    ax1.patch.zorder = 0.9  # but this has a side effect that the patch is
-    # drawn twice, and possibly over some other
-    # artists. So, we decrease the zorder a bit to
-    # prevent this.
-
-    return ax1, aux_ax
-
-
-def setup_axes3(fig, rect):
-    """
-    Sometimes, things like axis_direction need to be adjusted.
-    """
-
-    # rotate a bit for better orientation
-    tr_rotate = Affine2D().translate(-95, 0)
-
-    # scale degree to radians
-    tr_scale = Affine2D().scale(np.pi/180., 1.)
-
-    tr = tr_rotate + tr_scale + PolarAxes.PolarTransform()
-
-    grid_locator1 = angle_helper.LocatorHMS(4)
-    tick_formatter1 = angle_helper.FormatterHMS()
-
-    grid_locator2 = MaxNLocator(3)
-
-    ra0, ra1 = 8.*15, 14.*15
-    cz0, cz1 = 0, 14000
-    grid_helper = floating_axes.GridHelperCurveLinear(
-        tr, extremes=(ra0, ra1, cz0, cz1),
-        grid_locator1=grid_locator1,
-        grid_locator2=grid_locator2,
-        tick_formatter1=tick_formatter1,
-        tick_formatter2=None)
-
-    ax1 = floating_axes.FloatingSubplot(fig, rect, grid_helper=grid_helper)
-    fig.add_subplot(ax1)
-
-    # adjust axis
-    ax1.axis["left"].set_axis_direction("bottom")
-    ax1.axis["right"].set_axis_direction("top")
-
-    ax1.axis["bottom"].set_visible(False)
-    ax1.axis["top"].set_axis_direction("bottom")
-    ax1.axis["top"].toggle(ticklabels=True, label=True)
-    ax1.axis["top"].major_ticklabels.set_axis_direction("top")
-    ax1.axis["top"].label.set_axis_direction("top")
-
-    ax1.axis["left"].label.set_text(r"cz [km$^{-1}$]")
-    ax1.axis["top"].label.set_text(r"$\alpha_{1950}$")
-
-    # create a parasite axes whose transData in RA, cz
-    aux_ax = ax1.get_aux_axes(tr)
-
-    aux_ax.patch = ax1.patch  # for aux_ax to have a clip path as in ax
-    ax1.patch.zorder = 0.9  # but this has a side effect that the patch is
-    # drawn twice, and possibly over some other
-    # artists. So, we decrease the zorder a bit to
-    # prevent this.
-
-    return ax1, aux_ax
-
-
-##########################################################
-fig = plt.figure(1, figsize=(8, 4))
-fig.subplots_adjust(wspace=0.3, left=0.05, right=0.95)
-
-ax1, aux_ax1 = setup_axes1(fig, 131)
-aux_ax1.bar([0, 1, 2, 3], [3, 2, 1, 3])
-
-ax2, aux_ax2 = setup_axes2(fig, 132)
-theta = np.random.rand(10)*.5*np.pi
-radius = np.random.rand(10) + 1.
-aux_ax2.scatter(theta, radius)
-
-ax3, aux_ax3 = setup_axes3(fig, 133)
-
-theta = (8 + np.random.rand(10)*(14 - 8))*15.  # in degrees
-radius = np.random.rand(10)*14000.
-aux_ax3.scatter(theta, radius)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/axes_grid/demo_floating_axis.html b/examples/axes_grid/demo_floating_axis.html deleted file mode 100644 index 2d672abf533..00000000000 --- a/examples/axes_grid/demo_floating_axis.html +++ /dev/null @@ -1,392 +0,0 @@ - - - - - - - - axes_grid example code: demo_floating_axis.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

axes_grid example code: demo_floating_axis.py

-

(Source code, png, pdf)

-
-../../_images/demo_floating_axis.png -
-
"""
-Axis within rectangular frame
-
-The following code demonstrates how to put a floating polar curve within a
-rectangular box. In order to get a better sense of polar curves, please look at
-demo_curvelinear_grid.py.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-import mpl_toolkits.axisartist.angle_helper as angle_helper
-from matplotlib.projections import PolarAxes
-from matplotlib.transforms import Affine2D
-from mpl_toolkits.axisartist import SubplotHost
-from mpl_toolkits.axisartist import GridHelperCurveLinear
-
-
-def curvelinear_test2(fig):
-    """
-    polar projection, but in a rectangular box.
-    """
-    global ax1
-    # see demo_curvelinear_grid.py for details
-    tr = Affine2D().scale(np.pi / 180., 1.) + PolarAxes.PolarTransform()
-
-    extreme_finder = angle_helper.ExtremeFinderCycle(20,
-                                                     20,
-                                                     lon_cycle=360,
-                                                     lat_cycle=None,
-                                                     lon_minmax=None,
-                                                     lat_minmax=(0,
-                                                                 np.inf),
-                                                     )
-
-    grid_locator1 = angle_helper.LocatorDMS(12)
-
-    tick_formatter1 = angle_helper.FormatterDMS()
-
-    grid_helper = GridHelperCurveLinear(tr,
-                                        extreme_finder=extreme_finder,
-                                        grid_locator1=grid_locator1,
-                                        tick_formatter1=tick_formatter1
-                                        )
-
-    ax1 = SubplotHost(fig, 1, 1, 1, grid_helper=grid_helper)
-
-    fig.add_subplot(ax1)
-
-    # Now creates floating axis
-
-    # floating axis whose first coordinate (theta) is fixed at 60
-    ax1.axis["lat"] = axis = ax1.new_floating_axis(0, 60)
-    axis.label.set_text(r"$\theta = 60^{\circ}$")
-    axis.label.set_visible(True)
-
-    # floating axis whose second coordinate (r) is fixed at 6
-    ax1.axis["lon"] = axis = ax1.new_floating_axis(1, 6)
-    axis.label.set_text(r"$r = 6$")
-
-    ax1.set_aspect(1.)
-    ax1.set_xlim(-5, 12)
-    ax1.set_ylim(-5, 10)
-
-    ax1.grid(True)
-
-fig = plt.figure(1, figsize=(5, 5))
-fig.clf()
-
-curvelinear_test2(fig)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/axes_grid/demo_imagegrid_aspect.html b/examples/axes_grid/demo_imagegrid_aspect.html deleted file mode 100644 index 29a1d061456..00000000000 --- a/examples/axes_grid/demo_imagegrid_aspect.html +++ /dev/null @@ -1,342 +0,0 @@ - - - - - - - - axes_grid example code: demo_imagegrid_aspect.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

axes_grid example code: demo_imagegrid_aspect.py

-

(Source code, png, pdf)

-
-../../_images/demo_imagegrid_aspect.png -
-
import matplotlib.pyplot as plt
-
-from mpl_toolkits.axes_grid1 import ImageGrid
-fig = plt.figure(1)
-
-grid1 = ImageGrid(fig, 121, (2, 2), axes_pad=0.1,
-                  aspect=True, share_all=True)
-
-for i in [0, 1]:
-    grid1[i].set_aspect(2)
-
-
-grid2 = ImageGrid(fig, 122, (2, 2), axes_pad=0.1,
-                  aspect=True, share_all=True)
-
-
-for i in [1, 3]:
-    grid2[i].set_aspect(2)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/axes_grid/demo_parasite_axes2.html b/examples/axes_grid/demo_parasite_axes2.html deleted file mode 100644 index bd6f0243695..00000000000 --- a/examples/axes_grid/demo_parasite_axes2.html +++ /dev/null @@ -1,373 +0,0 @@ - - - - - - - - axes_grid example code: demo_parasite_axes2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

axes_grid example code: demo_parasite_axes2.py

-

(Source code, png, pdf)

-
-../../_images/demo_parasite_axes2.png -
-
"""
-Parasite axis demo
-
-The following code is an example of a parasite axis. It aims to show a user how
-to plot multiple different values onto one single plot. Notice how in this
-example, par1 and par2 are both calling twinx meaning both are tied directly to
-the x-axis. From there, each of those two axis can behave separately from the
-each other, meaning they can take on separate values from themselves as well as
-the x-axis.
-"""
-from mpl_toolkits.axes_grid1 import host_subplot
-import mpl_toolkits.axisartist as AA
-import matplotlib.pyplot as plt
-
-host = host_subplot(111, axes_class=AA.Axes)
-plt.subplots_adjust(right=0.75)
-
-par1 = host.twinx()
-par2 = host.twinx()
-
-offset = 60
-new_fixed_axis = par2.get_grid_helper().new_fixed_axis
-par2.axis["right"] = new_fixed_axis(loc="right",
-                                    axes=par2,
-                                    offset=(offset, 0))
-
-par2.axis["right"].toggle(all=True)
-
-host.set_xlim(0, 2)
-host.set_ylim(0, 2)
-
-host.set_xlabel("Distance")
-host.set_ylabel("Density")
-par1.set_ylabel("Temperature")
-par2.set_ylabel("Velocity")
-
-p1, = host.plot([0, 1, 2], [0, 1, 2], label="Density")
-p2, = par1.plot([0, 1, 2], [0, 3, 2], label="Temperature")
-p3, = par2.plot([0, 1, 2], [50, 30, 15], label="Velocity")
-
-par1.set_ylim(0, 4)
-par2.set_ylim(1, 65)
-
-host.legend()
-
-host.axis["left"].label.set_color(p1.get_color())
-par1.axis["right"].label.set_color(p2.get_color())
-par2.axis["right"].label.set_color(p3.get_color())
-
-plt.draw()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/axes_grid/index.html b/examples/axes_grid/index.html deleted file mode 100644 index 9ea6b1c0af7..00000000000 --- a/examples/axes_grid/index.html +++ /dev/null @@ -1,349 +0,0 @@ - - - - - - - - axes_grid Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- - - - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/axes_grid/inset_locator_demo.html b/examples/axes_grid/inset_locator_demo.html deleted file mode 100644 index c7bdd2842d9..00000000000 --- a/examples/axes_grid/inset_locator_demo.html +++ /dev/null @@ -1,368 +0,0 @@ - - - - - - - - axes_grid example code: inset_locator_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

axes_grid example code: inset_locator_demo.py

-

(Source code, png, pdf)

-
-../../_images/inset_locator_demo.png -
-
import matplotlib.pyplot as plt
-
-from mpl_toolkits.axes_grid1.inset_locator import inset_axes, zoomed_inset_axes
-from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar
-
-
-def add_sizebar(ax, size):
-    asb = AnchoredSizeBar(ax.transData,
-                          size,
-                          str(size),
-                          loc=8,
-                          pad=0.1, borderpad=0.5, sep=5,
-                          frameon=False)
-    ax.add_artist(asb)
-
-
-fig, (ax, ax2) = plt.subplots(1, 2, figsize=[5.5, 3])
-
-# first subplot
-ax.set_aspect(1.)
-
-axins = inset_axes(ax,
-                   width="30%",  # width = 30% of parent_bbox
-                   height=1.,  # height : 1 inch
-                   loc=3)
-
-plt.xticks(visible=False)
-plt.yticks(visible=False)
-
-
-# second subplot
-ax2.set_aspect(1.)
-
-axins = zoomed_inset_axes(ax2, 0.5, loc=1)  # zoom = 0.5
-# fix the number of ticks on the inset axes
-axins.yaxis.get_major_locator().set_params(nbins=7)
-axins.xaxis.get_major_locator().set_params(nbins=7)
-
-plt.xticks(visible=False)
-plt.yticks(visible=False)
-
-add_sizebar(ax2, 0.5)
-add_sizebar(axins, 0.5)
-
-plt.draw()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/axes_grid/inset_locator_demo2.html b/examples/axes_grid/inset_locator_demo2.html deleted file mode 100644 index 3374d6a9409..00000000000 --- a/examples/axes_grid/inset_locator_demo2.html +++ /dev/null @@ -1,371 +0,0 @@ - - - - - - - - axes_grid example code: inset_locator_demo2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

axes_grid example code: inset_locator_demo2.py

-

(Source code, png, pdf)

-
-../../_images/inset_locator_demo2.png -
-
import matplotlib.pyplot as plt
-
-from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes
-from mpl_toolkits.axes_grid1.inset_locator import mark_inset
-
-import numpy as np
-
-
-def get_demo_image():
-    from matplotlib.cbook import get_sample_data
-    import numpy as np
-    f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False)
-    z = np.load(f)
-    # z is a numpy array of 15x15
-    return z, (-3, 4, -4, 3)
-
-fig, ax = plt.subplots(figsize=[5, 4])
-
-# prepare the demo image
-Z, extent = get_demo_image()
-Z2 = np.zeros([150, 150], dtype="d")
-ny, nx = Z.shape
-Z2[30:30 + ny, 30:30 + nx] = Z
-
-# extent = [-3, 4, -4, 3]
-ax.imshow(Z2, extent=extent, interpolation="nearest",
-          origin="lower")
-
-axins = zoomed_inset_axes(ax, 6, loc=1)  # zoom = 6
-axins.imshow(Z2, extent=extent, interpolation="nearest",
-             origin="lower")
-
-# sub region of the original image
-x1, x2, y1, y2 = -1.5, -0.9, -2.5, -1.9
-axins.set_xlim(x1, x2)
-axins.set_ylim(y1, y2)
-# fix the number of ticks on the inset axes
-axins.yaxis.get_major_locator().set_params(nbins=7)
-axins.xaxis.get_major_locator().set_params(nbins=7)
-
-plt.xticks(visible=False)
-plt.yticks(visible=False)
-
-# draw a bbox of the region of the inset axes in the parent axes and
-# connecting lines between the bbox and the inset axes area
-mark_inset(ax, axins, loc1=2, loc2=4, fc="none", ec="0.5")
-
-plt.draw()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/axes_grid/make_room_for_ylabel_using_axesgrid.html b/examples/axes_grid/make_room_for_ylabel_using_axesgrid.html deleted file mode 100644 index 618730a2b3c..00000000000 --- a/examples/axes_grid/make_room_for_ylabel_using_axesgrid.html +++ /dev/null @@ -1,392 +0,0 @@ - - - - - - - - axes_grid example code: make_room_for_ylabel_using_axesgrid.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

axes_grid example code: make_room_for_ylabel_using_axesgrid.py

-

(Source code)

-
-../../_images/make_room_for_ylabel_using_axesgrid_00.png -

(png, pdf)

-
-
-../../_images/make_room_for_ylabel_using_axesgrid_01.png -

(png, pdf)

-
-
-../../_images/make_room_for_ylabel_using_axesgrid_02.png -

(png, pdf)

-
-
from mpl_toolkits.axes_grid1 import make_axes_locatable
-from mpl_toolkits.axes_grid1.axes_divider import make_axes_area_auto_adjustable
-
-
-if __name__ == "__main__":
-
-    import matplotlib.pyplot as plt
-
-    def ex1():
-        plt.figure(1)
-        ax = plt.axes([0, 0, 1, 1])
-        #ax = plt.subplot(111)
-
-        ax.set_yticks([0.5])
-        ax.set_yticklabels(["very long label"])
-
-        make_axes_area_auto_adjustable(ax)
-
-    def ex2():
-
-        plt.figure(2)
-        ax1 = plt.axes([0, 0, 1, 0.5])
-        ax2 = plt.axes([0, 0.5, 1, 0.5])
-
-        ax1.set_yticks([0.5])
-        ax1.set_yticklabels(["very long label"])
-        ax1.set_ylabel("Y label")
-
-        ax2.set_title("Title")
-
-        make_axes_area_auto_adjustable(ax1, pad=0.1, use_axes=[ax1, ax2])
-        make_axes_area_auto_adjustable(ax2, pad=0.1, use_axes=[ax1, ax2])
-
-    def ex3():
-
-        fig = plt.figure(3)
-        ax1 = plt.axes([0, 0, 1, 1])
-        divider = make_axes_locatable(ax1)
-
-        ax2 = divider.new_horizontal("100%", pad=0.3, sharey=ax1)
-        ax2.tick_params(labelleft="off")
-        fig.add_axes(ax2)
-
-        divider.add_auto_adjustable_area(use_axes=[ax1], pad=0.1,
-                                         adjust_dirs=["left"])
-        divider.add_auto_adjustable_area(use_axes=[ax2], pad=0.1,
-                                         adjust_dirs=["right"])
-        divider.add_auto_adjustable_area(use_axes=[ax1, ax2], pad=0.1,
-                                         adjust_dirs=["top", "bottom"])
-
-        ax1.set_yticks([0.5])
-        ax1.set_yticklabels(["very long label"])
-
-        ax2.set_title("Title")
-        ax2.set_xlabel("X - Label")
-
-    ex1()
-    ex2()
-    ex3()
-
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/axes_grid/parasite_simple2.html b/examples/axes_grid/parasite_simple2.html deleted file mode 100644 index 6f86947b92a..00000000000 --- a/examples/axes_grid/parasite_simple2.html +++ /dev/null @@ -1,364 +0,0 @@ - - - - - - - - axes_grid example code: parasite_simple2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

axes_grid example code: parasite_simple2.py

-

(Source code, png, pdf)

-
-../../_images/parasite_simple2.png -
-
import matplotlib.transforms as mtransforms
-import matplotlib.pyplot as plt
-from mpl_toolkits.axes_grid1.parasite_axes import SubplotHost
-
-obs = [["01_S1", 3.88, 0.14, 1970, 63],
-       ["01_S4", 5.6, 0.82, 1622, 150],
-       ["02_S1", 2.4, 0.54, 1570, 40],
-       ["03_S1", 4.1, 0.62, 2380, 170]]
-
-
-fig = plt.figure()
-
-ax_kms = SubplotHost(fig, 1, 1, 1, aspect=1.)
-
-# angular proper motion("/yr) to linear velocity(km/s) at distance=2.3kpc
-pm_to_kms = 1./206265.*2300*3.085e18/3.15e7/1.e5
-
-aux_trans = mtransforms.Affine2D().scale(pm_to_kms, 1.)
-ax_pm = ax_kms.twin(aux_trans)
-ax_pm.set_viewlim_mode("transform")
-
-fig.add_subplot(ax_kms)
-
-for n, ds, dse, w, we in obs:
-    time = ((2007 + (10. + 4/30.)/12) - 1988.5)
-    v = ds / time * pm_to_kms
-    ve = dse / time * pm_to_kms
-    ax_kms.errorbar([v], [w], xerr=[ve], yerr=[we], color="k")
-
-
-ax_kms.axis["bottom"].set_label("Linear velocity at 2.3 kpc [km/s]")
-ax_kms.axis["left"].set_label("FWHM [km/s]")
-ax_pm.axis["top"].set_label(r"Proper Motion [$''$/yr]")
-ax_pm.axis["top"].label.set_visible(True)
-ax_pm.axis["right"].major_ticklabels.set_visible(False)
-
-ax_kms.set_xlim(950, 3700)
-ax_kms.set_ylim(950, 3100)
-# xlim and ylim of ax_pms will be automatically adjusted.
-
-plt.draw()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/axes_grid/scatter_hist.html b/examples/axes_grid/scatter_hist.html deleted file mode 100644 index 77691aac8ad..00000000000 --- a/examples/axes_grid/scatter_hist.html +++ /dev/null @@ -1,373 +0,0 @@ - - - - - - - - axes_grid example code: scatter_hist.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

axes_grid example code: scatter_hist.py

-

(Source code, png, pdf)

-
-../../_images/scatter_hist.png -
-
import numpy as np
-import matplotlib.pyplot as plt
-from mpl_toolkits.axes_grid1 import make_axes_locatable
-
-# the random data
-x = np.random.randn(1000)
-y = np.random.randn(1000)
-
-
-fig, axScatter = plt.subplots(figsize=(5.5, 5.5))
-
-# the scatter plot:
-axScatter.scatter(x, y)
-axScatter.set_aspect(1.)
-
-# create new axes on the right and on the top of the current axes
-# The first argument of the new_vertical(new_horizontal) method is
-# the height (width) of the axes to be created in inches.
-divider = make_axes_locatable(axScatter)
-axHistx = divider.append_axes("top", 1.2, pad=0.1, sharex=axScatter)
-axHisty = divider.append_axes("right", 1.2, pad=0.1, sharey=axScatter)
-
-# make some labels invisible
-plt.setp(axHistx.get_xticklabels() + axHisty.get_yticklabels(),
-         visible=False)
-
-# now determine nice limits by hand:
-binwidth = 0.25
-xymax = np.max([np.max(np.fabs(x)), np.max(np.fabs(y))])
-lim = (int(xymax/binwidth) + 1)*binwidth
-
-bins = np.arange(-lim, lim + binwidth, binwidth)
-axHistx.hist(x, bins=bins)
-axHisty.hist(y, bins=bins, orientation='horizontal')
-
-# the xaxis of axHistx and yaxis of axHisty are shared with axScatter,
-# thus there is no need to manually adjust the xlim and ylim of these
-# axis.
-
-#axHistx.axis["bottom"].major_ticklabels.set_visible(False)
-for tl in axHistx.get_xticklabels():
-    tl.set_visible(False)
-axHistx.set_yticks([0, 50, 100])
-
-#axHisty.axis["left"].major_ticklabels.set_visible(False)
-for tl in axHisty.get_yticklabels():
-    tl.set_visible(False)
-axHisty.set_xticks([0, 50, 100])
-
-plt.draw()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/axes_grid/simple_anchored_artists.html b/examples/axes_grid/simple_anchored_artists.html deleted file mode 100644 index 2229a7eb906..00000000000 --- a/examples/axes_grid/simple_anchored_artists.html +++ /dev/null @@ -1,384 +0,0 @@ - - - - - - - - axes_grid example code: simple_anchored_artists.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

axes_grid example code: simple_anchored_artists.py

-

(Source code, png, pdf)

-
-../../_images/simple_anchored_artists.png -
-
import matplotlib.pyplot as plt
-
-
-def draw_text(ax):
-    from matplotlib.offsetbox import AnchoredText
-    at = AnchoredText("Figure 1a",
-                      loc=2, prop=dict(size=8), frameon=True,
-                      )
-    at.patch.set_boxstyle("round,pad=0.,rounding_size=0.2")
-    ax.add_artist(at)
-
-    at2 = AnchoredText("Figure 1(b)",
-                       loc=3, prop=dict(size=8), frameon=True,
-                       bbox_to_anchor=(0., 1.),
-                       bbox_transform=ax.transAxes
-                       )
-    at2.patch.set_boxstyle("round,pad=0.,rounding_size=0.2")
-    ax.add_artist(at2)
-
-
-def draw_circle(ax):  # circle in the canvas coordinate
-    from mpl_toolkits.axes_grid1.anchored_artists import AnchoredDrawingArea
-    from matplotlib.patches import Circle
-    ada = AnchoredDrawingArea(20, 20, 0, 0,
-                              loc=1, pad=0., frameon=False)
-    p = Circle((10, 10), 10)
-    ada.da.add_artist(p)
-    ax.add_artist(ada)
-
-
-def draw_ellipse(ax):
-    from mpl_toolkits.axes_grid1.anchored_artists import AnchoredEllipse
-    # draw an ellipse of width=0.1, height=0.15 in the data coordinate
-    ae = AnchoredEllipse(ax.transData, width=0.1, height=0.15, angle=0.,
-                         loc=3, pad=0.5, borderpad=0.4, frameon=True)
-
-    ax.add_artist(ae)
-
-
-def draw_sizebar(ax):
-    from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar
-    # draw a horizontal bar with length of 0.1 in Data coordinate
-    # (ax.transData) with a label underneath.
-    asb = AnchoredSizeBar(ax.transData,
-                          0.1,
-                          r"1$^{\prime}$",
-                          loc=8,
-                          pad=0.1, borderpad=0.5, sep=5,
-                          frameon=False)
-    ax.add_artist(asb)
-
-
-if 1:
-    ax = plt.gca()
-    ax.set_aspect(1.)
-
-    draw_text(ax)
-    draw_circle(ax)
-    draw_ellipse(ax)
-    draw_sizebar(ax)
-
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/axes_grid/simple_axesgrid.html b/examples/axes_grid/simple_axesgrid.html deleted file mode 100644 index 1bf569f71c1..00000000000 --- a/examples/axes_grid/simple_axesgrid.html +++ /dev/null @@ -1,339 +0,0 @@ - - - - - - - - axes_grid example code: simple_axesgrid.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

axes_grid example code: simple_axesgrid.py

-

(Source code, png, pdf)

-
-../../_images/simple_axesgrid.png -
-
import matplotlib.pyplot as plt
-from mpl_toolkits.axes_grid1 import ImageGrid
-import numpy as np
-
-im = np.arange(100)
-im.shape = 10, 10
-
-fig = plt.figure(1, (4., 4.))
-grid = ImageGrid(fig, 111,  # similar to subplot(111)
-                 nrows_ncols=(2, 2),  # creates 2x2 grid of axes
-                 axes_pad=0.1,  # pad between axes in inch.
-                 )
-
-for i in range(4):
-    grid[i].imshow(im)  # The AxesGrid object work as a list of axes.
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/axes_grid/simple_axesgrid2.html b/examples/axes_grid/simple_axesgrid2.html deleted file mode 100644 index 68e786566a1..00000000000 --- a/examples/axes_grid/simple_axesgrid2.html +++ /dev/null @@ -1,355 +0,0 @@ - - - - - - - - axes_grid example code: simple_axesgrid2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

axes_grid example code: simple_axesgrid2.py

-

(Source code, png, pdf)

-
-../../_images/simple_axesgrid2.png -
-
import matplotlib.pyplot as plt
-from mpl_toolkits.axes_grid1 import ImageGrid
-
-
-def get_demo_image():
-    import numpy as np
-    from matplotlib.cbook import get_sample_data
-    f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False)
-    z = np.load(f)
-    # z is a numpy array of 15x15
-    return z, (-3, 4, -4, 3)
-
-F = plt.figure(1, (5.5, 3.5))
-grid = ImageGrid(F, 111,  # similar to subplot(111)
-                 nrows_ncols=(1, 3),
-                 axes_pad=0.1,
-                 add_all=True,
-                 label_mode="L",
-                 )
-
-Z, extent = get_demo_image()  # demo image
-
-im1 = Z
-im2 = Z[:, :10]
-im3 = Z[:, 10:]
-vmin, vmax = Z.min(), Z.max()
-for i, im in enumerate([im1, im2, im3]):
-    ax = grid[i]
-    ax.imshow(im, origin="lower", vmin=vmin,
-              vmax=vmax, interpolation="nearest")
-
-plt.draw()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/axes_grid/simple_axisline4.html b/examples/axes_grid/simple_axisline4.html deleted file mode 100644 index 6ac62c8743b..00000000000 --- a/examples/axes_grid/simple_axisline4.html +++ /dev/null @@ -1,341 +0,0 @@ - - - - - - - - axes_grid example code: simple_axisline4.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

axes_grid example code: simple_axisline4.py

-

(Source code, png, pdf)

-
-../../_images/simple_axisline4.png -
-
import matplotlib.pyplot as plt
-from mpl_toolkits.axes_grid1 import host_subplot
-import mpl_toolkits.axisartist as AA
-import numpy as np
-
-ax = host_subplot(111, axes_class=AA.Axes)
-xx = np.arange(0, 2*np.pi, 0.01)
-ax.plot(xx, np.sin(xx))
-
-ax2 = ax.twin()  # ax2 is responsible for "top" axis and "right" axis
-ax2.set_xticks([0., .5*np.pi, np.pi, 1.5*np.pi, 2*np.pi])
-ax2.set_xticklabels(["$0$", r"$\frac{1}{2}\pi$",
-                     r"$\pi$", r"$\frac{3}{2}\pi$", r"$2\pi$"])
-
-ax2.axis["right"].major_ticklabels.set_visible(False)
-ax2.axis["top"].major_ticklabels.set_visible(True)
-
-plt.draw()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/color/color_cycle_default.html b/examples/color/color_cycle_default.html deleted file mode 100644 index 7435e2ffe58..00000000000 --- a/examples/color/color_cycle_default.html +++ /dev/null @@ -1,362 +0,0 @@ - - - - - - - - color example code: color_cycle_default.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

color example code: color_cycle_default.py

-

(Source code, png, pdf)

-
-../../_images/color_cycle_default.png -
-
"""
-====================================
-Colors in the default property cycle
-====================================
-
-Display the colors from the default prop_cycle.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-prop_cycle = plt.rcParams['axes.prop_cycle']
-colors = prop_cycle.by_key()['color']
-
-lwbase = plt.rcParams['lines.linewidth']
-thin = float('%.1f' % (lwbase / 2))
-thick = lwbase * 3
-
-fig, axs = plt.subplots(nrows=2, ncols=2, sharex=True, sharey=True)
-for icol in range(2):
-    if icol == 0:
-        lwx, lwy = thin, lwbase
-    else:
-        lwx, lwy = lwbase, thick
-    for irow in range(2):
-        for i, color in enumerate(colors):
-            axs[irow, icol].axhline(i, color=color, lw=lwx)
-            axs[irow, icol].axvline(i, color=color, lw=lwy)
-
-    axs[1, icol].set_facecolor('k')
-    axs[1, icol].xaxis.set_ticks(np.arange(0, 10, 2))
-    axs[0, icol].set_title('line widths (pts): %.1f, %.1f' % (lwx, lwy),
-                           fontsize='medium')
-
-for irow in range(2):
-    axs[irow, 0].yaxis.set_ticks(np.arange(0, 10, 2))
-
-fig.suptitle('Colors in the default prop_cycle', fontsize='large')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/color/color_cycle_demo.html b/examples/color/color_cycle_demo.html deleted file mode 100644 index 65669caf041..00000000000 --- a/examples/color/color_cycle_demo.html +++ /dev/null @@ -1,363 +0,0 @@ - - - - - - - - color example code: color_cycle_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

color example code: color_cycle_demo.py

-

(Source code, png, pdf)

-
-../../_images/color_cycle_demo.png -
-
"""
-===================
-Styling with cycler
-===================
-
-Demo of custom property-cycle settings to control colors and other style
-properties for multi-line plots.
-
-This example demonstrates two different APIs:
-
-    1. Setting the default rc parameter specifying the property cycle.
-       This affects all subsequent axes (but not axes already created).
-    2. Setting the property cycle for a single pair of axes.
-"""
-from cycler import cycler
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-x = np.linspace(0, 2 * np.pi)
-offsets = np.linspace(0, 2*np.pi, 4, endpoint=False)
-# Create array with shifted-sine curve along each column
-yy = np.transpose([np.sin(x + phi) for phi in offsets])
-
-# 1. Setting prop cycle on default rc parameter
-plt.rc('lines', linewidth=4)
-plt.rc('axes', prop_cycle=(cycler('color', ['r', 'g', 'b', 'y']) +
-                           cycler('linestyle', ['-', '--', ':', '-.'])))
-fig, (ax0, ax1) = plt.subplots(nrows=2)
-ax0.plot(yy)
-ax0.set_title('Set default color cycle to rgby')
-
-# 2. Define prop cycle for single set of axes
-ax1.set_prop_cycle(cycler('color', ['c', 'm', 'y', 'k']) +
-                   cycler('lw', [1, 2, 3, 4]))
-ax1.plot(yy)
-ax1.set_title('Set axes color cycle to cmyk')
-
-# Tweak spacing between subplots to prevent labels from overlapping
-fig.subplots_adjust(hspace=0.3)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/color/colormaps_reference.html b/examples/color/colormaps_reference.html deleted file mode 100644 index 376329260c3..00000000000 --- a/examples/color/colormaps_reference.html +++ /dev/null @@ -1,436 +0,0 @@ - - - - - - - - color example code: colormaps_reference.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

color example code: colormaps_reference.py

-

(Source code)

-
-../../_images/colormaps_reference_00.png -

(png, pdf)

-
-
-../../_images/colormaps_reference_01.png -

(png, pdf)

-
-
-../../_images/colormaps_reference_02.png -

(png, pdf)

-
-
-../../_images/colormaps_reference_03.png -

(png, pdf)

-
-
-../../_images/colormaps_reference_04.png -

(png, pdf)

-
-
-../../_images/colormaps_reference_05.png -

(png, pdf)

-
-
"""
-==================
-Colormap reference
-==================
-
-Reference for colormaps included with Matplotlib.
-
-This reference example shows all colormaps included with Matplotlib. Note that
-any colormap listed here can be reversed by appending "_r" (e.g., "pink_r").
-These colormaps are divided into the following categories:
-
-Sequential:
-    These colormaps are approximately monochromatic colormaps varying smoothly
-    between two color tones---usually from low saturation (e.g. white) to high
-    saturation (e.g. a bright blue). Sequential colormaps are ideal for
-    representing most scientific data since they show a clear progression from
-    low-to-high values.
-
-Diverging:
-    These colormaps have a median value (usually light in color) and vary
-    smoothly to two different color tones at high and low values. Diverging
-    colormaps are ideal when your data has a median value that is significant
-    (e.g.  0, such that positive and negative values are represented by
-    different colors of the colormap).
-
-Qualitative:
-    These colormaps vary rapidly in color. Qualitative colormaps are useful for
-    choosing a set of discrete colors. For example::
-
-        color_list = plt.cm.Set3(np.linspace(0, 1, 12))
-
-    gives a list of RGB colors that are good for plotting a series of lines on
-    a dark background.
-
-Miscellaneous:
-    Colormaps that don't fit into the categories above.
-
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-# Have colormaps separated into categories:
-# http://matplotlib.org/examples/color/colormaps_reference.html
-cmaps = [('Perceptually Uniform Sequential', [
-            'viridis', 'plasma', 'inferno', 'magma']),
-         ('Sequential', [
-            'Greys', 'Purples', 'Blues', 'Greens', 'Oranges', 'Reds',
-            'YlOrBr', 'YlOrRd', 'OrRd', 'PuRd', 'RdPu', 'BuPu',
-            'GnBu', 'PuBu', 'YlGnBu', 'PuBuGn', 'BuGn', 'YlGn']),
-         ('Sequential (2)', [
-            'binary', 'gist_yarg', 'gist_gray', 'gray', 'bone', 'pink',
-            'spring', 'summer', 'autumn', 'winter', 'cool', 'Wistia',
-            'hot', 'afmhot', 'gist_heat', 'copper']),
-         ('Diverging', [
-            'PiYG', 'PRGn', 'BrBG', 'PuOr', 'RdGy', 'RdBu',
-            'RdYlBu', 'RdYlGn', 'Spectral', 'coolwarm', 'bwr', 'seismic']),
-         ('Qualitative', [
-            'Pastel1', 'Pastel2', 'Paired', 'Accent',
-            'Dark2', 'Set1', 'Set2', 'Set3',
-            'tab10', 'tab20', 'tab20b', 'tab20c']),
-         ('Miscellaneous', [
-            'flag', 'prism', 'ocean', 'gist_earth', 'terrain', 'gist_stern',
-            'gnuplot', 'gnuplot2', 'CMRmap', 'cubehelix', 'brg', 'hsv',
-            'gist_rainbow', 'rainbow', 'jet', 'nipy_spectral', 'gist_ncar'])]
-
-
-nrows = max(len(cmap_list) for cmap_category, cmap_list in cmaps)
-gradient = np.linspace(0, 1, 256)
-gradient = np.vstack((gradient, gradient))
-
-
-def plot_color_gradients(cmap_category, cmap_list, nrows):
-    fig, axes = plt.subplots(nrows=nrows)
-    fig.subplots_adjust(top=0.95, bottom=0.01, left=0.2, right=0.99)
-    axes[0].set_title(cmap_category + ' colormaps', fontsize=14)
-
-    for ax, name in zip(axes, cmap_list):
-        ax.imshow(gradient, aspect='auto', cmap=plt.get_cmap(name))
-        pos = list(ax.get_position().bounds)
-        x_text = pos[0] - 0.01
-        y_text = pos[1] + pos[3]/2.
-        fig.text(x_text, y_text, name, va='center', ha='right', fontsize=10)
-
-    # Turn off *all* ticks & spines, not just the ones with colormaps.
-    for ax in axes:
-        ax.set_axis_off()
-
-
-for cmap_category, cmap_list in cmaps:
-    plot_color_gradients(cmap_category, cmap_list, nrows)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/color/index.html b/examples/color/index.html deleted file mode 100644 index ed7ec19ab30..00000000000 --- a/examples/color/index.html +++ /dev/null @@ -1,330 +0,0 @@ - - - - - - - - color Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

color Examples

- --- - - - - - -
Release:2.0.2
Date:May 10, 2017
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/color/named_colors.html b/examples/color/named_colors.html deleted file mode 100644 index e2ecc39e554..00000000000 --- a/examples/color/named_colors.html +++ /dev/null @@ -1,377 +0,0 @@ - - - - - - - - color example code: named_colors.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

color example code: named_colors.py

-

(Source code, png, pdf)

-
-../../_images/named_colors.png -
-
"""
-========================
-Visualizing named colors
-========================
-
-Simple plot example with the named colors and its visual representation.
-"""
-from __future__ import division
-
-import matplotlib.pyplot as plt
-from matplotlib import colors as mcolors
-
-
-colors = dict(mcolors.BASE_COLORS, **mcolors.CSS4_COLORS)
-
-# Sort colors by hue, saturation, value and name.
-by_hsv = sorted((tuple(mcolors.rgb_to_hsv(mcolors.to_rgba(color)[:3])), name)
-                for name, color in colors.items())
-sorted_names = [name for hsv, name in by_hsv]
-
-n = len(sorted_names)
-ncols = 4
-nrows = n // ncols + 1
-
-fig, ax = plt.subplots(figsize=(8, 5))
-
-# Get height and width
-X, Y = fig.get_dpi() * fig.get_size_inches()
-h = Y / (nrows + 1)
-w = X / ncols
-
-for i, name in enumerate(sorted_names):
-    col = i % ncols
-    row = i // ncols
-    y = Y - (row * h) - h
-
-    xi_line = w * (col + 0.05)
-    xf_line = w * (col + 0.25)
-    xi_text = w * (col + 0.3)
-
-    ax.text(xi_text, y, name, fontsize=(h * 0.8),
-            horizontalalignment='left',
-            verticalalignment='center')
-
-    ax.hlines(y + h * 0.1, xi_line, xf_line,
-              color=colors[name], linewidth=(h * 0.6))
-
-ax.set_xlim(0, X)
-ax.set_ylim(0, Y)
-ax.set_axis_off()
-
-fig.subplots_adjust(left=0, right=1,
-                    top=1, bottom=0,
-                    hspace=0, wspace=0)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/event_handling/close_event.html b/examples/event_handling/close_event.html deleted file mode 100644 index 661a9ce2d3b..00000000000 --- a/examples/event_handling/close_event.html +++ /dev/null @@ -1,331 +0,0 @@ - - - - - - - - event_handling example code: close_event.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

event_handling example code: close_event.py

-

[source code]

-
from __future__ import print_function
-import matplotlib.pyplot as plt
-
-
-def handle_close(evt):
-    print('Closed Figure!')
-
-fig = plt.figure()
-fig.canvas.mpl_connect('close_event', handle_close)
-
-plt.text(0.35, 0.5, 'Close Me!', dict(size=30))
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/event_handling/close_event.py b/examples/event_handling/close_event.py deleted file mode 100644 index cffb6157cc3..00000000000 --- a/examples/event_handling/close_event.py +++ /dev/null @@ -1,12 +0,0 @@ -from __future__ import print_function -import matplotlib.pyplot as plt - - -def handle_close(evt): - print('Closed Figure!') - -fig = plt.figure() -fig.canvas.mpl_connect('close_event', handle_close) - -plt.text(0.35, 0.5, 'Close Me!', dict(size=30)) -plt.show() diff --git a/examples/event_handling/data_browser.html b/examples/event_handling/data_browser.html deleted file mode 100644 index 56a3015dd37..00000000000 --- a/examples/event_handling/data_browser.html +++ /dev/null @@ -1,407 +0,0 @@ - - - - - - - - event_handling example code: data_browser.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

event_handling example code: data_browser.py

-

[source code]

-
import numpy as np
-
-
-class PointBrowser(object):
-    """
-    Click on a point to select and highlight it -- the data that
-    generated the point will be shown in the lower axes.  Use the 'n'
-    and 'p' keys to browse through the next and previous points
-    """
-
-    def __init__(self):
-        self.lastind = 0
-
-        self.text = ax.text(0.05, 0.95, 'selected: none',
-                            transform=ax.transAxes, va='top')
-        self.selected, = ax.plot([xs[0]], [ys[0]], 'o', ms=12, alpha=0.4,
-                                 color='yellow', visible=False)
-
-    def onpress(self, event):
-        if self.lastind is None:
-            return
-        if event.key not in ('n', 'p'):
-            return
-        if event.key == 'n':
-            inc = 1
-        else:
-            inc = -1
-
-        self.lastind += inc
-        self.lastind = np.clip(self.lastind, 0, len(xs) - 1)
-        self.update()
-
-    def onpick(self, event):
-
-        if event.artist != line:
-            return True
-
-        N = len(event.ind)
-        if not N:
-            return True
-
-        # the click locations
-        x = event.mouseevent.xdata
-        y = event.mouseevent.ydata
-
-        distances = np.hypot(x - xs[event.ind], y - ys[event.ind])
-        indmin = distances.argmin()
-        dataind = event.ind[indmin]
-
-        self.lastind = dataind
-        self.update()
-
-    def update(self):
-        if self.lastind is None:
-            return
-
-        dataind = self.lastind
-
-        ax2.cla()
-        ax2.plot(X[dataind])
-
-        ax2.text(0.05, 0.9, 'mu=%1.3f\nsigma=%1.3f' % (xs[dataind], ys[dataind]),
-                 transform=ax2.transAxes, va='top')
-        ax2.set_ylim(-0.5, 1.5)
-        self.selected.set_visible(True)
-        self.selected.set_data(xs[dataind], ys[dataind])
-
-        self.text.set_text('selected: %d' % dataind)
-        fig.canvas.draw()
-
-
-if __name__ == '__main__':
-    import matplotlib.pyplot as plt
-
-    X = np.random.rand(100, 200)
-    xs = np.mean(X, axis=1)
-    ys = np.std(X, axis=1)
-
-    fig, (ax, ax2) = plt.subplots(2, 1)
-    ax.set_title('click on point to plot time series')
-    line, = ax.plot(xs, ys, 'o', picker=5)  # 5 points tolerance
-
-    browser = PointBrowser()
-
-    fig.canvas.mpl_connect('pick_event', browser.onpick)
-    fig.canvas.mpl_connect('key_press_event', browser.onpress)
-
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/event_handling/data_browser.py b/examples/event_handling/data_browser.py deleted file mode 100644 index 7bafd58f970..00000000000 --- a/examples/event_handling/data_browser.py +++ /dev/null @@ -1,88 +0,0 @@ -import numpy as np - - -class PointBrowser(object): - """ - Click on a point to select and highlight it -- the data that - generated the point will be shown in the lower axes. Use the 'n' - and 'p' keys to browse through the next and previous points - """ - - def __init__(self): - self.lastind = 0 - - self.text = ax.text(0.05, 0.95, 'selected: none', - transform=ax.transAxes, va='top') - self.selected, = ax.plot([xs[0]], [ys[0]], 'o', ms=12, alpha=0.4, - color='yellow', visible=False) - - def onpress(self, event): - if self.lastind is None: - return - if event.key not in ('n', 'p'): - return - if event.key == 'n': - inc = 1 - else: - inc = -1 - - self.lastind += inc - self.lastind = np.clip(self.lastind, 0, len(xs) - 1) - self.update() - - def onpick(self, event): - - if event.artist != line: - return True - - N = len(event.ind) - if not N: - return True - - # the click locations - x = event.mouseevent.xdata - y = event.mouseevent.ydata - - distances = np.hypot(x - xs[event.ind], y - ys[event.ind]) - indmin = distances.argmin() - dataind = event.ind[indmin] - - self.lastind = dataind - self.update() - - def update(self): - if self.lastind is None: - return - - dataind = self.lastind - - ax2.cla() - ax2.plot(X[dataind]) - - ax2.text(0.05, 0.9, 'mu=%1.3f\nsigma=%1.3f' % (xs[dataind], ys[dataind]), - transform=ax2.transAxes, va='top') - ax2.set_ylim(-0.5, 1.5) - self.selected.set_visible(True) - self.selected.set_data(xs[dataind], ys[dataind]) - - self.text.set_text('selected: %d' % dataind) - fig.canvas.draw() - - -if __name__ == '__main__': - import matplotlib.pyplot as plt - - X = np.random.rand(100, 200) - xs = np.mean(X, axis=1) - ys = np.std(X, axis=1) - - fig, (ax, ax2) = plt.subplots(2, 1) - ax.set_title('click on point to plot time series') - line, = ax.plot(xs, ys, 'o', picker=5) # 5 points tolerance - - browser = PointBrowser() - - fig.canvas.mpl_connect('pick_event', browser.onpick) - fig.canvas.mpl_connect('key_press_event', browser.onpress) - - plt.show() diff --git a/examples/event_handling/figure_axes_enter_leave.html b/examples/event_handling/figure_axes_enter_leave.html deleted file mode 100644 index 32bea580de3..00000000000 --- a/examples/event_handling/figure_axes_enter_leave.html +++ /dev/null @@ -1,367 +0,0 @@ - - - - - - - - event_handling example code: figure_axes_enter_leave.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

event_handling example code: figure_axes_enter_leave.py

-

[source code]

-
"""
-Illustrate the figure and axes enter and leave events by changing the
-frame colors on enter and leave
-"""
-from __future__ import print_function
-import matplotlib.pyplot as plt
-
-
-def enter_axes(event):
-    print('enter_axes', event.inaxes)
-    event.inaxes.patch.set_facecolor('yellow')
-    event.canvas.draw()
-
-
-def leave_axes(event):
-    print('leave_axes', event.inaxes)
-    event.inaxes.patch.set_facecolor('white')
-    event.canvas.draw()
-
-
-def enter_figure(event):
-    print('enter_figure', event.canvas.figure)
-    event.canvas.figure.patch.set_facecolor('red')
-    event.canvas.draw()
-
-
-def leave_figure(event):
-    print('leave_figure', event.canvas.figure)
-    event.canvas.figure.patch.set_facecolor('grey')
-    event.canvas.draw()
-
-fig1, (ax, ax2) = plt.subplots(2, 1)
-fig1.suptitle('mouse hover over figure or axes to trigger events')
-
-fig1.canvas.mpl_connect('figure_enter_event', enter_figure)
-fig1.canvas.mpl_connect('figure_leave_event', leave_figure)
-fig1.canvas.mpl_connect('axes_enter_event', enter_axes)
-fig1.canvas.mpl_connect('axes_leave_event', leave_axes)
-
-fig2, (ax, ax2) = plt.subplots(2, 1)
-fig2.suptitle('mouse hover over figure or axes to trigger events')
-
-fig2.canvas.mpl_connect('figure_enter_event', enter_figure)
-fig2.canvas.mpl_connect('figure_leave_event', leave_figure)
-fig2.canvas.mpl_connect('axes_enter_event', enter_axes)
-fig2.canvas.mpl_connect('axes_leave_event', leave_axes)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/event_handling/figure_axes_enter_leave.py b/examples/event_handling/figure_axes_enter_leave.py deleted file mode 100644 index 7ca0ee39d52..00000000000 --- a/examples/event_handling/figure_axes_enter_leave.py +++ /dev/null @@ -1,48 +0,0 @@ -""" -Illustrate the figure and axes enter and leave events by changing the -frame colors on enter and leave -""" -from __future__ import print_function -import matplotlib.pyplot as plt - - -def enter_axes(event): - print('enter_axes', event.inaxes) - event.inaxes.patch.set_facecolor('yellow') - event.canvas.draw() - - -def leave_axes(event): - print('leave_axes', event.inaxes) - event.inaxes.patch.set_facecolor('white') - event.canvas.draw() - - -def enter_figure(event): - print('enter_figure', event.canvas.figure) - event.canvas.figure.patch.set_facecolor('red') - event.canvas.draw() - - -def leave_figure(event): - print('leave_figure', event.canvas.figure) - event.canvas.figure.patch.set_facecolor('grey') - event.canvas.draw() - -fig1, (ax, ax2) = plt.subplots(2, 1) -fig1.suptitle('mouse hover over figure or axes to trigger events') - -fig1.canvas.mpl_connect('figure_enter_event', enter_figure) -fig1.canvas.mpl_connect('figure_leave_event', leave_figure) -fig1.canvas.mpl_connect('axes_enter_event', enter_axes) -fig1.canvas.mpl_connect('axes_leave_event', leave_axes) - -fig2, (ax, ax2) = plt.subplots(2, 1) -fig2.suptitle('mouse hover over figure or axes to trigger events') - -fig2.canvas.mpl_connect('figure_enter_event', enter_figure) -fig2.canvas.mpl_connect('figure_leave_event', leave_figure) -fig2.canvas.mpl_connect('axes_enter_event', enter_axes) -fig2.canvas.mpl_connect('axes_leave_event', leave_axes) - -plt.show() diff --git a/examples/event_handling/idle_and_timeout.html b/examples/event_handling/idle_and_timeout.html deleted file mode 100644 index 5843f06d6ff..00000000000 --- a/examples/event_handling/idle_and_timeout.html +++ /dev/null @@ -1,356 +0,0 @@ - - - - - - - - event_handling example code: idle_and_timeout.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

event_handling example code: idle_and_timeout.py

-

[source code]

-
from __future__ import print_function
-"""
-Demonstrate/test the idle and timeout API
-
-WARNING: idle_event is deprecated. Use the animations module instead.
-
-This is only tested on gtk so far and is a prototype implementation
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-fig, ax = plt.subplots()
-
-t = np.arange(0.0, 2.0, 0.01)
-y1 = np.sin(2*np.pi*t)
-y2 = np.cos(2*np.pi*t)
-line1, = ax.plot(y1)
-line2, = ax.plot(y2)
-
-N = 100
-
-
-def on_idle(event):
-    on_idle.count += 1
-    print('idle', on_idle.count)
-    line1.set_ydata(np.sin(2*np.pi*t*(N - on_idle.count)/float(N)))
-    event.canvas.draw()
-    # test boolean return removal
-    if on_idle.count == N:
-        return False
-    return True
-on_idle.cid = None
-on_idle.count = 0
-
-fig.canvas.mpl_connect('idle_event', on_idle)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/event_handling/idle_and_timeout.py b/examples/event_handling/idle_and_timeout.py deleted file mode 100644 index e89d0b69614..00000000000 --- a/examples/event_handling/idle_and_timeout.py +++ /dev/null @@ -1,37 +0,0 @@ -from __future__ import print_function -""" -Demonstrate/test the idle and timeout API - -WARNING: idle_event is deprecated. Use the animations module instead. - -This is only tested on gtk so far and is a prototype implementation -""" -import numpy as np -import matplotlib.pyplot as plt - -fig, ax = plt.subplots() - -t = np.arange(0.0, 2.0, 0.01) -y1 = np.sin(2*np.pi*t) -y2 = np.cos(2*np.pi*t) -line1, = ax.plot(y1) -line2, = ax.plot(y2) - -N = 100 - - -def on_idle(event): - on_idle.count += 1 - print('idle', on_idle.count) - line1.set_ydata(np.sin(2*np.pi*t*(N - on_idle.count)/float(N))) - event.canvas.draw() - # test boolean return removal - if on_idle.count == N: - return False - return True -on_idle.cid = None -on_idle.count = 0 - -fig.canvas.mpl_connect('idle_event', on_idle) - -plt.show() diff --git a/examples/event_handling/index.html b/examples/event_handling/index.html deleted file mode 100644 index e4f68b8cd65..00000000000 --- a/examples/event_handling/index.html +++ /dev/null @@ -1,346 +0,0 @@ - - - - - - - - event_handling Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- - - - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/event_handling/keypress_demo.html b/examples/event_handling/keypress_demo.html deleted file mode 100644 index 194eb658bbd..00000000000 --- a/examples/event_handling/keypress_demo.html +++ /dev/null @@ -1,344 +0,0 @@ - - - - - - - - event_handling example code: keypress_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

event_handling example code: keypress_demo.py

-

[source code]

-
"""
-Show how to connect to keypress events
-"""
-from __future__ import print_function
-import sys
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-def press(event):
-    print('press', event.key)
-    sys.stdout.flush()
-    if event.key == 'x':
-        visible = xl.get_visible()
-        xl.set_visible(not visible)
-        fig.canvas.draw()
-
-fig, ax = plt.subplots()
-
-fig.canvas.mpl_connect('key_press_event', press)
-
-ax.plot(np.random.rand(12), np.random.rand(12), 'go')
-xl = ax.set_xlabel('easy come, easy go')
-ax.set_title('Press a key')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/event_handling/keypress_demo.py b/examples/event_handling/keypress_demo.py deleted file mode 100644 index db8c71c9691..00000000000 --- a/examples/event_handling/keypress_demo.py +++ /dev/null @@ -1,25 +0,0 @@ -""" -Show how to connect to keypress events -""" -from __future__ import print_function -import sys -import numpy as np -import matplotlib.pyplot as plt - - -def press(event): - print('press', event.key) - sys.stdout.flush() - if event.key == 'x': - visible = xl.get_visible() - xl.set_visible(not visible) - fig.canvas.draw() - -fig, ax = plt.subplots() - -fig.canvas.mpl_connect('key_press_event', press) - -ax.plot(np.random.rand(12), np.random.rand(12), 'go') -xl = ax.set_xlabel('easy come, easy go') -ax.set_title('Press a key') -plt.show() diff --git a/examples/event_handling/lasso_demo.html b/examples/event_handling/lasso_demo.html deleted file mode 100644 index 33e47b0c4b5..00000000000 --- a/examples/event_handling/lasso_demo.html +++ /dev/null @@ -1,403 +0,0 @@ - - - - - - - - event_handling example code: lasso_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

event_handling example code: lasso_demo.py

-

[source code]

-
"""
-Show how to use a lasso to select a set of points and get the indices
-of the selected points.  A callback is used to change the color of the
-selected points
-
-This is currently a proof-of-concept implementation (though it is
-usable as is).  There will be some refinement of the API.
-"""
-from matplotlib.widgets import Lasso
-from matplotlib.collections import RegularPolyCollection
-from matplotlib import colors as mcolors, path
-
-import matplotlib.pyplot as plt
-from numpy import nonzero
-from numpy.random import rand
-
-
-class Datum(object):
-    colorin = mcolors.to_rgba("red")
-    colorout = mcolors.to_rgba("blue")
-
-    def __init__(self, x, y, include=False):
-        self.x = x
-        self.y = y
-        if include:
-            self.color = self.colorin
-        else:
-            self.color = self.colorout
-
-
-class LassoManager(object):
-    def __init__(self, ax, data):
-        self.axes = ax
-        self.canvas = ax.figure.canvas
-        self.data = data
-
-        self.Nxy = len(data)
-
-        facecolors = [d.color for d in data]
-        self.xys = [(d.x, d.y) for d in data]
-        self.collection = RegularPolyCollection(
-            6, sizes=(100,),
-            facecolors=facecolors,
-            offsets=self.xys,
-            transOffset=ax.transData)
-
-        ax.add_collection(self.collection)
-
-        self.cid = self.canvas.mpl_connect('button_press_event', self.onpress)
-
-    def callback(self, verts):
-        facecolors = self.collection.get_facecolors()
-        p = path.Path(verts)
-        ind = p.contains_points(self.xys)
-        for i in range(len(self.xys)):
-            if ind[i]:
-                facecolors[i] = Datum.colorin
-            else:
-                facecolors[i] = Datum.colorout
-
-        self.canvas.draw_idle()
-        self.canvas.widgetlock.release(self.lasso)
-        del self.lasso
-
-    def onpress(self, event):
-        if self.canvas.widgetlock.locked():
-            return
-        if event.inaxes is None:
-            return
-        self.lasso = Lasso(event.inaxes,
-                           (event.xdata, event.ydata),
-                           self.callback)
-        # acquire a lock on the widget drawing
-        self.canvas.widgetlock(self.lasso)
-
-if __name__ == '__main__':
-
-    data = [Datum(*xy) for xy in rand(100, 2)]
-    ax = plt.axes(xlim=(0, 1), ylim=(0, 1), autoscale_on=False)
-    ax.set_title('Lasso points using left mouse button')
-
-    lman = LassoManager(ax, data)
-
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/event_handling/lasso_demo.py b/examples/event_handling/lasso_demo.py deleted file mode 100644 index 09a03af24d8..00000000000 --- a/examples/event_handling/lasso_demo.py +++ /dev/null @@ -1,84 +0,0 @@ -""" -Show how to use a lasso to select a set of points and get the indices -of the selected points. A callback is used to change the color of the -selected points - -This is currently a proof-of-concept implementation (though it is -usable as is). There will be some refinement of the API. -""" -from matplotlib.widgets import Lasso -from matplotlib.collections import RegularPolyCollection -from matplotlib import colors as mcolors, path - -import matplotlib.pyplot as plt -from numpy import nonzero -from numpy.random import rand - - -class Datum(object): - colorin = mcolors.to_rgba("red") - colorout = mcolors.to_rgba("blue") - - def __init__(self, x, y, include=False): - self.x = x - self.y = y - if include: - self.color = self.colorin - else: - self.color = self.colorout - - -class LassoManager(object): - def __init__(self, ax, data): - self.axes = ax - self.canvas = ax.figure.canvas - self.data = data - - self.Nxy = len(data) - - facecolors = [d.color for d in data] - self.xys = [(d.x, d.y) for d in data] - self.collection = RegularPolyCollection( - 6, sizes=(100,), - facecolors=facecolors, - offsets=self.xys, - transOffset=ax.transData) - - ax.add_collection(self.collection) - - self.cid = self.canvas.mpl_connect('button_press_event', self.onpress) - - def callback(self, verts): - facecolors = self.collection.get_facecolors() - p = path.Path(verts) - ind = p.contains_points(self.xys) - for i in range(len(self.xys)): - if ind[i]: - facecolors[i] = Datum.colorin - else: - facecolors[i] = Datum.colorout - - self.canvas.draw_idle() - self.canvas.widgetlock.release(self.lasso) - del self.lasso - - def onpress(self, event): - if self.canvas.widgetlock.locked(): - return - if event.inaxes is None: - return - self.lasso = Lasso(event.inaxes, - (event.xdata, event.ydata), - self.callback) - # acquire a lock on the widget drawing - self.canvas.widgetlock(self.lasso) - -if __name__ == '__main__': - - data = [Datum(*xy) for xy in rand(100, 2)] - ax = plt.axes(xlim=(0, 1), ylim=(0, 1), autoscale_on=False) - ax.set_title('Lasso points using left mouse button') - - lman = LassoManager(ax, data) - - plt.show() diff --git a/examples/event_handling/legend_picking.html b/examples/event_handling/legend_picking.html deleted file mode 100644 index 44632a1831d..00000000000 --- a/examples/event_handling/legend_picking.html +++ /dev/null @@ -1,364 +0,0 @@ - - - - - - - - event_handling example code: legend_picking.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

event_handling example code: legend_picking.py

-

[source code]

-
"""
-Enable picking on the legend to toggle the original line on and off
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-t = np.arange(0.0, 0.2, 0.1)
-y1 = 2*np.sin(2*np.pi*t)
-y2 = 4*np.sin(2*np.pi*2*t)
-
-fig, ax = plt.subplots()
-ax.set_title('Click on legend line to toggle line on/off')
-line1, = ax.plot(t, y1, lw=2, color='red', label='1 HZ')
-line2, = ax.plot(t, y2, lw=2, color='blue', label='2 HZ')
-leg = ax.legend(loc='upper left', fancybox=True, shadow=True)
-leg.get_frame().set_alpha(0.4)
-
-
-# we will set up a dict mapping legend line to orig line, and enable
-# picking on the legend line
-lines = [line1, line2]
-lined = dict()
-for legline, origline in zip(leg.get_lines(), lines):
-    legline.set_picker(5)  # 5 pts tolerance
-    lined[legline] = origline
-
-
-def onpick(event):
-    # on the pick event, find the orig line corresponding to the
-    # legend proxy line, and toggle the visibility
-    legline = event.artist
-    origline = lined[legline]
-    vis = not origline.get_visible()
-    origline.set_visible(vis)
-    # Change the alpha on the line in the legend so we can see what lines
-    # have been toggled
-    if vis:
-        legline.set_alpha(1.0)
-    else:
-        legline.set_alpha(0.2)
-    fig.canvas.draw()
-
-fig.canvas.mpl_connect('pick_event', onpick)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/event_handling/legend_picking.py b/examples/event_handling/legend_picking.py deleted file mode 100644 index 88641554b70..00000000000 --- a/examples/event_handling/legend_picking.py +++ /dev/null @@ -1,45 +0,0 @@ -""" -Enable picking on the legend to toggle the original line on and off -""" -import numpy as np -import matplotlib.pyplot as plt - -t = np.arange(0.0, 0.2, 0.1) -y1 = 2*np.sin(2*np.pi*t) -y2 = 4*np.sin(2*np.pi*2*t) - -fig, ax = plt.subplots() -ax.set_title('Click on legend line to toggle line on/off') -line1, = ax.plot(t, y1, lw=2, color='red', label='1 HZ') -line2, = ax.plot(t, y2, lw=2, color='blue', label='2 HZ') -leg = ax.legend(loc='upper left', fancybox=True, shadow=True) -leg.get_frame().set_alpha(0.4) - - -# we will set up a dict mapping legend line to orig line, and enable -# picking on the legend line -lines = [line1, line2] -lined = dict() -for legline, origline in zip(leg.get_lines(), lines): - legline.set_picker(5) # 5 pts tolerance - lined[legline] = origline - - -def onpick(event): - # on the pick event, find the orig line corresponding to the - # legend proxy line, and toggle the visibility - legline = event.artist - origline = lined[legline] - vis = not origline.get_visible() - origline.set_visible(vis) - # Change the alpha on the line in the legend so we can see what lines - # have been toggled - if vis: - legline.set_alpha(1.0) - else: - legline.set_alpha(0.2) - fig.canvas.draw() - -fig.canvas.mpl_connect('pick_event', onpick) - -plt.show() diff --git a/examples/event_handling/looking_glass.html b/examples/event_handling/looking_glass.html deleted file mode 100644 index 23b12a8df98..00000000000 --- a/examples/event_handling/looking_glass.html +++ /dev/null @@ -1,367 +0,0 @@ - - - - - - - - event_handling example code: looking_glass.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

event_handling example code: looking_glass.py

-

[source code]

-
import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.patches as patches
-x, y = np.random.rand(2, 200)
-
-fig, ax = plt.subplots()
-circ = patches.Circle((0.5, 0.5), 0.25, alpha=0.8, fc='yellow')
-ax.add_patch(circ)
-
-
-ax.plot(x, y, alpha=0.2)
-line, = ax.plot(x, y, alpha=1.0, clip_path=circ)
-ax.set_title("Left click and drag to move looking glass")
-
-
-class EventHandler(object):
-    def __init__(self):
-        fig.canvas.mpl_connect('button_press_event', self.onpress)
-        fig.canvas.mpl_connect('button_release_event', self.onrelease)
-        fig.canvas.mpl_connect('motion_notify_event', self.onmove)
-        self.x0, self.y0 = circ.center
-        self.pressevent = None
-
-    def onpress(self, event):
-        if event.inaxes != ax:
-            return
-
-        if not circ.contains(event)[0]:
-            return
-
-        self.pressevent = event
-
-    def onrelease(self, event):
-        self.pressevent = None
-        self.x0, self.y0 = circ.center
-
-    def onmove(self, event):
-        if self.pressevent is None or event.inaxes != self.pressevent.inaxes:
-            return
-
-        dx = event.xdata - self.pressevent.xdata
-        dy = event.ydata - self.pressevent.ydata
-        circ.center = self.x0 + dx, self.y0 + dy
-        line.set_clip_path(circ)
-        fig.canvas.draw()
-
-handler = EventHandler()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/event_handling/looking_glass.py b/examples/event_handling/looking_glass.py deleted file mode 100644 index 8a5c0d0979b..00000000000 --- a/examples/event_handling/looking_glass.py +++ /dev/null @@ -1,48 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.patches as patches -x, y = np.random.rand(2, 200) - -fig, ax = plt.subplots() -circ = patches.Circle((0.5, 0.5), 0.25, alpha=0.8, fc='yellow') -ax.add_patch(circ) - - -ax.plot(x, y, alpha=0.2) -line, = ax.plot(x, y, alpha=1.0, clip_path=circ) -ax.set_title("Left click and drag to move looking glass") - - -class EventHandler(object): - def __init__(self): - fig.canvas.mpl_connect('button_press_event', self.onpress) - fig.canvas.mpl_connect('button_release_event', self.onrelease) - fig.canvas.mpl_connect('motion_notify_event', self.onmove) - self.x0, self.y0 = circ.center - self.pressevent = None - - def onpress(self, event): - if event.inaxes != ax: - return - - if not circ.contains(event)[0]: - return - - self.pressevent = event - - def onrelease(self, event): - self.pressevent = None - self.x0, self.y0 = circ.center - - def onmove(self, event): - if self.pressevent is None or event.inaxes != self.pressevent.inaxes: - return - - dx = event.xdata - self.pressevent.xdata - dy = event.ydata - self.pressevent.ydata - circ.center = self.x0 + dx, self.y0 + dy - line.set_clip_path(circ) - fig.canvas.draw() - -handler = EventHandler() -plt.show() diff --git a/examples/event_handling/path_editor.html b/examples/event_handling/path_editor.html deleted file mode 100644 index 09034d6bd6c..00000000000 --- a/examples/event_handling/path_editor.html +++ /dev/null @@ -1,468 +0,0 @@ - - - - - - - - event_handling example code: path_editor.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

event_handling example code: path_editor.py

-

[source code]

-
import numpy as np
-import matplotlib.path as mpath
-import matplotlib.patches as mpatches
-import matplotlib.pyplot as plt
-
-Path = mpath.Path
-
-fig, ax = plt.subplots()
-
-pathdata = [
-    (Path.MOVETO, (1.58, -2.57)),
-    (Path.CURVE4, (0.35, -1.1)),
-    (Path.CURVE4, (-1.75, 2.0)),
-    (Path.CURVE4, (0.375, 2.0)),
-    (Path.LINETO, (0.85, 1.15)),
-    (Path.CURVE4, (2.2, 3.2)),
-    (Path.CURVE4, (3, 0.05)),
-    (Path.CURVE4, (2.0, -0.5)),
-    (Path.CLOSEPOLY, (1.58, -2.57)),
-    ]
-
-codes, verts = zip(*pathdata)
-path = mpath.Path(verts, codes)
-patch = mpatches.PathPatch(path, facecolor='green', edgecolor='yellow', alpha=0.5)
-ax.add_patch(patch)
-
-
-class PathInteractor(object):
-    """
-    An path editor.
-
-    Key-bindings
-
-      't' toggle vertex markers on and off.  When vertex markers are on,
-          you can move them, delete them
-
-
-    """
-
-    showverts = True
-    epsilon = 5  # max pixel distance to count as a vertex hit
-
-    def __init__(self, pathpatch):
-
-        self.ax = pathpatch.axes
-        canvas = self.ax.figure.canvas
-        self.pathpatch = pathpatch
-        self.pathpatch.set_animated(True)
-
-        x, y = zip(*self.pathpatch.get_path().vertices)
-
-        self.line, = ax.plot(x, y, marker='o', markerfacecolor='r', animated=True)
-
-        self._ind = None  # the active vert
-
-        canvas.mpl_connect('draw_event', self.draw_callback)
-        canvas.mpl_connect('button_press_event', self.button_press_callback)
-        canvas.mpl_connect('key_press_event', self.key_press_callback)
-        canvas.mpl_connect('button_release_event', self.button_release_callback)
-        canvas.mpl_connect('motion_notify_event', self.motion_notify_callback)
-        self.canvas = canvas
-
-    def draw_callback(self, event):
-        self.background = self.canvas.copy_from_bbox(self.ax.bbox)
-        self.ax.draw_artist(self.pathpatch)
-        self.ax.draw_artist(self.line)
-        self.canvas.blit(self.ax.bbox)
-
-    def pathpatch_changed(self, pathpatch):
-        'this method is called whenever the pathpatchgon object is called'
-        # only copy the artist props to the line (except visibility)
-        vis = self.line.get_visible()
-        plt.Artist.update_from(self.line, pathpatch)
-        self.line.set_visible(vis)  # don't use the pathpatch visibility state
-
-    def get_ind_under_point(self, event):
-        'get the index of the vertex under point if within epsilon tolerance'
-
-        # display coords
-        xy = np.asarray(self.pathpatch.get_path().vertices)
-        xyt = self.pathpatch.get_transform().transform(xy)
-        xt, yt = xyt[:, 0], xyt[:, 1]
-        d = np.sqrt((xt - event.x)**2 + (yt - event.y)**2)
-        ind = d.argmin()
-
-        if d[ind] >= self.epsilon:
-            ind = None
-
-        return ind
-
-    def button_press_callback(self, event):
-        'whenever a mouse button is pressed'
-        if not self.showverts:
-            return
-        if event.inaxes is None:
-            return
-        if event.button != 1:
-            return
-        self._ind = self.get_ind_under_point(event)
-
-    def button_release_callback(self, event):
-        'whenever a mouse button is released'
-        if not self.showverts:
-            return
-        if event.button != 1:
-            return
-        self._ind = None
-
-    def key_press_callback(self, event):
-        'whenever a key is pressed'
-        if not event.inaxes:
-            return
-        if event.key == 't':
-            self.showverts = not self.showverts
-            self.line.set_visible(self.showverts)
-            if not self.showverts:
-                self._ind = None
-
-        self.canvas.draw()
-
-    def motion_notify_callback(self, event):
-        'on mouse movement'
-        if not self.showverts:
-            return
-        if self._ind is None:
-            return
-        if event.inaxes is None:
-            return
-        if event.button != 1:
-            return
-        x, y = event.xdata, event.ydata
-
-        vertices = self.pathpatch.get_path().vertices
-
-        vertices[self._ind] = x, y
-        self.line.set_data(zip(*vertices))
-
-        self.canvas.restore_region(self.background)
-        self.ax.draw_artist(self.pathpatch)
-        self.ax.draw_artist(self.line)
-        self.canvas.blit(self.ax.bbox)
-
-
-interactor = PathInteractor(patch)
-ax.set_title('drag vertices to update path')
-ax.set_xlim(-3, 4)
-ax.set_ylim(-3, 4)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/event_handling/path_editor.py b/examples/event_handling/path_editor.py deleted file mode 100644 index 3921bf71c8c..00000000000 --- a/examples/event_handling/path_editor.py +++ /dev/null @@ -1,149 +0,0 @@ -import numpy as np -import matplotlib.path as mpath -import matplotlib.patches as mpatches -import matplotlib.pyplot as plt - -Path = mpath.Path - -fig, ax = plt.subplots() - -pathdata = [ - (Path.MOVETO, (1.58, -2.57)), - (Path.CURVE4, (0.35, -1.1)), - (Path.CURVE4, (-1.75, 2.0)), - (Path.CURVE4, (0.375, 2.0)), - (Path.LINETO, (0.85, 1.15)), - (Path.CURVE4, (2.2, 3.2)), - (Path.CURVE4, (3, 0.05)), - (Path.CURVE4, (2.0, -0.5)), - (Path.CLOSEPOLY, (1.58, -2.57)), - ] - -codes, verts = zip(*pathdata) -path = mpath.Path(verts, codes) -patch = mpatches.PathPatch(path, facecolor='green', edgecolor='yellow', alpha=0.5) -ax.add_patch(patch) - - -class PathInteractor(object): - """ - An path editor. - - Key-bindings - - 't' toggle vertex markers on and off. When vertex markers are on, - you can move them, delete them - - - """ - - showverts = True - epsilon = 5 # max pixel distance to count as a vertex hit - - def __init__(self, pathpatch): - - self.ax = pathpatch.axes - canvas = self.ax.figure.canvas - self.pathpatch = pathpatch - self.pathpatch.set_animated(True) - - x, y = zip(*self.pathpatch.get_path().vertices) - - self.line, = ax.plot(x, y, marker='o', markerfacecolor='r', animated=True) - - self._ind = None # the active vert - - canvas.mpl_connect('draw_event', self.draw_callback) - canvas.mpl_connect('button_press_event', self.button_press_callback) - canvas.mpl_connect('key_press_event', self.key_press_callback) - canvas.mpl_connect('button_release_event', self.button_release_callback) - canvas.mpl_connect('motion_notify_event', self.motion_notify_callback) - self.canvas = canvas - - def draw_callback(self, event): - self.background = self.canvas.copy_from_bbox(self.ax.bbox) - self.ax.draw_artist(self.pathpatch) - self.ax.draw_artist(self.line) - self.canvas.blit(self.ax.bbox) - - def pathpatch_changed(self, pathpatch): - 'this method is called whenever the pathpatchgon object is called' - # only copy the artist props to the line (except visibility) - vis = self.line.get_visible() - plt.Artist.update_from(self.line, pathpatch) - self.line.set_visible(vis) # don't use the pathpatch visibility state - - def get_ind_under_point(self, event): - 'get the index of the vertex under point if within epsilon tolerance' - - # display coords - xy = np.asarray(self.pathpatch.get_path().vertices) - xyt = self.pathpatch.get_transform().transform(xy) - xt, yt = xyt[:, 0], xyt[:, 1] - d = np.sqrt((xt - event.x)**2 + (yt - event.y)**2) - ind = d.argmin() - - if d[ind] >= self.epsilon: - ind = None - - return ind - - def button_press_callback(self, event): - 'whenever a mouse button is pressed' - if not self.showverts: - return - if event.inaxes is None: - return - if event.button != 1: - return - self._ind = self.get_ind_under_point(event) - - def button_release_callback(self, event): - 'whenever a mouse button is released' - if not self.showverts: - return - if event.button != 1: - return - self._ind = None - - def key_press_callback(self, event): - 'whenever a key is pressed' - if not event.inaxes: - return - if event.key == 't': - self.showverts = not self.showverts - self.line.set_visible(self.showverts) - if not self.showverts: - self._ind = None - - self.canvas.draw() - - def motion_notify_callback(self, event): - 'on mouse movement' - if not self.showverts: - return - if self._ind is None: - return - if event.inaxes is None: - return - if event.button != 1: - return - x, y = event.xdata, event.ydata - - vertices = self.pathpatch.get_path().vertices - - vertices[self._ind] = x, y - self.line.set_data(zip(*vertices)) - - self.canvas.restore_region(self.background) - self.ax.draw_artist(self.pathpatch) - self.ax.draw_artist(self.line) - self.canvas.blit(self.ax.bbox) - - -interactor = PathInteractor(patch) -ax.set_title('drag vertices to update path') -ax.set_xlim(-3, 4) -ax.set_ylim(-3, 4) - -plt.show() diff --git a/examples/event_handling/pick_event_demo.html b/examples/event_handling/pick_event_demo.html deleted file mode 100644 index ccc27a87695..00000000000 --- a/examples/event_handling/pick_event_demo.html +++ /dev/null @@ -1,492 +0,0 @@ - - - - - - - - event_handling example code: pick_event_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

event_handling example code: pick_event_demo.py

-

[source code]

-
"""
-
-You can enable picking by setting the "picker" property of an artist
-(for example, a matplotlib Line2D, Text, Patch, Polygon, AxesImage,
-etc...)
-
-There are a variety of meanings of the picker property
-
-    None -  picking is disabled for this artist (default)
-
-    boolean - if True then picking will be enabled and the
-      artist will fire a pick event if the mouse event is over
-      the artist
-
-    float - if picker is a number it is interpreted as an
-      epsilon tolerance in points and the artist will fire
-      off an event if it's data is within epsilon of the mouse
-      event.  For some artists like lines and patch collections,
-      the artist may provide additional data to the pick event
-      that is generated, for example, the indices of the data within
-      epsilon of the pick event
-
-    function - if picker is callable, it is a user supplied
-      function which determines whether the artist is hit by the
-      mouse event.
-
-         hit, props = picker(artist, mouseevent)
-
-      to determine the hit test.  If the mouse event is over the
-      artist, return hit=True and props is a dictionary of properties
-      you want added to the PickEvent attributes
-
-
-After you have enabled an artist for picking by setting the "picker"
-property, you need to connect to the figure canvas pick_event to get
-pick callbacks on mouse press events.  For example,
-
-  def pick_handler(event):
-      mouseevent = event.mouseevent
-      artist = event.artist
-      # now do something with this...
-
-
-The pick event (matplotlib.backend_bases.PickEvent) which is passed to
-your callback is always fired with two attributes:
-
-  mouseevent - the mouse event that generate the pick event.  The
-    mouse event in turn has attributes like x and y (the coordinates in
-    display space, such as pixels from left, bottom) and xdata, ydata (the
-    coords in data space).  Additionally, you can get information about
-    which buttons were pressed, which keys were pressed, which Axes
-    the mouse is over, etc.  See matplotlib.backend_bases.MouseEvent
-    for details.
-
-  artist - the matplotlib.artist that generated the pick event.
-
-Additionally, certain artists like Line2D and PatchCollection may
-attach additional meta data like the indices into the data that meet
-the picker criteria (for example, all the points in the line that are within
-the specified epsilon tolerance)
-
-The examples below illustrate each of these methods.
-"""
-
-from __future__ import print_function
-import matplotlib.pyplot as plt
-from matplotlib.lines import Line2D
-from matplotlib.patches import Rectangle
-from matplotlib.text import Text
-from matplotlib.image import AxesImage
-import numpy as np
-from numpy.random import rand
-
-if 1:  # simple picking, lines, rectangles and text
-    fig, (ax1, ax2) = plt.subplots(2, 1)
-    ax1.set_title('click on points, rectangles or text', picker=True)
-    ax1.set_ylabel('ylabel', picker=True, bbox=dict(facecolor='red'))
-    line, = ax1.plot(rand(100), 'o', picker=5)  # 5 points tolerance
-
-    # pick the rectangle
-    bars = ax2.bar(range(10), rand(10), picker=True)
-    for label in ax2.get_xticklabels():  # make the xtick labels pickable
-        label.set_picker(True)
-
-    def onpick1(event):
-        if isinstance(event.artist, Line2D):
-            thisline = event.artist
-            xdata = thisline.get_xdata()
-            ydata = thisline.get_ydata()
-            ind = event.ind
-            print('onpick1 line:', zip(np.take(xdata, ind), np.take(ydata, ind)))
-        elif isinstance(event.artist, Rectangle):
-            patch = event.artist
-            print('onpick1 patch:', patch.get_path())
-        elif isinstance(event.artist, Text):
-            text = event.artist
-            print('onpick1 text:', text.get_text())
-
-    fig.canvas.mpl_connect('pick_event', onpick1)
-
-if 1:  # picking with a custom hit test function
-    # you can define custom pickers by setting picker to a callable
-    # function.  The function has the signature
-    #
-    #  hit, props = func(artist, mouseevent)
-    #
-    # to determine the hit test.  if the mouse event is over the artist,
-    # return hit=True and props is a dictionary of
-    # properties you want added to the PickEvent attributes
-
-    def line_picker(line, mouseevent):
-        """
-        find the points within a certain distance from the mouseclick in
-        data coords and attach some extra attributes, pickx and picky
-        which are the data points that were picked
-        """
-        if mouseevent.xdata is None:
-            return False, dict()
-        xdata = line.get_xdata()
-        ydata = line.get_ydata()
-        maxd = 0.05
-        d = np.sqrt((xdata - mouseevent.xdata)**2. + (ydata - mouseevent.ydata)**2.)
-
-        ind = np.nonzero(np.less_equal(d, maxd))
-        if len(ind):
-            pickx = np.take(xdata, ind)
-            picky = np.take(ydata, ind)
-            props = dict(ind=ind, pickx=pickx, picky=picky)
-            return True, props
-        else:
-            return False, dict()
-
-    def onpick2(event):
-        print('onpick2 line:', event.pickx, event.picky)
-
-    fig, ax = plt.subplots()
-    ax.set_title('custom picker for line data')
-    line, = ax.plot(rand(100), rand(100), 'o', picker=line_picker)
-    fig.canvas.mpl_connect('pick_event', onpick2)
-
-
-if 1:  # picking on a scatter plot (matplotlib.collections.RegularPolyCollection)
-
-    x, y, c, s = rand(4, 100)
-
-    def onpick3(event):
-        ind = event.ind
-        print('onpick3 scatter:', ind, np.take(x, ind), np.take(y, ind))
-
-    fig, ax = plt.subplots()
-    col = ax.scatter(x, y, 100*s, c, picker=True)
-    #fig.savefig('pscoll.eps')
-    fig.canvas.mpl_connect('pick_event', onpick3)
-
-if 1:  # picking images (matplotlib.image.AxesImage)
-    fig, ax = plt.subplots()
-    im1 = ax.imshow(rand(10, 5), extent=(1, 2, 1, 2), picker=True)
-    im2 = ax.imshow(rand(5, 10), extent=(3, 4, 1, 2), picker=True)
-    im3 = ax.imshow(rand(20, 25), extent=(1, 2, 3, 4), picker=True)
-    im4 = ax.imshow(rand(30, 12), extent=(3, 4, 3, 4), picker=True)
-    ax.axis([0, 5, 0, 5])
-
-    def onpick4(event):
-        artist = event.artist
-        if isinstance(artist, AxesImage):
-            im = artist
-            A = im.get_array()
-            print('onpick4 image', A.shape)
-
-    fig.canvas.mpl_connect('pick_event', onpick4)
-
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/event_handling/pick_event_demo.py b/examples/event_handling/pick_event_demo.py deleted file mode 100644 index e6282da88af..00000000000 --- a/examples/event_handling/pick_event_demo.py +++ /dev/null @@ -1,173 +0,0 @@ -""" - -You can enable picking by setting the "picker" property of an artist -(for example, a matplotlib Line2D, Text, Patch, Polygon, AxesImage, -etc...) - -There are a variety of meanings of the picker property - - None - picking is disabled for this artist (default) - - boolean - if True then picking will be enabled and the - artist will fire a pick event if the mouse event is over - the artist - - float - if picker is a number it is interpreted as an - epsilon tolerance in points and the artist will fire - off an event if it's data is within epsilon of the mouse - event. For some artists like lines and patch collections, - the artist may provide additional data to the pick event - that is generated, for example, the indices of the data within - epsilon of the pick event - - function - if picker is callable, it is a user supplied - function which determines whether the artist is hit by the - mouse event. - - hit, props = picker(artist, mouseevent) - - to determine the hit test. If the mouse event is over the - artist, return hit=True and props is a dictionary of properties - you want added to the PickEvent attributes - - -After you have enabled an artist for picking by setting the "picker" -property, you need to connect to the figure canvas pick_event to get -pick callbacks on mouse press events. For example, - - def pick_handler(event): - mouseevent = event.mouseevent - artist = event.artist - # now do something with this... - - -The pick event (matplotlib.backend_bases.PickEvent) which is passed to -your callback is always fired with two attributes: - - mouseevent - the mouse event that generate the pick event. The - mouse event in turn has attributes like x and y (the coordinates in - display space, such as pixels from left, bottom) and xdata, ydata (the - coords in data space). Additionally, you can get information about - which buttons were pressed, which keys were pressed, which Axes - the mouse is over, etc. See matplotlib.backend_bases.MouseEvent - for details. - - artist - the matplotlib.artist that generated the pick event. - -Additionally, certain artists like Line2D and PatchCollection may -attach additional meta data like the indices into the data that meet -the picker criteria (for example, all the points in the line that are within -the specified epsilon tolerance) - -The examples below illustrate each of these methods. -""" - -from __future__ import print_function -import matplotlib.pyplot as plt -from matplotlib.lines import Line2D -from matplotlib.patches import Rectangle -from matplotlib.text import Text -from matplotlib.image import AxesImage -import numpy as np -from numpy.random import rand - -if 1: # simple picking, lines, rectangles and text - fig, (ax1, ax2) = plt.subplots(2, 1) - ax1.set_title('click on points, rectangles or text', picker=True) - ax1.set_ylabel('ylabel', picker=True, bbox=dict(facecolor='red')) - line, = ax1.plot(rand(100), 'o', picker=5) # 5 points tolerance - - # pick the rectangle - bars = ax2.bar(range(10), rand(10), picker=True) - for label in ax2.get_xticklabels(): # make the xtick labels pickable - label.set_picker(True) - - def onpick1(event): - if isinstance(event.artist, Line2D): - thisline = event.artist - xdata = thisline.get_xdata() - ydata = thisline.get_ydata() - ind = event.ind - print('onpick1 line:', zip(np.take(xdata, ind), np.take(ydata, ind))) - elif isinstance(event.artist, Rectangle): - patch = event.artist - print('onpick1 patch:', patch.get_path()) - elif isinstance(event.artist, Text): - text = event.artist - print('onpick1 text:', text.get_text()) - - fig.canvas.mpl_connect('pick_event', onpick1) - -if 1: # picking with a custom hit test function - # you can define custom pickers by setting picker to a callable - # function. The function has the signature - # - # hit, props = func(artist, mouseevent) - # - # to determine the hit test. if the mouse event is over the artist, - # return hit=True and props is a dictionary of - # properties you want added to the PickEvent attributes - - def line_picker(line, mouseevent): - """ - find the points within a certain distance from the mouseclick in - data coords and attach some extra attributes, pickx and picky - which are the data points that were picked - """ - if mouseevent.xdata is None: - return False, dict() - xdata = line.get_xdata() - ydata = line.get_ydata() - maxd = 0.05 - d = np.sqrt((xdata - mouseevent.xdata)**2. + (ydata - mouseevent.ydata)**2.) - - ind = np.nonzero(np.less_equal(d, maxd)) - if len(ind): - pickx = np.take(xdata, ind) - picky = np.take(ydata, ind) - props = dict(ind=ind, pickx=pickx, picky=picky) - return True, props - else: - return False, dict() - - def onpick2(event): - print('onpick2 line:', event.pickx, event.picky) - - fig, ax = plt.subplots() - ax.set_title('custom picker for line data') - line, = ax.plot(rand(100), rand(100), 'o', picker=line_picker) - fig.canvas.mpl_connect('pick_event', onpick2) - - -if 1: # picking on a scatter plot (matplotlib.collections.RegularPolyCollection) - - x, y, c, s = rand(4, 100) - - def onpick3(event): - ind = event.ind - print('onpick3 scatter:', ind, np.take(x, ind), np.take(y, ind)) - - fig, ax = plt.subplots() - col = ax.scatter(x, y, 100*s, c, picker=True) - #fig.savefig('pscoll.eps') - fig.canvas.mpl_connect('pick_event', onpick3) - -if 1: # picking images (matplotlib.image.AxesImage) - fig, ax = plt.subplots() - im1 = ax.imshow(rand(10, 5), extent=(1, 2, 1, 2), picker=True) - im2 = ax.imshow(rand(5, 10), extent=(3, 4, 1, 2), picker=True) - im3 = ax.imshow(rand(20, 25), extent=(1, 2, 3, 4), picker=True) - im4 = ax.imshow(rand(30, 12), extent=(3, 4, 3, 4), picker=True) - ax.axis([0, 5, 0, 5]) - - def onpick4(event): - artist = event.artist - if isinstance(artist, AxesImage): - im = artist - A = im.get_array() - print('onpick4 image', A.shape) - - fig.canvas.mpl_connect('pick_event', onpick4) - - -plt.show() diff --git a/examples/event_handling/pick_event_demo2.html b/examples/event_handling/pick_event_demo2.html deleted file mode 100644 index 7e4025ac45e..00000000000 --- a/examples/event_handling/pick_event_demo2.html +++ /dev/null @@ -1,359 +0,0 @@ - - - - - - - - event_handling example code: pick_event_demo2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

event_handling example code: pick_event_demo2.py

-

[source code]

-
"""
-compute the mean and standard deviation (stddev) of 100 data sets and plot
-mean vs stddev.  When you click on one of the mu, sigma points, plot the raw
-data from the dataset that generated the mean and stddev.
-"""
-import numpy
-import matplotlib.pyplot as plt
-
-
-X = numpy.random.rand(100, 1000)
-xs = numpy.mean(X, axis=1)
-ys = numpy.std(X, axis=1)
-
-fig, ax = plt.subplots()
-ax.set_title('click on point to plot time series')
-line, = ax.plot(xs, ys, 'o', picker=5)  # 5 points tolerance
-
-
-def onpick(event):
-
-    if event.artist != line:
-        return True
-
-    N = len(event.ind)
-    if not N:
-        return True
-
-    figi = plt.figure()
-    for subplotnum, dataind in enumerate(event.ind):
-        ax = figi.add_subplot(N, 1, subplotnum + 1)
-        ax.plot(X[dataind])
-        ax.text(0.05, 0.9, 'mu=%1.3f\nsigma=%1.3f' % (xs[dataind], ys[dataind]),
-                transform=ax.transAxes, va='top')
-        ax.set_ylim(-0.5, 1.5)
-    figi.show()
-    return True
-
-fig.canvas.mpl_connect('pick_event', onpick)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/event_handling/pick_event_demo2.py b/examples/event_handling/pick_event_demo2.py deleted file mode 100644 index 0e103ebbad8..00000000000 --- a/examples/event_handling/pick_event_demo2.py +++ /dev/null @@ -1,40 +0,0 @@ -""" -compute the mean and standard deviation (stddev) of 100 data sets and plot -mean vs stddev. When you click on one of the mu, sigma points, plot the raw -data from the dataset that generated the mean and stddev. -""" -import numpy -import matplotlib.pyplot as plt - - -X = numpy.random.rand(100, 1000) -xs = numpy.mean(X, axis=1) -ys = numpy.std(X, axis=1) - -fig, ax = plt.subplots() -ax.set_title('click on point to plot time series') -line, = ax.plot(xs, ys, 'o', picker=5) # 5 points tolerance - - -def onpick(event): - - if event.artist != line: - return True - - N = len(event.ind) - if not N: - return True - - figi = plt.figure() - for subplotnum, dataind in enumerate(event.ind): - ax = figi.add_subplot(N, 1, subplotnum + 1) - ax.plot(X[dataind]) - ax.text(0.05, 0.9, 'mu=%1.3f\nsigma=%1.3f' % (xs[dataind], ys[dataind]), - transform=ax.transAxes, va='top') - ax.set_ylim(-0.5, 1.5) - figi.show() - return True - -fig.canvas.mpl_connect('pick_event', onpick) - -plt.show() diff --git a/examples/event_handling/pipong.html b/examples/event_handling/pipong.html deleted file mode 100644 index 14d628e6f7f..00000000000 --- a/examples/event_handling/pipong.html +++ /dev/null @@ -1,584 +0,0 @@ - - - - - - - - event_handling example code: pipong.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

event_handling example code: pipong.py

-

[source code]

-
# A matplotlib based game of Pong illustrating one way to write interactive
-# animation which are easily ported to multiple backends
-# pipong.py was written by Paul Ivanov <http://pirsquared.org>
-
-from __future__ import print_function
-
-import numpy as np
-import matplotlib.pyplot as plt
-from numpy.random import randn, randint
-
-instructions = """
-Player A:       Player B:
-  'e'      up     'i'
-  'd'     down    'k'
-
-press 't' -- close these instructions
-            (animation will be much faster)
-press 'a' -- add a puck
-press 'A' -- remove a puck
-press '1' -- slow down all pucks
-press '2' -- speed up all pucks
-press '3' -- slow down distractors
-press '4' -- speed up distractors
-press ' ' -- reset the first puck
-press 'n' -- toggle distractors on/off
-press 'g' -- toggle the game on/off
-
-  """
-
-
-class Pad(object):
-    def __init__(self, disp, x, y, type='l'):
-        self.disp = disp
-        self.x = x
-        self.y = y
-        self.w = .3
-        self.score = 0
-        self.xoffset = 0.3
-        self.yoffset = 0.1
-        if type == 'r':
-            self.xoffset *= -1.0
-
-        if type == 'l' or type == 'r':
-            self.signx = -1.0
-            self.signy = 1.0
-        else:
-            self.signx = 1.0
-            self.signy = -1.0
-
-    def contains(self, loc):
-        return self.disp.get_bbox().contains(loc.x, loc.y)
-
-
-class Puck(object):
-    def __init__(self, disp, pad, field):
-        self.vmax = .2
-        self.disp = disp
-        self.field = field
-        self._reset(pad)
-
-    def _reset(self, pad):
-        self.x = pad.x + pad.xoffset
-        if pad.y < 0:
-            self.y = pad.y + pad.yoffset
-        else:
-            self.y = pad.y - pad.yoffset
-        self.vx = pad.x - self.x
-        self.vy = pad.y + pad.w/2 - self.y
-        self._speedlimit()
-        self._slower()
-        self._slower()
-
-    def update(self, pads):
-        self.x += self.vx
-        self.y += self.vy
-        for pad in pads:
-            if pad.contains(self):
-                self.vx *= 1.2 * pad.signx
-                self.vy *= 1.2 * pad.signy
-        fudge = .001
-        # probably cleaner with something like...
-        #if not self.field.contains(self.x, self.y):
-        if self.x < fudge:
-            #print("player A loses")
-            pads[1].score += 1
-            self._reset(pads[0])
-            return True
-        if self.x > 7 - fudge:
-            #print("player B loses")
-            pads[0].score += 1
-            self._reset(pads[1])
-            return True
-        if self.y < -1 + fudge or self.y > 1 - fudge:
-            self.vy *= -1.0
-            # add some randomness, just to make it interesting
-            self.vy -= (randn()/300.0 + 1/300.0) * np.sign(self.vy)
-        self._speedlimit()
-        return False
-
-    def _slower(self):
-        self.vx /= 5.0
-        self.vy /= 5.0
-
-    def _faster(self):
-        self.vx *= 5.0
-        self.vy *= 5.0
-
-    def _speedlimit(self):
-        if self.vx > self.vmax:
-            self.vx = self.vmax
-        if self.vx < -self.vmax:
-            self.vx = -self.vmax
-
-        if self.vy > self.vmax:
-            self.vy = self.vmax
-        if self.vy < -self.vmax:
-            self.vy = -self.vmax
-
-
-class Game(object):
-    def __init__(self, ax):
-        # create the initial line
-        self.ax = ax
-        padAx = padBx = .50
-        padAy = padBy = .30
-        padBx += 6.3
-        pA, = self.ax.barh(padAy, .2, height=.3, color='k', alpha=.5, edgecolor='b', lw=2, label="Player B", animated=True)
-        pB, = self.ax.barh(padBy, .2, height=.3, left=padBx, color='k', alpha=.5, edgecolor='r', lw=2, label="Player A", animated=True)
-
-        # distractors
-        self.x = np.arange(0, 2.22*np.pi, 0.01)
-        self.line, = self.ax.plot(self.x, np.sin(self.x), "r", animated=True, lw=4)
-        self.line2, = self.ax.plot(self.x, np.cos(self.x), "g", animated=True, lw=4)
-        self.line3, = self.ax.plot(self.x, np.cos(self.x), "g", animated=True, lw=4)
-        self.line4, = self.ax.plot(self.x, np.cos(self.x), "r", animated=True, lw=4)
-        self.centerline, = self.ax.plot([3.5, 3.5], [1, -1], 'k', alpha=.5, animated=True, lw=8)
-        self.puckdisp = self.ax.scatter([1], [1], label='_nolegend_', s=200, c='g', alpha=.9, animated=True)
-
-        self.canvas = self.ax.figure.canvas
-        self.background = None
-        self.cnt = 0
-        self.distract = True
-        self.res = 100.0
-        self.on = False
-        self.inst = True    # show instructions from the beginning
-        self.background = None
-        self.pads = []
-        self.pads.append(Pad(pA, 0, padAy))
-        self.pads.append(Pad(pB, padBx, padBy, 'r'))
-        self.pucks = []
-        self.i = self.ax.annotate(instructions, (.5, 0.5),
-                                  name='monospace',
-                                  verticalalignment='center',
-                                  horizontalalignment='center',
-                                  multialignment='left',
-                                  textcoords='axes fraction', animated=True)
-        self.canvas.mpl_connect('key_press_event', self.key_press)
-
-    def draw(self, evt):
-        draw_artist = self.ax.draw_artist
-        if self.background is None:
-            self.background = self.canvas.copy_from_bbox(self.ax.bbox)
-
-        # restore the clean slate background
-        self.canvas.restore_region(self.background)
-
-        # show the distractors
-        if self.distract:
-            self.line.set_ydata(np.sin(self.x + self.cnt/self.res))
-            self.line2.set_ydata(np.cos(self.x - self.cnt/self.res))
-            self.line3.set_ydata(np.tan(self.x + self.cnt/self.res))
-            self.line4.set_ydata(np.tan(self.x - self.cnt/self.res))
-            draw_artist(self.line)
-            draw_artist(self.line2)
-            draw_artist(self.line3)
-            draw_artist(self.line4)
-
-        # show the instructions - this is very slow
-        if self.inst:
-            self.ax.draw_artist(self.i)
-
-        # pucks and pads
-        if self.on:
-            self.ax.draw_artist(self.centerline)
-            for pad in self.pads:
-                pad.disp.set_y(pad.y)
-                pad.disp.set_x(pad.x)
-                self.ax.draw_artist(pad.disp)
-
-            for puck in self.pucks:
-                if puck.update(self.pads):
-                    # we only get here if someone scored
-                    self.pads[0].disp.set_label("   " + str(self.pads[0].score))
-                    self.pads[1].disp.set_label("   " + str(self.pads[1].score))
-                    self.ax.legend(loc='center')
-                    self.leg = self.ax.get_legend()
-                    #self.leg.draw_frame(False) #don't draw the legend border
-                    self.leg.get_frame().set_alpha(.2)
-                    plt.setp(self.leg.get_texts(), fontweight='bold', fontsize='xx-large')
-                    self.leg.get_frame().set_facecolor('0.2')
-                    self.background = None
-                    self.ax.figure.canvas.draw()
-                    return True
-                puck.disp.set_offsets([puck.x, puck.y])
-                self.ax.draw_artist(puck.disp)
-
-        # just redraw the axes rectangle
-        self.canvas.blit(self.ax.bbox)
-
-        if self.cnt == 50000:
-            # just so we don't get carried away
-            print("...and you've been playing for too long!!!")
-            plt.close()
-
-        self.cnt += 1
-        return True
-
-    def key_press(self, event):
-        if event.key == '3':
-            self.res *= 5.0
-        if event.key == '4':
-            self.res /= 5.0
-
-        if event.key == 'e':
-            self.pads[0].y += .1
-            if self.pads[0].y > 1 - .3:
-                self.pads[0].y = 1 - .3
-        if event.key == 'd':
-            self.pads[0].y -= .1
-            if self.pads[0].y < -1:
-                self.pads[0].y = -1
-
-        if event.key == 'i':
-            self.pads[1].y += .1
-            if self.pads[1].y > 1 - .3:
-                self.pads[1].y = 1 - .3
-        if event.key == 'k':
-            self.pads[1].y -= .1
-            if self.pads[1].y < -1:
-                self.pads[1].y = -1
-
-        if event.key == 'a':
-            self.pucks.append(Puck(self.puckdisp, self.pads[randint(2)], self.ax.bbox))
-        if event.key == 'A' and len(self.pucks):
-            self.pucks.pop()
-        if event.key == ' ' and len(self.pucks):
-            self.pucks[0]._reset(self.pads[randint(2)])
-        if event.key == '1':
-            for p in self.pucks:
-                p._slower()
-        if event.key == '2':
-            for p in self.pucks:
-                p._faster()
-
-        if event.key == 'n':
-            self.distract = not self.distract
-
-        if event.key == 'g':
-            #self.ax.clear()
-            self.on = not self.on
-        if event.key == 't':
-            self.inst = not self.inst
-            self.i.set_visible(self.i.get_visible())
-        if event.key == 'q':
-            plt.close()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/event_handling/pipong.py b/examples/event_handling/pipong.py deleted file mode 100644 index 89ab36ef9b3..00000000000 --- a/examples/event_handling/pipong.py +++ /dev/null @@ -1,265 +0,0 @@ -# A matplotlib based game of Pong illustrating one way to write interactive -# animation which are easily ported to multiple backends -# pipong.py was written by Paul Ivanov - -from __future__ import print_function - -import numpy as np -import matplotlib.pyplot as plt -from numpy.random import randn, randint - -instructions = """ -Player A: Player B: - 'e' up 'i' - 'd' down 'k' - -press 't' -- close these instructions - (animation will be much faster) -press 'a' -- add a puck -press 'A' -- remove a puck -press '1' -- slow down all pucks -press '2' -- speed up all pucks -press '3' -- slow down distractors -press '4' -- speed up distractors -press ' ' -- reset the first puck -press 'n' -- toggle distractors on/off -press 'g' -- toggle the game on/off - - """ - - -class Pad(object): - def __init__(self, disp, x, y, type='l'): - self.disp = disp - self.x = x - self.y = y - self.w = .3 - self.score = 0 - self.xoffset = 0.3 - self.yoffset = 0.1 - if type == 'r': - self.xoffset *= -1.0 - - if type == 'l' or type == 'r': - self.signx = -1.0 - self.signy = 1.0 - else: - self.signx = 1.0 - self.signy = -1.0 - - def contains(self, loc): - return self.disp.get_bbox().contains(loc.x, loc.y) - - -class Puck(object): - def __init__(self, disp, pad, field): - self.vmax = .2 - self.disp = disp - self.field = field - self._reset(pad) - - def _reset(self, pad): - self.x = pad.x + pad.xoffset - if pad.y < 0: - self.y = pad.y + pad.yoffset - else: - self.y = pad.y - pad.yoffset - self.vx = pad.x - self.x - self.vy = pad.y + pad.w/2 - self.y - self._speedlimit() - self._slower() - self._slower() - - def update(self, pads): - self.x += self.vx - self.y += self.vy - for pad in pads: - if pad.contains(self): - self.vx *= 1.2 * pad.signx - self.vy *= 1.2 * pad.signy - fudge = .001 - # probably cleaner with something like... - #if not self.field.contains(self.x, self.y): - if self.x < fudge: - #print("player A loses") - pads[1].score += 1 - self._reset(pads[0]) - return True - if self.x > 7 - fudge: - #print("player B loses") - pads[0].score += 1 - self._reset(pads[1]) - return True - if self.y < -1 + fudge or self.y > 1 - fudge: - self.vy *= -1.0 - # add some randomness, just to make it interesting - self.vy -= (randn()/300.0 + 1/300.0) * np.sign(self.vy) - self._speedlimit() - return False - - def _slower(self): - self.vx /= 5.0 - self.vy /= 5.0 - - def _faster(self): - self.vx *= 5.0 - self.vy *= 5.0 - - def _speedlimit(self): - if self.vx > self.vmax: - self.vx = self.vmax - if self.vx < -self.vmax: - self.vx = -self.vmax - - if self.vy > self.vmax: - self.vy = self.vmax - if self.vy < -self.vmax: - self.vy = -self.vmax - - -class Game(object): - def __init__(self, ax): - # create the initial line - self.ax = ax - padAx = padBx = .50 - padAy = padBy = .30 - padBx += 6.3 - pA, = self.ax.barh(padAy, .2, height=.3, color='k', alpha=.5, edgecolor='b', lw=2, label="Player B", animated=True) - pB, = self.ax.barh(padBy, .2, height=.3, left=padBx, color='k', alpha=.5, edgecolor='r', lw=2, label="Player A", animated=True) - - # distractors - self.x = np.arange(0, 2.22*np.pi, 0.01) - self.line, = self.ax.plot(self.x, np.sin(self.x), "r", animated=True, lw=4) - self.line2, = self.ax.plot(self.x, np.cos(self.x), "g", animated=True, lw=4) - self.line3, = self.ax.plot(self.x, np.cos(self.x), "g", animated=True, lw=4) - self.line4, = self.ax.plot(self.x, np.cos(self.x), "r", animated=True, lw=4) - self.centerline, = self.ax.plot([3.5, 3.5], [1, -1], 'k', alpha=.5, animated=True, lw=8) - self.puckdisp = self.ax.scatter([1], [1], label='_nolegend_', s=200, c='g', alpha=.9, animated=True) - - self.canvas = self.ax.figure.canvas - self.background = None - self.cnt = 0 - self.distract = True - self.res = 100.0 - self.on = False - self.inst = True # show instructions from the beginning - self.background = None - self.pads = [] - self.pads.append(Pad(pA, 0, padAy)) - self.pads.append(Pad(pB, padBx, padBy, 'r')) - self.pucks = [] - self.i = self.ax.annotate(instructions, (.5, 0.5), - name='monospace', - verticalalignment='center', - horizontalalignment='center', - multialignment='left', - textcoords='axes fraction', animated=True) - self.canvas.mpl_connect('key_press_event', self.key_press) - - def draw(self, evt): - draw_artist = self.ax.draw_artist - if self.background is None: - self.background = self.canvas.copy_from_bbox(self.ax.bbox) - - # restore the clean slate background - self.canvas.restore_region(self.background) - - # show the distractors - if self.distract: - self.line.set_ydata(np.sin(self.x + self.cnt/self.res)) - self.line2.set_ydata(np.cos(self.x - self.cnt/self.res)) - self.line3.set_ydata(np.tan(self.x + self.cnt/self.res)) - self.line4.set_ydata(np.tan(self.x - self.cnt/self.res)) - draw_artist(self.line) - draw_artist(self.line2) - draw_artist(self.line3) - draw_artist(self.line4) - - # show the instructions - this is very slow - if self.inst: - self.ax.draw_artist(self.i) - - # pucks and pads - if self.on: - self.ax.draw_artist(self.centerline) - for pad in self.pads: - pad.disp.set_y(pad.y) - pad.disp.set_x(pad.x) - self.ax.draw_artist(pad.disp) - - for puck in self.pucks: - if puck.update(self.pads): - # we only get here if someone scored - self.pads[0].disp.set_label(" " + str(self.pads[0].score)) - self.pads[1].disp.set_label(" " + str(self.pads[1].score)) - self.ax.legend(loc='center') - self.leg = self.ax.get_legend() - #self.leg.draw_frame(False) #don't draw the legend border - self.leg.get_frame().set_alpha(.2) - plt.setp(self.leg.get_texts(), fontweight='bold', fontsize='xx-large') - self.leg.get_frame().set_facecolor('0.2') - self.background = None - self.ax.figure.canvas.draw() - return True - puck.disp.set_offsets([puck.x, puck.y]) - self.ax.draw_artist(puck.disp) - - # just redraw the axes rectangle - self.canvas.blit(self.ax.bbox) - - if self.cnt == 50000: - # just so we don't get carried away - print("...and you've been playing for too long!!!") - plt.close() - - self.cnt += 1 - return True - - def key_press(self, event): - if event.key == '3': - self.res *= 5.0 - if event.key == '4': - self.res /= 5.0 - - if event.key == 'e': - self.pads[0].y += .1 - if self.pads[0].y > 1 - .3: - self.pads[0].y = 1 - .3 - if event.key == 'd': - self.pads[0].y -= .1 - if self.pads[0].y < -1: - self.pads[0].y = -1 - - if event.key == 'i': - self.pads[1].y += .1 - if self.pads[1].y > 1 - .3: - self.pads[1].y = 1 - .3 - if event.key == 'k': - self.pads[1].y -= .1 - if self.pads[1].y < -1: - self.pads[1].y = -1 - - if event.key == 'a': - self.pucks.append(Puck(self.puckdisp, self.pads[randint(2)], self.ax.bbox)) - if event.key == 'A' and len(self.pucks): - self.pucks.pop() - if event.key == ' ' and len(self.pucks): - self.pucks[0]._reset(self.pads[randint(2)]) - if event.key == '1': - for p in self.pucks: - p._slower() - if event.key == '2': - for p in self.pucks: - p._faster() - - if event.key == 'n': - self.distract = not self.distract - - if event.key == 'g': - #self.ax.clear() - self.on = not self.on - if event.key == 't': - self.inst = not self.inst - self.i.set_visible(self.i.get_visible()) - if event.key == 'q': - plt.close() diff --git a/examples/event_handling/poly_editor.html b/examples/event_handling/poly_editor.html deleted file mode 100644 index eff45fd4204..00000000000 --- a/examples/event_handling/poly_editor.html +++ /dev/null @@ -1,495 +0,0 @@ - - - - - - - - event_handling example code: poly_editor.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

event_handling example code: poly_editor.py

-

[source code]

-
"""
-This is an example to show how to build cross-GUI applications using
-matplotlib event handling to interact with objects on the canvas
-
-"""
-import numpy as np
-from matplotlib.lines import Line2D
-from matplotlib.artist import Artist
-from matplotlib.mlab import dist_point_to_segment
-
-
-class PolygonInteractor(object):
-    """
-    An polygon editor.
-
-    Key-bindings
-
-      't' toggle vertex markers on and off.  When vertex markers are on,
-          you can move them, delete them
-
-      'd' delete the vertex under point
-
-      'i' insert a vertex at point.  You must be within epsilon of the
-          line connecting two existing vertices
-
-    """
-
-    showverts = True
-    epsilon = 5  # max pixel distance to count as a vertex hit
-
-    def __init__(self, ax, poly):
-        if poly.figure is None:
-            raise RuntimeError('You must first add the polygon to a figure or canvas before defining the interactor')
-        self.ax = ax
-        canvas = poly.figure.canvas
-        self.poly = poly
-
-        x, y = zip(*self.poly.xy)
-        self.line = Line2D(x, y, marker='o', markerfacecolor='r', animated=True)
-        self.ax.add_line(self.line)
-        #self._update_line(poly)
-
-        cid = self.poly.add_callback(self.poly_changed)
-        self._ind = None  # the active vert
-
-        canvas.mpl_connect('draw_event', self.draw_callback)
-        canvas.mpl_connect('button_press_event', self.button_press_callback)
-        canvas.mpl_connect('key_press_event', self.key_press_callback)
-        canvas.mpl_connect('button_release_event', self.button_release_callback)
-        canvas.mpl_connect('motion_notify_event', self.motion_notify_callback)
-        self.canvas = canvas
-
-    def draw_callback(self, event):
-        self.background = self.canvas.copy_from_bbox(self.ax.bbox)
-        self.ax.draw_artist(self.poly)
-        self.ax.draw_artist(self.line)
-        self.canvas.blit(self.ax.bbox)
-
-    def poly_changed(self, poly):
-        'this method is called whenever the polygon object is called'
-        # only copy the artist props to the line (except visibility)
-        vis = self.line.get_visible()
-        Artist.update_from(self.line, poly)
-        self.line.set_visible(vis)  # don't use the poly visibility state
-
-    def get_ind_under_point(self, event):
-        'get the index of the vertex under point if within epsilon tolerance'
-
-        # display coords
-        xy = np.asarray(self.poly.xy)
-        xyt = self.poly.get_transform().transform(xy)
-        xt, yt = xyt[:, 0], xyt[:, 1]
-        d = np.sqrt((xt - event.x)**2 + (yt - event.y)**2)
-        indseq = np.nonzero(np.equal(d, np.amin(d)))[0]
-        ind = indseq[0]
-
-        if d[ind] >= self.epsilon:
-            ind = None
-
-        return ind
-
-    def button_press_callback(self, event):
-        'whenever a mouse button is pressed'
-        if not self.showverts:
-            return
-        if event.inaxes is None:
-            return
-        if event.button != 1:
-            return
-        self._ind = self.get_ind_under_point(event)
-
-    def button_release_callback(self, event):
-        'whenever a mouse button is released'
-        if not self.showverts:
-            return
-        if event.button != 1:
-            return
-        self._ind = None
-
-    def key_press_callback(self, event):
-        'whenever a key is pressed'
-        if not event.inaxes:
-            return
-        if event.key == 't':
-            self.showverts = not self.showverts
-            self.line.set_visible(self.showverts)
-            if not self.showverts:
-                self._ind = None
-        elif event.key == 'd':
-            ind = self.get_ind_under_point(event)
-            if ind is not None:
-                self.poly.xy = [tup for i, tup in enumerate(self.poly.xy) if i != ind]
-                self.line.set_data(zip(*self.poly.xy))
-        elif event.key == 'i':
-            xys = self.poly.get_transform().transform(self.poly.xy)
-            p = event.x, event.y  # display coords
-            for i in range(len(xys) - 1):
-                s0 = xys[i]
-                s1 = xys[i + 1]
-                d = dist_point_to_segment(p, s0, s1)
-                if d <= self.epsilon:
-                    self.poly.xy = np.array(
-                        list(self.poly.xy[:i]) +
-                        [(event.xdata, event.ydata)] +
-                        list(self.poly.xy[i:]))
-                    self.line.set_data(zip(*self.poly.xy))
-                    break
-
-        self.canvas.draw()
-
-    def motion_notify_callback(self, event):
-        'on mouse movement'
-        if not self.showverts:
-            return
-        if self._ind is None:
-            return
-        if event.inaxes is None:
-            return
-        if event.button != 1:
-            return
-        x, y = event.xdata, event.ydata
-
-        self.poly.xy[self._ind] = x, y
-        if self._ind == 0:
-            self.poly.xy[-1] = x, y
-        elif self._ind == len(self.poly.xy) - 1:
-            self.poly.xy[0] = x, y
-        self.line.set_data(zip(*self.poly.xy))
-
-        self.canvas.restore_region(self.background)
-        self.ax.draw_artist(self.poly)
-        self.ax.draw_artist(self.line)
-        self.canvas.blit(self.ax.bbox)
-
-
-if __name__ == '__main__':
-    import matplotlib.pyplot as plt
-    from matplotlib.patches import Polygon
-
-    theta = np.arange(0, 2*np.pi, 0.1)
-    r = 1.5
-
-    xs = r*np.cos(theta)
-    ys = r*np.sin(theta)
-
-    poly = Polygon(list(zip(xs, ys)), animated=True)
-
-    fig, ax = plt.subplots()
-    ax.add_patch(poly)
-    p = PolygonInteractor(ax, poly)
-
-    #ax.add_line(p.line)
-    ax.set_title('Click and drag a point to move it')
-    ax.set_xlim((-2, 2))
-    ax.set_ylim((-2, 2))
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/event_handling/poly_editor.py b/examples/event_handling/poly_editor.py deleted file mode 100644 index 98d65d0021c..00000000000 --- a/examples/event_handling/poly_editor.py +++ /dev/null @@ -1,176 +0,0 @@ -""" -This is an example to show how to build cross-GUI applications using -matplotlib event handling to interact with objects on the canvas - -""" -import numpy as np -from matplotlib.lines import Line2D -from matplotlib.artist import Artist -from matplotlib.mlab import dist_point_to_segment - - -class PolygonInteractor(object): - """ - An polygon editor. - - Key-bindings - - 't' toggle vertex markers on and off. When vertex markers are on, - you can move them, delete them - - 'd' delete the vertex under point - - 'i' insert a vertex at point. You must be within epsilon of the - line connecting two existing vertices - - """ - - showverts = True - epsilon = 5 # max pixel distance to count as a vertex hit - - def __init__(self, ax, poly): - if poly.figure is None: - raise RuntimeError('You must first add the polygon to a figure or canvas before defining the interactor') - self.ax = ax - canvas = poly.figure.canvas - self.poly = poly - - x, y = zip(*self.poly.xy) - self.line = Line2D(x, y, marker='o', markerfacecolor='r', animated=True) - self.ax.add_line(self.line) - #self._update_line(poly) - - cid = self.poly.add_callback(self.poly_changed) - self._ind = None # the active vert - - canvas.mpl_connect('draw_event', self.draw_callback) - canvas.mpl_connect('button_press_event', self.button_press_callback) - canvas.mpl_connect('key_press_event', self.key_press_callback) - canvas.mpl_connect('button_release_event', self.button_release_callback) - canvas.mpl_connect('motion_notify_event', self.motion_notify_callback) - self.canvas = canvas - - def draw_callback(self, event): - self.background = self.canvas.copy_from_bbox(self.ax.bbox) - self.ax.draw_artist(self.poly) - self.ax.draw_artist(self.line) - self.canvas.blit(self.ax.bbox) - - def poly_changed(self, poly): - 'this method is called whenever the polygon object is called' - # only copy the artist props to the line (except visibility) - vis = self.line.get_visible() - Artist.update_from(self.line, poly) - self.line.set_visible(vis) # don't use the poly visibility state - - def get_ind_under_point(self, event): - 'get the index of the vertex under point if within epsilon tolerance' - - # display coords - xy = np.asarray(self.poly.xy) - xyt = self.poly.get_transform().transform(xy) - xt, yt = xyt[:, 0], xyt[:, 1] - d = np.sqrt((xt - event.x)**2 + (yt - event.y)**2) - indseq = np.nonzero(np.equal(d, np.amin(d)))[0] - ind = indseq[0] - - if d[ind] >= self.epsilon: - ind = None - - return ind - - def button_press_callback(self, event): - 'whenever a mouse button is pressed' - if not self.showverts: - return - if event.inaxes is None: - return - if event.button != 1: - return - self._ind = self.get_ind_under_point(event) - - def button_release_callback(self, event): - 'whenever a mouse button is released' - if not self.showverts: - return - if event.button != 1: - return - self._ind = None - - def key_press_callback(self, event): - 'whenever a key is pressed' - if not event.inaxes: - return - if event.key == 't': - self.showverts = not self.showverts - self.line.set_visible(self.showverts) - if not self.showverts: - self._ind = None - elif event.key == 'd': - ind = self.get_ind_under_point(event) - if ind is not None: - self.poly.xy = [tup for i, tup in enumerate(self.poly.xy) if i != ind] - self.line.set_data(zip(*self.poly.xy)) - elif event.key == 'i': - xys = self.poly.get_transform().transform(self.poly.xy) - p = event.x, event.y # display coords - for i in range(len(xys) - 1): - s0 = xys[i] - s1 = xys[i + 1] - d = dist_point_to_segment(p, s0, s1) - if d <= self.epsilon: - self.poly.xy = np.array( - list(self.poly.xy[:i]) + - [(event.xdata, event.ydata)] + - list(self.poly.xy[i:])) - self.line.set_data(zip(*self.poly.xy)) - break - - self.canvas.draw() - - def motion_notify_callback(self, event): - 'on mouse movement' - if not self.showverts: - return - if self._ind is None: - return - if event.inaxes is None: - return - if event.button != 1: - return - x, y = event.xdata, event.ydata - - self.poly.xy[self._ind] = x, y - if self._ind == 0: - self.poly.xy[-1] = x, y - elif self._ind == len(self.poly.xy) - 1: - self.poly.xy[0] = x, y - self.line.set_data(zip(*self.poly.xy)) - - self.canvas.restore_region(self.background) - self.ax.draw_artist(self.poly) - self.ax.draw_artist(self.line) - self.canvas.blit(self.ax.bbox) - - -if __name__ == '__main__': - import matplotlib.pyplot as plt - from matplotlib.patches import Polygon - - theta = np.arange(0, 2*np.pi, 0.1) - r = 1.5 - - xs = r*np.cos(theta) - ys = r*np.sin(theta) - - poly = Polygon(list(zip(xs, ys)), animated=True) - - fig, ax = plt.subplots() - ax.add_patch(poly) - p = PolygonInteractor(ax, poly) - - #ax.add_line(p.line) - ax.set_title('Click and drag a point to move it') - ax.set_xlim((-2, 2)) - ax.set_ylim((-2, 2)) - plt.show() diff --git a/examples/event_handling/pong_gtk.html b/examples/event_handling/pong_gtk.html deleted file mode 100644 index 630c78a5b44..00000000000 --- a/examples/event_handling/pong_gtk.html +++ /dev/null @@ -1,352 +0,0 @@ - - - - - - - - event_handling example code: pong_gtk.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

event_handling example code: pong_gtk.py

-

[source code]

-
from __future__ import print_function
-
-# For detailed comments on animation and the techniques used here, see
-# the wiki entry
-# http://www.scipy.org/wikis/topical_software/MatplotlibAnimation
-import time
-
-import gobject
-
-import matplotlib
-matplotlib.use('GTKAgg')
-
-import matplotlib.pyplot as plt
-import pipong
-
-
-fig, ax = plt.subplots()
-canvas = ax.figure.canvas
-
-
-def start_anim(event):
-    # gobject.idle_add(animation.draw,animation)
-    gobject.timeout_add(10, animation.draw, animation)
-    canvas.mpl_disconnect(start_anim.cid)
-
-animation = pipong.Game(ax)
-start_anim.cid = canvas.mpl_connect('draw_event', start_anim)
-
-
-tstart = time.time()
-plt.grid()  # to ensure proper background restore
-plt.show()
-print('FPS: %f' % animation.cnt/(time.time() - tstart))
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/event_handling/pong_gtk.py b/examples/event_handling/pong_gtk.py deleted file mode 100644 index 48290a1b904..00000000000 --- a/examples/event_handling/pong_gtk.py +++ /dev/null @@ -1,33 +0,0 @@ -from __future__ import print_function - -# For detailed comments on animation and the techniques used here, see -# the wiki entry -# http://www.scipy.org/wikis/topical_software/MatplotlibAnimation -import time - -import gobject - -import matplotlib -matplotlib.use('GTKAgg') - -import matplotlib.pyplot as plt -import pipong - - -fig, ax = plt.subplots() -canvas = ax.figure.canvas - - -def start_anim(event): - # gobject.idle_add(animation.draw,animation) - gobject.timeout_add(10, animation.draw, animation) - canvas.mpl_disconnect(start_anim.cid) - -animation = pipong.Game(ax) -start_anim.cid = canvas.mpl_connect('draw_event', start_anim) - - -tstart = time.time() -plt.grid() # to ensure proper background restore -plt.show() -print('FPS: %f' % animation.cnt/(time.time() - tstart)) diff --git a/examples/event_handling/resample.html b/examples/event_handling/resample.html deleted file mode 100644 index 5c89c82227c..00000000000 --- a/examples/event_handling/resample.html +++ /dev/null @@ -1,368 +0,0 @@ - - - - - - - - event_handling example code: resample.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

event_handling example code: resample.py

-

[source code]

-
import numpy as np
-import matplotlib.pyplot as plt
-
-
-# A class that will downsample the data and recompute when zoomed.
-class DataDisplayDownsampler(object):
-    def __init__(self, xdata, ydata):
-        self.origYData = ydata
-        self.origXData = xdata
-        self.ratio = 5
-        self.delta = xdata[-1] - xdata[0]
-
-    def downsample(self, xstart, xend):
-        # Very simple downsampling that takes the points within the range
-        # and picks every Nth point
-        mask = (self.origXData > xstart) & (self.origXData < xend)
-        xdata = self.origXData[mask]
-        xdata = xdata[::self.ratio]
-
-        ydata = self.origYData[mask]
-        ydata = ydata[::self.ratio]
-
-        return xdata, ydata
-
-    def update(self, ax):
-        # Update the line
-        lims = ax.viewLim
-        if np.abs(lims.width - self.delta) > 1e-8:
-            self.delta = lims.width
-            xstart, xend = lims.intervalx
-            self.line.set_data(*self.downsample(xstart, xend))
-            ax.figure.canvas.draw_idle()
-
-# Create a signal
-xdata = np.linspace(16, 365, 365-16)
-ydata = np.sin(2*np.pi*xdata/153) + np.cos(2*np.pi*xdata/127)
-
-d = DataDisplayDownsampler(xdata, ydata)
-
-fig, ax = plt.subplots()
-
-# Hook up the line
-d.line, = ax.plot(xdata, ydata, 'o-')
-ax.set_autoscale_on(False)  # Otherwise, infinite loop
-
-# Connect for changing the view limits
-ax.callbacks.connect('xlim_changed', d.update)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/event_handling/resample.py b/examples/event_handling/resample.py deleted file mode 100644 index 1b380a06cb9..00000000000 --- a/examples/event_handling/resample.py +++ /dev/null @@ -1,49 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - - -# A class that will downsample the data and recompute when zoomed. -class DataDisplayDownsampler(object): - def __init__(self, xdata, ydata): - self.origYData = ydata - self.origXData = xdata - self.ratio = 5 - self.delta = xdata[-1] - xdata[0] - - def downsample(self, xstart, xend): - # Very simple downsampling that takes the points within the range - # and picks every Nth point - mask = (self.origXData > xstart) & (self.origXData < xend) - xdata = self.origXData[mask] - xdata = xdata[::self.ratio] - - ydata = self.origYData[mask] - ydata = ydata[::self.ratio] - - return xdata, ydata - - def update(self, ax): - # Update the line - lims = ax.viewLim - if np.abs(lims.width - self.delta) > 1e-8: - self.delta = lims.width - xstart, xend = lims.intervalx - self.line.set_data(*self.downsample(xstart, xend)) - ax.figure.canvas.draw_idle() - -# Create a signal -xdata = np.linspace(16, 365, 365-16) -ydata = np.sin(2*np.pi*xdata/153) + np.cos(2*np.pi*xdata/127) - -d = DataDisplayDownsampler(xdata, ydata) - -fig, ax = plt.subplots() - -# Hook up the line -d.line, = ax.plot(xdata, ydata, 'o-') -ax.set_autoscale_on(False) # Otherwise, infinite loop - -# Connect for changing the view limits -ax.callbacks.connect('xlim_changed', d.update) - -plt.show() diff --git a/examples/event_handling/test_mouseclicks.html b/examples/event_handling/test_mouseclicks.html deleted file mode 100644 index d9bda4f005a..00000000000 --- a/examples/event_handling/test_mouseclicks.html +++ /dev/null @@ -1,351 +0,0 @@ - - - - - - - - event_handling example code: test_mouseclicks.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

event_handling example code: test_mouseclicks.py

-

[source code]

-
from __future__ import print_function
-
-import matplotlib
-#matplotlib.use("WxAgg")
-#matplotlib.use("TkAgg")
-#matplotlib.use("GTKAgg")
-#matplotlib.use("Qt4Agg")
-#matplotlib.use("MacOSX")
-import matplotlib.pyplot as plt
-
-#print("***** TESTING WITH BACKEND: %s"%matplotlib.get_backend() + " *****")
-
-
-def OnClick(event):
-    if event.dblclick:
-        print("DBLCLICK", event)
-    else:
-        print("DOWN    ", event)
-
-
-def OnRelease(event):
-    print("UP      ", event)
-
-
-fig = plt.gcf()
-cid_up = fig.canvas.mpl_connect('button_press_event', OnClick)
-cid_down = fig.canvas.mpl_connect('button_release_event', OnRelease)
-
-plt.gca().text(0.5, 0.5, "Click on the canvas to test mouse events.",
-               ha="center", va="center")
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/event_handling/test_mouseclicks.py b/examples/event_handling/test_mouseclicks.py deleted file mode 100644 index bfd26ab494c..00000000000 --- a/examples/event_handling/test_mouseclicks.py +++ /dev/null @@ -1,32 +0,0 @@ -from __future__ import print_function - -import matplotlib -#matplotlib.use("WxAgg") -#matplotlib.use("TkAgg") -#matplotlib.use("GTKAgg") -#matplotlib.use("Qt4Agg") -#matplotlib.use("MacOSX") -import matplotlib.pyplot as plt - -#print("***** TESTING WITH BACKEND: %s"%matplotlib.get_backend() + " *****") - - -def OnClick(event): - if event.dblclick: - print("DBLCLICK", event) - else: - print("DOWN ", event) - - -def OnRelease(event): - print("UP ", event) - - -fig = plt.gcf() -cid_up = fig.canvas.mpl_connect('button_press_event', OnClick) -cid_down = fig.canvas.mpl_connect('button_release_event', OnRelease) - -plt.gca().text(0.5, 0.5, "Click on the canvas to test mouse events.", - ha="center", va="center") - -plt.show() diff --git a/examples/event_handling/timers.html b/examples/event_handling/timers.html deleted file mode 100644 index 9df1ff0d724..00000000000 --- a/examples/event_handling/timers.html +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - event_handling example code: timers.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

event_handling example code: timers.py

-

[source code]

-
# Simple example of using general timer objects. This is used to update
-# the time placed in the title of the figure.
-import matplotlib.pyplot as plt
-import numpy as np
-from datetime import datetime
-
-
-def update_title(axes):
-    axes.set_title(datetime.now())
-    axes.figure.canvas.draw()
-
-fig, ax = plt.subplots()
-
-x = np.linspace(-3, 3)
-ax.plot(x, x*x)
-
-# Create a new timer object. Set the interval to 100 milliseconds
-# (1000 is default) and tell the timer what function should be called.
-timer = fig.canvas.new_timer(interval=100)
-timer.add_callback(update_title, ax)
-timer.start()
-
-# Or could start the timer on first figure draw
-#def start_timer(evt):
-#    timer.start()
-#    fig.canvas.mpl_disconnect(drawid)
-#drawid = fig.canvas.mpl_connect('draw_event', start_timer)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/event_handling/timers.py b/examples/event_handling/timers.py deleted file mode 100644 index b9e67e22348..00000000000 --- a/examples/event_handling/timers.py +++ /dev/null @@ -1,29 +0,0 @@ -# Simple example of using general timer objects. This is used to update -# the time placed in the title of the figure. -import matplotlib.pyplot as plt -import numpy as np -from datetime import datetime - - -def update_title(axes): - axes.set_title(datetime.now()) - axes.figure.canvas.draw() - -fig, ax = plt.subplots() - -x = np.linspace(-3, 3) -ax.plot(x, x*x) - -# Create a new timer object. Set the interval to 100 milliseconds -# (1000 is default) and tell the timer what function should be called. -timer = fig.canvas.new_timer(interval=100) -timer.add_callback(update_title, ax) -timer.start() - -# Or could start the timer on first figure draw -#def start_timer(evt): -# timer.start() -# fig.canvas.mpl_disconnect(drawid) -#drawid = fig.canvas.mpl_connect('draw_event', start_timer) - -plt.show() diff --git a/examples/event_handling/trifinder_event_demo.html b/examples/event_handling/trifinder_event_demo.html deleted file mode 100644 index 0d6e867d3b0..00000000000 --- a/examples/event_handling/trifinder_event_demo.html +++ /dev/null @@ -1,378 +0,0 @@ - - - - - - - - event_handling example code: trifinder_event_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

event_handling example code: trifinder_event_demo.py

-

[source code]

-
"""
-Example showing the use of a TriFinder object.  As the mouse is moved over the
-triangulation, the triangle under the cursor is highlighted and the index of
-the triangle is displayed in the plot title.
-"""
-import matplotlib.pyplot as plt
-from matplotlib.tri import Triangulation
-from matplotlib.patches import Polygon
-import numpy as np
-import math
-
-
-def update_polygon(tri):
-    if tri == -1:
-        points = [0, 0, 0]
-    else:
-        points = triangulation.triangles[tri]
-    xs = triangulation.x[points]
-    ys = triangulation.y[points]
-    polygon.set_xy(list(zip(xs, ys)))
-
-
-def motion_notify(event):
-    if event.inaxes is None:
-        tri = -1
-    else:
-        tri = trifinder(event.xdata, event.ydata)
-    update_polygon(tri)
-    plt.title('In triangle %i' % tri)
-    event.canvas.draw()
-
-
-# Create a Triangulation.
-n_angles = 16
-n_radii = 5
-min_radius = 0.25
-radii = np.linspace(min_radius, 0.95, n_radii)
-angles = np.linspace(0, 2*math.pi, n_angles, endpoint=False)
-angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1)
-angles[:, 1::2] += math.pi / n_angles
-x = (radii*np.cos(angles)).flatten()
-y = (radii*np.sin(angles)).flatten()
-triangulation = Triangulation(x, y)
-xmid = x[triangulation.triangles].mean(axis=1)
-ymid = y[triangulation.triangles].mean(axis=1)
-mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0)
-triangulation.set_mask(mask)
-
-# Use the triangulation's default TriFinder object.
-trifinder = triangulation.get_trifinder()
-
-# Setup plot and callbacks.
-plt.subplot(111, aspect='equal')
-plt.triplot(triangulation, 'bo-')
-polygon = Polygon([[0, 0], [0, 0]], facecolor='y')  # dummy data for xs,ys
-update_polygon(-1)
-plt.gca().add_patch(polygon)
-plt.gcf().canvas.mpl_connect('motion_notify_event', motion_notify)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/event_handling/trifinder_event_demo.py b/examples/event_handling/trifinder_event_demo.py deleted file mode 100644 index 0c45c78c4df..00000000000 --- a/examples/event_handling/trifinder_event_demo.py +++ /dev/null @@ -1,59 +0,0 @@ -""" -Example showing the use of a TriFinder object. As the mouse is moved over the -triangulation, the triangle under the cursor is highlighted and the index of -the triangle is displayed in the plot title. -""" -import matplotlib.pyplot as plt -from matplotlib.tri import Triangulation -from matplotlib.patches import Polygon -import numpy as np -import math - - -def update_polygon(tri): - if tri == -1: - points = [0, 0, 0] - else: - points = triangulation.triangles[tri] - xs = triangulation.x[points] - ys = triangulation.y[points] - polygon.set_xy(list(zip(xs, ys))) - - -def motion_notify(event): - if event.inaxes is None: - tri = -1 - else: - tri = trifinder(event.xdata, event.ydata) - update_polygon(tri) - plt.title('In triangle %i' % tri) - event.canvas.draw() - - -# Create a Triangulation. -n_angles = 16 -n_radii = 5 -min_radius = 0.25 -radii = np.linspace(min_radius, 0.95, n_radii) -angles = np.linspace(0, 2*math.pi, n_angles, endpoint=False) -angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) -angles[:, 1::2] += math.pi / n_angles -x = (radii*np.cos(angles)).flatten() -y = (radii*np.sin(angles)).flatten() -triangulation = Triangulation(x, y) -xmid = x[triangulation.triangles].mean(axis=1) -ymid = y[triangulation.triangles].mean(axis=1) -mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0) -triangulation.set_mask(mask) - -# Use the triangulation's default TriFinder object. -trifinder = triangulation.get_trifinder() - -# Setup plot and callbacks. -plt.subplot(111, aspect='equal') -plt.triplot(triangulation, 'bo-') -polygon = Polygon([[0, 0], [0, 0]], facecolor='y') # dummy data for xs,ys -update_polygon(-1) -plt.gca().add_patch(polygon) -plt.gcf().canvas.mpl_connect('motion_notify_event', motion_notify) -plt.show() diff --git a/examples/event_handling/viewlims.html b/examples/event_handling/viewlims.html deleted file mode 100644 index b37eb427017..00000000000 --- a/examples/event_handling/viewlims.html +++ /dev/null @@ -1,398 +0,0 @@ - - - - - - - - event_handling example code: viewlims.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

event_handling example code: viewlims.py

-

[source code]

-
# Creates two identical panels.  Zooming in on the right panel will show
-# a rectangle in the first panel, denoting the zoomed region.
-import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.patches import Rectangle
-
-
-# We just subclass Rectangle so that it can be called with an Axes
-# instance, causing the rectangle to update its shape to match the
-# bounds of the Axes
-class UpdatingRect(Rectangle):
-    def __call__(self, ax):
-        self.set_bounds(*ax.viewLim.bounds)
-        ax.figure.canvas.draw_idle()
-
-
-# A class that will regenerate a fractal set as we zoom in, so that you
-# can actually see the increasing detail.  A box in the left panel will show
-# the area to which we are zoomed.
-class MandelbrotDisplay(object):
-    def __init__(self, h=500, w=500, niter=50, radius=2., power=2):
-        self.height = h
-        self.width = w
-        self.niter = niter
-        self.radius = radius
-        self.power = power
-
-    def __call__(self, xstart, xend, ystart, yend):
-        self.x = np.linspace(xstart, xend, self.width)
-        self.y = np.linspace(ystart, yend, self.height).reshape(-1, 1)
-        c = self.x + 1.0j * self.y
-        threshold_time = np.zeros((self.height, self.width))
-        z = np.zeros(threshold_time.shape, dtype=np.complex)
-        mask = np.ones(threshold_time.shape, dtype=np.bool)
-        for i in range(self.niter):
-            z[mask] = z[mask]**self.power + c[mask]
-            mask = (np.abs(z) < self.radius)
-            threshold_time += mask
-        return threshold_time
-
-    def ax_update(self, ax):
-        ax.set_autoscale_on(False)  # Otherwise, infinite loop
-
-        # Get the number of points from the number of pixels in the window
-        dims = ax.axesPatch.get_window_extent().bounds
-        self.width = int(dims[2] + 0.5)
-        self.height = int(dims[2] + 0.5)
-
-        # Get the range for the new area
-        xstart, ystart, xdelta, ydelta = ax.viewLim.bounds
-        xend = xstart + xdelta
-        yend = ystart + ydelta
-
-        # Update the image object with our new data and extent
-        im = ax.images[-1]
-        im.set_data(self.__call__(xstart, xend, ystart, yend))
-        im.set_extent((xstart, xend, ystart, yend))
-        ax.figure.canvas.draw_idle()
-
-md = MandelbrotDisplay()
-Z = md(-2., 0.5, -1.25, 1.25)
-
-fig1, (ax1, ax2) = plt.subplots(1, 2)
-ax1.imshow(Z, origin='lower', extent=(md.x.min(), md.x.max(), md.y.min(), md.y.max()))
-ax2.imshow(Z, origin='lower', extent=(md.x.min(), md.x.max(), md.y.min(), md.y.max()))
-
-rect = UpdatingRect([0, 0], 0, 0, facecolor='None', edgecolor='black', linewidth=1.0)
-rect.set_bounds(*ax2.viewLim.bounds)
-ax1.add_patch(rect)
-
-# Connect for changing the view limits
-ax2.callbacks.connect('xlim_changed', rect)
-ax2.callbacks.connect('ylim_changed', rect)
-
-ax2.callbacks.connect('xlim_changed', md.ax_update)
-ax2.callbacks.connect('ylim_changed', md.ax_update)
-ax2.set_title("Zoom here")
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/event_handling/viewlims.py b/examples/event_handling/viewlims.py deleted file mode 100644 index c1c0230cf7d..00000000000 --- a/examples/event_handling/viewlims.py +++ /dev/null @@ -1,79 +0,0 @@ -# Creates two identical panels. Zooming in on the right panel will show -# a rectangle in the first panel, denoting the zoomed region. -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.patches import Rectangle - - -# We just subclass Rectangle so that it can be called with an Axes -# instance, causing the rectangle to update its shape to match the -# bounds of the Axes -class UpdatingRect(Rectangle): - def __call__(self, ax): - self.set_bounds(*ax.viewLim.bounds) - ax.figure.canvas.draw_idle() - - -# A class that will regenerate a fractal set as we zoom in, so that you -# can actually see the increasing detail. A box in the left panel will show -# the area to which we are zoomed. -class MandelbrotDisplay(object): - def __init__(self, h=500, w=500, niter=50, radius=2., power=2): - self.height = h - self.width = w - self.niter = niter - self.radius = radius - self.power = power - - def __call__(self, xstart, xend, ystart, yend): - self.x = np.linspace(xstart, xend, self.width) - self.y = np.linspace(ystart, yend, self.height).reshape(-1, 1) - c = self.x + 1.0j * self.y - threshold_time = np.zeros((self.height, self.width)) - z = np.zeros(threshold_time.shape, dtype=np.complex) - mask = np.ones(threshold_time.shape, dtype=np.bool) - for i in range(self.niter): - z[mask] = z[mask]**self.power + c[mask] - mask = (np.abs(z) < self.radius) - threshold_time += mask - return threshold_time - - def ax_update(self, ax): - ax.set_autoscale_on(False) # Otherwise, infinite loop - - # Get the number of points from the number of pixels in the window - dims = ax.axesPatch.get_window_extent().bounds - self.width = int(dims[2] + 0.5) - self.height = int(dims[2] + 0.5) - - # Get the range for the new area - xstart, ystart, xdelta, ydelta = ax.viewLim.bounds - xend = xstart + xdelta - yend = ystart + ydelta - - # Update the image object with our new data and extent - im = ax.images[-1] - im.set_data(self.__call__(xstart, xend, ystart, yend)) - im.set_extent((xstart, xend, ystart, yend)) - ax.figure.canvas.draw_idle() - -md = MandelbrotDisplay() -Z = md(-2., 0.5, -1.25, 1.25) - -fig1, (ax1, ax2) = plt.subplots(1, 2) -ax1.imshow(Z, origin='lower', extent=(md.x.min(), md.x.max(), md.y.min(), md.y.max())) -ax2.imshow(Z, origin='lower', extent=(md.x.min(), md.x.max(), md.y.min(), md.y.max())) - -rect = UpdatingRect([0, 0], 0, 0, facecolor='None', edgecolor='black', linewidth=1.0) -rect.set_bounds(*ax2.viewLim.bounds) -ax1.add_patch(rect) - -# Connect for changing the view limits -ax2.callbacks.connect('xlim_changed', rect) -ax2.callbacks.connect('ylim_changed', rect) - -ax2.callbacks.connect('xlim_changed', md.ax_update) -ax2.callbacks.connect('ylim_changed', md.ax_update) -ax2.set_title("Zoom here") - -plt.show() diff --git a/examples/event_handling/zoom_window.html b/examples/event_handling/zoom_window.html deleted file mode 100644 index aff0fae4356..00000000000 --- a/examples/event_handling/zoom_window.html +++ /dev/null @@ -1,358 +0,0 @@ - - - - - - - - event_handling example code: zoom_window.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

event_handling example code: zoom_window.py

-

[source code]

-
"""
-This example shows how to connect events in one window, for example, a mouse
-press, to another figure window.
-
-If you click on a point in the first window, the z and y limits of the
-second will be adjusted so that the center of the zoom in the second
-window will be the x,y coordinates of the clicked point.
-
-Note the diameter of the circles in the scatter are defined in
-points**2, so their size is independent of the zoom
-"""
-from matplotlib.pyplot import figure, show
-import numpy
-figsrc = figure()
-figzoom = figure()
-
-axsrc = figsrc.add_subplot(111, xlim=(0, 1), ylim=(0, 1), autoscale_on=False)
-axzoom = figzoom.add_subplot(111, xlim=(0.45, 0.55), ylim=(0.4, .6),
-                             autoscale_on=False)
-axsrc.set_title('Click to zoom')
-axzoom.set_title('zoom window')
-x, y, s, c = numpy.random.rand(4, 200)
-s *= 200
-
-
-axsrc.scatter(x, y, s, c)
-axzoom.scatter(x, y, s, c)
-
-
-def onpress(event):
-    if event.button != 1:
-        return
-    x, y = event.xdata, event.ydata
-    axzoom.set_xlim(x - 0.1, x + 0.1)
-    axzoom.set_ylim(y - 0.1, y + 0.1)
-    figzoom.canvas.draw()
-
-figsrc.canvas.mpl_connect('button_press_event', onpress)
-show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/event_handling/zoom_window.py b/examples/event_handling/zoom_window.py deleted file mode 100644 index 130074aaa1b..00000000000 --- a/examples/event_handling/zoom_window.py +++ /dev/null @@ -1,39 +0,0 @@ -""" -This example shows how to connect events in one window, for example, a mouse -press, to another figure window. - -If you click on a point in the first window, the z and y limits of the -second will be adjusted so that the center of the zoom in the second -window will be the x,y coordinates of the clicked point. - -Note the diameter of the circles in the scatter are defined in -points**2, so their size is independent of the zoom -""" -from matplotlib.pyplot import figure, show -import numpy -figsrc = figure() -figzoom = figure() - -axsrc = figsrc.add_subplot(111, xlim=(0, 1), ylim=(0, 1), autoscale_on=False) -axzoom = figzoom.add_subplot(111, xlim=(0.45, 0.55), ylim=(0.4, .6), - autoscale_on=False) -axsrc.set_title('Click to zoom') -axzoom.set_title('zoom window') -x, y, s, c = numpy.random.rand(4, 200) -s *= 200 - - -axsrc.scatter(x, y, s, c) -axzoom.scatter(x, y, s, c) - - -def onpress(event): - if event.button != 1: - return - x, y = event.xdata, event.ydata - axzoom.set_xlim(x - 0.1, x + 0.1) - axzoom.set_ylim(y - 0.1, y + 0.1) - figzoom.canvas.draw() - -figsrc.canvas.mpl_connect('button_press_event', onpress) -show() diff --git a/examples/frontpage/index.html b/examples/frontpage/index.html deleted file mode 100644 index 04268d5c43f..00000000000 --- a/examples/frontpage/index.html +++ /dev/null @@ -1,330 +0,0 @@ - - - - - - - - frontpage Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

frontpage Examples

- --- - - - - - -
Release:2.0.2
Date:May 10, 2017
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/frontpage/plot_3D.html b/examples/frontpage/plot_3D.html deleted file mode 100644 index 0758048df06..00000000000 --- a/examples/frontpage/plot_3D.html +++ /dev/null @@ -1,357 +0,0 @@ - - - - - - - - frontpage example code: plot_3D.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

frontpage example code: plot_3D.py

-

[source code]

-
"""
-====================
-Frontpage 3D example
-====================
-
-This example reproduces the frontpage 3D example.
-
-"""
-from mpl_toolkits.mplot3d import Axes3D
-from matplotlib import cbook
-from matplotlib import cm
-from matplotlib.colors import LightSource
-import matplotlib.pyplot as plt
-import numpy as np
-
-filename = cbook.get_sample_data('jacksboro_fault_dem.npz', asfileobj=False)
-with np.load(filename) as dem:
-    z = dem['elevation']
-    nrows, ncols = z.shape
-    x = np.linspace(dem['xmin'], dem['xmax'], ncols)
-    y = np.linspace(dem['ymin'], dem['ymax'], nrows)
-    x, y = np.meshgrid(x, y)
-
-region = np.s_[5:50, 5:50]
-x, y, z = x[region], y[region], z[region]
-
-fig, ax = plt.subplots(subplot_kw=dict(projection='3d'))
-
-ls = LightSource(270, 45)
-# To use a custom hillshading mode, override the built-in shading and pass
-# in the rgb colors of the shaded surface calculated from "shade".
-rgb = ls.shade(z, cmap=cm.gist_earth, vert_exag=0.1, blend_mode='soft')
-surf = ax.plot_surface(x, y, z, rstride=1, cstride=1, facecolors=rgb,
-                       linewidth=0, antialiased=False, shade=False)
-ax.set_xticks([])
-ax.set_yticks([])
-ax.set_zticks([])
-fig.savefig("surface3d_frontpage.png", dpi=25)  # results in 160x120 px image
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/frontpage/plot_3D.py b/examples/frontpage/plot_3D.py deleted file mode 100644 index d08b52f54b2..00000000000 --- a/examples/frontpage/plot_3D.py +++ /dev/null @@ -1,38 +0,0 @@ -""" -==================== -Frontpage 3D example -==================== - -This example reproduces the frontpage 3D example. - -""" -from mpl_toolkits.mplot3d import Axes3D -from matplotlib import cbook -from matplotlib import cm -from matplotlib.colors import LightSource -import matplotlib.pyplot as plt -import numpy as np - -filename = cbook.get_sample_data('jacksboro_fault_dem.npz', asfileobj=False) -with np.load(filename) as dem: - z = dem['elevation'] - nrows, ncols = z.shape - x = np.linspace(dem['xmin'], dem['xmax'], ncols) - y = np.linspace(dem['ymin'], dem['ymax'], nrows) - x, y = np.meshgrid(x, y) - -region = np.s_[5:50, 5:50] -x, y, z = x[region], y[region], z[region] - -fig, ax = plt.subplots(subplot_kw=dict(projection='3d')) - -ls = LightSource(270, 45) -# To use a custom hillshading mode, override the built-in shading and pass -# in the rgb colors of the shaded surface calculated from "shade". -rgb = ls.shade(z, cmap=cm.gist_earth, vert_exag=0.1, blend_mode='soft') -surf = ax.plot_surface(x, y, z, rstride=1, cstride=1, facecolors=rgb, - linewidth=0, antialiased=False, shade=False) -ax.set_xticks([]) -ax.set_yticks([]) -ax.set_zticks([]) -fig.savefig("surface3d_frontpage.png", dpi=25) # results in 160x120 px image diff --git a/examples/frontpage/plot_contour.html b/examples/frontpage/plot_contour.html deleted file mode 100644 index b228d35532e..00000000000 --- a/examples/frontpage/plot_contour.html +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - frontpage example code: plot_contour.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

frontpage example code: plot_contour.py

-

[source code]

-
"""
-=========================
-Frontpage contour example
-=========================
-
-This example reproduces the frontpage contour example.
-"""
-
-import matplotlib.pyplot as plt
-import numpy as np
-from matplotlib import mlab, cm
-
-extent = (-3, 3, -3, 3)
-
-delta = 0.5
-x = np.arange(-3.0, 4.001, delta)
-y = np.arange(-4.0, 3.001, delta)
-X, Y = np.meshgrid(x, y)
-Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, -0.5)
-Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
-Z = (Z1 - Z2) * 10
-
-levels = np.linspace(-2.0, 1.601, 40)
-norm = cm.colors.Normalize(vmax=abs(Z).max(), vmin=-abs(Z).max())
-
-fig, ax = plt.subplots()
-cset1 = ax.contourf(
-    X, Y, Z, levels,
-    norm=norm)
-ax.set_xlim(-3, 3)
-ax.set_ylim(-3, 3)
-ax.set_xticks([])
-ax.set_yticks([])
-fig.savefig("contour_frontpage.png", dpi=25)  # results in 160x120 px image
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/frontpage/plot_contour.py b/examples/frontpage/plot_contour.py deleted file mode 100644 index 9622cc01508..00000000000 --- a/examples/frontpage/plot_contour.py +++ /dev/null @@ -1,34 +0,0 @@ -""" -========================= -Frontpage contour example -========================= - -This example reproduces the frontpage contour example. -""" - -import matplotlib.pyplot as plt -import numpy as np -from matplotlib import mlab, cm - -extent = (-3, 3, -3, 3) - -delta = 0.5 -x = np.arange(-3.0, 4.001, delta) -y = np.arange(-4.0, 3.001, delta) -X, Y = np.meshgrid(x, y) -Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, -0.5) -Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) -Z = (Z1 - Z2) * 10 - -levels = np.linspace(-2.0, 1.601, 40) -norm = cm.colors.Normalize(vmax=abs(Z).max(), vmin=-abs(Z).max()) - -fig, ax = plt.subplots() -cset1 = ax.contourf( - X, Y, Z, levels, - norm=norm) -ax.set_xlim(-3, 3) -ax.set_ylim(-3, 3) -ax.set_xticks([]) -ax.set_yticks([]) -fig.savefig("contour_frontpage.png", dpi=25) # results in 160x120 px image diff --git a/examples/frontpage/plot_histogram.html b/examples/frontpage/plot_histogram.html deleted file mode 100644 index e163a4f3e87..00000000000 --- a/examples/frontpage/plot_histogram.html +++ /dev/null @@ -1,341 +0,0 @@ - - - - - - - - frontpage example code: plot_histogram.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

frontpage example code: plot_histogram.py

-

[source code]

-
"""
-===========================
-Frontpage histogram example
-===========================
-
-This example reproduces the frontpage histogram example.
-"""
-
-import matplotlib.pyplot as plt
-import numpy as np
-
-
-random_state = np.random.RandomState(19680801)
-X = random_state.randn(10000)
-
-fig, ax = plt.subplots()
-ax.hist(X, bins=25, normed=True)
-x = np.linspace(-5, 5, 1000)
-ax.plot(x, 1 / np.sqrt(2*np.pi) * np.exp(-(x**2)/2), linewidth=4)
-ax.set_xticks([])
-ax.set_yticks([])
-fig.savefig("histogram_frontpage.png", dpi=25)  # results in 160x120 px image
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/frontpage/plot_histogram.py b/examples/frontpage/plot_histogram.py deleted file mode 100644 index e9c5299df7d..00000000000 --- a/examples/frontpage/plot_histogram.py +++ /dev/null @@ -1,22 +0,0 @@ -""" -=========================== -Frontpage histogram example -=========================== - -This example reproduces the frontpage histogram example. -""" - -import matplotlib.pyplot as plt -import numpy as np - - -random_state = np.random.RandomState(19680801) -X = random_state.randn(10000) - -fig, ax = plt.subplots() -ax.hist(X, bins=25, normed=True) -x = np.linspace(-5, 5, 1000) -ax.plot(x, 1 / np.sqrt(2*np.pi) * np.exp(-(x**2)/2), linewidth=4) -ax.set_xticks([]) -ax.set_yticks([]) -fig.savefig("histogram_frontpage.png", dpi=25) # results in 160x120 px image diff --git a/examples/frontpage/plot_membrane.html b/examples/frontpage/plot_membrane.html deleted file mode 100644 index 0d2723a5537..00000000000 --- a/examples/frontpage/plot_membrane.html +++ /dev/null @@ -1,344 +0,0 @@ - - - - - - - - frontpage example code: plot_membrane.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

frontpage example code: plot_membrane.py

-

[source code]

-
"""
-======================
-Frontpage plot example
-======================
-
-
-This example reproduces the frontpage simple plot example.
-"""
-
-import matplotlib.pyplot as plt
-import matplotlib.cbook as cbook
-import numpy as np
-
-
-datafile = cbook.get_sample_data('membrane.dat', asfileobj=False)
-x = np.fromfile(datafile, np.float32)
-# 0.0005 is the sample interval
-
-fig, ax = plt.subplots()
-ax.plot(x, linewidth=4)
-ax.set_xlim(5000, 6000)
-ax.set_ylim(-0.6, 0.1)
-ax.set_xticks([])
-ax.set_yticks([])
-fig.savefig("membrane_frontpage.png", dpi=25)  # results in 160x120 px image
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/frontpage/plot_membrane.py b/examples/frontpage/plot_membrane.py deleted file mode 100644 index 522ba78fb85..00000000000 --- a/examples/frontpage/plot_membrane.py +++ /dev/null @@ -1,25 +0,0 @@ -""" -====================== -Frontpage plot example -====================== - - -This example reproduces the frontpage simple plot example. -""" - -import matplotlib.pyplot as plt -import matplotlib.cbook as cbook -import numpy as np - - -datafile = cbook.get_sample_data('membrane.dat', asfileobj=False) -x = np.fromfile(datafile, np.float32) -# 0.0005 is the sample interval - -fig, ax = plt.subplots() -ax.plot(x, linewidth=4) -ax.set_xlim(5000, 6000) -ax.set_ylim(-0.6, 0.1) -ax.set_xticks([]) -ax.set_yticks([]) -fig.savefig("membrane_frontpage.png", dpi=25) # results in 160x120 px image diff --git a/examples/images_contours_and_fields/contourf_log.html b/examples/images_contours_and_fields/contourf_log.html deleted file mode 100644 index 994bae7ea6b..00000000000 --- a/examples/images_contours_and_fields/contourf_log.html +++ /dev/null @@ -1,369 +0,0 @@ - - - - - - - - images_contours_and_fields example code: contourf_log.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

images_contours_and_fields example code: contourf_log.py

-

(Source code, png, pdf)

-
-../../_images/contourf_log.png -
-
'''
-Demonstrate use of a log color scale in contourf
-'''
-
-import matplotlib.pyplot as plt
-import numpy as np
-from numpy import ma
-from matplotlib import colors, ticker, cm
-from matplotlib.mlab import bivariate_normal
-
-N = 100
-x = np.linspace(-3.0, 3.0, N)
-y = np.linspace(-2.0, 2.0, N)
-
-X, Y = np.meshgrid(x, y)
-
-# A low hump with a spike coming out of the top right.
-# Needs to have z/colour axis on a log scale so we see both hump and spike.
-# linear scale only shows the spike.
-z = (bivariate_normal(X, Y, 0.1, 0.2, 1.0, 1.0)
-     + 0.1 * bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0))
-
-# Put in some negative values (lower left corner) to cause trouble with logs:
-z[:5, :5] = -1
-
-# The following is not strictly essential, but it will eliminate
-# a warning.  Comment it out to see the warning.
-z = ma.masked_where(z <= 0, z)
-
-
-# Automatic selection of levels works; setting the
-# log locator tells contourf to use a log scale:
-fig, ax = plt.subplots()
-cs = ax.contourf(X, Y, z, locator=ticker.LogLocator(), cmap=cm.PuBu_r)
-
-# Alternatively, you can manually set the levels
-# and the norm:
-#lev_exp = np.arange(np.floor(np.log10(z.min())-1),
-#                    np.ceil(np.log10(z.max())+1))
-#levs = np.power(10, lev_exp)
-#cs = P.contourf(X, Y, z, levs, norm=colors.LogNorm())
-
-# The 'extend' kwarg does not work yet with a log scale.
-
-cbar = fig.colorbar(cs)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/images_contours_and_fields/image_demo.html b/examples/images_contours_and_fields/image_demo.html deleted file mode 100644 index 18f1061ef26..00000000000 --- a/examples/images_contours_and_fields/image_demo.html +++ /dev/null @@ -1,335 +0,0 @@ - - - - - - - - images_contours_and_fields example code: image_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

images_contours_and_fields example code: image_demo.py

-

(Source code, png, pdf)

-
-../../_images/image_demo3.png -
-
"""
-Simple demo of the imshow function.
-"""
-import matplotlib.pyplot as plt
-import matplotlib.cbook as cbook
-
-image_file = cbook.get_sample_data('ada.png')
-image = plt.imread(image_file)
-
-fig, ax = plt.subplots()
-ax.imshow(image)
-ax.axis('off')  # clear x- and y-axes
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/images_contours_and_fields/image_demo_clip_path.html b/examples/images_contours_and_fields/image_demo_clip_path.html deleted file mode 100644 index 14f5c7a4095..00000000000 --- a/examples/images_contours_and_fields/image_demo_clip_path.html +++ /dev/null @@ -1,340 +0,0 @@ - - - - - - - - images_contours_and_fields example code: image_demo_clip_path.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

images_contours_and_fields example code: image_demo_clip_path.py

-

(Source code, png, pdf)

-
-../../_images/image_demo_clip_path.png -
-
"""
-Demo of image that's been clipped by a circular patch.
-"""
-import matplotlib.pyplot as plt
-import matplotlib.patches as patches
-import matplotlib.cbook as cbook
-
-
-image_file = cbook.get_sample_data('grace_hopper.png')
-image = plt.imread(image_file)
-
-fig, ax = plt.subplots()
-im = ax.imshow(image)
-patch = patches.Circle((260, 200), radius=200, transform=ax.transData)
-im.set_clip_path(patch)
-
-ax.axis('off')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/images_contours_and_fields/index.html b/examples/images_contours_and_fields/index.html deleted file mode 100644 index ea94d5e9653..00000000000 --- a/examples/images_contours_and_fields/index.html +++ /dev/null @@ -1,334 +0,0 @@ - - - - - - - - images_contours_and_fields Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

images_contours_and_fields Examples

- --- - - - - - -
Release:2.0.2
Date:May 10, 2017
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/images_contours_and_fields/interpolation_methods.html b/examples/images_contours_and_fields/interpolation_methods.html deleted file mode 100644 index 9ce643790c3..00000000000 --- a/examples/images_contours_and_fields/interpolation_methods.html +++ /dev/null @@ -1,355 +0,0 @@ - - - - - - - - images_contours_and_fields example code: interpolation_methods.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

images_contours_and_fields example code: interpolation_methods.py

-

(Source code, png, pdf)

-
-../../_images/interpolation_methods.png -
-
'''
-Show all different interpolation methods for imshow
-'''
-
-import matplotlib.pyplot as plt
-import numpy as np
-
-# from the docs:
-
-# If interpolation is None, default to rc image.interpolation. See also
-# the filternorm and filterrad parameters. If interpolation is 'none', then
-# no interpolation is performed on the Agg, ps and pdf backends. Other
-# backends will fall back to 'nearest'.
-#
-# http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.imshow
-
-methods = [None, 'none', 'nearest', 'bilinear', 'bicubic', 'spline16',
-           'spline36', 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric',
-           'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc', 'lanczos']
-
-np.random.seed(0)
-grid = np.random.rand(4, 4)
-
-fig, axes = plt.subplots(3, 6, figsize=(12, 6),
-                         subplot_kw={'xticks': [], 'yticks': []})
-
-fig.subplots_adjust(hspace=0.3, wspace=0.05)
-
-for ax, interp_method in zip(axes.flat, methods):
-    ax.imshow(grid, interpolation=interp_method, cmap='viridis')
-    ax.set_title(interp_method)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/images_contours_and_fields/interpolation_none_vs_nearest.html b/examples/images_contours_and_fields/interpolation_none_vs_nearest.html deleted file mode 100644 index fcfc439639e..00000000000 --- a/examples/images_contours_and_fields/interpolation_none_vs_nearest.html +++ /dev/null @@ -1,389 +0,0 @@ - - - - - - - - images_contours_and_fields example code: interpolation_none_vs_nearest.py — Matplotlib 2.0.0 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

images_contours_and_fields example code: interpolation_none_vs_nearest.py

-

(Source code)

-
-../../_images/interpolation_none_vs_nearest_00.png -

(png, pdf)

-
-
-../../_images/interpolation_none_vs_nearest_01.png -

(png, pdf)

-
-
"""
-Displays the difference between interpolation = 'none' and
-interpolation = 'nearest'.
-
-Interpolation = 'none' and interpolation = 'nearest' are equivalent when
-converting a figure to an image file, such as a PNG.
-Interpolation = 'none' and interpolation = 'nearest' behave quite
-differently, however, when converting a figure to a vector graphics file,
-such as a PDF.  As shown, Interpolation = 'none' works well when a big
-image is scaled down, while interpolation = 'nearest' works well when a
-small image is blown up.
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.cbook as cbook
-
-# Load big image
-big_im_path = cbook.get_sample_data('necked_tensile_specimen.png')
-big_im = plt.imread(big_im_path)
-# Define small image
-small_im = np.array([[0.25, 0.75, 1.0, 0.75], [0.1, 0.65, 0.5, 0.4],
-                     [0.6, 0.3, 0.0, 0.2], [0.7, 0.9, 0.4, 0.6]])
-
-# Create a 2x2 table of plots
-fig, axes = plt.subplots(figsize=[8.0, 7.5], ncols=2, nrows=2)
-
-axes[0, 0].imshow(big_im, interpolation='none')
-axes[0, 1].imshow(big_im, interpolation='nearest')
-axes[1, 0].imshow(small_im, interpolation='none')
-axes[1, 1].imshow(small_im, interpolation='nearest')
-fig.subplots_adjust(left=0.24, wspace=0.2, hspace=0.1,
-                    bottom=0.05, top=0.86)
-
-# Label the rows and columns of the table
-fig.text(0.03, 0.645, 'Big Image\nScaled Down', ha='left')
-fig.text(0.03, 0.225, 'Small Image\nBlown Up', ha='left')
-fig.text(0.383, 0.90, "Interpolation = 'none'", ha='center')
-fig.text(0.75, 0.90, "Interpolation = 'nearest'", ha='center')
-
-# If you were going to run this example on your local machine, you
-# would save the figure as a PNG, save the same figure as a PDF, and
-# then compare them.  The following code would suffice.
-txt = fig.text(0.452, 0.95, 'Saved as a PNG', fontsize=18)
-# plt.savefig('None_vs_nearest-png.png')
-# txt.set_text('Saved as a PDF')
-# plt.savefig('None_vs_nearest-pdf.pdf')
-
-# Here, however, we need to display the PDF on a webpage, which means
-# the PDF must be converted into an image.  For the purposes of this
-# example, the 'Nearest_vs_none-pdf.pdf' has been pre-converted into
-#'Nearest_vs_none-pdf.png' at 80 dpi.  We simply need to load and
-# display it.
-# The conversion is done with:
-#  gs -dNOPAUSE -dBATCH -dDOINTERPOLATE -sDEVICE=pngalpha \
-#     -sOutputFile=None_vs_nearest-pdf.png -r80 None_vs_nearest-pdf.pdf
-pdf_im_path = cbook.get_sample_data('None_vs_nearest-pdf.png')
-pdf_im = plt.imread(pdf_im_path)
-fig2 = plt.figure(figsize=[8.0, 7.5])
-fig2.figimage(pdf_im)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/images_contours_and_fields/pcolormesh_levels.html b/examples/images_contours_and_fields/pcolormesh_levels.html deleted file mode 100644 index e3bccd571e3..00000000000 --- a/examples/images_contours_and_fields/pcolormesh_levels.html +++ /dev/null @@ -1,375 +0,0 @@ - - - - - - - - images_contours_and_fields example code: pcolormesh_levels.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

images_contours_and_fields example code: pcolormesh_levels.py

-

(Source code, png, pdf)

-
-../../_images/pcolormesh_levels.png -
-
"""
-Shows how to combine Normalization and Colormap instances to draw
-"levels" in pcolor, pcolormesh and imshow type plots in a similar
-way to the levels keyword argument to contour/contourf.
-
-"""
-
-import matplotlib.pyplot as plt
-from matplotlib.colors import BoundaryNorm
-from matplotlib.ticker import MaxNLocator
-import numpy as np
-
-
-# make these smaller to increase the resolution
-dx, dy = 0.05, 0.05
-
-# generate 2 2d grids for the x & y bounds
-y, x = np.mgrid[slice(1, 5 + dy, dy),
-                slice(1, 5 + dx, dx)]
-
-z = np.sin(x)**10 + np.cos(10 + y*x) * np.cos(x)
-
-# x and y are bounds, so z should be the value *inside* those bounds.
-# Therefore, remove the last value from the z array.
-z = z[:-1, :-1]
-levels = MaxNLocator(nbins=15).tick_values(z.min(), z.max())
-
-
-# pick the desired colormap, sensible levels, and define a normalization
-# instance which takes data values and translates those into levels.
-cmap = plt.get_cmap('PiYG')
-norm = BoundaryNorm(levels, ncolors=cmap.N, clip=True)
-
-fig, (ax0, ax1) = plt.subplots(nrows=2)
-
-im = ax0.pcolormesh(x, y, z, cmap=cmap, norm=norm)
-fig.colorbar(im, ax=ax0)
-ax0.set_title('pcolormesh with levels')
-
-
-# contours are *point* based plots, so convert our bound into point
-# centers
-cf = ax1.contourf(x[:-1, :-1] + dx/2.,
-                  y[:-1, :-1] + dy/2., z, levels=levels,
-                  cmap=cmap)
-fig.colorbar(cf, ax=ax1)
-ax1.set_title('contourf with levels')
-
-# adjust spacing between subplots so `ax1` title and `ax0` tick labels
-# don't overlap
-fig.tight_layout()
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/images_contours_and_fields/streamplot_demo_features.html b/examples/images_contours_and_fields/streamplot_demo_features.html deleted file mode 100644 index 74725e1e3cc..00000000000 --- a/examples/images_contours_and_fields/streamplot_demo_features.html +++ /dev/null @@ -1,356 +0,0 @@ - - - - - - - - images_contours_and_fields example code: streamplot_demo_features.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

images_contours_and_fields example code: streamplot_demo_features.py

-

(Source code)

-
-../../_images/streamplot_demo_features_00.png -

(png, pdf)

-
-
-../../_images/streamplot_demo_features_01.png -

(png, pdf)

-
-
"""
-Demo of the `streamplot` function.
-
-A streamplot, or streamline plot, is used to display 2D vector fields. This
-example shows a few features of the stream plot function:
-
-    * Varying the color along a streamline.
-    * Varying the density of streamlines.
-    * Varying the line width along a stream line.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-Y, X = np.mgrid[-3:3:100j, -3:3:100j]
-U = -1 - X**2 + Y
-V = 1 + X - Y**2
-speed = np.sqrt(U*U + V*V)
-
-fig0, ax0 = plt.subplots()
-strm = ax0.streamplot(X, Y, U, V, color=U, linewidth=2, cmap=plt.cm.autumn)
-fig0.colorbar(strm.lines)
-
-fig1, (ax1, ax2) = plt.subplots(ncols=2)
-ax1.streamplot(X, Y, U, V, density=[0.5, 1])
-
-lw = 5*speed / speed.max()
-ax2.streamplot(X, Y, U, V, density=0.6, color='k', linewidth=lw)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/images_contours_and_fields/streamplot_demo_masking.html b/examples/images_contours_and_fields/streamplot_demo_masking.html deleted file mode 100644 index d9618dd4940..00000000000 --- a/examples/images_contours_and_fields/streamplot_demo_masking.html +++ /dev/null @@ -1,349 +0,0 @@ - - - - - - - - images_contours_and_fields example code: streamplot_demo_masking.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

images_contours_and_fields example code: streamplot_demo_masking.py

-

(Source code, png, pdf)

-
-../../_images/streamplot_demo_masking.png -
-
"""
-Demo of the streamplot function with masking.
-
-This example shows how streamlines created by the streamplot function skips
-masked regions and NaN values.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-w = 3
-Y, X = np.mgrid[-w:w:100j, -w:w:100j]
-U = -1 - X**2 + Y
-V = 1 + X - Y**2
-speed = np.sqrt(U*U + V*V)
-
-mask = np.zeros(U.shape, dtype=bool)
-mask[40:60, 40:60] = True
-U[:20, :20] = np.nan
-U = np.ma.array(U, mask=mask)
-
-fig, ax = plt.subplots()
-ax.streamplot(X, Y, U, V, color='r')
-
-ax.imshow(~mask, extent=(-w, w, -w, w), alpha=0.5,
-          interpolation='nearest', cmap=plt.cm.gray)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/images_contours_and_fields/streamplot_demo_start_points.html b/examples/images_contours_and_fields/streamplot_demo_start_points.html deleted file mode 100644 index a642fc4bb9a..00000000000 --- a/examples/images_contours_and_fields/streamplot_demo_start_points.html +++ /dev/null @@ -1,352 +0,0 @@ - - - - - - - - images_contours_and_fields example code: streamplot_demo_start_points.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

images_contours_and_fields example code: streamplot_demo_start_points.py

-

(Source code, png, pdf)

-
-../../_images/streamplot_demo_start_points.png -
-
"""
-Demo of the `streamplot` function.
-
-A streamplot, or streamline plot, is used to display 2D vector fields. This
-example shows a few features of the stream plot function:
-
-    * Varying the color along a streamline.
-    * Varying the density of streamlines.
-    * Varying the line width along a stream line.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-X, Y = (np.linspace(-3, 3, 100),
-        np.linspace(-3, 3, 100))
-
-U, V = np.mgrid[-3:3:100j, 0:0:100j]
-
-seed_points = np.array([[-2, 0, 1], [-2, 0, 1]])
-
-fig0, ax0 = plt.subplots()
-strm = ax0.streamplot(X, Y, U, V, color=U, linewidth=2,
-                      cmap=plt.cm.autumn, start_points=seed_points.T)
-fig0.colorbar(strm.lines)
-
-ax0.plot(seed_points[0], seed_points[1], 'bo')
-
-ax0.axis((-3, 3, -3, 3))
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/index.html b/examples/index.html deleted file mode 100644 index d2250d308d3..00000000000 --- a/examples/index.html +++ /dev/null @@ -1,906 +0,0 @@ - - - - - - - - Matplotlib Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-

Related Topics

- -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

Matplotlib Examples

- --- - - - - - -
Release:2.0.2
Date:May 10, 2017
-
- -
-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/lines_bars_and_markers/barh_demo.html b/examples/lines_bars_and_markers/barh_demo.html deleted file mode 100644 index d5779f2248c..00000000000 --- a/examples/lines_bars_and_markers/barh_demo.html +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - lines_bars_and_markers example code: barh_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

lines_bars_and_markers example code: barh_demo.py

-

(Source code, png, pdf)

-
-../../_images/barh_demo.png -
-
"""
-====================
-Horizontal bar chart
-====================
-
-This example showcases a simple horizontal bar chart.
-"""
-import matplotlib.pyplot as plt
-plt.rcdefaults()
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-plt.rcdefaults()
-fig, ax = plt.subplots()
-
-# Example data
-people = ('Tom', 'Dick', 'Harry', 'Slim', 'Jim')
-y_pos = np.arange(len(people))
-performance = 3 + 10 * np.random.rand(len(people))
-error = np.random.rand(len(people))
-
-ax.barh(y_pos, performance, xerr=error, align='center',
-        color='green', ecolor='black')
-ax.set_yticks(y_pos)
-ax.set_yticklabels(people)
-ax.invert_yaxis()  # labels read top-to-bottom
-ax.set_xlabel('Performance')
-ax.set_title('How fast do you want to go today?')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/lines_bars_and_markers/fill_demo.html b/examples/lines_bars_and_markers/fill_demo.html deleted file mode 100644 index b1ff5cc20e5..00000000000 --- a/examples/lines_bars_and_markers/fill_demo.html +++ /dev/null @@ -1,340 +0,0 @@ - - - - - - - - lines_bars_and_markers example code: fill_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

lines_bars_and_markers example code: fill_demo.py

-

(Source code, png, pdf)

-
-../../_images/fill_demo1.png -
-
"""
-==================
-A simple Fill plot
-==================
-
-This example showcases the most basic fill plot a user can do with matplotlib.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-x = np.linspace(0, 1, 500)
-y = np.sin(4 * np.pi * x) * np.exp(-5 * x)
-
-fig, ax = plt.subplots()
-
-ax.fill(x, y, zorder=10)
-ax.grid(True, zorder=5)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/lines_bars_and_markers/fill_demo_features.html b/examples/lines_bars_and_markers/fill_demo_features.html deleted file mode 100644 index cb0725ecee8..00000000000 --- a/examples/lines_bars_and_markers/fill_demo_features.html +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - - - lines_bars_and_markers example code: fill_demo_features.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

lines_bars_and_markers example code: fill_demo_features.py

-

(Source code, png, pdf)

-
-../../_images/fill_demo_features.png -
-
"""
-========================
-A more complex fill demo
-========================
-
-In addition to the basic fill plot, this demo shows a few optional features:
-
-    * Multiple curves with a single command.
-    * Setting the fill color.
-    * Setting the opacity (alpha value).
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-x = np.linspace(0, 2 * np.pi, 500)
-y1 = np.sin(x)
-y2 = np.sin(3 * x)
-
-fig, ax = plt.subplots()
-ax.fill(x, y1, 'b', x, y2, 'r', alpha=0.3)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/lines_bars_and_markers/index.html b/examples/lines_bars_and_markers/index.html deleted file mode 100644 index 4a4cb588302..00000000000 --- a/examples/lines_bars_and_markers/index.html +++ /dev/null @@ -1,335 +0,0 @@ - - - - - - - - lines_bars_and_markers Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

lines_bars_and_markers Examples

- --- - - - - - -
Release:2.0.2
Date:May 10, 2017
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/lines_bars_and_markers/line_demo_dash_control.html b/examples/lines_bars_and_markers/line_demo_dash_control.html deleted file mode 100644 index 10d7f931a98..00000000000 --- a/examples/lines_bars_and_markers/line_demo_dash_control.html +++ /dev/null @@ -1,347 +0,0 @@ - - - - - - - - lines_bars_and_markers example code: line_demo_dash_control.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

lines_bars_and_markers example code: line_demo_dash_control.py

-

(Source code, png, pdf)

-
-../../_images/line_demo_dash_control.png -
-
"""
-=======================================
-A simple plot with a custom dashed line
-=======================================
-
-A Line object's ``set_dashes`` method allows you to specify dashes with
-a series of on/off lengths (in points).
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-x = np.linspace(0, 10, 500)
-dashes = [10, 5, 100, 5]  # 10 points on, 5 off, 100 on, 5 off
-
-fig, ax = plt.subplots()
-line1, = ax.plot(x, np.sin(x), '--', linewidth=2,
-                 label='Dashes set retroactively')
-line1.set_dashes(dashes)
-
-line2, = ax.plot(x, -1 * np.sin(x), dashes=[30, 5, 10, 5],
-                 label='Dashes set proactively')
-
-ax.legend(loc='lower right')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/lines_bars_and_markers/line_styles_reference.html b/examples/lines_bars_and_markers/line_styles_reference.html deleted file mode 100644 index 07c810b1f8a..00000000000 --- a/examples/lines_bars_and_markers/line_styles_reference.html +++ /dev/null @@ -1,359 +0,0 @@ - - - - - - - - lines_bars_and_markers example code: line_styles_reference.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

lines_bars_and_markers example code: line_styles_reference.py

-

(Source code, png, pdf)

-
-../../_images/line_styles_reference.png -
-
"""
-====================
-Line-style reference
-====================
-
-Reference for line-styles included with Matplotlib.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-color = 'cornflowerblue'
-points = np.ones(5)  # Draw 5 points for each line
-text_style = dict(horizontalalignment='right', verticalalignment='center',
-                  fontsize=12, fontdict={'family': 'monospace'})
-
-
-def format_axes(ax):
-    ax.margins(0.2)
-    ax.set_axis_off()
-
-
-def nice_repr(text):
-    return repr(text).lstrip('u')
-
-
-# Plot all line styles.
-fig, ax = plt.subplots()
-
-linestyles = ['-', '--', '-.', ':']
-for y, linestyle in enumerate(linestyles):
-    ax.text(-0.1, y, nice_repr(linestyle), **text_style)
-    ax.plot(y * points, linestyle=linestyle, color=color, linewidth=3)
-    format_axes(ax)
-    ax.set_title('line styles')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/lines_bars_and_markers/linestyles.html b/examples/lines_bars_and_markers/linestyles.html deleted file mode 100644 index be33917f778..00000000000 --- a/examples/lines_bars_and_markers/linestyles.html +++ /dev/null @@ -1,374 +0,0 @@ - - - - - - - - lines_bars_and_markers example code: linestyles.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

lines_bars_and_markers example code: linestyles.py

-

(Source code, png, pdf)

-
-../../_images/linestyles.png -
-
"""
-==========
-Linestyles
-==========
-
-This examples showcases different linestyles copying those of Tikz/PGF.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-from collections import OrderedDict
-from matplotlib.transforms import blended_transform_factory
-
-linestyles = OrderedDict(
-    [('solid',               (0, ())),
-     ('loosely dotted',      (0, (1, 10))),
-     ('dotted',              (0, (1, 5))),
-     ('densely dotted',      (0, (1, 1))),
-
-     ('loosely dashed',      (0, (5, 10))),
-     ('dashed',              (0, (5, 5))),
-     ('densely dashed',      (0, (5, 1))),
-
-     ('loosely dashdotted',  (0, (3, 10, 1, 10))),
-     ('dashdotted',          (0, (3, 5, 1, 5))),
-     ('densely dashdotted',  (0, (3, 1, 1, 1))),
-
-     ('loosely dashdotdotted', (0, (3, 10, 1, 10, 1, 10))),
-     ('dashdotdotted',         (0, (3, 5, 1, 5, 1, 5))),
-     ('densely dashdotdotted', (0, (3, 1, 1, 1, 1, 1)))])
-
-
-plt.figure(figsize=(10, 6))
-ax = plt.subplot(1, 1, 1)
-
-X, Y = np.linspace(0, 100, 10), np.zeros(10)
-for i, (name, linestyle) in enumerate(linestyles.items()):
-    ax.plot(X, Y+i, linestyle=linestyle, linewidth=1.5, color='black')
-
-ax.set_ylim(-0.5, len(linestyles)-0.5)
-plt.yticks(np.arange(len(linestyles)), linestyles.keys())
-plt.xticks([])
-
-# For each line style, add a text annotation with a small offset from
-# the reference point (0 in Axes coords, y tick value in Data coords).
-reference_transform = blended_transform_factory(ax.transAxes, ax.transData)
-for i, (name, linestyle) in enumerate(linestyles.items()):
-    ax.annotate(str(linestyle), xy=(0.0, i), xycoords=reference_transform,
-                xytext=(-6, -12), textcoords='offset points', color="blue",
-                fontsize=8, ha="right", family="monospace")
-
-plt.tight_layout()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/lines_bars_and_markers/marker_fillstyle_reference.html b/examples/lines_bars_and_markers/marker_fillstyle_reference.html deleted file mode 100644 index 80dc8644c82..00000000000 --- a/examples/lines_bars_and_markers/marker_fillstyle_reference.html +++ /dev/null @@ -1,360 +0,0 @@ - - - - - - - - lines_bars_and_markers example code: marker_fillstyle_reference.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

lines_bars_and_markers example code: marker_fillstyle_reference.py

-

(Source code, png, pdf)

-
-../../_images/marker_fillstyle_reference.png -
-
"""
-=====================
-Marker filling-styles
-=====================
-
-Reference for marker fill-styles included with Matplotlib.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.lines import Line2D
-
-
-points = np.ones(5)  # Draw 3 points for each line
-text_style = dict(horizontalalignment='right', verticalalignment='center',
-                  fontsize=12, fontdict={'family': 'monospace'})
-marker_style = dict(color='cornflowerblue', linestyle=':', marker='o',
-                    markersize=15, markerfacecoloralt='gray')
-
-
-def format_axes(ax):
-    ax.margins(0.2)
-    ax.set_axis_off()
-
-
-def nice_repr(text):
-    return repr(text).lstrip('u')
-
-
-fig, ax = plt.subplots()
-
-# Plot all fill styles.
-for y, fill_style in enumerate(Line2D.fillStyles):
-    ax.text(-0.5, y, nice_repr(fill_style), **text_style)
-    ax.plot(y * points, fillstyle=fill_style, **marker_style)
-    format_axes(ax)
-    ax.set_title('fill style')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/lines_bars_and_markers/marker_reference.html b/examples/lines_bars_and_markers/marker_reference.html deleted file mode 100644 index 37c0bccd715..00000000000 --- a/examples/lines_bars_and_markers/marker_reference.html +++ /dev/null @@ -1,394 +0,0 @@ - - - - - - - - lines_bars_and_markers example code: marker_reference.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

lines_bars_and_markers example code: marker_reference.py

-

(Source code)

-
-../../_images/marker_reference_00.png -

(png, pdf)

-
-
-../../_images/marker_reference_01.png -

(png, pdf)

-
-
"""
-================================
-Filled and unfilled-marker types
-================================
-
-Reference for filled- and unfilled-marker types included with Matplotlib.
-"""
-from six import iteritems
-import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.lines import Line2D
-
-
-points = np.ones(3)  # Draw 3 points for each line
-text_style = dict(horizontalalignment='right', verticalalignment='center',
-                  fontsize=12, fontdict={'family': 'monospace'})
-marker_style = dict(linestyle=':', color='cornflowerblue', markersize=10)
-
-
-def format_axes(ax):
-    ax.margins(0.2)
-    ax.set_axis_off()
-
-
-def nice_repr(text):
-    return repr(text).lstrip('u')
-
-
-def split_list(a_list):
-    i_half = len(a_list) // 2
-    return (a_list[:i_half], a_list[i_half:])
-
-
-# Plot all un-filled markers
-# --------------------------
-
-fig, axes = plt.subplots(ncols=2)
-
-# Filter out filled markers and marker settings that do nothing.
-# We use iteritems from six to make sure that we get an iterator
-# in both python 2 and 3
-unfilled_markers = [m for m, func in iteritems(Line2D.markers)
-                    if func != 'nothing' and m not in Line2D.filled_markers]
-# Reverse-sort for pretty. We use our own sort key which is essentially
-# a python3 compatible reimplementation of python2 sort.
-unfilled_markers = sorted(unfilled_markers,
-                          key=lambda x: (str(type(x)), str(x)))[::-1]
-for ax, markers in zip(axes, split_list(unfilled_markers)):
-    for y, marker in enumerate(markers):
-        ax.text(-0.5, y, nice_repr(marker), **text_style)
-        ax.plot(y * points, marker=marker, **marker_style)
-        format_axes(ax)
-fig.suptitle('un-filled markers', fontsize=14)
-
-
-# Plot all filled markers.
-# ------------------------
-
-fig, axes = plt.subplots(ncols=2)
-for ax, markers in zip(axes, split_list(Line2D.filled_markers)):
-    for y, marker in enumerate(markers):
-        ax.text(-0.5, y, nice_repr(marker), **text_style)
-        ax.plot(y * points, marker=marker, **marker_style)
-        format_axes(ax)
-fig.suptitle('filled markers', fontsize=14)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/lines_bars_and_markers/scatter_with_legend.html b/examples/lines_bars_and_markers/scatter_with_legend.html deleted file mode 100644 index 572defc86ad..00000000000 --- a/examples/lines_bars_and_markers/scatter_with_legend.html +++ /dev/null @@ -1,338 +0,0 @@ - - - - - - - - lines_bars_and_markers example code: scatter_with_legend.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

lines_bars_and_markers example code: scatter_with_legend.py

-

(Source code, png, pdf)

-
-../../_images/scatter_with_legend.png -
-
import matplotlib.pyplot as plt
-from numpy.random import rand
-
-
-fig, ax = plt.subplots()
-for color in ['red', 'green', 'blue']:
-    n = 750
-    x, y = rand(2, n)
-    scale = 200.0 * rand(n)
-    ax.scatter(x, y, c=color, s=scale, label=color,
-               alpha=0.3, edgecolors='none')
-
-ax.legend()
-ax.grid(True)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/misc/contour_manual.html b/examples/misc/contour_manual.html deleted file mode 100644 index 64cb6fadd99..00000000000 --- a/examples/misc/contour_manual.html +++ /dev/null @@ -1,376 +0,0 @@ - - - - - - - - misc example code: contour_manual.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

misc example code: contour_manual.py

-

(Source code)

-
-../../_images/contour_manual_00.png -

(png, pdf)

-
-
-../../_images/contour_manual_01.png -

(png, pdf)

-
-
"""
-Example of displaying your own contour lines and polygons using ContourSet.
-"""
-import matplotlib.pyplot as plt
-from matplotlib.contour import ContourSet
-import matplotlib.cm as cm
-
-# Contour lines for each level are a list/tuple of polygons.
-lines0 = [[[0, 0], [0, 4]]]
-lines1 = [[[2, 0], [1, 2], [1, 3]]]
-lines2 = [[[3, 0], [3, 2]], [[3, 3], [3, 4]]]  # Note two lines.
-
-# Filled contours between two levels are also a list/tuple of polygons.
-# Points can be ordered clockwise or anticlockwise.
-filled01 = [[[0, 0], [0, 4], [1, 3], [1, 2], [2, 0]]]
-filled12 = [[[2, 0], [3, 0], [3, 2], [1, 3], [1, 2]],   # Note two polygons.
-            [[1, 4], [3, 4], [3, 3]]]
-
-
-plt.figure()
-
-# Filled contours using filled=True.
-cs = ContourSet(plt.gca(), [0, 1, 2], [filled01, filled12], filled=True, cmap=cm.bone)
-cbar = plt.colorbar(cs)
-
-# Contour lines (non-filled).
-lines = ContourSet(plt.gca(), [0, 1, 2], [lines0, lines1, lines2], cmap=cm.cool,
-                   linewidths=3)
-cbar.add_lines(lines)
-
-plt.axis([-0.5, 3.5, -0.5, 4.5])
-plt.title('User-specified contours')
-
-
-# Multiple filled contour lines can be specified in a single list of polygon
-# vertices along with a list of vertex kinds (code types) as described in the
-# Path class.  This is particularly useful for polygons with holes.
-# Here a code type of 1 is a MOVETO, and 2 is a LINETO.
-
-plt.figure()
-filled01 = [[[0, 0], [3, 0], [3, 3], [0, 3], [1, 1], [1, 2], [2, 2], [2, 1]]]
-kinds01 = [[1, 2, 2, 2, 1, 2, 2, 2]]
-cs = ContourSet(plt.gca(), [0, 1], [filled01], [kinds01], filled=True)
-cbar = plt.colorbar(cs)
-
-plt.axis([-0.5, 3.5, -0.5, 3.5])
-plt.title('User specified filled contours with holes')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/misc/contour_manual.py b/examples/misc/contour_manual.py deleted file mode 100644 index 37d06d0b17e..00000000000 --- a/examples/misc/contour_manual.py +++ /dev/null @@ -1,49 +0,0 @@ -""" -Example of displaying your own contour lines and polygons using ContourSet. -""" -import matplotlib.pyplot as plt -from matplotlib.contour import ContourSet -import matplotlib.cm as cm - -# Contour lines for each level are a list/tuple of polygons. -lines0 = [[[0, 0], [0, 4]]] -lines1 = [[[2, 0], [1, 2], [1, 3]]] -lines2 = [[[3, 0], [3, 2]], [[3, 3], [3, 4]]] # Note two lines. - -# Filled contours between two levels are also a list/tuple of polygons. -# Points can be ordered clockwise or anticlockwise. -filled01 = [[[0, 0], [0, 4], [1, 3], [1, 2], [2, 0]]] -filled12 = [[[2, 0], [3, 0], [3, 2], [1, 3], [1, 2]], # Note two polygons. - [[1, 4], [3, 4], [3, 3]]] - - -plt.figure() - -# Filled contours using filled=True. -cs = ContourSet(plt.gca(), [0, 1, 2], [filled01, filled12], filled=True, cmap=cm.bone) -cbar = plt.colorbar(cs) - -# Contour lines (non-filled). -lines = ContourSet(plt.gca(), [0, 1, 2], [lines0, lines1, lines2], cmap=cm.cool, - linewidths=3) -cbar.add_lines(lines) - -plt.axis([-0.5, 3.5, -0.5, 4.5]) -plt.title('User-specified contours') - - -# Multiple filled contour lines can be specified in a single list of polygon -# vertices along with a list of vertex kinds (code types) as described in the -# Path class. This is particularly useful for polygons with holes. -# Here a code type of 1 is a MOVETO, and 2 is a LINETO. - -plt.figure() -filled01 = [[[0, 0], [3, 0], [3, 3], [0, 3], [1, 1], [1, 2], [2, 2], [2, 1]]] -kinds01 = [[1, 2, 2, 2, 1, 2, 2, 2]] -cs = ContourSet(plt.gca(), [0, 1], [filled01], [kinds01], filled=True) -cbar = plt.colorbar(cs) - -plt.axis([-0.5, 3.5, -0.5, 3.5]) -plt.title('User specified filled contours with holes') - -plt.show() diff --git a/examples/misc/developer_commit_history.html b/examples/misc/developer_commit_history.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/misc/developer_commit_history.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/misc/font_indexing.html b/examples/misc/font_indexing.html deleted file mode 100644 index cf1c825070a..00000000000 --- a/examples/misc/font_indexing.html +++ /dev/null @@ -1,359 +0,0 @@ - - - - - - - - misc example code: font_indexing.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

misc example code: font_indexing.py

-

(Source code)

-
"""
-A little example that shows how the various indexing into the font
-tables relate to one another.  Mainly for mpl developers....
-
-"""
-from __future__ import print_function
-import matplotlib
-from matplotlib.ft2font import FT2Font, KERNING_DEFAULT, KERNING_UNFITTED, KERNING_UNSCALED
-
-
-#fname = '/usr/share/fonts/sfd/FreeSans.ttf'
-fname = matplotlib.get_data_path() + '/fonts/ttf/DejaVuSans.ttf'
-font = FT2Font(fname)
-font.set_charmap(0)
-
-codes = font.get_charmap().items()
-#dsu = [(ccode, glyphind) for ccode, glyphind in codes]
-#dsu.sort()
-#for ccode, glyphind in dsu:
-#    try: name = font.get_glyph_name(glyphind)
-#    except RuntimeError: pass
-#    else: print('% 4d % 4d %s %s' % (glyphind, ccode, hex(int(ccode)), name))
-
-
-# make a charname to charcode and glyphind dictionary
-coded = {}
-glyphd = {}
-for ccode, glyphind in codes:
-    name = font.get_glyph_name(glyphind)
-    coded[name] = ccode
-    glyphd[name] = glyphind
-
-code = coded['A']
-glyph = font.load_char(code)
-#print(glyph.bbox)
-print(glyphd['A'], glyphd['V'], coded['A'], coded['V'])
-print('AV', font.get_kerning(glyphd['A'], glyphd['V'], KERNING_DEFAULT))
-print('AV', font.get_kerning(glyphd['A'], glyphd['V'], KERNING_UNFITTED))
-print('AV', font.get_kerning(glyphd['A'], glyphd['V'], KERNING_UNSCALED))
-print('AV', font.get_kerning(glyphd['A'], glyphd['T'], KERNING_UNSCALED))
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/misc/font_indexing.py b/examples/misc/font_indexing.py deleted file mode 100644 index a680dcb385f..00000000000 --- a/examples/misc/font_indexing.py +++ /dev/null @@ -1,40 +0,0 @@ -""" -A little example that shows how the various indexing into the font -tables relate to one another. Mainly for mpl developers.... - -""" -from __future__ import print_function -import matplotlib -from matplotlib.ft2font import FT2Font, KERNING_DEFAULT, KERNING_UNFITTED, KERNING_UNSCALED - - -#fname = '/usr/share/fonts/sfd/FreeSans.ttf' -fname = matplotlib.get_data_path() + '/fonts/ttf/Vera.ttf' -font = FT2Font(fname) -font.set_charmap(0) - -codes = font.get_charmap().items() -#dsu = [(ccode, glyphind) for ccode, glyphind in codes] -#dsu.sort() -#for ccode, glyphind in dsu: -# try: name = font.get_glyph_name(glyphind) -# except RuntimeError: pass -# else: print('% 4d % 4d %s %s' % (glyphind, ccode, hex(int(ccode)), name)) - - -# make a charname to charcode and glyphind dictionary -coded = {} -glyphd = {} -for ccode, glyphind in codes: - name = font.get_glyph_name(glyphind) - coded[name] = ccode - glyphd[name] = glyphind - -code = coded['A'] -glyph = font.load_char(code) -#print(glyph.bbox) -print(glyphd['A'], glyphd['V'], coded['A'], coded['V']) -print('AV', font.get_kerning(glyphd['A'], glyphd['V'], KERNING_DEFAULT)) -print('AV', font.get_kerning(glyphd['A'], glyphd['V'], KERNING_UNFITTED)) -print('AV', font.get_kerning(glyphd['A'], glyphd['V'], KERNING_UNSCALED)) -print('AV', font.get_kerning(glyphd['A'], glyphd['T'], KERNING_UNSCALED)) diff --git a/examples/misc/ftface_props.html b/examples/misc/ftface_props.html deleted file mode 100644 index 6f836cdf500..00000000000 --- a/examples/misc/ftface_props.html +++ /dev/null @@ -1,383 +0,0 @@ - - - - - - - - misc example code: ftface_props.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

misc example code: ftface_props.py

-

(Source code)

-
from __future__ import print_function
-"""
-This is a demo script to show you how to use all the properties of an
-FT2Font object.  These describe global font properties.  For
-individual character metrics, use the Glyph object, as returned by
-load_char
-"""
-import matplotlib
-import matplotlib.ft2font as ft
-
-
-#fname = '/usr/local/share/matplotlib/VeraIt.ttf'
-fname = matplotlib.get_data_path() + '/fonts/ttf/DejaVuSans-Oblique.ttf'
-#fname = '/usr/local/share/matplotlib/cmr10.ttf'
-
-font = ft.FT2Font(fname)
-
-print('Num faces   :', font.num_faces)        # number of faces in file
-print('Num glyphs  :', font.num_glyphs)       # number of glyphs in the face
-print('Family name :', font.family_name)      # face family name
-print('Style name  :', font.style_name)       # face style name
-print('PS name     :', font.postscript_name)  # the postscript name
-print('Num fixed   :', font.num_fixed_sizes)  # number of embedded bitmap in face
-
-# the following are only available if face.scalable
-if font.scalable:
-    # the face global bounding box (xmin, ymin, xmax, ymax)
-    print('Bbox                :', font.bbox)
-    # number of font units covered by the EM
-    print('EM                  :', font.units_per_EM)
-    # the ascender in 26.6 units
-    print('Ascender            :', font.ascender)
-    # the descender in 26.6 units
-    print('Descender           :', font.descender)
-    # the height in 26.6 units
-    print('Height              :', font.height)
-    # maximum horizontal cursor advance
-    print('Max adv width       :', font.max_advance_width)
-    # same for vertical layout
-    print('Max adv height      :', font.max_advance_height)
-    # vertical position of the underline bar
-    print('Underline pos       :', font.underline_position)
-    # vertical thickness of the underline
-    print('Underline thickness :', font.underline_thickness)
-
-for style in ('Italic',
-              'Bold',
-              'Scalable',
-              'Fixed sizes',
-              'Fixed width',
-              'SFNT',
-              'Horizontal',
-              'Vertical',
-              'Kerning',
-              'Fast glyphs',
-              'Multiple masters',
-              'Glyph names',
-              'External stream'):
-    bitpos = getattr(ft, style.replace(' ', '_').upper()) - 1
-    print('%-17s:' % style, bool(font.style_flags & (1 << bitpos)))
-
-print(dir(font))
-
-print(font.get_kerning)
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/misc/ftface_props.py b/examples/misc/ftface_props.py deleted file mode 100644 index 1a821cb531e..00000000000 --- a/examples/misc/ftface_props.py +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env python - -from __future__ import print_function -""" -This is a demo script to show you how to use all the properties of an -FT2Font object. These describe global font properties. For -individual character metrices, use the Glyp object, as returned by -load_char -""" -import matplotlib -import matplotlib.ft2font as ft - - -#fname = '/usr/local/share/matplotlib/VeraIt.ttf' -fname = matplotlib.get_data_path() + '/fonts/ttf/VeraIt.ttf' -#fname = '/usr/local/share/matplotlib/cmr10.ttf' - -font = ft.FT2Font(fname) - -print('Num faces :', font.num_faces) # number of faces in file -print('Num glyphs :', font.num_glyphs) # number of glyphs in the face -print('Family name :', font.family_name) # face family name -print('Syle name :', font.style_name) # face syle name -print('PS name :', font.postscript_name) # the postscript name -print('Num fixed :', font.num_fixed_sizes) # number of embedded bitmap in face - -# the following are only available if face.scalable -if font.scalable: - # the face global bounding box (xmin, ymin, xmax, ymax) - print('Bbox :', font.bbox) - # number of font units covered by the EM - print('EM :', font.units_per_EM) - # the ascender in 26.6 units - print('Ascender :', font.ascender) - # the descender in 26.6 units - print('Descender :', font.descender) - # the height in 26.6 units - print('Height :', font.height) - # maximum horizontal cursor advance - print('Max adv width :', font.max_advance_width) - # same for vertical layout - print('Max adv height :', font.max_advance_height) - # vertical position of the underline bar - print('Underline pos :', font.underline_position) - # vertical thickness of the underline - print('Underline thickness :', font.underline_thickness) - -for style in ('Italic', - 'Bold', - 'Scalable', - 'Fixed sizes', - 'Fixed width', - 'SFNT', - 'Horizontal', - 'Vertical', - 'Kerning', - 'Fast glyphs', - 'Multiple masters', - 'Glyph names', - 'External stream'): - bitpos = getattr(ft, style.replace(' ', '_').upper()) - 1 - print('%-17s:' % style, bool(font.style_flags & (1 << bitpos))) - -print(dir(font)) - -cmap = font.get_charmap() -print(font.get_kerning) diff --git a/examples/misc/image_thumbnail.html b/examples/misc/image_thumbnail.html deleted file mode 100644 index c0351363856..00000000000 --- a/examples/misc/image_thumbnail.html +++ /dev/null @@ -1,351 +0,0 @@ - - - - - - - - misc example code: image_thumbnail.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

misc example code: image_thumbnail.py

-

[source code]

-
# -*- noplot -*-
-"""
-You can use matplotlib to generate thumbnails from existing images.
-matplotlib natively supports PNG files on the input side, and other
-image types transparently if your have PIL installed
-"""
-
-from __future__ import print_function
-# build thumbnails of all images in a directory
-import sys
-import os
-import glob
-import matplotlib.image as image
-
-
-if len(sys.argv) != 2:
-    print('Usage: python %s IMAGEDIR' % __file__)
-    raise SystemExit
-indir = sys.argv[1]
-if not os.path.isdir(indir):
-    print('Could not find input directory "%s"' % indir)
-    raise SystemExit
-
-outdir = 'thumbs'
-if not os.path.exists(outdir):
-    os.makedirs(outdir)
-
-for fname in glob.glob(os.path.join(indir, '*.png')):
-    basedir, basename = os.path.split(fname)
-    outfile = os.path.join(outdir, basename)
-    fig = image.thumbnail(fname, outfile, scale=0.15)
-    print('saved thumbnail of %s to %s' % (fname, outfile))
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/misc/image_thumbnail.py b/examples/misc/image_thumbnail.py deleted file mode 100644 index 89a87ecd563..00000000000 --- a/examples/misc/image_thumbnail.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- noplot -*- -""" -You can use matplotlib to generate thumbnails from existing images. -matplotlib natively supports PNG files on the input side, and other -image types transparently if your have PIL installed -""" - -from __future__ import print_function -# build thumbnails of all images in a directory -import sys -import os -import glob -import matplotlib.image as image - - -if len(sys.argv) != 2: - print('Usage: python %s IMAGEDIR' % __file__) - raise SystemExit -indir = sys.argv[1] -if not os.path.isdir(indir): - print('Could not find input directory "%s"' % indir) - raise SystemExit - -outdir = 'thumbs' -if not os.path.exists(outdir): - os.makedirs(outdir) - -for fname in glob.glob(os.path.join(indir, '*.png')): - basedir, basename = os.path.split(fname) - outfile = os.path.join(outdir, basename) - fig = image.thumbnail(fname, outfile, scale=0.15) - print('saved thumbnail of %s to %s' % (fname, outfile)) diff --git a/examples/misc/index.html b/examples/misc/index.html deleted file mode 100644 index e512fdb6eda..00000000000 --- a/examples/misc/index.html +++ /dev/null @@ -1,339 +0,0 @@ - - - - - - - - misc Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
- - -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/misc/longshort.html b/examples/misc/longshort.html deleted file mode 100644 index 1be3a36a16c..00000000000 --- a/examples/misc/longshort.html +++ /dev/null @@ -1,369 +0,0 @@ - - - - - - - - misc example code: longshort.py — Matplotlib 1.5.3 documentation - - - - - - - - - - - - - - - - - - -
-

Matplotlib 2.0.0rc2 is available

- -

Install the release candidate now!

- -
- - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

misc example code: longshort.py

-

[source code]

-
"""
-Illustrate the rec array utility funcitons by loading prices from a
-csv file, computing the daily returns, appending the results to the
-record arrays, joining on date
-"""
-import urllib
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.mlab as mlab
-
-# grab the price data off yahoo
-u1 = urllib.urlretrieve('http://ichart.finance.yahoo.com/table.csv?s=AAPL&d=9&e=14&f=2008&g=d&a=8&b=7&c=1984&ignore=.csv')
-u2 = urllib.urlretrieve('http://ichart.finance.yahoo.com/table.csv?s=GOOG&d=9&e=14&f=2008&g=d&a=8&b=7&c=1984&ignore=.csv')
-
-# load the CSV files into record arrays
-r1 = mlab.csv2rec(file(u1[0]))
-r2 = mlab.csv2rec(file(u2[0]))
-
-# compute the daily returns and add these columns to the arrays
-gains1 = np.zeros_like(r1.adj_close)
-gains2 = np.zeros_like(r2.adj_close)
-gains1[1:] = np.diff(r1.adj_close)/r1.adj_close[:-1]
-gains2[1:] = np.diff(r2.adj_close)/r2.adj_close[:-1]
-r1 = mlab.rec_append_fields(r1, 'gains', gains1)
-r2 = mlab.rec_append_fields(r2, 'gains', gains2)
-
-# now join them by date; the default postfixes are 1 and 2.  The
-# default jointype is inner so it will do an intersection of dates and
-# drop the dates in AAPL which occurred before GOOG started trading in
-# 2004.  r1 and r2 are reverse ordered by date since Yahoo returns
-# most recent first in the CSV files, but rec_join will sort by key so
-# r below will be properly sorted
-r = mlab.rec_join('date', r1, r2)
-
-
-# long appl, short goog
-g = r.gains1 - r.gains2
-tr = (1 + g).cumprod()  # the total return
-
-# plot the return
-fig, ax = plt.subplots()
-ax.plot(r.date, tr)
-ax.set_title('total return: long APPL, short GOOG')
-ax.grid()
-fig.autofmt_xdate()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/misc/longshort.py b/examples/misc/longshort.py deleted file mode 100644 index 56b121db2cf..00000000000 --- a/examples/misc/longshort.py +++ /dev/null @@ -1,46 +0,0 @@ -""" -Illustrate the rec array utility funcitons by loading prices from a -csv file, computing the daily returns, appending the results to the -record arrays, joining on date -""" -import urllib -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.mlab as mlab - -# grab the price data off yahoo -u1 = urllib.urlretrieve('http://ichart.finance.yahoo.com/table.csv?s=AAPL&d=9&e=14&f=2008&g=d&a=8&b=7&c=1984&ignore=.csv') -u2 = urllib.urlretrieve('http://ichart.finance.yahoo.com/table.csv?s=GOOG&d=9&e=14&f=2008&g=d&a=8&b=7&c=1984&ignore=.csv') - -# load the CSV files into record arrays -r1 = mlab.csv2rec(file(u1[0])) -r2 = mlab.csv2rec(file(u2[0])) - -# compute the daily returns and add these columns to the arrays -gains1 = np.zeros_like(r1.adj_close) -gains2 = np.zeros_like(r2.adj_close) -gains1[1:] = np.diff(r1.adj_close)/r1.adj_close[:-1] -gains2[1:] = np.diff(r2.adj_close)/r2.adj_close[:-1] -r1 = mlab.rec_append_fields(r1, 'gains', gains1) -r2 = mlab.rec_append_fields(r2, 'gains', gains2) - -# now join them by date; the default postfixes are 1 and 2. The -# default jointype is inner so it will do an intersection of dates and -# drop the dates in AAPL which occurred before GOOG started trading in -# 2004. r1 and r2 are reverse ordered by date since Yahoo returns -# most recent first in the CSV files, but rec_join will sort by key so -# r below will be properly sorted -r = mlab.rec_join('date', r1, r2) - - -# long appl, short goog -g = r.gains1 - r.gains2 -tr = (1 + g).cumprod() # the total return - -# plot the return -fig, ax = plt.subplots() -ax.plot(r.date, tr) -ax.set_title('total return: long APPL, short GOOG') -ax.grid() -fig.autofmt_xdate() -plt.show() diff --git a/examples/misc/multiprocess.html b/examples/misc/multiprocess.html deleted file mode 100644 index 0e28aeecf68..00000000000 --- a/examples/misc/multiprocess.html +++ /dev/null @@ -1,409 +0,0 @@ - - - - - - - - misc example code: multiprocess.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

misc example code: multiprocess.py

-

[source code]

-
# -*- noplot -*-
-# Demo of using multiprocessing for generating data in one process and plotting
-# in another.
-# Written by Robert Cimrman
-
-from __future__ import print_function
-import time
-from multiprocessing import Process, Pipe
-import numpy as np
-
-import matplotlib
-matplotlib.use('GtkAgg')
-import matplotlib.pyplot as plt
-import gobject
-
-
-class ProcessPlotter(object):
-    def __init__(self):
-        self.x = []
-        self.y = []
-
-    def terminate(self):
-        plt.close('all')
-
-    def poll_draw(self):
-
-        def call_back():
-            while 1:
-                if not self.pipe.poll():
-                    break
-
-                command = self.pipe.recv()
-
-                if command is None:
-                    self.terminate()
-                    return False
-
-                else:
-                    self.x.append(command[0])
-                    self.y.append(command[1])
-                    self.ax.plot(self.x, self.y, 'ro')
-
-            self.fig.canvas.draw()
-            return True
-
-        return call_back
-
-    def __call__(self, pipe):
-        print('starting plotter...')
-
-        self.pipe = pipe
-        self.fig, self.ax = plt.subplots()
-        self.gid = gobject.timeout_add(1000, self.poll_draw())
-
-        print('...done')
-        plt.show()
-
-
-class NBPlot(object):
-    def __init__(self):
-        self.plot_pipe, plotter_pipe = Pipe()
-        self.plotter = ProcessPlotter()
-        self.plot_process = Process(target=self.plotter,
-                                    args=(plotter_pipe,))
-        self.plot_process.daemon = True
-        self.plot_process.start()
-
-    def plot(self, finished=False):
-        send = self.plot_pipe.send
-        if finished:
-            send(None)
-        else:
-            data = np.random.random(2)
-            send(data)
-
-
-def main():
-    pl = NBPlot()
-    for ii in range(10):
-        pl.plot()
-        time.sleep(0.5)
-    try:
-        input = raw_input
-    except NameError:
-        pass
-    input('press Enter...')
-    pl.plot(finished=True)
-
-if __name__ == '__main__':
-    main()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/misc/multiprocess.py b/examples/misc/multiprocess.py deleted file mode 100644 index 1038d53a847..00000000000 --- a/examples/misc/multiprocess.py +++ /dev/null @@ -1,90 +0,0 @@ -# -*- noplot -*- -# Demo of using multiprocessing for generating data in one process and plotting -# in another. -# Written by Robert Cimrman - -from __future__ import print_function -import time -from multiprocessing import Process, Pipe -import numpy as np - -import matplotlib -matplotlib.use('GtkAgg') -import matplotlib.pyplot as plt -import gobject - - -class ProcessPlotter(object): - def __init__(self): - self.x = [] - self.y = [] - - def terminate(self): - plt.close('all') - - def poll_draw(self): - - def call_back(): - while 1: - if not self.pipe.poll(): - break - - command = self.pipe.recv() - - if command is None: - self.terminate() - return False - - else: - self.x.append(command[0]) - self.y.append(command[1]) - self.ax.plot(self.x, self.y, 'ro') - - self.fig.canvas.draw() - return True - - return call_back - - def __call__(self, pipe): - print('starting plotter...') - - self.pipe = pipe - self.fig, self.ax = plt.subplots() - self.gid = gobject.timeout_add(1000, self.poll_draw()) - - print('...done') - plt.show() - - -class NBPlot(object): - def __init__(self): - self.plot_pipe, plotter_pipe = Pipe() - self.plotter = ProcessPlotter() - self.plot_process = Process(target=self.plotter, - args=(plotter_pipe,)) - self.plot_process.daemon = True - self.plot_process.start() - - def plot(self, finished=False): - send = self.plot_pipe.send - if finished: - send(None) - else: - data = np.random.random(2) - send(data) - - -def main(): - pl = NBPlot() - for ii in range(10): - pl.plot() - time.sleep(0.5) - try: - input = raw_input - except NameError: - pass - input('press Enter...') - pl.plot(finished=True) - -if __name__ == '__main__': - main() diff --git a/examples/misc/rasterization_demo.html b/examples/misc/rasterization_demo.html deleted file mode 100644 index 72c3e12226f..00000000000 --- a/examples/misc/rasterization_demo.html +++ /dev/null @@ -1,372 +0,0 @@ - - - - - - - - misc example code: rasterization_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

misc example code: rasterization_demo.py

-

(Source code, png, pdf)

-
-../../_images/rasterization_demo.png -
-
import numpy as np
-import matplotlib.pyplot as plt
-
-d = np.arange(100).reshape(10, 10)
-x, y = np.meshgrid(np.arange(11), np.arange(11))
-
-theta = 0.25*np.pi
-xx = x*np.cos(theta) - y*np.sin(theta)
-yy = x*np.sin(theta) + y*np.cos(theta)
-
-fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2)
-ax1.set_aspect(1)
-ax1.pcolormesh(xx, yy, d)
-ax1.set_title("No Rasterization")
-
-ax2.set_aspect(1)
-ax2.set_title("Rasterization")
-
-m = ax2.pcolormesh(xx, yy, d)
-m.set_rasterized(True)
-
-ax3.set_aspect(1)
-ax3.pcolormesh(xx, yy, d)
-ax3.text(0.5, 0.5, "Text", alpha=0.2,
-         va="center", ha="center", size=50, transform=ax3.transAxes)
-
-ax3.set_title("No Rasterization")
-
-
-ax4.set_aspect(1)
-m = ax4.pcolormesh(xx, yy, d)
-m.set_zorder(-20)
-
-ax4.text(0.5, 0.5, "Text", alpha=0.2,
-         zorder=-15,
-         va="center", ha="center", size=50, transform=ax4.transAxes)
-
-ax4.set_rasterization_zorder(-10)
-
-ax4.set_title("Rasterization z$<-10$")
-
-
-# ax2.title.set_rasterized(True) # should display a warning
-
-plt.savefig("test_rasterization.pdf", dpi=150)
-plt.savefig("test_rasterization.eps", dpi=150)
-
-if not plt.rcParams["text.usetex"]:
-    plt.savefig("test_rasterization.svg", dpi=150)
-    # svg backend currently ignores the dpi
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/misc/rasterization_demo.py b/examples/misc/rasterization_demo.py deleted file mode 100644 index 067099c56a2..00000000000 --- a/examples/misc/rasterization_demo.py +++ /dev/null @@ -1,50 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -d = np.arange(100).reshape(10, 10) -x, y = np.meshgrid(np.arange(11), np.arange(11)) - -theta = 0.25*np.pi -xx = x*np.cos(theta) - y*np.sin(theta) -yy = x*np.sin(theta) + y*np.cos(theta) - -fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2) -ax1.set_aspect(1) -ax1.pcolormesh(xx, yy, d) -ax1.set_title("No Rasterization") - -ax2.set_aspect(1) -ax2.set_title("Rasterization") - -m = ax2.pcolormesh(xx, yy, d) -m.set_rasterized(True) - -ax3.set_aspect(1) -ax3.pcolormesh(xx, yy, d) -ax3.text(0.5, 0.5, "Text", alpha=0.2, - va="center", ha="center", size=50, transform=ax3.transAxes) - -ax3.set_title("No Rasterization") - - -ax4.set_aspect(1) -m = ax4.pcolormesh(xx, yy, d) -m.set_zorder(-20) - -ax4.text(0.5, 0.5, "Text", alpha=0.2, - zorder=-15, - va="center", ha="center", size=50, transform=ax4.transAxes) - -ax4.set_rasterization_zorder(-10) - -ax4.set_title("Rasterization z$<-10$") - - -# ax2.title.set_rasterized(True) # should display a warning - -plt.savefig("test_rasterization.pdf", dpi=150) -plt.savefig("test_rasterization.eps", dpi=150) - -if not plt.rcParams["text.usetex"]: - plt.savefig("test_rasterization.svg", dpi=150) - # svg backend currently ignores the dpi diff --git a/examples/misc/rc_traits.html b/examples/misc/rc_traits.html deleted file mode 100644 index cdd131608b0..00000000000 --- a/examples/misc/rc_traits.html +++ /dev/null @@ -1,532 +0,0 @@ - - - - - - - - misc example code: rc_traits.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

misc example code: rc_traits.py

-

[source code]

-
# -*- noplot -*-
-# Here is some example code showing how to define some representative
-# rc properties and construct a matplotlib artist using traits.
-# matplotlib does not ship with enthought.traits, so you will need to
-# install it separately.
-
-from __future__ import print_function
-
-import sys
-import os
-import re
-import traits.api as traits
-from matplotlib.cbook import is_string_like
-from matplotlib.artist import Artist
-
-doprint = True
-flexible_true_trait = traits.Trait(
-   True,
-   {'true': True, 't': True, 'yes': True, 'y': True, 'on': True, True: True,
-    'false': False, 'f': False, 'no': False, 'n': False, 'off': False, False: False
-    })
-flexible_false_trait = traits.Trait(False, flexible_true_trait)
-
-colors = {
-   'c': '#00bfbf',
-   'b': '#0000ff',
-   'g': '#008000',
-   'k': '#000000',
-   'm': '#bf00bf',
-   'r': '#ff0000',
-   'w': '#ffffff',
-   'y': '#bfbf00',
-   'gold':        '#FFD700',
-   'peachpuff':   '#FFDAB9',
-   'navajowhite': '#FFDEAD',
-   }
-
-
-def hex2color(s):
-    "Convert hex string (like html uses, eg, #efefef) to a r,g,b tuple"
-    return tuple([int(n, 16)/255.0 for n in (s[1:3], s[3:5], s[5:7])])
-
-
-class RGBA(traits.HasTraits):
-    # r,g,b,a in the range 0-1 with default color 0,0,0,1 (black)
-    r = traits.Range(0., 1., 0.)
-    g = traits.Range(0., 1., 0.)
-    b = traits.Range(0., 1., 0.)
-    a = traits.Range(0., 1., 1.)
-
-    def __init__(self, r=0., g=0., b=0., a=1.):
-        self.r = r
-        self.g = g
-        self.b = b
-        self.a = a
-
-    def __repr__(self):
-        return 'r,g,b,a = (%1.2f, %1.2f, %1.2f, %1.2f)' %\
-               (self.r, self.g, self.b, self.a)
-
-
-def tuple_to_rgba(ob, name, val):
-    tup = [float(x) for x in val]
-    if len(tup) == 3:
-        r, g, b = tup
-        return RGBA(r, g, b)
-    elif len(tup) == 4:
-        r, g, b, a = tup
-        return RGBA(r, g, b, a)
-    else:
-        raise ValueError
-tuple_to_rgba.info = 'a RGB or RGBA tuple of floats'
-
-
-def hex_to_rgba(ob, name, val):
-    rgx = re.compile('^#[0-9A-Fa-f]{6}$')
-
-    if not is_string_like(val):
-        raise TypeError
-    if rgx.match(val) is None:
-        raise ValueError
-    r, g, b = hex2color(val)
-    return RGBA(r, g, b, 1.0)
-hex_to_rgba.info = 'a hex color string'
-
-
-def colorname_to_rgba(ob, name, val):
-    hex = colors[val.lower()]
-    r, g, b = hex2color(hex)
-    return RGBA(r, g, b, 1.0)
-colorname_to_rgba.info = 'a named color'
-
-
-def float_to_rgba(ob, name, val):
-    val = float(val)
-    return RGBA(val, val, val, 1.)
-float_to_rgba.info = 'a grayscale intensity'
-
-
-Color = traits.Trait(RGBA(), float_to_rgba, colorname_to_rgba, RGBA,
-                     hex_to_rgba, tuple_to_rgba)
-
-
-def file_exists(ob, name, val):
-    fh = file(val, 'r')
-    return val
-
-linestyles = ('-', '--', '-.', ':', 'steps', 'None')
-TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN = range(4)
-linemarkers = (None, '.', ',', 'o', '^', 'v', '<', '>', 's',
-               '+', 'x', 'd', 'D', '|', '_', 'h', 'H',
-               'p', '1', '2', '3', '4',
-               TICKLEFT,
-               TICKRIGHT,
-               TICKUP,
-               TICKDOWN,
-               'None'
-               )
-
-
-class LineRC(traits.HasTraits):
-    linewidth = traits.Float(0.5)
-    linestyle = traits.Trait(*linestyles)
-    color = Color
-    marker = traits.Trait(*linemarkers)
-    markerfacecolor = Color
-    markeredgecolor = Color
-    markeredgewidth = traits.Float(0.5)
-    markersize = traits.Float(6)
-    antialiased = flexible_true_trait
-    data_clipping = flexible_false_trait
-
-
-class PatchRC(traits.HasTraits):
-    linewidth = traits.Float(1.0)
-    facecolor = Color
-    edgecolor = Color
-    antialiased = flexible_true_trait
-
-timezones = 'UTC', 'US/Central', 'ES/Eastern'  # fixme: and many more
-backends = ('GTKAgg', 'Cairo', 'GDK', 'GTK', 'Agg',
-            'GTKCairo', 'PS', 'SVG', 'Template', 'TkAgg',
-            'WX')
-
-
-class RC(traits.HasTraits):
-    backend = traits.Trait(*backends)
-    interactive = flexible_false_trait
-    toolbar = traits.Trait('toolbar2', 'classic', None)
-    timezone = traits.Trait(*timezones)
-    lines = traits.Trait(LineRC())
-    patch = traits.Trait(PatchRC())
-
-rc = RC()
-rc.lines.color = 'r'
-if doprint:
-    print('RC')
-    rc.print_traits()
-    print('RC lines')
-    rc.lines.print_traits()
-    print('RC patches')
-    rc.patch.print_traits()
-
-
-class Patch(Artist, traits.HasTraits):
-    linewidth = traits.Float(0.5)
-    facecolor = Color
-    fc = facecolor
-    edgecolor = Color
-    fill = flexible_true_trait
-
-    def __init__(self,
-                 edgecolor=None,
-                 facecolor=None,
-                 linewidth=None,
-                 antialiased=None,
-                 fill=1,
-                 **kwargs
-                 ):
-        Artist.__init__(self)
-
-        if edgecolor is None:
-            edgecolor = rc.patch.edgecolor
-        if facecolor is None:
-            facecolor = rc.patch.facecolor
-        if linewidth is None:
-            linewidth = rc.patch.linewidth
-        if antialiased is None:
-            antialiased = rc.patch.antialiased
-
-        self.edgecolor = edgecolor
-        self.facecolor = facecolor
-        self.linewidth = linewidth
-        self.antialiased = antialiased
-        self.fill = fill
-
-
-p = Patch()
-p.facecolor = '#bfbf00'
-p.edgecolor = 'gold'
-p.facecolor = (1, .5, .5, .25)
-p.facecolor = 0.25
-p.fill = 'f'
-print('p.facecolor', type(p.facecolor), p.facecolor)
-print('p.fill', type(p.fill), p.fill)
-if p.fill_:
-    print('fill')
-else:
-    print('no fill')
-if doprint:
-    print()
-    print('Patch')
-    p.print_traits()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/misc/rc_traits.py b/examples/misc/rc_traits.py deleted file mode 100644 index e5aa417f4cd..00000000000 --- a/examples/misc/rc_traits.py +++ /dev/null @@ -1,213 +0,0 @@ -# -*- noplot -*- -# Here is some example code showing how to define some representative -# rc properties and construct a matplotlib artist using traits. -# matplotlib does not ship with enthought.traits, so you will need to -# install it separately. - -from __future__ import print_function - -import sys -import os -import re -import traits.api as traits -from matplotlib.cbook import is_string_like -from matplotlib.artist import Artist - -doprint = True -flexible_true_trait = traits.Trait( - True, - {'true': True, 't': True, 'yes': True, 'y': True, 'on': True, True: True, - 'false': False, 'f': False, 'no': False, 'n': False, 'off': False, False: False - }) -flexible_false_trait = traits.Trait(False, flexible_true_trait) - -colors = { - 'c': '#00bfbf', - 'b': '#0000ff', - 'g': '#008000', - 'k': '#000000', - 'm': '#bf00bf', - 'r': '#ff0000', - 'w': '#ffffff', - 'y': '#bfbf00', - 'gold': '#FFD700', - 'peachpuff': '#FFDAB9', - 'navajowhite': '#FFDEAD', - } - - -def hex2color(s): - "Convert hex string (like html uses, eg, #efefef) to a r,g,b tuple" - return tuple([int(n, 16)/255.0 for n in (s[1:3], s[3:5], s[5:7])]) - - -class RGBA(traits.HasTraits): - # r,g,b,a in the range 0-1 with default color 0,0,0,1 (black) - r = traits.Range(0., 1., 0.) - g = traits.Range(0., 1., 0.) - b = traits.Range(0., 1., 0.) - a = traits.Range(0., 1., 1.) - - def __init__(self, r=0., g=0., b=0., a=1.): - self.r = r - self.g = g - self.b = b - self.a = a - - def __repr__(self): - return 'r,g,b,a = (%1.2f, %1.2f, %1.2f, %1.2f)' %\ - (self.r, self.g, self.b, self.a) - - -def tuple_to_rgba(ob, name, val): - tup = [float(x) for x in val] - if len(tup) == 3: - r, g, b = tup - return RGBA(r, g, b) - elif len(tup) == 4: - r, g, b, a = tup - return RGBA(r, g, b, a) - else: - raise ValueError -tuple_to_rgba.info = 'a RGB or RGBA tuple of floats' - - -def hex_to_rgba(ob, name, val): - rgx = re.compile('^#[0-9A-Fa-f]{6}$') - - if not is_string_like(val): - raise TypeError - if rgx.match(val) is None: - raise ValueError - r, g, b = hex2color(val) - return RGBA(r, g, b, 1.0) -hex_to_rgba.info = 'a hex color string' - - -def colorname_to_rgba(ob, name, val): - hex = colors[val.lower()] - r, g, b = hex2color(hex) - return RGBA(r, g, b, 1.0) -colorname_to_rgba.info = 'a named color' - - -def float_to_rgba(ob, name, val): - val = float(val) - return RGBA(val, val, val, 1.) -float_to_rgba.info = 'a grayscale intensity' - - -Color = traits.Trait(RGBA(), float_to_rgba, colorname_to_rgba, RGBA, - hex_to_rgba, tuple_to_rgba) - - -def file_exists(ob, name, val): - fh = file(val, 'r') - return val - -linestyles = ('-', '--', '-.', ':', 'steps', 'None') -TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN = range(4) -linemarkers = (None, '.', ',', 'o', '^', 'v', '<', '>', 's', - '+', 'x', 'd', 'D', '|', '_', 'h', 'H', - 'p', '1', '2', '3', '4', - TICKLEFT, - TICKRIGHT, - TICKUP, - TICKDOWN, - 'None' - ) - - -class LineRC(traits.HasTraits): - linewidth = traits.Float(0.5) - linestyle = traits.Trait(*linestyles) - color = Color - marker = traits.Trait(*linemarkers) - markerfacecolor = Color - markeredgecolor = Color - markeredgewidth = traits.Float(0.5) - markersize = traits.Float(6) - antialiased = flexible_true_trait - data_clipping = flexible_false_trait - - -class PatchRC(traits.HasTraits): - linewidth = traits.Float(1.0) - facecolor = Color - edgecolor = Color - antialiased = flexible_true_trait - -timezones = 'UTC', 'US/Central', 'ES/Eastern' # fixme: and many more -backends = ('GTKAgg', 'Cairo', 'GDK', 'GTK', 'Agg', - 'GTKCairo', 'PS', 'SVG', 'Template', 'TkAgg', - 'WX') - - -class RC(traits.HasTraits): - backend = traits.Trait(*backends) - interactive = flexible_false_trait - toolbar = traits.Trait('toolbar2', 'classic', None) - timezone = traits.Trait(*timezones) - lines = traits.Trait(LineRC()) - patch = traits.Trait(PatchRC()) - -rc = RC() -rc.lines.color = 'r' -if doprint: - print('RC') - rc.print_traits() - print('RC lines') - rc.lines.print_traits() - print('RC patches') - rc.patch.print_traits() - - -class Patch(Artist, traits.HasTraits): - linewidth = traits.Float(0.5) - facecolor = Color - fc = facecolor - edgecolor = Color - fill = flexible_true_trait - - def __init__(self, - edgecolor=None, - facecolor=None, - linewidth=None, - antialiased=None, - fill=1, - **kwargs - ): - Artist.__init__(self) - - if edgecolor is None: - edgecolor = rc.patch.edgecolor - if facecolor is None: - facecolor = rc.patch.facecolor - if linewidth is None: - linewidth = rc.patch.linewidth - if antialiased is None: - antialiased = rc.patch.antialiased - - self.edgecolor = edgecolor - self.facecolor = facecolor - self.linewidth = linewidth - self.antialiased = antialiased - self.fill = fill - - -p = Patch() -p.facecolor = '#bfbf00' -p.edgecolor = 'gold' -p.facecolor = (1, .5, .5, .25) -p.facecolor = 0.25 -p.fill = 'f' -print('p.facecolor', type(p.facecolor), p.facecolor) -print('p.fill', type(p.fill), p.fill) -if p.fill_: - print('fill') -else: - print('no fill') -if doprint: - print() - print('Patch') - p.print_traits() diff --git a/examples/misc/rec_groupby_demo.html b/examples/misc/rec_groupby_demo.html deleted file mode 100644 index 25b09cddf69..00000000000 --- a/examples/misc/rec_groupby_demo.html +++ /dev/null @@ -1,384 +0,0 @@ - - - - - - - - misc example code: rec_groupby_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

misc example code: rec_groupby_demo.py

-

(Source code)

-
from __future__ import print_function
-import numpy as np
-import matplotlib.mlab as mlab
-import matplotlib.cbook as cbook
-
-datafile = cbook.get_sample_data('aapl.csv', asfileobj=False)
-print('loading', datafile)
-r = mlab.csv2rec(datafile)
-r.sort()
-
-
-def daily_return(prices):
-    'an array of daily returns from price array'
-    g = np.zeros_like(prices)
-    g[1:] = (prices[1:] - prices[:-1])/prices[:-1]
-    return g
-
-
-def volume_code(volume):
-    'code the continuous volume data categorically'
-    ind = np.searchsorted([1e5, 1e6, 5e6, 10e6, 1e7], volume)
-    return ind
-
-# a list of (dtype_name, summary_function, output_dtype_name).
-# rec_summarize will call on each function on the indicated recarray
-# attribute, and the result assigned to output name in the return
-# record array.
-summaryfuncs = (
-    ('date', lambda x: [thisdate.year for thisdate in x], 'years'),
-    ('date', lambda x: [thisdate.month for thisdate in x], 'months'),
-    ('date', lambda x: [thisdate.weekday() for thisdate in x], 'weekday'),
-    ('adj_close', daily_return, 'dreturn'),
-    ('volume', volume_code, 'volcode'),
-    )
-
-rsum = mlab.rec_summarize(r, summaryfuncs)
-
-# stats is a list of (dtype_name, function, output_dtype_name).
-# rec_groupby will summarize the attribute identified by the
-# dtype_name over the groups in the groupby list, and assign the
-# result to the output_dtype_name
-stats = (
-    ('dreturn', len, 'rcnt'),
-    ('dreturn', np.mean, 'rmean'),
-    ('dreturn', np.median, 'rmedian'),
-    ('dreturn', np.std, 'rsigma'),
-    )
-
-# you can summarize over a single variable, like years or months
-print('summary by years')
-ry = mlab.rec_groupby(rsum, ('years',), stats)
-print(mlab. rec2txt(ry))
-
-print('summary by months')
-rm = mlab.rec_groupby(rsum, ('months',), stats)
-print(mlab.rec2txt(rm))
-
-# or over multiple variables like years and months
-print('summary by year and month')
-rym = mlab.rec_groupby(rsum, ('years', 'months'), stats)
-print(mlab.rec2txt(rym))
-
-print('summary by volume')
-rv = mlab.rec_groupby(rsum, ('volcode',), stats)
-print(mlab.rec2txt(rv))
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/misc/rec_groupby_demo.py b/examples/misc/rec_groupby_demo.py deleted file mode 100644 index 06f2a1cca16..00000000000 --- a/examples/misc/rec_groupby_demo.py +++ /dev/null @@ -1,65 +0,0 @@ -from __future__ import print_function -import numpy as np -import matplotlib.mlab as mlab -import matplotlib.cbook as cbook - -datafile = cbook.get_sample_data('aapl.csv', asfileobj=False) -print('loading', datafile) -r = mlab.csv2rec(datafile) -r.sort() - - -def daily_return(prices): - 'an array of daily returns from price array' - g = np.zeros_like(prices) - g[1:] = (prices[1:] - prices[:-1])/prices[:-1] - return g - - -def volume_code(volume): - 'code the continuous volume data categorically' - ind = np.searchsorted([1e5, 1e6, 5e6, 10e6, 1e7], volume) - return ind - -# a list of (dtype_name, summary_function, output_dtype_name). -# rec_summarize will call on each function on the indicated recarray -# attribute, and the result assigned to output name in the return -# record array. -summaryfuncs = ( - ('date', lambda x: [thisdate.year for thisdate in x], 'years'), - ('date', lambda x: [thisdate.month for thisdate in x], 'months'), - ('date', lambda x: [thisdate.weekday() for thisdate in x], 'weekday'), - ('adj_close', daily_return, 'dreturn'), - ('volume', volume_code, 'volcode'), - ) - -rsum = mlab.rec_summarize(r, summaryfuncs) - -# stats is a list of (dtype_name, function, output_dtype_name). -# rec_groupby will summarize the attribute identified by the -# dtype_name over the groups in the groupby list, and assign the -# result to the output_dtype_name -stats = ( - ('dreturn', len, 'rcnt'), - ('dreturn', np.mean, 'rmean'), - ('dreturn', np.median, 'rmedian'), - ('dreturn', np.std, 'rsigma'), - ) - -# you can summarize over a single variable, like years or months -print('summary by years') -ry = mlab.rec_groupby(rsum, ('years',), stats) -print(mlab. rec2txt(ry)) - -print('summary by months') -rm = mlab.rec_groupby(rsum, ('months',), stats) -print(mlab.rec2txt(rm)) - -# or over multiple variables like years and months -print('summary by year and month') -rym = mlab.rec_groupby(rsum, ('years', 'months'), stats) -print(mlab.rec2txt(rym)) - -print('summary by volume') -rv = mlab.rec_groupby(rsum, ('volcode',), stats) -print(mlab.rec2txt(rv)) diff --git a/examples/misc/rec_join_demo.html b/examples/misc/rec_join_demo.html deleted file mode 100644 index 9fca3a62e35..00000000000 --- a/examples/misc/rec_join_demo.html +++ /dev/null @@ -1,350 +0,0 @@ - - - - - - - - misc example code: rec_join_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

misc example code: rec_join_demo.py

-

(Source code)

-
from __future__ import print_function
-import numpy as np
-import matplotlib.mlab as mlab
-import matplotlib.cbook as cbook
-
-datafile = cbook.get_sample_data('aapl.csv', asfileobj=False)
-print('loading', datafile)
-r = mlab.csv2rec(datafile)
-
-r.sort()
-r1 = r[-10:]
-
-# Create a new array
-r2 = np.empty(12, dtype=[('date', '|O4'), ('high', np.float),
-                         ('marker', np.float)])
-r2 = r2.view(np.recarray)
-r2.date = r.date[-17:-5]
-r2.high = r.high[-17:-5]
-r2.marker = np.arange(12)
-
-print("r1:")
-print(mlab.rec2txt(r1))
-print("r2:")
-print(mlab.rec2txt(r2))
-
-defaults = {'marker': -1, 'close': np.NaN, 'low': -4444.}
-
-for s in ('inner', 'outer', 'leftouter'):
-    rec = mlab.rec_join(['date', 'high'], r1, r2,
-                        jointype=s, defaults=defaults)
-    print("\n%sjoin :\n%s" % (s, mlab.rec2txt(rec)))
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/misc/rec_join_demo.py b/examples/misc/rec_join_demo.py deleted file mode 100644 index 6d365042b35..00000000000 --- a/examples/misc/rec_join_demo.py +++ /dev/null @@ -1,31 +0,0 @@ -from __future__ import print_function -import numpy as np -import matplotlib.mlab as mlab -import matplotlib.cbook as cbook - -datafile = cbook.get_sample_data('aapl.csv', asfileobj=False) -print('loading', datafile) -r = mlab.csv2rec(datafile) - -r.sort() -r1 = r[-10:] - -# Create a new array -r2 = np.empty(12, dtype=[('date', '|O4'), ('high', np.float), - ('marker', np.float)]) -r2 = r2.view(np.recarray) -r2.date = r.date[-17:-5] -r2.high = r.high[-17:-5] -r2.marker = np.arange(12) - -print("r1:") -print(mlab.rec2txt(r1)) -print("r2:") -print(mlab.rec2txt(r2)) - -defaults = {'marker': -1, 'close': np.NaN, 'low': -4444.} - -for s in ('inner', 'outer', 'leftouter'): - rec = mlab.rec_join(['date', 'high'], r1, r2, - jointype=s, defaults=defaults) - print("\n%sjoin :\n%s" % (s, mlab.rec2txt(rec))) diff --git a/examples/misc/sample_data_demo.html b/examples/misc/sample_data_demo.html deleted file mode 100644 index 46e296e9a40..00000000000 --- a/examples/misc/sample_data_demo.html +++ /dev/null @@ -1,335 +0,0 @@ - - - - - - - - misc example code: sample_data_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

misc example code: sample_data_demo.py

-

(Source code, png, pdf)

-
-../../_images/sample_data_demo.png -
-
"""
-Grab mpl data from the ~/.matplotlib/sample_data cache if it exists, else
-fetch it from GitHub and cache it
-"""
-from __future__ import print_function
-import matplotlib.cbook as cbook
-import matplotlib.pyplot as plt
-fname = cbook.get_sample_data('ada.png', asfileobj=False)
-
-print('fname', fname)
-im = plt.imread(fname)
-plt.imshow(im)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/misc/sample_data_demo.py b/examples/misc/sample_data_demo.py deleted file mode 100644 index 1e60b1e9085..00000000000 --- a/examples/misc/sample_data_demo.py +++ /dev/null @@ -1,13 +0,0 @@ -""" -Grab mpl data from the ~/.matplotlib/sample_data cache if it exists, else -fetch it from github and cache it -""" -from __future__ import print_function -import matplotlib.cbook as cbook -import matplotlib.pyplot as plt -fname = cbook.get_sample_data('ada.png', asfileobj=False) - -print('fname', fname) -im = plt.imread(fname) -plt.imshow(im) -plt.show() diff --git a/examples/misc/svg_filter_line.html b/examples/misc/svg_filter_line.html deleted file mode 100644 index fa6f1c93aba..00000000000 --- a/examples/misc/svg_filter_line.html +++ /dev/null @@ -1,408 +0,0 @@ - - - - - - - - misc example code: svg_filter_line.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

misc example code: svg_filter_line.py

-

(Source code, png, pdf)

-
-../../_images/svg_filter_line.png -
-
"""
-Demonstrate SVG filtering effects which might be used with mpl.
-
-Note that the filtering effects are only effective if your svg renderer
-support it.
-"""
-
-from __future__ import print_function
-import matplotlib
-
-matplotlib.use("Svg")
-
-import matplotlib.pyplot as plt
-import matplotlib.transforms as mtransforms
-
-fig1 = plt.figure()
-ax = fig1.add_axes([0.1, 0.1, 0.8, 0.8])
-
-# draw lines
-l1, = ax.plot([0.1, 0.5, 0.9], [0.1, 0.9, 0.5], "bo-",
-              mec="b", lw=5, ms=10, label="Line 1")
-l2, = ax.plot([0.1, 0.5, 0.9], [0.5, 0.2, 0.7], "rs-",
-              mec="r", lw=5, ms=10, color="r", label="Line 2")
-
-
-for l in [l1, l2]:
-
-    # draw shadows with same lines with slight offset and gray colors.
-
-    xx = l.get_xdata()
-    yy = l.get_ydata()
-    shadow, = ax.plot(xx, yy)
-    shadow.update_from(l)
-
-    # adjust color
-    shadow.set_color("0.2")
-    # adjust zorder of the shadow lines so that it is drawn below the
-    # original lines
-    shadow.set_zorder(l.get_zorder() - 0.5)
-
-    # offset transform
-    ot = mtransforms.offset_copy(l.get_transform(), fig1,
-                                 x=4.0, y=-6.0, units='points')
-
-    shadow.set_transform(ot)
-
-    # set the id for a later use
-    shadow.set_gid(l.get_label() + "_shadow")
-
-
-ax.set_xlim(0., 1.)
-ax.set_ylim(0., 1.)
-
-# save the figure as a bytes string in the svg format.
-from io import BytesIO
-f = BytesIO()
-plt.savefig(f, format="svg")
-
-
-import xml.etree.cElementTree as ET
-
-# filter definition for a gaussian blur
-filter_def = """
-  <defs  xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>
-    <filter id='dropshadow' height='1.2' width='1.2'>
-      <feGaussianBlur result='blur' stdDeviation='3'/>
-    </filter>
-  </defs>
-"""
-
-
-# read in the saved svg
-tree, xmlid = ET.XMLID(f.getvalue())
-
-# insert the filter definition in the svg dom tree.
-tree.insert(0, ET.XML(filter_def))
-
-for l in [l1, l2]:
-    # pick up the svg element with given id
-    shadow = xmlid[l.get_label() + "_shadow"]
-    # apply shadow filter
-    shadow.set("filter", 'url(#dropshadow)')
-
-fn = "svg_filter_line.svg"
-print("Saving '%s'" % fn)
-ET.ElementTree(tree).write(fn)
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/misc/svg_filter_line.py b/examples/misc/svg_filter_line.py deleted file mode 100644 index 006ca04b6a8..00000000000 --- a/examples/misc/svg_filter_line.py +++ /dev/null @@ -1,86 +0,0 @@ -""" -Demonstrate SVG filtering effects which might be used with mpl. - -Note that the filtering effects are only effective if your svg rederer -support it. -""" - -from __future__ import print_function -import matplotlib - -matplotlib.use("Svg") - -import matplotlib.pyplot as plt -import matplotlib.transforms as mtransforms - -fig1 = plt.figure() -ax = fig1.add_axes([0.1, 0.1, 0.8, 0.8]) - -# draw lines -l1, = ax.plot([0.1, 0.5, 0.9], [0.1, 0.9, 0.5], "bo-", - mec="b", lw=5, ms=10, label="Line 1") -l2, = ax.plot([0.1, 0.5, 0.9], [0.5, 0.2, 0.7], "rs-", - mec="r", lw=5, ms=10, color="r", label="Line 2") - - -for l in [l1, l2]: - - # draw shadows with same lines with slight offset and gray colors. - - xx = l.get_xdata() - yy = l.get_ydata() - shadow, = ax.plot(xx, yy) - shadow.update_from(l) - - # adjust color - shadow.set_color("0.2") - # adjust zorder of the shadow lines so that it is drawn below the - # original lines - shadow.set_zorder(l.get_zorder() - 0.5) - - # offset transform - ot = mtransforms.offset_copy(l.get_transform(), fig1, - x=4.0, y=-6.0, units='points') - - shadow.set_transform(ot) - - # set the id for a later use - shadow.set_gid(l.get_label() + "_shadow") - - -ax.set_xlim(0., 1.) -ax.set_ylim(0., 1.) - -# save the figure as a bytes string in the svg format. -from io import BytesIO -f = BytesIO() -plt.savefig(f, format="svg") - - -import xml.etree.cElementTree as ET - -# filter definition for a gaussian blur -filter_def = """ - - - - - -""" - - -# read in the saved svg -tree, xmlid = ET.XMLID(f.getvalue()) - -# insert the filter definition in the svg dom tree. -tree.insert(0, ET.XML(filter_def)) - -for l in [l1, l2]: - # pick up the svg element with given id - shadow = xmlid[l.get_label() + "_shadow"] - # apply shdow filter - shadow.set("filter", 'url(#dropshadow)') - -fn = "svg_filter_line.svg" -print("Saving '%s'" % fn) -ET.ElementTree(tree).write(fn) diff --git a/examples/misc/svg_filter_pie.html b/examples/misc/svg_filter_pie.html deleted file mode 100644 index c927651c9d6..00000000000 --- a/examples/misc/svg_filter_pie.html +++ /dev/null @@ -1,417 +0,0 @@ - - - - - - - - misc example code: svg_filter_pie.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

misc example code: svg_filter_pie.py

-

(Source code, png, pdf)

-
-../../_images/svg_filter_pie.png -
-
"""
-Demonstrate SVG filtering effects which might be used with mpl.
-The pie chart drawing code is borrowed from pie_demo.py
-
-Note that the filtering effects are only effective if your svg renderer
-support it.
-"""
-
-
-import matplotlib
-matplotlib.use("Svg")
-
-import matplotlib.pyplot as plt
-from matplotlib.patches import Shadow
-
-# make a square figure and axes
-fig1 = plt.figure(1, figsize=(6, 6))
-ax = fig1.add_axes([0.1, 0.1, 0.8, 0.8])
-
-labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
-fracs = [15, 30, 45, 10]
-
-explode = (0, 0.05, 0, 0)
-
-# We want to draw the shadow for each pie but we will not use "shadow"
-# option as it does'n save the references to the shadow patches.
-pies = ax.pie(fracs, explode=explode, labels=labels, autopct='%1.1f%%')
-
-for w in pies[0]:
-    # set the id with the label.
-    w.set_gid(w.get_label())
-
-    # we don't want to draw the edge of the pie
-    w.set_ec("none")
-
-for w in pies[0]:
-    # create shadow patch
-    s = Shadow(w, -0.01, -0.01)
-    s.set_gid(w.get_gid() + "_shadow")
-    s.set_zorder(w.get_zorder() - 0.1)
-    ax.add_patch(s)
-
-
-# save
-from io import BytesIO
-f = BytesIO()
-plt.savefig(f, format="svg")
-
-import xml.etree.cElementTree as ET
-
-
-# filter definition for shadow using a gaussian blur
-# and lightening effect.
-# The lightening filter is copied from http://www.w3.org/TR/SVG/filters.html
-
-# I tested it with Inkscape and Firefox3. "Gaussian blur" is supported
-# in both, but the lightening effect only in the Inkscape. Also note
-# that, Inkscape's exporting also may not support it.
-
-filter_def = """
-  <defs  xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>
-    <filter id='dropshadow' height='1.2' width='1.2'>
-      <feGaussianBlur result='blur' stdDeviation='2'/>
-    </filter>
-
-    <filter id='MyFilter' filterUnits='objectBoundingBox' x='0' y='0' width='1' height='1'>
-      <feGaussianBlur in='SourceAlpha' stdDeviation='4%' result='blur'/>
-      <feOffset in='blur' dx='4%' dy='4%' result='offsetBlur'/>
-      <feSpecularLighting in='blur' surfaceScale='5' specularConstant='.75'
-           specularExponent='20' lighting-color='#bbbbbb' result='specOut'>
-        <fePointLight x='-5000%' y='-10000%' z='20000%'/>
-      </feSpecularLighting>
-      <feComposite in='specOut' in2='SourceAlpha' operator='in' result='specOut'/>
-      <feComposite in='SourceGraphic' in2='specOut' operator='arithmetic'
-    k1='0' k2='1' k3='1' k4='0'/>
-    </filter>
-  </defs>
-"""
-
-
-tree, xmlid = ET.XMLID(f.getvalue())
-
-# insert the filter definition in the svg dom tree.
-tree.insert(0, ET.XML(filter_def))
-
-for i, pie_name in enumerate(labels):
-    pie = xmlid[pie_name]
-    pie.set("filter", 'url(#MyFilter)')
-
-    shadow = xmlid[pie_name + "_shadow"]
-    shadow.set("filter", 'url(#dropshadow)')
-
-fn = "svg_filter_pie.svg"
-print("Saving '%s'" % fn)
-ET.ElementTree(tree).write(fn)
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/misc/svg_filter_pie.py b/examples/misc/svg_filter_pie.py deleted file mode 100644 index 61a2719fce4..00000000000 --- a/examples/misc/svg_filter_pie.py +++ /dev/null @@ -1,95 +0,0 @@ -""" -Demonstrate SVG filtering effects which might be used with mpl. -The pie chart drawing code is borrowed from pie_demo.py - -Note that the filtering effects are only effective if your svg rederer -support it. -""" - - -import matplotlib -matplotlib.use("Svg") - -import matplotlib.pyplot as plt -from matplotlib.patches import Shadow - -# make a square figure and axes -fig1 = plt.figure(1, figsize=(6, 6)) -ax = fig1.add_axes([0.1, 0.1, 0.8, 0.8]) - -labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' -fracs = [15, 30, 45, 10] - -explode = (0, 0.05, 0, 0) - -# We want to draw the shadow for each pie but we will not use "shadow" -# option as it does'n save the references to the shadow patches. -pies = ax.pie(fracs, explode=explode, labels=labels, autopct='%1.1f%%') - -for w in pies[0]: - # set the id with the label. - w.set_gid(w.get_label()) - - # we don't want to draw the edge of the pie - w.set_ec("none") - -for w in pies[0]: - # create shadow patch - s = Shadow(w, -0.01, -0.01) - s.set_gid(w.get_gid() + "_shadow") - s.set_zorder(w.get_zorder() - 0.1) - ax.add_patch(s) - - -# save -from io import BytesIO -f = BytesIO() -plt.savefig(f, format="svg") - -import xml.etree.cElementTree as ET - - -# filter definition for shadow using a gaussian blur -# and lighteneing effect. -# The lightnening filter is copied from http://www.w3.org/TR/SVG/filters.html - -# I tested it with Inkscape and Firefox3. "Gaussian blur" is supported -# in both, but the lightnening effect only in the inkscape. Also note -# that, inkscape's exporting also may not support it. - -filter_def = """ - - - - - - - - - - - - - - - -""" - - -tree, xmlid = ET.XMLID(f.getvalue()) - -# insert the filter definition in the svg dom tree. -tree.insert(0, ET.XML(filter_def)) - -for i, pie_name in enumerate(labels): - pie = xmlid[pie_name] - pie.set("filter", 'url(#MyFilter)') - - shadow = xmlid[pie_name + "_shadow"] - shadow.set("filter", 'url(#dropshadow)') - -fn = "svg_filter_pie.svg" -print("Saving '%s'" % fn) -ET.ElementTree(tree).write(fn) diff --git a/examples/misc/tight_bbox_test.html b/examples/misc/tight_bbox_test.html deleted file mode 100644 index e2fb42bce91..00000000000 --- a/examples/misc/tight_bbox_test.html +++ /dev/null @@ -1,337 +0,0 @@ - - - - - - - - misc example code: tight_bbox_test.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

misc example code: tight_bbox_test.py

-

(Source code, png, pdf)

-
-../../_images/tight_bbox_test.png -
-
from __future__ import print_function
-import matplotlib.pyplot as plt
-import numpy as np
-
-ax = plt.axes([0.1, 0.3, 0.5, 0.5])
-
-ax.pcolormesh(np.array([[1, 2], [3, 4]]))
-plt.yticks([0.5, 1.5], ["long long tick label",
-                        "tick label"])
-plt.ylabel("My y-label")
-plt.title("Check saved figures for their bboxes")
-for ext in ["png", "pdf", "svg", "svgz", "eps"]:
-    print("saving tight_bbox_test.%s" % (ext,))
-    plt.savefig("tight_bbox_test.%s" % (ext,), bbox_inches="tight")
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/misc/tight_bbox_test.py b/examples/misc/tight_bbox_test.py deleted file mode 100644 index 2e966e28666..00000000000 --- a/examples/misc/tight_bbox_test.py +++ /dev/null @@ -1,15 +0,0 @@ -from __future__ import print_function -import matplotlib.pyplot as plt -import numpy as np - -ax = plt.axes([0.1, 0.3, 0.5, 0.5]) - -ax.pcolormesh(np.array([[1, 2], [3, 4]])) -plt.yticks([0.5, 1.5], ["long long tick label", - "tick label"]) -plt.ylabel("My y-label") -plt.title("Check saved figures for their bboxes") -for ext in ["png", "pdf", "svg", "svgz", "eps"]: - print("saving tight_bbox_test.%s" % (ext,)) - plt.savefig("tight_bbox_test.%s" % (ext,), bbox_inches="tight") -plt.show() diff --git a/examples/mplot3d/2dcollections3d_demo.html b/examples/mplot3d/2dcollections3d_demo.html deleted file mode 100644 index dbf83d51ae6..00000000000 --- a/examples/mplot3d/2dcollections3d_demo.html +++ /dev/null @@ -1,368 +0,0 @@ - - - - - - - - mplot3d example code: 2dcollections3d_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: 2dcollections3d_demo.py

-

(Source code, png, pdf)

-
-../../_images/2dcollections3d_demo1.png -
-
"""
-=======================
-Plot 2D data on 3D plot
-=======================
-
-Demonstrates using ax.plot's zdir keyword to plot 2D data on
-selective axes of a 3D plot.
-"""
-
-from mpl_toolkits.mplot3d import Axes3D
-import numpy as np
-import matplotlib.pyplot as plt
-
-fig = plt.figure()
-ax = fig.gca(projection='3d')
-
-# Plot a sin curve using the x and y axes.
-x = np.linspace(0, 1, 100)
-y = np.sin(x * 2 * np.pi) / 2 + 0.5
-ax.plot(x, y, zs=0, zdir='z', label='curve in (x,y)')
-
-# Plot scatterplot data (20 2D points per colour) on the x and z axes.
-colors = ('r', 'g', 'b', 'k')
-x = np.random.sample(20*len(colors))
-y = np.random.sample(20*len(colors))
-c_list = []
-for c in colors:
-    c_list.append([c]*20)
-# By using zdir='y', the y value of these points is fixed to the zs value 0
-# and the (x,y) points are plotted on the x and z axes.
-ax.scatter(x, y, zs=0, zdir='y', c=c_list, label='points in (x,z)')
-
-# Make legend, set axes limits and labels
-ax.legend()
-ax.set_xlim(0, 1)
-ax.set_ylim(0, 1)
-ax.set_zlim(0, 1)
-ax.set_xlabel('X')
-ax.set_ylabel('Y')
-ax.set_zlabel('Z')
-
-# Customize the view angle so it's easier to see that the scatter points lie
-# on the plane y=0
-ax.view_init(elev=20., azim=-35)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/bars3d_demo.html b/examples/mplot3d/bars3d_demo.html deleted file mode 100644 index e20a5121f70..00000000000 --- a/examples/mplot3d/bars3d_demo.html +++ /dev/null @@ -1,352 +0,0 @@ - - - - - - - - mplot3d example code: bars3d_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: bars3d_demo.py

-

(Source code, png, pdf)

-
-../../_images/bars3d_demo1.png -
-
"""
-========================================
-Create 2D bar graphs in different planes
-========================================
-
-Demonstrates making a 3D plot which has 2D bar graphs projected onto
-planes y=0, y=1, etc.
-"""
-
-from mpl_toolkits.mplot3d import Axes3D
-import matplotlib.pyplot as plt
-import numpy as np
-
-fig = plt.figure()
-ax = fig.add_subplot(111, projection='3d')
-for c, z in zip(['r', 'g', 'b', 'y'], [30, 20, 10, 0]):
-    xs = np.arange(20)
-    ys = np.random.rand(20)
-
-    # You can provide either a single color or an array. To demonstrate this,
-    # the first bar of each set will be colored cyan.
-    cs = [c] * len(xs)
-    cs[0] = 'c'
-    ax.bar(xs, ys, zs=z, zdir='y', color=cs, alpha=0.8)
-
-ax.set_xlabel('X')
-ax.set_ylabel('Y')
-ax.set_zlabel('Z')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/contour3d_demo.html b/examples/mplot3d/contour3d_demo.html deleted file mode 100644 index 60b5fd9ec8e..00000000000 --- a/examples/mplot3d/contour3d_demo.html +++ /dev/null @@ -1,333 +0,0 @@ - - - - - - - - mplot3d example code: contour3d_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: contour3d_demo.py

-

(Source code, png, pdf)

-
-../../_images/contour3d_demo1.png -
-
from mpl_toolkits.mplot3d import axes3d
-import matplotlib.pyplot as plt
-from matplotlib import cm
-
-fig = plt.figure()
-ax = fig.add_subplot(111, projection='3d')
-X, Y, Z = axes3d.get_test_data(0.05)
-cset = ax.contour(X, Y, Z, cmap=cm.coolwarm)
-ax.clabel(cset, fontsize=9, inline=1)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/contour3d_demo2.html b/examples/mplot3d/contour3d_demo2.html deleted file mode 100644 index 346b0be4fa3..00000000000 --- a/examples/mplot3d/contour3d_demo2.html +++ /dev/null @@ -1,333 +0,0 @@ - - - - - - - - mplot3d example code: contour3d_demo2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: contour3d_demo2.py

-

(Source code, png, pdf)

-
-../../_images/contour3d_demo21.png -
-
from mpl_toolkits.mplot3d import axes3d
-import matplotlib.pyplot as plt
-from matplotlib import cm
-
-fig = plt.figure()
-ax = fig.gca(projection='3d')
-X, Y, Z = axes3d.get_test_data(0.05)
-cset = ax.contour(X, Y, Z, extend3d=True, cmap=cm.coolwarm)
-ax.clabel(cset, fontsize=9, inline=1)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/contour3d_demo3.html b/examples/mplot3d/contour3d_demo3.html deleted file mode 100644 index 89a27f65e74..00000000000 --- a/examples/mplot3d/contour3d_demo3.html +++ /dev/null @@ -1,342 +0,0 @@ - - - - - - - - mplot3d example code: contour3d_demo3.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: contour3d_demo3.py

-

(Source code, png, pdf)

-
-../../_images/contour3d_demo31.png -
-
from mpl_toolkits.mplot3d import axes3d
-import matplotlib.pyplot as plt
-from matplotlib import cm
-
-fig = plt.figure()
-ax = fig.gca(projection='3d')
-X, Y, Z = axes3d.get_test_data(0.05)
-ax.plot_surface(X, Y, Z, rstride=8, cstride=8, alpha=0.3)
-cset = ax.contour(X, Y, Z, zdir='z', offset=-100, cmap=cm.coolwarm)
-cset = ax.contour(X, Y, Z, zdir='x', offset=-40, cmap=cm.coolwarm)
-cset = ax.contour(X, Y, Z, zdir='y', offset=40, cmap=cm.coolwarm)
-
-ax.set_xlabel('X')
-ax.set_xlim(-40, 40)
-ax.set_ylabel('Y')
-ax.set_ylim(-40, 40)
-ax.set_zlabel('Z')
-ax.set_zlim(-100, 100)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/contourf3d_demo.html b/examples/mplot3d/contourf3d_demo.html deleted file mode 100644 index 16390559867..00000000000 --- a/examples/mplot3d/contourf3d_demo.html +++ /dev/null @@ -1,333 +0,0 @@ - - - - - - - - mplot3d example code: contourf3d_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: contourf3d_demo.py

-

(Source code, png, pdf)

-
-../../_images/contourf3d_demo1.png -
-
from mpl_toolkits.mplot3d import axes3d
-import matplotlib.pyplot as plt
-from matplotlib import cm
-
-fig = plt.figure()
-ax = fig.gca(projection='3d')
-X, Y, Z = axes3d.get_test_data(0.05)
-cset = ax.contourf(X, Y, Z, cmap=cm.coolwarm)
-ax.clabel(cset, fontsize=9, inline=1)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/contourf3d_demo2.html b/examples/mplot3d/contourf3d_demo2.html deleted file mode 100644 index a3c11a319f5..00000000000 --- a/examples/mplot3d/contourf3d_demo2.html +++ /dev/null @@ -1,347 +0,0 @@ - - - - - - - - mplot3d example code: contourf3d_demo2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: contourf3d_demo2.py

-

(Source code, png, pdf)

-
-../../_images/contourf3d_demo22.png -
-
"""
-.. versionadded:: 1.1.0
-   This demo depends on new features added to contourf3d.
-"""
-
-from mpl_toolkits.mplot3d import axes3d
-import matplotlib.pyplot as plt
-from matplotlib import cm
-
-fig = plt.figure()
-ax = fig.gca(projection='3d')
-X, Y, Z = axes3d.get_test_data(0.05)
-ax.plot_surface(X, Y, Z, rstride=8, cstride=8, alpha=0.3)
-cset = ax.contourf(X, Y, Z, zdir='z', offset=-100, cmap=cm.coolwarm)
-cset = ax.contourf(X, Y, Z, zdir='x', offset=-40, cmap=cm.coolwarm)
-cset = ax.contourf(X, Y, Z, zdir='y', offset=40, cmap=cm.coolwarm)
-
-ax.set_xlabel('X')
-ax.set_xlim(-40, 40)
-ax.set_ylabel('Y')
-ax.set_ylim(-40, 40)
-ax.set_zlabel('Z')
-ax.set_zlim(-100, 100)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/custom_shaded_3d_surface.html b/examples/mplot3d/custom_shaded_3d_surface.html deleted file mode 100644 index d7acec50177..00000000000 --- a/examples/mplot3d/custom_shaded_3d_surface.html +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - mplot3d example code: custom_shaded_3d_surface.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: custom_shaded_3d_surface.py

-

(Source code, png, pdf)

-
-../../_images/custom_shaded_3d_surface.png -
-
"""
-Demonstrates using custom hillshading in a 3D surface plot.
-"""
-from mpl_toolkits.mplot3d import Axes3D
-from matplotlib import cbook
-from matplotlib import cm
-from matplotlib.colors import LightSource
-import matplotlib.pyplot as plt
-import numpy as np
-
-filename = cbook.get_sample_data('jacksboro_fault_dem.npz', asfileobj=False)
-with np.load(filename) as dem:
-    z = dem['elevation']
-    nrows, ncols = z.shape
-    x = np.linspace(dem['xmin'], dem['xmax'], ncols)
-    y = np.linspace(dem['ymin'], dem['ymax'], nrows)
-    x, y = np.meshgrid(x, y)
-
-region = np.s_[5:50, 5:50]
-x, y, z = x[region], y[region], z[region]
-
-fig, ax = plt.subplots(subplot_kw=dict(projection='3d'))
-
-ls = LightSource(270, 45)
-# To use a custom hillshading mode, override the built-in shading and pass
-# in the rgb colors of the shaded surface calculated from "shade".
-rgb = ls.shade(z, cmap=cm.gist_earth, vert_exag=0.1, blend_mode='soft')
-surf = ax.plot_surface(x, y, z, rstride=1, cstride=1, facecolors=rgb,
-                       linewidth=0, antialiased=False, shade=False)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/hist3d_demo.html b/examples/mplot3d/hist3d_demo.html deleted file mode 100644 index d91e796dbf5..00000000000 --- a/examples/mplot3d/hist3d_demo.html +++ /dev/null @@ -1,356 +0,0 @@ - - - - - - - - mplot3d example code: hist3d_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: hist3d_demo.py

-

(Source code, png, pdf)

-
-../../_images/hist3d_demo.png -
-
"""
-==============================
-Create 3D histogram of 2D data
-==============================
-
-Demo of a histogram for 2 dimensional data as a bar graph in 3D.
-"""
-
-from mpl_toolkits.mplot3d import Axes3D
-import matplotlib.pyplot as plt
-import numpy as np
-
-fig = plt.figure()
-ax = fig.add_subplot(111, projection='3d')
-x, y = np.random.rand(2, 100) * 4
-hist, xedges, yedges = np.histogram2d(x, y, bins=4, range=[[0, 4], [0, 4]])
-
-# Construct arrays for the anchor positions of the 16 bars.
-# Note: np.meshgrid gives arrays in (ny, nx) so we use 'F' to flatten xpos,
-# ypos in column-major order. For numpy >= 1.7, we could instead call meshgrid
-# with indexing='ij'.
-xpos, ypos = np.meshgrid(xedges[:-1] + 0.25, yedges[:-1] + 0.25)
-xpos = xpos.flatten('F')
-ypos = ypos.flatten('F')
-zpos = np.zeros_like(xpos)
-
-# Construct arrays with the dimensions for the 16 bars.
-dx = 0.5 * np.ones_like(zpos)
-dy = dx.copy()
-dz = hist.flatten()
-
-ax.bar3d(xpos, ypos, zpos, dx, dy, dz, color='b', zsort='average')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/index.html b/examples/mplot3d/index.html deleted file mode 100644 index 5b84a707bc5..00000000000 --- a/examples/mplot3d/index.html +++ /dev/null @@ -1,357 +0,0 @@ - - - - - - - - mplot3d Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- - - - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/lines3d_demo.html b/examples/mplot3d/lines3d_demo.html deleted file mode 100644 index f91aa1aef41..00000000000 --- a/examples/mplot3d/lines3d_demo.html +++ /dev/null @@ -1,340 +0,0 @@ - - - - - - - - mplot3d example code: lines3d_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: lines3d_demo.py

-

(Source code, png, pdf)

-
-../../_images/lines3d_demo1.png -
-
import matplotlib as mpl
-from mpl_toolkits.mplot3d import Axes3D
-import numpy as np
-import matplotlib.pyplot as plt
-
-mpl.rcParams['legend.fontsize'] = 10
-
-fig = plt.figure()
-ax = fig.gca(projection='3d')
-theta = np.linspace(-4 * np.pi, 4 * np.pi, 100)
-z = np.linspace(-2, 2, 100)
-r = z**2 + 1
-x = r * np.sin(theta)
-y = r * np.cos(theta)
-ax.plot(x, y, z, label='parametric curve')
-ax.legend()
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/lorenz_attractor.html b/examples/mplot3d/lorenz_attractor.html deleted file mode 100644 index b92bd45677b..00000000000 --- a/examples/mplot3d/lorenz_attractor.html +++ /dev/null @@ -1,371 +0,0 @@ - - - - - - - - mplot3d example code: lorenz_attractor.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: lorenz_attractor.py

-

(Source code, png, pdf)

-
-../../_images/lorenz_attractor.png -
-
# Plot of the Lorenz Attractor based on Edward Lorenz's 1963 "Deterministic
-# Nonperiodic Flow" publication.
-# http://journals.ametsoc.org/doi/abs/10.1175/1520-0469%281963%29020%3C0130%3ADNF%3E2.0.CO%3B2
-#
-# Note: Because this is a simple non-linear ODE, it would be more easily
-#       done using SciPy's ode solver, but this approach depends only
-#       upon NumPy.
-
-import numpy as np
-import matplotlib.pyplot as plt
-from mpl_toolkits.mplot3d import Axes3D
-
-
-def lorenz(x, y, z, s=10, r=28, b=2.667):
-    x_dot = s*(y - x)
-    y_dot = r*x - y - x*z
-    z_dot = x*y - b*z
-    return x_dot, y_dot, z_dot
-
-
-dt = 0.01
-stepCnt = 10000
-
-# Need one more for the initial values
-xs = np.empty((stepCnt + 1,))
-ys = np.empty((stepCnt + 1,))
-zs = np.empty((stepCnt + 1,))
-
-# Setting initial values
-xs[0], ys[0], zs[0] = (0., 1., 1.05)
-
-# Stepping through "time".
-for i in range(stepCnt):
-    # Derivatives of the X, Y, Z state
-    x_dot, y_dot, z_dot = lorenz(xs[i], ys[i], zs[i])
-    xs[i + 1] = xs[i] + (x_dot * dt)
-    ys[i + 1] = ys[i] + (y_dot * dt)
-    zs[i + 1] = zs[i] + (z_dot * dt)
-
-fig = plt.figure()
-ax = fig.gca(projection='3d')
-
-ax.plot(xs, ys, zs, lw=0.5)
-ax.set_xlabel("X Axis")
-ax.set_ylabel("Y Axis")
-ax.set_zlabel("Z Axis")
-ax.set_title("Lorenz Attractor")
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/mixed_subplots_demo.html b/examples/mplot3d/mixed_subplots_demo.html deleted file mode 100644 index 1dbe1153296..00000000000 --- a/examples/mplot3d/mixed_subplots_demo.html +++ /dev/null @@ -1,371 +0,0 @@ - - - - - - - - mplot3d example code: mixed_subplots_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: mixed_subplots_demo.py

-

(Source code, png, pdf)

-
-../../_images/mixed_subplots_demo1.png -
-
"""
-Demonstrate the mixing of 2d and 3d subplots
-"""
-from mpl_toolkits.mplot3d import Axes3D
-import matplotlib.pyplot as plt
-import numpy as np
-
-
-def f(t):
-    s1 = np.cos(2*np.pi*t)
-    e1 = np.exp(-t)
-    return np.multiply(s1, e1)
-
-
-################
-# First subplot
-################
-t1 = np.arange(0.0, 5.0, 0.1)
-t2 = np.arange(0.0, 5.0, 0.02)
-t3 = np.arange(0.0, 2.0, 0.01)
-
-# Twice as tall as it is wide.
-fig = plt.figure(figsize=plt.figaspect(2.))
-fig.suptitle('A tale of 2 subplots')
-ax = fig.add_subplot(2, 1, 1)
-l = ax.plot(t1, f(t1), 'bo',
-            t2, f(t2), 'k--', markerfacecolor='green')
-ax.grid(True)
-ax.set_ylabel('Damped oscillation')
-
-
-#################
-# Second subplot
-#################
-ax = fig.add_subplot(2, 1, 2, projection='3d')
-X = np.arange(-5, 5, 0.25)
-xlen = len(X)
-Y = np.arange(-5, 5, 0.25)
-ylen = len(Y)
-X, Y = np.meshgrid(X, Y)
-R = np.sqrt(X**2 + Y**2)
-Z = np.sin(R)
-
-surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1,
-                       linewidth=0, antialiased=False)
-
-ax.set_zlim3d(-1, 1)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/offset_demo.html b/examples/mplot3d/offset_demo.html deleted file mode 100644 index 6ebd27a12d0..00000000000 --- a/examples/mplot3d/offset_demo.html +++ /dev/null @@ -1,347 +0,0 @@ - - - - - - - - mplot3d example code: offset_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: offset_demo.py

-

(Source code, png, pdf)

-
-../../_images/offset_demo.png -
-
from mpl_toolkits.mplot3d import Axes3D
-import matplotlib.pyplot as plt
-import numpy as np
-
-# This example demonstrates mplot3d's offset text display.
-# As one rotates the 3D figure, the offsets should remain oriented
-# same way as the axis label, and should also be located "away"
-# from the center of the plot.
-#
-# This demo triggers the display of the offset text for the x and
-# y axis by adding 1e5 to X and Y. Anything less would not
-# automatically trigger it.
-
-fig = plt.figure()
-ax = fig.gca(projection='3d')
-X, Y = np.mgrid[0:6*np.pi:0.25, 0:4*np.pi:0.25]
-Z = np.sqrt(np.abs(np.cos(X) + np.cos(Y)))
-
-surf = ax.plot_surface(X + 1e5, Y + 1e5, Z, cmap='autumn', cstride=2, rstride=2)
-ax.set_xlabel("X-Label")
-ax.set_ylabel("Y-Label")
-ax.set_zlabel("Z-Label")
-ax.set_zlim(0, 2)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/pathpatch3d_demo.html b/examples/mplot3d/pathpatch3d_demo.html deleted file mode 100644 index a9b3c30c6d8..00000000000 --- a/examples/mplot3d/pathpatch3d_demo.html +++ /dev/null @@ -1,383 +0,0 @@ - - - - - - - - mplot3d example code: pathpatch3d_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: pathpatch3d_demo.py

-

(Source code, png, pdf)

-
-../../_images/pathpatch3d_demo.png -
-
"""
-============================
-Draw flat objects in 3D plot
-============================
-
-Demonstrate using pathpatch_2d_to_3d to 'draw' shapes and text on a 3D plot.
-"""
-
-import matplotlib.pyplot as plt
-from matplotlib.patches import Circle, PathPatch
-# register Axes3D class with matplotlib by importing Axes3D
-from mpl_toolkits.mplot3d import Axes3D
-import mpl_toolkits.mplot3d.art3d as art3d
-from matplotlib.text import TextPath
-from matplotlib.transforms import Affine2D
-
-
-def text3d(ax, xyz, s, zdir="z", size=None, angle=0, usetex=False, **kwargs):
-
-    x, y, z = xyz
-    if zdir == "y":
-        xy1, z1 = (x, z), y
-    elif zdir == "y":
-        xy1, z1 = (y, z), x
-    else:
-        xy1, z1 = (x, y), z
-
-    text_path = TextPath((0, 0), s, size=size, usetex=usetex)
-    trans = Affine2D().rotate(angle).translate(xy1[0], xy1[1])
-
-    p1 = PathPatch(trans.transform_path(text_path), **kwargs)
-    ax.add_patch(p1)
-    art3d.pathpatch_2d_to_3d(p1, z=z1, zdir=zdir)
-
-
-fig = plt.figure()
-ax = fig.add_subplot(111, projection='3d')
-
-p = Circle((5, 5), 3)
-ax.add_patch(p)
-art3d.pathpatch_2d_to_3d(p, z=0, zdir="x")
-
-
-text3d(ax, (4, -2, 0), "X-axis", zdir="z", size=.5, usetex=False,
-       ec="none", fc="k")
-text3d(ax, (12, 4, 0), "Y-axis", zdir="z", size=.5, usetex=False,
-       angle=.5*3.14159, ec="none", fc="k")
-text3d(ax, (12, 10, 4), "Z-axis", zdir="y", size=.5, usetex=False,
-       angle=.5*3.14159, ec="none", fc="k")
-
-text3d(ax, (1, 5, 0),
-       r"$\displaystyle G_{\mu\nu} + \Lambda g_{\mu\nu} = "
-       r"\frac{8\pi G}{c^4} T_{\mu\nu}  $",
-       zdir="z", size=1, usetex=True,
-       ec="none", fc="k")
-
-ax.set_xlim3d(0, 10)
-ax.set_ylim3d(0, 10)
-ax.set_zlim3d(0, 10)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/polys3d_demo.html b/examples/mplot3d/polys3d_demo.html deleted file mode 100644 index 47f6eca748d..00000000000 --- a/examples/mplot3d/polys3d_demo.html +++ /dev/null @@ -1,367 +0,0 @@ - - - - - - - - mplot3d example code: polys3d_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: polys3d_demo.py

-

(Source code, png, pdf)

-
-../../_images/polys3d_demo1.png -
-
"""
-=============================================
-Generate polygons to fill under 3D line graph
-=============================================
-
-Demonstrate how to create polygons which fill the space under a line
-graph. In this example polygons are semi-transparent, creating a sort
-of 'jagged stained glass' effect.
-"""
-
-from mpl_toolkits.mplot3d import Axes3D
-from matplotlib.collections import PolyCollection
-import matplotlib.pyplot as plt
-from matplotlib import colors as mcolors
-import numpy as np
-
-
-fig = plt.figure()
-ax = fig.gca(projection='3d')
-
-
-def cc(arg):
-    return mcolors.to_rgba(arg, alpha=0.6)
-
-xs = np.arange(0, 10, 0.4)
-verts = []
-zs = [0.0, 1.0, 2.0, 3.0]
-for z in zs:
-    ys = np.random.rand(len(xs))
-    ys[0], ys[-1] = 0, 0
-    verts.append(list(zip(xs, ys)))
-
-poly = PolyCollection(verts, facecolors=[cc('r'), cc('g'), cc('b'),
-                                         cc('y')])
-poly.set_alpha(0.7)
-ax.add_collection3d(poly, zs=zs, zdir='y')
-
-ax.set_xlabel('X')
-ax.set_xlim3d(0, 10)
-ax.set_ylabel('Y')
-ax.set_ylim3d(-1, 4)
-ax.set_zlabel('Z')
-ax.set_zlim3d(0, 1)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/quiver3d_demo.html b/examples/mplot3d/quiver3d_demo.html deleted file mode 100644 index 762b55bf59f..00000000000 --- a/examples/mplot3d/quiver3d_demo.html +++ /dev/null @@ -1,351 +0,0 @@ - - - - - - - - mplot3d example code: quiver3d_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: quiver3d_demo.py

-

(Source code, png, pdf)

-
-../../_images/quiver3d_demo2.png -
-
'''
-==============
-3D quiver plot
-==============
-
-Demonstrates plotting directional arrows at points on a 3d meshgrid.
-'''
-
-from mpl_toolkits.mplot3d import axes3d
-import matplotlib.pyplot as plt
-import numpy as np
-
-fig = plt.figure()
-ax = fig.gca(projection='3d')
-
-# Make the grid
-x, y, z = np.meshgrid(np.arange(-0.8, 1, 0.2),
-                      np.arange(-0.8, 1, 0.2),
-                      np.arange(-0.8, 1, 0.8))
-
-# Make the direction data for the arrows
-u = np.sin(np.pi * x) * np.cos(np.pi * y) * np.cos(np.pi * z)
-v = -np.cos(np.pi * x) * np.sin(np.pi * y) * np.cos(np.pi * z)
-w = (np.sqrt(2.0 / 3.0) * np.cos(np.pi * x) * np.cos(np.pi * y) *
-     np.sin(np.pi * z))
-
-ax.quiver(x, y, z, u, v, w, length=0.1, normalize=True)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/rotate_axes3d_demo.html b/examples/mplot3d/rotate_axes3d_demo.html deleted file mode 100644 index f2187b9980a..00000000000 --- a/examples/mplot3d/rotate_axes3d_demo.html +++ /dev/null @@ -1,347 +0,0 @@ - - - - - - - - mplot3d example code: rotate_axes3d_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: rotate_axes3d_demo.py

-

(Source code, png, pdf)

-
-../../_images/rotate_axes3d_demo.png -
-
'''
-==================
-Rotating a 3D plot
-==================
-
-A very simple animation of a rotating 3D plot.
-
-See wire3d_animation_demo for another simple example of animating a 3D plot.
-'''
-
-from mpl_toolkits.mplot3d import axes3d
-import matplotlib.pyplot as plt
-
-fig = plt.figure()
-ax = fig.add_subplot(111, projection='3d')
-
-# load some test data for demonstration and plot a wireframe
-X, Y, Z = axes3d.get_test_data(0.1)
-ax.plot_wireframe(X, Y, Z, rstride=5, cstride=5)
-
-# rotate the axes and update
-for angle in range(0, 360):
-    ax.view_init(30, angle)
-    plt.draw()
-    plt.pause(.001)
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/scatter3d_demo.html b/examples/mplot3d/scatter3d_demo.html deleted file mode 100644 index 6c7a159a71b..00000000000 --- a/examples/mplot3d/scatter3d_demo.html +++ /dev/null @@ -1,360 +0,0 @@ - - - - - - - - mplot3d example code: scatter3d_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: scatter3d_demo.py

-

(Source code, png, pdf)

-
-../../_images/scatter3d_demo1.png -
-
'''
-==============
-3D scatterplot
-==============
-
-Demonstration of a basic scatterplot in 3D.
-'''
-
-from mpl_toolkits.mplot3d import Axes3D
-import matplotlib.pyplot as plt
-import numpy as np
-
-
-def randrange(n, vmin, vmax):
-    '''
-    Helper function to make an array of random numbers having shape (n, )
-    with each number distributed Uniform(vmin, vmax).
-    '''
-    return (vmax - vmin)*np.random.rand(n) + vmin
-
-fig = plt.figure()
-ax = fig.add_subplot(111, projection='3d')
-
-n = 100
-
-# For each set of style and range settings, plot n random points in the box
-# defined by x in [23, 32], y in [0, 100], z in [zlow, zhigh].
-for c, m, zlow, zhigh in [('r', 'o', -50, -25), ('b', '^', -30, -5)]:
-    xs = randrange(n, 23, 32)
-    ys = randrange(n, 0, 100)
-    zs = randrange(n, zlow, zhigh)
-    ax.scatter(xs, ys, zs, c=c, marker=m)
-
-ax.set_xlabel('X Label')
-ax.set_ylabel('Y Label')
-ax.set_zlabel('Z Label')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/subplot3d_demo.html b/examples/mplot3d/subplot3d_demo.html deleted file mode 100644 index 1311426c79a..00000000000 --- a/examples/mplot3d/subplot3d_demo.html +++ /dev/null @@ -1,367 +0,0 @@ - - - - - - - - mplot3d example code: subplot3d_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: subplot3d_demo.py

-

(Source code, png, pdf)

-
-../../_images/subplot3d_demo1.png -
-
'''
-====================
-3D plots as subplots
-====================
-
-Demonstrate including 3D plots as subplots.
-'''
-
-import matplotlib.pyplot as plt
-from mpl_toolkits.mplot3d.axes3d import Axes3D, get_test_data
-from matplotlib import cm
-import numpy as np
-
-
-# set up a figure twice as wide as it is tall
-fig = plt.figure(figsize=plt.figaspect(0.5))
-
-#===============
-#  First subplot
-#===============
-# set up the axes for the first plot
-ax = fig.add_subplot(1, 2, 1, projection='3d')
-
-# plot a 3D surface like in the example mplot3d/surface3d_demo
-X = np.arange(-5, 5, 0.25)
-Y = np.arange(-5, 5, 0.25)
-X, Y = np.meshgrid(X, Y)
-R = np.sqrt(X**2 + Y**2)
-Z = np.sin(R)
-surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.coolwarm,
-                       linewidth=0, antialiased=False)
-ax.set_zlim(-1.01, 1.01)
-fig.colorbar(surf, shrink=0.5, aspect=10)
-
-#===============
-# Second subplot
-#===============
-# set up the axes for the second plot
-ax = fig.add_subplot(1, 2, 2, projection='3d')
-
-# plot a 3D wireframe like in the example mplot3d/wire3d_demo
-X, Y, Z = get_test_data(0.05)
-ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/surface3d_demo.html b/examples/mplot3d/surface3d_demo.html deleted file mode 100644 index 2847df5c90f..00000000000 --- a/examples/mplot3d/surface3d_demo.html +++ /dev/null @@ -1,364 +0,0 @@ - - - - - - - - mplot3d example code: surface3d_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: surface3d_demo.py

-

(Source code, png, pdf)

-
-../../_images/surface3d_demo4.png -
-
'''
-======================
-3D surface (color map)
-======================
-
-Demonstrates plotting a 3D surface colored with the coolwarm color map.
-The surface is made opaque by using antialiased=False.
-
-Also demonstrates using the LinearLocator and custom formatting for the
-z axis tick labels.
-'''
-
-from mpl_toolkits.mplot3d import Axes3D
-import matplotlib.pyplot as plt
-from matplotlib import cm
-from matplotlib.ticker import LinearLocator, FormatStrFormatter
-import numpy as np
-
-
-fig = plt.figure()
-ax = fig.gca(projection='3d')
-
-# Make data.
-X = np.arange(-5, 5, 0.25)
-Y = np.arange(-5, 5, 0.25)
-X, Y = np.meshgrid(X, Y)
-R = np.sqrt(X**2 + Y**2)
-Z = np.sin(R)
-
-# Plot the surface.
-surf = ax.plot_surface(X, Y, Z, cmap=cm.coolwarm,
-                       linewidth=0, antialiased=False)
-
-# Customize the z axis.
-ax.set_zlim(-1.01, 1.01)
-ax.zaxis.set_major_locator(LinearLocator(10))
-ax.zaxis.set_major_formatter(FormatStrFormatter('%.02f'))
-
-# Add a color bar which maps values to colors.
-fig.colorbar(surf, shrink=0.5, aspect=5)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/surface3d_demo2.html b/examples/mplot3d/surface3d_demo2.html deleted file mode 100644 index b4925618368..00000000000 --- a/examples/mplot3d/surface3d_demo2.html +++ /dev/null @@ -1,349 +0,0 @@ - - - - - - - - mplot3d example code: surface3d_demo2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: surface3d_demo2.py

-

(Source code, png, pdf)

-
-../../_images/surface3d_demo21.png -
-
'''
-========================
-3D surface (solid color)
-========================
-
-Demonstrates a very basic plot of a 3D surface using a solid color.
-'''
-
-from mpl_toolkits.mplot3d import Axes3D
-import matplotlib.pyplot as plt
-import numpy as np
-
-
-fig = plt.figure()
-ax = fig.add_subplot(111, projection='3d')
-
-# Make data
-u = np.linspace(0, 2 * np.pi, 100)
-v = np.linspace(0, np.pi, 100)
-x = 10 * np.outer(np.cos(u), np.sin(v))
-y = 10 * np.outer(np.sin(u), np.sin(v))
-z = 10 * np.outer(np.ones(np.size(u)), np.cos(v))
-
-# Plot the surface
-ax.plot_surface(x, y, z, color='b')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/surface3d_demo3.html b/examples/mplot3d/surface3d_demo3.html deleted file mode 100644 index 37a8fc89b42..00000000000 --- a/examples/mplot3d/surface3d_demo3.html +++ /dev/null @@ -1,365 +0,0 @@ - - - - - - - - mplot3d example code: surface3d_demo3.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: surface3d_demo3.py

-

(Source code, png, pdf)

-
-../../_images/surface3d_demo31.png -
-
'''
-=========================
-3D surface (checkerboard)
-=========================
-
-Demonstrates plotting a 3D surface colored in a checkerboard pattern.
-'''
-
-from mpl_toolkits.mplot3d import Axes3D
-import matplotlib.pyplot as plt
-from matplotlib import cm
-from matplotlib.ticker import LinearLocator
-import numpy as np
-
-
-fig = plt.figure()
-ax = fig.gca(projection='3d')
-
-# Make data.
-X = np.arange(-5, 5, 0.25)
-xlen = len(X)
-Y = np.arange(-5, 5, 0.25)
-ylen = len(Y)
-X, Y = np.meshgrid(X, Y)
-R = np.sqrt(X**2 + Y**2)
-Z = np.sin(R)
-
-# Create an empty array of strings with the same shape as the meshgrid, and
-# populate it with two colors in a checkerboard pattern.
-colortuple = ('y', 'b')
-colors = np.empty(X.shape, dtype=str)
-for y in range(ylen):
-    for x in range(xlen):
-        colors[x, y] = colortuple[(x + y) % len(colortuple)]
-
-# Plot the surface with face colors taken from the array we made.
-surf = ax.plot_surface(X, Y, Z, facecolors=colors, linewidth=0)
-
-# Customize the z axis.
-ax.set_zlim(-1, 1)
-ax.w_zaxis.set_major_locator(LinearLocator(6))
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/surface3d_radial_demo.html b/examples/mplot3d/surface3d_radial_demo.html deleted file mode 100644 index 5265dd1c439..00000000000 --- a/examples/mplot3d/surface3d_radial_demo.html +++ /dev/null @@ -1,361 +0,0 @@ - - - - - - - - mplot3d example code: surface3d_radial_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: surface3d_radial_demo.py

-

(Source code, png, pdf)

-
-../../_images/surface3d_radial_demo.png -
-
'''
-=================================
-3D surface with polar coordinates
-=================================
-
-Demonstrates plotting a surface defined in polar coordinates.
-Uses the reversed version of the YlGnBu color map.
-Also demonstrates writing axis labels with latex math mode.
-
-Example contributed by Armin Moser.
-'''
-
-from mpl_toolkits.mplot3d import Axes3D
-from matplotlib import pyplot as plt
-import numpy as np
-
-
-fig = plt.figure()
-ax = fig.add_subplot(111, projection='3d')
-
-# Create the mesh in polar coordinates and compute corresponding Z.
-r = np.linspace(0, 1.25, 50)
-p = np.linspace(0, 2*np.pi, 50)
-R, P = np.meshgrid(r, p)
-Z = ((R**2 - 1)**2)
-
-# Express the mesh in the cartesian system.
-X, Y = R*np.cos(P), R*np.sin(P)
-
-# Plot the surface.
-ax.plot_surface(X, Y, Z, cmap=plt.cm.YlGnBu_r)
-
-# Tweak the limits and add latex math labels.
-ax.set_zlim(0, 1)
-ax.set_xlabel(r'$\phi_\mathrm{real}$')
-ax.set_ylabel(r'$\phi_\mathrm{im}$')
-ax.set_zlabel(r'$V(\phi)$')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/text3d_demo.html b/examples/mplot3d/text3d_demo.html deleted file mode 100644 index dd0791e37b7..00000000000 --- a/examples/mplot3d/text3d_demo.html +++ /dev/null @@ -1,369 +0,0 @@ - - - - - - - - mplot3d example code: text3d_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: text3d_demo.py

-

(Source code, png, pdf)

-
-../../_images/text3d_demo1.png -
-
'''
-======================
-Text annotations in 3D
-======================
-
-Demonstrates the placement of text annotations on a 3D plot.
-
-Functionality shown:
-- Using the text function with three types of 'zdir' values: None,
-  an axis name (ex. 'x'), or a direction tuple (ex. (1, 1, 0)).
-- Using the text function with the color keyword.
-- Using the text2D function to place text on a fixed position on the ax object.
-'''
-
-from mpl_toolkits.mplot3d import Axes3D
-import matplotlib.pyplot as plt
-
-
-fig = plt.figure()
-ax = fig.gca(projection='3d')
-
-# Demo 1: zdir
-zdirs = (None, 'x', 'y', 'z', (1, 1, 0), (1, 1, 1))
-xs = (1, 4, 4, 9, 4, 1)
-ys = (2, 5, 8, 10, 1, 2)
-zs = (10, 3, 8, 9, 1, 8)
-
-for zdir, x, y, z in zip(zdirs, xs, ys, zs):
-    label = '(%d, %d, %d), dir=%s' % (x, y, z, zdir)
-    ax.text(x, y, z, label, zdir)
-
-# Demo 2: color
-ax.text(9, 0, 0, "red", color='red')
-
-# Demo 3: text2D
-# Placement 0, 0 would be the bottom left, 1, 1 would be the top right.
-ax.text2D(0.05, 0.95, "2D Text", transform=ax.transAxes)
-
-# Tweaking display region and labels
-ax.set_xlim(0, 10)
-ax.set_ylim(0, 10)
-ax.set_zlim(0, 10)
-ax.set_xlabel('X axis')
-ax.set_ylabel('Y axis')
-ax.set_zlabel('Z axis')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/tricontour3d_demo.html b/examples/mplot3d/tricontour3d_demo.html deleted file mode 100644 index fc01fcc6278..00000000000 --- a/examples/mplot3d/tricontour3d_demo.html +++ /dev/null @@ -1,369 +0,0 @@ - - - - - - - - mplot3d example code: tricontour3d_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: tricontour3d_demo.py

-

(Source code, png, pdf)

-
-../../_images/tricontour3d_demo1.png -
-
"""
-==========================
-Triangular 3D contour plot
-==========================
-
-Contour plots of unstructured triangular grids.
-
-The data used is the same as in the second plot of trisurf3d_demo2.
-tricontourf3d_demo shows the filled version of this example.
-"""
-
-import matplotlib.pyplot as plt
-from mpl_toolkits.mplot3d import Axes3D
-import matplotlib.tri as tri
-import numpy as np
-
-n_angles = 48
-n_radii = 8
-min_radius = 0.25
-
-# Create the mesh in polar coordinates and compute x, y, z.
-radii = np.linspace(min_radius, 0.95, n_radii)
-angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False)
-angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1)
-angles[:, 1::2] += np.pi/n_angles
-
-x = (radii*np.cos(angles)).flatten()
-y = (radii*np.sin(angles)).flatten()
-z = (np.cos(radii)*np.cos(angles*3.0)).flatten()
-
-# Create a custom triangulation.
-triang = tri.Triangulation(x, y)
-
-# Mask off unwanted triangles.
-xmid = x[triang.triangles].mean(axis=1)
-ymid = y[triang.triangles].mean(axis=1)
-mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0)
-triang.set_mask(mask)
-
-fig = plt.figure()
-ax = fig.gca(projection='3d')
-ax.tricontour(triang, z, cmap=plt.cm.CMRmap)
-
-# Customize the view angle so it's easier to understand the plot.
-ax.view_init(elev=45.)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/tricontourf3d_demo.html b/examples/mplot3d/tricontourf3d_demo.html deleted file mode 100644 index 42c820eddb5..00000000000 --- a/examples/mplot3d/tricontourf3d_demo.html +++ /dev/null @@ -1,370 +0,0 @@ - - - - - - - - mplot3d example code: tricontourf3d_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: tricontourf3d_demo.py

-

(Source code, png, pdf)

-
-../../_images/tricontourf3d_demo.png -
-
"""
-=================================
-Triangular 3D filled contour plot
-=================================
-
-Filled contour plots of unstructured triangular grids.
-
-The data used is the same as in the second plot of trisurf3d_demo2.
-tricontour3d_demo shows the unfilled version of this example.
-"""
-
-import matplotlib.pyplot as plt
-from mpl_toolkits.mplot3d import Axes3D
-import matplotlib.tri as tri
-import numpy as np
-
-# First create the x, y, z coordinates of the points.
-n_angles = 48
-n_radii = 8
-min_radius = 0.25
-
-# Create the mesh in polar coordinates and compute x, y, z.
-radii = np.linspace(min_radius, 0.95, n_radii)
-angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False)
-angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1)
-angles[:, 1::2] += np.pi/n_angles
-
-x = (radii*np.cos(angles)).flatten()
-y = (radii*np.sin(angles)).flatten()
-z = (np.cos(radii)*np.cos(angles*3.0)).flatten()
-
-# Create a custom triangulation.
-triang = tri.Triangulation(x, y)
-
-# Mask off unwanted triangles.
-xmid = x[triang.triangles].mean(axis=1)
-ymid = y[triang.triangles].mean(axis=1)
-mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0)
-triang.set_mask(mask)
-
-fig = plt.figure()
-ax = fig.gca(projection='3d')
-ax.tricontourf(triang, z, cmap=plt.cm.CMRmap)
-
-# Customize the view angle so it's easier to understand the plot.
-ax.view_init(elev=45.)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/trisurf3d_demo.html b/examples/mplot3d/trisurf3d_demo.html deleted file mode 100644 index 43edbb965d0..00000000000 --- a/examples/mplot3d/trisurf3d_demo.html +++ /dev/null @@ -1,360 +0,0 @@ - - - - - - - - mplot3d example code: trisurf3d_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: trisurf3d_demo.py

-

(Source code, png, pdf)

-
-../../_images/trisurf3d_demo1.png -
-
'''
-======================
-Triangular 3D surfaces
-======================
-
-Plot a 3D surface with a triangular mesh.
-'''
-
-from mpl_toolkits.mplot3d import Axes3D
-import matplotlib.pyplot as plt
-import numpy as np
-
-
-n_radii = 8
-n_angles = 36
-
-# Make radii and angles spaces (radius r=0 omitted to eliminate duplication).
-radii = np.linspace(0.125, 1.0, n_radii)
-angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False)
-
-# Repeat all angles for each radius.
-angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1)
-
-# Convert polar (radii, angles) coords to cartesian (x, y) coords.
-# (0, 0) is manually added at this stage,  so there will be no duplicate
-# points in the (x, y) plane.
-x = np.append(0, (radii*np.cos(angles)).flatten())
-y = np.append(0, (radii*np.sin(angles)).flatten())
-
-# Compute z to make the pringle surface.
-z = np.sin(-x*y)
-
-fig = plt.figure()
-ax = fig.gca(projection='3d')
-
-ax.plot_trisurf(x, y, z, linewidth=0.2, antialiased=True)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/trisurf3d_demo2.html b/examples/mplot3d/trisurf3d_demo2.html deleted file mode 100644 index 3421b4f97fc..00000000000 --- a/examples/mplot3d/trisurf3d_demo2.html +++ /dev/null @@ -1,402 +0,0 @@ - - - - - - - - mplot3d example code: trisurf3d_demo2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: trisurf3d_demo2.py

-

(Source code, png, pdf)

-
-../../_images/trisurf3d_demo21.png -
-
'''
-===========================
-More triangular 3D surfaces
-===========================
-
-Two additional examples of plotting surfaces with triangular mesh.
-
-The first demonstrates use of plot_trisurf's triangles argument, and the
-second sets a Triangulation object's mask and passes the object directly
-to plot_trisurf.
-'''
-
-import numpy as np
-import matplotlib.pyplot as plt
-from mpl_toolkits.mplot3d import Axes3D
-import matplotlib.tri as mtri
-
-
-fig = plt.figure(figsize=plt.figaspect(0.5))
-
-#============
-# First plot
-#============
-
-# Make a mesh in the space of parameterisation variables u and v
-u = np.linspace(0, 2.0 * np.pi, endpoint=True, num=50)
-v = np.linspace(-0.5, 0.5, endpoint=True, num=10)
-u, v = np.meshgrid(u, v)
-u, v = u.flatten(), v.flatten()
-
-# This is the Mobius mapping, taking a u, v pair and returning an x, y, z
-# triple
-x = (1 + 0.5 * v * np.cos(u / 2.0)) * np.cos(u)
-y = (1 + 0.5 * v * np.cos(u / 2.0)) * np.sin(u)
-z = 0.5 * v * np.sin(u / 2.0)
-
-# Triangulate parameter space to determine the triangles
-tri = mtri.Triangulation(u, v)
-
-# Plot the surface.  The triangles in parameter space determine which x, y, z
-# points are connected by an edge.
-ax = fig.add_subplot(1, 2, 1, projection='3d')
-ax.plot_trisurf(x, y, z, triangles=tri.triangles, cmap=plt.cm.Spectral)
-ax.set_zlim(-1, 1)
-
-
-#============
-# Second plot
-#============
-
-# Make parameter spaces radii and angles.
-n_angles = 36
-n_radii = 8
-min_radius = 0.25
-radii = np.linspace(min_radius, 0.95, n_radii)
-
-angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False)
-angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1)
-angles[:, 1::2] += np.pi/n_angles
-
-# Map radius, angle pairs to x, y, z points.
-x = (radii*np.cos(angles)).flatten()
-y = (radii*np.sin(angles)).flatten()
-z = (np.cos(radii)*np.cos(angles*3.0)).flatten()
-
-# Create the Triangulation; no triangles so Delaunay triangulation created.
-triang = mtri.Triangulation(x, y)
-
-# Mask off unwanted triangles.
-xmid = x[triang.triangles].mean(axis=1)
-ymid = y[triang.triangles].mean(axis=1)
-mask = np.where(xmid**2 + ymid**2 < min_radius**2, 1, 0)
-triang.set_mask(mask)
-
-# Plot the surface.
-ax = fig.add_subplot(1, 2, 2, projection='3d')
-ax.plot_trisurf(triang, z, cmap=plt.cm.CMRmap)
-
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/wire3d_animation_demo.html b/examples/mplot3d/wire3d_animation_demo.html deleted file mode 100644 index b4a10d2c2bb..00000000000 --- a/examples/mplot3d/wire3d_animation_demo.html +++ /dev/null @@ -1,371 +0,0 @@ - - - - - - - - mplot3d example code: wire3d_animation_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: wire3d_animation_demo.py

-

(Source code, png, pdf)

-
-../../_images/wire3d_animation_demo.png -
-
"""
-==========================
-Rotating 3D wireframe plot
-==========================
-
-A very simple 'animation' of a 3D plot.  See also rotate_axes3d_demo.
-"""
-
-from __future__ import print_function
-
-from mpl_toolkits.mplot3d import axes3d
-import matplotlib.pyplot as plt
-import numpy as np
-import time
-
-
-def generate(X, Y, phi):
-    '''
-    Generates Z data for the points in the X, Y meshgrid and parameter phi.
-    '''
-    R = 1 - np.sqrt(X**2 + Y**2)
-    return np.cos(2 * np.pi * X + phi) * R
-
-
-fig = plt.figure()
-ax = fig.add_subplot(111, projection='3d')
-
-# Make the X, Y meshgrid.
-xs = np.linspace(-1, 1, 50)
-ys = np.linspace(-1, 1, 50)
-X, Y = np.meshgrid(xs, ys)
-
-# Set the z axis limits so they aren't recalculated each frame.
-ax.set_zlim(-1, 1)
-
-# Begin plotting.
-wframe = None
-tstart = time.time()
-for phi in np.linspace(0, 180. / np.pi, 100):
-    # If a line collection is already remove it before drawing.
-    if wframe:
-        ax.collections.remove(wframe)
-
-    # Plot the new wireframe and pause briefly before continuing.
-    Z = generate(X, Y, phi)
-    wframe = ax.plot_wireframe(X, Y, Z, rstride=2, cstride=2)
-    plt.pause(.001)
-
-print('Average FPS: %f' % (100 / (time.time() - tstart)))
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/wire3d_demo.html b/examples/mplot3d/wire3d_demo.html deleted file mode 100644 index c193761f55e..00000000000 --- a/examples/mplot3d/wire3d_demo.html +++ /dev/null @@ -1,344 +0,0 @@ - - - - - - - - mplot3d example code: wire3d_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: wire3d_demo.py

-

(Source code, png, pdf)

-
-../../_images/wire3d_demo.png -
-
'''
-=================
-3D wireframe plot
-=================
-
-A very basic demonstration of a wireframe plot.
-'''
-
-from mpl_toolkits.mplot3d import axes3d
-import matplotlib.pyplot as plt
-
-
-fig = plt.figure()
-ax = fig.add_subplot(111, projection='3d')
-
-# Grab some test data.
-X, Y, Z = axes3d.get_test_data(0.05)
-
-# Plot a basic wireframe.
-ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/mplot3d/wire3d_zero_stride.html b/examples/mplot3d/wire3d_zero_stride.html deleted file mode 100644 index 8545c757f07..00000000000 --- a/examples/mplot3d/wire3d_zero_stride.html +++ /dev/null @@ -1,350 +0,0 @@ - - - - - - - - mplot3d example code: wire3d_zero_stride.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

mplot3d example code: wire3d_zero_stride.py

-

(Source code, png, pdf)

-
-../../_images/wire3d_zero_stride.png -
-
'''
-===================================
-3D wireframe plots in one direction
-===================================
-
-Demonstrates that setting rstride or cstride to 0 causes wires to not be
-generated in the corresponding direction.
-'''
-
-from mpl_toolkits.mplot3d import axes3d
-import matplotlib.pyplot as plt
-
-
-fig, [ax1, ax2] = plt.subplots(2, 1, figsize=(8, 12), subplot_kw={'projection': '3d'})
-
-# Get the test data
-X, Y, Z = axes3d.get_test_data(0.05)
-
-# Give the first plot only wireframes of the type y = c
-ax1.plot_wireframe(X, Y, Z, rstride=10, cstride=0)
-ax1.set_title("Column (x) stride set to 0")
-
-# Give the second plot only wireframes of the type x = c
-ax2.plot_wireframe(X, Y, Z, rstride=0, cstride=10)
-ax2.set_title("Row (y) stride set to 0")
-
-plt.tight_layout()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/old_animation/animate_decay_tk_blit.html b/examples/old_animation/animate_decay_tk_blit.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/old_animation/animate_decay_tk_blit.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/old_animation/animation_blit_gtk.html b/examples/old_animation/animation_blit_gtk.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/old_animation/animation_blit_gtk.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/old_animation/animation_blit_gtk2.html b/examples/old_animation/animation_blit_gtk2.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/old_animation/animation_blit_gtk2.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/old_animation/animation_blit_qt4.html b/examples/old_animation/animation_blit_qt4.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/old_animation/animation_blit_qt4.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/old_animation/animation_blit_tk.html b/examples/old_animation/animation_blit_tk.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/old_animation/animation_blit_tk.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/old_animation/animation_blit_wx.html b/examples/old_animation/animation_blit_wx.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/old_animation/animation_blit_wx.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/old_animation/draggable_legend.html b/examples/old_animation/draggable_legend.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/old_animation/draggable_legend.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/old_animation/dynamic_collection.html b/examples/old_animation/dynamic_collection.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/old_animation/dynamic_collection.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/old_animation/dynamic_image_gtkagg.html b/examples/old_animation/dynamic_image_gtkagg.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/old_animation/dynamic_image_gtkagg.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/old_animation/dynamic_image_wxagg2.html b/examples/old_animation/dynamic_image_wxagg2.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/old_animation/dynamic_image_wxagg2.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/old_animation/gtk_timeout.html b/examples/old_animation/gtk_timeout.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/old_animation/gtk_timeout.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/old_animation/histogram_tkagg.html b/examples/old_animation/histogram_tkagg.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/old_animation/histogram_tkagg.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/old_animation/index.html b/examples/old_animation/index.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/old_animation/index.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/old_animation/movie_demo.html b/examples/old_animation/movie_demo.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/old_animation/movie_demo.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/old_animation/simple_anim_gtk.html b/examples/old_animation/simple_anim_gtk.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/old_animation/simple_anim_gtk.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/old_animation/simple_anim_tkagg.html b/examples/old_animation/simple_anim_tkagg.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/old_animation/simple_anim_tkagg.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/old_animation/simple_idle_wx.html b/examples/old_animation/simple_idle_wx.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/old_animation/simple_idle_wx.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/old_animation/simple_timer_wx.html b/examples/old_animation/simple_timer_wx.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/old_animation/simple_timer_wx.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/old_animation/strip_chart_demo.html b/examples/old_animation/strip_chart_demo.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/old_animation/strip_chart_demo.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/pie_and_polar_charts/index.html b/examples/pie_and_polar_charts/index.html deleted file mode 100644 index 40380575b74..00000000000 --- a/examples/pie_and_polar_charts/index.html +++ /dev/null @@ -1,329 +0,0 @@ - - - - - - - - pie_and_polar_charts Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pie_and_polar_charts Examples

- --- - - - - - -
Release:2.0.2
Date:May 10, 2017
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pie_and_polar_charts/pie_demo_features.html b/examples/pie_and_polar_charts/pie_demo_features.html deleted file mode 100644 index 95226808b67..00000000000 --- a/examples/pie_and_polar_charts/pie_demo_features.html +++ /dev/null @@ -1,357 +0,0 @@ - - - - - - - - pie_and_polar_charts example code: pie_demo_features.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pie_and_polar_charts example code: pie_demo_features.py

-

(Source code, png, pdf)

-
-../../_images/pie_demo_features1.png -
-
"""
-===============
-Basic pie chart
-===============
-
-Demo of a basic pie chart plus a few additional features.
-
-In addition to the basic pie chart, this demo shows a few optional features:
-
-    * slice labels
-    * auto-labeling the percentage
-    * offsetting a slice with "explode"
-    * drop-shadow
-    * custom start angle
-
-Note about the custom start angle:
-
-The default ``startangle`` is 0, which would start the "Frogs" slice on the
-positive x-axis. This example sets ``startangle = 90`` such that everything is
-rotated counter-clockwise by 90 degrees, and the frog slice starts on the
-positive y-axis.
-"""
-import matplotlib.pyplot as plt
-
-# Pie chart, where the slices will be ordered and plotted counter-clockwise:
-labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
-sizes = [15, 30, 45, 10]
-explode = (0, 0.1, 0, 0)  # only "explode" the 2nd slice (i.e. 'Hogs')
-
-fig1, ax1 = plt.subplots()
-ax1.pie(sizes, explode=explode, labels=labels, autopct='%1.1f%%',
-        shadow=True, startangle=90)
-ax1.axis('equal')  # Equal aspect ratio ensures that pie is drawn as a circle.
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pie_and_polar_charts/polar_bar_demo.html b/examples/pie_and_polar_charts/polar_bar_demo.html deleted file mode 100644 index 3f735ec4115..00000000000 --- a/examples/pie_and_polar_charts/polar_bar_demo.html +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - pie_and_polar_charts example code: polar_bar_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pie_and_polar_charts example code: polar_bar_demo.py

-

(Source code, png, pdf)

-
-../../_images/polar_bar_demo.png -
-
"""
-=======================
-Pie chart on polar axis
-=======================
-
-Demo of bar plot on a polar axis.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-# Compute pie slices
-N = 20
-theta = np.linspace(0.0, 2 * np.pi, N, endpoint=False)
-radii = 10 * np.random.rand(N)
-width = np.pi / 4 * np.random.rand(N)
-
-ax = plt.subplot(111, projection='polar')
-bars = ax.bar(theta, radii, width=width, bottom=0.0)
-
-# Use custom colors and opacity
-for r, bar in zip(radii, bars):
-    bar.set_facecolor(plt.cm.viridis(r / 10.))
-    bar.set_alpha(0.5)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pie_and_polar_charts/polar_scatter_demo.html b/examples/pie_and_polar_charts/polar_scatter_demo.html deleted file mode 100644 index 5ca1b777841..00000000000 --- a/examples/pie_and_polar_charts/polar_scatter_demo.html +++ /dev/null @@ -1,347 +0,0 @@ - - - - - - - - pie_and_polar_charts example code: polar_scatter_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pie_and_polar_charts example code: polar_scatter_demo.py

-

(Source code, png, pdf)

-
-../../_images/polar_scatter_demo.png -
-
"""
-==========================
-Scatter plot on polar axis
-==========================
-
-Demo of scatter plot on a polar axis.
-
-Size increases radially in this example and color increases with angle
-(just to verify the symbols are being scattered correctly).
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-# Compute areas and colors
-N = 150
-r = 2 * np.random.rand(N)
-theta = 2 * np.pi * np.random.rand(N)
-area = 200 * r**2
-colors = theta
-
-ax = plt.subplot(111, projection='polar')
-c = ax.scatter(theta, r, c=colors, s=area, cmap='hsv', alpha=0.75)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pngsuite/index.html b/examples/pngsuite/index.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/pngsuite/index.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/pngsuite/pngsuite.html b/examples/pngsuite/pngsuite.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/pngsuite/pngsuite.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/pylab_examples/accented_text.html b/examples/pylab_examples/accented_text.html deleted file mode 100644 index fccde93b35e..00000000000 --- a/examples/pylab_examples/accented_text.html +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - - - pylab_examples example code: accented_text.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: accented_text.py

-

(Source code, png, pdf)

-
-../../_images/accented_text.png -
-
r"""
-matplotlib supports accented characters via TeX mathtext
-
-The following accents are provided: \hat, \breve, \grave, \bar,
-\acute, \tilde, \vec, \dot, \ddot.  All of them have the same syntax,
-e.g., to make an overbar you do \bar{o} or to make an o umlaut you do
-\ddot{o}.  The shortcuts are also provided, e.g.,: \"o \'e \`e \~n \.x
-\^y
-
-"""
-import matplotlib.pyplot as plt
-
-plt.axes([0.1, 0.15, 0.8, 0.75])
-plt.plot(range(10))
-
-plt.title(r'$\ddot{o}\acute{e}\grave{e}\hat{O}\breve{i}\bar{A}\tilde{n}\vec{q}$', fontsize=20)
-# shorthand is also supported and curly's are optional
-plt.xlabel(r"""$\"o\ddot o \'e\`e\~n\.x\^y$""", fontsize=20)
-
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/agg_buffer.html b/examples/pylab_examples/agg_buffer.html deleted file mode 100644 index 48a7c2b775b..00000000000 --- a/examples/pylab_examples/agg_buffer.html +++ /dev/null @@ -1,361 +0,0 @@ - - - - - - - - pylab_examples example code: agg_buffer.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: agg_buffer.py

-

(Source code, png, pdf)

-
-../../_images/agg_buffer.png -
-
"""
-Use backend agg to access the figure canvas as an RGB string and then
-convert it to an array and pass it to Pillow for rendering.
-"""
-
-import numpy as np
-
-import matplotlib.pyplot as plt
-from matplotlib.backends.backend_agg import FigureCanvasAgg
-
-
-try:
-    from PIL import Image
-except ImportError:
-    raise SystemExit("Pillow must be installed to run this example")
-
-plt.plot([1, 2, 3])
-
-canvas = plt.get_current_fig_manager().canvas
-
-agg = canvas.switch_backends(FigureCanvasAgg)
-agg.draw()
-s = agg.tostring_rgb()
-
-# get the width and the height to resize the matrix
-l, b, w, h = agg.figure.bbox.bounds
-w, h = int(w), int(h)
-
-X = np.fromstring(s, np.uint8)
-X.shape = h, w, 3
-
-try:
-    im = Image.fromstring("RGB", (w, h), s)
-except Exception:
-    im = Image.frombytes("RGB", (w, h), s)
-
-# Uncomment this line to display the image using ImageMagick's
-# `display` tool.
-# im.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/agg_buffer_to_array.html b/examples/pylab_examples/agg_buffer_to_array.html deleted file mode 100644 index 72005f35bef..00000000000 --- a/examples/pylab_examples/agg_buffer_to_array.html +++ /dev/null @@ -1,344 +0,0 @@ - - - - - - - - pylab_examples example code: agg_buffer_to_array.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: agg_buffer_to_array.py

-

(Source code)

-
-../../_images/agg_buffer_to_array_00.png -

(png, pdf)

-
-
-../../_images/agg_buffer_to_array_01.png -

(png, pdf)

-
-
import matplotlib.pyplot as plt
-import numpy as np
-
-# make an agg figure
-fig, ax = plt.subplots()
-ax.plot([1, 2, 3])
-ax.set_title('a simple figure')
-fig.canvas.draw()
-
-# grab the pixel buffer and dump it into a numpy array
-X = np.array(fig.canvas.renderer._renderer)
-
-# now display the array X as an Axes in a new figure
-fig2 = plt.figure()
-ax2 = fig2.add_subplot(111, frameon=False)
-ax2.imshow(X)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/alignment_test.html b/examples/pylab_examples/alignment_test.html deleted file mode 100644 index c1e533901db..00000000000 --- a/examples/pylab_examples/alignment_test.html +++ /dev/null @@ -1,403 +0,0 @@ - - - - - - - - pylab_examples example code: alignment_test.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: alignment_test.py

-

(Source code, png, pdf)

-
-../../_images/alignment_test.png -
-
"""
-You can precisely layout text in data or axes (0,1) coordinates.  This
-example shows you some of the alignment and rotation specifications to
-layout text
-"""
-
-import matplotlib.pyplot as plt
-from matplotlib.lines import Line2D
-from matplotlib.patches import Rectangle
-
-# build a rectangle in axes coords
-left, width = .25, .5
-bottom, height = .25, .5
-right = left + width
-top = bottom + height
-ax = plt.gca()
-p = plt.Rectangle((left, bottom), width, height,
-              fill=False,
-              )
-p.set_transform(ax.transAxes)
-p.set_clip_on(False)
-ax.add_patch(p)
-
-
-ax.text(left, bottom, 'left top',
-        horizontalalignment='left',
-        verticalalignment='top',
-        transform=ax.transAxes)
-
-ax.text(left, bottom, 'left bottom',
-        horizontalalignment='left',
-        verticalalignment='bottom',
-        transform=ax.transAxes)
-
-ax.text(right, top, 'right bottom',
-        horizontalalignment='right',
-        verticalalignment='bottom',
-        transform=ax.transAxes)
-
-ax.text(right, top, 'right top',
-        horizontalalignment='right',
-        verticalalignment='top',
-        transform=ax.transAxes)
-
-ax.text(right, bottom, 'center top',
-        horizontalalignment='center',
-        verticalalignment='top',
-        transform=ax.transAxes)
-
-ax.text(left, 0.5*(bottom + top), 'right center',
-        horizontalalignment='right',
-        verticalalignment='center',
-        rotation='vertical',
-        transform=ax.transAxes)
-
-ax.text(left, 0.5*(bottom + top), 'left center',
-        horizontalalignment='left',
-        verticalalignment='center',
-        rotation='vertical',
-        transform=ax.transAxes)
-
-ax.text(0.5*(left + right), 0.5*(bottom + top), 'middle',
-        horizontalalignment='center',
-        verticalalignment='center',
-        transform=ax.transAxes)
-
-ax.text(right, 0.5*(bottom + top), 'centered',
-        horizontalalignment='center',
-        verticalalignment='center',
-        rotation='vertical',
-        transform=ax.transAxes)
-
-ax.text(left, top, 'rotated\nwith newlines',
-        horizontalalignment='center',
-        verticalalignment='center',
-        rotation=45,
-        transform=ax.transAxes)
-
-plt.axis('off')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/anchored_artists.html b/examples/pylab_examples/anchored_artists.html deleted file mode 100644 index d43c0670a30..00000000000 --- a/examples/pylab_examples/anchored_artists.html +++ /dev/null @@ -1,432 +0,0 @@ - - - - - - - - pylab_examples example code: anchored_artists.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: anchored_artists.py

-

(Source code, png, pdf)

-
-../../_images/anchored_artists.png -
-
from matplotlib.patches import Rectangle, Ellipse
-
-from matplotlib.offsetbox import AnchoredOffsetbox, AuxTransformBox, VPacker,\
-    TextArea, DrawingArea
-
-
-class AnchoredText(AnchoredOffsetbox):
-    def __init__(self, s, loc, pad=0.4, borderpad=0.5, prop=None, frameon=True):
-
-        self.txt = TextArea(s,
-                            minimumdescent=False)
-
-        super(AnchoredText, self).__init__(loc, pad=pad, borderpad=borderpad,
-                                           child=self.txt,
-                                           prop=prop,
-                                           frameon=frameon)
-
-
-class AnchoredSizeBar(AnchoredOffsetbox):
-    def __init__(self, transform, size, label, loc,
-                 pad=0.1, borderpad=0.1, sep=2, prop=None, frameon=True):
-        """
-        Draw a horizontal bar with the size in data coordinate of the give axes.
-        A label will be drawn underneath (center-aligned).
-
-        pad, borderpad in fraction of the legend font size (or prop)
-        sep in points.
-        """
-        self.size_bar = AuxTransformBox(transform)
-        self.size_bar.add_artist(Rectangle((0, 0), size, 0, fc="none", lw=1.0))
-
-        self.txt_label = TextArea(label, minimumdescent=False)
-
-        self._box = VPacker(children=[self.size_bar, self.txt_label],
-                            align="center",
-                            pad=0, sep=sep)
-
-        AnchoredOffsetbox.__init__(self, loc, pad=pad, borderpad=borderpad,
-                                   child=self._box,
-                                   prop=prop,
-                                   frameon=frameon)
-
-
-class AnchoredEllipse(AnchoredOffsetbox):
-    def __init__(self, transform, width, height, angle, loc,
-                 pad=0.1, borderpad=0.1, prop=None, frameon=True):
-        """
-        Draw an ellipse the size in data coordinate of the give axes.
-
-        pad, borderpad in fraction of the legend font size (or prop)
-        """
-        self._box = AuxTransformBox(transform)
-        self.ellipse = Ellipse((0, 0), width, height, angle)
-        self._box.add_artist(self.ellipse)
-
-        AnchoredOffsetbox.__init__(self, loc, pad=pad, borderpad=borderpad,
-                                   child=self._box,
-                                   prop=prop,
-                                   frameon=frameon)
-
-
-class AnchoredDrawingArea(AnchoredOffsetbox):
-    def __init__(self, width, height, xdescent, ydescent,
-                 loc, pad=0.4, borderpad=0.5, prop=None, frameon=True):
-
-        self.da = DrawingArea(width, height, xdescent, ydescent)
-
-        super(AnchoredDrawingArea, self).__init__(loc, pad=pad, borderpad=borderpad,
-                                                  child=self.da,
-                                                  prop=None,
-                                                  frameon=frameon)
-
-
-if __name__ == "__main__":
-
-    import matplotlib.pyplot as plt
-
-    ax = plt.gca()
-    ax.set_aspect(1.)
-
-    at = AnchoredText("Figure 1a",
-                      loc=2, frameon=True)
-    at.patch.set_boxstyle("round,pad=0.,rounding_size=0.2")
-    ax.add_artist(at)
-
-    from matplotlib.patches import Circle
-    ada = AnchoredDrawingArea(20, 20, 0, 0,
-                              loc=1, pad=0., frameon=False)
-    p = Circle((10, 10), 10)
-    ada.da.add_artist(p)
-    ax.add_artist(ada)
-
-    # draw an ellipse of width=0.1, height=0.15 in the data coordinate
-    ae = AnchoredEllipse(ax.transData, width=0.1, height=0.15, angle=0.,
-                         loc=3, pad=0.5, borderpad=0.4, frameon=True)
-
-    ax.add_artist(ae)
-
-    # draw a horizontal bar with length of 0.1 in Data coordinate
-    # (ax.transData) with a label underneath.
-    asb = AnchoredSizeBar(ax.transData,
-                          0.1,
-                          r"1$^{\prime}$",
-                          loc=8,
-                          pad=0.1, borderpad=0.5, sep=5,
-                          frameon=False)
-    ax.add_artist(asb)
-
-    plt.draw()
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/animation_demo.html b/examples/pylab_examples/animation_demo.html deleted file mode 100644 index b9c8f3125f7..00000000000 --- a/examples/pylab_examples/animation_demo.html +++ /dev/null @@ -1,349 +0,0 @@ - - - - - - - - pylab_examples example code: animation_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: animation_demo.py

-

(Source code, png, pdf)

-
-../../_images/animation_demo.png -
-
"""
-Pyplot animation example.
-
-The method shown here is only for very simple, low-performance
-use.  For more demanding applications, look at the animation
-module and the examples that use it.
-"""
-
-import matplotlib.pyplot as plt
-import numpy as np
-
-x = np.arange(6)
-y = np.arange(5)
-z = x * y[:, np.newaxis]
-
-for i in range(5):
-    if i == 0:
-        p = plt.imshow(z)
-        fig = plt.gcf()
-        plt.clim()   # clamp the color limits
-        plt.title("Boring slide show")
-    else:
-        z = z + 2
-        p.set_data(z)
-
-    print("step", i)
-    plt.pause(0.5)
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/annotation_demo.html b/examples/pylab_examples/annotation_demo.html deleted file mode 100644 index 701c130f1d6..00000000000 --- a/examples/pylab_examples/annotation_demo.html +++ /dev/null @@ -1,463 +0,0 @@ - - - - - - - - pylab_examples example code: annotation_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: annotation_demo.py

-

(Source code)

-
-../../_images/annotation_demo_00.png -

(png, pdf)

-
-
-../../_images/annotation_demo_01.png -

(png, pdf)

-
-
-../../_images/annotation_demo_02.png -

(png, pdf)

-
-
"""
-Some examples of how to annotate points in figures.  You specify an
-annotation point xy=(x,y) and a text point xytext=(x,y) for the
-annotated points and text location, respectively.  Optionally, you can
-specify the coordinate system of xy and xytext with one of the
-following strings for xycoords and textcoords (default is 'data')
-
-
-  'figure points'   : points from the lower left corner of the figure
-  'figure pixels'   : pixels from the lower left corner of the figure
-  'figure fraction' : 0,0 is lower left of figure and 1,1 is upper, right
-  'axes points'     : points from lower left corner of axes
-  'axes pixels'     : pixels from lower left corner of axes
-  'axes fraction'   : 0,0 is lower left of axes and 1,1 is upper right
-  'offset points'   : Specify an offset (in points) from the xy value
-  'offset pixels'   : Specify an offset (in pixels) from the xy value
-  'data'            : use the axes data coordinate system
-
-Optionally, you can specify arrow properties which draws and arrow
-from the text to the annotated point by giving a dictionary of arrow
-properties
-
-Valid keys are
-
-          width : the width of the arrow in points
-          frac  : the fraction of the arrow length occupied by the head
-          headwidth : the width of the base of the arrow head in points
-          shrink : move the tip and base some percent away from the
-                   annotated point and text
-          any key for matplotlib.patches.polygon  (e.g., facecolor)
-
-For physical coordinate systems (points or pixels) the origin is the
-(bottom, left) of the figure or axes.
-"""
-
-
-import matplotlib.pyplot as plt
-from matplotlib.patches import Ellipse
-import numpy as np
-
-
-# If only one location is given, the text and xypoint being
-# annotated are assumed to be the same
-fig = plt.figure()
-ax = fig.add_subplot(111, autoscale_on=False, xlim=(-1, 5), ylim=(-3, 5))
-
-t = np.arange(0.0, 5.0, 0.01)
-s = np.cos(2*np.pi*t)
-line, = ax.plot(t, s)
-
-ax.annotate('figure pixels',
-            xy=(10, 10), xycoords='figure pixels')
-
-ax.annotate('figure points',
-            xy=(80, 80), xycoords='figure points')
-
-ax.annotate('point offset from data',
-            xy=(2, 1), xycoords='data',
-            xytext=(-15, 25), textcoords='offset points',
-            arrowprops=dict(facecolor='black', shrink=0.05),
-            horizontalalignment='right', verticalalignment='bottom')
-
-ax.annotate('axes fraction',
-            xy=(3, 1), xycoords='data',
-            xytext=(0.8, 0.95), textcoords='axes fraction',
-            arrowprops=dict(facecolor='black', shrink=0.05),
-            horizontalalignment='right', verticalalignment='top')
-
-ax.annotate('figure fraction',
-            xy=(.025, .975), xycoords='figure fraction',
-            horizontalalignment='left', verticalalignment='top',
-            fontsize=20)
-
-# use negative points or pixels to specify from right, top -10, 10
-# is 10 points to the left of the right side of the axes and 10
-# points above the bottom
-ax.annotate('pixel offset from axes fraction',
-            xy=(1, 0), xycoords='axes fraction',
-            xytext=(-20, 20), textcoords='offset pixels',
-            horizontalalignment='right',
-            verticalalignment='bottom')
-
-
-# You can specify the xypoint and the xytext in different positions and
-# coordinate systems, and optionally turn on a connecting line and mark
-# the point with a marker.  Annotations work on polar axes too.
-# In the example below, the xy point is in native coordinates (xycoords
-# defaults to 'data').  For a polar axes, this is in (theta, radius) space.
-# The text in the example is placed in the fractional figure coordinate system.
-# Text keyword args like horizontal and vertical alignment are respected.
-fig = plt.figure()
-ax = fig.add_subplot(111, projection='polar')
-r = np.arange(0, 1, 0.001)
-theta = 2*2*np.pi*r
-line, = ax.plot(theta, r)
-
-ind = 800
-thisr, thistheta = r[ind], theta[ind]
-ax.plot([thistheta], [thisr], 'o')
-ax.annotate('a polar annotation',
-            xy=(thistheta, thisr),  # theta, radius
-            xytext=(0.05, 0.05),    # fraction, fraction
-            textcoords='figure fraction',
-            arrowprops=dict(facecolor='black', shrink=0.05),
-            horizontalalignment='left',
-            verticalalignment='bottom')
-
-
-# You can also use polar notation on a cartesian axes.  Here the native
-# coordinate system ('data') is cartesian, so you need to specify the
-# xycoords and textcoords as 'polar' if you want to use (theta, radius).
-
-el = Ellipse((0, 0), 10, 20, facecolor='r', alpha=0.5)
-
-fig = plt.figure()
-ax = fig.add_subplot(111, aspect='equal')
-ax.add_artist(el)
-el.set_clip_box(ax.bbox)
-ax.annotate('the top',
-            xy=(np.pi/2., 10.),      # theta, radius
-            xytext=(np.pi/3, 20.),   # theta, radius
-            xycoords='polar',
-            textcoords='polar',
-            arrowprops=dict(facecolor='black', shrink=0.05),
-            horizontalalignment='left',
-            verticalalignment='bottom',
-            clip_on=True)  # clip to the axes bounding box
-
-ax.set_xlim([-20, 20])
-ax.set_ylim([-20, 20])
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/annotation_demo2.html b/examples/pylab_examples/annotation_demo2.html deleted file mode 100644 index 6fef2d62230..00000000000 --- a/examples/pylab_examples/annotation_demo2.html +++ /dev/null @@ -1,477 +0,0 @@ - - - - - - - - pylab_examples example code: annotation_demo2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: annotation_demo2.py

-

(Source code)

-
-../../_images/annotation_demo2_00.png -

(png, pdf)

-
-
-../../_images/annotation_demo2_01.png -

(png, pdf)

-
-
import matplotlib.pyplot as plt
-from matplotlib.patches import Ellipse
-import numpy as np
-
-
-fig = plt.figure(1, figsize=(8, 5))
-ax = fig.add_subplot(111, autoscale_on=False, xlim=(-1, 5), ylim=(-4, 3))
-
-t = np.arange(0.0, 5.0, 0.01)
-s = np.cos(2*np.pi*t)
-line, = ax.plot(t, s, lw=3)
-
-ax.annotate('straight',
-            xy=(0, 1), xycoords='data',
-            xytext=(-50, 30), textcoords='offset points',
-            arrowprops=dict(arrowstyle="->"))
-
-ax.annotate('arc3,\nrad 0.2',
-            xy=(0.5, -1), xycoords='data',
-            xytext=(-80, -60), textcoords='offset points',
-            arrowprops=dict(arrowstyle="->",
-                            connectionstyle="arc3,rad=.2"))
-
-ax.annotate('arc,\nangle 50',
-            xy=(1., 1), xycoords='data',
-            xytext=(-90, 50), textcoords='offset points',
-            arrowprops=dict(arrowstyle="->",
-                            connectionstyle="arc,angleA=0,armA=50,rad=10"))
-
-ax.annotate('arc,\narms',
-            xy=(1.5, -1), xycoords='data',
-            xytext=(-80, -60), textcoords='offset points',
-            arrowprops=dict(arrowstyle="->",
-                            connectionstyle="arc,angleA=0,armA=40,angleB=-90,armB=30,rad=7"))
-
-ax.annotate('angle,\nangle 90',
-            xy=(2., 1), xycoords='data',
-            xytext=(-70, 30), textcoords='offset points',
-            arrowprops=dict(arrowstyle="->",
-                            connectionstyle="angle,angleA=0,angleB=90,rad=10"))
-
-ax.annotate('angle3,\nangle -90',
-            xy=(2.5, -1), xycoords='data',
-            xytext=(-80, -60), textcoords='offset points',
-            arrowprops=dict(arrowstyle="->",
-                            connectionstyle="angle3,angleA=0,angleB=-90"))
-
-ax.annotate('angle,\nround',
-            xy=(3., 1), xycoords='data',
-            xytext=(-60, 30), textcoords='offset points',
-            bbox=dict(boxstyle="round", fc="0.8"),
-            arrowprops=dict(arrowstyle="->",
-                            connectionstyle="angle,angleA=0,angleB=90,rad=10"))
-
-ax.annotate('angle,\nround4',
-            xy=(3.5, -1), xycoords='data',
-            xytext=(-70, -80), textcoords='offset points',
-            size=20,
-            bbox=dict(boxstyle="round4,pad=.5", fc="0.8"),
-            arrowprops=dict(arrowstyle="->",
-                            connectionstyle="angle,angleA=0,angleB=-90,rad=10"))
-
-ax.annotate('angle,\nshrink',
-            xy=(4., 1), xycoords='data',
-            xytext=(-60, 30), textcoords='offset points',
-            bbox=dict(boxstyle="round", fc="0.8"),
-            arrowprops=dict(arrowstyle="->",
-                            shrinkA=0, shrinkB=10,
-                            connectionstyle="angle,angleA=0,angleB=90,rad=10"))
-
-# You can pass an empty string to get only annotation arrows rendered
-ann = ax.annotate('', xy=(4., 1.), xycoords='data',
-                  xytext=(4.5, -1), textcoords='data',
-                  arrowprops=dict(arrowstyle="<->",
-                                  connectionstyle="bar",
-                                  ec="k",
-                                  shrinkA=5, shrinkB=5))
-
-
-fig = plt.figure(2)
-fig.clf()
-ax = fig.add_subplot(111, autoscale_on=False, xlim=(-1, 5), ylim=(-5, 3))
-
-el = Ellipse((2, -1), 0.5, 0.5)
-ax.add_patch(el)
-
-ax.annotate('$->$',
-            xy=(2., -1), xycoords='data',
-            xytext=(-150, -140), textcoords='offset points',
-            bbox=dict(boxstyle="round", fc="0.8"),
-            arrowprops=dict(arrowstyle="->",
-                            patchB=el,
-                            connectionstyle="angle,angleA=90,angleB=0,rad=10"))
-
-ax.annotate('arrow\nfancy',
-            xy=(2., -1), xycoords='data',
-            xytext=(-100, 60), textcoords='offset points',
-            size=20,
-            # bbox=dict(boxstyle="round", fc="0.8"),
-            arrowprops=dict(arrowstyle="fancy",
-                            fc="0.6", ec="none",
-                            patchB=el,
-                            connectionstyle="angle3,angleA=0,angleB=-90"))
-
-ax.annotate('arrow\nsimple',
-            xy=(2., -1), xycoords='data',
-            xytext=(100, 60), textcoords='offset points',
-            size=20,
-            # bbox=dict(boxstyle="round", fc="0.8"),
-            arrowprops=dict(arrowstyle="simple",
-                            fc="0.6", ec="none",
-                            patchB=el,
-                            connectionstyle="arc3,rad=0.3"))
-
-ax.annotate('wedge',
-            xy=(2., -1), xycoords='data',
-            xytext=(-100, -100), textcoords='offset points',
-            size=20,
-            # bbox=dict(boxstyle="round", fc="0.8"),
-            arrowprops=dict(arrowstyle="wedge,tail_width=0.7",
-                            fc="0.6", ec="none",
-                            patchB=el,
-                            connectionstyle="arc3,rad=-0.3"))
-
-ann = ax.annotate('bubble,\ncontours',
-                  xy=(2., -1), xycoords='data',
-                  xytext=(0, -70), textcoords='offset points',
-                  size=20,
-                  bbox=dict(boxstyle="round",
-                            fc=(1.0, 0.7, 0.7),
-                            ec=(1., .5, .5)),
-                  arrowprops=dict(arrowstyle="wedge,tail_width=1.",
-                                  fc=(1.0, 0.7, 0.7), ec=(1., .5, .5),
-                                  patchA=None,
-                                  patchB=el,
-                                  relpos=(0.2, 0.8),
-                                  connectionstyle="arc3,rad=-0.1"))
-
-ann = ax.annotate('bubble',
-                  xy=(2., -1), xycoords='data',
-                  xytext=(55, 0), textcoords='offset points',
-                  size=20, va="center",
-                  bbox=dict(boxstyle="round", fc=(1.0, 0.7, 0.7), ec="none"),
-                  arrowprops=dict(arrowstyle="wedge,tail_width=1.",
-                                  fc=(1.0, 0.7, 0.7), ec="none",
-                                  patchA=None,
-                                  patchB=el,
-                                  relpos=(0.2, 0.5)))
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/annotation_demo3.html b/examples/pylab_examples/annotation_demo3.html deleted file mode 100644 index 3b29d031e36..00000000000 --- a/examples/pylab_examples/annotation_demo3.html +++ /dev/null @@ -1,410 +0,0 @@ - - - - - - - - pylab_examples example code: annotation_demo3.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: annotation_demo3.py

-

(Source code, png, pdf)

-
-../../_images/annotation_demo3.png -
-
import matplotlib.pyplot as plt
-from matplotlib.text import OffsetFrom
-
-
-fig, (ax1, ax2) = plt.subplots(1, 2)
-
-bbox_args = dict(boxstyle="round", fc="0.8")
-arrow_args = dict(arrowstyle="->")
-
-ax1.annotate('figure fraction : 0, 0', xy=(0, 0), xycoords='figure fraction',
-             xytext=(20, 20), textcoords='offset points',
-             ha="left", va="bottom",
-             bbox=bbox_args,
-             arrowprops=arrow_args)
-
-ax1.annotate('figure fraction : 1, 1', xy=(1, 1), xycoords='figure fraction',
-             xytext=(-20, -20), textcoords='offset points',
-             ha="right", va="top",
-             bbox=bbox_args,
-             arrowprops=arrow_args)
-
-ax1.annotate('axes fraction : 0, 0', xy=(0, 0), xycoords='axes fraction',
-             xytext=(20, 20), textcoords='offset points',
-             ha="left", va="bottom",
-             bbox=bbox_args,
-             arrowprops=arrow_args)
-
-ax1.annotate('axes fraction : 1, 1', xy=(1, 1), xycoords='axes fraction',
-             xytext=(-20, -20), textcoords='offset points',
-             ha="right", va="top",
-             bbox=bbox_args,
-             arrowprops=arrow_args)
-
-
-an1 = ax1.annotate('Drag me 1', xy=(.5, .7), xycoords='data',
-                   #xytext=(.5, .7), textcoords='data',
-                   ha="center", va="center",
-                   bbox=bbox_args,
-                   #arrowprops=arrow_args
-                   )
-
-an2 = ax1.annotate('Drag me 2', xy=(.5, .5), xycoords=an1,
-                   xytext=(.5, .3), textcoords='axes fraction',
-                   ha="center", va="center",
-                   bbox=bbox_args,
-                   arrowprops=dict(patchB=an1.get_bbox_patch(),
-                                   connectionstyle="arc3,rad=0.2",
-                                   **arrow_args))
-
-an3 = ax1.annotate('', xy=(.5, .5), xycoords=an2,
-                   xytext=(.5, .5), textcoords=an1,
-                   ha="center", va="center",
-                   bbox=bbox_args,
-                   arrowprops=dict(patchA=an1.get_bbox_patch(),
-                                   patchB=an2.get_bbox_patch(),
-                                   connectionstyle="arc3,rad=0.2",
-                                   **arrow_args))
-
-
-t = ax2.annotate('xy=(0, 1)\nxycoords=("data", "axes fraction")',
-                 xy=(0, 1), xycoords=("data", 'axes fraction'),
-                 xytext=(0, -20), textcoords='offset points',
-                 ha="center", va="top",
-                 bbox=bbox_args,
-                 arrowprops=arrow_args)
-
-ax2.annotate('xy=(0.5, 0)\nxycoords=artist',
-             xy=(0.5, 0.), xycoords=t,
-             xytext=(0, -20), textcoords='offset points',
-             ha="center", va="top",
-             bbox=bbox_args,
-             arrowprops=arrow_args)
-
-ax2.annotate('xy=(0.8, 0.5)\nxycoords=ax1.transData',
-             xy=(0.8, 0.5), xycoords=ax1.transData,
-             xytext=(10, 10),
-             textcoords=OffsetFrom(ax2.bbox, (0, 0), "points"),
-             ha="left", va="bottom",
-             bbox=bbox_args,
-             arrowprops=arrow_args)
-
-ax2.set_xlim([-2, 2])
-ax2.set_ylim([-2, 2])
-
-an1.draggable()
-an2.draggable()
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/anscombe.html b/examples/pylab_examples/anscombe.html deleted file mode 100644 index 66ae4c75dca..00000000000 --- a/examples/pylab_examples/anscombe.html +++ /dev/null @@ -1,380 +0,0 @@ - - - - - - - - pylab_examples example code: anscombe.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: anscombe.py

-

(Source code, png, pdf)

-
-../../_images/anscombe.png -
-
from __future__ import print_function
-"""
-Edward Tufte uses this example from Anscombe to show 4 datasets of x
-and y that have the same mean, standard deviation, and regression
-line, but which are qualitatively different.
-
-matplotlib fun for a rainy day
-"""
-
-import matplotlib.pyplot as plt
-import numpy as np
-
-x = np.array([10, 8, 13, 9, 11, 14, 6, 4, 12, 7, 5])
-y1 = np.array([8.04, 6.95, 7.58, 8.81, 8.33, 9.96, 7.24, 4.26, 10.84, 4.82, 5.68])
-y2 = np.array([9.14, 8.14, 8.74, 8.77, 9.26, 8.10, 6.13, 3.10, 9.13, 7.26, 4.74])
-y3 = np.array([7.46, 6.77, 12.74, 7.11, 7.81, 8.84, 6.08, 5.39, 8.15, 6.42, 5.73])
-x4 = np.array([8, 8, 8, 8, 8, 8, 8, 19, 8, 8, 8])
-y4 = np.array([6.58, 5.76, 7.71, 8.84, 8.47, 7.04, 5.25, 12.50, 5.56, 7.91, 6.89])
-
-
-def fit(x):
-    return 3 + 0.5*x
-
-
-xfit = np.array([np.amin(x), np.amax(x)])
-
-plt.subplot(221)
-plt.plot(x, y1, 'ks', xfit, fit(xfit), 'r-', lw=2)
-plt.axis([2, 20, 2, 14])
-plt.setp(plt.gca(), xticklabels=[], yticks=(4, 8, 12), xticks=(0, 10, 20))
-plt.text(3, 12, 'I', fontsize=20)
-
-plt.subplot(222)
-plt.plot(x, y2, 'ks', xfit, fit(xfit), 'r-', lw=2)
-plt.axis([2, 20, 2, 14])
-plt.setp(plt.gca(), xticklabels=[], yticks=(4, 8, 12), yticklabels=[], xticks=(0, 10, 20))
-plt.text(3, 12, 'II', fontsize=20)
-
-plt.subplot(223)
-plt.plot(x, y3, 'ks', xfit, fit(xfit), 'r-', lw=2)
-plt.axis([2, 20, 2, 14])
-plt.text(3, 12, 'III', fontsize=20)
-plt.setp(plt.gca(), yticks=(4, 8, 12), xticks=(0, 10, 20))
-
-plt.subplot(224)
-
-xfit = np.array([np.amin(x4), np.amax(x4)])
-plt.plot(x4, y4, 'ks', xfit, fit(xfit), 'r-', lw=2)
-plt.axis([2, 20, 2, 14])
-plt.setp(plt.gca(), yticklabels=[], yticks=(4, 8, 12), xticks=(0, 10, 20))
-plt.text(3, 12, 'IV', fontsize=20)
-
-# verify the stats
-pairs = (x, y1), (x, y2), (x, y3), (x4, y4)
-for x, y in pairs:
-    print('mean=%1.2f, std=%1.2f, r=%1.2f' % (np.mean(y), np.std(y), np.corrcoef(x, y)[0][1]))
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/arctest.html b/examples/pylab_examples/arctest.html deleted file mode 100644 index 648e7b6ff36..00000000000 --- a/examples/pylab_examples/arctest.html +++ /dev/null @@ -1,340 +0,0 @@ - - - - - - - - pylab_examples example code: arctest.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: arctest.py

-

(Source code, png, pdf)

-
-../../_images/arctest.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-
-
-def f(t):
-    'a damped exponential'
-    s1 = np.cos(2 * np.pi * t)
-    e1 = np.exp(-t)
-    return s1 * e1
-
-t1 = np.arange(0.0, 5.0, .2)
-
-
-l = plt.plot(t1, f(t1), 'ro')
-plt.setp(l, 'markersize', 30)
-plt.setp(l, 'markerfacecolor', 'b')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/arrow_demo.html b/examples/pylab_examples/arrow_demo.html deleted file mode 100644 index 895026162ff..00000000000 --- a/examples/pylab_examples/arrow_demo.html +++ /dev/null @@ -1,635 +0,0 @@ - - - - - - - - pylab_examples example code: arrow_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: arrow_demo.py

-

(Source code, png, pdf)

-
-../../_images/arrow_demo1.png -
-
"""Arrow drawing example for the new fancy_arrow facilities.
-
-Code contributed by: Rob Knight <rob@spot.colorado.edu>
-
-usage:
-
-  python arrow_demo.py realistic|full|sample|extreme
-
-
-"""
-import matplotlib.pyplot as plt
-import numpy as np
-
-rates_to_bases = {'r1': 'AT', 'r2': 'TA', 'r3': 'GA', 'r4': 'AG', 'r5': 'CA',
-                  'r6': 'AC', 'r7': 'GT', 'r8': 'TG', 'r9': 'CT', 'r10': 'TC',
-                  'r11': 'GC', 'r12': 'CG'}
-numbered_bases_to_rates = dict([(v, k) for k, v in rates_to_bases.items()])
-lettered_bases_to_rates = dict([(v, 'r' + v) for k, v in rates_to_bases.items()])
-
-
-def add_dicts(d1, d2):
-    """Adds two dicts and returns the result."""
-    result = d1.copy()
-    result.update(d2)
-    return result
-
-
-def make_arrow_plot(data, size=4, display='length', shape='right',
-                    max_arrow_width=0.03, arrow_sep=0.02, alpha=0.5,
-                    normalize_data=False, ec=None, labelcolor=None,
-                    head_starts_at_zero=True, rate_labels=lettered_bases_to_rates,
-                    **kwargs):
-    """Makes an arrow plot.
-
-    Parameters:
-
-    data: dict with probabilities for the bases and pair transitions.
-    size: size of the graph in inches.
-    display: 'length', 'width', or 'alpha' for arrow property to change.
-    shape: 'full', 'left', or 'right' for full or half arrows.
-    max_arrow_width: maximum width of an arrow, data coordinates.
-    arrow_sep: separation between arrows in a pair, data coordinates.
-    alpha: maximum opacity of arrows, default 0.8.
-
-    **kwargs can be anything allowed by a Arrow object, e.g.
-    linewidth and edgecolor.
-    """
-
-    plt.xlim(-0.5, 1.5)
-    plt.ylim(-0.5, 1.5)
-    plt.gcf().set_size_inches(size, size)
-    plt.xticks([])
-    plt.yticks([])
-    max_text_size = size*12
-    min_text_size = size
-    label_text_size = size*2.5
-    text_params = {'ha': 'center', 'va': 'center', 'family': 'sans-serif',
-                   'fontweight': 'bold'}
-    r2 = np.sqrt(2)
-
-    deltas = {
-        'AT': (1, 0),
-        'TA': (-1, 0),
-        'GA': (0, 1),
-        'AG': (0, -1),
-        'CA': (-1/r2, 1/r2),
-        'AC': (1/r2, -1/r2),
-        'GT': (1/r2, 1/r2),
-        'TG': (-1/r2, -1/r2),
-        'CT': (0, 1),
-        'TC': (0, -1),
-        'GC': (1, 0),
-        'CG': (-1, 0)
-        }
-
-    colors = {
-        'AT': 'r',
-        'TA': 'k',
-        'GA': 'g',
-        'AG': 'r',
-        'CA': 'b',
-        'AC': 'r',
-        'GT': 'g',
-        'TG': 'k',
-        'CT': 'b',
-        'TC': 'k',
-        'GC': 'g',
-        'CG': 'b'
-        }
-
-    label_positions = {
-        'AT': 'center',
-        'TA': 'center',
-        'GA': 'center',
-        'AG': 'center',
-        'CA': 'left',
-        'AC': 'left',
-        'GT': 'left',
-        'TG': 'left',
-        'CT': 'center',
-        'TC': 'center',
-        'GC': 'center',
-        'CG': 'center'
-        }
-
-    def do_fontsize(k):
-        return float(np.clip(max_text_size*np.sqrt(data[k]),
-                          min_text_size, max_text_size))
-
-    A = plt.text(0, 1, '$A_3$', color='r', size=do_fontsize('A'), **text_params)
-    T = plt.text(1, 1, '$T_3$', color='k', size=do_fontsize('T'), **text_params)
-    G = plt.text(0, 0, '$G_3$', color='g', size=do_fontsize('G'), **text_params)
-    C = plt.text(1, 0, '$C_3$', color='b', size=do_fontsize('C'), **text_params)
-
-    arrow_h_offset = 0.25  # data coordinates, empirically determined
-    max_arrow_length = 1 - 2*arrow_h_offset
-
-    max_arrow_width = max_arrow_width
-    max_head_width = 2.5*max_arrow_width
-    max_head_length = 2*max_arrow_width
-    arrow_params = {'length_includes_head': True, 'shape': shape,
-                    'head_starts_at_zero': head_starts_at_zero}
-    ax = plt.gca()
-    sf = 0.6  # max arrow size represents this in data coords
-
-    d = (r2/2 + arrow_h_offset - 0.5)/r2  # distance for diags
-    r2v = arrow_sep/r2  # offset for diags
-
-    # tuple of x, y for start position
-    positions = {
-        'AT': (arrow_h_offset, 1 + arrow_sep),
-        'TA': (1 - arrow_h_offset, 1 - arrow_sep),
-        'GA': (-arrow_sep, arrow_h_offset),
-        'AG': (arrow_sep, 1 - arrow_h_offset),
-        'CA': (1 - d - r2v, d - r2v),
-        'AC': (d + r2v, 1 - d + r2v),
-        'GT': (d - r2v, d + r2v),
-        'TG': (1 - d + r2v, 1 - d - r2v),
-        'CT': (1 - arrow_sep, arrow_h_offset),
-        'TC': (1 + arrow_sep, 1 - arrow_h_offset),
-        'GC': (arrow_h_offset, arrow_sep),
-        'CG': (1 - arrow_h_offset, -arrow_sep),
-        }
-
-    if normalize_data:
-        # find maximum value for rates, i.e. where keys are 2 chars long
-        max_val = 0
-        for k, v in data.items():
-            if len(k) == 2:
-                max_val = max(max_val, v)
-        # divide rates by max val, multiply by arrow scale factor
-        for k, v in data.items():
-            data[k] = v/max_val*sf
-
-    def draw_arrow(pair, alpha=alpha, ec=ec, labelcolor=labelcolor):
-        # set the length of the arrow
-        if display == 'length':
-            length = max_head_length + data[pair]/sf*(max_arrow_length -
-                                                      max_head_length)
-        else:
-            length = max_arrow_length
-        # set the transparency of the arrow
-        if display == 'alph':
-            alpha = min(data[pair]/sf, alpha)
-        else:
-            alpha = alpha
-        # set the width of the arrow
-        if display == 'width':
-            scale = data[pair]/sf
-            width = max_arrow_width*scale
-            head_width = max_head_width*scale
-            head_length = max_head_length*scale
-        else:
-            width = max_arrow_width
-            head_width = max_head_width
-            head_length = max_head_length
-
-        fc = colors[pair]
-        ec = ec or fc
-
-        x_scale, y_scale = deltas[pair]
-        x_pos, y_pos = positions[pair]
-        plt.arrow(x_pos, y_pos, x_scale*length, y_scale*length,
-              fc=fc, ec=ec, alpha=alpha, width=width, head_width=head_width,
-              head_length=head_length, **arrow_params)
-
-        # figure out coordinates for text
-        # if drawing relative to base: x and y are same as for arrow
-        # dx and dy are one arrow width left and up
-        # need to rotate based on direction of arrow, use x_scale and y_scale
-        # as sin x and cos x?
-        sx, cx = y_scale, x_scale
-
-        where = label_positions[pair]
-        if where == 'left':
-            orig_position = 3*np.array([[max_arrow_width, max_arrow_width]])
-        elif where == 'absolute':
-            orig_position = np.array([[max_arrow_length/2.0, 3*max_arrow_width]])
-        elif where == 'right':
-            orig_position = np.array([[length - 3*max_arrow_width,
-                                    3*max_arrow_width]])
-        elif where == 'center':
-            orig_position = np.array([[length/2.0, 3*max_arrow_width]])
-        else:
-            raise ValueError("Got unknown position parameter %s" % where)
-
-        M = np.array([[cx, sx], [-sx, cx]])
-        coords = np.dot(orig_position, M) + [[x_pos, y_pos]]
-        x, y = np.ravel(coords)
-        orig_label = rate_labels[pair]
-        label = '$%s_{_{\mathrm{%s}}}$' % (orig_label[0], orig_label[1:])
-
-        plt.text(x, y, label, size=label_text_size, ha='center', va='center',
-             color=labelcolor or fc)
-
-    for p in sorted(positions):
-        draw_arrow(p)
-
-# test data
-all_on_max = dict([(i, 1) for i in 'TCAG'] +
-                  [(i + j, 0.6) for i in 'TCAG' for j in 'TCAG'])
-
-realistic_data = {
-    'A': 0.4,
-    'T': 0.3,
-    'G': 0.5,
-    'C': 0.2,
-    'AT': 0.4,
-    'AC': 0.3,
-    'AG': 0.2,
-    'TA': 0.2,
-    'TC': 0.3,
-    'TG': 0.4,
-    'CT': 0.2,
-    'CG': 0.3,
-    'CA': 0.2,
-    'GA': 0.1,
-    'GT': 0.4,
-    'GC': 0.1,
-    }
-
-extreme_data = {
-    'A': 0.75,
-    'T': 0.10,
-    'G': 0.10,
-    'C': 0.05,
-    'AT': 0.6,
-    'AC': 0.3,
-    'AG': 0.1,
-    'TA': 0.02,
-    'TC': 0.3,
-    'TG': 0.01,
-    'CT': 0.2,
-    'CG': 0.5,
-    'CA': 0.2,
-    'GA': 0.1,
-    'GT': 0.4,
-    'GC': 0.2,
-    }
-
-sample_data = {
-    'A': 0.2137,
-    'T': 0.3541,
-    'G': 0.1946,
-    'C': 0.2376,
-    'AT': 0.0228,
-    'AC': 0.0684,
-    'AG': 0.2056,
-    'TA': 0.0315,
-    'TC': 0.0629,
-    'TG': 0.0315,
-    'CT': 0.1355,
-    'CG': 0.0401,
-    'CA': 0.0703,
-    'GA': 0.1824,
-    'GT': 0.0387,
-    'GC': 0.1106,
-    }
-
-
-if __name__ == '__main__':
-    from sys import argv
-    d = None
-    if len(argv) > 1:
-        if argv[1] == 'full':
-            d = all_on_max
-            scaled = False
-        elif argv[1] == 'extreme':
-            d = extreme_data
-            scaled = False
-        elif argv[1] == 'realistic':
-            d = realistic_data
-            scaled = False
-        elif argv[1] == 'sample':
-            d = sample_data
-            scaled = True
-    if d is None:
-        d = all_on_max
-        scaled = False
-    if len(argv) > 2:
-        display = argv[2]
-    else:
-        display = 'length'
-
-    size = 4
-    plt.figure(figsize=(size, size))
-
-    make_arrow_plot(d, display=display, linewidth=0.001, edgecolor=None,
-                    normalize_data=scaled, head_starts_at_zero=True, size=size)
-
-    plt.draw()
-
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/arrow_simple_demo.html b/examples/pylab_examples/arrow_simple_demo.html deleted file mode 100644 index 7ce2ebb0b8c..00000000000 --- a/examples/pylab_examples/arrow_simple_demo.html +++ /dev/null @@ -1,327 +0,0 @@ - - - - - - - - pylab_examples example code: arrow_simple_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: arrow_simple_demo.py

-

(Source code, png, pdf)

-
-../../_images/arrow_simple_demo.png -
-
import matplotlib.pyplot as plt
-
-ax = plt.axes()
-ax.arrow(0, 0, 0.5, 0.5, head_width=0.05, head_length=0.1, fc='k', ec='k')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/aspect_loglog.html b/examples/pylab_examples/aspect_loglog.html deleted file mode 100644 index 03fe6ebef41..00000000000 --- a/examples/pylab_examples/aspect_loglog.html +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - - - pylab_examples example code: aspect_loglog.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: aspect_loglog.py

-

(Source code, png, pdf)

-
-../../_images/aspect_loglog.png -
-
import matplotlib.pyplot as plt
-
-fig, (ax1, ax2) = plt.subplots(1, 2)
-ax1.set_xscale("log")
-ax1.set_yscale("log")
-ax1.set_xlim(1e1, 1e3)
-ax1.set_ylim(1e2, 1e3)
-ax1.set_aspect(1)
-ax1.set_title("adjustable = box")
-
-ax2.set_xscale("log")
-ax2.set_yscale("log")
-ax2.set_adjustable("datalim")
-ax2.plot([1, 3, 10], [1, 9, 100], "o-")
-ax2.set_xlim(1e-1, 1e2)
-ax2.set_ylim(1e-1, 1e3)
-ax2.set_aspect(1)
-ax2.set_title("adjustable = datalim")
-
-plt.draw()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/axes_demo.html b/examples/pylab_examples/axes_demo.html deleted file mode 100644 index 3d126daba9c..00000000000 --- a/examples/pylab_examples/axes_demo.html +++ /dev/null @@ -1,355 +0,0 @@ - - - - - - - - pylab_examples example code: axes_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: axes_demo.py

-

(Source code, png, pdf)

-
-../../_images/axes_demo.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-
-# create some data to use for the plot
-dt = 0.001
-t = np.arange(0.0, 10.0, dt)
-r = np.exp(-t[:1000]/0.05)               # impulse response
-x = np.random.randn(len(t))
-s = np.convolve(x, r)[:len(x)]*dt  # colored noise
-
-# the main axes is subplot(111) by default
-plt.plot(t, s)
-plt.axis([0, 1, 1.1*np.amin(s), 2*np.amax(s)])
-plt.xlabel('time (s)')
-plt.ylabel('current (nA)')
-plt.title('Gaussian colored noise')
-
-# this is an inset axes over the main axes
-a = plt.axes([.65, .6, .2, .2], facecolor='y')
-n, bins, patches = plt.hist(s, 400, normed=1)
-plt.title('Probability')
-plt.xticks([])
-plt.yticks([])
-
-# this is another inset axes over the main axes
-a = plt.axes([0.2, 0.6, .2, .2], facecolor='y')
-plt.plot(t[:len(r)], r)
-plt.title('Impulse response')
-plt.xlim(0, 0.2)
-plt.xticks([])
-plt.yticks([])
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/axes_props.html b/examples/pylab_examples/axes_props.html deleted file mode 100644 index 0a6761d52f6..00000000000 --- a/examples/pylab_examples/axes_props.html +++ /dev/null @@ -1,350 +0,0 @@ - - - - - - - - pylab_examples example code: axes_props.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: axes_props.py

-

(Source code, png, pdf)

-
-../../_images/axes_props.png -
-
"""
-You can control the axis tick and grid properties
-"""
-
-import matplotlib.pyplot as plt
-import numpy as np
-
-t = np.arange(0.0, 2.0, 0.01)
-s = np.sin(2 * np.pi * t)
-fig, ax = plt.subplots()
-ax.plot(t, s)
-ax.grid(True)
-
-ticklines = ax.get_xticklines() + ax.get_yticklines()
-gridlines = ax.get_xgridlines() + ax.get_ygridlines()
-ticklabels = ax.get_xticklabels() + ax.get_yticklabels()
-
-for line in ticklines:
-    line.set_linewidth(3)
-
-for line in gridlines:
-    line.set_linestyle('-.')
-
-for label in ticklabels:
-    label.set_color('r')
-    label.set_fontsize('medium')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/axes_zoom_effect.html b/examples/pylab_examples/axes_zoom_effect.html deleted file mode 100644 index 89ea6ed00f2..00000000000 --- a/examples/pylab_examples/axes_zoom_effect.html +++ /dev/null @@ -1,440 +0,0 @@ - - - - - - - - pylab_examples example code: axes_zoom_effect.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: axes_zoom_effect.py

-

(Source code, png, pdf)

-
-../../_images/axes_zoom_effect.png -
-
from matplotlib.transforms import Bbox, TransformedBbox, \
-    blended_transform_factory
-
-from mpl_toolkits.axes_grid1.inset_locator import BboxPatch, BboxConnector,\
-    BboxConnectorPatch
-
-
-def connect_bbox(bbox1, bbox2,
-                 loc1a, loc2a, loc1b, loc2b,
-                 prop_lines, prop_patches=None):
-    if prop_patches is None:
-        prop_patches = prop_lines.copy()
-        prop_patches["alpha"] = prop_patches.get("alpha", 1)*0.2
-
-    c1 = BboxConnector(bbox1, bbox2, loc1=loc1a, loc2=loc2a, **prop_lines)
-    c1.set_clip_on(False)
-    c2 = BboxConnector(bbox1, bbox2, loc1=loc1b, loc2=loc2b, **prop_lines)
-    c2.set_clip_on(False)
-
-    bbox_patch1 = BboxPatch(bbox1, **prop_patches)
-    bbox_patch2 = BboxPatch(bbox2, **prop_patches)
-
-    p = BboxConnectorPatch(bbox1, bbox2,
-                           # loc1a=3, loc2a=2, loc1b=4, loc2b=1,
-                           loc1a=loc1a, loc2a=loc2a, loc1b=loc1b, loc2b=loc2b,
-                           **prop_patches)
-    p.set_clip_on(False)
-
-    return c1, c2, bbox_patch1, bbox_patch2, p
-
-
-def zoom_effect01(ax1, ax2, xmin, xmax, **kwargs):
-    """
-    ax1 : the main axes
-    ax1 : the zoomed axes
-    (xmin,xmax) : the limits of the colored area in both plot axes.
-
-    connect ax1 & ax2. The x-range of (xmin, xmax) in both axes will
-    be marked.  The keywords parameters will be used ti create
-    patches.
-
-    """
-
-    trans1 = blended_transform_factory(ax1.transData, ax1.transAxes)
-    trans2 = blended_transform_factory(ax2.transData, ax2.transAxes)
-
-    bbox = Bbox.from_extents(xmin, 0, xmax, 1)
-
-    mybbox1 = TransformedBbox(bbox, trans1)
-    mybbox2 = TransformedBbox(bbox, trans2)
-
-    prop_patches = kwargs.copy()
-    prop_patches["ec"] = "none"
-    prop_patches["alpha"] = 0.2
-
-    c1, c2, bbox_patch1, bbox_patch2, p = \
-        connect_bbox(mybbox1, mybbox2,
-                     loc1a=3, loc2a=2, loc1b=4, loc2b=1,
-                     prop_lines=kwargs, prop_patches=prop_patches)
-
-    ax1.add_patch(bbox_patch1)
-    ax2.add_patch(bbox_patch2)
-    ax2.add_patch(c1)
-    ax2.add_patch(c2)
-    ax2.add_patch(p)
-
-    return c1, c2, bbox_patch1, bbox_patch2, p
-
-
-def zoom_effect02(ax1, ax2, **kwargs):
-    """
-    ax1 : the main axes
-    ax1 : the zoomed axes
-
-    Similar to zoom_effect01.  The xmin & xmax will be taken from the
-    ax1.viewLim.
-    """
-
-    tt = ax1.transScale + (ax1.transLimits + ax2.transAxes)
-    trans = blended_transform_factory(ax2.transData, tt)
-
-    mybbox1 = ax1.bbox
-    mybbox2 = TransformedBbox(ax1.viewLim, trans)
-
-    prop_patches = kwargs.copy()
-    prop_patches["ec"] = "none"
-    prop_patches["alpha"] = 0.2
-
-    c1, c2, bbox_patch1, bbox_patch2, p = \
-        connect_bbox(mybbox1, mybbox2,
-                     loc1a=3, loc2a=2, loc1b=4, loc2b=1,
-                     prop_lines=kwargs, prop_patches=prop_patches)
-
-    ax1.add_patch(bbox_patch1)
-    ax2.add_patch(bbox_patch2)
-    ax2.add_patch(c1)
-    ax2.add_patch(c2)
-    ax2.add_patch(p)
-
-    return c1, c2, bbox_patch1, bbox_patch2, p
-
-
-import matplotlib.pyplot as plt
-
-plt.figure(1, figsize=(5, 5))
-ax1 = plt.subplot(221)
-ax2 = plt.subplot(212)
-ax2.set_xlim(0, 1)
-ax2.set_xlim(0, 5)
-zoom_effect01(ax1, ax2, 0.2, 0.8)
-
-
-ax1 = plt.subplot(222)
-ax1.set_xlim(2, 3)
-ax2.set_xlim(0, 5)
-zoom_effect02(ax1, ax2)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/axhspan_demo.html b/examples/pylab_examples/axhspan_demo.html deleted file mode 100644 index abe27f374ae..00000000000 --- a/examples/pylab_examples/axhspan_demo.html +++ /dev/null @@ -1,354 +0,0 @@ - - - - - - - - pylab_examples example code: axhspan_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: axhspan_demo.py

-

(Source code, png, pdf)

-
-../../_images/axhspan_demo1.png -
-
import numpy as np
-import matplotlib.pyplot as plt
-
-t = np.arange(-1, 2, .01)
-s = np.sin(2*np.pi*t)
-
-plt.plot(t, s)
-# draw a thick red hline at y=0 that spans the xrange
-l = plt.axhline(linewidth=8, color='#d62728')
-
-# draw a default hline at y=1 that spans the xrange
-l = plt.axhline(y=1)
-
-# draw a default vline at x=1 that spans the yrange
-l = plt.axvline(x=1)
-
-# draw a thick blue vline at x=0 that spans the upper quadrant of
-# the yrange
-l = plt.axvline(x=0, ymin=0.75, linewidth=8, color='#1f77b4')
-
-# draw a default hline at y=.5 that spans the middle half of
-# the axes
-l = plt.axhline(y=.5, xmin=0.25, xmax=0.75)
-
-p = plt.axhspan(0.25, 0.75, facecolor='0.5', alpha=0.5)
-
-p = plt.axvspan(1.25, 1.55, facecolor='#2ca02c', alpha=0.5)
-
-plt.axis([-1, 2, -1, 2])
-
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/axis_equal_demo.html b/examples/pylab_examples/axis_equal_demo.html deleted file mode 100644 index 68ce18ac5ac..00000000000 --- a/examples/pylab_examples/axis_equal_demo.html +++ /dev/null @@ -1,354 +0,0 @@ - - - - - - - - pylab_examples example code: axis_equal_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: axis_equal_demo.py

-

(Source code, png, pdf)

-
-../../_images/axis_equal_demo.png -
-
'''This example is only interesting when ran in interactive mode'''
-
-import matplotlib.pyplot as plt
-import numpy as np
-
-# Plot circle or radius 3
-
-an = np.linspace(0, 2*np.pi, 100)
-
-plt.subplot(221)
-plt.plot(3*np.cos(an), 3*np.sin(an))
-plt.title('not equal, looks like ellipse', fontsize=10)
-
-plt.subplot(222)
-plt.plot(3*np.cos(an), 3*np.sin(an))
-plt.axis('equal')
-plt.title('equal, looks like circle', fontsize=10)
-
-plt.subplot(223)
-plt.plot(3*np.cos(an), 3*np.sin(an))
-plt.axis('equal')
-plt.axis([-3, 3, -3, 3])
-plt.title('looks like circle, even after changing limits', fontsize=10)
-
-plt.subplot(224)
-plt.plot(3*np.cos(an), 3*np.sin(an))
-plt.axis('equal')
-plt.axis([-3, 3, -3, 3])
-plt.plot([0, 4], [0, 4])
-plt.title('still equal after adding line', fontsize=10)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/bar_stacked.html b/examples/pylab_examples/bar_stacked.html deleted file mode 100644 index d028a3ca9fc..00000000000 --- a/examples/pylab_examples/bar_stacked.html +++ /dev/null @@ -1,346 +0,0 @@ - - - - - - - - pylab_examples example code: bar_stacked.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: bar_stacked.py

-

(Source code, png, pdf)

-
-../../_images/bar_stacked1.png -
-
# a stacked bar plot with errorbars
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-N = 5
-menMeans = (20, 35, 30, 35, 27)
-womenMeans = (25, 32, 34, 20, 25)
-menStd = (2, 3, 4, 1, 2)
-womenStd = (3, 5, 2, 3, 3)
-ind = np.arange(N)    # the x locations for the groups
-width = 0.35       # the width of the bars: can also be len(x) sequence
-
-p1 = plt.bar(ind, menMeans, width, color='#d62728', yerr=menStd)
-p2 = plt.bar(ind, womenMeans, width,
-             bottom=menMeans, yerr=womenStd)
-
-plt.ylabel('Scores')
-plt.title('Scores by group and gender')
-plt.xticks(ind, ('G1', 'G2', 'G3', 'G4', 'G5'))
-plt.yticks(np.arange(0, 81, 10))
-plt.legend((p1[0], p2[0]), ('Men', 'Women'))
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/barb_demo.html b/examples/pylab_examples/barb_demo.html deleted file mode 100644 index fd5bd06a7d0..00000000000 --- a/examples/pylab_examples/barb_demo.html +++ /dev/null @@ -1,380 +0,0 @@ - - - - - - - - pylab_examples example code: barb_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: barb_demo.py

-

(Source code)

-
-../../_images/barb_demo_001.png -

(png, pdf)

-
-
-../../_images/barb_demo_011.png -

(png, pdf)

-
-
'''
-Demonstration of wind barb plots
-'''
-import matplotlib.pyplot as plt
-import numpy as np
-
-x = np.linspace(-5, 5, 5)
-X, Y = np.meshgrid(x, x)
-U, V = 12*X, 12*Y
-
-data = [(-1.5, .5, -6, -6),
-        (1, -1, -46, 46),
-        (-3, -1, 11, -11),
-        (1, 1.5, 80, 80),
-        (0.5, 0.25, 25, 15),
-        (-1.5, -0.5, -5, 40)]
-
-data = np.array(data, dtype=[('x', np.float32), ('y', np.float32),
-                             ('u', np.float32), ('v', np.float32)])
-
-# Default parameters, uniform grid
-ax = plt.subplot(2, 2, 1)
-ax.barbs(X, Y, U, V)
-
-# Arbitrary set of vectors, make them longer and change the pivot point
-#(point around which they're rotated) to be the middle
-ax = plt.subplot(2, 2, 2)
-ax.barbs(data['x'], data['y'], data['u'], data['v'], length=8, pivot='middle')
-
-# Showing colormapping with uniform grid.  Fill the circle for an empty barb,
-# don't round the values, and change some of the size parameters
-ax = plt.subplot(2, 2, 3)
-ax.barbs(X, Y, U, V, np.sqrt(U*U + V*V), fill_empty=True, rounding=False,
-         sizes=dict(emptybarb=0.25, spacing=0.2, height=0.3))
-
-# Change colors as well as the increments for parts of the barbs
-ax = plt.subplot(2, 2, 4)
-ax.barbs(data['x'], data['y'], data['u'], data['v'], flagcolor='r',
-         barbcolor=['b', 'g'], barb_increments=dict(half=10, full=20, flag=100),
-         flip_barb=True)
-
-# Masked arrays are also supported
-masked_u = np.ma.masked_array(data['u'])
-masked_u[4] = 1000  # Bad value that should not be plotted when masked
-masked_u[4] = np.ma.masked
-
-# Identical plot to panel 2 in the first figure, but with the point at
-#(0.5, 0.25) missing (masked)
-fig2 = plt.figure()
-ax = fig2.add_subplot(1, 1, 1)
-ax.barbs(data['x'], data['y'], masked_u, data['v'], length=8, pivot='middle')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/barchart_demo.html b/examples/pylab_examples/barchart_demo.html deleted file mode 100644 index 718990cbf13..00000000000 --- a/examples/pylab_examples/barchart_demo.html +++ /dev/null @@ -1,367 +0,0 @@ - - - - - - - - pylab_examples example code: barchart_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: barchart_demo.py

-

(Source code, png, pdf)

-
-../../_images/barchart_demo.png -
-
"""
-Bar chart demo with pairs of bars grouped for easy comparison.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-n_groups = 5
-
-means_men = (20, 35, 30, 35, 27)
-std_men = (2, 3, 4, 1, 2)
-
-means_women = (25, 32, 34, 20, 25)
-std_women = (3, 5, 2, 3, 3)
-
-fig, ax = plt.subplots()
-
-index = np.arange(n_groups)
-bar_width = 0.35
-
-opacity = 0.4
-error_config = {'ecolor': '0.3'}
-
-rects1 = plt.bar(index, means_men, bar_width,
-                 alpha=opacity,
-                 color='b',
-                 yerr=std_men,
-                 error_kw=error_config,
-                 label='Men')
-
-rects2 = plt.bar(index + bar_width, means_women, bar_width,
-                 alpha=opacity,
-                 color='r',
-                 yerr=std_women,
-                 error_kw=error_config,
-                 label='Women')
-
-plt.xlabel('Group')
-plt.ylabel('Scores')
-plt.title('Scores by group and gender')
-plt.xticks(index + bar_width / 2, ('A', 'B', 'C', 'D', 'E'))
-plt.legend()
-
-plt.tight_layout()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/barchart_demo2.html b/examples/pylab_examples/barchart_demo2.html deleted file mode 100644 index cdb228770af..00000000000 --- a/examples/pylab_examples/barchart_demo2.html +++ /dev/null @@ -1,485 +0,0 @@ - - - - - - - - pylab_examples example code: barchart_demo2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: barchart_demo2.py

-

(Source code, png, pdf)

-
-../../_images/barchart_demo2.png -
-
"""
-Thanks Josh Hemann for the example
-
-This examples comes from an application in which grade school gym
-teachers wanted to be able to show parents how their child did across
-a handful of fitness tests, and importantly, relative to how other
-children did. To extract the plotting code for demo purposes, we'll
-just make up some data for little Johnny Doe...
-
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.ticker import MaxNLocator
-from collections import namedtuple
-
-Student = namedtuple('Student', ['name', 'grade', 'gender'])
-Score = namedtuple('Score', ['score', 'percentile'])
-
-# GLOBAL CONSTANTS
-testNames = ['Pacer Test', 'Flexed Arm\n Hang', 'Mile Run', 'Agility',
-             'Push Ups']
-testMeta = dict(zip(testNames, ['laps', 'sec', 'min:sec', 'sec', '']))
-
-
-def attach_ordinal(num):
-    """helper function to add ordinal string to integers
-
-    1 -> 1st
-    56 -> 56th
-    """
-    suffixes = dict((str(i), v) for i, v in
-                    enumerate(['th', 'st', 'nd', 'rd', 'th',
-                               'th', 'th', 'th', 'th', 'th']))
-
-    v = str(num)
-    # special case early teens
-    if v in {'11', '12', '13'}:
-        return v + 'th'
-    return v + suffixes[v[-1]]
-
-
-def format_score(scr, test):
-    """
-    Build up the score labels for the right Y-axis by first
-    appending a carriage return to each string and then tacking on
-    the appropriate meta information (i.e., 'laps' vs 'seconds'). We
-    want the labels centered on the ticks, so if there is no meta
-    info (like for pushups) then don't add the carriage return to
-    the string
-    """
-    md = testMeta[test]
-    if md:
-        return '{0}\n{1}'.format(scr, md)
-    else:
-        return scr
-
-
-def format_ycursor(y):
-    y = int(y)
-    if y < 0 or y >= len(testNames):
-        return ''
-    else:
-        return testNames[y]
-
-
-def plot_student_results(student, scores, cohort_size):
-    #  create the figure
-    fig, ax1 = plt.subplots(figsize=(9, 7))
-    fig.subplots_adjust(left=0.115, right=0.88)
-    fig.canvas.set_window_title('Eldorado K-8 Fitness Chart')
-
-    pos = np.arange(len(testNames))
-
-    rects = ax1.barh(pos, [scores[k].percentile for k in testNames],
-                     align='center',
-                     height=0.5, color='m',
-                     tick_label=testNames)
-
-    ax1.set_title(student.name)
-
-    ax1.set_xlim([0, 100])
-    ax1.xaxis.set_major_locator(MaxNLocator(11))
-    ax1.xaxis.grid(True, linestyle='--', which='major',
-                   color='grey', alpha=.25)
-
-    # Plot a solid vertical gridline to highlight the median position
-    ax1.axvline(50, color='grey', alpha=0.25)
-    # set X-axis tick marks at the deciles
-    cohort_label = ax1.text(.5, -.07, 'Cohort Size: {0}'.format(cohort_size),
-                            horizontalalignment='center', size='small',
-                            transform=ax1.transAxes)
-
-    # Set the right-hand Y-axis ticks and labels
-    ax2 = ax1.twinx()
-
-    scoreLabels = [format_score(scores[k].score, k) for k in testNames]
-
-    # set the tick locations
-    ax2.set_yticks(pos)
-    # make sure that the limits are set equally on both yaxis so the
-    # ticks line up
-    ax2.set_ylim(ax1.get_ylim())
-
-    # set the tick labels
-    ax2.set_yticklabels(scoreLabels)
-
-    ax2.set_ylabel('Test Scores')
-
-    ax2.set_xlabel(('Percentile Ranking Across '
-                    '{grade} Grade {gender}s').format(
-                        grade=attach_ordinal(student.grade),
-                        gender=student.gender.title()))
-
-    rect_labels = []
-    # Lastly, write in the ranking inside each bar to aid in interpretation
-    for rect in rects:
-        # Rectangle widths are already integer-valued but are floating
-        # type, so it helps to remove the trailing decimal point and 0 by
-        # converting width to int type
-        width = int(rect.get_width())
-
-        rankStr = attach_ordinal(width)
-        # The bars aren't wide enough to print the ranking inside
-        if (width < 5):
-            # Shift the text to the right side of the right edge
-            xloc = width + 1
-            # Black against white background
-            clr = 'black'
-            align = 'left'
-        else:
-            # Shift the text to the left side of the right edge
-            xloc = 0.98*width
-            # White on magenta
-            clr = 'white'
-            align = 'right'
-
-        # Center the text vertically in the bar
-        yloc = rect.get_y() + rect.get_height()/2.0
-        label = ax1.text(xloc, yloc, rankStr, horizontalalignment=align,
-                         verticalalignment='center', color=clr, weight='bold',
-                         clip_on=True)
-        rect_labels.append(label)
-
-    # make the interactive mouse over give the bar title
-    ax2.fmt_ydata = format_ycursor
-    # return all of the artists created
-    return {'fig': fig,
-            'ax': ax1,
-            'ax_right': ax2,
-            'bars': rects,
-            'perc_labels': rect_labels,
-            'cohort_label': cohort_label}
-
-student = Student('Johnny Doe', 2, 'boy')
-scores = dict(zip(testNames,
-                  (Score(v, p) for v, p in
-                   zip(['7', '48', '12:52', '17', '14'],
-                       np.round(np.random.uniform(0, 1,
-                                                  len(testNames))*100, 0)))))
-cohort_size = 62  # The number of other 2nd grade boys
-
-arts = plot_student_results(student, scores, cohort_size)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/barcode_demo.html b/examples/pylab_examples/barcode_demo.html deleted file mode 100644 index a6b7be21060..00000000000 --- a/examples/pylab_examples/barcode_demo.html +++ /dev/null @@ -1,346 +0,0 @@ - - - - - - - - pylab_examples example code: barcode_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: barcode_demo.py

-

(Source code, png, pdf)

-
-../../_images/barcode_demo.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-
-# the bar
-x = np.where(np.random.rand(500) > 0.7, 1.0, 0.0)
-
-axprops = dict(xticks=[], yticks=[])
-barprops = dict(aspect='auto', cmap=plt.cm.binary, interpolation='nearest')
-
-fig = plt.figure()
-
-# a vertical barcode -- this is broken at present
-x.shape = len(x), 1
-ax = fig.add_axes([0.1, 0.3, 0.1, 0.6], **axprops)
-ax.imshow(x, **barprops)
-
-x = x.copy()
-# a horizontal barcode
-x.shape = 1, len(x)
-ax = fig.add_axes([0.3, 0.1, 0.6, 0.1], **axprops)
-ax.imshow(x, **barprops)
-
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/boxplot_demo.html b/examples/pylab_examples/boxplot_demo.html deleted file mode 100644 index d572b6a089d..00000000000 --- a/examples/pylab_examples/boxplot_demo.html +++ /dev/null @@ -1,399 +0,0 @@ - - - - - - - - pylab_examples example code: boxplot_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: boxplot_demo.py

-

(Source code)

-
-../../_images/boxplot_demo_00.png -

(png, pdf)

-
-
-../../_images/boxplot_demo_01.png -

(png, pdf)

-
-
-../../_images/boxplot_demo_02.png -

(png, pdf)

-
-
-../../_images/boxplot_demo_03.png -

(png, pdf)

-
-
-../../_images/boxplot_demo_04.png -

(png, pdf)

-
-
-../../_images/boxplot_demo_05.png -

(png, pdf)

-
-
-../../_images/boxplot_demo_06.png -

(png, pdf)

-
-
import matplotlib.pyplot as plt
-import numpy as np
-
-# fake up some data
-spread = np.random.rand(50) * 100
-center = np.ones(25) * 50
-flier_high = np.random.rand(10) * 100 + 100
-flier_low = np.random.rand(10) * -100
-data = np.concatenate((spread, center, flier_high, flier_low), 0)
-
-# basic plot
-plt.boxplot(data)
-
-# notched plot
-plt.figure()
-plt.boxplot(data, 1)
-
-# change outlier point symbols
-plt.figure()
-plt.boxplot(data, 0, 'gD')
-
-# don't show outlier points
-plt.figure()
-plt.boxplot(data, 0, '')
-
-# horizontal boxes
-plt.figure()
-plt.boxplot(data, 0, 'rs', 0)
-
-# change whisker length
-plt.figure()
-plt.boxplot(data, 0, 'rs', 0, 0.75)
-
-# fake up some more data
-spread = np.random.rand(50) * 100
-center = np.ones(25) * 40
-flier_high = np.random.rand(10) * 100 + 100
-flier_low = np.random.rand(10) * -100
-d2 = np.concatenate((spread, center, flier_high, flier_low), 0)
-data.shape = (-1, 1)
-d2.shape = (-1, 1)
-# data = concatenate( (data, d2), 1 )
-# Making a 2-D array only works if all the columns are the
-# same length.  If they are not, then use a list instead.
-# This is actually more efficient because boxplot converts
-# a 2-D array into a list of vectors internally anyway.
-data = [data, d2, d2[::2, 0]]
-# multiple box plots on one figure
-plt.figure()
-plt.boxplot(data)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/boxplot_demo2.html b/examples/pylab_examples/boxplot_demo2.html deleted file mode 100644 index 4b0007fe1a3..00000000000 --- a/examples/pylab_examples/boxplot_demo2.html +++ /dev/null @@ -1,443 +0,0 @@ - - - - - - - - pylab_examples example code: boxplot_demo2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: boxplot_demo2.py

-

(Source code, png, pdf)

-
-../../_images/boxplot_demo2.png -
-
"""
-Thanks Josh Hemann for the example
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.patches import Polygon
-
-
-# Generate some data from five different probability distributions,
-# each with different characteristics. We want to play with how an IID
-# bootstrap resample of the data preserves the distributional
-# properties of the original sample, and a boxplot is one visual tool
-# to make this assessment
-numDists = 5
-randomDists = ['Normal(1,1)', ' Lognormal(1,1)', 'Exp(1)', 'Gumbel(6,4)',
-               'Triangular(2,9,11)']
-N = 500
-np.random.seed(0)
-norm = np.random.normal(1, 1, N)
-logn = np.random.lognormal(1, 1, N)
-expo = np.random.exponential(1, N)
-gumb = np.random.gumbel(6, 4, N)
-tria = np.random.triangular(2, 9, 11, N)
-
-# Generate some random indices that we'll use to resample the original data
-# arrays. For code brevity, just use the same random indices for each array
-bootstrapIndices = np.random.random_integers(0, N - 1, N)
-normBoot = norm[bootstrapIndices]
-expoBoot = expo[bootstrapIndices]
-gumbBoot = gumb[bootstrapIndices]
-lognBoot = logn[bootstrapIndices]
-triaBoot = tria[bootstrapIndices]
-
-data = [norm, normBoot, logn, lognBoot, expo, expoBoot, gumb, gumbBoot,
-        tria, triaBoot]
-
-fig, ax1 = plt.subplots(figsize=(10, 6))
-fig.canvas.set_window_title('A Boxplot Example')
-plt.subplots_adjust(left=0.075, right=0.95, top=0.9, bottom=0.25)
-
-bp = plt.boxplot(data, notch=0, sym='+', vert=1, whis=1.5)
-plt.setp(bp['boxes'], color='black')
-plt.setp(bp['whiskers'], color='black')
-plt.setp(bp['fliers'], color='red', marker='+')
-
-# Add a horizontal grid to the plot, but make it very light in color
-# so we can use it for reading data values but not be distracting
-ax1.yaxis.grid(True, linestyle='-', which='major', color='lightgrey',
-               alpha=0.5)
-
-# Hide these grid behind plot objects
-ax1.set_axisbelow(True)
-ax1.set_title('Comparison of IID Bootstrap Resampling Across Five Distributions')
-ax1.set_xlabel('Distribution')
-ax1.set_ylabel('Value')
-
-# Now fill the boxes with desired colors
-boxColors = ['darkkhaki', 'royalblue']
-numBoxes = numDists*2
-medians = list(range(numBoxes))
-for i in range(numBoxes):
-    box = bp['boxes'][i]
-    boxX = []
-    boxY = []
-    for j in range(5):
-        boxX.append(box.get_xdata()[j])
-        boxY.append(box.get_ydata()[j])
-    boxCoords = list(zip(boxX, boxY))
-    # Alternate between Dark Khaki and Royal Blue
-    k = i % 2
-    boxPolygon = Polygon(boxCoords, facecolor=boxColors[k])
-    ax1.add_patch(boxPolygon)
-    # Now draw the median lines back over what we just filled in
-    med = bp['medians'][i]
-    medianX = []
-    medianY = []
-    for j in range(2):
-        medianX.append(med.get_xdata()[j])
-        medianY.append(med.get_ydata()[j])
-        plt.plot(medianX, medianY, 'k')
-        medians[i] = medianY[0]
-    # Finally, overplot the sample averages, with horizontal alignment
-    # in the center of each box
-    plt.plot([np.average(med.get_xdata())], [np.average(data[i])],
-             color='w', marker='*', markeredgecolor='k')
-
-# Set the axes ranges and axes labels
-ax1.set_xlim(0.5, numBoxes + 0.5)
-top = 40
-bottom = -5
-ax1.set_ylim(bottom, top)
-xtickNames = plt.setp(ax1, xticklabels=np.repeat(randomDists, 2))
-plt.setp(xtickNames, rotation=45, fontsize=8)
-
-# Due to the Y-axis scale being different across samples, it can be
-# hard to compare differences in medians across the samples. Add upper
-# X-axis tick labels with the sample medians to aid in comparison
-# (just use two decimal places of precision)
-pos = np.arange(numBoxes) + 1
-upperLabels = [str(np.round(s, 2)) for s in medians]
-weights = ['bold', 'semibold']
-for tick, label in zip(range(numBoxes), ax1.get_xticklabels()):
-    k = tick % 2
-    ax1.text(pos[tick], top - (top*0.05), upperLabels[tick],
-             horizontalalignment='center', size='x-small', weight=weights[k],
-             color=boxColors[k])
-
-# Finally, add a basic legend
-plt.figtext(0.80, 0.08, str(N) + ' Random Numbers',
-            backgroundcolor=boxColors[0], color='black', weight='roman',
-            size='x-small')
-plt.figtext(0.80, 0.045, 'IID Bootstrap Resample',
-            backgroundcolor=boxColors[1],
-            color='white', weight='roman', size='x-small')
-plt.figtext(0.80, 0.015, '*', color='white', backgroundcolor='silver',
-            weight='roman', size='medium')
-plt.figtext(0.815, 0.013, ' Average Value', color='black', weight='roman',
-            size='x-small')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/boxplot_demo3.html b/examples/pylab_examples/boxplot_demo3.html deleted file mode 100644 index facc17a6b55..00000000000 --- a/examples/pylab_examples/boxplot_demo3.html +++ /dev/null @@ -1,369 +0,0 @@ - - - - - - - - pylab_examples example code: boxplot_demo3.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: boxplot_demo3.py

-

(Source code, png, pdf)

-
-../../_images/boxplot_demo3.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-
-
-def fakeBootStrapper(n):
-    '''
-    This is just a placeholder for the user's method of
-    bootstrapping the median and its confidence intervals.
-
-    Returns an arbitrary median and confidence intervals
-    packed into a tuple
-    '''
-    if n == 1:
-        med = 0.1
-        CI = (-0.25, 0.25)
-    else:
-        med = 0.2
-        CI = (-0.35, 0.50)
-
-    return med, CI
-
-
-np.random.seed(2)
-inc = 0.1
-e1 = np.random.normal(0, 1, size=(500,))
-e2 = np.random.normal(0, 1, size=(500,))
-e3 = np.random.normal(0, 1 + inc, size=(500,))
-e4 = np.random.normal(0, 1 + 2*inc, size=(500,))
-
-treatments = [e1, e2, e3, e4]
-med1, CI1 = fakeBootStrapper(1)
-med2, CI2 = fakeBootStrapper(2)
-medians = [None, None, med1, med2]
-conf_intervals = [None, None, CI1, CI2]
-
-fig, ax = plt.subplots()
-pos = np.array(range(len(treatments))) + 1
-bp = ax.boxplot(treatments, sym='k+', positions=pos,
-                notch=1, bootstrap=5000,
-                usermedians=medians,
-                conf_intervals=conf_intervals)
-
-ax.set_xlabel('treatment')
-ax.set_ylabel('response')
-plt.setp(bp['whiskers'], color='k', linestyle='-')
-plt.setp(bp['fliers'], markersize=3.0)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/break.html b/examples/pylab_examples/break.html deleted file mode 100644 index 43ab79b8c69..00000000000 --- a/examples/pylab_examples/break.html +++ /dev/null @@ -1,332 +0,0 @@ - - - - - - - - pylab_examples example code: break.py — Matplotlib 1.5.3 documentation - - - - - - - - - - - - - - - - - - -
-

Matplotlib 2.0.0rc2 is available

- -

Install the release candidate now!

- -
- - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: break.py

-

(Source code, png, hires.png, pdf)

-
-../../_images/break.png -
-
import matplotlib.pyplot as plt
-
-plt.gcf().text(0.5, 0.95, 'Distance Histograms by Category is \
-    a really long title')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/broken_axis.html b/examples/pylab_examples/broken_axis.html deleted file mode 100644 index df67697b0c9..00000000000 --- a/examples/pylab_examples/broken_axis.html +++ /dev/null @@ -1,383 +0,0 @@ - - - - - - - - pylab_examples example code: broken_axis.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: broken_axis.py

-

(Source code, png, pdf)

-
-../../_images/broken_axis.png -
-
"""
-Broken axis example, where the y-axis will have a portion cut out.
-"""
-import matplotlib.pyplot as plt
-import numpy as np
-
-
-# 30 points between [0, 0.2) originally made using np.random.rand(30)*.2
-pts = np.array([
-    0.015, 0.166, 0.133, 0.159, 0.041, 0.024, 0.195, 0.039, 0.161, 0.018,
-    0.143, 0.056, 0.125, 0.096, 0.094, 0.051, 0.043, 0.021, 0.138, 0.075,
-    0.109, 0.195, 0.050, 0.074, 0.079, 0.155, 0.020, 0.010, 0.061, 0.008])
-
-# Now let's make two outlier points which are far away from everything.
-pts[[3, 14]] += .8
-
-# If we were to simply plot pts, we'd lose most of the interesting
-# details due to the outliers. So let's 'break' or 'cut-out' the y-axis
-# into two portions - use the top (ax) for the outliers, and the bottom
-# (ax2) for the details of the majority of our data
-f, (ax, ax2) = plt.subplots(2, 1, sharex=True)
-
-# plot the same data on both axes
-ax.plot(pts)
-ax2.plot(pts)
-
-# zoom-in / limit the view to different portions of the data
-ax.set_ylim(.78, 1.)  # outliers only
-ax2.set_ylim(0, .22)  # most of the data
-
-# hide the spines between ax and ax2
-ax.spines['bottom'].set_visible(False)
-ax2.spines['top'].set_visible(False)
-ax.xaxis.tick_top()
-ax.tick_params(labeltop='off')  # don't put tick labels at the top
-ax2.xaxis.tick_bottom()
-
-# This looks pretty good, and was fairly painless, but you can get that
-# cut-out diagonal lines look with just a bit more work. The important
-# thing to know here is that in axes coordinates, which are always
-# between 0-1, spine endpoints are at these locations (0,0), (0,1),
-# (1,0), and (1,1).  Thus, we just need to put the diagonals in the
-# appropriate corners of each of our axes, and so long as we use the
-# right transform and disable clipping.
-
-d = .015  # how big to make the diagonal lines in axes coordinates
-# arguments to pass to plot, just so we don't keep repeating them
-kwargs = dict(transform=ax.transAxes, color='k', clip_on=False)
-ax.plot((-d, +d), (-d, +d), **kwargs)        # top-left diagonal
-ax.plot((1 - d, 1 + d), (-d, +d), **kwargs)  # top-right diagonal
-
-kwargs.update(transform=ax2.transAxes)  # switch to the bottom axes
-ax2.plot((-d, +d), (1 - d, 1 + d), **kwargs)  # bottom-left diagonal
-ax2.plot((1 - d, 1 + d), (1 - d, 1 + d), **kwargs)  # bottom-right diagonal
-
-# What's cool about this is that now if we vary the distance between
-# ax and ax2 via f.subplots_adjust(hspace=...) or plt.subplot_tool(),
-# the diagonal lines will move accordingly, and stay right at the tips
-# of the spines they are 'breaking'
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/broken_barh.html b/examples/pylab_examples/broken_barh.html deleted file mode 100644 index a001dc47943..00000000000 --- a/examples/pylab_examples/broken_barh.html +++ /dev/null @@ -1,344 +0,0 @@ - - - - - - - - pylab_examples example code: broken_barh.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: broken_barh.py

-

(Source code, png, pdf)

-
-../../_images/broken_barh1.png -
-
"""
-Make a "broken" horizontal bar plot, i.e., one with gaps
-"""
-import matplotlib.pyplot as plt
-
-fig, ax = plt.subplots()
-ax.broken_barh([(110, 30), (150, 10)], (10, 9), facecolors='blue')
-ax.broken_barh([(10, 50), (100, 20), (130, 10)], (20, 9),
-               facecolors=('red', 'yellow', 'green'))
-ax.set_ylim(5, 35)
-ax.set_xlim(0, 200)
-ax.set_xlabel('seconds since start')
-ax.set_yticks([15, 25])
-ax.set_yticklabels(['Bill', 'Jim'])
-ax.grid(True)
-ax.annotate('race interrupted', (61, 25),
-            xytext=(0.8, 0.9), textcoords='axes fraction',
-            arrowprops=dict(facecolor='black', shrink=0.05),
-            fontsize=16,
-            horizontalalignment='right', verticalalignment='top')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/centered_ticklabels.html b/examples/pylab_examples/centered_ticklabels.html deleted file mode 100644 index ad1da834184..00000000000 --- a/examples/pylab_examples/centered_ticklabels.html +++ /dev/null @@ -1,372 +0,0 @@ - - - - - - - - pylab_examples example code: centered_ticklabels.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: centered_ticklabels.py

-

(Source code, png, pdf)

-
-../../_images/centered_ticklabels.png -
-
# sometimes it is nice to have ticklabels centered.  mpl currently
-# associates a label with a tick, and the label can be aligned
-# 'center', 'left', or 'right' using the horizontal alignment property:
-#
-#
-#   for label in ax.xaxis.get_xticklabels():
-#       label.set_horizontalalignment('right')
-#
-#
-# but this doesn't help center the label between ticks.  One solution
-# is to "face it".  Use the minor ticks to place a tick centered
-# between the major ticks.  Here is an example that labels the months,
-# centered between the ticks
-
-import numpy as np
-import matplotlib.cbook as cbook
-import matplotlib.dates as dates
-import matplotlib.ticker as ticker
-import matplotlib.pyplot as plt
-
-# load some financial data; apple's stock price
-fh = cbook.get_sample_data('aapl.npy.gz')
-try:
-    # Python3 cannot load python2 .npy files with datetime(object) arrays
-    # unless the encoding is set to bytes. However this option was
-    # not added until numpy 1.10 so this example will only work with
-    # python 2 or with numpy 1.10 and later.
-    r = np.load(fh, encoding='bytes')
-except TypeError:
-    r = np.load(fh)
-fh.close()
-r = r[-250:]  # get the last 250 days
-
-fig, ax = plt.subplots()
-ax.plot(r.date, r.adj_close)
-
-ax.xaxis.set_major_locator(dates.MonthLocator())
-ax.xaxis.set_minor_locator(dates.MonthLocator(bymonthday=15))
-
-ax.xaxis.set_major_formatter(ticker.NullFormatter())
-ax.xaxis.set_minor_formatter(dates.DateFormatter('%b'))
-
-for tick in ax.xaxis.get_minor_ticks():
-    tick.tick1line.set_markersize(0)
-    tick.tick2line.set_markersize(0)
-    tick.label1.set_horizontalalignment('center')
-
-imid = len(r)//2
-ax.set_xlabel(str(r.date[imid].year))
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/clippedline.html b/examples/pylab_examples/clippedline.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/pylab_examples/clippedline.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/pylab_examples/cohere_demo.html b/examples/pylab_examples/cohere_demo.html deleted file mode 100644 index e2f65bc8870..00000000000 --- a/examples/pylab_examples/cohere_demo.html +++ /dev/null @@ -1,355 +0,0 @@ - - - - - - - - pylab_examples example code: cohere_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: cohere_demo.py

-

(Source code, png, pdf)

-
-../../_images/cohere_demo1.png -
-
"""
-Compute the coherence of two signals
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-# make a little extra space between the subplots
-plt.subplots_adjust(wspace=0.5)
-
-dt = 0.01
-t = np.arange(0, 30, dt)
-nse1 = np.random.randn(len(t))                 # white noise 1
-nse2 = np.random.randn(len(t))                 # white noise 2
-r = np.exp(-t/0.05)
-
-cnse1 = np.convolve(nse1, r, mode='same')*dt   # colored noise 1
-cnse2 = np.convolve(nse2, r, mode='same')*dt   # colored noise 2
-
-# two signals with a coherent part and a random part
-s1 = 0.01*np.sin(2*np.pi*10*t) + cnse1
-s2 = 0.01*np.sin(2*np.pi*10*t) + cnse2
-
-plt.subplot(211)
-plt.plot(t, s1, t, s2)
-plt.xlim(0, 5)
-plt.xlabel('time')
-plt.ylabel('s1 and s2')
-plt.grid(True)
-
-plt.subplot(212)
-cxy, f = plt.cohere(s1, s2, 256, 1./dt)
-plt.ylabel('coherence')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/color_by_yvalue.html b/examples/pylab_examples/color_by_yvalue.html deleted file mode 100644 index 5e3330309ac..00000000000 --- a/examples/pylab_examples/color_by_yvalue.html +++ /dev/null @@ -1,339 +0,0 @@ - - - - - - - - pylab_examples example code: color_by_yvalue.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: color_by_yvalue.py

-

(Source code, png, pdf)

-
-../../_images/color_by_yvalue.png -
-
# use masked arrays to plot a line with different colors by y-value
-import numpy as np
-import matplotlib.pyplot as plt
-
-t = np.arange(0.0, 2.0, 0.01)
-s = np.sin(2*np.pi*t)
-
-upper = 0.77
-lower = -0.77
-
-
-supper = np.ma.masked_where(s < upper, s)
-slower = np.ma.masked_where(s > lower, s)
-smiddle = np.ma.masked_where(np.logical_or(s < lower, s > upper), s)
-
-plt.plot(t, smiddle, t, slower, t, supper)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/color_demo.html b/examples/pylab_examples/color_demo.html deleted file mode 100644 index 1df78d67370..00000000000 --- a/examples/pylab_examples/color_demo.html +++ /dev/null @@ -1,351 +0,0 @@ - - - - - - - - pylab_examples example code: color_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: color_demo.py

-

(Source code, png, pdf)

-
-../../_images/color_demo.png -
-
"""
-matplotlib gives you 5 ways to specify colors,
-
-    1) as a single letter string, ala MATLAB
-
-    2) as an html style hex string or html color name
-
-    3) as an R,G,B tuple, where R,G,B, range from 0-1
-
-    4) as a string representing a floating point number
-       from 0 to 1, corresponding to shades of gray.
-
-    5) as a special color "Cn", where n is a number 0-9 specifying the
-       nth color in the currently active color cycle.
-
-See help(colors) for more info.
-"""
-import matplotlib.pyplot as plt
-import numpy as np
-
-plt.subplot(111, facecolor='darkslategray')
-#subplot(111, facecolor='#ababab')
-t = np.arange(0.0, 2.0, 0.01)
-s = np.sin(2*np.pi*t)
-plt.plot(t, s, 'C1')
-plt.xlabel('time (s)', color='C1')
-plt.ylabel('voltage (mV)', color='0.5')  # grayscale color
-plt.title('About as silly as it gets, folks', color='#afeeee')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/colorbar_tick_labelling_demo.html b/examples/pylab_examples/colorbar_tick_labelling_demo.html deleted file mode 100644 index 67e9bb9c7fe..00000000000 --- a/examples/pylab_examples/colorbar_tick_labelling_demo.html +++ /dev/null @@ -1,361 +0,0 @@ - - - - - - - - pylab_examples example code: colorbar_tick_labelling_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: colorbar_tick_labelling_demo.py

-

(Source code)

-
-../../_images/colorbar_tick_labelling_demo_00.png -

(png, pdf)

-
-
-../../_images/colorbar_tick_labelling_demo_01.png -

(png, pdf)

-
-
"""Produce custom labelling for a colorbar.
-
-Contributed by Scott Sinclair
-"""
-
-import matplotlib.pyplot as plt
-import numpy as np
-from matplotlib import cm
-from numpy.random import randn
-
-# Make plot with vertical (default) colorbar
-fig, ax = plt.subplots()
-
-data = np.clip(randn(250, 250), -1, 1)
-
-cax = ax.imshow(data, interpolation='nearest', cmap=cm.coolwarm)
-ax.set_title('Gaussian noise with vertical colorbar')
-
-# Add colorbar, make sure to specify tick locations to match desired ticklabels
-cbar = fig.colorbar(cax, ticks=[-1, 0, 1])
-cbar.ax.set_yticklabels(['< -1', '0', '> 1'])  # vertically oriented colorbar
-
-# Make plot with horizontal colorbar
-fig, ax = plt.subplots()
-
-data = np.clip(randn(250, 250), -1, 1)
-
-cax = ax.imshow(data, interpolation='nearest', cmap=cm.afmhot)
-ax.set_title('Gaussian noise with horizontal colorbar')
-
-cbar = fig.colorbar(cax, ticks=[-1, 0, 1], orientation='horizontal')
-cbar.ax.set_xticklabels(['Low', 'Medium', 'High'])  # horizontal colorbar
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/colours.html b/examples/pylab_examples/colours.html deleted file mode 100644 index 5f9a05a8f8f..00000000000 --- a/examples/pylab_examples/colours.html +++ /dev/null @@ -1,370 +0,0 @@ - - - - - - - - pylab_examples example code: colours.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: colours.py

-

[source code]

-
# -*- noplot -*-
-"""
-Some simple functions to generate colours.
-"""
-import numpy as np
-from matplotlib import colors as mcolors
-
-
-def pastel(colour, weight=2.4):
-    """ Convert colour into a nice pastel shade"""
-    rgb = np.asarray(mcolors.to_rgba(colour)[:3])
-    # scale colour
-    maxc = max(rgb)
-    if maxc < 1.0 and maxc > 0:
-        # scale colour
-        scale = 1.0 / maxc
-        rgb = rgb * scale
-    # now decrease saturation
-    total = rgb.sum()
-    slack = 0
-    for x in rgb:
-        slack += 1.0 - x
-
-    # want to increase weight from total to weight
-    # pick x s.t.  slack * x == weight - total
-    # x = (weight - total) / slack
-    x = (weight - total) / slack
-
-    rgb = [c + (x * (1.0 - c)) for c in rgb]
-
-    return rgb
-
-
-def get_colours(n):
-    """ Return n pastel colours. """
-    base = np.asarray([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
-
-    if n <= 3:
-        return base[0:n]
-
-    # how many new colours to we need to insert between
-    # red and green and between green and blue?
-    needed = (((n - 3) + 1) / 2, (n - 3) / 2)
-
-    colours = []
-    for start in (0, 1):
-        for x in np.linspace(0, 1, needed[start] + 2):
-            colours.append((base[start] * (1.0 - x)) +
-                           (base[start + 1] * x))
-
-    return [pastel(c) for c in colours[0:n]]
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/colours.py b/examples/pylab_examples/colours.py deleted file mode 100644 index adcbd433131..00000000000 --- a/examples/pylab_examples/colours.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- noplot -*- -""" -Some simple functions to generate colours. -""" -import numpy as np -from matplotlib import colors as mcolors - - -def pastel(colour, weight=2.4): - """ Convert colour into a nice pastel shade""" - rgb = np.asarray(mcolors.to_rgba(colour)[:3]) - # scale colour - maxc = max(rgb) - if maxc < 1.0 and maxc > 0: - # scale colour - scale = 1.0 / maxc - rgb = rgb * scale - # now decrease saturation - total = rgb.sum() - slack = 0 - for x in rgb: - slack += 1.0 - x - - # want to increase weight from total to weight - # pick x s.t. slack * x == weight - total - # x = (weight - total) / slack - x = (weight - total) / slack - - rgb = [c + (x * (1.0 - c)) for c in rgb] - - return rgb - - -def get_colours(n): - """ Return n pastel colours. """ - base = np.asarray([[1, 0, 0], [0, 1, 0], [0, 0, 1]]) - - if n <= 3: - return base[0:n] - - # how many new colours to we need to insert between - # red and green and between green and blue? - needed = (((n - 3) + 1) / 2, (n - 3) / 2) - - colours = [] - for start in (0, 1): - for x in np.linspace(0, 1, needed[start] + 2): - colours.append((base[start] * (1.0 - x)) + - (base[start + 1] * x)) - - return [pastel(c) for c in colours[0:n]] diff --git a/examples/pylab_examples/contour_corner_mask.html b/examples/pylab_examples/contour_corner_mask.html deleted file mode 100644 index 1f1cb961744..00000000000 --- a/examples/pylab_examples/contour_corner_mask.html +++ /dev/null @@ -1,356 +0,0 @@ - - - - - - - - pylab_examples example code: contour_corner_mask.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: contour_corner_mask.py

-

(Source code, png, pdf)

-
-../../_images/contour_corner_mask1.png -
-
"""
-Illustrate the difference between corner_mask=False and corner_mask=True
-for masked contour plots.
-"""
-import matplotlib.pyplot as plt
-import numpy as np
-
-# Data to plot.
-x, y = np.meshgrid(np.arange(7), np.arange(10))
-z = np.sin(0.5*x)*np.cos(0.52*y)
-
-# Mask various z values.
-mask = np.zeros_like(z, dtype=np.bool)
-mask[2, 3:5] = True
-mask[3:5, 4] = True
-mask[7, 2] = True
-mask[5, 0] = True
-mask[0, 6] = True
-z = np.ma.array(z, mask=mask)
-
-corner_masks = [False, True]
-for i, corner_mask in enumerate(corner_masks):
-    plt.subplot(1, 2, i+1)
-    cs = plt.contourf(x, y, z, corner_mask=corner_mask)
-    plt.contour(cs, colors='k')
-    plt.title('corner_mask = {0}'.format(corner_mask))
-
-    # Plot grid.
-    plt.grid(c='k', ls='-', alpha=0.3)
-
-    # Indicate masked points with red circles.
-    plt.plot(np.ma.array(x, mask=~mask), y, 'ro')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/contour_demo.html b/examples/pylab_examples/contour_demo.html deleted file mode 100644 index 058a243b378..00000000000 --- a/examples/pylab_examples/contour_demo.html +++ /dev/null @@ -1,455 +0,0 @@ - - - - - - - - pylab_examples example code: contour_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: contour_demo.py

-

(Source code)

-
-../../_images/contour_demo_001.png -

(png, pdf)

-
-
-../../_images/contour_demo_011.png -

(png, pdf)

-
-
-../../_images/contour_demo_021.png -

(png, pdf)

-
-
-../../_images/contour_demo_031.png -

(png, pdf)

-
-
-../../_images/contour_demo_041.png -

(png, pdf)

-
-
-../../_images/contour_demo_051.png -

(png, pdf)

-
-
"""
-Illustrate simple contour plotting, contours on an image with
-a colorbar for the contours, and labelled contours.
-
-See also contour_image.py.
-"""
-import matplotlib
-import numpy as np
-import matplotlib.cm as cm
-import matplotlib.mlab as mlab
-import matplotlib.pyplot as plt
-
-matplotlib.rcParams['xtick.direction'] = 'out'
-matplotlib.rcParams['ytick.direction'] = 'out'
-
-delta = 0.025
-x = np.arange(-3.0, 3.0, delta)
-y = np.arange(-2.0, 2.0, delta)
-X, Y = np.meshgrid(x, y)
-Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
-Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
-# difference of Gaussians
-Z = 10.0 * (Z2 - Z1)
-
-
-# Create a simple contour plot with labels using default colors.  The
-# inline argument to clabel will control whether the labels are draw
-# over the line segments of the contour, removing the lines beneath
-# the label
-plt.figure()
-CS = plt.contour(X, Y, Z)
-plt.clabel(CS, inline=1, fontsize=10)
-plt.title('Simplest default with labels')
-
-
-# contour labels can be placed manually by providing list of positions
-# (in data coordinate). See ginput_manual_clabel.py for interactive
-# placement.
-plt.figure()
-CS = plt.contour(X, Y, Z)
-manual_locations = [(-1, -1.4), (-0.62, -0.7), (-2, 0.5), (1.7, 1.2), (2.0, 1.4), (2.4, 1.7)]
-plt.clabel(CS, inline=1, fontsize=10, manual=manual_locations)
-plt.title('labels at selected locations')
-
-
-# You can force all the contours to be the same color.
-plt.figure()
-CS = plt.contour(X, Y, Z, 6,
-                 colors='k',  # negative contours will be dashed by default
-                 )
-plt.clabel(CS, fontsize=9, inline=1)
-plt.title('Single color - negative contours dashed')
-
-# You can set negative contours to be solid instead of dashed:
-matplotlib.rcParams['contour.negative_linestyle'] = 'solid'
-plt.figure()
-CS = plt.contour(X, Y, Z, 6,
-                 colors='k',  # negative contours will be dashed by default
-                 )
-plt.clabel(CS, fontsize=9, inline=1)
-plt.title('Single color - negative contours solid')
-
-
-# And you can manually specify the colors of the contour
-plt.figure()
-CS = plt.contour(X, Y, Z, 6,
-                 linewidths=np.arange(.5, 4, .5),
-                 colors=('r', 'green', 'blue', (1, 1, 0), '#afeeee', '0.5')
-                 )
-plt.clabel(CS, fontsize=9, inline=1)
-plt.title('Crazy lines')
-
-
-# Or you can use a colormap to specify the colors; the default
-# colormap will be used for the contour lines
-plt.figure()
-im = plt.imshow(Z, interpolation='bilinear', origin='lower',
-                cmap=cm.gray, extent=(-3, 3, -2, 2))
-levels = np.arange(-1.2, 1.6, 0.2)
-CS = plt.contour(Z, levels,
-                 origin='lower',
-                 linewidths=2,
-                 extent=(-3, 3, -2, 2))
-
-# Thicken the zero contour.
-zc = CS.collections[6]
-plt.setp(zc, linewidth=4)
-
-plt.clabel(CS, levels[1::2],  # label every second level
-           inline=1,
-           fmt='%1.1f',
-           fontsize=14)
-
-# make a colorbar for the contour lines
-CB = plt.colorbar(CS, shrink=0.8, extend='both')
-
-plt.title('Lines with colorbar')
-#plt.hot()  # Now change the colormap for the contour lines and colorbar
-plt.flag()
-
-# We can still add a colorbar for the image, too.
-CBI = plt.colorbar(im, orientation='horizontal', shrink=0.8)
-
-# This makes the original colorbar look a bit out of place,
-# so let's improve its position.
-
-l, b, w, h = plt.gca().get_position().bounds
-ll, bb, ww, hh = CB.ax.get_position().bounds
-CB.ax.set_position([ll, b + 0.1*h, ww, h*0.8])
-
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/contour_image.html b/examples/pylab_examples/contour_image.html deleted file mode 100644 index 4d82e0b8b6c..00000000000 --- a/examples/pylab_examples/contour_image.html +++ /dev/null @@ -1,424 +0,0 @@ - - - - - - - - pylab_examples example code: contour_image.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: contour_image.py

-

(Source code, png, pdf)

-
-../../_images/contour_image.png -
-
'''
-Test combinations of contouring, filled contouring, and image plotting.
-For contour labelling, see contour_demo.py.
-
-The emphasis in this demo is on showing how to make contours register
-correctly on images, and on how to get both of them oriented as
-desired.  In particular, note the usage of the "origin" and "extent"
-keyword arguments to imshow and contour.
-'''
-import matplotlib.pyplot as plt
-import numpy as np
-from matplotlib import mlab, cm
-
-# Default delta is large because that makes it fast, and it illustrates
-# the correct registration between image and contours.
-delta = 0.5
-
-extent = (-3, 4, -4, 3)
-
-x = np.arange(-3.0, 4.001, delta)
-y = np.arange(-4.0, 3.001, delta)
-X, Y = np.meshgrid(x, y)
-Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
-Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
-Z = (Z1 - Z2) * 10
-
-levels = np.arange(-2.0, 1.601, 0.4)  # Boost the upper limit to avoid truncation errors.
-
-norm = cm.colors.Normalize(vmax=abs(Z).max(), vmin=-abs(Z).max())
-cmap = cm.PRGn
-
-fig = plt.figure()
-fig.subplots_adjust(hspace=0.3)
-
-
-plt.subplot(2, 2, 1)
-
-cset1 = plt.contourf(X, Y, Z, levels,
-                 cmap=cm.get_cmap(cmap, len(levels) - 1),
-                 norm=norm,
-                 )
-# It is not necessary, but for the colormap, we need only the
-# number of levels minus 1.  To avoid discretization error, use
-# either this number or a large number such as the default (256).
-
-# If we want lines as well as filled regions, we need to call
-# contour separately; don't try to change the edgecolor or edgewidth
-# of the polygons in the collections returned by contourf.
-# Use levels output from previous call to guarantee they are the same.
-
-cset2 = plt.contour(X, Y, Z, cset1.levels, colors='k')
-
-# We don't really need dashed contour lines to indicate negative
-# regions, so let's turn them off.
-
-for c in cset2.collections:
-    c.set_linestyle('solid')
-
-# It is easier here to make a separate call to contour than
-# to set up an array of colors and linewidths.
-# We are making a thick green line as a zero contour.
-# Specify the zero level as a tuple with only 0 in it.
-
-cset3 = plt.contour(X, Y, Z, (0,), colors='g', linewidths=2)
-plt.title('Filled contours')
-plt.colorbar(cset1)
-
-
-plt.subplot(2, 2, 2)
-
-plt.imshow(Z, extent=extent, cmap=cmap, norm=norm)
-v = plt.axis()
-plt.contour(Z, levels, colors='k', origin='upper', extent=extent)
-plt.axis(v)
-plt.title("Image, origin 'upper'")
-
-plt.subplot(2, 2, 3)
-
-plt.imshow(Z, origin='lower', extent=extent, cmap=cmap, norm=norm)
-v = plt.axis()
-plt.contour(Z, levels, colors='k', origin='lower', extent=extent)
-plt.axis(v)
-plt.title("Image, origin 'lower'")
-
-plt.subplot(2, 2, 4)
-
-# We will use the interpolation "nearest" here to show the actual
-# image pixels.
-# Note that the contour lines don't extend to the edge of the box.
-# This is intentional. The Z values are defined at the center of each
-# image pixel (each color block on the following subplot), so the
-# domain that is contoured does not extend beyond these pixel centers.
-im = plt.imshow(Z, interpolation='nearest', extent=extent, cmap=cmap, norm=norm)
-v = plt.axis()
-plt.contour(Z, levels, colors='k', origin='image', extent=extent)
-plt.axis(v)
-ylim = plt.get(plt.gca(), 'ylim')
-plt.setp(plt.gca(), ylim=ylim[::-1])
-plt.title("Origin from rc, reversed y-axis")
-plt.colorbar(im)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/contour_label_demo.html b/examples/pylab_examples/contour_label_demo.html deleted file mode 100644 index c040359d97b..00000000000 --- a/examples/pylab_examples/contour_label_demo.html +++ /dev/null @@ -1,417 +0,0 @@ - - - - - - - - pylab_examples example code: contour_label_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: contour_label_demo.py

-

(Source code)

-
-../../_images/contour_label_demo_00.png -

(png, pdf)

-
-
-../../_images/contour_label_demo_01.png -

(png, pdf)

-
-
-../../_images/contour_label_demo_02.png -

(png, pdf)

-
-
"""
-Illustrate some of the more advanced things that one can do with
-contour labels.
-
-See also contour_demo.py.
-"""
-import matplotlib
-import numpy as np
-import matplotlib.cm as cm
-import matplotlib.mlab as mlab
-import matplotlib.ticker as ticker
-import matplotlib.pyplot as plt
-
-matplotlib.rcParams['xtick.direction'] = 'out'
-matplotlib.rcParams['ytick.direction'] = 'out'
-
-##################################################
-# Define our surface
-##################################################
-delta = 0.025
-x = np.arange(-3.0, 3.0, delta)
-y = np.arange(-2.0, 2.0, delta)
-X, Y = np.meshgrid(x, y)
-Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
-Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
-# difference of Gaussians
-Z = 10.0 * (Z2 - Z1)
-
-##################################################
-# Make contour labels using creative float classes
-# Follows suggestion of Manuel Metz
-##################################################
-plt.figure()
-
-# Basic contour plot
-CS = plt.contour(X, Y, Z)
-
-
-# Define a class that forces representation of float to look a certain way
-# This remove trailing zero so '1.0' becomes '1'
-class nf(float):
-    def __repr__(self):
-        str = '%.1f' % (self.__float__(),)
-        if str[-1] == '0':
-            return '%.0f' % self.__float__()
-        else:
-            return '%.1f' % self.__float__()
-
-# Recast levels to new class
-CS.levels = [nf(val) for val in CS.levels]
-
-# Label levels with specially formatted floats
-if plt.rcParams["text.usetex"]:
-    fmt = r'%r \%%'
-else:
-    fmt = '%r %%'
-plt.clabel(CS, CS.levels, inline=True, fmt=fmt, fontsize=10)
-
-##################################################
-# Label contours with arbitrary strings using a
-# dictionary
-##################################################
-plt.figure()
-
-# Basic contour plot
-CS = plt.contour(X, Y, Z)
-
-fmt = {}
-strs = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh']
-for l, s in zip(CS.levels, strs):
-    fmt[l] = s
-
-# Label every other level using strings
-plt.clabel(CS, CS.levels[::2], inline=True, fmt=fmt, fontsize=10)
-
-# Use a Formatter
-
-plt.figure()
-
-CS = plt.contour(X, Y, 100**Z, locator=plt.LogLocator())
-fmt = ticker.LogFormatterMathtext()
-fmt.create_dummy_axis()
-plt.clabel(CS, CS.levels, fmt=fmt)
-plt.title("$100^Z$")
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/contourf_demo.html b/examples/pylab_examples/contourf_demo.html deleted file mode 100644 index 22fecd6dda4..00000000000 --- a/examples/pylab_examples/contourf_demo.html +++ /dev/null @@ -1,437 +0,0 @@ - - - - - - - - pylab_examples example code: contourf_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: contourf_demo.py

-

(Source code)

-
-../../_images/contourf_demo_001.png -

(png, pdf)

-
-
-../../_images/contourf_demo_011.png -

(png, pdf)

-
-
-../../_images/contourf_demo_021.png -

(png, pdf)

-
-
import numpy as np
-import matplotlib.pyplot as plt
-
-origin = 'lower'
-#origin = 'upper'
-
-delta = 0.025
-
-x = y = np.arange(-3.0, 3.01, delta)
-X, Y = np.meshgrid(x, y)
-Z1 = plt.mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
-Z2 = plt.mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
-Z = 10 * (Z1 - Z2)
-
-nr, nc = Z.shape
-
-# put NaNs in one corner:
-Z[-nr//6:, -nc//6:] = np.nan
-# contourf will convert these to masked
-
-
-Z = np.ma.array(Z)
-# mask another corner:
-Z[:nr//6, :nc//6] = np.ma.masked
-
-# mask a circle in the middle:
-interior = np.sqrt((X**2) + (Y**2)) < 0.5
-Z[interior] = np.ma.masked
-
-# We are using automatic selection of contour levels;
-# this is usually not such a good idea, because they don't
-# occur on nice boundaries, but we do it here for purposes
-# of illustration.
-CS = plt.contourf(X, Y, Z, 10,
-                  #[-1, -0.1, 0, 0.1],
-                  #alpha=0.5,
-                  cmap=plt.cm.bone,
-                  origin=origin)
-
-# Note that in the following, we explicitly pass in a subset of
-# the contour levels used for the filled contours.  Alternatively,
-# We could pass in additional levels to provide extra resolution,
-# or leave out the levels kwarg to use all of the original levels.
-
-CS2 = plt.contour(CS, levels=CS.levels[::2],
-                  colors='r',
-                  origin=origin)
-
-plt.title('Nonsense (3 masked regions)')
-plt.xlabel('word length anomaly')
-plt.ylabel('sentence length anomaly')
-
-# Make a colorbar for the ContourSet returned by the contourf call.
-cbar = plt.colorbar(CS)
-cbar.ax.set_ylabel('verbosity coefficient')
-# Add the contour line levels to the colorbar
-cbar.add_lines(CS2)
-
-plt.figure()
-
-# Now make a contour plot with the levels specified,
-# and with the colormap generated automatically from a list
-# of colors.
-levels = [-1.5, -1, -0.5, 0, 0.5, 1]
-CS3 = plt.contourf(X, Y, Z, levels,
-                   colors=('r', 'g', 'b'),
-                   origin=origin,
-                   extend='both')
-# Our data range extends outside the range of levels; make
-# data below the lowest contour level yellow, and above the
-# highest level cyan:
-CS3.cmap.set_under('yellow')
-CS3.cmap.set_over('cyan')
-
-CS4 = plt.contour(X, Y, Z, levels,
-                  colors=('k',),
-                  linewidths=(3,),
-                  origin=origin)
-plt.title('Listed colors (3 masked regions)')
-plt.clabel(CS4, fmt='%2.1f', colors='w', fontsize=14)
-
-# Notice that the colorbar command gets all the information it
-# needs from the ContourSet object, CS3.
-plt.colorbar(CS3)
-
-# Illustrate all 4 possible "extend" settings:
-extends = ["neither", "both", "min", "max"]
-cmap = plt.cm.get_cmap("winter")
-cmap.set_under("magenta")
-cmap.set_over("yellow")
-# Note: contouring simply excludes masked or nan regions, so
-# instead of using the "bad" colormap value for them, it draws
-# nothing at all in them.  Therefore the following would have
-# no effect:
-# cmap.set_bad("red")
-
-fig, axs = plt.subplots(2, 2)
-fig.subplots_adjust(hspace=0.3)
-
-for ax, extend in zip(axs.ravel(), extends):
-    cs = ax.contourf(X, Y, Z, levels, cmap=cmap, extend=extend, origin=origin)
-    fig.colorbar(cs, ax=ax, shrink=0.9)
-    ax.set_title("extend = %s" % extend)
-    ax.locator_params(nbins=4)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/contourf_hatching.html b/examples/pylab_examples/contourf_hatching.html deleted file mode 100644 index c0abcd0e680..00000000000 --- a/examples/pylab_examples/contourf_hatching.html +++ /dev/null @@ -1,371 +0,0 @@ - - - - - - - - pylab_examples example code: contourf_hatching.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: contourf_hatching.py

-

(Source code)

-
-../../_images/contourf_hatching_00.png -

(png, pdf)

-
-
-../../_images/contourf_hatching_01.png -

(png, pdf)

-
-
import matplotlib.pyplot as plt
-import numpy as np
-
-
-# invent some numbers, turning the x and y arrays into simple
-# 2d arrays, which make combining them together easier.
-x = np.linspace(-3, 5, 150).reshape(1, -1)
-y = np.linspace(-3, 5, 120).reshape(-1, 1)
-z = np.cos(x) + np.sin(y)
-
-# we no longer need x and y to be 2 dimensional, so flatten them.
-x, y = x.flatten(), y.flatten()
-
-
-# ---------------------------------------------
-# |                 Plot #1                   |
-# ---------------------------------------------
-# the simplest hatched plot with a colorbar
-fig = plt.figure()
-cs = plt.contourf(x, y, z, hatches=['-', '/', '\\', '//'],
-                  cmap=plt.get_cmap('gray'),
-                  extend='both', alpha=0.5
-                  )
-plt.colorbar()
-
-
-# ---------------------------------------------
-# |                 Plot #2                   |
-# ---------------------------------------------
-# a plot of hatches without color with a legend
-plt.figure()
-n_levels = 6
-plt.contour(x, y, z, n_levels, colors='black', linestyles='-')
-cs = plt.contourf(x, y, z, n_levels, colors='none',
-                  hatches=['.', '/', '\\', None, '\\\\', '*'],
-                  extend='lower'
-                  )
-
-# create a legend for the contour set
-artists, labels = cs.legend_elements()
-plt.legend(artists, labels, handleheight=2)
-
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/contourf_log.html b/examples/pylab_examples/contourf_log.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/pylab_examples/contourf_log.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/pylab_examples/coords_demo.html b/examples/pylab_examples/coords_demo.html deleted file mode 100644 index 2044bb8ad23..00000000000 --- a/examples/pylab_examples/coords_demo.html +++ /dev/null @@ -1,361 +0,0 @@ - - - - - - - - pylab_examples example code: coords_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: coords_demo.py

-

(Source code, png, pdf)

-
-../../_images/coords_demo.png -
-
"""
-An example of how to interact with the plotting canvas by connecting
-to move and click events
-"""
-from __future__ import print_function
-import sys
-import matplotlib.pyplot as plt
-import numpy as np
-
-t = np.arange(0.0, 1.0, 0.01)
-s = np.sin(2*np.pi*t)
-fig, ax = plt.subplots()
-ax.plot(t, s)
-
-
-def on_move(event):
-    # get the x and y pixel coords
-    x, y = event.x, event.y
-
-    if event.inaxes:
-        ax = event.inaxes  # the axes instance
-        print('data coords %f %f' % (event.xdata, event.ydata))
-
-
-def on_click(event):
-    # get the x and y coords, flip y from top to bottom
-    x, y = event.x, event.y
-    if event.button == 1:
-        if event.inaxes is not None:
-            print('data coords %f %f' % (event.xdata, event.ydata))
-
-binding_id = plt.connect('motion_notify_event', on_move)
-plt.connect('button_press_event', on_click)
-
-if "test_disconnect" in sys.argv:
-    print("disconnecting console coordinate printout...")
-    plt.disconnect(binding_id)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/coords_report.html b/examples/pylab_examples/coords_report.html deleted file mode 100644 index 696b7a278e8..00000000000 --- a/examples/pylab_examples/coords_report.html +++ /dev/null @@ -1,339 +0,0 @@ - - - - - - - - pylab_examples example code: coords_report.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: coords_report.py

-

(Source code, png, pdf)

-
-../../_images/coords_report.png -
-
# override the default reporting of coords
-
-import matplotlib.pyplot as plt
-import numpy as np
-
-
-def millions(x):
-    return '$%1.1fM' % (x*1e-6)
-
-x = np.random.rand(20)
-y = 1e7*np.random.rand(20)
-
-fig, ax = plt.subplots()
-ax.fmt_ydata = millions
-plt.plot(x, y, 'o')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/csd_demo.html b/examples/pylab_examples/csd_demo.html deleted file mode 100644 index 78f9db7b9b8..00000000000 --- a/examples/pylab_examples/csd_demo.html +++ /dev/null @@ -1,355 +0,0 @@ - - - - - - - - pylab_examples example code: csd_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: csd_demo.py

-

(Source code, png, pdf)

-
-../../_images/csd_demo1.png -
-
"""
-Compute the cross spectral density of two signals
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-fig, (ax1, ax2) = plt.subplots(2, 1)
-# make a little extra space between the subplots
-fig.subplots_adjust(hspace=0.5)
-
-dt = 0.01
-t = np.arange(0, 30, dt)
-nse1 = np.random.randn(len(t))                 # white noise 1
-nse2 = np.random.randn(len(t))                 # white noise 2
-r = np.exp(-t/0.05)
-
-cnse1 = np.convolve(nse1, r, mode='same')*dt   # colored noise 1
-cnse2 = np.convolve(nse2, r, mode='same')*dt   # colored noise 2
-
-# two signals with a coherent part and a random part
-s1 = 0.01*np.sin(2*np.pi*10*t) + cnse1
-s2 = 0.01*np.sin(2*np.pi*10*t) + cnse2
-
-ax1.plot(t, s1, t, s2)
-ax1.set_xlim(0, 5)
-ax1.set_xlabel('time')
-ax1.set_ylabel('s1 and s2')
-ax1.grid(True)
-
-cxy, f = ax2.csd(s1, s2, 256, 1./dt)
-ax2.set_ylabel('CSD (db)')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/cursor_demo.html b/examples/pylab_examples/cursor_demo.html deleted file mode 100644 index c73b540679b..00000000000 --- a/examples/pylab_examples/cursor_demo.html +++ /dev/null @@ -1,405 +0,0 @@ - - - - - - - - pylab_examples example code: cursor_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: cursor_demo.py

-

[source code]

-
# -*- noplot -*-
-
-"""
-This example shows how to use matplotlib to provide a data cursor.  It
-uses matplotlib to draw the cursor and may be a slow since this
-requires redrawing the figure with every mouse move.
-
-Faster cursoring is possible using native GUI drawing, as in
-wxcursor_demo.py.
-
-The mpldatacursor and mplcursors third-party packages can be used to achieve a
-similar effect.  See
-    https://github.com/joferkington/mpldatacursor
-    https://github.com/anntzer/mplcursors
-"""
-from __future__ import print_function
-import matplotlib.pyplot as plt
-import numpy as np
-
-
-class Cursor(object):
-    def __init__(self, ax):
-        self.ax = ax
-        self.lx = ax.axhline(color='k')  # the horiz line
-        self.ly = ax.axvline(color='k')  # the vert line
-
-        # text location in axes coords
-        self.txt = ax.text(0.7, 0.9, '', transform=ax.transAxes)
-
-    def mouse_move(self, event):
-        if not event.inaxes:
-            return
-
-        x, y = event.xdata, event.ydata
-        # update the line positions
-        self.lx.set_ydata(y)
-        self.ly.set_xdata(x)
-
-        self.txt.set_text('x=%1.2f, y=%1.2f' % (x, y))
-        plt.draw()
-
-
-class SnaptoCursor(object):
-    """
-    Like Cursor but the crosshair snaps to the nearest x,y point
-    For simplicity, I'm assuming x is sorted
-    """
-
-    def __init__(self, ax, x, y):
-        self.ax = ax
-        self.lx = ax.axhline(color='k')  # the horiz line
-        self.ly = ax.axvline(color='k')  # the vert line
-        self.x = x
-        self.y = y
-        # text location in axes coords
-        self.txt = ax.text(0.7, 0.9, '', transform=ax.transAxes)
-
-    def mouse_move(self, event):
-
-        if not event.inaxes:
-            return
-
-        x, y = event.xdata, event.ydata
-
-        indx = np.searchsorted(self.x, [x])[0]
-        x = self.x[indx]
-        y = self.y[indx]
-        # update the line positions
-        self.lx.set_ydata(y)
-        self.ly.set_xdata(x)
-
-        self.txt.set_text('x=%1.2f, y=%1.2f' % (x, y))
-        print('x=%1.2f, y=%1.2f' % (x, y))
-        plt.draw()
-
-t = np.arange(0.0, 1.0, 0.01)
-s = np.sin(2*2*np.pi*t)
-fig, ax = plt.subplots()
-
-#cursor = Cursor(ax)
-cursor = SnaptoCursor(ax, t, s)
-plt.connect('motion_notify_event', cursor.mouse_move)
-
-ax.plot(t, s, 'o')
-plt.axis([0, 1, -1, 1])
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/cursor_demo.py b/examples/pylab_examples/cursor_demo.py deleted file mode 100644 index 910e258a66d..00000000000 --- a/examples/pylab_examples/cursor_demo.py +++ /dev/null @@ -1,86 +0,0 @@ -# -*- noplot -*- - -""" -This example shows how to use matplotlib to provide a data cursor. It -uses matplotlib to draw the cursor and may be a slow since this -requires redrawing the figure with every mouse move. - -Faster cursoring is possible using native GUI drawing, as in -wxcursor_demo.py. - -The mpldatacursor and mplcursors third-party packages can be used to achieve a -similar effect. See - https://github.com/joferkington/mpldatacursor - https://github.com/anntzer/mplcursors -""" -from __future__ import print_function -import matplotlib.pyplot as plt -import numpy as np - - -class Cursor(object): - def __init__(self, ax): - self.ax = ax - self.lx = ax.axhline(color='k') # the horiz line - self.ly = ax.axvline(color='k') # the vert line - - # text location in axes coords - self.txt = ax.text(0.7, 0.9, '', transform=ax.transAxes) - - def mouse_move(self, event): - if not event.inaxes: - return - - x, y = event.xdata, event.ydata - # update the line positions - self.lx.set_ydata(y) - self.ly.set_xdata(x) - - self.txt.set_text('x=%1.2f, y=%1.2f' % (x, y)) - plt.draw() - - -class SnaptoCursor(object): - """ - Like Cursor but the crosshair snaps to the nearest x,y point - For simplicity, I'm assuming x is sorted - """ - - def __init__(self, ax, x, y): - self.ax = ax - self.lx = ax.axhline(color='k') # the horiz line - self.ly = ax.axvline(color='k') # the vert line - self.x = x - self.y = y - # text location in axes coords - self.txt = ax.text(0.7, 0.9, '', transform=ax.transAxes) - - def mouse_move(self, event): - - if not event.inaxes: - return - - x, y = event.xdata, event.ydata - - indx = np.searchsorted(self.x, [x])[0] - x = self.x[indx] - y = self.y[indx] - # update the line positions - self.lx.set_ydata(y) - self.ly.set_xdata(x) - - self.txt.set_text('x=%1.2f, y=%1.2f' % (x, y)) - print('x=%1.2f, y=%1.2f' % (x, y)) - plt.draw() - -t = np.arange(0.0, 1.0, 0.01) -s = np.sin(2*2*np.pi*t) -fig, ax = plt.subplots() - -#cursor = Cursor(ax) -cursor = SnaptoCursor(ax, t, s) -plt.connect('motion_notify_event', cursor.mouse_move) - -ax.plot(t, s, 'o') -plt.axis([0, 1, -1, 1]) -plt.show() diff --git a/examples/pylab_examples/custom_cmap.html b/examples/pylab_examples/custom_cmap.html deleted file mode 100644 index 1e090e76674..00000000000 --- a/examples/pylab_examples/custom_cmap.html +++ /dev/null @@ -1,542 +0,0 @@ - - - - - - - - pylab_examples example code: custom_cmap.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: custom_cmap.py

-

(Source code)

-
-../../_images/custom_cmap_00.png -

(png, pdf)

-
-
-../../_images/custom_cmap_01.png -

(png, pdf)

-
-
import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.colors import LinearSegmentedColormap
-
-"""
-Creating a colormap from a list of colors
------------------------------------------
-Creating a colormap from a list of colors can be done with the `from_list`
-method of `LinearSegmentedColormap`. You must pass a list of RGB tuples that
-define the mixture of colors from 0 to 1.
-
-
-Creating custom colormaps
--------------------------
-It is also possible to create a custom mapping for a colormap. This is
-accomplished by creating dictionary that specifies how the RGB channels
-change from one end of the cmap to the other.
-
-Example: suppose you want red to increase from 0 to 1 over the bottom
-half, green to do the same over the middle half, and blue over the top
-half.  Then you would use:
-
-cdict = {'red':   ((0.0,  0.0, 0.0),
-                   (0.5,  1.0, 1.0),
-                   (1.0,  1.0, 1.0)),
-
-         'green': ((0.0,  0.0, 0.0),
-                   (0.25, 0.0, 0.0),
-                   (0.75, 1.0, 1.0),
-                   (1.0,  1.0, 1.0)),
-
-         'blue':  ((0.0,  0.0, 0.0),
-                   (0.5,  0.0, 0.0),
-                   (1.0,  1.0, 1.0))}
-
-If, as in this example, there are no discontinuities in the r, g, and b
-components, then it is quite simple: the second and third element of
-each tuple, above, is the same--call it "y".  The first element ("x")
-defines interpolation intervals over the full range of 0 to 1, and it
-must span that whole range.  In other words, the values of x divide the
-0-to-1 range into a set of segments, and y gives the end-point color
-values for each segment.
-
-Now consider the green. cdict['green'] is saying that for
-0 <= x <= 0.25, y is zero; no green.
-0.25 < x <= 0.75, y varies linearly from 0 to 1.
-x > 0.75, y remains at 1, full green.
-
-If there are discontinuities, then it is a little more complicated.
-Label the 3 elements in each row in the cdict entry for a given color as
-(x, y0, y1).  Then for values of x between x[i] and x[i+1] the color
-value is interpolated between y1[i] and y0[i+1].
-
-Going back to the cookbook example, look at cdict['red']; because y0 !=
-y1, it is saying that for x from 0 to 0.5, red increases from 0 to 1,
-but then it jumps down, so that for x from 0.5 to 1, red increases from
-0.7 to 1.  Green ramps from 0 to 1 as x goes from 0 to 0.5, then jumps
-back to 0, and ramps back to 1 as x goes from 0.5 to 1.
-
-row i:   x  y0  y1
-                /
-               /
-row i+1: x  y0  y1
-
-Above is an attempt to show that for x in the range x[i] to x[i+1], the
-interpolation is between y1[i] and y0[i+1].  So, y0[0] and y1[-1] are
-never used.
-
-"""
-# Make some illustrative fake data:
-
-x = np.arange(0, np.pi, 0.1)
-y = np.arange(0, 2*np.pi, 0.1)
-X, Y = np.meshgrid(x, y)
-Z = np.cos(X) * np.sin(Y) * 10
-
-
-# --- Colormaps from a list ---
-
-colors = [(1, 0, 0), (0, 1, 0), (0, 0, 1)]  # R -> G -> B
-n_bins = [3, 6, 10, 100]  # Discretizes the interpolation into bins
-cmap_name = 'my_list'
-fig, axs = plt.subplots(2, 2, figsize=(6, 9))
-fig.subplots_adjust(left=0.02, bottom=0.06, right=0.95, top=0.94, wspace=0.05)
-for n_bin, ax in zip(n_bins, axs.ravel()):
-    # Create the colormap
-    cm = LinearSegmentedColormap.from_list(
-        cmap_name, colors, N=n_bin)
-    # Fewer bins will result in "coarser" colomap interpolation
-    im = ax.imshow(Z, interpolation='nearest', origin='lower', cmap=cm)
-    ax.set_title("N bins: %s" % n_bin)
-    fig.colorbar(im, ax=ax)
-
-
-# --- Custom colormaps ---
-
-cdict1 = {'red':   ((0.0, 0.0, 0.0),
-                   (0.5, 0.0, 0.1),
-                   (1.0, 1.0, 1.0)),
-
-         'green': ((0.0, 0.0, 0.0),
-                   (1.0, 0.0, 0.0)),
-
-         'blue':  ((0.0, 0.0, 1.0),
-                   (0.5, 0.1, 0.0),
-                   (1.0, 0.0, 0.0))
-        }
-
-cdict2 = {'red':   ((0.0, 0.0, 0.0),
-                   (0.5, 0.0, 1.0),
-                   (1.0, 0.1, 1.0)),
-
-         'green': ((0.0, 0.0, 0.0),
-                   (1.0, 0.0, 0.0)),
-
-         'blue':  ((0.0, 0.0, 0.1),
-                   (0.5, 1.0, 0.0),
-                   (1.0, 0.0, 0.0))
-        }
-
-cdict3 = {'red':  ((0.0, 0.0, 0.0),
-                   (0.25, 0.0, 0.0),
-                   (0.5, 0.8, 1.0),
-                   (0.75, 1.0, 1.0),
-                   (1.0, 0.4, 1.0)),
-
-         'green': ((0.0, 0.0, 0.0),
-                   (0.25, 0.0, 0.0),
-                   (0.5, 0.9, 0.9),
-                   (0.75, 0.0, 0.0),
-                   (1.0, 0.0, 0.0)),
-
-         'blue':  ((0.0, 0.0, 0.4),
-                   (0.25, 1.0, 1.0),
-                   (0.5, 1.0, 0.8),
-                   (0.75, 0.0, 0.0),
-                   (1.0, 0.0, 0.0))
-        }
-
-# Make a modified version of cdict3 with some transparency
-# in the middle of the range.
-cdict4 = cdict3.copy()
-cdict4['alpha'] = ((0.0, 1.0, 1.0),
-                #   (0.25,1.0, 1.0),
-                   (0.5, 0.3, 0.3),
-                #   (0.75,1.0, 1.0),
-                   (1.0, 1.0, 1.0))
-
-
-# Now we will use this example to illustrate 3 ways of
-# handling custom colormaps.
-# First, the most direct and explicit:
-
-blue_red1 = LinearSegmentedColormap('BlueRed1', cdict1)
-
-# Second, create the map explicitly and register it.
-# Like the first method, this method works with any kind
-# of Colormap, not just
-# a LinearSegmentedColormap:
-
-blue_red2 = LinearSegmentedColormap('BlueRed2', cdict2)
-plt.register_cmap(cmap=blue_red2)
-
-# Third, for LinearSegmentedColormap only,
-# leave everything to register_cmap:
-
-plt.register_cmap(name='BlueRed3', data=cdict3)  # optional lut kwarg
-plt.register_cmap(name='BlueRedAlpha', data=cdict4)
-
-# Make the figure:
-
-fig, axs = plt.subplots(2, 2, figsize=(6, 9))
-fig.subplots_adjust(left=0.02, bottom=0.06, right=0.95, top=0.94, wspace=0.05)
-
-# Make 4 subplots:
-
-im1 = axs[0, 0].imshow(Z, interpolation='nearest', cmap=blue_red1)
-fig.colorbar(im1, ax=axs[0, 0])
-
-cmap = plt.get_cmap('BlueRed2')
-im2 = axs[1, 0].imshow(Z, interpolation='nearest', cmap=cmap)
-fig.colorbar(im2, ax=axs[1, 0])
-
-# Now we will set the third cmap as the default.  One would
-# not normally do this in the middle of a script like this;
-# it is done here just to illustrate the method.
-
-plt.rcParams['image.cmap'] = 'BlueRed3'
-
-im3 = axs[0, 1].imshow(Z, interpolation='nearest')
-fig.colorbar(im3, ax=axs[0, 1])
-axs[0, 1].set_title("Alpha = 1")
-
-# Or as yet another variation, we can replace the rcParams
-# specification *before* the imshow with the following *after*
-# imshow.
-# This sets the new default *and* sets the colormap of the last
-# image-like item plotted via pyplot, if any.
-#
-
-# Draw a line with low zorder so it will be behind the image.
-axs[1, 1].plot([0, 10*np.pi], [0, 20*np.pi], color='c', lw=20, zorder=-1)
-
-im4 = axs[1, 1].imshow(Z, interpolation='nearest')
-fig.colorbar(im4, ax=axs[1, 1])
-
-# Here it is: changing the colormap for the current image and its
-# colorbar after they have been plotted.
-im4.set_cmap('BlueRedAlpha')
-axs[1, 1].set_title("Varying alpha")
-#
-
-fig.suptitle('Custom Blue-Red colormaps', fontsize=16)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/custom_figure_class.html b/examples/pylab_examples/custom_figure_class.html deleted file mode 100644 index 9884bbc2251..00000000000 --- a/examples/pylab_examples/custom_figure_class.html +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - - - pylab_examples example code: custom_figure_class.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: custom_figure_class.py

-

(Source code, png, pdf)

-
-../../_images/custom_figure_class.png -
-
"""
-You can pass a custom Figure constructor to figure if you want to derive from the default Figure.  This simple example creates a figure with a figure title
-"""
-from matplotlib.pyplot import figure, show
-from matplotlib.figure import Figure
-
-
-class MyFigure(Figure):
-    def __init__(self, *args, **kwargs):
-        """
-        custom kwarg figtitle is a figure title
-        """
-        figtitle = kwargs.pop('figtitle', 'hi mom')
-        Figure.__init__(self, *args, **kwargs)
-        self.text(0.5, 0.95, figtitle, ha='center')
-
-fig = figure(FigureClass=MyFigure, figtitle='my title')
-ax = fig.add_subplot(111)
-ax.plot([1, 2, 3])
-
-show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/custom_ticker1.html b/examples/pylab_examples/custom_ticker1.html deleted file mode 100644 index 711f96f41af..00000000000 --- a/examples/pylab_examples/custom_ticker1.html +++ /dev/null @@ -1,351 +0,0 @@ - - - - - - - - pylab_examples example code: custom_ticker1.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: custom_ticker1.py

-

(Source code, png, pdf)

-
-../../_images/custom_ticker1.png -
-
"""
-The new ticker code was designed to explicitly support user customized
-ticking.  The documentation
-http://matplotlib.org/matplotlib.ticker.html details this
-process.  That code defines a lot of preset tickers but was primarily
-designed to be user extensible.
-
-In this example a user defined function is used to format the ticks in
-millions of dollars on the y axis
-"""
-from matplotlib.ticker import FuncFormatter
-import matplotlib.pyplot as plt
-import numpy as np
-
-x = np.arange(4)
-money = [1.5e5, 2.5e6, 5.5e6, 2.0e7]
-
-
-def millions(x, pos):
-    'The two args are the value and tick position'
-    return '$%1.1fM' % (x*1e-6)
-
-formatter = FuncFormatter(millions)
-
-fig, ax = plt.subplots()
-ax.yaxis.set_major_formatter(formatter)
-plt.bar(x, money)
-plt.xticks(x, ('Bill', 'Fred', 'Mary', 'Sue'))
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/customize_rc.html b/examples/pylab_examples/customize_rc.html deleted file mode 100644 index 60bb3f5394b..00000000000 --- a/examples/pylab_examples/customize_rc.html +++ /dev/null @@ -1,372 +0,0 @@ - - - - - - - - pylab_examples example code: customize_rc.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: customize_rc.py

-

(Source code, png, pdf)

-
-../../_images/customize_rc.png -
-
"""
-I'm not trying to make a good looking figure here, but just to show
-some examples of customizing rc params on the fly
-
-If you like to work interactively, and need to create different sets
-of defaults for figures (e.g., one set of defaults for publication, one
-set for interactive exploration), you may want to define some
-functions in a custom module that set the defaults, e.g.,
-
-def set_pub():
-    rc('font', weight='bold')    # bold fonts are easier to see
-    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
-
-
-
-Then as you are working interactively, you just need to do
-
->>> set_pub()
->>> subplot(111)
->>> plot([1,2,3])
->>> savefig('myfig')
->>> rcdefaults()  # restore the defaults
-
-"""
-import matplotlib.pyplot as plt
-
-plt.subplot(311)
-plt.plot([1, 2, 3])
-
-# the axes attributes need to be set before the call to subplot
-plt.rc('font', weight='bold')
-plt.rc('xtick.major', size=5, pad=7)
-plt.rc('xtick', labelsize=15)
-
-# using aliases for color, linestyle and linewidth; gray, solid, thick
-plt.rc('grid', c='0.5', ls='-', lw=5)
-plt.rc('lines', lw=2, color='g')
-plt.subplot(312)
-
-plt.plot([1, 2, 3])
-plt.grid(True)
-
-plt.rcdefaults()
-plt.subplot(313)
-plt.plot([1, 2, 3])
-plt.grid(True)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/dannys_example.html b/examples/pylab_examples/dannys_example.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/pylab_examples/dannys_example.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/pylab_examples/dashpointlabel.html b/examples/pylab_examples/dashpointlabel.html deleted file mode 100644 index 5349ed26e6a..00000000000 --- a/examples/pylab_examples/dashpointlabel.html +++ /dev/null @@ -1,359 +0,0 @@ - - - - - - - - pylab_examples example code: dashpointlabel.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: dashpointlabel.py

-

(Source code, png, pdf)

-
-../../_images/dashpointlabel.png -
-
import matplotlib.pyplot as plt
-
-DATA = ((1, 3),
-        (2, 4),
-        (3, 1),
-        (4, 2))
-# dash_style =
-#     direction, length, (text)rotation, dashrotation, push
-# (The parameters are varied to show their effects,
-# not for visual appeal).
-dash_style = (
-    (0, 20, -15, 30, 10),
-    (1, 30, 0, 15, 10),
-    (0, 40, 15, 15, 10),
-    (1, 20, 30, 60, 10),
-    )
-
-fig, ax = plt.subplots()
-
-(x, y) = zip(*DATA)
-ax.plot(x, y, marker='o')
-for i in range(len(DATA)):
-    (x, y) = DATA[i]
-    (dd, dl, r, dr, dp) = dash_style[i]
-    #print('dashlen call %d' % dl)
-    t = ax.text(x, y, str((x, y)), withdash=True,
-                dashdirection=dd,
-                dashlength=dl,
-                rotation=r,
-                dashrotation=dr,
-                dashpush=dp,
-                )
-
-ax.set_xlim((0.0, 5.0))
-ax.set_ylim((0.0, 5.0))
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/data_helper.html b/examples/pylab_examples/data_helper.html deleted file mode 100644 index a8b5db6e059..00000000000 --- a/examples/pylab_examples/data_helper.html +++ /dev/null @@ -1,384 +0,0 @@ - - - - - - - - pylab_examples example code: data_helper.py — Matplotlib 1.5.3 documentation - - - - - - - - - - - - - - - - - - -
-

Matplotlib 2.0.0rc2 is available

- -

Install the release candidate now!

- -
- - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: data_helper.py

-

(Source code)

-
#!/usr/bin/env python
-# Some functions to load a return data for the plot demos
-
-from numpy import fromstring, argsort, take, array, resize
-import matplotlib.cbook as cbook
-
-
-def get_two_stock_data():
-    """
-    load stock time and price data for two stocks The return values
-    (d1,p1,d2,p2) are the trade time (in days) and prices for stocks 1
-    and 2 (intc and aapl)
-    """
-    ticker1, ticker2 = 'INTC', 'AAPL'
-
-    file1 = cbook.get_sample_data('INTC.dat.gz')
-    file2 = cbook.get_sample_data('AAPL.dat.gz')
-    M1 = fromstring(file1.read(), '<d')
-
-    M1 = resize(M1, (M1.shape[0]//2, 2))
-
-    M2 = fromstring(file2.read(), '<d')
-    M2 = resize(M2, (M2.shape[0]//2, 2))
-
-    d1, p1 = M1[:, 0], M1[:, 1]
-    d2, p2 = M2[:, 0], M2[:, 1]
-    return (d1, p1, d2, p2)
-
-
-def get_daily_data():
-    """
-    return stock1 and stock2 instances, each of which have attributes
-
-      open, high, low, close, volume
-
-    as numeric arrays
-
-    """
-    class C:
-        pass
-
-    def get_ticker(ticker):
-        vals = []
-
-        datafile = cbook.get_sample_data('%s.csv' % ticker, asfileobj=False)
-
-        lines = open(datafile).readlines()
-        for line in lines[1:]:
-            vals.append([float(val) for val in line.split(',')[1:]])
-
-        M = array(vals)
-        c = C()
-        c.open = M[:, 0]
-        c.high = M[:, 1]
-        c.low = M[:, 2]
-        c.close = M[:, 3]
-        c.volume = M[:, 4]
-        return c
-    c1 = get_ticker('intc')
-    c2 = get_ticker('msft')
-    return c1, c2
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/date_demo1.html b/examples/pylab_examples/date_demo1.html deleted file mode 100644 index 273373ea9b8..00000000000 --- a/examples/pylab_examples/date_demo1.html +++ /dev/null @@ -1,379 +0,0 @@ - - - - - - - - pylab_examples example code: date_demo1.py — Matplotlib 1.5.3 documentation - - - - - - - - - - - - - - - - - - -
-

Matplotlib 2.0.0rc2 is available

- -

Install the release candidate now!

- -
- - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: date_demo1.py

-

(Source code, png, hires.png, pdf)

-
-../../_images/date_demo1.png -
-
#!/usr/bin/env python
-"""
-Show how to make date plots in matplotlib using date tick locators and
-formatters.  See major_minor_demo1.py for more information on
-controlling major and minor ticks
-
-All matplotlib date plotting is done by converting date instances into
-days since the 0001-01-01 UTC.  The conversion, tick locating and
-formatting is done behind the scenes so this is most transparent to
-you.  The dates module provides several converter functions date2num
-and num2date
-
-This example requires an active internet connection since it uses
-yahoo finance to get the data for plotting
-"""
-
-import matplotlib.pyplot as plt
-from matplotlib.finance import quotes_historical_yahoo_ochl
-from matplotlib.dates import YearLocator, MonthLocator, DateFormatter
-import datetime
-date1 = datetime.date(1995, 1, 1)
-date2 = datetime.date(2004, 4, 12)
-
-years = YearLocator()   # every year
-months = MonthLocator()  # every month
-yearsFmt = DateFormatter('%Y')
-
-quotes = quotes_historical_yahoo_ochl('INTC', date1, date2)
-if len(quotes) == 0:
-    raise SystemExit
-
-dates = [q[0] for q in quotes]
-opens = [q[1] for q in quotes]
-
-fig, ax = plt.subplots()
-ax.plot_date(dates, opens, '-')
-
-# format the ticks
-ax.xaxis.set_major_locator(years)
-ax.xaxis.set_major_formatter(yearsFmt)
-ax.xaxis.set_minor_locator(months)
-ax.autoscale_view()
-
-
-# format the coords message box
-def price(x):
-    return '$%1.2f' % x
-ax.fmt_xdata = DateFormatter('%Y-%m-%d')
-ax.fmt_ydata = price
-ax.grid(True)
-
-fig.autofmt_xdate()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/date_demo2.html b/examples/pylab_examples/date_demo2.html deleted file mode 100644 index fce8ec383c4..00000000000 --- a/examples/pylab_examples/date_demo2.html +++ /dev/null @@ -1,373 +0,0 @@ - - - - - - - - pylab_examples example code: date_demo2.py — Matplotlib 1.5.3 documentation - - - - - - - - - - - - - - - - - - -
-

Matplotlib 2.0.0rc2 is available

- -

Install the release candidate now!

- -
- - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: date_demo2.py

-

(Source code, png, hires.png, pdf)

-
-../../_images/date_demo2.png -
-
#!/usr/bin/env python
-
-"""
-Show how to make date plots in matplotlib using date tick locators and
-formatters.  See major_minor_demo1.py for more information on
-controlling major and minor ticks
-"""
-from __future__ import print_function
-import datetime
-import matplotlib.pyplot as plt
-from matplotlib.dates import MONDAY
-from matplotlib.finance import quotes_historical_yahoo_ochl
-from matplotlib.dates import MonthLocator, WeekdayLocator, DateFormatter
-
-
-date1 = datetime.date(2002, 1, 5)
-date2 = datetime.date(2003, 12, 1)
-
-# every monday
-mondays = WeekdayLocator(MONDAY)
-
-# every 3rd month
-months = MonthLocator(range(1, 13), bymonthday=1, interval=3)
-monthsFmt = DateFormatter("%b '%y")
-
-
-quotes = quotes_historical_yahoo_ochl('INTC', date1, date2)
-if len(quotes) == 0:
-    print('Found no quotes')
-    raise SystemExit
-
-dates = [q[0] for q in quotes]
-opens = [q[1] for q in quotes]
-
-fig, ax = plt.subplots()
-ax.plot_date(dates, opens, '-')
-ax.xaxis.set_major_locator(months)
-ax.xaxis.set_major_formatter(monthsFmt)
-ax.xaxis.set_minor_locator(mondays)
-ax.autoscale_view()
-#ax.xaxis.grid(False, 'major')
-#ax.xaxis.grid(True, 'minor')
-ax.grid(True)
-
-fig.autofmt_xdate()
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/date_demo_convert.html b/examples/pylab_examples/date_demo_convert.html deleted file mode 100644 index f7c1e083566..00000000000 --- a/examples/pylab_examples/date_demo_convert.html +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - pylab_examples example code: date_demo_convert.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: date_demo_convert.py

-

(Source code, png, pdf)

-
-../../_images/date_demo_convert.png -
-
import datetime
-import matplotlib.pyplot as plt
-from matplotlib.dates import DayLocator, HourLocator, DateFormatter, drange
-from numpy import arange
-
-date1 = datetime.datetime(2000, 3, 2)
-date2 = datetime.datetime(2000, 3, 6)
-delta = datetime.timedelta(hours=6)
-dates = drange(date1, date2, delta)
-
-y = arange(len(dates)*1.0)
-
-fig, ax = plt.subplots()
-ax.plot_date(dates, y*y)
-
-# this is superfluous, since the autoscaler should get it right, but
-# use date2num and num2date to convert between dates and floats if
-# you want; both date2num and num2date convert an instance or sequence
-ax.set_xlim(dates[0], dates[-1])
-
-# The hour locator takes the hour or sequence of hours you want to
-# tick, not the base multiple
-
-ax.xaxis.set_major_locator(DayLocator())
-ax.xaxis.set_minor_locator(HourLocator(arange(0, 25, 6)))
-ax.xaxis.set_major_formatter(DateFormatter('%Y-%m-%d'))
-
-ax.fmt_xdata = DateFormatter('%Y-%m-%d %H:%M:%S')
-fig.autofmt_xdate()
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/date_demo_rrule.html b/examples/pylab_examples/date_demo_rrule.html deleted file mode 100644 index a3133895073..00000000000 --- a/examples/pylab_examples/date_demo_rrule.html +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - pylab_examples example code: date_demo_rrule.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: date_demo_rrule.py

-

(Source code, png, pdf)

-
-../../_images/date_demo_rrule.png -
-
"""
-Show how to use an rrule instance to make a custom date ticker - here
-we put a tick mark on every 5th easter
-
-See https://moin.conectiva.com.br/DateUtil for help with rrules
-"""
-import matplotlib.pyplot as plt
-from matplotlib.dates import YEARLY, DateFormatter, rrulewrapper, RRuleLocator, drange
-import numpy as np
-import datetime
-
-# tick every 5th easter
-rule = rrulewrapper(YEARLY, byeaster=1, interval=5)
-loc = RRuleLocator(rule)
-formatter = DateFormatter('%m/%d/%y')
-date1 = datetime.date(1952, 1, 1)
-date2 = datetime.date(2004, 4, 12)
-delta = datetime.timedelta(days=100)
-
-dates = drange(date1, date2, delta)
-s = np.random.rand(len(dates))  # make up some random y values
-
-
-fig, ax = plt.subplots()
-plt.plot_date(dates, s)
-ax.xaxis.set_major_locator(loc)
-ax.xaxis.set_major_formatter(formatter)
-labels = ax.get_xticklabels()
-plt.setp(labels, rotation=30, fontsize=10)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/date_index_formatter.html b/examples/pylab_examples/date_index_formatter.html deleted file mode 100644 index 6a664780c05..00000000000 --- a/examples/pylab_examples/date_index_formatter.html +++ /dev/null @@ -1,363 +0,0 @@ - - - - - - - - pylab_examples example code: date_index_formatter.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: date_index_formatter.py

-

(Source code, png, pdf)

-
-../../_images/date_index_formatter.png -
-
"""
-When plotting daily data, a frequent request is to plot the data
-ignoring skips, e.g., no extra spaces for weekends.  This is particularly
-common in financial time series, when you may have data for M-F and
-not Sat, Sun and you don't want gaps in the x axis.  The approach is
-to simply use the integer index for the xdata and a custom tick
-Formatter to get the appropriate date string for a given index.
-"""
-
-from __future__ import print_function
-import numpy as np
-from matplotlib.mlab import csv2rec
-import matplotlib.pyplot as plt
-import matplotlib.cbook as cbook
-from matplotlib.ticker import Formatter
-
-datafile = cbook.get_sample_data('msft.csv', asfileobj=False)
-print('loading %s' % datafile)
-r = csv2rec(datafile)[-40:]
-
-
-class MyFormatter(Formatter):
-    def __init__(self, dates, fmt='%Y-%m-%d'):
-        self.dates = dates
-        self.fmt = fmt
-
-    def __call__(self, x, pos=0):
-        'Return the label for time x at position pos'
-        ind = int(np.round(x))
-        if ind >= len(self.dates) or ind < 0:
-            return ''
-
-        return self.dates[ind].strftime(self.fmt)
-
-formatter = MyFormatter(r.date)
-
-fig, ax = plt.subplots()
-ax.xaxis.set_major_formatter(formatter)
-ax.plot(np.arange(len(r)), r.close, 'o-')
-fig.autofmt_xdate()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/demo_agg_filter.html b/examples/pylab_examples/demo_agg_filter.html deleted file mode 100644 index 2bb59c34729..00000000000 --- a/examples/pylab_examples/demo_agg_filter.html +++ /dev/null @@ -1,652 +0,0 @@ - - - - - - - - pylab_examples example code: demo_agg_filter.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: demo_agg_filter.py

-

(Source code, png, pdf)

-
-../../_images/demo_agg_filter.png -
-
import matplotlib.pyplot as plt
-
-import numpy as np
-import matplotlib.cm as cm
-import matplotlib.mlab as mlab
-
-
-def smooth1d(x, window_len):
-    # copied from http://www.scipy.org/Cookbook/SignalSmooth
-
-    s = np.r_[2*x[0] - x[window_len:1:-1], x, 2*x[-1] - x[-1:-window_len:-1]]
-    w = np.hanning(window_len)
-    y = np.convolve(w/w.sum(), s, mode='same')
-    return y[window_len-1:-window_len+1]
-
-
-def smooth2d(A, sigma=3):
-
-    window_len = max(int(sigma), 3)*2 + 1
-    A1 = np.array([smooth1d(x, window_len) for x in np.asarray(A)])
-    A2 = np.transpose(A1)
-    A3 = np.array([smooth1d(x, window_len) for x in A2])
-    A4 = np.transpose(A3)
-
-    return A4
-
-
-class BaseFilter(object):
-    def prepare_image(self, src_image, dpi, pad):
-        ny, nx, depth = src_image.shape
-        #tgt_image = np.zeros([pad*2+ny, pad*2+nx, depth], dtype="d")
-        padded_src = np.zeros([pad*2 + ny, pad*2 + nx, depth], dtype="d")
-        padded_src[pad:-pad, pad:-pad, :] = src_image[:, :, :]
-
-        return padded_src  # , tgt_image
-
-    def get_pad(self, dpi):
-        return 0
-
-    def __call__(self, im, dpi):
-        pad = self.get_pad(dpi)
-        padded_src = self.prepare_image(im, dpi, pad)
-        tgt_image = self.process_image(padded_src, dpi)
-        return tgt_image, -pad, -pad
-
-
-class OffsetFilter(BaseFilter):
-    def __init__(self, offsets=None):
-        if offsets is None:
-            self.offsets = (0, 0)
-        else:
-            self.offsets = offsets
-
-    def get_pad(self, dpi):
-        return int(max(*self.offsets)/72.*dpi)
-
-    def process_image(self, padded_src, dpi):
-        ox, oy = self.offsets
-        a1 = np.roll(padded_src, int(ox/72.*dpi), axis=1)
-        a2 = np.roll(a1, -int(oy/72.*dpi), axis=0)
-        return a2
-
-
-class GaussianFilter(BaseFilter):
-    "simple gauss filter"
-
-    def __init__(self, sigma, alpha=0.5, color=None):
-        self.sigma = sigma
-        self.alpha = alpha
-        if color is None:
-            self.color = (0, 0, 0)
-        else:
-            self.color = color
-
-    def get_pad(self, dpi):
-        return int(self.sigma*3/72.*dpi)
-
-    def process_image(self, padded_src, dpi):
-        #offsetx, offsety = int(self.offsets[0]), int(self.offsets[1])
-        tgt_image = np.zeros_like(padded_src)
-        aa = smooth2d(padded_src[:, :, -1]*self.alpha,
-                      self.sigma/72.*dpi)
-        tgt_image[:, :, -1] = aa
-        tgt_image[:, :, :-1] = self.color
-        return tgt_image
-
-
-class DropShadowFilter(BaseFilter):
-    def __init__(self, sigma, alpha=0.3, color=None, offsets=None):
-        self.gauss_filter = GaussianFilter(sigma, alpha, color)
-        self.offset_filter = OffsetFilter(offsets)
-
-    def get_pad(self, dpi):
-        return max(self.gauss_filter.get_pad(dpi),
-                   self.offset_filter.get_pad(dpi))
-
-    def process_image(self, padded_src, dpi):
-        t1 = self.gauss_filter.process_image(padded_src, dpi)
-        t2 = self.offset_filter.process_image(t1, dpi)
-        return t2
-
-
-from matplotlib.colors import LightSource
-
-
-class LightFilter(BaseFilter):
-    "simple gauss filter"
-
-    def __init__(self, sigma, fraction=0.5):
-        self.gauss_filter = GaussianFilter(sigma, alpha=1)
-        self.light_source = LightSource()
-        self.fraction = fraction
-
-    def get_pad(self, dpi):
-        return self.gauss_filter.get_pad(dpi)
-
-    def process_image(self, padded_src, dpi):
-        t1 = self.gauss_filter.process_image(padded_src, dpi)
-        elevation = t1[:, :, 3]
-        rgb = padded_src[:, :, :3]
-
-        rgb2 = self.light_source.shade_rgb(rgb, elevation,
-                                           fraction=self.fraction)
-
-        tgt = np.empty_like(padded_src)
-        tgt[:, :, :3] = rgb2
-        tgt[:, :, 3] = padded_src[:, :, 3]
-
-        return tgt
-
-
-class GrowFilter(BaseFilter):
-    "enlarge the area"
-
-    def __init__(self, pixels, color=None):
-        self.pixels = pixels
-        if color is None:
-            self.color = (1, 1, 1)
-        else:
-            self.color = color
-
-    def __call__(self, im, dpi):
-        pad = self.pixels
-        ny, nx, depth = im.shape
-        new_im = np.empty([pad*2 + ny, pad*2 + nx, depth], dtype="d")
-        alpha = new_im[:, :, 3]
-        alpha.fill(0)
-        alpha[pad:-pad, pad:-pad] = im[:, :, -1]
-        alpha2 = np.clip(smooth2d(alpha, self.pixels/72.*dpi) * 5, 0, 1)
-        new_im[:, :, -1] = alpha2
-        new_im[:, :, :-1] = self.color
-        offsetx, offsety = -pad, -pad
-
-        return new_im, offsetx, offsety
-
-
-from matplotlib.artist import Artist
-
-
-class FilteredArtistList(Artist):
-    """
-    A simple container to draw filtered artist.
-    """
-
-    def __init__(self, artist_list, filter):
-        self._artist_list = artist_list
-        self._filter = filter
-        Artist.__init__(self)
-
-    def draw(self, renderer):
-        renderer.start_rasterizing()
-        renderer.start_filter()
-        for a in self._artist_list:
-            a.draw(renderer)
-        renderer.stop_filter(self._filter)
-        renderer.stop_rasterizing()
-
-
-import matplotlib.transforms as mtransforms
-
-
-def filtered_text(ax):
-    # mostly copied from contour_demo.py
-
-    # prepare image
-    delta = 0.025
-    x = np.arange(-3.0, 3.0, delta)
-    y = np.arange(-2.0, 2.0, delta)
-    X, Y = np.meshgrid(x, y)
-    Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
-    Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
-    # difference of Gaussians
-    Z = 10.0 * (Z2 - Z1)
-
-    # draw
-    im = ax.imshow(Z, interpolation='bilinear', origin='lower',
-                   cmap=cm.gray, extent=(-3, 3, -2, 2))
-    levels = np.arange(-1.2, 1.6, 0.2)
-    CS = ax.contour(Z, levels,
-                    origin='lower',
-                    linewidths=2,
-                    extent=(-3, 3, -2, 2))
-
-    ax.set_aspect("auto")
-
-    # contour label
-    cl = ax.clabel(CS, levels[1::2],  # label every second level
-                   inline=1,
-                   fmt='%1.1f',
-                   fontsize=11)
-
-    # change clable color to black
-    from matplotlib.patheffects import Normal
-    for t in cl:
-        t.set_color("k")
-        # to force TextPath (i.e., same font in all backends)
-        t.set_path_effects([Normal()])
-
-    # Add white glows to improve visibility of labels.
-    white_glows = FilteredArtistList(cl, GrowFilter(3))
-    ax.add_artist(white_glows)
-    white_glows.set_zorder(cl[0].get_zorder() - 0.1)
-
-    ax.xaxis.set_visible(False)
-    ax.yaxis.set_visible(False)
-
-
-def drop_shadow_line(ax):
-    # copied from examples/misc/svg_filter_line.py
-
-    # draw lines
-    l1, = ax.plot([0.1, 0.5, 0.9], [0.1, 0.9, 0.5], "bo-",
-                  mec="b", mfc="w", lw=5, mew=3, ms=10, label="Line 1")
-    l2, = ax.plot([0.1, 0.5, 0.9], [0.5, 0.2, 0.7], "ro-",
-                  mec="r", mfc="w", lw=5, mew=3, ms=10, label="Line 1")
-
-    gauss = DropShadowFilter(4)
-
-    for l in [l1, l2]:
-
-        # draw shadows with same lines with slight offset.
-
-        xx = l.get_xdata()
-        yy = l.get_ydata()
-        shadow, = ax.plot(xx, yy)
-        shadow.update_from(l)
-
-        # offset transform
-        ot = mtransforms.offset_copy(l.get_transform(), ax.figure,
-                                     x=4.0, y=-6.0, units='points')
-
-        shadow.set_transform(ot)
-
-        # adjust zorder of the shadow lines so that it is drawn below the
-        # original lines
-        shadow.set_zorder(l.get_zorder() - 0.5)
-        shadow.set_agg_filter(gauss)
-        shadow.set_rasterized(True)  # to support mixed-mode renderers
-
-    ax.set_xlim(0., 1.)
-    ax.set_ylim(0., 1.)
-
-    ax.xaxis.set_visible(False)
-    ax.yaxis.set_visible(False)
-
-
-def drop_shadow_patches(ax):
-    # Copied from barchart_demo.py
-    N = 5
-    menMeans = (20, 35, 30, 35, 27)
-
-    ind = np.arange(N)  # the x locations for the groups
-    width = 0.35       # the width of the bars
-
-    rects1 = ax.bar(ind, menMeans, width, color='r', ec="w", lw=2)
-
-    womenMeans = (25, 32, 34, 20, 25)
-    rects2 = ax.bar(ind + width + 0.1, womenMeans, width, color='y', ec="w", lw=2)
-
-    #gauss = GaussianFilter(1.5, offsets=(1,1), )
-    gauss = DropShadowFilter(5, offsets=(1, 1), )
-    shadow = FilteredArtistList(rects1 + rects2, gauss)
-    ax.add_artist(shadow)
-    shadow.set_zorder(rects1[0].get_zorder() - 0.1)
-
-    ax.set_ylim(0, 40)
-
-    ax.xaxis.set_visible(False)
-    ax.yaxis.set_visible(False)
-
-
-def light_filter_pie(ax):
-    fracs = [15, 30, 45, 10]
-    explode = (0, 0.05, 0, 0)
-    pies = ax.pie(fracs, explode=explode)
-    ax.patch.set_visible(True)
-
-    light_filter = LightFilter(9)
-    for p in pies[0]:
-        p.set_agg_filter(light_filter)
-        p.set_rasterized(True)  # to support mixed-mode renderers
-        p.set(ec="none",
-              lw=2)
-
-    gauss = DropShadowFilter(9, offsets=(3, 4), alpha=0.7)
-    shadow = FilteredArtistList(pies[0], gauss)
-    ax.add_artist(shadow)
-    shadow.set_zorder(pies[0][0].get_zorder() - 0.1)
-
-
-if 1:
-
-    plt.figure(1, figsize=(6, 6))
-    plt.subplots_adjust(left=0.05, right=0.95)
-
-    ax = plt.subplot(221)
-    filtered_text(ax)
-
-    ax = plt.subplot(222)
-    drop_shadow_line(ax)
-
-    ax = plt.subplot(223)
-    drop_shadow_patches(ax)
-
-    ax = plt.subplot(224)
-    ax.set_aspect(1)
-    light_filter_pie(ax)
-    ax.set_frame_on(True)
-
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/demo_annotation_box.html b/examples/pylab_examples/demo_annotation_box.html deleted file mode 100644 index a61a4a512c9..00000000000 --- a/examples/pylab_examples/demo_annotation_box.html +++ /dev/null @@ -1,414 +0,0 @@ - - - - - - - - pylab_examples example code: demo_annotation_box.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: demo_annotation_box.py

-

(Source code, png, pdf)

-
-../../_images/demo_annotation_box.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-
-from matplotlib.patches import Circle
-from matplotlib.offsetbox import (TextArea, DrawingArea, OffsetImage,
-                                  AnnotationBbox)
-from matplotlib.cbook import get_sample_data
-
-
-if 1:
-    fig, ax = plt.subplots()
-
-    # Define a 1st position to annotate (display it with a marker)
-    xy = (0.5, 0.7)
-    ax.plot(xy[0], xy[1], ".r")
-
-    # Annotate the 1st position with a text box ('Test 1')
-    offsetbox = TextArea("Test 1", minimumdescent=False)
-
-    ab = AnnotationBbox(offsetbox, xy,
-                        xybox=(-20, 40),
-                        xycoords='data',
-                        boxcoords="offset points",
-                        arrowprops=dict(arrowstyle="->"))
-    ax.add_artist(ab)
-
-    # Annotate the 1st position with another text box ('Test')
-    offsetbox = TextArea("Test", minimumdescent=False)
-
-    ab = AnnotationBbox(offsetbox, xy,
-                        xybox=(1.02, xy[1]),
-                        xycoords='data',
-                        boxcoords=("axes fraction", "data"),
-                        box_alignment=(0., 0.5),
-                        arrowprops=dict(arrowstyle="->"))
-    ax.add_artist(ab)
-
-    # Define a 2nd position to annotate (don't display with a marker this time)
-    xy = [0.3, 0.55]
-
-    # Annotate the 2nd position with a circle patch
-    da = DrawingArea(20, 20, 0, 0)
-    p = Circle((10, 10), 10)
-    da.add_artist(p)
-
-    ab = AnnotationBbox(da, xy,
-                        xybox=(1.02, xy[1]),
-                        xycoords='data',
-                        boxcoords=("axes fraction", "data"),
-                        box_alignment=(0., 0.5),
-                        arrowprops=dict(arrowstyle="->"))
-
-    ax.add_artist(ab)
-
-    # Annotate the 2nd position with an image (a generated array of pixels)
-    arr = np.arange(100).reshape((10, 10))
-    im = OffsetImage(arr, zoom=2)
-    im.image.axes = ax
-
-    ab = AnnotationBbox(im, xy,
-                        xybox=(-50., 50.),
-                        xycoords='data',
-                        boxcoords="offset points",
-                        pad=0.3,
-                        arrowprops=dict(arrowstyle="->"))
-
-    ax.add_artist(ab)
-
-    # Annotate the 2nd position with another image (a Grace Hopper portrait)
-    fn = get_sample_data("grace_hopper.png", asfileobj=False)
-    arr_img = plt.imread(fn, format='png')
-
-    imagebox = OffsetImage(arr_img, zoom=0.2)
-    imagebox.image.axes = ax
-
-    ab = AnnotationBbox(imagebox, xy,
-                        xybox=(120., -80.),
-                        xycoords='data',
-                        boxcoords="offset points",
-                        pad=0.5,
-                        arrowprops=dict(
-                            arrowstyle="->",
-                            connectionstyle="angle,angleA=0,angleB=90,rad=3")
-                        )
-
-    ax.add_artist(ab)
-
-    # Fix the display limits to see everything
-    ax.set_xlim(0, 1)
-    ax.set_ylim(0, 1)
-
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/demo_bboximage.html b/examples/pylab_examples/demo_bboximage.html deleted file mode 100644 index 1269ae20238..00000000000 --- a/examples/pylab_examples/demo_bboximage.html +++ /dev/null @@ -1,386 +0,0 @@ - - - - - - - - pylab_examples example code: demo_bboximage.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: demo_bboximage.py

-

(Source code, png, pdf)

-
-../../_images/demo_bboximage.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-from matplotlib.image import BboxImage
-from matplotlib.transforms import Bbox, TransformedBbox
-
-if __name__ == "__main__":
-
-    fig = plt.figure(1)
-    ax = plt.subplot(121)
-
-    txt = ax.text(0.5, 0.5, "test", size=30, ha="center", color="w")
-    kwargs = dict()
-
-    bbox_image = BboxImage(txt.get_window_extent,
-                           norm=None,
-                           origin=None,
-                           clip_on=False,
-                           **kwargs
-                           )
-    a = np.arange(256).reshape(1, 256)/256.
-    bbox_image.set_data(a)
-    ax.add_artist(bbox_image)
-
-    ax = plt.subplot(122)
-    a = np.linspace(0, 1, 256).reshape(1, -1)
-    a = np.vstack((a, a))
-
-    maps = sorted(
-        m for m in plt.cm.cmap_d
-        if not m.endswith("_r") and  # Skip reversed colormaps.
-        not m.startswith(('spectral', 'Vega'))  # Skip deprecated colormaps.
-    )
-
-    #fig.subplots_adjust(top=0.99, bottom=0.01, left=0.2, right=0.99)
-
-    ncol = 2
-    nrow = len(maps)//ncol + 1
-
-    xpad_fraction = 0.3
-    dx = 1./(ncol + xpad_fraction*(ncol - 1))
-
-    ypad_fraction = 0.3
-    dy = 1./(nrow + ypad_fraction*(nrow - 1))
-
-    for i, m in enumerate(maps):
-        ix, iy = divmod(i, nrow)
-        #plt.figimage(a, 10, i*10, cmap=plt.get_cmap(m), origin='lower')
-        bbox0 = Bbox.from_bounds(ix*dx*(1 + xpad_fraction),
-                                 1. - iy*dy*(1 + ypad_fraction) - dy,
-                                 dx, dy)
-        bbox = TransformedBbox(bbox0, ax.transAxes)
-
-        bbox_image = BboxImage(bbox,
-                               cmap=plt.get_cmap(m),
-                               norm=None,
-                               origin=None,
-                               **kwargs
-                               )
-
-        bbox_image.set_data(a)
-        ax.add_artist(bbox_image)
-
-    plt.draw()
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/demo_ribbon_box.html b/examples/pylab_examples/demo_ribbon_box.html deleted file mode 100644 index b19f357d292..00000000000 --- a/examples/pylab_examples/demo_ribbon_box.html +++ /dev/null @@ -1,456 +0,0 @@ - - - - - - - - pylab_examples example code: demo_ribbon_box.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: demo_ribbon_box.py

-

(Source code, png, pdf)

-
-../../_images/demo_ribbon_box.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-from matplotlib.image import BboxImage
-
-from matplotlib._png import read_png
-import matplotlib.colors
-from matplotlib.cbook import get_sample_data
-
-
-class RibbonBox(object):
-
-    original_image = read_png(get_sample_data("Minduka_Present_Blue_Pack.png",
-                                              asfileobj=False))
-    cut_location = 70
-    b_and_h = original_image[:, :, 2]
-    color = original_image[:, :, 2] - original_image[:, :, 0]
-    alpha = original_image[:, :, 3]
-    nx = original_image.shape[1]
-
-    def __init__(self, color):
-        rgb = matplotlib.colors.to_rgba(color)[:3]
-
-        im = np.empty(self.original_image.shape,
-                      self.original_image.dtype)
-
-        im[:, :, :3] = self.b_and_h[:, :, np.newaxis]
-        im[:, :, :3] -= self.color[:, :, np.newaxis]*(1. - np.array(rgb))
-        im[:, :, 3] = self.alpha
-
-        self.im = im
-
-    def get_stretched_image(self, stretch_factor):
-        stretch_factor = max(stretch_factor, 1)
-        ny, nx, nch = self.im.shape
-        ny2 = int(ny*stretch_factor)
-
-        stretched_image = np.empty((ny2, nx, nch),
-                                   self.im.dtype)
-        cut = self.im[self.cut_location, :, :]
-        stretched_image[:, :, :] = cut
-        stretched_image[:self.cut_location, :, :] = \
-            self.im[:self.cut_location, :, :]
-        stretched_image[-(ny - self.cut_location):, :, :] = \
-            self.im[-(ny - self.cut_location):, :, :]
-
-        self._cached_im = stretched_image
-        return stretched_image
-
-
-class RibbonBoxImage(BboxImage):
-    zorder = 1
-
-    def __init__(self, bbox, color,
-                 cmap=None,
-                 norm=None,
-                 interpolation=None,
-                 origin=None,
-                 filternorm=1,
-                 filterrad=4.0,
-                 resample=False,
-                 **kwargs
-                 ):
-
-        BboxImage.__init__(self, bbox,
-                           cmap=cmap,
-                           norm=norm,
-                           interpolation=interpolation,
-                           origin=origin,
-                           filternorm=filternorm,
-                           filterrad=filterrad,
-                           resample=resample,
-                           **kwargs
-                           )
-
-        self._ribbonbox = RibbonBox(color)
-        self._cached_ny = None
-
-    def draw(self, renderer, *args, **kwargs):
-
-        bbox = self.get_window_extent(renderer)
-        stretch_factor = bbox.height / bbox.width
-
-        ny = int(stretch_factor*self._ribbonbox.nx)
-        if self._cached_ny != ny:
-            arr = self._ribbonbox.get_stretched_image(stretch_factor)
-            self.set_array(arr)
-            self._cached_ny = ny
-
-        BboxImage.draw(self, renderer, *args, **kwargs)
-
-
-if 1:
-    from matplotlib.transforms import Bbox, TransformedBbox
-    from matplotlib.ticker import ScalarFormatter
-
-    fig, ax = plt.subplots()
-
-    years = np.arange(2004, 2009)
-    box_colors = [(0.8, 0.2, 0.2),
-                  (0.2, 0.8, 0.2),
-                  (0.2, 0.2, 0.8),
-                  (0.7, 0.5, 0.8),
-                  (0.3, 0.8, 0.7),
-                  ]
-    heights = np.random.random(years.shape) * 7000 + 3000
-
-    fmt = ScalarFormatter(useOffset=False)
-    ax.xaxis.set_major_formatter(fmt)
-
-    for year, h, bc in zip(years, heights, box_colors):
-        bbox0 = Bbox.from_extents(year - 0.4, 0., year + 0.4, h)
-        bbox = TransformedBbox(bbox0, ax.transData)
-        rb_patch = RibbonBoxImage(bbox, bc, interpolation="bicubic")
-
-        ax.add_artist(rb_patch)
-
-        ax.annotate(r"%d" % (int(h/100.)*100),
-                    (year, h), va="bottom", ha="center")
-
-    patch_gradient = BboxImage(ax.bbox,
-                               interpolation="bicubic",
-                               zorder=0.1,
-                               )
-    gradient = np.zeros((2, 2, 4), dtype=np.float)
-    gradient[:, :, :3] = [1, 1, 0.]
-    gradient[:, :, 3] = [[0.1, 0.3], [0.3, 0.5]]  # alpha channel
-    patch_gradient.set_array(gradient)
-    ax.add_artist(patch_gradient)
-
-    ax.set_xlim(years[0] - 0.5, years[-1] + 0.5)
-    ax.set_ylim(0, 10000)
-
-    fig.savefig('ribbon_box.png')
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/demo_text_path.html b/examples/pylab_examples/demo_text_path.html deleted file mode 100644 index 1324e137c0e..00000000000 --- a/examples/pylab_examples/demo_text_path.html +++ /dev/null @@ -1,472 +0,0 @@ - - - - - - - - pylab_examples example code: demo_text_path.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: demo_text_path.py

-

(Source code, png, pdf)

-
-../../_images/demo_text_path.png -
-
# -*- coding: utf-8 -*-
-
-import matplotlib.pyplot as plt
-from matplotlib.image import BboxImage
-import numpy as np
-from matplotlib.transforms import IdentityTransform
-
-import matplotlib.patches as mpatches
-
-from matplotlib.offsetbox import AnnotationBbox,\
-    AnchoredOffsetbox, AuxTransformBox
-
-from matplotlib.cbook import get_sample_data
-
-from matplotlib.text import TextPath
-
-
-class PathClippedImagePatch(mpatches.PathPatch):
-    """
-    The given image is used to draw the face of the patch. Internally,
-    it uses BboxImage whose clippath set to the path of the patch.
-
-    FIXME : The result is currently dpi dependent.
-    """
-
-    def __init__(self, path, bbox_image, **kwargs):
-        mpatches.PathPatch.__init__(self, path, **kwargs)
-        self._init_bbox_image(bbox_image)
-
-    def set_facecolor(self, color):
-        """simply ignore facecolor"""
-        mpatches.PathPatch.set_facecolor(self, "none")
-
-    def _init_bbox_image(self, im):
-
-        bbox_image = BboxImage(self.get_window_extent,
-                               norm=None,
-                               origin=None,
-                               )
-        bbox_image.set_transform(IdentityTransform())
-
-        bbox_image.set_data(im)
-        self.bbox_image = bbox_image
-
-    def draw(self, renderer=None):
-
-        # the clip path must be updated every draw. any solution? -JJ
-        self.bbox_image.set_clip_path(self._path, self.get_transform())
-        self.bbox_image.draw(renderer)
-
-        mpatches.PathPatch.draw(self, renderer)
-
-
-if 1:
-
-    usetex = plt.rcParams["text.usetex"]
-
-    fig = plt.figure(1)
-
-    # EXAMPLE 1
-
-    ax = plt.subplot(211)
-
-    from matplotlib._png import read_png
-    fn = get_sample_data("grace_hopper.png", asfileobj=False)
-    arr = read_png(fn)
-
-    text_path = TextPath((0, 0), "!?", size=150)
-    p = PathClippedImagePatch(text_path, arr, ec="k",
-                              transform=IdentityTransform())
-
-    #p.set_clip_on(False)
-
-    # make offset box
-    offsetbox = AuxTransformBox(IdentityTransform())
-    offsetbox.add_artist(p)
-
-    # make anchored offset box
-    ao = AnchoredOffsetbox(loc=2, child=offsetbox, frameon=True, borderpad=0.2)
-    ax.add_artist(ao)
-
-    # another text
-    from matplotlib.patches import PathPatch
-    if usetex:
-        r = r"\mbox{textpath supports mathtext \& \TeX}"
-    else:
-        r = r"textpath supports mathtext & TeX"
-
-    text_path = TextPath((0, 0), r,
-                         size=20, usetex=usetex)
-
-    p1 = PathPatch(text_path, ec="w", lw=3, fc="w", alpha=0.9,
-                   transform=IdentityTransform())
-    p2 = PathPatch(text_path, ec="none", fc="k",
-                   transform=IdentityTransform())
-
-    offsetbox2 = AuxTransformBox(IdentityTransform())
-    offsetbox2.add_artist(p1)
-    offsetbox2.add_artist(p2)
-
-    ab = AnnotationBbox(offsetbox2, (0.95, 0.05),
-                        xycoords='axes fraction',
-                        boxcoords="offset points",
-                        box_alignment=(1., 0.),
-                        frameon=False
-                        )
-    ax.add_artist(ab)
-
-    ax.imshow([[0, 1, 2], [1, 2, 3]], cmap=plt.cm.gist_gray_r,
-              interpolation="bilinear",
-              aspect="auto")
-
-    # EXAMPLE 2
-
-    ax = plt.subplot(212)
-
-    arr = np.arange(256).reshape(1, 256)/256.
-
-    if usetex:
-        s = r"$\displaystyle\left[\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}\right]$!"
-    else:
-        s = r"$\left[\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}\right]$!"
-    text_path = TextPath((0, 0), s, size=40, usetex=usetex)
-    text_patch = PathClippedImagePatch(text_path, arr, ec="none",
-                                       transform=IdentityTransform())
-
-    shadow1 = mpatches.Shadow(text_patch, 1, -1, props=dict(fc="none", ec="0.6", lw=3))
-    shadow2 = mpatches.Shadow(text_patch, 1, -1, props=dict(fc="0.3", ec="none"))
-
-    # make offset box
-    offsetbox = AuxTransformBox(IdentityTransform())
-    offsetbox.add_artist(shadow1)
-    offsetbox.add_artist(shadow2)
-    offsetbox.add_artist(text_patch)
-
-    # place the anchored offset box using AnnotationBbox
-    ab = AnnotationBbox(offsetbox, (0.5, 0.5),
-                        xycoords='data',
-                        boxcoords="offset points",
-                        box_alignment=(0.5, 0.5),
-                        )
-    #text_path.set_size(10)
-
-    ax.add_artist(ab)
-
-    ax.set_xlim(0, 1)
-    ax.set_ylim(0, 1)
-
-    plt.draw()
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/demo_text_rotation_mode.html b/examples/pylab_examples/demo_text_rotation_mode.html deleted file mode 100644 index dcddc30947f..00000000000 --- a/examples/pylab_examples/demo_text_rotation_mode.html +++ /dev/null @@ -1,367 +0,0 @@ - - - - - - - - pylab_examples example code: demo_text_rotation_mode.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: demo_text_rotation_mode.py

-

(Source code, png, pdf)

-
-../../_images/demo_text_rotation_mode.png -
-
from mpl_toolkits.axes_grid1.axes_grid import ImageGrid
-
-
-def test_rotation_mode(fig, mode, subplot_location):
-    ha_list = "left center right".split()
-    va_list = "top center baseline bottom".split()
-    grid = ImageGrid(fig, subplot_location,
-                     nrows_ncols=(len(va_list), len(ha_list)),
-                     share_all=True, aspect=True,
-                     #label_mode='1',
-                     cbar_mode=None)
-
-    for ha, ax in zip(ha_list, grid.axes_row[-1]):
-        ax.axis["bottom"].label.set_text(ha)
-
-    grid.axes_row[0][1].set_title(mode, size="large")
-
-    for va, ax in zip(va_list, grid.axes_column[0]):
-        ax.axis["left"].label.set_text(va)
-
-    i = 0
-    for va in va_list:
-        for ha in ha_list:
-            ax = grid[i]
-            for axis in ax.axis.values():
-                axis.toggle(ticks=False, ticklabels=False)
-
-            ax.text(0.5, 0.5, "Tpg",
-                    size="large", rotation=40,
-                    bbox=dict(boxstyle="square,pad=0.",
-                              ec="none", fc="0.5", alpha=0.5),
-                    ha=ha, va=va,
-                    rotation_mode=mode)
-            ax.axvline(0.5)
-            ax.axhline(0.5)
-            i += 1
-
-if 1:
-    import matplotlib.pyplot as plt
-    fig = plt.figure(1, figsize=(5.5, 4))
-    fig.clf()
-
-    test_rotation_mode(fig, "default", 121)
-    test_rotation_mode(fig, "anchor", 122)
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/demo_tight_layout.html b/examples/pylab_examples/demo_tight_layout.html deleted file mode 100644 index 3c16f8ccbdc..00000000000 --- a/examples/pylab_examples/demo_tight_layout.html +++ /dev/null @@ -1,466 +0,0 @@ - - - - - - - - pylab_examples example code: demo_tight_layout.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: demo_tight_layout.py

-

(Source code)

-
-../../_images/demo_tight_layout_00_00.png -

(png, pdf)

-
-
-../../_images/demo_tight_layout_00_01.png -

(png, pdf)

-
-
-../../_images/demo_tight_layout_00_02.png -

(png, pdf)

-
-
-../../_images/demo_tight_layout_00_03.png -

(png, pdf)

-
-
-../../_images/demo_tight_layout_00_04.png -

(png, pdf)

-
-
-../../_images/demo_tight_layout_00_05.png -

(png, pdf)

-
-
-../../_images/demo_tight_layout_00_06.png -

(png, pdf)

-
-

(png, pdf)

-
-../../_images/demo_tight_layout_01_00.png -
-
import matplotlib.pyplot as plt
-import itertools
-import warnings
-
-
-fontsizes = itertools.cycle([8, 16, 24, 32])
-
-
-def example_plot(ax):
-    ax.plot([1, 2])
-    ax.set_xlabel('x-label', fontsize=next(fontsizes))
-    ax.set_ylabel('y-label', fontsize=next(fontsizes))
-    ax.set_title('Title', fontsize=next(fontsizes))
-
-
-fig, ax = plt.subplots()
-example_plot(ax)
-plt.tight_layout()
-
-fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(nrows=2, ncols=2)
-example_plot(ax1)
-example_plot(ax2)
-example_plot(ax3)
-example_plot(ax4)
-plt.tight_layout()
-
-fig, (ax1, ax2) = plt.subplots(nrows=2, ncols=1)
-example_plot(ax1)
-example_plot(ax2)
-plt.tight_layout()
-
-fig, (ax1, ax2) = plt.subplots(nrows=1, ncols=2)
-example_plot(ax1)
-example_plot(ax2)
-plt.tight_layout()
-
-fig, axes = plt.subplots(nrows=3, ncols=3)
-for row in axes:
-    for ax in row:
-        example_plot(ax)
-plt.tight_layout()
-
-
-fig = plt.figure()
-
-ax1 = plt.subplot(221)
-ax2 = plt.subplot(223)
-ax3 = plt.subplot(122)
-
-example_plot(ax1)
-example_plot(ax2)
-example_plot(ax3)
-
-plt.tight_layout()
-
-
-fig = plt.figure()
-
-ax1 = plt.subplot2grid((3, 3), (0, 0))
-ax2 = plt.subplot2grid((3, 3), (0, 1), colspan=2)
-ax3 = plt.subplot2grid((3, 3), (1, 0), colspan=2, rowspan=2)
-ax4 = plt.subplot2grid((3, 3), (1, 2), rowspan=2)
-
-example_plot(ax1)
-example_plot(ax2)
-example_plot(ax3)
-example_plot(ax4)
-
-plt.tight_layout()
-
-plt.show()
-
-
-fig = plt.figure()
-
-import matplotlib.gridspec as gridspec
-
-gs1 = gridspec.GridSpec(3, 1)
-ax1 = fig.add_subplot(gs1[0])
-ax2 = fig.add_subplot(gs1[1])
-ax3 = fig.add_subplot(gs1[2])
-
-example_plot(ax1)
-example_plot(ax2)
-example_plot(ax3)
-
-with warnings.catch_warnings():
-    warnings.simplefilter("ignore", UserWarning)
-    # This raises warnings since tight layout cannot
-    # handle gridspec automatically. We are going to
-    # do that manually so we can filter the warning.
-    gs1.tight_layout(fig, rect=[None, None, 0.45, None])
-
-gs2 = gridspec.GridSpec(2, 1)
-ax4 = fig.add_subplot(gs2[0])
-ax5 = fig.add_subplot(gs2[1])
-
-example_plot(ax4)
-example_plot(ax5)
-
-with warnings.catch_warnings():
-    # This raises warnings since tight layout cannot
-    # handle gridspec automatically. We are going to
-    # do that manually so we can filter the warning.
-    warnings.simplefilter("ignore", UserWarning)
-    gs2.tight_layout(fig, rect=[0.45, None, None, None])
-
-# now match the top and bottom of two gridspecs.
-top = min(gs1.top, gs2.top)
-bottom = max(gs1.bottom, gs2.bottom)
-
-gs1.update(top=top, bottom=bottom)
-gs2.update(top=top, bottom=bottom)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/dolphin.html b/examples/pylab_examples/dolphin.html deleted file mode 100644 index 499d2f46918..00000000000 --- a/examples/pylab_examples/dolphin.html +++ /dev/null @@ -1,413 +0,0 @@ - - - - - - - - pylab_examples example code: dolphin.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: dolphin.py

-

(Source code, png, pdf)

-
-../../_images/dolphin.png -
-
import matplotlib.cm as cm
-import matplotlib.pyplot as plt
-from matplotlib.patches import Circle, PathPatch
-from matplotlib.path import Path
-from matplotlib.transforms import Affine2D
-import numpy as np
-
-
-r = np.random.rand(50)
-t = np.random.rand(50) * np.pi * 2.0
-x = r * np.cos(t)
-y = r * np.sin(t)
-
-fig, ax = plt.subplots(figsize=(6, 6))
-circle = Circle((0, 0), 1, facecolor='none',
-                edgecolor=(0, 0.8, 0.8), linewidth=3, alpha=0.5)
-ax.add_patch(circle)
-
-im = plt.imshow(np.random.random((100, 100)),
-                origin='lower', cmap=cm.winter,
-                interpolation='spline36',
-                extent=([-1, 1, -1, 1]))
-im.set_clip_path(circle)
-
-plt.plot(x, y, 'o', color=(0.9, 0.9, 1.0), alpha=0.8)
-
-# Dolphin from OpenClipart library by Andy Fitzsimon
-#       <cc:License rdf:about="http://web.resource.org/cc/PublicDomain">
-#         <cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
-#         <cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/>
-#         <cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>
-#       </cc:License>
-
-dolphin = """
-M -0.59739425,160.18173 C -0.62740401,160.18885 -0.57867129,160.11183
--0.57867129,160.11183 C -0.57867129,160.11183 -0.5438361,159.89315
--0.39514638,159.81496 C -0.24645668,159.73678 -0.18316813,159.71981
--0.18316813,159.71981 C -0.18316813,159.71981 -0.10322971,159.58124
--0.057804323,159.58725 C -0.029723983,159.58913 -0.061841603,159.60356
--0.071265813,159.62815 C -0.080250183,159.65325 -0.082918513,159.70554
--0.061841203,159.71248 C -0.040763903,159.7194 -0.0066711426,159.71091
-0.077336307,159.73612 C 0.16879567,159.76377 0.28380306,159.86448
-0.31516668,159.91533 C 0.3465303,159.96618 0.5011127,160.1771
-0.5011127,160.1771 C 0.63668998,160.19238 0.67763022,160.31259
-0.66556395,160.32668 C 0.65339985,160.34212 0.66350443,160.33642
-0.64907098,160.33088 C 0.63463742,160.32533 0.61309688,160.297
-0.5789627,160.29339 C 0.54348657,160.28968 0.52329693,160.27674
-0.50728856,160.27737 C 0.49060916,160.27795 0.48965803,160.31565
-0.46114204,160.33673 C 0.43329696,160.35786 0.4570711,160.39871
-0.43309565,160.40685 C 0.4105108,160.41442 0.39416631,160.33027
-0.3954995,160.2935 C 0.39683269,160.25672 0.43807996,160.21522
-0.44567915,160.19734 C 0.45327833,160.17946 0.27946869,159.9424
--0.061852613,159.99845 C -0.083965233,160.0427 -0.26176109,160.06683
--0.26176109,160.06683 C -0.30127962,160.07028 -0.21167141,160.09731
--0.24649368,160.1011 C -0.32642366,160.11569 -0.34521187,160.06895
--0.40622293,160.0819 C -0.467234,160.09485 -0.56738444,160.17461
--0.59739425,160.18173
-"""
-
-vertices = []
-codes = []
-parts = dolphin.split()
-i = 0
-code_map = {
-    'M': (Path.MOVETO, 1),
-    'C': (Path.CURVE4, 3),
-    'L': (Path.LINETO, 1)
-    }
-
-while i < len(parts):
-    code = parts[i]
-    path_code, npoints = code_map[code]
-    codes.extend([path_code] * npoints)
-    vertices.extend([[float(x) for x in y.split(',')] for y in
-                     parts[i + 1:i + npoints + 1]])
-    i += npoints + 1
-vertices = np.array(vertices, np.float)
-vertices[:, 1] -= 160
-
-dolphin_path = Path(vertices, codes)
-dolphin_patch = PathPatch(dolphin_path, facecolor=(0.6, 0.6, 0.6),
-                          edgecolor=(0.0, 0.0, 0.0))
-ax.add_patch(dolphin_patch)
-
-vertices = Affine2D().rotate_deg(60).transform(vertices)
-dolphin_path2 = Path(vertices, codes)
-dolphin_patch2 = PathPatch(dolphin_path2, facecolor=(0.5, 0.5, 0.5),
-                           edgecolor=(0.0, 0.0, 0.0))
-ax.add_patch(dolphin_patch2)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/ellipse_collection.html b/examples/pylab_examples/ellipse_collection.html deleted file mode 100644 index 4590926ef17..00000000000 --- a/examples/pylab_examples/ellipse_collection.html +++ /dev/null @@ -1,349 +0,0 @@ - - - - - - - - pylab_examples example code: ellipse_collection.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: ellipse_collection.py

-

(Source code, png, pdf)

-
-../../_images/ellipse_collection.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-from matplotlib.collections import EllipseCollection
-
-x = np.arange(10)
-y = np.arange(15)
-X, Y = np.meshgrid(x, y)
-
-XY = np.hstack((X.ravel()[:, np.newaxis], Y.ravel()[:, np.newaxis]))
-
-ww = X/10.0
-hh = Y/15.0
-aa = X*9
-
-
-fig, ax = plt.subplots()
-
-ec = EllipseCollection(ww, hh, aa, units='x', offsets=XY,
-                       transOffset=ax.transData)
-ec.set_array((X + Y).ravel())
-ax.add_collection(ec)
-ax.autoscale_view()
-ax.set_xlabel('X')
-ax.set_ylabel('y')
-cbar = plt.colorbar(ec)
-cbar.set_label('X+Y')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/ellipse_demo.html b/examples/pylab_examples/ellipse_demo.html deleted file mode 100644 index 622f04c3930..00000000000 --- a/examples/pylab_examples/ellipse_demo.html +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - - - pylab_examples example code: ellipse_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: ellipse_demo.py

-

(Source code, png, pdf)

-
-../../_images/ellipse_demo.png -
-
import matplotlib.pyplot as plt
-import numpy.random as rnd
-from matplotlib.patches import Ellipse
-
-NUM = 250
-
-ells = [Ellipse(xy=rnd.rand(2)*10, width=rnd.rand(), height=rnd.rand(), angle=rnd.rand()*360)
-        for i in range(NUM)]
-
-fig = plt.figure(0)
-ax = fig.add_subplot(111, aspect='equal')
-for e in ells:
-    ax.add_artist(e)
-    e.set_clip_box(ax.bbox)
-    e.set_alpha(rnd.rand())
-    e.set_facecolor(rnd.rand(3))
-
-ax.set_xlim(0, 10)
-ax.set_ylim(0, 10)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/ellipse_rotated.html b/examples/pylab_examples/ellipse_rotated.html deleted file mode 100644 index 29ba680ad1c..00000000000 --- a/examples/pylab_examples/ellipse_rotated.html +++ /dev/null @@ -1,342 +0,0 @@ - - - - - - - - pylab_examples example code: ellipse_rotated.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: ellipse_rotated.py

-

(Source code, png, pdf)

-
-../../_images/ellipse_rotated.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-from matplotlib.patches import Ellipse
-
-delta = 45.0  # degrees
-
-angles = np.arange(0, 360 + delta, delta)
-ells = [Ellipse((1, 1), 4, 2, a) for a in angles]
-
-a = plt.subplot(111, aspect='equal')
-
-for e in ells:
-    e.set_clip_box(a.bbox)
-    e.set_alpha(0.1)
-    a.add_artist(e)
-
-plt.xlim(-2, 4)
-plt.ylim(-1, 3)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/equal_aspect_ratio.html b/examples/pylab_examples/equal_aspect_ratio.html deleted file mode 100644 index c4ddc7bb16e..00000000000 --- a/examples/pylab_examples/equal_aspect_ratio.html +++ /dev/null @@ -1,342 +0,0 @@ - - - - - - - - pylab_examples example code: equal_aspect_ratio.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: equal_aspect_ratio.py

-

(Source code, png, pdf)

-
-../../_images/equal_aspect_ratio.png -
-
"""
-Example: simple line plot.
-Show how to make a plot that has equal aspect ratio
-"""
-import matplotlib.pyplot as plt
-import numpy as np
-
-t = np.arange(0.0, 1.0 + 0.01, 0.01)
-s = np.cos(2*2*np.pi*t)
-plt.plot(t, s, '-', lw=2)
-
-plt.xlabel('time (s)')
-plt.ylabel('voltage (mV)')
-plt.title('About as simple as it gets, folks')
-plt.grid(True)
-
-plt.axes().set_aspect('equal', 'datalim')
-
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/errorbar_limits.html b/examples/pylab_examples/errorbar_limits.html deleted file mode 100644 index 8848673a3f0..00000000000 --- a/examples/pylab_examples/errorbar_limits.html +++ /dev/null @@ -1,366 +0,0 @@ - - - - - - - - pylab_examples example code: errorbar_limits.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: errorbar_limits.py

-

(Source code)

-
-../../_images/errorbar_limits_00.png -

(png, pdf)

-
-
-../../_images/errorbar_limits_01.png -

(png, pdf)

-
-
"""
-Illustration of upper and lower limit symbols on errorbars
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-
-fig = plt.figure(0)
-x = np.arange(10.0)
-y = np.sin(np.arange(10.0)/20.0*np.pi)
-
-plt.errorbar(x, y, yerr=0.1)
-
-y = np.sin(np.arange(10.0)/20.0*np.pi) + 1
-plt.errorbar(x, y, yerr=0.1, uplims=True)
-
-y = np.sin(np.arange(10.0)/20.0*np.pi) + 2
-upperlimits = np.array([1, 0]*5)
-lowerlimits = np.array([0, 1]*5)
-plt.errorbar(x, y, yerr=0.1, uplims=upperlimits, lolims=lowerlimits)
-
-plt.xlim(-1, 10)
-
-fig = plt.figure(1)
-x = np.arange(10.0)/10.0
-y = (x + 0.1)**2
-
-plt.errorbar(x, y, xerr=0.1, xlolims=True)
-y = (x + 0.1)**3
-
-plt.errorbar(x + 0.6, y, xerr=0.1, xuplims=upperlimits, xlolims=lowerlimits)
-
-y = (x + 0.1)**4
-plt.errorbar(x + 1.2, y, xerr=0.1, xuplims=True)
-
-plt.xlim(-0.2, 2.4)
-plt.ylim(-0.1, 1.3)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/errorbar_subsample.html b/examples/pylab_examples/errorbar_subsample.html deleted file mode 100644 index a56496318c1..00000000000 --- a/examples/pylab_examples/errorbar_subsample.html +++ /dev/null @@ -1,352 +0,0 @@ - - - - - - - - pylab_examples example code: errorbar_subsample.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: errorbar_subsample.py

-

(Source code, png, pdf)

-
-../../_images/errorbar_subsample.png -
-
'''
-Demo for the errorevery keyword to show data full accuracy data plots with
-few errorbars.
-'''
-
-import numpy as np
-import matplotlib.pyplot as plt
-
-# example data
-x = np.arange(0.1, 4, 0.1)
-y = np.exp(-x)
-
-# example variable error bar values
-yerr = 0.1 + 0.1*np.sqrt(x)
-
-
-# Now switch to a more OO interface to exercise more features.
-fig, axs = plt.subplots(nrows=1, ncols=2, sharex=True)
-ax = axs[0]
-ax.errorbar(x, y, yerr=yerr)
-ax.set_title('all errorbars')
-
-ax = axs[1]
-ax.errorbar(x, y, yerr=yerr, errorevery=5)
-ax.set_title('only every 5th errorbar')
-
-
-fig.suptitle('Errorbar subsampling for better appearance')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/eventcollection_demo.html b/examples/pylab_examples/eventcollection_demo.html deleted file mode 100644 index de81f694348..00000000000 --- a/examples/pylab_examples/eventcollection_demo.html +++ /dev/null @@ -1,376 +0,0 @@ - - - - - - - - pylab_examples example code: eventcollection_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: eventcollection_demo.py

-

(Source code, png, pdf)

-
-../../_images/eventcollection_demo.png -
-
'''
-Plot two curves, then use EventCollections to mark the locations of the x
-and y data points on the respective axes for each curve
-'''
-
-import matplotlib.pyplot as plt
-from matplotlib.collections import EventCollection
-import numpy as np
-
-# create random data
-np.random.seed(50)
-xdata = np.random.random([2, 10])
-
-# split the data into two parts
-xdata1 = xdata[0, :]
-xdata2 = xdata[1, :]
-
-# sort the data so it makes clean curves
-xdata1.sort()
-xdata2.sort()
-
-# create some y data points
-ydata1 = xdata1 ** 2
-ydata2 = 1 - xdata2 ** 3
-
-# plot the data
-fig = plt.figure()
-ax = fig.add_subplot(1, 1, 1)
-ax.plot(xdata1, ydata1, 'r', xdata2, ydata2, 'b')
-
-# create the events marking the x data points
-xevents1 = EventCollection(xdata1, color=[1, 0, 0], linelength=0.05)
-xevents2 = EventCollection(xdata2, color=[0, 0, 1], linelength=0.05)
-
-# create the events marking the y data points
-yevents1 = EventCollection(ydata1, color=[1, 0, 0], linelength=0.05,
-                           orientation='vertical')
-yevents2 = EventCollection(ydata2, color=[0, 0, 1], linelength=0.05,
-                           orientation='vertical')
-
-# add the events to the axis
-ax.add_collection(xevents1)
-ax.add_collection(xevents2)
-ax.add_collection(yevents1)
-ax.add_collection(yevents2)
-
-# set the limits
-ax.set_xlim([0, 1])
-ax.set_ylim([0, 1])
-
-ax.set_title('line plot with data points')
-
-# display the plot
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/eventplot_demo.html b/examples/pylab_examples/eventplot_demo.html deleted file mode 100644 index e4d27df6e95..00000000000 --- a/examples/pylab_examples/eventplot_demo.html +++ /dev/null @@ -1,387 +0,0 @@ - - - - - - - - pylab_examples example code: eventplot_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: eventplot_demo.py

-

(Source code, png, pdf)

-
-../../_images/eventplot_demo1.png -
-
'''
-An eventplot showing sequences of events with various line properties.
-The plot is shown in both horizontal and vertical orientations.
-'''
-
-import matplotlib.pyplot as plt
-import numpy as np
-import matplotlib
-matplotlib.rcParams['font.size'] = 8.0
-
-# set the random seed
-np.random.seed(0)
-
-# create random data
-data1 = np.random.random([6, 50])
-
-# set different colors for each set of positions
-colors1 = np.array([[1, 0, 0],
-                    [0, 1, 0],
-                    [0, 0, 1],
-                    [1, 1, 0],
-                    [1, 0, 1],
-                    [0, 1, 1]])
-
-# set different line properties for each set of positions
-# note that some overlap
-lineoffsets1 = np.array([-15, -3, 1, 1.5, 6, 10])
-linelengths1 = [5, 2, 1, 1, 3, 1.5]
-
-fig = plt.figure()
-
-# create a horizontal plot
-ax1 = fig.add_subplot(221)
-ax1.eventplot(data1, colors=colors1, lineoffsets=lineoffsets1,
-              linelengths=linelengths1)
-
-
-# create a vertical plot
-ax2 = fig.add_subplot(223)
-ax2.eventplot(data1, colors=colors1, lineoffsets=lineoffsets1,
-              linelengths=linelengths1, orientation='vertical')
-
-# create another set of random data.
-# the gamma distribution is only used fo aesthetic purposes
-data2 = np.random.gamma(4, size=[60, 50])
-
-# use individual values for the parameters this time
-# these values will be used for all data sets (except lineoffsets2, which
-# sets the increment between each data set in this usage)
-colors2 = [[0, 0, 0]]
-lineoffsets2 = 1
-linelengths2 = 1
-
-# create a horizontal plot
-ax1 = fig.add_subplot(222)
-ax1.eventplot(data2, colors=colors2, lineoffsets=lineoffsets2,
-              linelengths=linelengths2)
-
-
-# create a vertical plot
-ax2 = fig.add_subplot(224)
-ax2.eventplot(data2, colors=colors2, lineoffsets=lineoffsets2,
-              linelengths=linelengths2, orientation='vertical')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/fancyarrow_demo.html b/examples/pylab_examples/fancyarrow_demo.html deleted file mode 100644 index 845af9493bd..00000000000 --- a/examples/pylab_examples/fancyarrow_demo.html +++ /dev/null @@ -1,372 +0,0 @@ - - - - - - - - pylab_examples example code: fancyarrow_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: fancyarrow_demo.py

-

(Source code, png, pdf)

-
-../../_images/fancyarrow_demo.png -
-
import matplotlib.patches as mpatches
-import matplotlib.pyplot as plt
-
-styles = mpatches.ArrowStyle.get_styles()
-
-ncol = 2
-nrow = (len(styles) + 1) // ncol
-figheight = (nrow + 0.5)
-fig1 = plt.figure(1, (4.*ncol/1.5, figheight/1.5))
-fontsize = 0.2 * 70
-
-
-ax = fig1.add_axes([0, 0, 1, 1], frameon=False, aspect=1.)
-
-ax.set_xlim(0, 4*ncol)
-ax.set_ylim(0, figheight)
-
-
-def to_texstring(s):
-    s = s.replace("<", r"$<$")
-    s = s.replace(">", r"$>$")
-    s = s.replace("|", r"$|$")
-    return s
-
-for i, (stylename, styleclass) in enumerate(sorted(styles.items())):
-    x = 3.2 + (i//nrow)*4
-    y = (figheight - 0.7 - i % nrow)  # /figheight
-    p = mpatches.Circle((x, y), 0.2)
-    ax.add_patch(p)
-
-    ax.annotate(to_texstring(stylename), (x, y),
-                (x - 1.2, y),
-                #xycoords="figure fraction", textcoords="figure fraction",
-                ha="right", va="center",
-                size=fontsize,
-                arrowprops=dict(arrowstyle=stylename,
-                                patchB=p,
-                                shrinkA=5,
-                                shrinkB=5,
-                                fc="k", ec="k",
-                                connectionstyle="arc3,rad=-0.05",
-                                ),
-                bbox=dict(boxstyle="square", fc="w"))
-
-ax.xaxis.set_visible(False)
-ax.yaxis.set_visible(False)
-
-
-plt.draw()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/fancybox_demo.html b/examples/pylab_examples/fancybox_demo.html deleted file mode 100644 index e5aeb857e53..00000000000 --- a/examples/pylab_examples/fancybox_demo.html +++ /dev/null @@ -1,486 +0,0 @@ - - - - - - - - pylab_examples example code: fancybox_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: fancybox_demo.py

-

(Source code)

-

(png, pdf)

-
-../../_images/fancybox_demo_01_00.png -
-
import matplotlib.pyplot as plt
-import matplotlib.transforms as mtransforms
-from matplotlib.patches import FancyBboxPatch
-
-
-# Bbox object around which the fancy box will be drawn.
-bb = mtransforms.Bbox([[0.3, 0.4], [0.7, 0.6]])
-
-
-def draw_bbox(ax, bb):
-    # boxstyle=square with pad=0, i.e. bbox itself.
-    p_bbox = FancyBboxPatch((bb.xmin, bb.ymin),
-                            abs(bb.width), abs(bb.height),
-                            boxstyle="square,pad=0.",
-                            ec="k", fc="none", zorder=10.,
-                            )
-    ax.add_patch(p_bbox)
-
-
-def test1(ax):
-
-    # a fancy box with round corners. pad=0.1
-    p_fancy = FancyBboxPatch((bb.xmin, bb.ymin),
-                             abs(bb.width), abs(bb.height),
-                             boxstyle="round,pad=0.1",
-                             fc=(1., .8, 1.),
-                             ec=(1., 0.5, 1.))
-
-    ax.add_patch(p_fancy)
-
-    ax.text(0.1, 0.8,
-            r' boxstyle="round,pad=0.1"',
-            size=10, transform=ax.transAxes)
-
-    # draws control points for the fancy box.
-    #l = p_fancy.get_path().vertices
-    #ax.plot(l[:,0], l[:,1], ".")
-
-    # draw the original bbox in black
-    draw_bbox(ax, bb)
-
-
-def test2(ax):
-
-    # bbox=round has two optional argument. pad and rounding_size.
-    # They can be set during the initialization.
-    p_fancy = FancyBboxPatch((bb.xmin, bb.ymin),
-                             abs(bb.width), abs(bb.height),
-                             boxstyle="round,pad=0.1",
-                             fc=(1., .8, 1.),
-                             ec=(1., 0.5, 1.))
-
-    ax.add_patch(p_fancy)
-
-    # boxstyle and its argument can be later modified with
-    # set_boxstyle method. Note that the old attributes are simply
-    # forgotten even if the boxstyle name is same.
-
-    p_fancy.set_boxstyle("round,pad=0.1, rounding_size=0.2")
-    # or
-    #p_fancy.set_boxstyle("round", pad=0.1, rounding_size=0.2)
-
-    ax.text(0.1, 0.8,
-            ' boxstyle="round,pad=0.1\n rounding\\_size=0.2"',
-            size=10, transform=ax.transAxes)
-
-    # draws control points for the fancy box.
-    #l = p_fancy.get_path().vertices
-    #ax.plot(l[:,0], l[:,1], ".")
-
-    draw_bbox(ax, bb)
-
-
-def test3(ax):
-
-    # mutation_scale determine overall scale of the mutation,
-    # i.e. both pad and rounding_size is scaled according to this
-    # value.
-    p_fancy = FancyBboxPatch((bb.xmin, bb.ymin),
-                             abs(bb.width), abs(bb.height),
-                             boxstyle="round,pad=0.1",
-                             mutation_scale=2.,
-                             fc=(1., .8, 1.),
-                             ec=(1., 0.5, 1.))
-
-    ax.add_patch(p_fancy)
-
-    ax.text(0.1, 0.8,
-            ' boxstyle="round,pad=0.1"\n mutation\\_scale=2',
-            size=10, transform=ax.transAxes)
-
-    # draws control points for the fancy box.
-    #l = p_fancy.get_path().vertices
-    #ax.plot(l[:,0], l[:,1], ".")
-
-    draw_bbox(ax, bb)
-
-
-def test4(ax):
-
-    # When the aspect ratio of the axes is not 1, the fancy box may
-    # not be what you expected (green)
-
-    p_fancy = FancyBboxPatch((bb.xmin, bb.ymin),
-                             abs(bb.width), abs(bb.height),
-                             boxstyle="round,pad=0.2",
-                             fc="none",
-                             ec=(0., .5, 0.), zorder=4)
-
-    ax.add_patch(p_fancy)
-
-    # You can compensate this by setting the mutation_aspect (pink).
-    p_fancy = FancyBboxPatch((bb.xmin, bb.ymin),
-                             abs(bb.width), abs(bb.height),
-                             boxstyle="round,pad=0.3",
-                             mutation_aspect=.5,
-                             fc=(1., 0.8, 1.),
-                             ec=(1., 0.5, 1.))
-
-    ax.add_patch(p_fancy)
-
-    ax.text(0.1, 0.8,
-            ' boxstyle="round,pad=0.3"\n mutation\\_aspect=.5',
-            size=10, transform=ax.transAxes)
-
-    draw_bbox(ax, bb)
-
-
-def test_all():
-    plt.clf()
-
-    ax = plt.subplot(2, 2, 1)
-    test1(ax)
-    ax.set_xlim(0., 1.)
-    ax.set_ylim(0., 1.)
-    ax.set_title("test1")
-    ax.set_aspect(1.)
-
-    ax = plt.subplot(2, 2, 2)
-    ax.set_title("test2")
-    test2(ax)
-    ax.set_xlim(0., 1.)
-    ax.set_ylim(0., 1.)
-    ax.set_aspect(1.)
-
-    ax = plt.subplot(2, 2, 3)
-    ax.set_title("test3")
-    test3(ax)
-    ax.set_xlim(0., 1.)
-    ax.set_ylim(0., 1.)
-    ax.set_aspect(1)
-
-    ax = plt.subplot(2, 2, 4)
-    ax.set_title("test4")
-    test4(ax)
-    ax.set_xlim(-0.5, 1.5)
-    ax.set_ylim(0., 1.)
-    ax.set_aspect(2.)
-
-    plt.draw()
-    plt.show()
-
-test_all()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/fancybox_demo2.html b/examples/pylab_examples/fancybox_demo2.html deleted file mode 100644 index db540ca3860..00000000000 --- a/examples/pylab_examples/fancybox_demo2.html +++ /dev/null @@ -1,340 +0,0 @@ - - - - - - - - pylab_examples example code: fancybox_demo2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: fancybox_demo2.py

-

(Source code, png, pdf)

-
-../../_images/fancybox_demo2.png -
-
import matplotlib.patches as mpatch
-import matplotlib.pyplot as plt
-
-styles = mpatch.BoxStyle.get_styles()
-spacing = 1.2
-
-figheight = (spacing * len(styles) + .5)
-fig1 = plt.figure(1, (4/1.5, figheight/1.5))
-fontsize = 0.3 * 72
-
-for i, stylename in enumerate(sorted(styles.keys())):
-    fig1.text(0.5, (spacing * (float(len(styles)) - i) - 0.5)/figheight, stylename,
-              ha="center",
-              size=fontsize,
-              transform=fig1.transFigure,
-              bbox=dict(boxstyle=stylename, fc="w", ec="k"))
-plt.draw()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/fancytextbox_demo.html b/examples/pylab_examples/fancytextbox_demo.html deleted file mode 100644 index d82d84b57d2..00000000000 --- a/examples/pylab_examples/fancytextbox_demo.html +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - - - pylab_examples example code: fancytextbox_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: fancytextbox_demo.py

-

(Source code, png, pdf)

-
-../../_images/fancytextbox_demo.png -
-
import matplotlib.pyplot as plt
-
-plt.text(0.6, 0.5, "test", size=50, rotation=30.,
-         ha="center", va="center",
-         bbox=dict(boxstyle="round",
-                   ec=(1., 0.5, 0.5),
-                   fc=(1., 0.8, 0.8),
-                   )
-         )
-
-plt.text(0.5, 0.4, "test", size=50, rotation=-30.,
-         ha="right", va="top",
-         bbox=dict(boxstyle="square",
-                   ec=(1., 0.5, 0.5),
-                   fc=(1., 0.8, 0.8),
-                   )
-         )
-
-
-plt.draw()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/figimage_demo.html b/examples/pylab_examples/figimage_demo.html deleted file mode 100644 index 03129dee1ec..00000000000 --- a/examples/pylab_examples/figimage_demo.html +++ /dev/null @@ -1,341 +0,0 @@ - - - - - - - - pylab_examples example code: figimage_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: figimage_demo.py

-

(Source code, png, pdf)

-
-../../_images/figimage_demo.png -
-
"""
-This illustrates placing images directly in the figure, with no axes.
-
-"""
-import numpy as np
-import matplotlib
-import matplotlib.cm as cm
-import matplotlib.pyplot as plt
-
-
-fig = plt.figure()
-Z = np.arange(10000.0)
-Z.shape = 100, 100
-Z[:, 50:] = 1.
-
-im1 = plt.figimage(Z, xo=50, yo=0, origin='lower')
-im2 = plt.figimage(Z, xo=100, yo=100, alpha=.8, origin='lower')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/figlegend_demo.html b/examples/pylab_examples/figlegend_demo.html deleted file mode 100644 index a5f3332a45d..00000000000 --- a/examples/pylab_examples/figlegend_demo.html +++ /dev/null @@ -1,341 +0,0 @@ - - - - - - - - pylab_examples example code: figlegend_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: figlegend_demo.py

-

(Source code, png, pdf)

-
-../../_images/figlegend_demo.png -
-
import numpy as np
-import matplotlib.pyplot as plt
-
-fig = plt.figure()
-ax1 = fig.add_axes([0.1, 0.1, 0.4, 0.7])
-ax2 = fig.add_axes([0.55, 0.1, 0.4, 0.7])
-
-x = np.arange(0.0, 2.0, 0.02)
-y1 = np.sin(2*np.pi*x)
-y2 = np.exp(-x)
-l1, l2 = ax1.plot(x, y1, 'rs-', x, y2, 'go')
-
-y3 = np.sin(4*np.pi*x)
-y4 = np.exp(-2*x)
-l3, l4 = ax2.plot(x, y3, 'yd-', x, y4, 'k^')
-
-fig.legend((l1, l2), ('Line 1', 'Line 2'), 'upper left')
-fig.legend((l3, l4), ('Line 3', 'Line 4'), 'upper right')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/figure_title.html b/examples/pylab_examples/figure_title.html deleted file mode 100644 index 32d2b65df19..00000000000 --- a/examples/pylab_examples/figure_title.html +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - pylab_examples example code: figure_title.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: figure_title.py

-

(Source code, png, pdf)

-
-../../_images/figure_title.png -
-
from matplotlib.font_manager import FontProperties
-import matplotlib.pyplot as plt
-import numpy as np
-
-
-def f(t):
-    s1 = np.cos(2*np.pi*t)
-    e1 = np.exp(-t)
-    return s1 * e1
-
-t1 = np.arange(0.0, 5.0, 0.1)
-t2 = np.arange(0.0, 5.0, 0.02)
-t3 = np.arange(0.0, 2.0, 0.01)
-
-
-plt.subplot(121)
-plt.plot(t1, f(t1), 'o', t2, f(t2), '-')
-plt.title('subplot 1')
-plt.ylabel('Damped oscillation')
-plt.suptitle('This is a somewhat long figure title', fontsize=16)
-
-
-plt.subplot(122)
-plt.plot(t3, np.cos(2*np.pi*t3), '--')
-plt.xlabel('time (s)')
-plt.title('subplot 2')
-plt.ylabel('Undamped')
-
-plt.subplots_adjust(left=0.2, wspace=0.8, top=0.8)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/fill_between_demo.html b/examples/pylab_examples/fill_between_demo.html deleted file mode 100644 index 9915a453ecb..00000000000 --- a/examples/pylab_examples/fill_between_demo.html +++ /dev/null @@ -1,388 +0,0 @@ - - - - - - - - pylab_examples example code: fill_between_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: fill_between_demo.py

-

(Source code)

-
-../../_images/fill_between_demo_001.png -

(png, pdf)

-
-
-../../_images/fill_between_demo_011.png -

(png, pdf)

-
-
-../../_images/fill_between_demo_021.png -

(png, pdf)

-
-
import matplotlib.pyplot as plt
-import numpy as np
-
-x = np.arange(0.0, 2, 0.01)
-y1 = np.sin(2*np.pi*x)
-y2 = 1.2*np.sin(4*np.pi*x)
-
-fig, (ax1, ax2, ax3) = plt.subplots(3, 1, sharex=True)
-
-ax1.fill_between(x, 0, y1)
-ax1.set_ylabel('between y1 and 0')
-
-ax2.fill_between(x, y1, 1)
-ax2.set_ylabel('between y1 and 1')
-
-ax3.fill_between(x, y1, y2)
-ax3.set_ylabel('between y1 and y2')
-ax3.set_xlabel('x')
-
-# now fill between y1 and y2 where a logical condition is met.  Note
-# this is different than calling
-#   fill_between(x[where], y1[where],y2[where]
-# because of edge effects over multiple contiguous regions.
-fig, (ax, ax1) = plt.subplots(2, 1, sharex=True)
-ax.plot(x, y1, x, y2, color='black')
-ax.fill_between(x, y1, y2, where=y2 >= y1, facecolor='green', interpolate=True)
-ax.fill_between(x, y1, y2, where=y2 <= y1, facecolor='red', interpolate=True)
-ax.set_title('fill between where')
-
-# Test support for masked arrays.
-y2 = np.ma.masked_greater(y2, 1.0)
-ax1.plot(x, y1, x, y2, color='black')
-ax1.fill_between(x, y1, y2, where=y2 >= y1, facecolor='green', interpolate=True)
-ax1.fill_between(x, y1, y2, where=y2 <= y1, facecolor='red', interpolate=True)
-ax1.set_title('Now regions with y2>1 are masked')
-
-# This example illustrates a problem; because of the data
-# gridding, there are undesired unfilled triangles at the crossover
-# points.  A brute-force solution would be to interpolate all
-# arrays to a very fine grid before plotting.
-
-# show how to use transforms to create axes spans where a certain condition is satisfied
-fig, ax = plt.subplots()
-y = np.sin(4*np.pi*x)
-ax.plot(x, y, color='black')
-
-# use the data coordinates for the x-axis and the axes coordinates for the y-axis
-import matplotlib.transforms as mtransforms
-trans = mtransforms.blended_transform_factory(ax.transData, ax.transAxes)
-theta = 0.9
-ax.axhline(theta, color='green', lw=2, alpha=0.5)
-ax.axhline(-theta, color='red', lw=2, alpha=0.5)
-ax.fill_between(x, 0, 1, where=y > theta, facecolor='green', alpha=0.5, transform=trans)
-ax.fill_between(x, 0, 1, where=y < -theta, facecolor='red', alpha=0.5, transform=trans)
-
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/fill_betweenx_demo.html b/examples/pylab_examples/fill_betweenx_demo.html deleted file mode 100644 index 0c238190687..00000000000 --- a/examples/pylab_examples/fill_betweenx_demo.html +++ /dev/null @@ -1,379 +0,0 @@ - - - - - - - - pylab_examples example code: fill_betweenx_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: fill_betweenx_demo.py

-

(Source code)

-
-../../_images/fill_betweenx_demo_001.png -

(png, pdf)

-
-
-../../_images/fill_betweenx_demo_011.png -

(png, pdf)

-
-
"""
-Copy of fill_between.py but using fill_betweenx() instead.
-"""
-import matplotlib.mlab as mlab
-from matplotlib.pyplot import figure, show
-import numpy as np
-
-
-x = np.arange(0.0, 2, 0.01)
-y1 = np.sin(2*np.pi*x)
-y2 = 1.2*np.sin(4*np.pi*x)
-
-fig = figure()
-ax1 = fig.add_subplot(311)
-ax2 = fig.add_subplot(312, sharex=ax1)
-ax3 = fig.add_subplot(313, sharex=ax1)
-
-ax1.fill_betweenx(x, 0, y1)
-ax1.set_ylabel('(y1, 0)')
-
-ax2.fill_betweenx(x, y1, 1)
-ax2.set_ylabel('(y1, 1)')
-
-ax3.fill_betweenx(x, y1, y2)
-ax3.set_ylabel('(y1, y2)')
-ax3.set_xlabel('x')
-
-# now fill between y1 and y2 where a logical condition is met.  Note
-# this is different than calling
-#   fill_between(x[where], y1[where],y2[where]
-# because of edge effects over multiple contiguous regions.
-fig = figure()
-ax = fig.add_subplot(211)
-ax.plot(y1, x, y2, x, color='black')
-ax.fill_betweenx(x, y1, y2, where=y2 >= y1, facecolor='green')
-ax.fill_betweenx(x, y1, y2, where=y2 <= y1, facecolor='red')
-ax.set_title('fill between where')
-
-# Test support for masked arrays.
-y2 = np.ma.masked_greater(y2, 1.0)
-ax1 = fig.add_subplot(212, sharex=ax)
-ax1.plot(y1, x, y2, x, color='black')
-ax1.fill_betweenx(x, y1, y2, where=y2 >= y1, facecolor='green')
-ax1.fill_betweenx(x, y1, y2, where=y2 <= y1, facecolor='red')
-ax1.set_title('Now regions with y2 > 1 are masked')
-
-# This example illustrates a problem; because of the data
-# gridding, there are undesired unfilled triangles at the crossover
-# points.  A brute-force solution would be to interpolate all
-# arrays to a very fine grid before plotting.
-
-show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/fill_spiral.html b/examples/pylab_examples/fill_spiral.html deleted file mode 100644 index 89aac78b768..00000000000 --- a/examples/pylab_examples/fill_spiral.html +++ /dev/null @@ -1,345 +0,0 @@ - - - - - - - - pylab_examples example code: fill_spiral.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: fill_spiral.py

-

(Source code, png, pdf)

-
-../../_images/fill_spiral.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-
-theta = np.arange(0, 8*np.pi, 0.1)
-a = 1
-b = .2
-
-for dt in np.arange(0, 2*np.pi, np.pi/2.0):
-
-    x = a*np.cos(theta + dt)*np.exp(b*theta)
-    y = a*np.sin(theta + dt)*np.exp(b*theta)
-
-    dt = dt + np.pi/4.0
-
-    x2 = a*np.cos(theta + dt)*np.exp(b*theta)
-    y2 = a*np.sin(theta + dt)*np.exp(b*theta)
-
-    xf = np.concatenate((x, x2[::-1]))
-    yf = np.concatenate((y, y2[::-1]))
-
-    p1 = plt.fill(xf, yf)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/filledmarker_demo.html b/examples/pylab_examples/filledmarker_demo.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/pylab_examples/filledmarker_demo.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/pylab_examples/finance_demo.html b/examples/pylab_examples/finance_demo.html deleted file mode 100644 index 70157d762bd..00000000000 --- a/examples/pylab_examples/finance_demo.html +++ /dev/null @@ -1,362 +0,0 @@ - - - - - - - - pylab_examples example code: finance_demo.py — Matplotlib 1.5.3 documentation - - - - - - - - - - - - - - - - - - -
-

Matplotlib 2.0.0rc2 is available

- -

Install the release candidate now!

- -
- - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: finance_demo.py

-

(Source code, png, hires.png, pdf)

-
-../../_images/finance_demo.png -
-
#!/usr/bin/env python
-import matplotlib.pyplot as plt
-from matplotlib.dates import DateFormatter, WeekdayLocator,\
-    DayLocator, MONDAY
-from matplotlib.finance import quotes_historical_yahoo_ohlc, candlestick_ohlc
-
-
-# (Year, month, day) tuples suffice as args for quotes_historical_yahoo
-date1 = (2004, 2, 1)
-date2 = (2004, 4, 12)
-
-
-mondays = WeekdayLocator(MONDAY)        # major ticks on the mondays
-alldays = DayLocator()              # minor ticks on the days
-weekFormatter = DateFormatter('%b %d')  # e.g., Jan 12
-dayFormatter = DateFormatter('%d')      # e.g., 12
-
-quotes = quotes_historical_yahoo_ohlc('INTC', date1, date2)
-if len(quotes) == 0:
-    raise SystemExit
-
-fig, ax = plt.subplots()
-fig.subplots_adjust(bottom=0.2)
-ax.xaxis.set_major_locator(mondays)
-ax.xaxis.set_minor_locator(alldays)
-ax.xaxis.set_major_formatter(weekFormatter)
-#ax.xaxis.set_minor_formatter(dayFormatter)
-
-#plot_day_summary(ax, quotes, ticksize=3)
-candlestick_ohlc(ax, quotes, width=0.6)
-
-ax.xaxis_date()
-ax.autoscale_view()
-plt.setp(plt.gca().get_xticklabels(), rotation=45, horizontalalignment='right')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/finance_work2.html b/examples/pylab_examples/finance_work2.html deleted file mode 100644 index 08c45e70dc2..00000000000 --- a/examples/pylab_examples/finance_work2.html +++ /dev/null @@ -1,533 +0,0 @@ - - - - - - - - pylab_examples example code: finance_work2.py — Matplotlib 1.5.3 documentation - - - - - - - - - - - - - - - - - - -
-

Matplotlib 2.0.0rc2 is available

- -

Install the release candidate now!

- -
- - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: finance_work2.py

-

(Source code, png, hires.png, pdf)

-
-../../_images/finance_work2.png -
-
import datetime
-import numpy as np
-import matplotlib.colors as colors
-import matplotlib.finance as finance
-import matplotlib.dates as mdates
-import matplotlib.ticker as mticker
-import matplotlib.mlab as mlab
-import matplotlib.pyplot as plt
-import matplotlib.font_manager as font_manager
-
-
-startdate = datetime.date(2006, 1, 1)
-today = enddate = datetime.date.today()
-ticker = 'SPY'
-
-
-fh = finance.fetch_historical_yahoo(ticker, startdate, enddate)
-# a numpy record array with fields: date, open, high, low, close, volume, adj_close)
-
-r = mlab.csv2rec(fh)
-fh.close()
-r.sort()
-
-
-def moving_average(x, n, type='simple'):
-    """
-    compute an n period moving average.
-
-    type is 'simple' | 'exponential'
-
-    """
-    x = np.asarray(x)
-    if type == 'simple':
-        weights = np.ones(n)
-    else:
-        weights = np.exp(np.linspace(-1., 0., n))
-
-    weights /= weights.sum()
-
-    a = np.convolve(x, weights, mode='full')[:len(x)]
-    a[:n] = a[n]
-    return a
-
-
-def relative_strength(prices, n=14):
-    """
-    compute the n period relative strength indicator
-    http://stockcharts.com/school/doku.php?id=chart_school:glossary_r#relativestrengthindex
-    http://www.investopedia.com/terms/r/rsi.asp
-    """
-
-    deltas = np.diff(prices)
-    seed = deltas[:n+1]
-    up = seed[seed >= 0].sum()/n
-    down = -seed[seed < 0].sum()/n
-    rs = up/down
-    rsi = np.zeros_like(prices)
-    rsi[:n] = 100. - 100./(1. + rs)
-
-    for i in range(n, len(prices)):
-        delta = deltas[i - 1]  # cause the diff is 1 shorter
-
-        if delta > 0:
-            upval = delta
-            downval = 0.
-        else:
-            upval = 0.
-            downval = -delta
-
-        up = (up*(n - 1) + upval)/n
-        down = (down*(n - 1) + downval)/n
-
-        rs = up/down
-        rsi[i] = 100. - 100./(1. + rs)
-
-    return rsi
-
-
-def moving_average_convergence(x, nslow=26, nfast=12):
-    """
-    compute the MACD (Moving Average Convergence/Divergence) using a fast and slow exponential moving avg'
-    return value is emaslow, emafast, macd which are len(x) arrays
-    """
-    emaslow = moving_average(x, nslow, type='exponential')
-    emafast = moving_average(x, nfast, type='exponential')
-    return emaslow, emafast, emafast - emaslow
-
-
-plt.rc('axes', grid=True)
-plt.rc('grid', color='0.75', linestyle='-', linewidth=0.5)
-
-textsize = 9
-left, width = 0.1, 0.8
-rect1 = [left, 0.7, width, 0.2]
-rect2 = [left, 0.3, width, 0.4]
-rect3 = [left, 0.1, width, 0.2]
-
-
-fig = plt.figure(facecolor='white')
-axescolor = '#f6f6f6'  # the axes background color
-
-ax1 = fig.add_axes(rect1, axisbg=axescolor)  # left, bottom, width, height
-ax2 = fig.add_axes(rect2, axisbg=axescolor, sharex=ax1)
-ax2t = ax2.twinx()
-ax3 = fig.add_axes(rect3, axisbg=axescolor, sharex=ax1)
-
-
-# plot the relative strength indicator
-prices = r.adj_close
-rsi = relative_strength(prices)
-fillcolor = 'darkgoldenrod'
-
-ax1.plot(r.date, rsi, color=fillcolor)
-ax1.axhline(70, color=fillcolor)
-ax1.axhline(30, color=fillcolor)
-ax1.fill_between(r.date, rsi, 70, where=(rsi >= 70), facecolor=fillcolor, edgecolor=fillcolor)
-ax1.fill_between(r.date, rsi, 30, where=(rsi <= 30), facecolor=fillcolor, edgecolor=fillcolor)
-ax1.text(0.6, 0.9, '>70 = overbought', va='top', transform=ax1.transAxes, fontsize=textsize)
-ax1.text(0.6, 0.1, '<30 = oversold', transform=ax1.transAxes, fontsize=textsize)
-ax1.set_ylim(0, 100)
-ax1.set_yticks([30, 70])
-ax1.text(0.025, 0.95, 'RSI (14)', va='top', transform=ax1.transAxes, fontsize=textsize)
-ax1.set_title('%s daily' % ticker)
-
-# plot the price and volume data
-dx = r.adj_close - r.close
-low = r.low + dx
-high = r.high + dx
-
-deltas = np.zeros_like(prices)
-deltas[1:] = np.diff(prices)
-up = deltas > 0
-ax2.vlines(r.date[up], low[up], high[up], color='black', label='_nolegend_')
-ax2.vlines(r.date[~up], low[~up], high[~up], color='black', label='_nolegend_')
-ma20 = moving_average(prices, 20, type='simple')
-ma200 = moving_average(prices, 200, type='simple')
-
-linema20, = ax2.plot(r.date, ma20, color='blue', lw=2, label='MA (20)')
-linema200, = ax2.plot(r.date, ma200, color='red', lw=2, label='MA (200)')
-
-
-last = r[-1]
-s = '%s O:%1.2f H:%1.2f L:%1.2f C:%1.2f, V:%1.1fM Chg:%+1.2f' % (
-    today.strftime('%d-%b-%Y'),
-    last.open, last.high,
-    last.low, last.close,
-    last.volume*1e-6,
-    last.close - last.open)
-t4 = ax2.text(0.3, 0.9, s, transform=ax2.transAxes, fontsize=textsize)
-
-props = font_manager.FontProperties(size=10)
-leg = ax2.legend(loc='center left', shadow=True, fancybox=True, prop=props)
-leg.get_frame().set_alpha(0.5)
-
-
-volume = (r.close*r.volume)/1e6  # dollar volume in millions
-vmax = volume.max()
-poly = ax2t.fill_between(r.date, volume, 0, label='Volume', facecolor=fillcolor, edgecolor=fillcolor)
-ax2t.set_ylim(0, 5*vmax)
-ax2t.set_yticks([])
-
-
-# compute the MACD indicator
-fillcolor = 'darkslategrey'
-nslow = 26
-nfast = 12
-nema = 9
-emaslow, emafast, macd = moving_average_convergence(prices, nslow=nslow, nfast=nfast)
-ema9 = moving_average(macd, nema, type='exponential')
-ax3.plot(r.date, macd, color='black', lw=2)
-ax3.plot(r.date, ema9, color='blue', lw=1)
-ax3.fill_between(r.date, macd - ema9, 0, alpha=0.5, facecolor=fillcolor, edgecolor=fillcolor)
-
-
-ax3.text(0.025, 0.95, 'MACD (%d, %d, %d)' % (nfast, nslow, nema), va='top',
-         transform=ax3.transAxes, fontsize=textsize)
-
-#ax3.set_yticks([])
-# turn off upper axis tick labels, rotate the lower ones, etc
-for ax in ax1, ax2, ax2t, ax3:
-    if ax != ax3:
-        for label in ax.get_xticklabels():
-            label.set_visible(False)
-    else:
-        for label in ax.get_xticklabels():
-            label.set_rotation(30)
-            label.set_horizontalalignment('right')
-
-    ax.fmt_xdata = mdates.DateFormatter('%Y-%m-%d')
-
-
-class MyLocator(mticker.MaxNLocator):
-    def __init__(self, *args, **kwargs):
-        mticker.MaxNLocator.__init__(self, *args, **kwargs)
-
-    def __call__(self, *args, **kwargs):
-        return mticker.MaxNLocator.__call__(self, *args, **kwargs)
-
-# at most 5 ticks, pruning the upper and lower so they don't overlap
-# with other ticks
-#ax2.yaxis.set_major_locator(mticker.MaxNLocator(5, prune='both'))
-#ax3.yaxis.set_major_locator(mticker.MaxNLocator(5, prune='both'))
-
-ax2.yaxis.set_major_locator(MyLocator(5, prune='both'))
-ax3.yaxis.set_major_locator(MyLocator(5, prune='both'))
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/findobj_demo.html b/examples/pylab_examples/findobj_demo.html deleted file mode 100644 index 5010cf51e50..00000000000 --- a/examples/pylab_examples/findobj_demo.html +++ /dev/null @@ -1,358 +0,0 @@ - - - - - - - - pylab_examples example code: findobj_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: findobj_demo.py

-

(Source code, png, pdf)

-
-../../_images/findobj_demo.png -
-
"""
-Recursively find all objects that match some criteria
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.text as text
-
-a = np.arange(0, 3, .02)
-b = np.arange(0, 3, .02)
-c = np.exp(a)
-d = c[::-1]
-
-fig, ax = plt.subplots()
-plt.plot(a, c, 'k--', a, d, 'k:', a, c + d, 'k')
-plt.legend(('Model length', 'Data length', 'Total message length'),
-           loc='upper center', shadow=True)
-plt.ylim([-1, 20])
-plt.grid(False)
-plt.xlabel('Model complexity --->')
-plt.ylabel('Message length --->')
-plt.title('Minimum Message Length')
-
-
-# match on arbitrary function
-def myfunc(x):
-    return hasattr(x, 'set_color') and not hasattr(x, 'set_facecolor')
-
-for o in fig.findobj(myfunc):
-    o.set_color('blue')
-
-# match on class instances
-for o in fig.findobj(text.Text):
-    o.set_fontstyle('italic')
-
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/font_table_ttf.html b/examples/pylab_examples/font_table_ttf.html deleted file mode 100644 index 0ea7914ffc6..00000000000 --- a/examples/pylab_examples/font_table_ttf.html +++ /dev/null @@ -1,385 +0,0 @@ - - - - - - - - pylab_examples example code: font_table_ttf.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: font_table_ttf.py

-

[source code]

-
# -*- noplot -*-
-"""
-matplotlib has support for FreeType fonts.  Here's a little example
-using the 'table' command to build a font table that shows the glyphs
-by character code.
-
-Usage python font_table_ttf.py somefile.ttf
-"""
-
-import sys
-import os
-
-import matplotlib
-from matplotlib.ft2font import FT2Font
-from matplotlib.font_manager import FontProperties
-import matplotlib.pyplot as plt
-
-import six
-from six import unichr
-
-# the font table grid
-
-labelc = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-          'A', 'B', 'C', 'D', 'E', 'F']
-labelr = ['00', '10', '20', '30', '40', '50', '60', '70', '80', '90',
-          'A0', 'B0', 'C0', 'D0', 'E0', 'F0']
-
-if len(sys.argv) > 1:
-    fontname = sys.argv[1]
-else:
-    fontname = os.path.join(matplotlib.get_data_path(),
-                            'fonts', 'ttf', 'DejaVuSans.ttf')
-
-font = FT2Font(fontname)
-codes = list(font.get_charmap().items())
-codes.sort()
-
-# a 16,16 array of character strings
-chars = [['' for c in range(16)] for r in range(16)]
-colors = [[(0.95, 0.95, 0.95) for c in range(16)] for r in range(16)]
-
-plt.figure(figsize=(8, 4), dpi=120)
-for ccode, glyphind in codes:
-    if ccode >= 256:
-        continue
-    r, c = divmod(ccode, 16)
-    s = unichr(ccode)
-    chars[r][c] = s
-
-lightgrn = (0.5, 0.8, 0.5)
-plt.title(fontname)
-tab = plt.table(cellText=chars,
-                rowLabels=labelr,
-                colLabels=labelc,
-                rowColours=[lightgrn]*16,
-                colColours=[lightgrn]*16,
-                cellColours=colors,
-                cellLoc='center',
-                loc='upper left')
-
-for key, cell in tab.get_celld().items():
-    row, col = key
-    if row > 0 and col > 0:
-        cell.set_text_props(fontproperties=FontProperties(fname=fontname))
-plt.axis('off')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/font_table_ttf.py b/examples/pylab_examples/font_table_ttf.py deleted file mode 100644 index b59ca990bb3..00000000000 --- a/examples/pylab_examples/font_table_ttf.py +++ /dev/null @@ -1,66 +0,0 @@ -# -*- noplot -*- -""" -matplotlib has support for FreeType fonts. Here's a little example -using the 'table' command to build a font table that shows the glyphs -by character code. - -Usage python font_table_ttf.py somefile.ttf -""" - -import sys -import os - -import matplotlib -from matplotlib.ft2font import FT2Font -from matplotlib.font_manager import FontProperties -import matplotlib.pyplot as plt - -import six -from six import unichr - -# the font table grid - -labelc = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - 'A', 'B', 'C', 'D', 'E', 'F'] -labelr = ['00', '10', '20', '30', '40', '50', '60', '70', '80', '90', - 'A0', 'B0', 'C0', 'D0', 'E0', 'F0'] - -if len(sys.argv) > 1: - fontname = sys.argv[1] -else: - fontname = os.path.join(matplotlib.get_data_path(), - 'fonts', 'ttf', 'DejaVuSans.ttf') - -font = FT2Font(fontname) -codes = list(font.get_charmap().items()) -codes.sort() - -# a 16,16 array of character strings -chars = [['' for c in range(16)] for r in range(16)] -colors = [[(0.95, 0.95, 0.95) for c in range(16)] for r in range(16)] - -plt.figure(figsize=(8, 4), dpi=120) -for ccode, glyphind in codes: - if ccode >= 256: - continue - r, c = divmod(ccode, 16) - s = unichr(ccode) - chars[r][c] = s - -lightgrn = (0.5, 0.8, 0.5) -plt.title(fontname) -tab = plt.table(cellText=chars, - rowLabels=labelr, - colLabels=labelc, - rowColours=[lightgrn]*16, - colColours=[lightgrn]*16, - cellColours=colors, - cellLoc='center', - loc='upper left') - -for key, cell in tab.get_celld().items(): - row, col = key - if row > 0 and col > 0: - cell.set_text_props(fontproperties=FontProperties(fname=fontname)) -plt.axis('off') -plt.show() diff --git a/examples/pylab_examples/fonts_demo.html b/examples/pylab_examples/fonts_demo.html deleted file mode 100644 index 8f917cb8a7d..00000000000 --- a/examples/pylab_examples/fonts_demo.html +++ /dev/null @@ -1,434 +0,0 @@ - - - - - - - - pylab_examples example code: fonts_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: fonts_demo.py

-

(Source code, png, pdf)

-
-../../_images/fonts_demo.png -
-
"""
-Show how to set custom font properties.
-
-For interactive users, you can also use kwargs to the text command,
-which requires less typing.  See examples/fonts_demo_kw.py
-"""
-from matplotlib.font_manager import FontProperties
-import matplotlib.pyplot as plt
-
-plt.subplot(111, facecolor='w')
-
-font0 = FontProperties()
-alignment = {'horizontalalignment': 'center', 'verticalalignment': 'baseline'}
-# Show family options
-
-families = ['serif', 'sans-serif', 'cursive', 'fantasy', 'monospace']
-
-font1 = font0.copy()
-font1.set_size('large')
-
-t = plt.text(-0.8, 0.9, 'family', fontproperties=font1,
-             **alignment)
-
-yp = [0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2]
-
-for k, family in enumerate(families):
-    font = font0.copy()
-    font.set_family(family)
-    t = plt.text(-0.8, yp[k], family, fontproperties=font,
-                 **alignment)
-
-# Show style options
-
-styles = ['normal', 'italic', 'oblique']
-
-t = plt.text(-0.4, 0.9, 'style', fontproperties=font1,
-             **alignment)
-
-for k, style in enumerate(styles):
-    font = font0.copy()
-    font.set_family('sans-serif')
-    font.set_style(style)
-    t = plt.text(-0.4, yp[k], style, fontproperties=font,
-                 **alignment)
-
-# Show variant options
-
-variants = ['normal', 'small-caps']
-
-t = plt.text(0.0, 0.9, 'variant', fontproperties=font1,
-             **alignment)
-
-for k, variant in enumerate(variants):
-    font = font0.copy()
-    font.set_family('serif')
-    font.set_variant(variant)
-    t = plt.text(0.0, yp[k], variant, fontproperties=font,
-                 **alignment)
-
-# Show weight options
-
-weights = ['light', 'normal', 'medium', 'semibold', 'bold', 'heavy', 'black']
-
-t = plt.text(0.4, 0.9, 'weight', fontproperties=font1,
-             **alignment)
-
-for k, weight in enumerate(weights):
-    font = font0.copy()
-    font.set_weight(weight)
-    t = plt.text(0.4, yp[k], weight, fontproperties=font,
-                 **alignment)
-
-# Show size options
-
-sizes = ['xx-small', 'x-small', 'small', 'medium', 'large',
-         'x-large', 'xx-large']
-
-t = plt.text(0.8, 0.9, 'size', fontproperties=font1,
-             **alignment)
-
-for k, size in enumerate(sizes):
-    font = font0.copy()
-    font.set_size(size)
-    t = plt.text(0.8, yp[k], size, fontproperties=font,
-                 **alignment)
-
-# Show bold italic
-
-font = font0.copy()
-font.set_style('italic')
-font.set_weight('bold')
-font.set_size('x-small')
-t = plt.text(-0.4, 0.1, 'bold italic', fontproperties=font,
-             **alignment)
-
-font = font0.copy()
-font.set_style('italic')
-font.set_weight('bold')
-font.set_size('medium')
-t = plt.text(-0.4, 0.2, 'bold italic', fontproperties=font,
-             **alignment)
-
-font = font0.copy()
-font.set_style('italic')
-font.set_weight('bold')
-font.set_size('x-large')
-t = plt.text(-0.4, 0.3, 'bold italic', fontproperties=font,
-             **alignment)
-
-plt.axis([-1, 1, 0, 1])
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/fonts_demo_kw.html b/examples/pylab_examples/fonts_demo_kw.html deleted file mode 100644 index 23264df08eb..00000000000 --- a/examples/pylab_examples/fonts_demo_kw.html +++ /dev/null @@ -1,403 +0,0 @@ - - - - - - - - pylab_examples example code: fonts_demo_kw.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: fonts_demo_kw.py

-

(Source code, png, pdf)

-
-../../_images/fonts_demo_kw.png -
-
"""
-Same as fonts_demo using kwargs.  If you prefer a more pythonic, OO
-style of coding, see examples/fonts_demo.py.
-
-"""
-from matplotlib.font_manager import FontProperties
-import matplotlib.pyplot as plt
-import numpy as np
-
-plt.subplot(111, facecolor='w')
-alignment = {'horizontalalignment': 'center', 'verticalalignment': 'baseline'}
-
-# Show family options
-
-families = ['serif', 'sans-serif', 'cursive', 'fantasy', 'monospace']
-
-t = plt.text(-0.8, 0.9, 'family', size='large', **alignment)
-
-yp = [0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2]
-
-for k, family in enumerate(families):
-    t = plt.text(-0.8, yp[k], family, family=family, **alignment)
-
-# Show style options
-
-styles = ['normal', 'italic', 'oblique']
-
-t = plt.text(-0.4, 0.9, 'style', **alignment)
-
-for k, style in enumerate(styles):
-    t = plt.text(-0.4, yp[k], style, family='sans-serif', style=style,
-                 **alignment)
-
-# Show variant options
-
-variants = ['normal', 'small-caps']
-
-t = plt.text(0.0, 0.9, 'variant', **alignment)
-
-for k, variant in enumerate(variants):
-    t = plt.text(0.0, yp[k], variant, family='serif', variant=variant,
-                 **alignment)
-
-# Show weight options
-
-weights = ['light', 'normal', 'medium', 'semibold', 'bold', 'heavy', 'black']
-
-t = plt.text(0.4, 0.9, 'weight', **alignment)
-
-for k, weight in enumerate(weights):
-    t = plt.text(0.4, yp[k], weight, weight=weight,
-                 **alignment)
-
-# Show size options
-
-sizes = ['xx-small', 'x-small', 'small', 'medium', 'large',
-         'x-large', 'xx-large']
-
-t = plt.text(0.8, 0.9, 'size', **alignment)
-
-for k, size in enumerate(sizes):
-    t = plt.text(0.8, yp[k], size, size=size,
-                 **alignment)
-
-x = -0.4
-# Show bold italic
-t = plt.text(x, 0.1, 'bold italic', style='italic',
-             weight='bold', size='x-small',
-             **alignment)
-
-t = plt.text(x, 0.2, 'bold italic',
-             style='italic', weight='bold', size='medium',
-             **alignment)
-
-t = plt.text(x, 0.3, 'bold italic',
-             style='italic', weight='bold', size='x-large',
-             **alignment)
-
-plt.axis([-1, 1, 0, 1])
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/ganged_plots.html b/examples/pylab_examples/ganged_plots.html deleted file mode 100644 index 435fd417ce4..00000000000 --- a/examples/pylab_examples/ganged_plots.html +++ /dev/null @@ -1,367 +0,0 @@ - - - - - - - - pylab_examples example code: ganged_plots.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: ganged_plots.py

-

(Source code, png, pdf)

-
-../../_images/ganged_plots.png -
-
"""
-To create plots that share a common axes (visually) you can set the
-hspace between the subplots close to zero (do not use zero itself).
-Normally you'll want to turn off the tick labels on all but one of the
-axes.
-
-In this example the plots share a common xaxis but you can follow the
-same logic to supply a common y axis.
-"""
-import matplotlib.pyplot as plt
-import numpy as np
-
-t = np.arange(0.0, 2.0, 0.01)
-
-s1 = np.sin(2*np.pi*t)
-s2 = np.exp(-t)
-s3 = s1*s2
-
-# axes rect in relative 0,1 coords left, bottom, width, height.  Turn
-# off xtick labels on all but the lower plot
-
-
-f = plt.figure()
-plt.subplots_adjust(hspace=0.001)
-
-
-ax1 = plt.subplot(311)
-ax1.plot(t, s1)
-plt.yticks(np.arange(-0.9, 1.0, 0.4))
-plt.ylim(-1, 1)
-
-ax2 = plt.subplot(312, sharex=ax1)
-ax2.plot(t, s2)
-plt.yticks(np.arange(0.1, 1.0, 0.2))
-plt.ylim(0, 1)
-
-ax3 = plt.subplot(313, sharex=ax1)
-ax3.plot(t, s3)
-plt.yticks(np.arange(-0.9, 1.0, 0.4))
-plt.ylim(-1, 1)
-
-xticklabels = ax1.get_xticklabels() + ax2.get_xticklabels()
-plt.setp(xticklabels, visible=False)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/geo_demo.html b/examples/pylab_examples/geo_demo.html deleted file mode 100644 index c76b04653d7..00000000000 --- a/examples/pylab_examples/geo_demo.html +++ /dev/null @@ -1,358 +0,0 @@ - - - - - - - - pylab_examples example code: geo_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: geo_demo.py

-

(Source code)

-
-../../_images/geo_demo_00.png -

(png, pdf)

-
-
-../../_images/geo_demo_01.png -

(png, pdf)

-
-
-../../_images/geo_demo_02.png -

(png, pdf)

-
-
-../../_images/geo_demo_03.png -

(png, pdf)

-
-
import matplotlib.pyplot as plt
-
-plt.figure()
-plt.subplot(111, projection="aitoff")
-plt.title("Aitoff")
-plt.grid(True)
-
-plt.figure()
-plt.subplot(111, projection="hammer")
-plt.title("Hammer")
-plt.grid(True)
-
-plt.figure()
-plt.subplot(111, projection="lambert")
-plt.title("Lambert")
-plt.grid(True)
-
-plt.figure()
-plt.subplot(111, projection="mollweide")
-plt.title("Mollweide")
-plt.grid(True)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/ginput_demo.html b/examples/pylab_examples/ginput_demo.html deleted file mode 100644 index 70b6a76dcc5..00000000000 --- a/examples/pylab_examples/ginput_demo.html +++ /dev/null @@ -1,331 +0,0 @@ - - - - - - - - pylab_examples example code: ginput_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: ginput_demo.py

-

[source code]

-
# -*- noplot -*-
-
-from __future__ import print_function
-
-import matplotlib.pyplot as plt
-import numpy as np
-t = np.arange(10)
-plt.plot(t, np.sin(t))
-print("Please click")
-x = plt.ginput(3)
-print("clicked", x)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/ginput_demo.py b/examples/pylab_examples/ginput_demo.py deleted file mode 100644 index f92f16917a7..00000000000 --- a/examples/pylab_examples/ginput_demo.py +++ /dev/null @@ -1,12 +0,0 @@ -# -*- noplot -*- - -from __future__ import print_function - -import matplotlib.pyplot as plt -import numpy as np -t = np.arange(10) -plt.plot(t, np.sin(t)) -print("Please click") -x = plt.ginput(3) -print("clicked", x) -plt.show() diff --git a/examples/pylab_examples/ginput_manual_clabel.html b/examples/pylab_examples/ginput_manual_clabel.html deleted file mode 100644 index 7d780af2ba4..00000000000 --- a/examples/pylab_examples/ginput_manual_clabel.html +++ /dev/null @@ -1,418 +0,0 @@ - - - - - - - - pylab_examples example code: ginput_manual_clabel.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: ginput_manual_clabel.py

-

[source code]

-
# -*- noplot -*-
-
-from __future__ import print_function
-"""
-This provides examples of uses of interactive functions, such as ginput,
-waitforbuttonpress and manual clabel placement.
-
-This script must be run interactively using a backend that has a
-graphical user interface (for example, using GTKAgg backend, but not
-PS backend).
-
-See also ginput_demo.py
-"""
-import time
-import matplotlib
-import numpy as np
-import matplotlib.cm as cm
-import matplotlib.mlab as mlab
-import matplotlib.pyplot as plt
-
-
-def tellme(s):
-    print(s)
-    plt.title(s, fontsize=16)
-    plt.draw()
-
-##################################################
-# Define a triangle by clicking three points
-##################################################
-plt.clf()
-plt.axis([-1., 1., -1., 1.])
-plt.setp(plt.gca(), autoscale_on=False)
-
-tellme('You will define a triangle, click to begin')
-
-plt.waitforbuttonpress()
-
-happy = False
-while not happy:
-    pts = []
-    while len(pts) < 3:
-        tellme('Select 3 corners with mouse')
-        pts = np.asarray(plt.ginput(3, timeout=-1))
-        if len(pts) < 3:
-            tellme('Too few points, starting over')
-            time.sleep(1)  # Wait a second
-
-    ph = plt.fill(pts[:, 0], pts[:, 1], 'r', lw=2)
-
-    tellme('Happy? Key click for yes, mouse click for no')
-
-    happy = plt.waitforbuttonpress()
-
-    # Get rid of fill
-    if not happy:
-        for p in ph:
-            p.remove()
-
-##################################################
-# Now contour according to distance from triangle
-# corners - just an example
-##################################################
-
-
-# Define a nice function of distance from individual pts
-def f(x, y, pts):
-    z = np.zeros_like(x)
-    for p in pts:
-        z = z + 1/(np.sqrt((x - p[0])**2 + (y - p[1])**2))
-    return 1/z
-
-X, Y = np.meshgrid(np.linspace(-1, 1, 51), np.linspace(-1, 1, 51))
-Z = f(X, Y, pts)
-
-CS = plt.contour(X, Y, Z, 20)
-
-tellme('Use mouse to select contour label locations, middle button to finish')
-CL = plt.clabel(CS, manual=True)
-
-##################################################
-# Now do a zoom
-##################################################
-tellme('Now do a nested zoom, click to begin')
-plt.waitforbuttonpress()
-
-happy = False
-while not happy:
-    tellme('Select two corners of zoom, middle mouse button to finish')
-    pts = np.asarray(plt.ginput(2, timeout=-1))
-
-    happy = len(pts) < 2
-    if happy:
-        break
-
-    pts = np.sort(pts, axis=0)
-    plt.axis(pts.T.ravel())
-
-tellme('All Done!')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/ginput_manual_clabel.py b/examples/pylab_examples/ginput_manual_clabel.py deleted file mode 100644 index 9cbf85cbde9..00000000000 --- a/examples/pylab_examples/ginput_manual_clabel.py +++ /dev/null @@ -1,99 +0,0 @@ -# -*- noplot -*- - -from __future__ import print_function -""" -This provides examples of uses of interactive functions, such as ginput, -waitforbuttonpress and manual clabel placement. - -This script must be run interactively using a backend that has a -graphical user interface (for example, using GTKAgg backend, but not -PS backend). - -See also ginput_demo.py -""" -import time -import matplotlib -import numpy as np -import matplotlib.cm as cm -import matplotlib.mlab as mlab -import matplotlib.pyplot as plt - - -def tellme(s): - print(s) - plt.title(s, fontsize=16) - plt.draw() - -################################################## -# Define a triangle by clicking three points -################################################## -plt.clf() -plt.axis([-1., 1., -1., 1.]) -plt.setp(plt.gca(), autoscale_on=False) - -tellme('You will define a triangle, click to begin') - -plt.waitforbuttonpress() - -happy = False -while not happy: - pts = [] - while len(pts) < 3: - tellme('Select 3 corners with mouse') - pts = np.asarray(plt.ginput(3, timeout=-1)) - if len(pts) < 3: - tellme('Too few points, starting over') - time.sleep(1) # Wait a second - - ph = plt.fill(pts[:, 0], pts[:, 1], 'r', lw=2) - - tellme('Happy? Key click for yes, mouse click for no') - - happy = plt.waitforbuttonpress() - - # Get rid of fill - if not happy: - for p in ph: - p.remove() - -################################################## -# Now contour according to distance from triangle -# corners - just an example -################################################## - - -# Define a nice function of distance from individual pts -def f(x, y, pts): - z = np.zeros_like(x) - for p in pts: - z = z + 1/(np.sqrt((x - p[0])**2 + (y - p[1])**2)) - return 1/z - -X, Y = np.meshgrid(np.linspace(-1, 1, 51), np.linspace(-1, 1, 51)) -Z = f(X, Y, pts) - -CS = plt.contour(X, Y, Z, 20) - -tellme('Use mouse to select contour label locations, middle button to finish') -CL = plt.clabel(CS, manual=True) - -################################################## -# Now do a zoom -################################################## -tellme('Now do a nested zoom, click to begin') -plt.waitforbuttonpress() - -happy = False -while not happy: - tellme('Select two corners of zoom, middle mouse button to finish') - pts = np.asarray(plt.ginput(2, timeout=-1)) - - happy = len(pts) < 2 - if happy: - break - - pts = np.sort(pts, axis=0) - plt.axis(pts.T.ravel()) - -tellme('All Done!') -plt.show() diff --git a/examples/pylab_examples/gradient_bar.html b/examples/pylab_examples/gradient_bar.html deleted file mode 100644 index c816ca7e968..00000000000 --- a/examples/pylab_examples/gradient_bar.html +++ /dev/null @@ -1,351 +0,0 @@ - - - - - - - - pylab_examples example code: gradient_bar.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: gradient_bar.py

-

(Source code, png, pdf)

-
-../../_images/gradient_bar.png -
-
from matplotlib.pyplot import figure, show, cm
-from numpy import arange
-from numpy.random import rand
-
-
-def gbar(ax, x, y, width=0.5, bottom=0):
-    X = [[.6, .6], [.7, .7]]
-    for left, top in zip(x, y):
-        right = left + width
-        ax.imshow(X, interpolation='bicubic', cmap=cm.Blues,
-                  extent=(left, right, bottom, top), alpha=1)
-
-fig = figure()
-
-xmin, xmax = xlim = 0, 10
-ymin, ymax = ylim = 0, 1
-ax = fig.add_subplot(111, xlim=xlim, ylim=ylim,
-                     autoscale_on=False)
-X = [[.6, .6], [.7, .7]]
-
-ax.imshow(X, interpolation='bicubic', cmap=cm.copper,
-          extent=(xmin, xmax, ymin, ymax), alpha=1)
-
-N = 10
-x = arange(N) + 0.25
-y = rand(N)
-gbar(ax, x, y, width=0.7)
-ax.set_aspect('auto')
-show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/griddata_demo.html b/examples/pylab_examples/griddata_demo.html deleted file mode 100644 index 99e0996f5c5..00000000000 --- a/examples/pylab_examples/griddata_demo.html +++ /dev/null @@ -1,349 +0,0 @@ - - - - - - - - pylab_examples example code: griddata_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: griddata_demo.py

-

(Source code, png, pdf)

-
-../../_images/griddata_demo.png -
-
from numpy.random import uniform, seed
-from matplotlib.mlab import griddata
-import matplotlib.pyplot as plt
-import numpy as np
-# make up data.
-#npts = int(raw_input('enter # of random points to plot:'))
-seed(0)
-npts = 200
-x = uniform(-2, 2, npts)
-y = uniform(-2, 2, npts)
-z = x*np.exp(-x**2 - y**2)
-# define grid.
-xi = np.linspace(-2.1, 2.1, 100)
-yi = np.linspace(-2.1, 2.1, 200)
-# grid the data.
-zi = griddata(x, y, z, xi, yi, interp='linear')
-# contour the gridded data, plotting dots at the nonuniform data points.
-CS = plt.contour(xi, yi, zi, 15, linewidths=0.5, colors='k')
-CS = plt.contourf(xi, yi, zi, 15,
-                  vmax=abs(zi).max(), vmin=-abs(zi).max())
-plt.colorbar()  # draw colorbar
-# plot data points.
-plt.scatter(x, y, marker='o', s=5, zorder=10)
-plt.xlim(-2, 2)
-plt.ylim(-2, 2)
-plt.title('griddata test (%d points)' % npts)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/hatch_demo.html b/examples/pylab_examples/hatch_demo.html deleted file mode 100644 index 86ce7595d53..00000000000 --- a/examples/pylab_examples/hatch_demo.html +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - pylab_examples example code: hatch_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: hatch_demo.py

-

(Source code, png, pdf)

-
-../../_images/hatch_demo.png -
-
"""
-Hatching (pattern filled polygons) is supported currently in the PS,
-PDF, SVG and Agg backends only.
-"""
-import matplotlib.pyplot as plt
-from matplotlib.patches import Ellipse, Polygon
-
-fig = plt.figure()
-ax1 = fig.add_subplot(131)
-ax1.bar(range(1, 5), range(1, 5), color='red', edgecolor='black', hatch="/")
-ax1.bar(range(1, 5), [6] * 4, bottom=range(1, 5), color='blue', edgecolor='black', hatch='//')
-ax1.set_xticks([1.5, 2.5, 3.5, 4.5])
-
-ax2 = fig.add_subplot(132)
-bars = ax2.bar(range(1, 5), range(1, 5), color='yellow', ecolor='black') + \
-    ax2.bar(range(1, 5), [6] * 4, bottom=range(1, 5), color='green', ecolor='black')
-ax2.set_xticks([1.5, 2.5, 3.5, 4.5])
-
-patterns = ('-', '+', 'x', '\\', '*', 'o', 'O', '.')
-for bar, pattern in zip(bars, patterns):
-    bar.set_hatch(pattern)
-
-ax3 = fig.add_subplot(133)
-ax3.fill([1, 3, 3, 1], [1, 1, 2, 2], fill=False, hatch='\\')
-ax3.add_patch(Ellipse((4, 1.5), 4, 0.5, fill=False, hatch='*'))
-ax3.add_patch(Polygon([[0, 0], [4, 1.1], [6, 2.5], [2, 1.4]], closed=True,
-                      fill=False, hatch='/'))
-ax3.set_xlim((0, 6))
-ax3.set_ylim((0, 2.5))
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/hexbin_demo.html b/examples/pylab_examples/hexbin_demo.html deleted file mode 100644 index 1da1ed03df2..00000000000 --- a/examples/pylab_examples/hexbin_demo.html +++ /dev/null @@ -1,358 +0,0 @@ - - - - - - - - pylab_examples example code: hexbin_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: hexbin_demo.py

-

(Source code, png, pdf)

-
-../../_images/hexbin_demo1.png -
-
"""
-hexbin is an axes method or pyplot function that is essentially
-a pcolor of a 2-D histogram with hexagonal cells.  It can be
-much more informative than a scatter plot; in the first subplot
-below, try substituting 'scatter' for 'hexbin'.
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-
-np.random.seed(0)
-n = 100000
-x = np.random.standard_normal(n)
-y = 2.0 + 3.0 * x + 4.0 * np.random.standard_normal(n)
-xmin = x.min()
-xmax = x.max()
-ymin = y.min()
-ymax = y.max()
-
-fig, axs = plt.subplots(ncols=2, sharey=True, figsize=(7, 4))
-fig.subplots_adjust(hspace=0.5, left=0.07, right=0.93)
-ax = axs[0]
-hb = ax.hexbin(x, y, gridsize=50, cmap='inferno')
-ax.axis([xmin, xmax, ymin, ymax])
-ax.set_title("Hexagon binning")
-cb = fig.colorbar(hb, ax=ax)
-cb.set_label('counts')
-
-ax = axs[1]
-hb = ax.hexbin(x, y, gridsize=50, bins='log', cmap='inferno')
-ax.axis([xmin, xmax, ymin, ymax])
-ax.set_title("With a log color scale")
-cb = fig.colorbar(hb, ax=ax)
-cb.set_label('log10(N)')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/hexbin_demo2.html b/examples/pylab_examples/hexbin_demo2.html deleted file mode 100644 index b09dc263d6d..00000000000 --- a/examples/pylab_examples/hexbin_demo2.html +++ /dev/null @@ -1,377 +0,0 @@ - - - - - - - - pylab_examples example code: hexbin_demo2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: hexbin_demo2.py

-

(Source code, png, pdf)

-
-../../_images/hexbin_demo2.png -
-
"""
-hexbin is an axes method or pyplot function that is essentially a
-pcolor of a 2-D histogram with hexagonal cells.
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.mlab as mlab
-
-delta = 0.025
-x = y = np.arange(-3.0, 3.0, delta)
-X, Y = np.meshgrid(x, y)
-Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
-Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
-Z = Z2 - Z1  # difference of Gaussians
-
-x = X.ravel()
-y = Y.ravel()
-z = Z.ravel()
-
-if 1:
-    # make some points 20 times more common than others, but same mean
-    xcond = (-1 < x) & (x < 1)
-    ycond = (-2 < y) & (y < 0)
-    cond = xcond & ycond
-    xnew = x[cond]
-    ynew = y[cond]
-    znew = z[cond]
-    for i in range(20):
-        x = np.hstack((x, xnew))
-        y = np.hstack((y, ynew))
-        z = np.hstack((z, znew))
-
-xmin = x.min()
-xmax = x.max()
-ymin = y.min()
-ymax = y.max()
-
-gridsize = 30
-
-plt.subplot(211)
-plt.hexbin(x, y, C=z, gridsize=gridsize, marginals=True, cmap=plt.cm.RdBu,
-           vmax=abs(z).max(), vmin=-abs(z).max())
-plt.axis([xmin, xmax, ymin, ymax])
-cb = plt.colorbar()
-cb.set_label('mean value')
-
-
-plt.subplot(212)
-plt.hexbin(x, y, gridsize=gridsize, cmap=plt.cm.Blues_r)
-plt.axis([xmin, xmax, ymin, ymax])
-cb = plt.colorbar()
-cb.set_label('N observations')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/hist2d_demo.html b/examples/pylab_examples/hist2d_demo.html deleted file mode 100644 index d8972cd5525..00000000000 --- a/examples/pylab_examples/hist2d_demo.html +++ /dev/null @@ -1,330 +0,0 @@ - - - - - - - - pylab_examples example code: hist2d_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: hist2d_demo.py

-

(Source code, png, pdf)

-
-../../_images/hist2d_demo1.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-x = np.random.randn(1000)
-y = np.random.randn(1000) + 5
-
-# normal distribution center at x=0 and y=5
-plt.hist2d(x, y, bins=40)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/hist2d_log_demo.html b/examples/pylab_examples/hist2d_log_demo.html deleted file mode 100644 index 050d3e42109..00000000000 --- a/examples/pylab_examples/hist2d_log_demo.html +++ /dev/null @@ -1,333 +0,0 @@ - - - - - - - - pylab_examples example code: hist2d_log_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: hist2d_log_demo.py

-

(Source code, png, pdf)

-
-../../_images/hist2d_log_demo.png -
-
from matplotlib.colors import LogNorm
-import matplotlib.pyplot as plt
-import numpy as np
-
-# normal distribution center at x=0 and y=5
-x = np.random.randn(100000)
-y = np.random.randn(100000) + 5
-
-plt.hist2d(x, y, bins=40, norm=LogNorm())
-plt.colorbar()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/hist_colormapped.html b/examples/pylab_examples/hist_colormapped.html deleted file mode 100644 index cf7121fe169..00000000000 --- a/examples/pylab_examples/hist_colormapped.html +++ /dev/null @@ -1,345 +0,0 @@ - - - - - - - - pylab_examples example code: hist_colormapped.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: hist_colormapped.py

-

(Source code, png, pdf)

-
-../../_images/hist_colormapped.png -
-
import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.cm as cm
-import matplotlib.colors as colors
-
-fig, ax = plt.subplots()
-Ntotal = 1000
-N, bins, patches = ax.hist(np.random.rand(Ntotal), 20)
-
-# I'll color code by height, but you could use any scalar
-
-
-# we need to normalize the data to 0..1 for the full
-# range of the colormap
-fracs = N.astype(float)/N.max()
-norm = colors.Normalize(fracs.min(), fracs.max())
-
-for thisfrac, thispatch in zip(fracs, patches):
-    color = cm.viridis(norm(thisfrac))
-    thispatch.set_facecolor(color)
-
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/histogram_demo_extended.html b/examples/pylab_examples/histogram_demo_extended.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/pylab_examples/histogram_demo_extended.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/pylab_examples/histogram_percent_demo.html b/examples/pylab_examples/histogram_percent_demo.html deleted file mode 100644 index a46ddda07d0..00000000000 --- a/examples/pylab_examples/histogram_percent_demo.html +++ /dev/null @@ -1,352 +0,0 @@ - - - - - - - - pylab_examples example code: histogram_percent_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: histogram_percent_demo.py

-

(Source code, png, pdf)

-
-../../_images/histogram_percent_demo.png -
-
import matplotlib
-from numpy.random import randn
-import matplotlib.pyplot as plt
-from matplotlib.ticker import FuncFormatter
-
-
-def to_percent(y, position):
-    # Ignore the passed in position. This has the effect of scaling the default
-    # tick locations.
-    s = str(100 * y)
-
-    # The percent symbol needs escaping in latex
-    if matplotlib.rcParams['text.usetex'] is True:
-        return s + r'$\%$'
-    else:
-        return s + '%'
-
-x = randn(5000)
-
-# Make a normed histogram. It'll be multiplied by 100 later.
-plt.hist(x, bins=50, normed=True)
-
-# Create the formatter using the function to_percent. This multiplies all the
-# default labels by 100, making them all percentages
-formatter = FuncFormatter(to_percent)
-
-# Set the formatter
-plt.gca().yaxis.set_major_formatter(formatter)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/hyperlinks.html b/examples/pylab_examples/hyperlinks.html deleted file mode 100644 index 0d4e0129bdb..00000000000 --- a/examples/pylab_examples/hyperlinks.html +++ /dev/null @@ -1,350 +0,0 @@ - - - - - - - - pylab_examples example code: hyperlinks.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- - - - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/hyperlinks.py b/examples/pylab_examples/hyperlinks.py deleted file mode 100644 index 599f637b88f..00000000000 --- a/examples/pylab_examples/hyperlinks.py +++ /dev/null @@ -1,31 +0,0 @@ -# -*- noplot -*- - -""" -This example demonstrates how to set a hyperlinks on various kinds of elements. - -This currently only works with the SVG backend. -""" - -import numpy as np -import matplotlib.cm as cm -import matplotlib.mlab as mlab -import matplotlib.pyplot as plt - -f = plt.figure() -s = plt.scatter([1, 2, 3], [4, 5, 6]) -s.set_urls(['http://www.bbc.co.uk/news', 'http://www.google.com', None]) -f.canvas.print_figure('scatter.svg') - -f = plt.figure() -delta = 0.025 -x = y = np.arange(-3.0, 3.0, delta) -X, Y = np.meshgrid(x, y) -Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) -Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) -Z = Z2 - Z1 # difference of Gaussians - -im = plt.imshow(Z, interpolation='bilinear', cmap=cm.gray, - origin='lower', extent=[-3, 3, -3, 3]) - -im.set_url('http://www.google.com') -f.canvas.print_figure('image.svg') diff --git a/examples/pylab_examples/image_clip_path.html b/examples/pylab_examples/image_clip_path.html deleted file mode 100644 index e91f03ecd1f..00000000000 --- a/examples/pylab_examples/image_clip_path.html +++ /dev/null @@ -1,346 +0,0 @@ - - - - - - - - pylab_examples example code: image_clip_path.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: image_clip_path.py

-

(Source code, png, pdf)

-
-../../_images/image_clip_path.png -
-
import numpy as np
-import matplotlib.cm as cm
-import matplotlib.mlab as mlab
-import matplotlib.pyplot as plt
-from matplotlib.path import Path
-from matplotlib.patches import PathPatch
-
-delta = 0.025
-x = y = np.arange(-3.0, 3.0, delta)
-X, Y = np.meshgrid(x, y)
-Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
-Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
-Z = Z2 - Z1  # difference of Gaussians
-
-path = Path([[0, 1], [1, 0], [0, -1], [-1, 0], [0, 1]])
-patch = PathPatch(path, facecolor='none')
-plt.gca().add_patch(patch)
-
-im = plt.imshow(Z, interpolation='bilinear', cmap=cm.gray,
-                origin='lower', extent=[-3, 3, -3, 3],
-                clip_path=patch, clip_on=True)
-im.set_clip_path(patch)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/image_demo.html b/examples/pylab_examples/image_demo.html deleted file mode 100644 index e899b9245d1..00000000000 --- a/examples/pylab_examples/image_demo.html +++ /dev/null @@ -1,339 +0,0 @@ - - - - - - - - pylab_examples example code: image_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: image_demo.py

-

(Source code, png, pdf)

-
-../../_images/image_demo1.png -
-
import numpy as np
-import matplotlib.cm as cm
-import matplotlib.mlab as mlab
-import matplotlib.pyplot as plt
-
-delta = 0.025
-x = y = np.arange(-3.0, 3.0, delta)
-X, Y = np.meshgrid(x, y)
-Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
-Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
-Z = Z2 - Z1  # difference of Gaussians
-
-im = plt.imshow(Z, interpolation='bilinear', cmap=cm.RdYlGn,
-                origin='lower', extent=[-3, 3, -3, 3],
-                vmax=abs(Z).max(), vmin=-abs(Z).max())
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/image_demo2.html b/examples/pylab_examples/image_demo2.html deleted file mode 100644 index bc06a434d44..00000000000 --- a/examples/pylab_examples/image_demo2.html +++ /dev/null @@ -1,345 +0,0 @@ - - - - - - - - pylab_examples example code: image_demo2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: image_demo2.py

-

(Source code, png, pdf)

-
-../../_images/image_demo2.png -
-
from __future__ import print_function
-import matplotlib.pyplot as plt
-import numpy as np
-import matplotlib.cbook as cbook
-
-w, h = 512, 512
-
-datafile = cbook.get_sample_data('ct.raw.gz', asfileobj=True)
-s = datafile.read()
-A = np.fromstring(s, np.uint16).astype(float)
-A *= 1.0 / max(A)
-A.shape = w, h
-
-extent = (0, 25, 0, 25)
-im = plt.imshow(A, cmap=plt.cm.hot, origin='upper', extent=extent)
-
-markers = [(15.9, 14.5), (16.8, 15)]
-x, y = zip(*markers)
-plt.plot(x, y, 'o')
-
-plt.title('CT density')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/image_interp.html b/examples/pylab_examples/image_interp.html deleted file mode 100644 index c408b2a691f..00000000000 --- a/examples/pylab_examples/image_interp.html +++ /dev/null @@ -1,395 +0,0 @@ - - - - - - - - pylab_examples example code: image_interp.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: image_interp.py

-

(Source code)

-
-../../_images/image_interp_00.png -

(png, pdf)

-
-
-../../_images/image_interp_01.png -

(png, pdf)

-
-
-../../_images/image_interp_02.png -

(png, pdf)

-
-
"""
-The same (small) array, interpolated with three different
-interpolation methods.
-
-The center of the pixel at A[i,j] is plotted at i+0.5, i+0.5.  If you
-are using interpolation='nearest', the region bounded by (i,j) and
-(i+1,j+1) will have the same color.  If you are using interpolation,
-the pixel center will have the same color as it does with nearest, but
-other pixels will be interpolated between the neighboring pixels.
-
-Earlier versions of matplotlib (<0.63) tried to hide the edge effects
-from you by setting the view limits so that they would not be visible.
-A recent bugfix in antigrain, and a new implementation in the
-matplotlib._image module which takes advantage of this fix, no longer
-makes this necessary.  To prevent edge effects, when doing
-interpolation, the matplotlib._image module now pads the input array
-with identical pixels around the edge.  e.g., if you have a 5x5 array
-with colors a-y as below
-
-
-  a b c d e
-  f g h i j
-  k l m n o
-  p q r s t
-  u v w x y
-
-the _image module creates the padded array,
-
-  a a b c d e e
-  a a b c d e e
-  f f g h i j j
-  k k l m n o o
-  p p q r s t t
-  o u v w x y y
-  o u v w x y y
-
-does the interpolation/resizing, and then extracts the central region.
-This allows you to plot the full range of your array w/o edge effects,
-and for example to layer multiple images of different sizes over one
-another with different interpolation methods - see
-examples/layer_images.py.  It also implies a performance hit, as this
-new temporary, padded array must be created.  Sophisticated
-interpolation also implies a performance hit, so if you need maximal
-performance or have very large images, interpolation='nearest' is
-suggested.
-
-"""
-import matplotlib.pyplot as plt
-import numpy as np
-
-A = np.random.rand(5, 5)
-plt.figure(1)
-plt.imshow(A, interpolation='nearest')
-plt.grid(True)
-
-plt.figure(2)
-plt.imshow(A, interpolation='bilinear')
-plt.grid(True)
-
-plt.figure(3)
-plt.imshow(A, interpolation='bicubic')
-plt.grid(True)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/image_masked.html b/examples/pylab_examples/image_masked.html deleted file mode 100644 index 2008ad45488..00000000000 --- a/examples/pylab_examples/image_masked.html +++ /dev/null @@ -1,394 +0,0 @@ - - - - - - - - pylab_examples example code: image_masked.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: image_masked.py

-

(Source code, png, pdf)

-
-../../_images/image_masked.png -
-
"""
-imshow with masked array input and out-of-range colors.
-
-The second subplot illustrates the use of BoundaryNorm to
-get a filled contour effect.
-"""
-from copy import copy
-
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.colors as colors
-import matplotlib.mlab as mlab
-
-# compute some interesting data
-x0, x1 = -5, 5
-y0, y1 = -3, 3
-x = np.linspace(x0, x1, 500)
-y = np.linspace(y0, y1, 500)
-X, Y = np.meshgrid(x, y)
-Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
-Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
-Z = 10*(Z2 - Z1)  # difference of Gaussians
-
-# Set up a colormap:
-# use copy so that we do not mutate the global colormap instance
-palette = copy(plt.cm.gray)
-palette.set_over('r', 1.0)
-palette.set_under('g', 1.0)
-palette.set_bad('b', 1.0)
-# Alternatively, we could use
-# palette.set_bad(alpha = 0.0)
-# to make the bad region transparent.  This is the default.
-# If you comment out all the palette.set* lines, you will see
-# all the defaults; under and over will be colored with the
-# first and last colors in the palette, respectively.
-Zm = np.ma.masked_where(Z > 1.2, Z)
-
-# By setting vmin and vmax in the norm, we establish the
-# range to which the regular palette color scale is applied.
-# Anything above that range is colored based on palette.set_over, etc.
-
-# set up the axes
-fig, (ax1, ax2) = plt.subplots(nrows=2, figsize=(6, 5.4))
-
-# plot using 'continuous' color map
-im = ax1.imshow(Zm, interpolation='bilinear',
-                cmap=palette,
-                norm=colors.Normalize(vmin=-1.0, vmax=1.0),
-                aspect='auto',
-                origin='lower',
-                extent=[x0, x1, y0, y1])
-ax1.set_title('Green=low, Red=high, Blue=masked')
-cbar = fig.colorbar(im, extend='both', shrink=0.9, ax=ax1)
-cbar.set_label('uniform')
-for ticklabel in ax1.xaxis.get_ticklabels():
-    ticklabel.set_visible(False)
-
-# Plot using a small number of colors, with unevenly spaced boundaries.
-im = ax2.imshow(Zm, interpolation='nearest',
-                cmap=palette,
-                norm=colors.BoundaryNorm([-1, -0.5, -0.2, 0, 0.2, 0.5, 1],
-                                         ncolors=palette.N),
-                aspect='auto',
-                origin='lower',
-                extent=[x0, x1, y0, y1])
-ax2.set_title('With BoundaryNorm')
-cbar = fig.colorbar(im, extend='both', spacing='proportional',
-                    shrink=0.9, ax=ax2)
-cbar.set_label('proportional')
-
-fig.suptitle('imshow, with out-of-range and masked data')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/image_nonuniform.html b/examples/pylab_examples/image_nonuniform.html deleted file mode 100644 index db38b15a224..00000000000 --- a/examples/pylab_examples/image_nonuniform.html +++ /dev/null @@ -1,387 +0,0 @@ - - - - - - - - pylab_examples example code: image_nonuniform.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: image_nonuniform.py

-

(Source code, png, pdf)

-
-../../_images/image_nonuniform.png -
-
'''
-This illustrates the NonUniformImage class.  It is not
-available via an Axes method but it is easily added to an
-Axes instance as shown here.
-'''
-
-import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.image import NonUniformImage
-from matplotlib import cm
-
-interp = 'nearest'
-
-# Linear x array for cell centers:
-x = np.linspace(-4, 4, 9)
-
-# Highly nonlinear x array:
-x2 = x**3
-
-y = np.linspace(-4, 4, 9)
-
-z = np.sqrt(x[np.newaxis, :]**2 + y[:, np.newaxis]**2)
-
-fig, axs = plt.subplots(nrows=2, ncols=2)
-fig.subplots_adjust(bottom=0.07, hspace=0.3)
-fig.suptitle('NonUniformImage class', fontsize='large')
-ax = axs[0, 0]
-im = NonUniformImage(ax, interpolation=interp, extent=(-4, 4, -4, 4),
-                     cmap=cm.Purples)
-im.set_data(x, y, z)
-ax.images.append(im)
-ax.set_xlim(-4, 4)
-ax.set_ylim(-4, 4)
-ax.set_title(interp)
-
-ax = axs[0, 1]
-im = NonUniformImage(ax, interpolation=interp, extent=(-64, 64, -4, 4),
-                     cmap=cm.Purples)
-im.set_data(x2, y, z)
-ax.images.append(im)
-ax.set_xlim(-64, 64)
-ax.set_ylim(-4, 4)
-ax.set_title(interp)
-
-interp = 'bilinear'
-
-ax = axs[1, 0]
-im = NonUniformImage(ax, interpolation=interp, extent=(-4, 4, -4, 4),
-                     cmap=cm.Purples)
-im.set_data(x, y, z)
-ax.images.append(im)
-ax.set_xlim(-4, 4)
-ax.set_ylim(-4, 4)
-ax.set_title(interp)
-
-ax = axs[1, 1]
-im = NonUniformImage(ax, interpolation=interp, extent=(-64, 64, -4, 4),
-                     cmap=cm.Purples)
-im.set_data(x2, y, z)
-ax.images.append(im)
-ax.set_xlim(-64, 64)
-ax.set_ylim(-4, 4)
-ax.set_title(interp)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/image_origin.html b/examples/pylab_examples/image_origin.html deleted file mode 100644 index 079ae59781f..00000000000 --- a/examples/pylab_examples/image_origin.html +++ /dev/null @@ -1,342 +0,0 @@ - - - - - - - - pylab_examples example code: image_origin.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: image_origin.py

-

(Source code, png, pdf)

-
-../../_images/image_origin.png -
-
"""
-You can specify whether images should be plotted with the array origin
-x[0,0] in the upper left or upper right by using the origin parameter.
-You can also control the default be setting image.origin in your
-matplotlibrc file; see http://matplotlib.org/matplotlibrc
-"""
-import matplotlib.pyplot as plt
-import numpy as np
-
-x = np.arange(120)
-x.shape = (10, 12)
-
-interp = 'bilinear'
-fig, axs = plt.subplots(nrows=2, sharex=True, figsize=(3, 5))
-axs[0].set_title('blue should be up')
-axs[0].imshow(x, origin='upper', interpolation=interp)
-
-axs[1].set_title('blue should be down')
-axs[1].imshow(x, origin='lower', interpolation=interp)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/image_slices_viewer.html b/examples/pylab_examples/image_slices_viewer.html deleted file mode 100644 index 3fdf3bc07f9..00000000000 --- a/examples/pylab_examples/image_slices_viewer.html +++ /dev/null @@ -1,362 +0,0 @@ - - - - - - - - pylab_examples example code: image_slices_viewer.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: image_slices_viewer.py

-

(Source code, png, pdf)

-
-../../_images/image_slices_viewer.png -
-
from __future__ import print_function
-import numpy
-import matplotlib.pyplot as plt
-
-
-class IndexTracker(object):
-    def __init__(self, ax, X):
-        self.ax = ax
-        ax.set_title('use scroll wheel to navigate images')
-
-        self.X = X
-        rows, cols, self.slices = X.shape
-        self.ind = self.slices//2
-
-        self.im = ax.imshow(self.X[:, :, self.ind])
-        self.update()
-
-    def onscroll(self, event):
-        print("%s %s" % (event.button, event.step))
-        if event.button == 'up':
-            self.ind = numpy.clip(self.ind + 1, 0, self.slices - 1)
-        else:
-            self.ind = numpy.clip(self.ind - 1, 0, self.slices - 1)
-        self.update()
-
-    def update(self):
-        self.im.set_data(self.X[:, :, self.ind])
-        ax.set_ylabel('slice %s' % self.ind)
-        self.im.axes.figure.canvas.draw()
-
-
-fig, ax = plt.subplots(1, 1)
-
-X = numpy.random.rand(20, 20, 40)
-
-tracker = IndexTracker(ax, X)
-
-
-fig.canvas.mpl_connect('scroll_event', tracker.onscroll)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/index.html b/examples/pylab_examples/index.html deleted file mode 100644 index 16a217b680f..00000000000 --- a/examples/pylab_examples/index.html +++ /dev/null @@ -1,534 +0,0 @@ - - - - - - - - pylab_examples Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples Examples

- --- - - - - - -
Release:2.0.2
Date:May 10, 2017
-
- -
-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/interp_demo.html b/examples/pylab_examples/interp_demo.html deleted file mode 100644 index 892b643a0d2..00000000000 --- a/examples/pylab_examples/interp_demo.html +++ /dev/null @@ -1,335 +0,0 @@ - - - - - - - - pylab_examples example code: interp_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: interp_demo.py

-

(Source code, png, pdf)

-
-../../_images/interp_demo.png -
-
import matplotlib.pyplot as plt
-from numpy import pi, sin, linspace
-from matplotlib.mlab import stineman_interp
-
-x = linspace(0, 2*pi, 20)
-y = sin(x)
-yp = None
-xi = linspace(x[0], x[-1], 100)
-yi = stineman_interp(xi, x, y, yp)
-
-fig, ax = plt.subplots()
-ax.plot(x, y, 'o', xi, yi, '.')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/invert_axes.html b/examples/pylab_examples/invert_axes.html deleted file mode 100644 index 64a13926a0e..00000000000 --- a/examples/pylab_examples/invert_axes.html +++ /dev/null @@ -1,342 +0,0 @@ - - - - - - - - pylab_examples example code: invert_axes.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: invert_axes.py

-

(Source code, png, pdf)

-
-../../_images/invert_axes.png -
-
"""
-You can use decreasing axes by flipping the normal order of the axis
-limits
-"""
-
-import matplotlib.pyplot as plt
-import numpy as np
-
-t = np.arange(0.01, 5.0, 0.01)
-s = np.exp(-t)
-plt.plot(t, s)
-
-plt.xlim(5, 0)  # decreasing time
-
-plt.xlabel('decreasing time (s)')
-plt.ylabel('voltage (mV)')
-plt.title('Should be growing...')
-plt.grid(True)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/layer_images.html b/examples/pylab_examples/layer_images.html deleted file mode 100644 index 350b56d6960..00000000000 --- a/examples/pylab_examples/layer_images.html +++ /dev/null @@ -1,363 +0,0 @@ - - - - - - - - pylab_examples example code: layer_images.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: layer_images.py

-

(Source code, png, pdf)

-
-../../_images/layer_images.png -
-
"""
-Layer images above one another using alpha blending
-"""
-from __future__ import division
-import matplotlib.pyplot as plt
-import numpy as np
-
-
-def func3(x, y):
-    return (1 - x/2 + x**5 + y**3)*np.exp(-(x**2 + y**2))
-
-# make these smaller to increase the resolution
-dx, dy = 0.05, 0.05
-
-x = np.arange(-3.0, 3.0, dx)
-y = np.arange(-3.0, 3.0, dy)
-X, Y = np.meshgrid(x, y)
-
-# when layering multiple images, the images need to have the same
-# extent.  This does not mean they need to have the same shape, but
-# they both need to render to the same coordinate system determined by
-# xmin, xmax, ymin, ymax.  Note if you use different interpolations
-# for the images their apparent extent could be different due to
-# interpolation edge effects
-
-
-xmin, xmax, ymin, ymax = np.amin(x), np.amax(x), np.amin(y), np.amax(y)
-extent = xmin, xmax, ymin, ymax
-fig = plt.figure(frameon=False)
-
-Z1 = np.array(([0, 1]*4 + [1, 0]*4)*4)
-Z1.shape = (8, 8)  # chessboard
-im1 = plt.imshow(Z1, cmap=plt.cm.gray, interpolation='nearest',
-                 extent=extent)
-
-Z2 = func3(X, Y)
-
-im2 = plt.imshow(Z2, cmap=plt.cm.viridis, alpha=.9, interpolation='bilinear',
-                 extent=extent)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/leftventricle_bulleye.html b/examples/pylab_examples/leftventricle_bulleye.html deleted file mode 100644 index 238f68285f5..00000000000 --- a/examples/pylab_examples/leftventricle_bulleye.html +++ /dev/null @@ -1,528 +0,0 @@ - - - - - - - - pylab_examples example code: leftventricle_bulleye.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: leftventricle_bulleye.py

-

(Source code, png, pdf)

-
-../../_images/leftventricle_bulleye.png -
-
"""
-This example demonstrates how to create the 17 segment model for the left
-ventricle recommended by the American Heart Association (AHA).
-"""
-
-import numpy as np
-import matplotlib as mpl
-import matplotlib.pyplot as plt
-
-
-def bullseye_plot(ax, data, segBold=None, cmap=None, norm=None):
-    """
-    Bullseye representation for the left ventricle.
-
-    Parameters
-    ----------
-    ax : axes
-    data : list of int and float
-        The intensity values for each of the 17 segments
-    segBold: list of int, optional
-        A list with the segments to highlight
-    cmap : ColorMap or None, optional
-        Optional argument to set the desired colormap
-    norm : Normalize or None, optional
-        Optional argument to normalize data into the [0.0, 1.0] range
-
-
-    Notes
-    -----
-    This function create the 17 segment model for the left ventricle according
-    to the American Heart Association (AHA) [1]_
-
-    References
-    ----------
-    .. [1] M. D. Cerqueira, N. J. Weissman, V. Dilsizian, A. K. Jacobs,
-        S. Kaul, W. K. Laskey, D. J. Pennell, J. A. Rumberger, T. Ryan,
-        and M. S. Verani, "Standardized myocardial segmentation and
-        nomenclature for tomographic imaging of the heart",
-        Circulation, vol. 105, no. 4, pp. 539-542, 2002.
-    """
-    if segBold is None:
-        segBold = []
-
-    linewidth = 2
-    data = np.array(data).ravel()
-
-    if cmap is None:
-        cmap = plt.cm.viridis
-
-    if norm is None:
-        norm = mpl.colors.Normalize(vmin=data.min(), vmax=data.max())
-
-    theta = np.linspace(0, 2*np.pi, 768)
-    r = np.linspace(0.2, 1, 4)
-
-    # Create the bound for the segment 17
-    for i in range(r.shape[0]):
-        ax.plot(theta, np.repeat(r[i], theta.shape), '-k', lw=linewidth)
-
-    # Create the bounds for the segments  1-12
-    for i in range(6):
-        theta_i = i*60*np.pi/180
-        ax.plot([theta_i, theta_i], [r[1], 1], '-k', lw=linewidth)
-
-    # Create the bounds for the segments 13-16
-    for i in range(4):
-        theta_i = i*90*np.pi/180 - 45*np.pi/180
-        ax.plot([theta_i, theta_i], [r[0], r[1]], '-k', lw=linewidth)
-
-    # Fill the segments 1-6
-    r0 = r[2:4]
-    r0 = np.repeat(r0[:, np.newaxis], 128, axis=1).T
-    for i in range(6):
-        # First segment start at 60 degrees
-        theta0 = theta[i*128:i*128+128] + 60*np.pi/180
-        theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1)
-        z = np.ones((128, 2))*data[i]
-        ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm)
-        if i+1 in segBold:
-            ax.plot(theta0, r0, '-k', lw=linewidth+2)
-            ax.plot(theta0[0], [r[2], r[3]], '-k', lw=linewidth+1)
-            ax.plot(theta0[-1], [r[2], r[3]], '-k', lw=linewidth+1)
-
-    # Fill the segments 7-12
-    r0 = r[1:3]
-    r0 = np.repeat(r0[:, np.newaxis], 128, axis=1).T
-    for i in range(6):
-        # First segment start at 60 degrees
-        theta0 = theta[i*128:i*128+128] + 60*np.pi/180
-        theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1)
-        z = np.ones((128, 2))*data[i+6]
-        ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm)
-        if i+7 in segBold:
-            ax.plot(theta0, r0, '-k', lw=linewidth+2)
-            ax.plot(theta0[0], [r[1], r[2]], '-k', lw=linewidth+1)
-            ax.plot(theta0[-1], [r[1], r[2]], '-k', lw=linewidth+1)
-
-    # Fill the segments 13-16
-    r0 = r[0:2]
-    r0 = np.repeat(r0[:, np.newaxis], 192, axis=1).T
-    for i in range(4):
-        # First segment start at 45 degrees
-        theta0 = theta[i*192:i*192+192] + 45*np.pi/180
-        theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1)
-        z = np.ones((192, 2))*data[i+12]
-        ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm)
-        if i+13 in segBold:
-            ax.plot(theta0, r0, '-k', lw=linewidth+2)
-            ax.plot(theta0[0], [r[0], r[1]], '-k', lw=linewidth+1)
-            ax.plot(theta0[-1], [r[0], r[1]], '-k', lw=linewidth+1)
-
-    # Fill the segments 17
-    if data.size == 17:
-        r0 = np.array([0, r[0]])
-        r0 = np.repeat(r0[:, np.newaxis], theta.size, axis=1).T
-        theta0 = np.repeat(theta[:, np.newaxis], 2, axis=1)
-        z = np.ones((theta.size, 2))*data[16]
-        ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm)
-        if 17 in segBold:
-            ax.plot(theta0, r0, '-k', lw=linewidth+2)
-
-    ax.set_ylim([0, 1])
-    ax.set_yticklabels([])
-    ax.set_xticklabels([])
-
-
-# Create the fake data
-data = np.array(range(17)) + 1
-
-
-# Make a figure and axes with dimensions as desired.
-fig, ax = plt.subplots(figsize=(12, 8), nrows=1, ncols=3,
-                       subplot_kw=dict(projection='polar'))
-fig.canvas.set_window_title('Left Ventricle Bulls Eyes (AHA)')
-
-# Create the axis for the colorbars
-axl = fig.add_axes([0.14, 0.15, 0.2, 0.05])
-axl2 = fig.add_axes([0.41, 0.15, 0.2, 0.05])
-axl3 = fig.add_axes([0.69, 0.15, 0.2, 0.05])
-
-
-# Set the colormap and norm to correspond to the data for which
-# the colorbar will be used.
-cmap = mpl.cm.viridis
-norm = mpl.colors.Normalize(vmin=1, vmax=17)
-
-# ColorbarBase derives from ScalarMappable and puts a colorbar
-# in a specified axes, so it has everything needed for a
-# standalone colorbar.  There are many more kwargs, but the
-# following gives a basic continuous colorbar with ticks
-# and labels.
-cb1 = mpl.colorbar.ColorbarBase(axl, cmap=cmap, norm=norm,
-                                orientation='horizontal')
-cb1.set_label('Some Units')
-
-
-# Set the colormap and norm to correspond to the data for which
-# the colorbar will be used.
-cmap2 = mpl.cm.cool
-norm2 = mpl.colors.Normalize(vmin=1, vmax=17)
-
-# ColorbarBase derives from ScalarMappable and puts a colorbar
-# in a specified axes, so it has everything needed for a
-# standalone colorbar.  There are many more kwargs, but the
-# following gives a basic continuous colorbar with ticks
-# and labels.
-cb2 = mpl.colorbar.ColorbarBase(axl2, cmap=cmap2, norm=norm2,
-                                orientation='horizontal')
-cb2.set_label('Some other units')
-
-
-# The second example illustrates the use of a ListedColormap, a
-# BoundaryNorm, and extended ends to show the "over" and "under"
-# value colors.
-cmap3 = mpl.colors.ListedColormap(['r', 'g', 'b', 'c'])
-cmap3.set_over('0.35')
-cmap3.set_under('0.75')
-
-# If a ListedColormap is used, the length of the bounds array must be
-# one greater than the length of the color list.  The bounds must be
-# monotonically increasing.
-bounds = [2, 3, 7, 9, 15]
-norm3 = mpl.colors.BoundaryNorm(bounds, cmap3.N)
-cb3 = mpl.colorbar.ColorbarBase(axl3, cmap=cmap3, norm=norm3,
-                                # to use 'extend', you must
-                                # specify two extra boundaries:
-                                boundaries=[0]+bounds+[18],
-                                extend='both',
-                                ticks=bounds,  # optional
-                                spacing='proportional',
-                                orientation='horizontal')
-cb3.set_label('Discrete intervals, some other units')
-
-
-# Create the 17 segment model
-bullseye_plot(ax[0], data, cmap=cmap, norm=norm)
-ax[0].set_title('Bulls Eye (AHA)')
-
-bullseye_plot(ax[1], data, cmap=cmap2, norm=norm2)
-ax[1].set_title('Bulls Eye (AHA)')
-
-bullseye_plot(ax[2], data, segBold=[3, 5, 6, 11, 12, 16],
-              cmap=cmap3, norm=norm3)
-ax[2].set_title('Segments [3,5,6,11,12,16] in bold')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/legend_auto.html b/examples/pylab_examples/legend_auto.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/pylab_examples/legend_auto.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/pylab_examples/legend_demo.html b/examples/pylab_examples/legend_demo.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/pylab_examples/legend_demo.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/pylab_examples/legend_demo2.html b/examples/pylab_examples/legend_demo2.html deleted file mode 100644 index e2937ef9fde..00000000000 --- a/examples/pylab_examples/legend_demo2.html +++ /dev/null @@ -1,342 +0,0 @@ - - - - - - - - pylab_examples example code: legend_demo2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: legend_demo2.py

-

(Source code, png, pdf)

-
-../../_images/legend_demo2.png -
-
# Make a legend for specific lines.
-import matplotlib.pyplot as plt
-import numpy as np
-
-
-t1 = np.arange(0.0, 2.0, 0.1)
-t2 = np.arange(0.0, 2.0, 0.01)
-
-# note that plot returns a list of lines.  The "l1, = plot" usage
-# extracts the first element of the list into l1 using tuple
-# unpacking.  So l1 is a Line2D instance, not a sequence of lines
-l1, = plt.plot(t2, np.exp(-t2))
-l2, l3 = plt.plot(t2, np.sin(2 * np.pi * t2), '--o', t1, np.log(1 + t1), '.')
-l4, = plt.plot(t2, np.exp(-t2) * np.sin(2 * np.pi * t2), 's-.')
-
-plt.legend((l2, l4), ('oscillatory', 'damped'), loc='upper right', shadow=True)
-plt.xlabel('time')
-plt.ylabel('volts')
-plt.title('Damped oscillation')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/legend_demo3.html b/examples/pylab_examples/legend_demo3.html deleted file mode 100644 index 39cba8be364..00000000000 --- a/examples/pylab_examples/legend_demo3.html +++ /dev/null @@ -1,344 +0,0 @@ - - - - - - - - pylab_examples example code: legend_demo3.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: legend_demo3.py

-

(Source code, png, pdf)

-
-../../_images/legend_demo3.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-
-x = np.linspace(0, 1)
-
-# Plot the lines y=x**n for n=1..4.
-ax = plt.subplot(2, 1, 1)
-for n in range(1, 5):
-    plt.plot(x, x**n, label="n={0}".format(n))
-plt.legend(loc="upper left", bbox_to_anchor=[0, 1],
-           ncol=2, shadow=True, title="Legend", fancybox=True)
-ax.get_legend().get_title().set_color("red")
-
-# Demonstrate some more complex labels.
-ax = plt.subplot(2, 1, 2)
-plt.plot(x, x**2, label="multi\nline")
-half_pi = np.linspace(0, np.pi / 2)
-plt.plot(np.sin(half_pi), np.cos(half_pi), label=r"$\frac{1}{2}\pi$")
-plt.plot(x, 2**(x**2), label="$2^{x^2}$")
-plt.legend(shadow=True, fancybox=True)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/legend_demo4.html b/examples/pylab_examples/legend_demo4.html deleted file mode 100644 index e03b0efdd8c..00000000000 --- a/examples/pylab_examples/legend_demo4.html +++ /dev/null @@ -1,344 +0,0 @@ - - - - - - - - pylab_examples example code: legend_demo4.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: legend_demo4.py

-

(Source code, png, pdf)

-
-../../_images/legend_demo4.png -
-
import matplotlib.pyplot as plt
-
-fig, axes = plt.subplots(3, 1)
-top_ax, middle_ax, bottom_ax = axes
-
-top_ax.bar([0, 1, 2], [0.2, 0.3, 0.1], width=0.4, label="Bar 1",
-           align="center")
-top_ax.bar([0.5, 1.5, 2.5], [0.3, 0.2, 0.2], color="red", width=0.4,
-           label="Bar 2", align="center")
-top_ax.legend()
-
-middle_ax.errorbar([0, 1, 2], [2, 3, 1], xerr=0.4, fmt="s", label="test 1")
-middle_ax.errorbar([0, 1, 2], [3, 2, 4], yerr=0.3, fmt="o", label="test 2")
-middle_ax.errorbar([0, 1, 2], [1, 1, 3], xerr=0.4, yerr=0.3, fmt="^",
-                   label="test 3")
-middle_ax.legend()
-
-bottom_ax.stem([0.3, 1.5, 2.7], [1, 3.6, 2.7], label="stem test")
-bottom_ax.legend()
-
-plt.subplots_adjust(hspace=0.7)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/legend_demo5.html b/examples/pylab_examples/legend_demo5.html deleted file mode 100644 index cdabd2e8050..00000000000 --- a/examples/pylab_examples/legend_demo5.html +++ /dev/null @@ -1,393 +0,0 @@ - - - - - - - - pylab_examples example code: legend_demo5.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: legend_demo5.py

-

(Source code, png, pdf)

-
-../../_images/legend_demo5.png -
-
from __future__ import (absolute_import, division,
-                        print_function, unicode_literals)
-import six
-from matplotlib import pyplot as plt
-import numpy as np
-from matplotlib.legend_handler import HandlerLineCollection
-import matplotlib.collections as mcol
-from matplotlib.lines import Line2D
-
-
-class HandlerDashedLines(HandlerLineCollection):
-    """
-    Custom Handler for LineCollection instances.
-    """
-    def create_artists(self, legend, orig_handle,
-                       xdescent, ydescent, width, height, fontsize, trans):
-        # figure out how many lines there are
-        numlines = len(orig_handle.get_segments())
-        xdata, xdata_marker = self.get_xdata(legend, xdescent, ydescent,
-                                             width, height, fontsize)
-        leglines = []
-        # divide the vertical space where the lines will go
-        # into equal parts based on the number of lines
-        ydata = ((height) / (numlines + 1)) * np.ones(xdata.shape, float)
-        # for each line, create the line at the proper location
-        # and set the dash pattern
-        for i in range(numlines):
-            legline = Line2D(xdata, ydata * (numlines - i) - ydescent)
-            self.update_prop(legline, orig_handle, legend)
-            # set color, dash pattern, and linewidth to that
-            # of the lines in linecollection
-            try:
-                color = orig_handle.get_colors()[i]
-            except IndexError:
-                color = orig_handle.get_colors()[0]
-            try:
-                dashes = orig_handle.get_dashes()[i]
-            except IndexError:
-                dashes = orig_handle.get_dashes()[0]
-            try:
-                lw = orig_handle.get_linewidths()[i]
-            except IndexError:
-                lw = orig_handle.get_linewidths()[0]
-            if dashes[0] is not None:
-                legline.set_dashes(dashes[1])
-            legline.set_color(color)
-            legline.set_transform(trans)
-            legline.set_linewidth(lw)
-            leglines.append(legline)
-        return leglines
-
-x = np.linspace(0, 5, 100)
-
-plt.figure()
-colors = plt.rcParams['axes.prop_cycle'].by_key()['color'][:5]
-styles = ['solid', 'dashed', 'dashed', 'dashed', 'solid']
-lines = []
-for i, color, style in zip(range(5), colors, styles):
-    plt.plot(x, np.sin(x) - .1 * i, c=color, ls=style)
-
-
-# make proxy artists
-# make list of one line -- doesn't matter what the coordinates are
-line = [[(0, 0)]]
-# set up the proxy artist
-lc = mcol.LineCollection(5 * line, linestyles=styles, colors=colors)
-# create the legend
-plt.legend([lc], ['multi-line'], handler_map={type(lc): HandlerDashedLines()},
-           handlelength=2.5, handleheight=3)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/legend_demo_custom_handler.html b/examples/pylab_examples/legend_demo_custom_handler.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/pylab_examples/legend_demo_custom_handler.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/pylab_examples/legend_scatter.html b/examples/pylab_examples/legend_scatter.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/pylab_examples/legend_scatter.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/pylab_examples/legend_translucent.html b/examples/pylab_examples/legend_translucent.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/pylab_examples/legend_translucent.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/pylab_examples/line_collection.html b/examples/pylab_examples/line_collection.html deleted file mode 100644 index 23965014256..00000000000 --- a/examples/pylab_examples/line_collection.html +++ /dev/null @@ -1,362 +0,0 @@ - - - - - - - - pylab_examples example code: line_collection.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: line_collection.py

-

(Source code, png, pdf)

-
-../../_images/line_collection.png -
-
import matplotlib.pyplot as plt
-from matplotlib.collections import LineCollection
-from matplotlib import colors as mcolors
-
-import numpy as np
-
-# In order to efficiently plot many lines in a single set of axes,
-# Matplotlib has the ability to add the lines all at once. Here is a
-# simple example showing how it is done.
-
-x = np.arange(100)
-# Here are many sets of y to plot vs x
-ys = x[:50, np.newaxis] + x[np.newaxis, :]
-
-segs = np.zeros((50, 100, 2), float)
-segs[:, :, 1] = ys
-segs[:, :, 0] = x
-
-# Mask some values to test masked array support:
-segs = np.ma.masked_where((segs > 50) & (segs < 60), segs)
-
-# We need to set the plot limits.
-ax = plt.axes()
-ax.set_xlim(x.min(), x.max())
-ax.set_ylim(ys.min(), ys.max())
-
-# colors is sequence of rgba tuples
-# linestyle is a string or dash tuple. Legal string values are
-#          solid|dashed|dashdot|dotted.  The dash tuple is (offset, onoffseq)
-#          where onoffseq is an even length tuple of on and off ink in points.
-#          If linestyle is omitted, 'solid' is used
-# See matplotlib.collections.LineCollection for more information
-colors = [mcolors.to_rgba(c)
-          for c in plt.rcParams['axes.prop_cycle'].by_key()['color']]
-
-line_segments = LineCollection(segs, linewidths=(0.5, 1, 1.5, 2),
-                               colors=colors, linestyle='solid')
-ax.add_collection(line_segments)
-ax.set_title('Line collection with masked arrays')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/line_collection2.html b/examples/pylab_examples/line_collection2.html deleted file mode 100644 index 9bfd30c183f..00000000000 --- a/examples/pylab_examples/line_collection2.html +++ /dev/null @@ -1,359 +0,0 @@ - - - - - - - - pylab_examples example code: line_collection2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: line_collection2.py

-

(Source code, png, pdf)

-
-../../_images/line_collection2.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-from matplotlib.collections import LineCollection
-
-# In order to efficiently plot many lines in a single set of axes,
-# Matplotlib has the ability to add the lines all at once. Here is a
-# simple example showing how it is done.
-
-N = 50
-x = np.arange(N)
-# Here are many sets of y to plot vs x
-ys = [x + i for i in x]
-
-# We need to set the plot limits, they will not autoscale
-ax = plt.axes()
-ax.set_xlim((np.amin(x), np.amax(x)))
-ax.set_ylim((np.amin(np.amin(ys)), np.amax(np.amax(ys))))
-
-# colors is sequence of rgba tuples
-# linestyle is a string or dash tuple. Legal string values are
-#          solid|dashed|dashdot|dotted.  The dash tuple is (offset, onoffseq)
-#          where onoffseq is an even length tuple of on and off ink in points.
-#          If linestyle is omitted, 'solid' is used
-# See matplotlib.collections.LineCollection for more information
-
-# Make a sequence of x,y pairs
-line_segments = LineCollection([list(zip(x, y)) for y in ys],
-                               linewidths=(0.5, 1, 1.5, 2),
-                               linestyles='solid')
-line_segments.set_array(x)
-ax.add_collection(line_segments)
-fig = plt.gcf()
-axcb = fig.colorbar(line_segments)
-axcb.set_label('Line Number')
-ax.set_title('Line Collection with mapped colors')
-plt.sci(line_segments)  # This allows interactive changing of the colormap.
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/line_styles.html b/examples/pylab_examples/line_styles.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/pylab_examples/line_styles.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/pylab_examples/load_converter.html b/examples/pylab_examples/load_converter.html deleted file mode 100644 index 2456c606b13..00000000000 --- a/examples/pylab_examples/load_converter.html +++ /dev/null @@ -1,341 +0,0 @@ - - - - - - - - pylab_examples example code: load_converter.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: load_converter.py

-

(Source code, png, pdf)

-
-../../_images/load_converter.png -
-
from __future__ import print_function
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.cbook as cbook
-import matplotlib.dates as mdates
-from matplotlib.dates import bytespdate2num
-
-datafile = cbook.get_sample_data('msft.csv', asfileobj=False)
-print('loading', datafile)
-
-dates, closes = np.loadtxt(datafile, delimiter=',',
-                           converters={0: bytespdate2num('%d-%b-%y')},
-                           skiprows=1, usecols=(0, 2), unpack=True)
-
-fig = plt.figure()
-ax = fig.add_subplot(111)
-ax.plot_date(dates, closes, '-')
-fig.autofmt_xdate()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/loadrec.html b/examples/pylab_examples/loadrec.html deleted file mode 100644 index 7f41e36e20d..00000000000 --- a/examples/pylab_examples/loadrec.html +++ /dev/null @@ -1,345 +0,0 @@ - - - - - - - - pylab_examples example code: loadrec.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: loadrec.py

-

(Source code, png, pdf)

-
-../../_images/loadrec.png -
-
from __future__ import print_function
-from matplotlib import mlab
-import matplotlib.pyplot as plt
-import matplotlib.cbook as cbook
-
-datafile = cbook.get_sample_data('msft.csv', asfileobj=False)
-print('loading', datafile)
-a = mlab.csv2rec(datafile)
-a.sort()
-print(a.dtype)
-
-fig = plt.figure()
-ax = fig.add_subplot(111)
-ax.plot(a.date, a.adj_close, '-')
-fig.autofmt_xdate()
-
-# if you have xlwt installed, you can output excel
-try:
-    import mpl_toolkits.exceltools as exceltools
-    exceltools.rec2excel(a, 'test.xls')
-except ImportError:
-    pass
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/log_bar.html b/examples/pylab_examples/log_bar.html deleted file mode 100644 index 4e7c7269f2f..00000000000 --- a/examples/pylab_examples/log_bar.html +++ /dev/null @@ -1,344 +0,0 @@ - - - - - - - - pylab_examples example code: log_bar.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: log_bar.py

-

(Source code, png, pdf)

-
-../../_images/log_bar.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-
-data = ((3, 1000), (10, 3), (100, 30), (500, 800), (50, 1))
-
-plt.xlabel("FOO")
-plt.ylabel("FOO")
-plt.title("Testing")
-plt.yscale('log')
-
-dim = len(data[0])
-w = 0.75
-dimw = w / dim
-
-x = np.arange(len(data))
-for i in range(len(data[0])):
-    y = [d[i] for d in data]
-    b = plt.bar(x + i * dimw, y, dimw, bottom=0.001)
-
-plt.xticks(x + dimw / 2, map(str, x))
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/log_demo.html b/examples/pylab_examples/log_demo.html deleted file mode 100644 index f731bf9e1f5..00000000000 --- a/examples/pylab_examples/log_demo.html +++ /dev/null @@ -1,359 +0,0 @@ - - - - - - - - pylab_examples example code: log_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: log_demo.py

-

(Source code, png, pdf)

-
-../../_images/log_demo1.png -
-
import numpy as np
-import matplotlib.pyplot as plt
-
-plt.subplots_adjust(hspace=0.4)
-t = np.arange(0.01, 20.0, 0.01)
-
-# log y axis
-plt.subplot(221)
-plt.semilogy(t, np.exp(-t/5.0))
-plt.title('semilogy')
-plt.grid(True)
-
-# log x axis
-plt.subplot(222)
-plt.semilogx(t, np.sin(2*np.pi*t))
-plt.title('semilogx')
-plt.grid(True)
-
-# log x and y axis
-plt.subplot(223)
-plt.loglog(t, 20*np.exp(-t/10.0), basex=2)
-plt.grid(True)
-plt.title('loglog base 2 on x')
-
-# with errorbars: clip non-positive values
-ax = plt.subplot(224)
-ax.set_xscale("log", nonposx='clip')
-ax.set_yscale("log", nonposy='clip')
-
-x = 10.0**np.linspace(0.0, 2.0, 20)
-y = x**2.0
-plt.errorbar(x, y, xerr=0.1*x, yerr=5.0 + 0.75*y)
-ax.set_ylim(ymin=0.1)
-ax.set_title('Errorbars go negative')
-
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/log_test.html b/examples/pylab_examples/log_test.html deleted file mode 100644 index 9cdbe3aa71a..00000000000 --- a/examples/pylab_examples/log_test.html +++ /dev/null @@ -1,332 +0,0 @@ - - - - - - - - pylab_examples example code: log_test.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: log_test.py

-

(Source code, png, pdf)

-
-../../_images/log_test.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-
-dt = 0.01
-t = np.arange(dt, 20.0, dt)
-
-plt.semilogx(t, np.exp(-t/5.0))
-plt.grid(True)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/logo.html b/examples/pylab_examples/logo.html deleted file mode 100644 index 94957942161..00000000000 --- a/examples/pylab_examples/logo.html +++ /dev/null @@ -1,352 +0,0 @@ - - - - - - - - pylab_examples example code: logo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: logo.py

-

(Source code, png, pdf)

-
-../../_images/logo.png -
-
# This file generates an old version of the matplotlib logo
-
-from __future__ import print_function
-# Above import not necessary for Python 3 onwards. Recommend taking this
-# out in examples in the future, since we should all move to Python 3.
-import matplotlib.pyplot as plt
-import numpy as np
-import matplotlib.cbook as cbook
-
-# convert data to mV
-datafile = cbook.get_sample_data('membrane.dat', asfileobj=False)
-print('loading', datafile)
-
-x = 1000 * 0.1 * np.fromstring(open(datafile, 'rb').read(), np.float32)
-# 0.0005 is the sample interval
-t = 0.0005 * np.arange(len(x))
-plt.figure(1, figsize=(7, 1), dpi=100)
-ax = plt.subplot(111, facecolor='y')
-plt.plot(t, x)
-plt.text(0.5, 0.5, 'matplotlib', color='r',
-         fontsize=40, fontname=['Courier', 'DejaVu Sans Mono'],
-         horizontalalignment='center',
-         verticalalignment='center',
-         transform=ax.transAxes,
-         )
-plt.axis([1, 1.72, -60, 10])
-plt.gca().set_xticklabels([])
-plt.gca().set_yticklabels([])
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/major_minor_demo1.html b/examples/pylab_examples/major_minor_demo1.html deleted file mode 100644 index 551115982e1..00000000000 --- a/examples/pylab_examples/major_minor_demo1.html +++ /dev/null @@ -1,375 +0,0 @@ - - - - - - - - pylab_examples example code: major_minor_demo1.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: major_minor_demo1.py

-

(Source code, png, pdf)

-
-../../_images/major_minor_demo1.png -
-
"""
-Demonstrate how to use major and minor tickers.
-
-The two relevant userland classes are Locators and Formatters.
-Locators determine where the ticks are and formatters control the
-formatting of ticks.
-
-Minor ticks are off by default (NullLocator and NullFormatter).  You
-can turn minor ticks on w/o labels by setting the minor locator.  You
-can also turn labeling on for the minor ticker by setting the minor
-formatter
-
-Make a plot with major ticks that are multiples of 20 and minor ticks
-that are multiples of 5.  Label major ticks with %d formatting but
-don't label minor ticks
-
-The MultipleLocator ticker class is used to place ticks on multiples of
-some base.  The FormatStrFormatter uses a string format string (e.g.,
-'%d' or '%1.2f' or '%1.1f cm' ) to format the tick
-
-The pyplot interface grid command changes the grid settings of the
-major ticks of the y and y axis together.  If you want to control the
-grid of the minor ticks for a given axis, use for example
-
-  ax.xaxis.grid(True, which='minor')
-
-Note, you should not use the same locator between different Axis
-because the locator stores references to the Axis data and view limits
-
-"""
-
-import matplotlib.pyplot as plt
-import numpy as np
-from matplotlib.ticker import MultipleLocator, FormatStrFormatter
-
-majorLocator = MultipleLocator(20)
-majorFormatter = FormatStrFormatter('%d')
-minorLocator = MultipleLocator(5)
-
-
-t = np.arange(0.0, 100.0, 0.1)
-s = np.sin(0.1*np.pi*t)*np.exp(-t*0.01)
-
-fig, ax = plt.subplots()
-plt.plot(t, s)
-
-ax.xaxis.set_major_locator(majorLocator)
-ax.xaxis.set_major_formatter(majorFormatter)
-
-# for the minor ticks, use no labels; default NullFormatter
-ax.xaxis.set_minor_locator(minorLocator)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/major_minor_demo2.html b/examples/pylab_examples/major_minor_demo2.html deleted file mode 100644 index 437d7416c8f..00000000000 --- a/examples/pylab_examples/major_minor_demo2.html +++ /dev/null @@ -1,355 +0,0 @@ - - - - - - - - pylab_examples example code: major_minor_demo2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: major_minor_demo2.py

-

(Source code, png, pdf)

-
-../../_images/major_minor_demo2.png -
-
"""
-Automatic tick selection for major and minor ticks.
-
-Use interactive pan and zoom to see how the tick intervals
-change. There will be either 4 or 5 minor tick intervals
-per major interval, depending on the major interval.
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.ticker import AutoMinorLocator
-
-# One can supply an argument to AutoMinorLocator to
-# specify a fixed number of minor intervals per major interval, e.g.:
-# minorLocator = AutoMinorLocator(2)
-# would lead to a single minor tick between major ticks.
-
-minorLocator = AutoMinorLocator()
-
-
-t = np.arange(0.0, 100.0, 0.01)
-s = np.sin(2*np.pi*t)*np.exp(-t*0.01)
-
-fig, ax = plt.subplots()
-plt.plot(t, s)
-
-ax.xaxis.set_minor_locator(minorLocator)
-
-plt.tick_params(which='both', width=2)
-plt.tick_params(which='major', length=7)
-plt.tick_params(which='minor', length=4, color='r')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/manual_axis.html b/examples/pylab_examples/manual_axis.html deleted file mode 100644 index 2e6eae17775..00000000000 --- a/examples/pylab_examples/manual_axis.html +++ /dev/null @@ -1,380 +0,0 @@ - - - - - - - - pylab_examples example code: manual_axis.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: manual_axis.py

-

(Source code, png, pdf)

-
-../../_images/manual_axis.png -
-
"""
-The techniques here are no longer required with the new support for
-spines in matplotlib -- see
-http://matplotlib.org/examples/pylab_examples/spine_placement_demo.html.
-
-This example should be considered deprecated and is left just for demo
-purposes for folks wanting to make a pseudo-axis
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.lines as lines
-
-
-def make_xaxis(ax, yloc, offset=0.05, **props):
-    xmin, xmax = ax.get_xlim()
-    locs = [loc for loc in ax.xaxis.get_majorticklocs()
-            if loc >= xmin and loc <= xmax]
-    tickline, = ax.plot(locs, [yloc]*len(locs), linestyle='',
-                        marker=lines.TICKDOWN, **props)
-    axline, = ax.plot([xmin, xmax], [yloc, yloc], **props)
-    tickline.set_clip_on(False)
-    axline.set_clip_on(False)
-    for loc in locs:
-        ax.text(loc, yloc - offset, '%1.1f' % loc,
-                horizontalalignment='center',
-                verticalalignment='top')
-
-
-def make_yaxis(ax, xloc=0, offset=0.05, **props):
-    ymin, ymax = ax.get_ylim()
-    locs = [loc for loc in ax.yaxis.get_majorticklocs()
-            if loc >= ymin and loc <= ymax]
-    tickline, = ax.plot([xloc]*len(locs), locs, linestyle='',
-                        marker=lines.TICKLEFT, **props)
-    axline, = ax.plot([xloc, xloc], [ymin, ymax], **props)
-    tickline.set_clip_on(False)
-    axline.set_clip_on(False)
-
-    for loc in locs:
-        ax.text(xloc - offset, loc, '%1.1f' % loc,
-                verticalalignment='center',
-                horizontalalignment='right')
-
-
-props = dict(color='black', linewidth=2, markeredgewidth=2)
-x = np.arange(200.)
-y = np.sin(2*np.pi*x/200.) + np.random.rand(200) - 0.5
-fig = plt.figure(facecolor='white')
-ax = fig.add_subplot(111, frame_on=False)
-ax.axison = False
-ax.plot(x, y, 'd', markersize=8, markerfacecolor='blue')
-ax.set_xlim(0, 200)
-ax.set_ylim(-1.5, 1.5)
-make_xaxis(ax, 0, offset=0.1, **props)
-make_yaxis(ax, 0, offset=5, **props)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/marker_path.html b/examples/pylab_examples/marker_path.html deleted file mode 100644 index 4d34fd4eba6..00000000000 --- a/examples/pylab_examples/marker_path.html +++ /dev/null @@ -1,338 +0,0 @@ - - - - - - - - pylab_examples example code: marker_path.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: marker_path.py

-

(Source code, png, pdf)

-
-../../_images/marker_path.png -
-
import matplotlib.pyplot as plt
-import matplotlib.path as mpath
-import numpy as np
-
-
-star = mpath.Path.unit_regular_star(6)
-circle = mpath.Path.unit_circle()
-# concatenate the circle with an internal cutout of the star
-verts = np.concatenate([circle.vertices, star.vertices[::-1, ...]])
-codes = np.concatenate([circle.codes, star.codes])
-cut_star = mpath.Path(verts, codes)
-
-
-plt.plot(np.arange(10)**2, '--r', marker=cut_star, markersize=15)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/markevery_demo.html b/examples/pylab_examples/markevery_demo.html deleted file mode 100644 index aea946cff2e..00000000000 --- a/examples/pylab_examples/markevery_demo.html +++ /dev/null @@ -1,433 +0,0 @@ - - - - - - - - pylab_examples example code: markevery_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: markevery_demo.py

-

(Source code)

-
-../../_images/markevery_demo_00.png -

(png, pdf)

-
-
-../../_images/markevery_demo_01.png -

(png, pdf)

-
-
-../../_images/markevery_demo_02.png -

(png, pdf)

-
-
-../../_images/markevery_demo_03.png -

(png, pdf)

-
-
"""
-This example demonstrates the various options for showing a marker at a
-subset of data points using the `markevery` property of a Line2D object.
-
-Integer arguments are fairly intuitive.  e.g. `markevery`=5 will plot every
-5th marker starting from the first data point.
-
-Float arguments allow markers to be spaced at approximately equal distances
-along the line.  The theoretical distance along the line between markers is
-determined by multiplying the display-coordinate distance of the axes
-bounding-box diagonal by the value of `markevery`.  The data points closest
-to the theoretical distances will be shown.
-
-A slice or list/array can also be used with `markevery` to specify the markers
-to show.
-
-"""
-
-from __future__ import division
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.gridspec as gridspec
-
-# define a list of markevery cases to plot
-cases = [None,
-         8,
-         (30, 8),
-         [16, 24, 30], [0, -1],
-         slice(100, 200, 3),
-         0.1, 0.3, 1.5,
-         (0.0, 0.1), (0.45, 0.1)]
-
-# define the figure size and grid layout properties
-figsize = (10, 8)
-cols = 3
-gs = gridspec.GridSpec(len(cases) // cols + 1, cols)
-
-# define the data for cartesian plots
-delta = 0.11
-x = np.linspace(0, 10 - 2 * delta, 200) + delta
-y = np.sin(x) + 1.0 + delta
-
-# plot each markevery case for linear x and y scales
-fig1 = plt.figure(num=1, figsize=figsize)
-ax = []
-for i, case in enumerate(cases):
-    row = (i // cols)
-    col = i % cols
-    ax.append(fig1.add_subplot(gs[row, col]))
-    ax[-1].set_title('markevery=%s' % str(case))
-    ax[-1].plot(x, y, 'o', ls='-', ms=4, markevery=case)
-#fig1.tight_layout()
-
-# plot each markevery case for log x and y scales
-fig2 = plt.figure(num=2, figsize=figsize)
-axlog = []
-for i, case in enumerate(cases):
-    row = (i // cols)
-    col = i % cols
-    axlog.append(fig2.add_subplot(gs[row, col]))
-    axlog[-1].set_title('markevery=%s' % str(case))
-    axlog[-1].set_xscale('log')
-    axlog[-1].set_yscale('log')
-    axlog[-1].plot(x, y, 'o', ls='-', ms=4, markevery=case)
-fig2.tight_layout()
-
-# plot each markevery case for linear x and y scales but zoomed in
-# note the behaviour when zoomed in.  When a start marker offset is specified
-# it is always interpreted with respect to the first data point which might be
-# different to the first visible data point.
-fig3 = plt.figure(num=3, figsize=figsize)
-axzoom = []
-for i, case in enumerate(cases):
-    row = (i // cols)
-    col = i % cols
-    axzoom.append(fig3.add_subplot(gs[row, col]))
-    axzoom[-1].set_title('markevery=%s' % str(case))
-    axzoom[-1].plot(x, y, 'o', ls='-', ms=4, markevery=case)
-    axzoom[-1].set_xlim((6, 6.7))
-    axzoom[-1].set_ylim((1.1, 1.7))
-fig3.tight_layout()
-
-# define data for polar plots
-r = np.linspace(0, 3.0, 200)
-theta = 2 * np.pi * r
-
-# plot each markevery case for polar plots
-fig4 = plt.figure(num=4, figsize=figsize)
-axpolar = []
-for i, case in enumerate(cases):
-    row = (i // cols)
-    col = i % cols
-    axpolar.append(fig4.add_subplot(gs[row, col], projection='polar'))
-    axpolar[-1].set_title('markevery=%s' % str(case))
-    axpolar[-1].plot(theta, r, 'o', ls='-', ms=4, markevery=case)
-fig4.tight_layout()
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/masked_demo.html b/examples/pylab_examples/masked_demo.html deleted file mode 100644 index 118ad813a64..00000000000 --- a/examples/pylab_examples/masked_demo.html +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - pylab_examples example code: masked_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: masked_demo.py

-

(Source code, png, pdf)

-
-../../_images/masked_demo.png -
-
'''
-Plot lines with points masked out.
-
-This would typically be used with gappy data, to
-break the line at the data gaps.
-'''
-
-import matplotlib.pyplot as plt
-import numpy as np
-
-x = np.arange(0, 2*np.pi, 0.02)
-y = np.sin(x)
-y1 = np.sin(2*x)
-y2 = np.sin(3*x)
-ym1 = np.ma.masked_where(y1 > 0.5, y1)
-ym2 = np.ma.masked_where(y2 < -0.5, y2)
-
-lines = plt.plot(x, y, x, ym1, x, ym2, 'o')
-plt.setp(lines[0], linewidth=4)
-plt.setp(lines[1], linewidth=2)
-plt.setp(lines[2], markersize=10)
-
-plt.legend(('No mask', 'Masked if > 0.5', 'Masked if < -0.5'),
-           loc='upper right')
-plt.title('Masked line demo')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/mathtext_demo.html b/examples/pylab_examples/mathtext_demo.html deleted file mode 100644 index d9f6df70216..00000000000 --- a/examples/pylab_examples/mathtext_demo.html +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - pylab_examples example code: mathtext_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: mathtext_demo.py

-

(Source code, png, pdf)

-
-../../_images/mathtext_demo.png -
-
"""
-Use matplotlib's internal LaTeX parser and layout engine.  For true
-latex rendering, see the text.usetex option
-"""
-import numpy as np
-from matplotlib.pyplot import figure, show
-
-fig = figure()
-fig.subplots_adjust(bottom=0.2)
-
-ax = fig.add_subplot(111)
-ax.plot([1, 2, 3], 'r')
-x = np.arange(0.0, 3.0, 0.1)
-
-ax.grid(True)
-ax.set_xlabel(r'$\Delta_i^j$', fontsize=20)
-ax.set_ylabel(r'$\Delta_{i+1}^j$', fontsize=20)
-tex = r'$\mathcal{R}\prod_{i=\alpha_{i+1}}^\infty a_i\sin(2 \pi f x_i)$'
-
-ax.text(1, 1.6, tex, fontsize=20, va='bottom')
-
-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)
-
-show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/mathtext_examples.html b/examples/pylab_examples/mathtext_examples.html deleted file mode 100644 index fabc350274c..00000000000 --- a/examples/pylab_examples/mathtext_examples.html +++ /dev/null @@ -1,448 +0,0 @@ - - - - - - - - pylab_examples example code: mathtext_examples.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: mathtext_examples.py

-

(Source code)

-

(png, pdf)

-
-../../_images/mathtext_examples_01_001.png -
-
"""
-Selected features of Matplotlib's math rendering engine.
-"""
-from __future__ import print_function
-import matplotlib.pyplot as plt
-import os
-import sys
-import re
-import gc
-
-# Selection of features following "Writing mathematical expressions" tutorial
-mathtext_titles = {
-    0: "Header demo",
-    1: "Subscripts and superscripts",
-    2: "Fractions, binomials and stacked numbers",
-    3: "Radicals",
-    4: "Fonts",
-    5: "Accents",
-    6: "Greek, Hebrew",
-    7: "Delimiters, functions and Symbols"}
-n_lines = len(mathtext_titles)
-
-# Randomly picked examples
-mathext_demos = {
-    0: r"$W^{3\beta}_{\delta_1 \rho_1 \sigma_2} = "
-    r"U^{3\beta}_{\delta_1 \rho_1} + \frac{1}{8 \pi 2} "
-    r"\int^{\alpha_2}_{\alpha_2} d \alpha^\prime_2 \left[\frac{ "
-    r"U^{2\beta}_{\delta_1 \rho_1} - \alpha^\prime_2U^{1\beta}_"
-    r"{\rho_1 \sigma_2} }{U^{0\beta}_{\rho_1 \sigma_2}}\right]$",
-
-    1: r"$\alpha_i > \beta_i,\ "
-    r"\alpha_{i+1}^j = {\rm sin}(2\pi f_j t_i) e^{-5 t_i/\tau},\ "
-    r"\ldots$",
-
-    2: r"$\frac{3}{4},\ \binom{3}{4},\ \stackrel{3}{4},\ "
-    r"\left(\frac{5 - \frac{1}{x}}{4}\right),\ \ldots$",
-
-    3: r"$\sqrt{2},\ \sqrt[3]{x},\ \ldots$",
-
-    4: r"$\mathrm{Roman}\ , \ \mathit{Italic}\ , \ \mathtt{Typewriter} \ "
-    r"\mathrm{or}\ \mathcal{CALLIGRAPHY}$",
-
-    5: r"$\acute a,\ \bar a,\ \breve a,\ \dot a,\ \ddot a, \ \grave a, \ "
-    r"\hat a,\ \tilde a,\ \vec a,\ \widehat{xyz},\ \widetilde{xyz},\ "
-    r"\ldots$",
-
-    6: r"$\alpha,\ \beta,\ \chi,\ \delta,\ \lambda,\ \mu,\ "
-    r"\Delta,\ \Gamma,\ \Omega,\ \Phi,\ \Pi,\ \Upsilon,\ \nabla,\ "
-    r"\aleph,\ \beth,\ \daleth,\ \gimel,\ \ldots$",
-
-    7: r"$\coprod,\ \int,\ \oint,\ \prod,\ \sum,\ "
-    r"\log,\ \sin,\ \approx,\ \oplus,\ \star,\ \varpropto,\ "
-    r"\infty,\ \partial,\ \Re,\ \leftrightsquigarrow, \ \ldots$"}
-
-
-def doall():
-    # Colors used in mpl online documentation.
-    mpl_blue_rvb = (191./255., 209./256., 212./255.)
-    mpl_orange_rvb = (202/255., 121/256., 0./255.)
-    mpl_grey_rvb = (51./255., 51./255., 51./255.)
-
-    # Creating figure and axis.
-    plt.figure(figsize=(6, 7))
-    plt.axes([0.01, 0.01, 0.98, 0.90], facecolor="white", frameon=True)
-    plt.gca().set_xlim(0., 1.)
-    plt.gca().set_ylim(0., 1.)
-    plt.gca().set_title("Matplotlib's math rendering engine",
-                        color=mpl_grey_rvb, fontsize=14, weight='bold')
-    plt.gca().set_xticklabels("", visible=False)
-    plt.gca().set_yticklabels("", visible=False)
-
-    # Gap between lines in axes coords
-    line_axesfrac = (1. / (n_lines))
-
-    # Plotting header demonstration formula
-    full_demo = mathext_demos[0]
-    plt.annotate(full_demo,
-                 xy=(0.5, 1. - 0.59*line_axesfrac),
-                 xycoords='data', color=mpl_orange_rvb, ha='center',
-                 fontsize=20)
-
-    # Plotting features demonstration formulae
-    for i_line in range(1, n_lines):
-        baseline = 1. - (i_line)*line_axesfrac
-        baseline_next = baseline - line_axesfrac*1.
-        title = mathtext_titles[i_line] + ":"
-        fill_color = ['white', mpl_blue_rvb][i_line % 2]
-        plt.fill_between([0., 1.], [baseline, baseline],
-                         [baseline_next, baseline_next],
-                         color=fill_color, alpha=0.5)
-        plt.annotate(title,
-                     xy=(0.07, baseline - 0.3*line_axesfrac),
-                     xycoords='data', color=mpl_grey_rvb, weight='bold')
-        demo = mathext_demos[i_line]
-        plt.annotate(demo,
-                     xy=(0.05, baseline - 0.75*line_axesfrac),
-                     xycoords='data', color=mpl_grey_rvb,
-                     fontsize=16)
-
-    for i in range(n_lines):
-        s = mathext_demos[i]
-        print(i, s)
-    plt.show()
-
-if '--latex' in sys.argv:
-    # Run: python mathtext_examples.py --latex
-    # Need amsmath and amssymb packages.
-    fd = open("mathtext_examples.ltx", "w")
-    fd.write("\\documentclass{article}\n")
-    fd.write("\\usepackage{amsmath, amssymb}\n")
-    fd.write("\\begin{document}\n")
-    fd.write("\\begin{enumerate}\n")
-
-    for i in range(n_lines):
-        s = mathext_demos[i]
-        s = re.sub(r"(?<!\\)\$", "$$", s)
-        fd.write("\\item %s\n" % s)
-
-    fd.write("\\end{enumerate}\n")
-    fd.write("\\end{document}\n")
-    fd.close()
-
-    os.system("pdflatex mathtext_examples.ltx")
-else:
-    doall()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/matplotlib_icon.html b/examples/pylab_examples/matplotlib_icon.html deleted file mode 100644 index 4344e0be25a..00000000000 --- a/examples/pylab_examples/matplotlib_icon.html +++ /dev/null @@ -1,347 +0,0 @@ - - - - - - - - pylab_examples example code: matplotlib_icon.py — Matplotlib 1.5.3 documentation - - - - - - - - - - - - - - - - - - -
-

Matplotlib 2.0.0rc2 is available

- -

Install the release candidate now!

- -
- - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: matplotlib_icon.py

-

(Source code, png, hires.png, pdf)

-
-../../_images/matplotlib_icon.png -
-
"""
-make the matplotlib svg minimization icon
-"""
-import matplotlib.pyplot as plt
-import matplotlib
-import numpy as np
-
-matplotlib.rc('grid', ls='-', lw=2, color='k')
-fig = plt.figure(figsize=(1, 1), dpi=72)
-plt.axes([0.025, 0.025, 0.95, 0.95], axisbg='#bfd1d4')
-
-t = np.arange(0, 2, 0.05)
-s = np.sin(2*np.pi*t)
-plt.plot(t, s, linewidth=4, color="#ca7900")
-plt.axis([-.2, 2.2, -1.2, 1.2])
-
-ax = plt.gca()
-ax.set_xticklabels([])
-ax.set_yticklabels([])
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/matshow.html b/examples/pylab_examples/matshow.html deleted file mode 100644 index d3fa7acf742..00000000000 --- a/examples/pylab_examples/matshow.html +++ /dev/null @@ -1,339 +0,0 @@ - - - - - - - - pylab_examples example code: matshow.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: matshow.py

-

(Source code, png, pdf)

-
-../../_images/matshow1.png -
-
"""Simple matshow() example."""
-import matplotlib.pyplot as plt
-import numpy as np
-
-
-def samplemat(dims):
-    """Make a matrix with all zeros and increasing elements on the diagonal"""
-    aa = np.zeros(dims)
-    for i in range(min(dims)):
-        aa[i, i] = i
-    return aa
-
-
-# Display matrix
-plt.matshow(samplemat((15, 35)))
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/movie_demo.html b/examples/pylab_examples/movie_demo.html deleted file mode 100644 index a7e29bad0f7..00000000000 --- a/examples/pylab_examples/movie_demo.html +++ /dev/null @@ -1,350 +0,0 @@ - - - - - - - - pylab_examples example code: movie_demo.py — Matplotlib 1.5.3 documentation - - - - - - - - - - - - - - - - - - -
-

Matplotlib 2.0.0rc2 is available

- -

Install the release candidate now!

- -
- - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: movie_demo.py

-

[source code]

-
#!/usr/bin/env python
-# -*- noplot -*-
-
-from __future__ import print_function
-
-import os
-import matplotlib.pyplot as plt
-import numpy as np
-
-files = []
-
-fig, ax = plt.subplots(figsize=(5, 5))
-for i in range(50):  # 50 frames
-    plt.cla()
-    plt.imshow(np.random.rand(5, 5), interpolation='nearest')
-    fname = '_tmp%03d.png' % i
-    print('Saving frame', fname)
-    plt.savefig(fname)
-    files.append(fname)
-
-print('Making movie animation.mpg - this make take a while')
-os.system("mencoder 'mf://_tmp*.png' -mf type=png:fps=10 -ovc lavc -lavcopts vcodec=wmv2 -oac copy -o animation.mpg")
-#os.system("convert _tmp*.png animation.mng")
-
-# cleanup
-for fname in files:
-    os.remove(fname)
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/movie_demo.py b/examples/pylab_examples/movie_demo.py deleted file mode 100644 index 0d1f7d78666..00000000000 --- a/examples/pylab_examples/movie_demo.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python -# -*- noplot -*- - -from __future__ import print_function - -import os -import matplotlib.pyplot as plt -import numpy as np - -files = [] - -fig, ax = plt.subplots(figsize=(5, 5)) -for i in range(50): # 50 frames - plt.cla() - plt.imshow(np.random.rand(5, 5), interpolation='nearest') - fname = '_tmp%03d.png' % i - print('Saving frame', fname) - plt.savefig(fname) - files.append(fname) - -print('Making movie animation.mpg - this make take a while') -os.system("mencoder 'mf://_tmp*.png' -mf type=png:fps=10 -ovc lavc -lavcopts vcodec=wmv2 -oac copy -o animation.mpg") -#os.system("convert _tmp*.png animation.mng") - -# cleanup -for fname in files: - os.remove(fname) diff --git a/examples/pylab_examples/mri_demo.html b/examples/pylab_examples/mri_demo.html deleted file mode 100644 index 12cca46e687..00000000000 --- a/examples/pylab_examples/mri_demo.html +++ /dev/null @@ -1,341 +0,0 @@ - - - - - - - - pylab_examples example code: mri_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: mri_demo.py

-

(Source code, png, pdf)

-
-../../_images/mri_demo.png -
-
"""Displays an MRI image."""
-
-import matplotlib.pyplot as plt
-import matplotlib.cbook as cbook
-import matplotlib.cm as cm
-import numpy as np
-
-fig, ax = plt.subplots(num="MRI_demo")
-
-# Data are 256x256 16 bit integers
-dfile = cbook.get_sample_data('s1045.ima.gz')
-im = np.fromstring(dfile.read(), np.uint16).astype(float)
-im.shape = (256, 256)
-dfile.close()
-
-ax.imshow(im, cmap=cm.gray)
-ax.axis('off')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/mri_with_eeg.html b/examples/pylab_examples/mri_with_eeg.html deleted file mode 100644 index d4efa60a41e..00000000000 --- a/examples/pylab_examples/mri_with_eeg.html +++ /dev/null @@ -1,401 +0,0 @@ - - - - - - - - pylab_examples example code: mri_with_eeg.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: mri_with_eeg.py

-

(Source code, png, pdf)

-
-../../_images/mri_with_eeg.png -
-
"""Displays a set of subplots with an MRI image, its intensity histogram and
-some EEG traces.
-"""
-
-from __future__ import division, print_function
-
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.cbook as cbook
-import matplotlib.cm as cm
-
-from matplotlib.collections import LineCollection
-from matplotlib.ticker import MultipleLocator
-
-fig = plt.figure("MRI_with_EEG")
-
-# Load the MRI data (256x256 16 bit integers)
-dfile = cbook.get_sample_data('s1045.ima.gz')
-im = np.fromstring(dfile.read(), np.uint16).astype(float)
-im.shape = (256, 256)
-dfile.close()
-
-# Plot the MRI image
-ax0 = fig.add_subplot(2, 2, 1)
-ax0.imshow(im, cmap=cm.gray)
-ax0.axis('off')
-
-# Plot the histogram of MRI intensity
-ax1 = fig.add_subplot(2, 2, 2)
-im = np.ravel(im)
-im = im[np.nonzero(im)]  # Ignore the background
-im = im / (2**16 - 1)  # Normalize
-ax1.hist(im, bins=100)
-ax1.xaxis.set_major_locator(MultipleLocator(0.4))
-ax1.minorticks_on()
-ax1.set_yticks([])
-ax1.set_xlabel('Intensity (a.u.)')
-ax1.set_ylabel('MRI density')
-
-# Load the EEG data
-numSamples, numRows = 800, 4
-eegfile = cbook.get_sample_data('eeg.dat', asfileobj=False)
-print('Loading EEG %s' % eegfile)
-data = np.fromfile(eegfile, dtype=float)
-data.shape = (numSamples, numRows)
-t = 10.0 * np.arange(numSamples) / numSamples
-
-# Plot the EEG
-ticklocs = []
-ax2 = fig.add_subplot(2, 1, 2)
-ax2.set_xlim(0, 10)
-ax2.set_xticks(np.arange(10))
-dmin = data.min()
-dmax = data.max()
-dr = (dmax - dmin) * 0.7  # Crowd them a bit.
-y0 = dmin
-y1 = (numRows - 1) * dr + dmax
-ax2.set_ylim(y0, y1)
-
-segs = []
-for i in range(numRows):
-    segs.append(np.hstack((t[:, np.newaxis], data[:, i, np.newaxis])))
-    ticklocs.append(i * dr)
-
-offsets = np.zeros((numRows, 2), dtype=float)
-offsets[:, 1] = ticklocs
-
-lines = LineCollection(segs, offsets=offsets, transOffset=None)
-ax2.add_collection(lines)
-
-# Set the yticks to use axes coordinates on the y axis
-ax2.set_yticks(ticklocs)
-ax2.set_yticklabels(['PG3', 'PG5', 'PG7', 'PG9'])
-
-ax2.set_xlabel('Time (s)')
-
-
-plt.tight_layout()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/multi_image.html b/examples/pylab_examples/multi_image.html deleted file mode 100644 index 933909709fb..00000000000 --- a/examples/pylab_examples/multi_image.html +++ /dev/null @@ -1,401 +0,0 @@ - - - - - - - - pylab_examples example code: multi_image.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: multi_image.py

-

(Source code, png, pdf)

-
-../../_images/multi_image.png -
-
'''
-Make a set of images with a single colormap, norm, and colorbar.
-
-It also illustrates colorbar tick labelling with a multiplier.
-'''
-
-from matplotlib.pyplot import figure, show, axes, sci
-from matplotlib import cm, colors
-from matplotlib.font_manager import FontProperties
-from numpy import amin, amax, ravel
-from numpy.random import rand
-
-Nr = 3
-Nc = 2
-
-fig = figure()
-cmap = cm.cool
-
-figtitle = 'Multiple images'
-t = fig.text(0.5, 0.95, figtitle,
-             horizontalalignment='center',
-             fontproperties=FontProperties(size=16))
-
-cax = fig.add_axes([0.2, 0.08, 0.6, 0.04])
-
-w = 0.4
-h = 0.22
-ax = []
-images = []
-vmin = 1e40
-vmax = -1e40
-for i in range(Nr):
-    for j in range(Nc):
-        pos = [0.075 + j*1.1*w, 0.18 + i*1.2*h, w, h]
-        a = fig.add_axes(pos)
-        if i > 0:
-            a.set_xticklabels([])
-        # Make some fake data with a range that varies
-        # somewhat from one plot to the next.
-        data = ((1 + i + j)/10.0)*rand(10, 20)*1e-6
-        dd = ravel(data)
-        # Manually find the min and max of all colors for
-        # use in setting the color scale.
-        vmin = min(vmin, amin(dd))
-        vmax = max(vmax, amax(dd))
-        images.append(a.imshow(data, cmap=cmap))
-
-        ax.append(a)
-
-# Set the first image as the master, with all the others
-# observing it for changes in cmap or norm.
-
-
-class ImageFollower(object):
-    'update image in response to changes in clim or cmap on another image'
-
-    def __init__(self, follower):
-        self.follower = follower
-
-    def __call__(self, leader):
-        self.follower.set_cmap(leader.get_cmap())
-        self.follower.set_clim(leader.get_clim())
-
-norm = colors.Normalize(vmin=vmin, vmax=vmax)
-for i, im in enumerate(images):
-    im.set_norm(norm)
-    if i > 0:
-        images[0].callbacksSM.connect('changed', ImageFollower(im))
-
-# The colorbar is also based on this master image.
-fig.colorbar(images[0], cax, orientation='horizontal')
-
-# We need the following only if we want to run this interactively and
-# modify the colormap:
-
-axes(ax[0])     # Return the current axes to the first one,
-sci(images[0])  # because the current image must be in current axes.
-
-show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/multicolored_line.html b/examples/pylab_examples/multicolored_line.html deleted file mode 100644 index 04fedff8655..00000000000 --- a/examples/pylab_examples/multicolored_line.html +++ /dev/null @@ -1,380 +0,0 @@ - - - - - - - - pylab_examples example code: multicolored_line.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: multicolored_line.py

-

(Source code)

-
-../../_images/multicolored_line_00.png -

(png, pdf)

-
-
-../../_images/multicolored_line_01.png -

(png, pdf)

-
-
'''
-Color parts of a line based on its properties, e.g., slope.
-'''
-
-import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.collections import LineCollection
-from matplotlib.colors import ListedColormap, BoundaryNorm
-
-x = np.linspace(0, 3 * np.pi, 500)
-y = np.sin(x)
-z = np.cos(0.5 * (x[:-1] + x[1:]))  # first derivative
-
-# Create a colormap for red, green and blue and a norm to color
-# f' < -0.5 red, f' > 0.5 blue, and the rest green
-cmap = ListedColormap(['r', 'g', 'b'])
-norm = BoundaryNorm([-1, -0.5, 0.5, 1], cmap.N)
-
-# Create a set of line segments so that we can color them individually
-# This creates the points as a N x 1 x 2 array so that we can stack points
-# together easily to get the segments. The segments array for line collection
-# needs to be numlines x points per line x 2 (x and y)
-points = np.array([x, y]).T.reshape(-1, 1, 2)
-segments = np.concatenate([points[:-1], points[1:]], axis=1)
-
-# Create the line collection object, setting the colormapping parameters.
-# Have to set the actual values used for colormapping separately.
-lc = LineCollection(segments, cmap=cmap, norm=norm)
-lc.set_array(z)
-lc.set_linewidth(3)
-
-fig1 = plt.figure()
-plt.gca().add_collection(lc)
-plt.xlim(x.min(), x.max())
-plt.ylim(-1.1, 1.1)
-
-# Now do a second plot coloring the curve using a continuous colormap
-t = np.linspace(0, 10, 200)
-x = np.cos(np.pi * t)
-y = np.sin(t)
-points = np.array([x, y]).T.reshape(-1, 1, 2)
-segments = np.concatenate([points[:-1], points[1:]], axis=1)
-
-lc = LineCollection(segments, cmap=plt.get_cmap('copper'),
-                    norm=plt.Normalize(0, 10))
-lc.set_array(t)
-lc.set_linewidth(3)
-
-fig2 = plt.figure()
-plt.gca().add_collection(lc)
-plt.xlim(-1, 1)
-plt.ylim(-1, 1)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/multiline.html b/examples/pylab_examples/multiline.html deleted file mode 100644 index 6b0ddba24fb..00000000000 --- a/examples/pylab_examples/multiline.html +++ /dev/null @@ -1,362 +0,0 @@ - - - - - - - - pylab_examples example code: multiline.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: multiline.py

-

(Source code, png, pdf)

-
-../../_images/multiline.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-
-plt.figure(figsize=(7, 4))
-ax = plt.subplot(121)
-ax.set_aspect(1)
-plt.plot(np.arange(10))
-plt.xlabel('this is a xlabel\n(with newlines!)')
-plt.ylabel('this is vertical\ntest', multialignment='center')
-plt.text(2, 7, 'this is\nyet another test',
-         rotation=45,
-         horizontalalignment='center',
-         verticalalignment='top',
-         multialignment='center')
-
-plt.grid(True)
-
-plt.subplot(122)
-
-plt.text(0.29, 0.4, "Mat\nTTp\n123", size=18,
-         va="baseline", ha="right", multialignment="left",
-         bbox=dict(fc="none"))
-
-plt.text(0.34, 0.4, "Mag\nTTT\n123", size=18,
-         va="baseline", ha="left", multialignment="left",
-         bbox=dict(fc="none"))
-
-plt.text(0.95, 0.4, "Mag\nTTT$^{A^A}$\n123", size=18,
-         va="baseline", ha="right", multialignment="left",
-         bbox=dict(fc="none"))
-
-plt.xticks([0.2, 0.4, 0.6, 0.8, 1.],
-           ["Jan\n2009", "Feb\n2009", "Mar\n2009", "Apr\n2009", "May\n2009"])
-
-plt.axhline(0.4)
-plt.title("test line spacing for multiline text")
-
-plt.subplots_adjust(bottom=0.25, top=0.75)
-plt.draw()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/multipage_pdf.html b/examples/pylab_examples/multipage_pdf.html deleted file mode 100644 index 3404ef4a178..00000000000 --- a/examples/pylab_examples/multipage_pdf.html +++ /dev/null @@ -1,364 +0,0 @@ - - - - - - - - pylab_examples example code: multipage_pdf.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: multipage_pdf.py

-

(Source code)

-
"""
-This is a demo of creating a pdf file with several pages,
-as well as adding metadata and annotations to pdf files.
-"""
-
-import datetime
-import numpy as np
-from matplotlib.backends.backend_pdf import PdfPages
-import matplotlib.pyplot as plt
-
-# Create the PdfPages object to which we will save the pages:
-# The with statement makes sure that the PdfPages object is closed properly at
-# the end of the block, even if an Exception occurs.
-with PdfPages('multipage_pdf.pdf') as pdf:
-    plt.figure(figsize=(3, 3))
-    plt.plot(range(7), [3, 1, 4, 1, 5, 9, 2], 'r-o')
-    plt.title('Page One')
-    pdf.savefig()  # saves the current figure into a pdf page
-    plt.close()
-
-    plt.rc('text', usetex=True)
-    plt.figure(figsize=(8, 6))
-    x = np.arange(0, 5, 0.1)
-    plt.plot(x, np.sin(x), 'b-')
-    plt.title('Page Two')
-    pdf.attach_note("plot of sin(x)")  # you can add a pdf note to
-                                       # attach metadata to a page
-    pdf.savefig()
-    plt.close()
-
-    plt.rc('text', usetex=False)
-    fig = plt.figure(figsize=(4, 5))
-    plt.plot(x, x*x, 'ko')
-    plt.title('Page Three')
-    pdf.savefig(fig)  # or you can pass a Figure object to pdf.savefig
-    plt.close()
-
-    # We can also set the file's metadata via the PdfPages object:
-    d = pdf.infodict()
-    d['Title'] = 'Multipage PDF Example'
-    d['Author'] = u'Jouni K. Sepp\xe4nen'
-    d['Subject'] = 'How to create a multipage pdf file and set its metadata'
-    d['Keywords'] = 'PdfPages multipage keywords author title subject'
-    d['CreationDate'] = datetime.datetime(2009, 11, 13)
-    d['ModDate'] = datetime.datetime.today()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/multiple_figs_demo.html b/examples/pylab_examples/multiple_figs_demo.html deleted file mode 100644 index 7df63201257..00000000000 --- a/examples/pylab_examples/multiple_figs_demo.html +++ /dev/null @@ -1,352 +0,0 @@ - - - - - - - - pylab_examples example code: multiple_figs_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: multiple_figs_demo.py

-

(Source code)

-
-../../_images/multiple_figs_demo_00.png -

(png, pdf)

-
-
-../../_images/multiple_figs_demo_01.png -

(png, pdf)

-
-
# Working with multiple figure windows and subplots
-import matplotlib.pyplot as plt
-import numpy as np
-
-t = np.arange(0.0, 2.0, 0.01)
-s1 = np.sin(2*np.pi*t)
-s2 = np.sin(4*np.pi*t)
-
-plt.figure(1)
-plt.subplot(211)
-plt.plot(t, s1)
-plt.subplot(212)
-plt.plot(t, 2*s1)
-
-plt.figure(2)
-plt.plot(t, s2)
-
-# now switch back to figure 1 and make some changes
-plt.figure(1)
-plt.subplot(211)
-plt.plot(t, s2, 's')
-ax = plt.gca()
-ax.set_xticklabels([])
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/multiple_yaxis_with_spines.html b/examples/pylab_examples/multiple_yaxis_with_spines.html deleted file mode 100644 index 20fb611a6bd..00000000000 --- a/examples/pylab_examples/multiple_yaxis_with_spines.html +++ /dev/null @@ -1,376 +0,0 @@ - - - - - - - - pylab_examples example code: multiple_yaxis_with_spines.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: multiple_yaxis_with_spines.py

-

(Source code, png, pdf)

-
-../../_images/multiple_yaxis_with_spines.png -
-
import matplotlib.pyplot as plt
-
-
-def make_patch_spines_invisible(ax):
-    ax.set_frame_on(True)
-    ax.patch.set_visible(False)
-    for sp in ax.spines.values():
-        sp.set_visible(False)
-
-fig, host = plt.subplots()
-fig.subplots_adjust(right=0.75)
-
-par1 = host.twinx()
-par2 = host.twinx()
-
-# Offset the right spine of par2.  The ticks and label have already been
-# placed on the right by twinx above.
-par2.spines["right"].set_position(("axes", 1.2))
-# Having been created by twinx, par2 has its frame off, so the line of its
-# detached spine is invisible.  First, activate the frame but make the patch
-# and spines invisible.
-make_patch_spines_invisible(par2)
-# Second, show the right spine.
-par2.spines["right"].set_visible(True)
-
-p1, = host.plot([0, 1, 2], [0, 1, 2], "b-", label="Density")
-p2, = par1.plot([0, 1, 2], [0, 3, 2], "r-", label="Temperature")
-p3, = par2.plot([0, 1, 2], [50, 30, 15], "g-", label="Velocity")
-
-host.set_xlim(0, 2)
-host.set_ylim(0, 2)
-par1.set_ylim(0, 4)
-par2.set_ylim(1, 65)
-
-host.set_xlabel("Distance")
-host.set_ylabel("Density")
-par1.set_ylabel("Temperature")
-par2.set_ylabel("Velocity")
-
-host.yaxis.label.set_color(p1.get_color())
-par1.yaxis.label.set_color(p2.get_color())
-par2.yaxis.label.set_color(p3.get_color())
-
-tkw = dict(size=4, width=1.5)
-host.tick_params(axis='y', colors=p1.get_color(), **tkw)
-par1.tick_params(axis='y', colors=p2.get_color(), **tkw)
-par2.tick_params(axis='y', colors=p3.get_color(), **tkw)
-host.tick_params(axis='x', **tkw)
-
-lines = [p1, p2, p3]
-
-host.legend(lines, [l.get_label() for l in lines])
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/nan_test.html b/examples/pylab_examples/nan_test.html deleted file mode 100644 index 1db2dece7d6..00000000000 --- a/examples/pylab_examples/nan_test.html +++ /dev/null @@ -1,351 +0,0 @@ - - - - - - - - pylab_examples example code: nan_test.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: nan_test.py

-

(Source code, png, pdf)

-
-../../_images/nan_test.png -
-
"""
-Example: simple line plots with NaNs inserted.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-t = np.arange(0.0, 1.0 + 0.01, 0.01)
-s = np.cos(2 * 2 * np.pi * t)
-t[41:60] = np.nan
-
-plt.subplot(2, 1, 1)
-plt.plot(t, s, '-', lw=2)
-
-plt.xlabel('time (s)')
-plt.ylabel('voltage (mV)')
-plt.title('A sine wave with a gap of NaNs between 0.4 and 0.6')
-plt.grid(True)
-
-plt.subplot(2, 1, 2)
-t[0] = np.nan
-t[-1] = np.nan
-plt.plot(t, s, '-', lw=2)
-plt.title('Also with NaN in first and last point')
-
-plt.xlabel('time (s)')
-plt.ylabel('more nans')
-plt.grid(True)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/newscalarformatter_demo.html b/examples/pylab_examples/newscalarformatter_demo.html deleted file mode 100644 index 66dc07de27f..00000000000 --- a/examples/pylab_examples/newscalarformatter_demo.html +++ /dev/null @@ -1,438 +0,0 @@ - - - - - - - - pylab_examples example code: newscalarformatter_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: newscalarformatter_demo.py

-

(Source code)

-
-../../_images/newscalarformatter_demo_00.png -

(png, pdf)

-
-
-../../_images/newscalarformatter_demo_01.png -

(png, pdf)

-
-
-../../_images/newscalarformatter_demo_02.png -

(png, pdf)

-
-
-../../_images/newscalarformatter_demo_03.png -

(png, pdf)

-
-
import matplotlib.pyplot as plt
-import numpy as np
-from matplotlib.ticker import OldScalarFormatter, ScalarFormatter
-
-# Example 1
-x = np.arange(0, 1, .01)
-fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6))
-fig.text(0.5, 0.975, 'The old formatter',
-         horizontalalignment='center', verticalalignment='top')
-ax1.plot(x * 1e5 + 1e10, x * 1e-10 + 1e-5)
-ax1.xaxis.set_major_formatter(OldScalarFormatter())
-ax1.yaxis.set_major_formatter(OldScalarFormatter())
-
-ax2.plot(x * 1e5, x * 1e-4)
-ax2.xaxis.set_major_formatter(OldScalarFormatter())
-ax2.yaxis.set_major_formatter(OldScalarFormatter())
-
-ax3.plot(-x * 1e5 - 1e10, -x * 1e-5 - 1e-10)
-ax3.xaxis.set_major_formatter(OldScalarFormatter())
-ax3.yaxis.set_major_formatter(OldScalarFormatter())
-
-ax4.plot(-x * 1e5, -x * 1e-4)
-ax4.xaxis.set_major_formatter(OldScalarFormatter())
-ax4.yaxis.set_major_formatter(OldScalarFormatter())
-
-fig.subplots_adjust(wspace=0.7, hspace=0.6)
-
-# Example 2
-x = np.arange(0, 1, .01)
-fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6))
-fig.text(0.5, 0.975, 'The new formatter, default settings',
-         horizontalalignment='center',
-         verticalalignment='top')
-
-ax1.plot(x * 1e5 + 1e10, x * 1e-10 + 1e-5)
-ax1.xaxis.set_major_formatter(ScalarFormatter())
-ax1.yaxis.set_major_formatter(ScalarFormatter())
-
-ax2.plot(x * 1e5, x * 1e-4)
-ax2.xaxis.set_major_formatter(ScalarFormatter())
-ax2.yaxis.set_major_formatter(ScalarFormatter())
-
-ax3.plot(-x * 1e5 - 1e10, -x * 1e-5 - 1e-10)
-ax3.xaxis.set_major_formatter(ScalarFormatter())
-ax3.yaxis.set_major_formatter(ScalarFormatter())
-
-ax4.plot(-x * 1e5, -x * 1e-4)
-ax4.xaxis.set_major_formatter(ScalarFormatter())
-ax4.yaxis.set_major_formatter(ScalarFormatter())
-
-fig.subplots_adjust(wspace=0.7, hspace=0.6)
-
-# Example 3
-x = np.arange(0, 1, .01)
-fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6))
-fig.text(0.5, 0.975, 'The new formatter, no numerical offset',
-         horizontalalignment='center',
-         verticalalignment='top')
-
-ax1.plot(x * 1e5 + 1e10, x * 1e-10 + 1e-5)
-ax1.xaxis.set_major_formatter(ScalarFormatter(useOffset=False))
-ax1.yaxis.set_major_formatter(ScalarFormatter(useOffset=False))
-
-ax2.plot(x * 1e5, x * 1e-4)
-ax2.xaxis.set_major_formatter(ScalarFormatter(useOffset=False))
-ax2.yaxis.set_major_formatter(ScalarFormatter(useOffset=False))
-
-ax3.plot(-x * 1e5 - 1e10, -x * 1e-5 - 1e-10)
-ax3.xaxis.set_major_formatter(ScalarFormatter(useOffset=False))
-ax3.yaxis.set_major_formatter(ScalarFormatter(useOffset=False))
-
-ax4.plot(-x * 1e5, -x * 1e-4)
-ax4.xaxis.set_major_formatter(ScalarFormatter(useOffset=False))
-ax4.yaxis.set_major_formatter(ScalarFormatter(useOffset=False))
-
-fig.subplots_adjust(wspace=0.7, hspace=0.6)
-
-# Example 4
-x = np.arange(0, 1, .01)
-fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6))
-fig.text(0.5, 0.975, 'The new formatter, with mathtext',
-         horizontalalignment='center',
-         verticalalignment='top')
-
-ax1.plot(x * 1e5 + 1e10, x * 1e-10 + 1e-5)
-ax1.xaxis.set_major_formatter(ScalarFormatter(useMathText=True))
-ax1.yaxis.set_major_formatter(ScalarFormatter(useMathText=True))
-
-ax2.plot(x * 1e5, x * 1e-4)
-ax2.xaxis.set_major_formatter(ScalarFormatter(useMathText=True))
-ax2.yaxis.set_major_formatter(ScalarFormatter(useMathText=True))
-
-ax3.plot(-x * 1e5 - 1e10, -x * 1e-5 - 1e-10)
-ax3.xaxis.set_major_formatter(ScalarFormatter(useMathText=True))
-ax3.yaxis.set_major_formatter(ScalarFormatter(useMathText=True))
-
-ax4.plot(-x * 1e5, -x * 1e-4)
-ax4.xaxis.set_major_formatter(ScalarFormatter(useMathText=True))
-ax4.yaxis.set_major_formatter(ScalarFormatter(useMathText=True))
-
-fig.subplots_adjust(wspace=0.7, hspace=0.6)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/patheffect_demo.html b/examples/pylab_examples/patheffect_demo.html deleted file mode 100644 index fbacbfa3f24..00000000000 --- a/examples/pylab_examples/patheffect_demo.html +++ /dev/null @@ -1,365 +0,0 @@ - - - - - - - - pylab_examples example code: patheffect_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: patheffect_demo.py

-

(Source code, png, pdf)

-
-../../_images/patheffect_demo1.png -
-
import matplotlib.pyplot as plt
-import matplotlib.patheffects as PathEffects
-import numpy as np
-
-if 1:
-    plt.figure(1, figsize=(8, 3))
-    ax1 = plt.subplot(131)
-    ax1.imshow([[1, 2], [2, 3]])
-    txt = ax1.annotate("test", (1., 1.), (0., 0),
-                       arrowprops=dict(arrowstyle="->",
-                                       connectionstyle="angle3", lw=2),
-                       size=20, ha="center", path_effects=[PathEffects.withStroke(linewidth=3,
-                                                                                  foreground="w")])
-    txt.arrow_patch.set_path_effects([
-        PathEffects.Stroke(linewidth=5, foreground="w"),
-        PathEffects.Normal()])
-
-    ax1.grid(True, linestyle="-")
-
-    pe = [PathEffects.withStroke(linewidth=3,
-                                 foreground="w")]
-    for l in ax1.get_xgridlines() + ax1.get_ygridlines():
-        l.set_path_effects(pe)
-
-    ax2 = plt.subplot(132)
-    arr = np.arange(25).reshape((5, 5))
-    ax2.imshow(arr)
-    cntr = ax2.contour(arr, colors="k")
-
-    plt.setp(cntr.collections, path_effects=[
-        PathEffects.withStroke(linewidth=3, foreground="w")])
-
-    clbls = ax2.clabel(cntr, fmt="%2.0f", use_clabeltext=True)
-    plt.setp(clbls, path_effects=[
-        PathEffects.withStroke(linewidth=3, foreground="w")])
-
-    # shadow as a path effect
-    ax3 = plt.subplot(133)
-    p1, = ax3.plot([0, 1], [0, 1])
-    leg = ax3.legend([p1], ["Line 1"], fancybox=True, loc=2)
-    leg.legendPatch.set_path_effects([PathEffects.withSimplePatchShadow()])
-
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/pcolor_demo.html b/examples/pylab_examples/pcolor_demo.html deleted file mode 100644 index 32444d6b4e7..00000000000 --- a/examples/pylab_examples/pcolor_demo.html +++ /dev/null @@ -1,375 +0,0 @@ - - - - - - - - pylab_examples example code: pcolor_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: pcolor_demo.py

-

(Source code, png, pdf)

-
-../../_images/pcolor_demo.png -
-
"""
-Demonstrates similarities between pcolor, pcolormesh, imshow and pcolorfast
-for drawing quadrilateral grids.
-
-"""
-import matplotlib.pyplot as plt
-import numpy as np
-
-# make these smaller to increase the resolution
-dx, dy = 0.15, 0.05
-
-# generate 2 2d grids for the x & y bounds
-y, x = np.mgrid[slice(-3, 3 + dy, dy),
-                slice(-3, 3 + dx, dx)]
-z = (1 - x / 2. + x ** 5 + y ** 3) * np.exp(-x ** 2 - y ** 2)
-# x and y are bounds, so z should be the value *inside* those bounds.
-# Therefore, remove the last value from the z array.
-z = z[:-1, :-1]
-z_min, z_max = -np.abs(z).max(), np.abs(z).max()
-
-
-plt.subplot(2, 2, 1)
-plt.pcolor(x, y, z, cmap='RdBu', vmin=z_min, vmax=z_max)
-plt.title('pcolor')
-# set the limits of the plot to the limits of the data
-plt.axis([x.min(), x.max(), y.min(), y.max()])
-plt.colorbar()
-
-
-plt.subplot(2, 2, 2)
-plt.pcolormesh(x, y, z, cmap='RdBu', vmin=z_min, vmax=z_max)
-plt.title('pcolormesh')
-# set the limits of the plot to the limits of the data
-plt.axis([x.min(), x.max(), y.min(), y.max()])
-plt.colorbar()
-
-
-plt.subplot(2, 2, 3)
-plt.imshow(z, cmap='RdBu', vmin=z_min, vmax=z_max,
-           extent=[x.min(), x.max(), y.min(), y.max()],
-           interpolation='nearest', origin='lower')
-plt.title('image (nearest)')
-plt.colorbar()
-
-
-ax = plt.subplot(2, 2, 4)
-ax.pcolorfast(x, y, z, cmap='RdBu', vmin=z_min, vmax=z_max)
-plt.title('pcolorfast')
-plt.colorbar()
-
-plt.subplots_adjust(wspace=0.5, hspace=0.5)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/pcolor_log.html b/examples/pylab_examples/pcolor_log.html deleted file mode 100644 index 3e3be4c36e6..00000000000 --- a/examples/pylab_examples/pcolor_log.html +++ /dev/null @@ -1,346 +0,0 @@ - - - - - - - - pylab_examples example code: pcolor_log.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: pcolor_log.py

-

(Source code, png, pdf)

-
-../../_images/pcolor_log.png -
-
import matplotlib.pyplot as plt
-from matplotlib.colors import LogNorm
-import numpy as np
-from matplotlib.mlab import bivariate_normal
-
-
-N = 100
-X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)]
-
-# A low hump with a spike coming out of the top right.
-# Needs to have z/colour axis on a log scale so we see both hump and spike.
-# linear scale only shows the spike.
-Z1 = bivariate_normal(X, Y, 0.1, 0.2, 1.0, 1.0) + 0.1 * bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
-
-plt.subplot(2, 1, 1)
-plt.pcolor(X, Y, Z1, norm=LogNorm(vmin=Z1.min(), vmax=Z1.max()), cmap='PuBu_r')
-plt.colorbar()
-
-plt.subplot(2, 1, 2)
-plt.pcolor(X, Y, Z1, cmap='PuBu_r')
-plt.colorbar()
-
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/pcolor_small.html b/examples/pylab_examples/pcolor_small.html deleted file mode 100644 index 6ba7cbda654..00000000000 --- a/examples/pylab_examples/pcolor_small.html +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - - - pylab_examples example code: pcolor_small.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: pcolor_small.py

-

(Source code, png, pdf)

-
-../../_images/pcolor_small.png -
-
import matplotlib.pyplot as plt
-from numpy.random import rand
-
-Z = rand(6, 10)
-
-plt.subplot(2, 1, 1)
-c = plt.pcolor(Z)
-plt.title('default: no edges')
-
-plt.subplot(2, 1, 2)
-c = plt.pcolor(Z, edgecolors='k', linewidths=4)
-plt.title('thick edges')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/pie_demo2.html b/examples/pylab_examples/pie_demo2.html deleted file mode 100644 index 11899ef6c8b..00000000000 --- a/examples/pylab_examples/pie_demo2.html +++ /dev/null @@ -1,379 +0,0 @@ - - - - - - - - pylab_examples example code: pie_demo2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: pie_demo2.py

-

(Source code, png, pdf)

-
-../../_images/pie_demo2.png -
-
"""
-Make a pie charts of varying size - see
-http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.pie for the docstring.
-
-This example shows a basic pie charts with labels optional features,
-like autolabeling the percentage, offsetting a slice with "explode"
-and adding a shadow, in different sizes.
-
-"""
-import matplotlib.pyplot as plt
-from matplotlib.gridspec import GridSpec
-
-# Some data
-
-labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
-fracs = [15, 30, 45, 10]
-
-explode = (0, 0.05, 0, 0)
-
-# Make square figures and axes
-
-the_grid = GridSpec(2, 2)
-
-plt.subplot(the_grid[0, 0], aspect=1)
-
-plt.pie(fracs, labels=labels, autopct='%1.1f%%', shadow=True)
-
-plt.subplot(the_grid[0, 1], aspect=1)
-
-plt.pie(fracs, explode=explode, labels=labels, autopct='%.0f%%', shadow=True)
-
-plt.subplot(the_grid[1, 0], aspect=1)
-
-patches, texts, autotexts = plt.pie(fracs, labels=labels,
-                                    autopct='%.0f%%',
-                                    shadow=True, radius=0.5)
-
-# Make the labels on the small plot easier to read.
-for t in texts:
-    t.set_size('smaller')
-for t in autotexts:
-    t.set_size('x-small')
-autotexts[0].set_color('y')
-
-plt.subplot(the_grid[1, 1], aspect=1)
-
-# Turn off shadow for tiny plot with exploded slice.
-patches, texts, autotexts = plt.pie(fracs, explode=explode,
-                                    labels=labels, autopct='%.0f%%',
-                                    shadow=False, radius=0.5)
-for t in texts:
-    t.set_size('smaller')
-for t in autotexts:
-    t.set_size('x-small')
-autotexts[0].set_color('y')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/plotfile_demo.html b/examples/pylab_examples/plotfile_demo.html deleted file mode 100644 index 4c39911aa65..00000000000 --- a/examples/pylab_examples/plotfile_demo.html +++ /dev/null @@ -1,390 +0,0 @@ - - - - - - - - pylab_examples example code: plotfile_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: plotfile_demo.py

-

(Source code)

-
-../../_images/plotfile_demo_00.png -

(png, pdf)

-
-
-../../_images/plotfile_demo_01.png -

(png, pdf)

-
-
-../../_images/plotfile_demo_02.png -

(png, pdf)

-
-
-../../_images/plotfile_demo_03.png -

(png, pdf)

-
-
-../../_images/plotfile_demo_04.png -

(png, pdf)

-
-
-../../_images/plotfile_demo_05.png -

(png, pdf)

-
-
-../../_images/plotfile_demo_06.png -

(png, pdf)

-
-
-../../_images/plotfile_demo_07.png -

(png, pdf)

-
-
import matplotlib.pyplot as plt
-import numpy as np
-
-import matplotlib.cbook as cbook
-
-fname = cbook.get_sample_data('msft.csv', asfileobj=False)
-fname2 = cbook.get_sample_data('data_x_x2_x3.csv', asfileobj=False)
-
-# test 1; use ints
-plt.plotfile(fname, (0, 5, 6))
-
-# test 2; use names
-plt.plotfile(fname, ('date', 'volume', 'adj_close'))
-
-# test 3; use semilogy for volume
-plt.plotfile(fname, ('date', 'volume', 'adj_close'),
-             plotfuncs={'volume': 'semilogy'})
-
-# test 4; use semilogy for volume
-plt.plotfile(fname, (0, 5, 6), plotfuncs={5: 'semilogy'})
-
-# test 5; single subplot
-plt.plotfile(fname, ('date', 'open', 'high', 'low', 'close'), subplots=False)
-
-# test 6; labeling, if no names in csv-file
-plt.plotfile(fname2, cols=(0, 1, 2), delimiter=' ',
-             names=['$x$', '$f(x)=x^2$', '$f(x)=x^3$'])
-
-# test 7; more than one file per figure--illustrated here with a single file
-plt.plotfile(fname2, cols=(0, 1), delimiter=' ')
-plt.plotfile(fname2, cols=(0, 2), newfig=False,
-             delimiter=' ')  # use current figure
-plt.xlabel(r'$x$')
-plt.ylabel(r'$f(x) = x^2, x^3$')
-
-# test 8; use bar for volume
-plt.plotfile(fname, (0, 5, 6), plotfuncs={5: 'bar'})
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/polar_demo.html b/examples/pylab_examples/polar_demo.html deleted file mode 100644 index b72387abab7..00000000000 --- a/examples/pylab_examples/polar_demo.html +++ /dev/null @@ -1,341 +0,0 @@ - - - - - - - - pylab_examples example code: polar_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: polar_demo.py

-

(Source code, png, pdf)

-
-../../_images/polar_demo1.png -
-
"""
-Demo of a line plot on a polar axis.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-r = np.arange(0, 2, 0.01)
-theta = 2 * np.pi * r
-
-ax = plt.subplot(111, projection='polar')
-ax.plot(theta, r)
-ax.set_rmax(2)
-ax.set_rticks([0.5, 1, 1.5, 2])  # less radial ticks
-ax.set_rlabel_position(-22.5)  # get radial labels away from plotted line
-ax.grid(True)
-
-ax.set_title("A line plot on a polar axis", va='bottom')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/polar_legend.html b/examples/pylab_examples/polar_legend.html deleted file mode 100644 index 50cc3a130bb..00000000000 --- a/examples/pylab_examples/polar_legend.html +++ /dev/null @@ -1,342 +0,0 @@ - - - - - - - - pylab_examples example code: polar_legend.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: polar_legend.py

-

(Source code, png, pdf)

-
-../../_images/polar_legend.png -
-
import numpy as np
-from matplotlib.pyplot import figure, show, rc
-
-# radar green, solid grid lines
-rc('grid', color='#316931', linewidth=1, linestyle='-')
-rc('xtick', labelsize=15)
-rc('ytick', labelsize=15)
-
-# force square figure and square axes looks better for polar, IMO
-fig = figure(figsize=(8, 8))
-ax = fig.add_axes([0.1, 0.1, 0.8, 0.8],
-                  projection='polar', facecolor='#d5de9c')
-
-r = np.arange(0, 3.0, 0.01)
-theta = 2*np.pi*r
-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()
-
-show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/print_stdout.html b/examples/pylab_examples/print_stdout.html deleted file mode 100644 index 722955948d2..00000000000 --- a/examples/pylab_examples/print_stdout.html +++ /dev/null @@ -1,334 +0,0 @@ - - - - - - - - pylab_examples example code: print_stdout.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: print_stdout.py

-

[source code]

-
# -*- noplot -*-
-# print png to standard out
-# usage: python print_stdout.py > somefile.png
-
-import sys
-import matplotlib
-matplotlib.use('Agg')
-import matplotlib.pyplot as plt
-
-plt.plot([1, 2, 3])
-
-if sys.version_info[0] >= 3:
-    plt.savefig(sys.stdout.buffer)
-else:
-    plt.savefig(sys.stdout)
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/print_stdout.py b/examples/pylab_examples/print_stdout.py deleted file mode 100644 index d08205f4508..00000000000 --- a/examples/pylab_examples/print_stdout.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- noplot -*- -# print png to standard out -# usage: python print_stdout.py > somefile.png - -import sys -import matplotlib -matplotlib.use('Agg') -import matplotlib.pyplot as plt - -plt.plot([1, 2, 3]) - -if sys.version_info[0] >= 3: - plt.savefig(sys.stdout.buffer) -else: - plt.savefig(sys.stdout) diff --git a/examples/pylab_examples/psd_demo.html b/examples/pylab_examples/psd_demo.html deleted file mode 100644 index f178dce350e..00000000000 --- a/examples/pylab_examples/psd_demo.html +++ /dev/null @@ -1,357 +0,0 @@ - - - - - - - - pylab_examples example code: psd_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: psd_demo.py

-

(Source code, png, pdf)

-
-../../_images/psd_demo_00_001.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-
-dt = 0.01
-t = np.arange(0, 10, dt)
-nse = np.random.randn(len(t))
-r = np.exp(-t/0.05)
-
-cnse = np.convolve(nse, r)*dt
-cnse = cnse[:len(t)]
-s = 0.1*np.sin(2*np.pi*t) + cnse
-
-plt.subplot(211)
-plt.plot(t, s)
-plt.subplot(212)
-plt.psd(s, 512, 1/dt)
-
-plt.show()
-
-"""
-% compare with MATLAB
-dt = 0.01;
-t = [0:dt:10];
-nse = randn(size(t));
-r = exp(-t/0.05);
-cnse = conv(nse, r)*dt;
-cnse = cnse(1:length(t));
-s = 0.1*sin(2*pi*t) + cnse;
-
-subplot(211)
-plot(t,s)
-subplot(212)
-psd(s, 512, 1/dt)
-
-"""
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/psd_demo2.html b/examples/pylab_examples/psd_demo2.html deleted file mode 100644 index f446647f463..00000000000 --- a/examples/pylab_examples/psd_demo2.html +++ /dev/null @@ -1,364 +0,0 @@ - - - - - - - - pylab_examples example code: psd_demo2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: psd_demo2.py

-

(Source code, png, pdf)

-
-../../_images/psd_demo2.png -
-
# This example shows the effects of some of the different PSD parameters
-import numpy as np
-import matplotlib.pyplot as plt
-
-dt = np.pi / 100.
-fs = 1. / dt
-t = np.arange(0, 8, dt)
-y = 10. * np.sin(2 * np.pi * 4 * t) + 5. * np.sin(2 * np.pi * 4.25 * t)
-y = y + np.random.randn(*t.shape)
-
-# Plot the raw time series
-fig = plt.figure()
-fig.subplots_adjust(hspace=0.45, wspace=0.3)
-ax = fig.add_subplot(2, 1, 1)
-ax.plot(t, y)
-
-# Plot the PSD with different amounts of zero padding. This uses the entire
-# time series at once
-ax2 = fig.add_subplot(2, 3, 4)
-ax2.psd(y, NFFT=len(t), pad_to=len(t), Fs=fs)
-ax2.psd(y, NFFT=len(t), pad_to=len(t)*2, Fs=fs)
-ax2.psd(y, NFFT=len(t), pad_to=len(t)*4, Fs=fs)
-plt.title('zero padding')
-
-# Plot the PSD with different block sizes, Zero pad to the length of the
-# original data sequence.
-ax3 = fig.add_subplot(2, 3, 5, sharex=ax2, sharey=ax2)
-ax3.psd(y, NFFT=len(t), pad_to=len(t), Fs=fs)
-ax3.psd(y, NFFT=len(t)//2, pad_to=len(t), Fs=fs)
-ax3.psd(y, NFFT=len(t)//4, pad_to=len(t), Fs=fs)
-ax3.set_ylabel('')
-plt.title('block size')
-
-# Plot the PSD with different amounts of overlap between blocks
-ax4 = fig.add_subplot(2, 3, 6, sharex=ax2, sharey=ax2)
-ax4.psd(y, NFFT=len(t)//2, pad_to=len(t), noverlap=0, Fs=fs)
-ax4.psd(y, NFFT=len(t)//2, pad_to=len(t), noverlap=int(0.05*len(t)/2.), Fs=fs)
-ax4.psd(y, NFFT=len(t)//2, pad_to=len(t), noverlap=int(0.2*len(t)/2.), Fs=fs)
-ax4.set_ylabel('')
-plt.title('overlap')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/psd_demo3.html b/examples/pylab_examples/psd_demo3.html deleted file mode 100644 index 0c555831238..00000000000 --- a/examples/pylab_examples/psd_demo3.html +++ /dev/null @@ -1,365 +0,0 @@ - - - - - - - - pylab_examples example code: psd_demo3.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: psd_demo3.py

-

(Source code, png, pdf)

-
-../../_images/psd_demo3.png -
-
"""This is a ported version of a MATLAB example from the signal
-processing toolbox that showed some difference at one time between
-Matplotlib's and MATLAB's scaling of the PSD.
-
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.mlab as mlab
-
-prng = np.random.RandomState(123456)  # to ensure reproducibility
-
-fs = 1000
-t = np.linspace(0, 0.3, 301)
-A = np.array([2, 8]).reshape(-1, 1)
-f = np.array([150, 140]).reshape(-1, 1)
-xn = (A * np.sin(2 * np.pi * f * t)).sum(axis=0) + 5 * prng.randn(*t.shape)
-
-fig, (ax0, ax1) = plt.subplots(ncols=2)
-
-fig.subplots_adjust(hspace=0.45, wspace=0.3)
-yticks = np.arange(-50, 30, 10)
-yrange = (yticks[0], yticks[-1])
-xticks = np.arange(0, 550, 100)
-
-ax0.psd(xn, NFFT=301, Fs=fs, window=mlab.window_none, pad_to=1024,
-        scale_by_freq=True)
-ax0.set_title('Periodogram')
-ax0.set_yticks(yticks)
-ax0.set_xticks(xticks)
-ax0.grid(True)
-ax0.set_ylim(yrange)
-
-ax1.psd(xn, NFFT=150, Fs=fs, window=mlab.window_none, pad_to=512, noverlap=75,
-        scale_by_freq=True)
-ax1.set_title('Welch')
-ax1.set_xticks(xticks)
-ax1.set_yticks(yticks)
-ax1.set_ylabel('')  # overwrite the y-label added by `psd`
-ax1.grid(True)
-ax1.set_ylim(yrange)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/psd_demo_complex.html b/examples/pylab_examples/psd_demo_complex.html deleted file mode 100644 index ae44ca51555..00000000000 --- a/examples/pylab_examples/psd_demo_complex.html +++ /dev/null @@ -1,368 +0,0 @@ - - - - - - - - pylab_examples example code: psd_demo_complex.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: psd_demo_complex.py

-

(Source code, png, pdf)

-
-../../_images/psd_demo_complex.png -
-
"""This is a ported version of a MATLAB example from the signal
-processing toolbox that showed some difference at one time between
-Matplotlib's and MATLAB's scaling of the PSD.
-
-This differs from psd_demo3.py in that this uses a complex signal,
-so we can see that complex PSD's work properly
-
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.mlab as mlab
-
-prng = np.random.RandomState(123456)  # to ensure reproducibility
-
-fs = 1000
-t = np.linspace(0, 0.3, 301)
-A = np.array([2, 8]).reshape(-1, 1)
-f = np.array([150, 140]).reshape(-1, 1)
-xn = (A * np.exp(2j * np.pi * f * t)).sum(axis=0) + 5 * prng.randn(*t.shape)
-
-fig, (ax0, ax1) = plt.subplots(ncols=2)
-
-fig.subplots_adjust(hspace=0.45, wspace=0.3)
-yticks = np.arange(-50, 30, 10)
-yrange = (yticks[0], yticks[-1])
-xticks = np.arange(-500, 550, 200)
-
-ax0.psd(xn, NFFT=301, Fs=fs, window=mlab.window_none, pad_to=1024,
-        scale_by_freq=True)
-ax0.set_title('Periodogram')
-ax0.set_yticks(yticks)
-ax0.set_xticks(xticks)
-ax0.grid(True)
-ax0.set_ylim(yrange)
-
-ax1.psd(xn, NFFT=150, Fs=fs, window=mlab.window_none, pad_to=512, noverlap=75,
-        scale_by_freq=True)
-ax1.set_title('Welch')
-ax1.set_xticks(xticks)
-ax1.set_yticks(yticks)
-ax1.set_ylabel('')  # overwrite the y-label added by `psd`
-ax1.grid(True)
-ax1.set_ylim(yrange)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/pstest.html b/examples/pylab_examples/pstest.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/pylab_examples/pstest.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/pylab_examples/pythonic_matplotlib.html b/examples/pylab_examples/pythonic_matplotlib.html deleted file mode 100644 index a556893dea1..00000000000 --- a/examples/pylab_examples/pythonic_matplotlib.html +++ /dev/null @@ -1,403 +0,0 @@ - - - - - - - - pylab_examples example code: pythonic_matplotlib.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: pythonic_matplotlib.py

-

(Source code, png, pdf)

-
-../../_images/pythonic_matplotlib.png -
-
"""
-Some people prefer to write more pythonic, object-oriented code
-rather than use the pyplot interface to matplotlib.  This example shows
-you how.
-
-Unless you are an application developer, I recommend using part of the
-pyplot interface, particularly the figure, close, subplot, axes, and
-show commands.  These hide a lot of complexity from you that you don't
-need to see in normal figure creation, like instantiating DPI
-instances, managing the bounding boxes of the figure elements,
-creating and realizing GUI windows and embedding figures in them.
-
-
-If you are an application developer and want to embed matplotlib in
-your application, follow the lead of examples/embedding_in_wx.py,
-examples/embedding_in_gtk.py or examples/embedding_in_tk.py.  In this
-case you will want to control the creation of all your figures,
-embedding them in application windows, etc.
-
-If you are a web application developer, you may want to use the
-example in webapp_demo.py, which shows how to use the backend agg
-figure canvas directly, with none of the globals (current figure,
-current axes) that are present in the pyplot interface.  Note that
-there is no reason why the pyplot interface won't work for web
-application developers, however.
-
-If you see an example in the examples dir written in pyplot interface,
-and you want to emulate that using the true python method calls, there
-is an easy mapping.  Many of those examples use 'set' to control
-figure properties.  Here's how to map those commands onto instance
-methods
-
-The syntax of set is
-
-  plt.setp(object or sequence, somestring, attribute)
-
-if called with an object, set calls
-
-  object.set_somestring(attribute)
-
-if called with a sequence, set does
-
-  for object in sequence:
-       object.set_somestring(attribute)
-
-So for your example, if a is your axes object, you can do
-
-  a.set_xticklabels([])
-  a.set_yticklabels([])
-  a.set_xticks([])
-  a.set_yticks([])
-"""
-
-
-from matplotlib.pyplot import figure, show
-from numpy import arange, sin, pi
-
-t = arange(0.0, 1.0, 0.01)
-
-fig = figure(1)
-
-ax1 = fig.add_subplot(211)
-ax1.plot(t, sin(2*pi*t))
-ax1.grid(True)
-ax1.set_ylim((-2, 2))
-ax1.set_ylabel('1 Hz')
-ax1.set_title('A sine wave or two')
-
-for label in ax1.get_xticklabels():
-    label.set_color('r')
-
-
-ax2 = fig.add_subplot(212)
-ax2.plot(t, sin(2*2*pi*t))
-ax2.grid(True)
-ax2.set_ylim((-2, 2))
-l = ax2.set_xlabel('Hi mom')
-l.set_color('g')
-l.set_fontsize('large')
-
-show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/quadmesh_demo.html b/examples/pylab_examples/quadmesh_demo.html deleted file mode 100644 index c461c3ee901..00000000000 --- a/examples/pylab_examples/quadmesh_demo.html +++ /dev/null @@ -1,364 +0,0 @@ - - - - - - - - pylab_examples example code: quadmesh_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: quadmesh_demo.py

-

(Source code, png, pdf)

-
-../../_images/quadmesh_demo.png -
-
"""
-pcolormesh uses a QuadMesh, a faster generalization of pcolor, but
-with some restrictions.
-
-This demo illustrates a bug in quadmesh with masked data.
-"""
-
-import numpy as np
-from matplotlib.pyplot import figure, show, savefig
-from matplotlib import cm, colors
-from numpy import ma
-
-n = 12
-x = np.linspace(-1.5, 1.5, n)
-y = np.linspace(-1.5, 1.5, n*2)
-X, Y = np.meshgrid(x, y)
-Qx = np.cos(Y) - np.cos(X)
-Qz = np.sin(Y) + np.sin(X)
-Qx = (Qx + 1.1)
-Z = np.sqrt(X**2 + Y**2)/5
-Z = (Z - Z.min()) / (Z.max() - Z.min())
-
-# The color array can include masked values:
-Zm = ma.masked_where(np.fabs(Qz) < 0.5*np.amax(Qz), Z)
-
-
-fig = figure()
-ax = fig.add_subplot(121)
-ax.pcolormesh(Qx, Qz, Z, shading='gouraud')
-ax.set_title('Without masked values')
-
-ax = fig.add_subplot(122)
-#  You can control the color of the masked region:
-# cmap = cm.RdBu
-# cmap.set_bad('y', 1.0)
-# ax.pcolormesh(Qx, Qz, Zm, cmap=cmap)
-#  Or use the default, which is transparent:
-col = ax.pcolormesh(Qx, Qz, Zm, shading='gouraud')
-ax.set_title('With masked values')
-
-
-show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/quiver_demo.html b/examples/pylab_examples/quiver_demo.html deleted file mode 100644 index 592492f5d48..00000000000 --- a/examples/pylab_examples/quiver_demo.html +++ /dev/null @@ -1,373 +0,0 @@ - - - - - - - - pylab_examples example code: quiver_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: quiver_demo.py

-

(Source code)

-
-../../_images/quiver_demo_00.png -

(png, pdf)

-
-
-../../_images/quiver_demo_01.png -

(png, pdf)

-
-
-../../_images/quiver_demo_02.png -

(png, pdf)

-
-
'''
-========================================================
-Demonstration of advanced quiver and quiverkey functions
-========================================================
-
-Known problem: the plot autoscaling does not take into account
-the arrows, so those on the boundaries are often out of the picture.
-This is *not* an easy problem to solve in a perfectly general way.
-The workaround is to manually expand the axes.
-'''
-import matplotlib.pyplot as plt
-import numpy as np
-from numpy import ma
-
-X, Y = np.meshgrid(np.arange(0, 2 * np.pi, .2), np.arange(0, 2 * np.pi, .2))
-U = np.cos(X)
-V = np.sin(Y)
-
-plt.figure()
-plt.title('Arrows scale with plot width, not view')
-Q = plt.quiver(X, Y, U, V, units='width')
-qk = plt.quiverkey(Q, 0.9, 0.9, 2, r'$2 \frac{m}{s}$', labelpos='E',
-                   coordinates='figure')
-
-plt.figure()
-plt.title("pivot='mid'; every third arrow; units='inches'")
-Q = plt.quiver(X[::3, ::3], Y[::3, ::3], U[::3, ::3], V[::3, ::3],
-               pivot='mid', units='inches')
-qk = plt.quiverkey(Q, 0.9, 0.9, 1, r'$1 \frac{m}{s}$', labelpos='E',
-                   coordinates='figure')
-plt.scatter(X[::3, ::3], Y[::3, ::3], color='r', s=5)
-
-plt.figure()
-plt.title("pivot='tip'; scales with x view")
-M = np.hypot(U, V)
-Q = plt.quiver(X, Y, U, V, M, units='x', pivot='tip', width=0.022,
-               scale=1 / 0.15)
-qk = plt.quiverkey(Q, 0.9, 0.9, 1, r'$1 \frac{m}{s}$', labelpos='E',
-                   coordinates='figure')
-plt.scatter(X, Y, color='k', s=5)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/quiver_simple_demo.html b/examples/pylab_examples/quiver_simple_demo.html deleted file mode 100644 index d88a9b456ae..00000000000 --- a/examples/pylab_examples/quiver_simple_demo.html +++ /dev/null @@ -1,340 +0,0 @@ - - - - - - - - pylab_examples example code: quiver_simple_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: quiver_simple_demo.py

-

(Source code, png, pdf)

-
-../../_images/quiver_simple_demo1.png -
-
'''
-==================================================
-A simple example of a quiver plot with a quiverkey
-==================================================
-'''
-import matplotlib.pyplot as plt
-import numpy as np
-
-X = np.arange(-10, 10, 1)
-Y = np.arange(-10, 10, 1)
-U, V = np.meshgrid(X, Y)
-
-fig, ax = plt.subplots()
-q = ax.quiver(X, Y, U, V)
-ax.quiverkey(q, X=0.3, Y=1.1, U=10,
-             label='Quiver key, length = 10', labelpos='E')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/scatter_custom_symbol.html b/examples/pylab_examples/scatter_custom_symbol.html deleted file mode 100644 index b909bc85513..00000000000 --- a/examples/pylab_examples/scatter_custom_symbol.html +++ /dev/null @@ -1,339 +0,0 @@ - - - - - - - - pylab_examples example code: scatter_custom_symbol.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: scatter_custom_symbol.py

-

(Source code, png, pdf)

-
-../../_images/scatter_custom_symbol.png -
-
import matplotlib.pyplot as plt
-from numpy import arange, pi, cos, sin
-from numpy.random import rand
-
-# unit area ellipse
-rx, ry = 3., 1.
-area = rx * ry * pi
-theta = arange(0, 2*pi + 0.01, 0.1)
-verts = list(zip(rx/area*cos(theta), ry/area*sin(theta)))
-
-x, y, s, c = rand(4, 30)
-s *= 10**2.
-
-fig, ax = plt.subplots()
-ax.scatter(x, y, s, c, marker=None, verts=verts)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/scatter_demo2.html b/examples/pylab_examples/scatter_demo2.html deleted file mode 100644 index 4856396b615..00000000000 --- a/examples/pylab_examples/scatter_demo2.html +++ /dev/null @@ -1,361 +0,0 @@ - - - - - - - - pylab_examples example code: scatter_demo2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: scatter_demo2.py

-

(Source code, png, pdf)

-
-../../_images/scatter_demo21.png -
-
"""
-Demo of scatter plot with varying marker colors and sizes.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.cbook as cbook
-
-# Load a numpy record array from yahoo csv data with fields date,
-# open, close, volume, adj_close from the mpl-data/example directory.
-# The record array stores python datetime.date as an object array in
-# the date column
-datafile = cbook.get_sample_data('goog.npy')
-try:
-    # Python3 cannot load python2 .npy files with datetime(object) arrays
-    # unless the encoding is set to bytes. However this option was
-    # not added until numpy 1.10 so this example will only work with
-    # python 2 or with numpy 1.10 and later
-    price_data = np.load(datafile, encoding='bytes').view(np.recarray)
-except TypeError:
-    price_data = np.load(datafile).view(np.recarray)
-price_data = price_data[-250:]  # get the most recent 250 trading days
-
-delta1 = np.diff(price_data.adj_close)/price_data.adj_close[:-1]
-
-# Marker size in units of points^2
-volume = (15 * price_data.volume[:-2] / price_data.volume[0])**2
-close = 0.003 * price_data.close[:-2] / 0.003 * price_data.open[:-2]
-
-fig, ax = plt.subplots()
-ax.scatter(delta1[:-1], delta1[1:], c=close, s=volume, alpha=0.5)
-
-ax.set_xlabel(r'$\Delta_i$', fontsize=15)
-ax.set_ylabel(r'$\Delta_{i+1}$', fontsize=15)
-ax.set_title('Volume and percent change')
-
-ax.grid(True)
-fig.tight_layout()
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/scatter_hist.html b/examples/pylab_examples/scatter_hist.html deleted file mode 100644 index 72bb3cf33fc..00000000000 --- a/examples/pylab_examples/scatter_hist.html +++ /dev/null @@ -1,371 +0,0 @@ - - - - - - - - pylab_examples example code: scatter_hist.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: scatter_hist.py

-

(Source code, png, pdf)

-
-../../_images/scatter_hist2.png -
-
import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.ticker import NullFormatter
-
-# the random data
-x = np.random.randn(1000)
-y = np.random.randn(1000)
-
-nullfmt = NullFormatter()         # no labels
-
-# definitions for the axes
-left, width = 0.1, 0.65
-bottom, height = 0.1, 0.65
-bottom_h = left_h = left + width + 0.02
-
-rect_scatter = [left, bottom, width, height]
-rect_histx = [left, bottom_h, width, 0.2]
-rect_histy = [left_h, bottom, 0.2, height]
-
-# start with a rectangular Figure
-plt.figure(1, figsize=(8, 8))
-
-axScatter = plt.axes(rect_scatter)
-axHistx = plt.axes(rect_histx)
-axHisty = plt.axes(rect_histy)
-
-# no labels
-axHistx.xaxis.set_major_formatter(nullfmt)
-axHisty.yaxis.set_major_formatter(nullfmt)
-
-# the scatter plot:
-axScatter.scatter(x, y)
-
-# now determine nice limits by hand:
-binwidth = 0.25
-xymax = np.max([np.max(np.fabs(x)), np.max(np.fabs(y))])
-lim = (int(xymax/binwidth) + 1) * binwidth
-
-axScatter.set_xlim((-lim, lim))
-axScatter.set_ylim((-lim, lim))
-
-bins = np.arange(-lim, lim + binwidth, binwidth)
-axHistx.hist(x, bins=bins)
-axHisty.hist(y, bins=bins, orientation='horizontal')
-
-axHistx.set_xlim(axScatter.get_xlim())
-axHisty.set_ylim(axScatter.get_ylim())
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/scatter_masked.html b/examples/pylab_examples/scatter_masked.html deleted file mode 100644 index 0ca70bd3824..00000000000 --- a/examples/pylab_examples/scatter_masked.html +++ /dev/null @@ -1,341 +0,0 @@ - - - - - - - - pylab_examples example code: scatter_masked.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: scatter_masked.py

-

(Source code, png, pdf)

-
-../../_images/scatter_masked.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-
-N = 100
-r0 = 0.6
-x = 0.9*np.random.rand(N)
-y = 0.9*np.random.rand(N)
-area = np.pi*(10 * np.random.rand(N))**2  # 0 to 10 point radii
-c = np.sqrt(area)
-r = np.sqrt(x*x + y*y)
-area1 = np.ma.masked_where(r < r0, area)
-area2 = np.ma.masked_where(r >= r0, area)
-plt.scatter(x, y, s=area1, marker='^', c=c)
-plt.scatter(x, y, s=area2, marker='o', c=c)
-# Show the boundary between the regions:
-theta = np.arange(0, np.pi/2, 0.01)
-plt.plot(r0*np.cos(theta), r0*np.sin(theta))
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/scatter_profile.html b/examples/pylab_examples/scatter_profile.html deleted file mode 100644 index e8a082dc1c9..00000000000 --- a/examples/pylab_examples/scatter_profile.html +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - - - pylab_examples example code: scatter_profile.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: scatter_profile.py

-

(Source code, png, pdf)

-
-../../_images/scatter_profile.png -
-
"""
-N       Classic     Base renderer    Ext renderer
-20       0.22           0.14            0.14
-100      0.16           0.14            0.13
-1000     0.45           0.26            0.17
-10000    3.30           1.31            0.53
-50000    19.30          6.53            1.98
-"""
-from __future__ import print_function  # only needed for python 2.x
-import matplotlib.pyplot as plt
-import numpy as np
-
-import time
-
-for N in (20, 100, 1000, 10000, 50000):
-    tstart = time.time()
-    x = 0.9*np.random.rand(N)
-    y = 0.9*np.random.rand(N)
-    s = 20*np.random.rand(N)
-    plt.scatter(x, y, s)
-    print('%d symbols in %1.2f s' % (N, time.time() - tstart))
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/scatter_star_poly.html b/examples/pylab_examples/scatter_star_poly.html deleted file mode 100644 index dff9491a85e..00000000000 --- a/examples/pylab_examples/scatter_star_poly.html +++ /dev/null @@ -1,352 +0,0 @@ - - - - - - - - pylab_examples example code: scatter_star_poly.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: scatter_star_poly.py

-

(Source code, png, pdf)

-
-../../_images/scatter_star_poly.png -
-
import numpy as np
-import matplotlib.pyplot as plt
-
-
-x = np.random.rand(10)
-y = np.random.rand(10)
-z = np.sqrt(x**2 + y**2)
-
-plt.subplot(321)
-plt.scatter(x, y, s=80, c=z, marker=">")
-
-plt.subplot(322)
-plt.scatter(x, y, s=80, c=z, marker=(5, 0))
-
-verts = list(zip([-1., 1., 1., -1.], [-1., -1., 1., -1.]))
-plt.subplot(323)
-plt.scatter(x, y, s=80, c=z, marker=(verts, 0))
-# equivalent:
-#plt.scatter(x,y,s=80, c=z, marker=None, verts=verts)
-
-plt.subplot(324)
-plt.scatter(x, y, s=80, c=z, marker=(5, 1))
-
-plt.subplot(325)
-plt.scatter(x, y, s=80, c=z, marker='+')
-
-plt.subplot(326)
-plt.scatter(x, y, s=80, c=z, marker=(5, 2))
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/scatter_symbol.html b/examples/pylab_examples/scatter_symbol.html deleted file mode 100644 index 2771aabee27..00000000000 --- a/examples/pylab_examples/scatter_symbol.html +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - - - pylab_examples example code: scatter_symbol.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: scatter_symbol.py

-

(Source code, png, pdf)

-
-../../_images/scatter_symbol.png -
-
from matplotlib import pyplot as plt
-import numpy as np
-import matplotlib
-
-x = np.arange(0.0, 50.0, 2.0)
-y = x ** 1.3 + np.random.rand(*x.shape) * 30.0
-s = np.random.rand(*x.shape) * 800 + 500
-
-plt.scatter(x, y, s, c="g", alpha=0.5, marker=r'$\clubsuit$',
-            label="Luck")
-plt.xlabel("Leprechauns")
-plt.ylabel("Gold")
-plt.legend(loc=2)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/set_and_get.html b/examples/pylab_examples/set_and_get.html deleted file mode 100644 index 42fb831d631..00000000000 --- a/examples/pylab_examples/set_and_get.html +++ /dev/null @@ -1,421 +0,0 @@ - - - - - - - - pylab_examples example code: set_and_get.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: set_and_get.py

-

(Source code, png, pdf)

-
-../../_images/set_and_get.png -
-
"""
-
-The pyplot interface allows you to use setp and getp to set and get
-object properties, as well as to do introspection on the object
-
-set:
-    To set the linestyle of a line to be dashed, you can do
-
-      >>> line, = plt.plot([1,2,3])
-      >>> plt.setp(line, linestyle='--')
-
-    If you want to know the valid types of arguments, you can provide the
-    name of the property you want to set without a value
-
-      >>> plt.setp(line, 'linestyle')
-          linestyle: [ '-' | '--' | '-.' | ':' | 'steps' | 'None' ]
-
-    If you want to see all the properties that can be set, and their
-    possible values, you can do
-
-        >>> plt.setp(line)
-
-    set operates on a single instance or a list of instances.  If you are
-    in query mode introspecting the possible values, only the first
-    instance in the sequence is used.  When actually setting values, all
-    the instances will be set.  e.g., suppose you have a list of two lines,
-    the following will make both lines thicker and red
-
-        >>> x = np.arange(0,1.0,0.01)
-        >>> y1 = np.sin(2*np.pi*x)
-        >>> y2 = np.sin(4*np.pi*x)
-        >>> lines = plt.plot(x, y1, x, y2)
-        >>> plt.setp(lines, linewidth=2, color='r')
-
-
-get:
-
-    get returns the value of a given attribute.  You can use get to query
-    the value of a single attribute
-
-        >>> plt.getp(line, 'linewidth')
-            0.5
-
-    or all the attribute/value pairs
-
-    >>> plt.getp(line)
-        aa = True
-        alpha = 1.0
-        antialiased = True
-        c = b
-        clip_on = True
-        color = b
-        ... long listing skipped ...
-
-Aliases:
-
-  To reduce keystrokes in interactive mode, a number of properties
-  have short aliases, e.g., 'lw' for 'linewidth' and 'mec' for
-  'markeredgecolor'.  When calling set or get in introspection mode,
-  these properties will be listed as 'fullname or aliasname', as in
-
-
-
-
-"""
-
-from __future__ import print_function
-
-import matplotlib.pyplot as plt
-import numpy as np
-
-
-x = np.arange(0, 1.0, 0.01)
-y1 = np.sin(2*np.pi*x)
-y2 = np.sin(4*np.pi*x)
-lines = plt.plot(x, y1, x, y2)
-l1, l2 = lines
-plt.setp(lines, linestyle='--')       # set both to dashed
-plt.setp(l1, linewidth=2, color='r')  # line1 is thick and red
-plt.setp(l2, linewidth=1, color='g')  # line2 is thinner and green
-
-
-print('Line setters')
-plt.setp(l1)
-print('Line getters')
-plt.getp(l1)
-
-print('Rectangle setters')
-plt.setp(plt.gca().patch)
-print('Rectangle getters')
-plt.getp(plt.gca().patch)
-
-t = plt.title('Hi mom')
-print('Text setters')
-plt.setp(t)
-print('Text getters')
-plt.getp(t)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/shading_example.html b/examples/pylab_examples/shading_example.html deleted file mode 100644 index 879b3956965..00000000000 --- a/examples/pylab_examples/shading_example.html +++ /dev/null @@ -1,384 +0,0 @@ - - - - - - - - pylab_examples example code: shading_example.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: shading_example.py

-

(Source code)

-
-../../_images/shading_example_01_00.png -

(png, pdf)

-
-
-../../_images/shading_example_01_01.png -

(png, pdf)

-
-
import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.colors import LightSource
-from matplotlib.cbook import get_sample_data
-
-# Example showing how to make shaded relief plots
-# like Mathematica
-# (http://reference.wolfram.com/mathematica/ref/ReliefPlot.html)
-# or Generic Mapping Tools
-# (http://gmt.soest.hawaii.edu/gmt/doc/gmt/html/GMT_Docs/node145.html)
-
-
-def main():
-    # Test data
-    x, y = np.mgrid[-5:5:0.05, -5:5:0.05]
-    z = 5 * (np.sqrt(x**2 + y**2) + np.sin(x**2 + y**2))
-
-    filename = get_sample_data('jacksboro_fault_dem.npz', asfileobj=False)
-    with np.load(filename) as dem:
-        elev = dem['elevation']
-
-    fig = compare(z, plt.cm.copper)
-    fig.suptitle('HSV Blending Looks Best with Smooth Surfaces', y=0.95)
-
-    fig = compare(elev, plt.cm.gist_earth, ve=0.05)
-    fig.suptitle('Overlay Blending Looks Best with Rough Surfaces', y=0.95)
-
-    plt.show()
-
-
-def compare(z, cmap, ve=1):
-    # Create subplots and hide ticks
-    fig, axes = plt.subplots(ncols=2, nrows=2)
-    for ax in axes.flat:
-        ax.set(xticks=[], yticks=[])
-
-    # Illuminate the scene from the northwest
-    ls = LightSource(azdeg=315, altdeg=45)
-
-    axes[0, 0].imshow(z, cmap=cmap)
-    axes[0, 0].set(xlabel='Colormapped Data')
-
-    axes[0, 1].imshow(ls.hillshade(z, vert_exag=ve), cmap='gray')
-    axes[0, 1].set(xlabel='Illumination Intensity')
-
-    rgb = ls.shade(z, cmap=cmap, vert_exag=ve, blend_mode='hsv')
-    axes[1, 0].imshow(rgb)
-    axes[1, 0].set(xlabel='Blend Mode: "hsv" (default)')
-
-    rgb = ls.shade(z, cmap=cmap, vert_exag=ve, blend_mode='overlay')
-    axes[1, 1].imshow(rgb)
-    axes[1, 1].set(xlabel='Blend Mode: "overlay"')
-
-    return fig
-
-if __name__ == '__main__':
-    main()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/shared_axis_across_figures.html b/examples/pylab_examples/shared_axis_across_figures.html deleted file mode 100644 index bd3bc4dd498..00000000000 --- a/examples/pylab_examples/shared_axis_across_figures.html +++ /dev/null @@ -1,354 +0,0 @@ - - - - - - - - pylab_examples example code: shared_axis_across_figures.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: shared_axis_across_figures.py

-

(Source code)

-
-../../_images/shared_axis_across_figures_00.png -

(png, pdf)

-
-
-../../_images/shared_axis_across_figures_01.png -

(png, pdf)

-
-
"""
-connect the data limits on the axes in one figure with the axes in
-another.  This is not the right way to do this for two axes in the
-same figure -- use the sharex and sharey property in that case
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-fig1 = plt.figure()
-fig2 = plt.figure()
-
-ax1 = fig1.add_subplot(111)
-ax2 = fig2.add_subplot(111, sharex=ax1, sharey=ax1)
-
-ax1.plot(np.random.rand(100), 'o')
-ax2.plot(np.random.rand(100), 'o')
-
-# In the latest release, it is no longer necessary to do anything
-# special to share axes across figures:
-
-# ax1.sharex_foreign(ax2)
-# ax2.sharex_foreign(ax1)
-
-# ax1.sharey_foreign(ax2)
-# ax2.sharey_foreign(ax1)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/shared_axis_demo.html b/examples/pylab_examples/shared_axis_demo.html deleted file mode 100644 index dd8afc2d292..00000000000 --- a/examples/pylab_examples/shared_axis_demo.html +++ /dev/null @@ -1,375 +0,0 @@ - - - - - - - - pylab_examples example code: shared_axis_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: shared_axis_demo.py

-

(Source code, png, pdf)

-
-../../_images/shared_axis_demo.png -
-
"""
-You can share the x or y axis limits for one axis with another by
-passing an axes instance as a sharex or sharey kwarg.
-
-Changing the axis limits on one axes will be reflected automatically
-in the other, and vice-versa, so when you navigate with the toolbar
-the axes will follow each other on their shared axes.  Ditto for
-changes in the axis scaling (e.g., log vs linear).  However, it is
-possible to have differences in tick labeling, e.g., you can selectively
-turn off the tick labels on one axes.
-
-The example below shows how to customize the tick labels on the
-various axes.  Shared axes share the tick locator, tick formatter,
-view limits, and transformation (e.g., log, linear).  But the ticklabels
-themselves do not share properties.  This is a feature and not a bug,
-because you may want to make the tick labels smaller on the upper
-axes, e.g., in the example below.
-
-If you want to turn off the ticklabels for a given axes (e.g., on
-subplot(211) or subplot(212), you cannot do the standard trick
-
-   setp(ax2, xticklabels=[])
-
-because this changes the tick Formatter, which is shared among all
-axes.  But you can alter the visibility of the labels, which is a
-property
-
-  setp( ax2.get_xticklabels(), visible=False)
-
-"""
-import matplotlib.pyplot as plt
-import numpy as np
-
-t = np.arange(0.01, 5.0, 0.01)
-s1 = np.sin(2*np.pi*t)
-s2 = np.exp(-t)
-s3 = np.sin(4*np.pi*t)
-
-ax1 = plt.subplot(311)
-plt.plot(t, s1)
-plt.setp(ax1.get_xticklabels(), fontsize=6)
-
-# share x only
-ax2 = plt.subplot(312, sharex=ax1)
-plt.plot(t, s2)
-# make these tick labels invisible
-plt.setp(ax2.get_xticklabels(), visible=False)
-
-# share x and y
-ax3 = plt.subplot(313, sharex=ax1, sharey=ax1)
-plt.plot(t, s3)
-plt.xlim(0.01, 5.0)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/simple_plot.html b/examples/pylab_examples/simple_plot.html deleted file mode 100644 index 1fc3793dd50..00000000000 --- a/examples/pylab_examples/simple_plot.html +++ /dev/null @@ -1,335 +0,0 @@ - - - - - - - - pylab_examples example code: simple_plot.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: simple_plot.py

-

(Source code, png, pdf)

-
-../../_images/simple_plot1.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-
-t = np.arange(0.0, 2.0, 0.01)
-s = 1 + np.sin(2*np.pi*t)
-plt.plot(t, s)
-
-plt.xlabel('time (s)')
-plt.ylabel('voltage (mV)')
-plt.title('About as simple as it gets, folks')
-plt.grid(True)
-plt.savefig("test.png")
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/simple_plot_fps.html b/examples/pylab_examples/simple_plot_fps.html deleted file mode 100644 index b6c46a13b2c..00000000000 --- a/examples/pylab_examples/simple_plot_fps.html +++ /dev/null @@ -1,360 +0,0 @@ - - - - - - - - pylab_examples example code: simple_plot_fps.py — Matplotlib 1.5.1 documentation - - - - - - - - - - - - - - - - - - -
-

We're updating the default styles for Matplotlib 2.0

- -

Learn what to expect in the new updates

- -
- - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: simple_plot_fps.py

-

(Source code, png, hires.png, pdf)

-
-../../_images/simple_plot_fps.png -
-
"""
-Example: simple line plot.
-Show how to make and save a simple line plot with labels, title and grid
-"""
-from __future__ import print_function  # not necessary in Python 3.x
-import matplotlib.pyplot as plt
-import numpy as np
-import time
-
-
-plt.ion()
-
-t = np.arange(0.0, 1.0 + 0.001, 0.001)
-s = np.cos(2*2*np.pi*t)
-plt.plot(t, s, '-', lw=2)
-
-plt.xlabel('time (s)')
-plt.ylabel('voltage (mV)')
-plt.title('About as simple as it gets, folks')
-plt.grid(True)
-
-frames = 100.0
-t = time.time()
-c = time.clock()
-for i in range(int(frames)):
-    part = i / frames
-    plt.axis([0.0, 1.0 - part, -1.0 + part, 1.0 - part])
-wallclock = time.time() - t
-user = time.clock() - c
-print("wallclock:", wallclock)
-print("user:", user)
-print("fps:", frames / wallclock)
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/specgram_demo.html b/examples/pylab_examples/specgram_demo.html deleted file mode 100644 index 9c225ec2d36..00000000000 --- a/examples/pylab_examples/specgram_demo.html +++ /dev/null @@ -1,351 +0,0 @@ - - - - - - - - pylab_examples example code: specgram_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: specgram_demo.py

-

(Source code, png, pdf)

-
-../../_images/specgram_demo1.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-
-dt = 0.0005
-t = np.arange(0.0, 20.0, dt)
-s1 = np.sin(2*np.pi*100*t)
-s2 = 2*np.sin(2*np.pi*400*t)
-
-# create a transient "chirp"
-mask = np.where(np.logical_and(t > 10, t < 12), 1.0, 0.0)
-s2 = s2 * mask
-
-# add some noise into the mix
-nse = 0.01*np.random.random(size=len(t))
-
-x = s1 + s2 + nse  # the signal
-NFFT = 1024       # the length of the windowing segments
-Fs = int(1.0/dt)  # the sampling frequency
-
-# Pxx is the segments x freqs array of instantaneous power, freqs is
-# the frequency vector, bins are the centers of the time bins in which
-# the power is computed, and im is the matplotlib.image.AxesImage
-# instance
-
-ax1 = plt.subplot(211)
-plt.plot(t, x)
-plt.subplot(212, sharex=ax1)
-Pxx, freqs, bins, im = plt.specgram(x, NFFT=NFFT, Fs=Fs, noverlap=900)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/spectrum_demo.html b/examples/pylab_examples/spectrum_demo.html deleted file mode 100644 index 9affaddb605..00000000000 --- a/examples/pylab_examples/spectrum_demo.html +++ /dev/null @@ -1,354 +0,0 @@ - - - - - - - - pylab_examples example code: spectrum_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: spectrum_demo.py

-

(Source code, png, pdf)

-
-../../_images/spectrum_demo1.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-
-
-np.random.seed(0)
-
-dt = 0.01
-Fs = 1/dt
-t = np.arange(0, 10, dt)
-nse = np.random.randn(len(t))
-r = np.exp(-t/0.05)
-
-cnse = np.convolve(nse, r)*dt
-cnse = cnse[:len(t)]
-s = 0.1*np.sin(2*np.pi*t) + cnse
-
-plt.subplot(3, 2, 1)
-plt.plot(t, s)
-
-plt.subplot(3, 2, 3)
-plt.magnitude_spectrum(s, Fs=Fs)
-
-plt.subplot(3, 2, 4)
-plt.magnitude_spectrum(s, Fs=Fs, scale='dB')
-
-plt.subplot(3, 2, 5)
-plt.angle_spectrum(s, Fs=Fs)
-
-plt.subplot(3, 2, 6)
-plt.phase_spectrum(s, Fs=Fs)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/spine_placement_demo.html b/examples/pylab_examples/spine_placement_demo.html deleted file mode 100644 index bc3828804f1..00000000000 --- a/examples/pylab_examples/spine_placement_demo.html +++ /dev/null @@ -1,428 +0,0 @@ - - - - - - - - pylab_examples example code: spine_placement_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: spine_placement_demo.py

-

(Source code)

-
-../../_images/spine_placement_demo_00.png -

(png, pdf)

-
-
-../../_images/spine_placement_demo_01.png -

(png, pdf)

-
-
import numpy as np
-import matplotlib.pyplot as plt
-
-
-fig = plt.figure()
-x = np.linspace(-np.pi, np.pi, 100)
-y = 2*np.sin(x)
-
-ax = fig.add_subplot(2, 2, 1)
-ax.set_title('centered spines')
-ax.plot(x, y)
-ax.spines['left'].set_position('center')
-ax.spines['right'].set_color('none')
-ax.spines['bottom'].set_position('center')
-ax.spines['top'].set_color('none')
-ax.spines['left'].set_smart_bounds(True)
-ax.spines['bottom'].set_smart_bounds(True)
-ax.xaxis.set_ticks_position('bottom')
-ax.yaxis.set_ticks_position('left')
-
-ax = fig.add_subplot(2, 2, 2)
-ax.set_title('zeroed spines')
-ax.plot(x, y)
-ax.spines['left'].set_position('zero')
-ax.spines['right'].set_color('none')
-ax.spines['bottom'].set_position('zero')
-ax.spines['top'].set_color('none')
-ax.spines['left'].set_smart_bounds(True)
-ax.spines['bottom'].set_smart_bounds(True)
-ax.xaxis.set_ticks_position('bottom')
-ax.yaxis.set_ticks_position('left')
-
-ax = fig.add_subplot(2, 2, 3)
-ax.set_title('spines at axes (0.6, 0.1)')
-ax.plot(x, y)
-ax.spines['left'].set_position(('axes', 0.6))
-ax.spines['right'].set_color('none')
-ax.spines['bottom'].set_position(('axes', 0.1))
-ax.spines['top'].set_color('none')
-ax.spines['left'].set_smart_bounds(True)
-ax.spines['bottom'].set_smart_bounds(True)
-ax.xaxis.set_ticks_position('bottom')
-ax.yaxis.set_ticks_position('left')
-
-ax = fig.add_subplot(2, 2, 4)
-ax.set_title('spines at data (1, 2)')
-ax.plot(x, y)
-ax.spines['left'].set_position(('data', 1))
-ax.spines['right'].set_color('none')
-ax.spines['bottom'].set_position(('data', 2))
-ax.spines['top'].set_color('none')
-ax.spines['left'].set_smart_bounds(True)
-ax.spines['bottom'].set_smart_bounds(True)
-ax.xaxis.set_ticks_position('bottom')
-ax.yaxis.set_ticks_position('left')
-# ----------------------------------------------------
-
-
-def adjust_spines(ax, spines):
-    for loc, spine in ax.spines.items():
-        if loc in spines:
-            spine.set_position(('outward', 10))  # outward by 10 points
-            spine.set_smart_bounds(True)
-        else:
-            spine.set_color('none')  # don't draw spine
-
-    # turn off ticks where there is no spine
-    if 'left' in spines:
-        ax.yaxis.set_ticks_position('left')
-    else:
-        # no yaxis ticks
-        ax.yaxis.set_ticks([])
-
-    if 'bottom' in spines:
-        ax.xaxis.set_ticks_position('bottom')
-    else:
-        # no xaxis ticks
-        ax.xaxis.set_ticks([])
-
-fig = plt.figure()
-
-x = np.linspace(0, 2*np.pi, 100)
-y = 2*np.sin(x)
-
-ax = fig.add_subplot(2, 2, 1)
-ax.plot(x, y, clip_on=False)
-adjust_spines(ax, ['left'])
-
-ax = fig.add_subplot(2, 2, 2)
-ax.plot(x, y, clip_on=False)
-adjust_spines(ax, [])
-
-ax = fig.add_subplot(2, 2, 3)
-ax.plot(x, y, clip_on=False)
-adjust_spines(ax, ['left', 'bottom'])
-
-ax = fig.add_subplot(2, 2, 4)
-ax.plot(x, y, clip_on=False)
-adjust_spines(ax, ['bottom'])
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/spy_demos.html b/examples/pylab_examples/spy_demos.html deleted file mode 100644 index 703925fe6c2..00000000000 --- a/examples/pylab_examples/spy_demos.html +++ /dev/null @@ -1,346 +0,0 @@ - - - - - - - - pylab_examples example code: spy_demos.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: spy_demos.py

-

(Source code, png, pdf)

-
-../../_images/spy_demos.png -
-
"""
-Plot the sparsity pattern of arrays
-"""
-
-from matplotlib.pyplot import figure, show
-import numpy
-
-fig = figure()
-ax1 = fig.add_subplot(221)
-ax2 = fig.add_subplot(222)
-ax3 = fig.add_subplot(223)
-ax4 = fig.add_subplot(224)
-
-x = numpy.random.randn(20, 20)
-x[5] = 0.
-x[:, 12] = 0.
-
-ax1.spy(x, markersize=5)
-ax2.spy(x, precision=0.1, markersize=5)
-
-ax3.spy(x)
-ax4.spy(x, precision=0.1)
-
-show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/stackplot_demo.html b/examples/pylab_examples/stackplot_demo.html deleted file mode 100644 index d20a1f8979d..00000000000 --- a/examples/pylab_examples/stackplot_demo.html +++ /dev/null @@ -1,345 +0,0 @@ - - - - - - - - pylab_examples example code: stackplot_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: stackplot_demo.py

-

(Source code, png, pdf)

-
-../../_images/stackplot_demo_00_00.png -
-

(png, pdf)

-
-../../_images/stackplot_demo_01_00.png -
-
import numpy as np
-import matplotlib.pyplot as plt
-
-
-def fnx():
-    return np.random.randint(5, 50, 10)
-
-y = np.row_stack((fnx(), fnx(), fnx()))
-x = np.arange(10)
-
-y1, y2, y3 = fnx(), fnx(), fnx()
-
-fig, ax = plt.subplots()
-ax.stackplot(x, y)
-plt.show()
-
-fig, ax = plt.subplots()
-ax.stackplot(x, y1, y2, y3)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/stackplot_demo2.html b/examples/pylab_examples/stackplot_demo2.html deleted file mode 100644 index 4b7c9fe7964..00000000000 --- a/examples/pylab_examples/stackplot_demo2.html +++ /dev/null @@ -1,350 +0,0 @@ - - - - - - - - pylab_examples example code: stackplot_demo2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: stackplot_demo2.py

-

(Source code, png, pdf)

-
-../../_images/stackplot_demo21.png -
-
import numpy as np
-import matplotlib.pyplot as plt
-
-np.random.seed(0)
-
-
-def layers(n, m):
-    """
-    Return *n* random Gaussian mixtures, each of length *m*.
-    """
-    def bump(a):
-        x = 1 / (.1 + np.random.random())
-        y = 2 * np.random.random() - .5
-        z = 10 / (.1 + np.random.random())
-        for i in range(m):
-            w = (i / float(m) - y) * z
-            a[i] += x * np.exp(-w * w)
-    a = np.zeros((m, n))
-    for i in range(n):
-        for j in range(5):
-            bump(a[:, i])
-    return a
-
-d = layers(3, 100)
-
-plt.subplots()
-plt.stackplot(range(100), d.T, baseline='wiggle')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/stem_plot.html b/examples/pylab_examples/stem_plot.html deleted file mode 100644 index 3fa971c98e0..00000000000 --- a/examples/pylab_examples/stem_plot.html +++ /dev/null @@ -1,330 +0,0 @@ - - - - - - - - pylab_examples example code: stem_plot.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: stem_plot.py

-

(Source code, png, pdf)

-
-../../_images/stem_plot1.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-
-x = np.linspace(0.1, 2*np.pi, 10)
-markerline, stemlines, baseline = plt.stem(x, np.cos(x), '-.')
-plt.setp(baseline, 'color', 'r', 'linewidth', 2)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/step_demo.html b/examples/pylab_examples/step_demo.html deleted file mode 100644 index 0412333c513..00000000000 --- a/examples/pylab_examples/step_demo.html +++ /dev/null @@ -1,347 +0,0 @@ - - - - - - - - pylab_examples example code: step_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: step_demo.py

-

(Source code, png, pdf)

-
-../../_images/step_demo.png -
-
import numpy as np
-from numpy import ma
-import matplotlib.pyplot as plt
-
-x = np.arange(1, 7, 0.4)
-y0 = np.sin(x)
-y = y0.copy() + 2.5
-
-plt.step(x, y, label='pre (default)')
-
-y -= 0.5
-plt.step(x, y, where='mid', label='mid')
-
-y -= 0.5
-plt.step(x, y, where='post', label='post')
-
-y = ma.masked_where((y0 > -0.15) & (y0 < 0.15), y - 0.5)
-plt.step(x, y, label='masked (pre)')
-
-plt.legend()
-
-plt.xlim(0, 7)
-plt.ylim(-0.5, 4)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/stix_fonts_demo.html b/examples/pylab_examples/stix_fonts_demo.html deleted file mode 100644 index 8a0685e5ad1..00000000000 --- a/examples/pylab_examples/stix_fonts_demo.html +++ /dev/null @@ -1,381 +0,0 @@ - - - - - - - - pylab_examples example code: stix_fonts_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: stix_fonts_demo.py

-

(Source code)

-

(png, pdf)

-
-../../_images/stix_fonts_demo_01_00.png -
-
from __future__ import unicode_literals
-
-import os
-import sys
-import re
-import gc
-import matplotlib.pyplot as plt
-import numpy as np
-
-stests = [
-    r'$\mathcircled{123} \mathrm{\mathcircled{123}}'
-    r' \mathbf{\mathcircled{123}}$',
-    r'$\mathsf{Sans \Omega} \mathrm{\mathsf{Sans \Omega}}'
-    r' \mathbf{\mathsf{Sans \Omega}}$',
-    r'$\mathtt{Monospace}$',
-    r'$\mathcal{CALLIGRAPHIC}$',
-    r'$\mathbb{Blackboard \pi}$',
-    r'$\mathrm{\mathbb{Blackboard \pi}}$',
-    r'$\mathbf{\mathbb{Blackboard \pi}}$',
-    r'$\mathfrak{Fraktur} \mathbf{\mathfrak{Fraktur}}$',
-    r'$\mathscr{Script}$']
-
-if sys.maxunicode > 0xffff:
-    s = r'Direct Unicode: $\u23ce \mathrm{\ue0f2 \U0001D538}$'
-
-
-def doall():
-    tests = stests
-
-    plt.figure(figsize=(8, (len(tests) * 1) + 2))
-    plt.plot([0, 0], 'r')
-    plt.grid(False)
-    plt.axis([0, 3, -len(tests), 0])
-    plt.yticks(np.arange(len(tests)) * -1)
-    for i, s in enumerate(tests):
-        plt.text(0.1, -i, s, fontsize=32)
-
-    plt.savefig('stix_fonts_example')
-    plt.show()
-
-
-if '--latex' in sys.argv:
-    fd = open("stix_fonts_examples.ltx", "w")
-    fd.write("\\documentclass{article}\n")
-    fd.write("\\begin{document}\n")
-    fd.write("\\begin{enumerate}\n")
-
-    for i, s in enumerate(stests):
-        s = re.sub(r"(?<!\\)\$", "$$", s)
-        fd.write("\\item %s\n" % s)
-
-    fd.write("\\end{enumerate}\n")
-    fd.write("\\end{document}\n")
-    fd.close()
-
-    os.system("pdflatex stix_fonts_examples.ltx")
-else:
-    doall()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/stock_demo.html b/examples/pylab_examples/stock_demo.html deleted file mode 100644 index f9cae054653..00000000000 --- a/examples/pylab_examples/stock_demo.html +++ /dev/null @@ -1,345 +0,0 @@ - - - - - - - - pylab_examples example code: stock_demo.py — Matplotlib 1.5.3 documentation - - - - - - - - - - - - - - - - - - -
-

Matplotlib 2.0.0rc2 is available

- -

Install the release candidate now!

- -
- - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: stock_demo.py

-

(Source code, png, hires.png, pdf)

-
-../../_images/stock_demo.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-
-from matplotlib.ticker import MultipleLocator
-from data_helper import get_two_stock_data
-
-d1, p1, d2, p2 = get_two_stock_data()
-
-fig, ax = plt.subplots()
-lines = plt.plot(d1, p1, 'bs', d2, p2, 'go')
-plt.xlabel('Days')
-plt.ylabel('Normalized price')
-plt.xlim(0, 3)
-ax.xaxis.set_major_locator(MultipleLocator(1))
-
-plt.title('INTC vs AAPL')
-plt.legend(('INTC', 'AAPL'))
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/subplot_demo.html b/examples/pylab_examples/subplot_demo.html deleted file mode 100644 index f68c5008e6b..00000000000 --- a/examples/pylab_examples/subplot_demo.html +++ /dev/null @@ -1,346 +0,0 @@ - - - - - - - - pylab_examples example code: subplot_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: subplot_demo.py

-

(Source code, png, pdf)

-
-../../_images/subplot_demo2.png -
-
"""
-Simple demo with multiple subplots.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-x1 = np.linspace(0.0, 5.0)
-x2 = np.linspace(0.0, 2.0)
-
-y1 = np.cos(2 * np.pi * x1) * np.exp(-x1)
-y2 = np.cos(2 * np.pi * x2)
-
-plt.subplot(2, 1, 1)
-plt.plot(x1, y1, 'ko-')
-plt.title('A tale of 2 subplots')
-plt.ylabel('Damped oscillation')
-
-plt.subplot(2, 1, 2)
-plt.plot(x2, y2, 'r.-')
-plt.xlabel('time (s)')
-plt.ylabel('Undamped')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/subplot_toolbar.html b/examples/pylab_examples/subplot_toolbar.html deleted file mode 100644 index 8e84cb5ed0f..00000000000 --- a/examples/pylab_examples/subplot_toolbar.html +++ /dev/null @@ -1,342 +0,0 @@ - - - - - - - - pylab_examples example code: subplot_toolbar.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: subplot_toolbar.py

-

(Source code)

-
-../../_images/subplot_toolbar_00.png -

(png, pdf)

-
-
-../../_images/subplot_toolbar_01.png -

(png, pdf)

-
-
import matplotlib.pyplot as plt
-import numpy.random as rnd
-
-fig = plt.figure()
-plt.subplot(221)
-plt.imshow(rnd.random((100, 100)))
-plt.subplot(222)
-plt.imshow(rnd.random((100, 100)))
-plt.subplot(223)
-plt.imshow(rnd.random((100, 100)))
-plt.subplot(224)
-plt.imshow(rnd.random((100, 100)))
-
-plt.subplot_tool()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/subplots_adjust.html b/examples/pylab_examples/subplots_adjust.html deleted file mode 100644 index 205b3f6678f..00000000000 --- a/examples/pylab_examples/subplots_adjust.html +++ /dev/null @@ -1,334 +0,0 @@ - - - - - - - - pylab_examples example code: subplots_adjust.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: subplots_adjust.py

-

(Source code, png, pdf)

-
-../../_images/subplots_adjust.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-
-plt.subplot(211)
-plt.imshow(np.random.random((100, 100)), cmap=plt.cm.BuPu_r)
-plt.subplot(212)
-plt.imshow(np.random.random((100, 100)), cmap=plt.cm.BuPu_r)
-
-plt.subplots_adjust(bottom=0.1, right=0.8, top=0.9)
-cax = plt.axes([0.85, 0.1, 0.075, 0.8])
-plt.colorbar(cax=cax)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/subplots_demo.html b/examples/pylab_examples/subplots_demo.html deleted file mode 100644 index c6cf63f3e62..00000000000 --- a/examples/pylab_examples/subplots_demo.html +++ /dev/null @@ -1,428 +0,0 @@ - - - - - - - - pylab_examples example code: subplots_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: subplots_demo.py

-

(Source code)

-
-../../_images/subplots_demo_00.png -

(png, pdf)

-
-
-../../_images/subplots_demo_01.png -

(png, pdf)

-
-
-../../_images/subplots_demo_02.png -

(png, pdf)

-
-
-../../_images/subplots_demo_03.png -

(png, pdf)

-
-
-../../_images/subplots_demo_04.png -

(png, pdf)

-
-
-../../_images/subplots_demo_05.png -

(png, pdf)

-
-
-../../_images/subplots_demo_06.png -

(png, pdf)

-
-
"""Examples illustrating the use of plt.subplots().
-
-This function creates a figure and a grid of subplots with a single call, while
-providing reasonable control over how the individual plots are created.  For
-very refined tuning of subplot creation, you can still use add_subplot()
-directly on a new figure.
-"""
-
-import matplotlib.pyplot as plt
-import numpy as np
-
-# Simple data to display in various forms
-x = np.linspace(0, 2 * np.pi, 400)
-y = np.sin(x ** 2)
-
-plt.close('all')
-
-# Just a figure and one subplot
-f, ax = plt.subplots()
-ax.plot(x, y)
-ax.set_title('Simple plot')
-
-# Two subplots, the axes array is 1-d
-f, axarr = plt.subplots(2, sharex=True)
-axarr[0].plot(x, y)
-axarr[0].set_title('Sharing X axis')
-axarr[1].scatter(x, y)
-
-# Two subplots, unpack the axes array immediately
-f, (ax1, ax2) = plt.subplots(1, 2, sharey=True)
-ax1.plot(x, y)
-ax1.set_title('Sharing Y axis')
-ax2.scatter(x, y)
-
-# Three subplots sharing both x/y axes
-f, (ax1, ax2, ax3) = plt.subplots(3, sharex=True, sharey=True)
-ax1.plot(x, y)
-ax1.set_title('Sharing both axes')
-ax2.scatter(x, y)
-ax3.scatter(x, 2 * y ** 2 - 1, color='r')
-# Fine-tune figure; make subplots close to each other and hide x ticks for
-# all but bottom plot.
-f.subplots_adjust(hspace=0)
-plt.setp([a.get_xticklabels() for a in f.axes[:-1]], visible=False)
-
-# row and column sharing
-f, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, sharex='col', sharey='row')
-ax1.plot(x, y)
-ax1.set_title('Sharing x per column, y per row')
-ax2.scatter(x, y)
-ax3.scatter(x, 2 * y ** 2 - 1, color='r')
-ax4.plot(x, 2 * y ** 2 - 1, color='r')
-
-# Four axes, returned as a 2-d array
-f, axarr = plt.subplots(2, 2)
-axarr[0, 0].plot(x, y)
-axarr[0, 0].set_title('Axis [0,0]')
-axarr[0, 1].scatter(x, y)
-axarr[0, 1].set_title('Axis [0,1]')
-axarr[1, 0].plot(x, y ** 2)
-axarr[1, 0].set_title('Axis [1,0]')
-axarr[1, 1].scatter(x, y ** 2)
-axarr[1, 1].set_title('Axis [1,1]')
-# Fine-tune figure; hide x ticks for top plots and y ticks for right plots
-plt.setp([a.get_xticklabels() for a in axarr[0, :]], visible=False)
-plt.setp([a.get_yticklabels() for a in axarr[:, 1]], visible=False)
-
-# Four polar axes
-f, axarr = plt.subplots(2, 2, subplot_kw=dict(projection='polar'))
-axarr[0, 0].plot(x, y)
-axarr[0, 0].set_title('Axis [0,0]')
-axarr[0, 1].scatter(x, y)
-axarr[0, 1].set_title('Axis [0,1]')
-axarr[1, 0].plot(x, y ** 2)
-axarr[1, 0].set_title('Axis [1,0]')
-axarr[1, 1].scatter(x, y ** 2)
-axarr[1, 1].set_title('Axis [1,1]')
-# Fine-tune figure; make subplots farther from each other.
-f.subplots_adjust(hspace=0.3)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/symlog_demo.html b/examples/pylab_examples/symlog_demo.html deleted file mode 100644 index 9178fd2bf11..00000000000 --- a/examples/pylab_examples/symlog_demo.html +++ /dev/null @@ -1,351 +0,0 @@ - - - - - - - - pylab_examples example code: symlog_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: symlog_demo.py

-

(Source code, png, pdf)

-
-../../_images/symlog_demo.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-
-dt = 0.01
-x = np.arange(-50.0, 50.0, dt)
-y = np.arange(0, 100.0, dt)
-
-plt.subplot(311)
-plt.plot(x, y)
-plt.xscale('symlog')
-plt.ylabel('symlogx')
-plt.grid(True)
-plt.gca().xaxis.grid(True, which='minor')  # minor grid on too
-
-plt.subplot(312)
-plt.plot(y, x)
-plt.yscale('symlog')
-plt.ylabel('symlogy')
-
-plt.subplot(313)
-plt.plot(x, np.sin(x / 3.0))
-plt.xscale('symlog')
-plt.yscale('symlog', linthreshy=0.015)
-plt.grid(True)
-plt.ylabel('symlog both')
-
-plt.subplots_adjust(hspace=0.5, left=0.2)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/system_monitor.html b/examples/pylab_examples/system_monitor.html deleted file mode 100644 index 44b5a2e8836..00000000000 --- a/examples/pylab_examples/system_monitor.html +++ /dev/null @@ -1,387 +0,0 @@ - - - - - - - - pylab_examples example code: system_monitor.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: system_monitor.py

-

(Source code, png, pdf)

-
-../../_images/system_monitor.png -
-
import time
-import matplotlib.pyplot as plt
-import numpy as np
-
-
-def get_memory(t):
-    "Simulate a function that returns system memory"
-    return 100 * (0.5 + 0.5 * np.sin(0.5 * np.pi * t))
-
-
-def get_cpu(t):
-    "Simulate a function that returns cpu usage"
-    return 100 * (0.5 + 0.5 * np.sin(0.2 * np.pi * (t - 0.25)))
-
-
-def get_net(t):
-    "Simulate a function that returns network bandwidth"
-    return 100 * (0.5 + 0.5 * np.sin(0.7 * np.pi * (t - 0.1)))
-
-
-def get_stats(t):
-    return get_memory(t), get_cpu(t), get_net(t)
-
-fig, ax = plt.subplots()
-ind = np.arange(1, 4)
-
-# show the figure, but do not block
-plt.show(block=False)
-
-
-pm, pc, pn = plt.bar(ind, get_stats(0))
-pm.set_facecolor('r')
-pc.set_facecolor('g')
-pn.set_facecolor('b')
-ax.set_xticks(ind)
-ax.set_xticklabels(['Memory', 'CPU', 'Bandwidth'])
-ax.set_ylim([0, 100])
-ax.set_ylabel('Percent usage')
-ax.set_title('System Monitor')
-
-start = time.time()
-for i in range(200):  # run for a little while
-    m, c, n = get_stats(i / 10.0)
-
-    # update the animated artists
-    pm.set_height(m)
-    pc.set_height(c)
-    pn.set_height(n)
-
-    # ask the canvas to re-draw itself the next time it
-    # has a chance.
-    # For most of the GUI backends this adds an event to the queue
-    # of the GUI frameworks event loop.
-    fig.canvas.draw_idle()
-    try:
-        # make sure that the GUI framework has a chance to run its event loop
-        # and clear any GUI events.  This needs to be in a try/except block
-        # because the default implementation of this method is to raise
-        # NotImplementedError
-        fig.canvas.flush_events()
-    except NotImplementedError:
-        pass
-
-stop = time.time()
-print("{fps:.1f} frames per second".format(fps=200 / (stop - start)))
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/table_demo.html b/examples/pylab_examples/table_demo.html deleted file mode 100644 index 463b82dd5e0..00000000000 --- a/examples/pylab_examples/table_demo.html +++ /dev/null @@ -1,377 +0,0 @@ - - - - - - - - pylab_examples example code: table_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: table_demo.py

-

(Source code, png, pdf)

-
-../../_images/table_demo.png -
-
"""
-Demo of table function to display a table within a plot.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-data = [[  66386,  174296,   75131,  577908,   32015],
-        [  58230,  381139,   78045,   99308,  160454],
-        [  89135,   80552,  152558,  497981,  603535],
-        [  78415,   81858,  150656,  193263,   69638],
-        [ 139361,  331509,  343164,  781380,   52269]]
-
-columns = ('Freeze', 'Wind', 'Flood', 'Quake', 'Hail')
-rows = ['%d year' % x for x in (100, 50, 20, 10, 5)]
-
-values = np.arange(0, 2500, 500)
-value_increment = 1000
-
-# Get some pastel shades for the colors
-colors = plt.cm.BuPu(np.linspace(0, 0.5, len(rows)))
-n_rows = len(data)
-
-index = np.arange(len(columns)) + 0.3
-bar_width = 0.4
-
-# Initialize the vertical-offset for the stacked bar chart.
-y_offset = np.array([0.0] * len(columns))
-
-# Plot bars and create text labels for the table
-cell_text = []
-for row in range(n_rows):
-    plt.bar(index, data[row], bar_width, bottom=y_offset, color=colors[row])
-    y_offset = y_offset + data[row]
-    cell_text.append(['%1.1f' % (x/1000.0) for x in y_offset])
-# Reverse colors and text labels to display the last value at the top.
-colors = colors[::-1]
-cell_text.reverse()
-
-# Add a table at the bottom of the axes
-the_table = plt.table(cellText=cell_text,
-                      rowLabels=rows,
-                      rowColours=colors,
-                      colLabels=columns,
-                      loc='bottom')
-
-# Adjust layout to make room for the table:
-plt.subplots_adjust(left=0.2, bottom=0.2)
-
-plt.ylabel("Loss in ${0}'s".format(value_increment))
-plt.yticks(values * value_increment, ['%d' % val for val in values])
-plt.xticks([])
-plt.title('Loss by Disaster')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/tex_demo.html b/examples/pylab_examples/tex_demo.html deleted file mode 100644 index 91ed1909c35..00000000000 --- a/examples/pylab_examples/tex_demo.html +++ /dev/null @@ -1,352 +0,0 @@ - - - - - - - - pylab_examples example code: tex_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: tex_demo.py

-

(Source code, png, pdf)

-
-../../_images/tex_demo.png -
-
"""
-You can use TeX to render all of your matplotlib text if the rc
-parameter text.usetex is set.  This works currently on the agg and ps
-backends, and requires that you have tex and the other dependencies
-described at http://matplotlib.org/users/usetex.html
-properly installed on your system.  The first time you run a script
-you will see a lot of output from tex and associated tools.  The next
-time, the run may be silent, as a lot of the information is cached in
-~/.tex.cache
-
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-plt.rc('text', usetex=True)
-plt.rc('font', family='serif')
-plt.figure(1, figsize=(6, 4))
-ax = plt.axes([0.1, 0.1, 0.8, 0.7])
-t = np.linspace(0.0, 1.0, 100)
-s = np.cos(4 * np.pi * t) + 2
-plt.plot(t, s)
-
-plt.xlabel(r'\textbf{time (s)}')
-plt.ylabel(r'\textit{voltage (mV)}', fontsize=16)
-plt.title(r"\TeX\ is Number $\displaystyle\sum_{n=1}^\infty"
-          r"\frac{-e^{i\pi}}{2^n}$!", fontsize=16, color='r')
-plt.grid(True)
-plt.savefig('tex_demo')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/tex_unicode_demo.html b/examples/pylab_examples/tex_unicode_demo.html deleted file mode 100644 index b8f9cd0a55a..00000000000 --- a/examples/pylab_examples/tex_unicode_demo.html +++ /dev/null @@ -1,347 +0,0 @@ - - - - - - - - pylab_examples example code: tex_unicode_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: tex_unicode_demo.py

-

(Source code, png, pdf)

-
-../../_images/tex_unicode_demo.png -
-
# -*- coding: utf-8 -*-
-"""
-This demo is tex_demo.py modified to have unicode. See that file for
-more information.
-"""
-
-from __future__ import unicode_literals
-import numpy as np
-import matplotlib
-matplotlib.rcParams['text.usetex'] = True
-matplotlib.rcParams['text.latex.unicode'] = True
-import matplotlib.pyplot as plt
-
-plt.figure(1, figsize=(6, 4))
-ax = plt.axes([0.1, 0.1, 0.8, 0.7])
-t = np.arange(0.0, 1.0 + 0.01, 0.01)
-s = np.cos(2*2*np.pi*t) + 2
-plt.plot(t, s)
-
-plt.xlabel(r'\textbf{time (s)}')
-plt.ylabel('\\textit{Velocity (\u00B0/sec)}', fontsize=16)
-plt.title(r'\TeX\ is Number $\displaystyle\sum_{n=1}^\infty'
-          r'\frac{-e^{i\pi}}{2^n}$!', fontsize=16, color='r')
-plt.grid(True)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/text_handles.html b/examples/pylab_examples/text_handles.html deleted file mode 100644 index 9ae5b16f761..00000000000 --- a/examples/pylab_examples/text_handles.html +++ /dev/null @@ -1,355 +0,0 @@ - - - - - - - - pylab_examples example code: text_handles.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: text_handles.py

-

(Source code, png, pdf)

-
-../../_images/text_handles.png -
-
"""
-Controlling the properties of axis text using handles
-
-See examples/text_themes.py for a more elegant, pythonic way to control
-fonts.  After all, if we were slaves to MATLAB , we wouldn't be
-using python!
-"""
-
-import matplotlib.pyplot as plt
-import numpy as np
-
-
-def f(t):
-    s1 = np.sin(2*np.pi*t)
-    e1 = np.exp(-t)
-    return np.multiply(s1, e1)
-
-t1 = np.arange(0.0, 5.0, 0.1)
-t2 = np.arange(0.0, 5.0, 0.02)
-
-fig, ax = plt.subplots()
-plt.plot(t1, f(t1), 'bo', t2, f(t2), 'k')
-plt.text(3.0, 0.6, 'f(t) = exp(-t) sin(2 pi t)')
-ttext = plt.title('Fun with text!')
-ytext = plt.ylabel('Damped oscillation')
-xtext = plt.xlabel('time (s)')
-
-plt.setp(ttext, size='large', color='r', style='italic')
-plt.setp(xtext, size='medium', name=['Courier', 'DejaVu Sans Mono'],
-     weight='bold', color='g')
-plt.setp(ytext, size='medium', name=['Helvetica', 'DejaVu Sans'],
-     weight='light', color='b')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/text_rotation.html b/examples/pylab_examples/text_rotation.html deleted file mode 100644 index 87ef8be3aa2..00000000000 --- a/examples/pylab_examples/text_rotation.html +++ /dev/null @@ -1,366 +0,0 @@ - - - - - - - - pylab_examples example code: text_rotation.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: text_rotation.py

-

(Source code, png, pdf)

-
-../../_images/text_rotation.png -
-
"""
-The way matplotlib does text layout is counter-intuitive to some, so
-this example is designed to make it a little clearer.  The text is
-aligned by it's bounding box (the rectangular box that surrounds the
-ink rectangle).  The order of operations is basically rotation then
-alignment, rather than alignment then rotation.  Basically, the text
-is centered at your x,y location, rotated around this point, and then
-aligned according to the bounding box of the rotated text.
-
-So if you specify left, bottom alignment, the bottom left of the
-bounding box of the rotated text will be at the x,y coordinate of the
-text.
-
-But a picture is worth a thousand words!
-"""
-
-import matplotlib.pyplot as plt
-import numpy as np
-
-
-def addtext(props):
-    plt.text(0.5, 0.5, 'text 0', props, rotation=0)
-    plt.text(1.5, 0.5, 'text 45', props, rotation=45)
-    plt.text(2.5, 0.5, 'text 135', props, rotation=135)
-    plt.text(3.5, 0.5, 'text 225', props, rotation=225)
-    plt.text(4.5, 0.5, 'text -45', props, rotation=-45)
-    plt.yticks([0, .5, 1])
-    plt.grid(True)
-
-# the text bounding box
-bbox = {'fc': '0.8', 'pad': 0}
-
-plt.subplot(211)
-addtext({'ha': 'center', 'va': 'center', 'bbox': bbox})
-plt.xlim(0, 5)
-plt.xticks(np.arange(0, 5.1, 0.5), [])
-plt.ylabel('center / center')
-
-plt.subplot(212)
-addtext({'ha': 'left', 'va': 'bottom', 'bbox': bbox})
-plt.xlim(0, 5)
-plt.xticks(np.arange(0, 5.1, 0.5))
-plt.ylabel('left / bottom')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/text_rotation_relative_to_line.html b/examples/pylab_examples/text_rotation_relative_to_line.html deleted file mode 100644 index 809f1222592..00000000000 --- a/examples/pylab_examples/text_rotation_relative_to_line.html +++ /dev/null @@ -1,359 +0,0 @@ - - - - - - - - pylab_examples example code: text_rotation_relative_to_line.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: text_rotation_relative_to_line.py

-

(Source code, png, pdf)

-
-../../_images/text_rotation_relative_to_line.png -
-
"""
-Text objects in matplotlib are normally rotated with respect to the
-screen coordinate system (i.e., 45 degrees rotation plots text along a
-line that is in between horizontal and vertical no matter how the axes
-are changed).  However, at times one wants to rotate text with respect
-to something on the plot.  In this case, the correct angle won't be
-the angle of that object in the plot coordinate system, but the angle
-that that object APPEARS in the screen coordinate system.  This angle
-is found by transforming the angle from the plot to the screen
-coordinate system, as shown in the example below.
-"""
-
-import matplotlib.pyplot as plt
-import numpy as np
-
-# Plot diagonal line (45 degrees)
-h = plt.plot(np.arange(0, 10), np.arange(0, 10))
-
-# set limits so that it no longer looks on screen to be 45 degrees
-plt.xlim([-10, 20])
-
-# Locations to plot text
-l1 = np.array((1, 1))
-l2 = np.array((5, 5))
-
-# Rotate angle
-angle = 45
-trans_angle = plt.gca().transData.transform_angles(np.array((45,)),
-                                                   l2.reshape((1, 2)))[0]
-
-# Plot text
-th1 = plt.text(l1[0], l1[1], 'text not rotated correctly', fontsize=16,
-               rotation=angle, rotation_mode='anchor')
-th2 = plt.text(l2[0], l2[1], 'text rotated correctly', fontsize=16,
-               rotation=trans_angle, rotation_mode='anchor')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/titles_demo.html b/examples/pylab_examples/titles_demo.html deleted file mode 100644 index ace7f497cf3..00000000000 --- a/examples/pylab_examples/titles_demo.html +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - - - pylab_examples example code: titles_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: titles_demo.py

-

(Source code, png, pdf)

-
-../../_images/titles_demo.png -
-
"""
-matplotlib can display plot titles centered, flush with the left side of
-a set of axes, and flush with the right side of a set of axes.
-
-"""
-import matplotlib.pyplot as plt
-
-plt.plot(range(10))
-
-plt.title('Center Title')
-plt.title('Left Title', loc='left')
-plt.title('Right Title', loc='right')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/to_numeric.html b/examples/pylab_examples/to_numeric.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/pylab_examples/to_numeric.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/pylab_examples/toggle_images.html b/examples/pylab_examples/toggle_images.html deleted file mode 100644 index b656180768c..00000000000 --- a/examples/pylab_examples/toggle_images.html +++ /dev/null @@ -1,368 +0,0 @@ - - - - - - - - pylab_examples example code: toggle_images.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: toggle_images.py

-

(Source code, png, pdf)

-
-../../_images/toggle_images.png -
-
""" toggle between two images by pressing "t"
-
-The basic idea is to load two images (they can be different shapes) and plot
-them to the same axes.  Then, toggle the visible property of
-them using keypress event handling
-
-If you want two images with different shapes to be plotted with the same
-extent, they must have the same "extent" property
-
-As usual, we'll define some random images for demo.  Real data is much more
-exciting!
-
-Note, on the wx backend on some platforms (e.g., linux), you have to
-first click on the figure before the keypress events are activated.
-If you know how to fix this, please email us!
-
-"""
-
-import matplotlib.pyplot as plt
-import numpy as np
-
-# two images x1 is initially visible, x2 is not
-x1 = np.random.random((100, 100))
-x2 = np.random.random((150, 175))
-
-# arbitrary extent - both images must have same extent if you want
-# them to be resampled into the same axes space
-extent = (0, 1, 0, 1)
-im1 = plt.imshow(x1, extent=extent)
-im2 = plt.imshow(x2, extent=extent)
-im2.set_visible(False)
-
-
-def toggle_images(event):
-    'toggle the visible state of the two images'
-    if event.key != 't':
-        return
-    b1 = im1.get_visible()
-    b2 = im2.get_visible()
-    im1.set_visible(not b1)
-    im2.set_visible(not b2)
-    plt.draw()
-
-plt.connect('key_press_event', toggle_images)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/transoffset.html b/examples/pylab_examples/transoffset.html deleted file mode 100644 index 97b8d2bdef5..00000000000 --- a/examples/pylab_examples/transoffset.html +++ /dev/null @@ -1,376 +0,0 @@ - - - - - - - - pylab_examples example code: transoffset.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: transoffset.py

-

(Source code, png, pdf)

-
-../../_images/transoffset.png -
-
'''
-This illustrates the use of transforms.offset_copy to
-make a transform that positions a drawing element such as
-a text string at a specified offset in screen coordinates
-(dots or inches) relative to a location given in any
-coordinates.
-
-Every Artist--the mpl class from which classes such as
-Text and Line are derived--has a transform that can be
-set when the Artist is created, such as by the corresponding
-pyplot command.  By default this is usually the Axes.transData
-transform, going from data units to screen dots.  We can
-use the offset_copy function to make a modified copy of
-this transform, where the modification consists of an
-offset.
-'''
-
-import matplotlib.pyplot as plt
-import matplotlib.transforms as mtrans
-import numpy as np
-
-from matplotlib.transforms import offset_copy
-
-xs = np.arange(7)
-ys = xs**2
-
-fig = plt.figure(figsize=(5, 10))
-ax = plt.subplot(2, 1, 1)
-
-# If we want the same offset for each text instance,
-# we only need to make one transform.  To get the
-# transform argument to offset_copy, we need to make the axes
-# first; the subplot command above is one way to do this.
-trans_offset = mtrans.offset_copy(ax.transData, fig=fig,
-                                  x=0.05, y=0.10, units='inches')
-
-for x, y in zip(xs, ys):
-    plt.plot((x,), (y,), 'ro')
-    plt.text(x, y, '%d, %d' % (int(x), int(y)), transform=trans_offset)
-
-
-# offset_copy works for polar plots also.
-ax = plt.subplot(2, 1, 2, projection='polar')
-
-trans_offset = mtrans.offset_copy(ax.transData, fig=fig, y=6, units='dots')
-
-for x, y in zip(xs, ys):
-    plt.polar((x,), (y,), 'ro')
-    plt.text(x, y, '%d, %d' % (int(x), int(y)),
-             transform=trans_offset,
-             horizontalalignment='center',
-             verticalalignment='bottom')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/tricontour_demo.html b/examples/pylab_examples/tricontour_demo.html deleted file mode 100644 index df81556bd52..00000000000 --- a/examples/pylab_examples/tricontour_demo.html +++ /dev/null @@ -1,431 +0,0 @@ - - - - - - - - pylab_examples example code: tricontour_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: tricontour_demo.py

-

(Source code)

-
-../../_images/tricontour_demo_001.png -

(png, pdf)

-
-
-../../_images/tricontour_demo_011.png -

(png, pdf)

-
-
"""
-Contour plots of unstructured triangular grids.
-"""
-import matplotlib.pyplot as plt
-import matplotlib.tri as tri
-import numpy as np
-import math
-
-# Creating a Triangulation without specifying the triangles results in the
-# Delaunay triangulation of the points.
-
-# First create the x and y coordinates of the points.
-n_angles = 48
-n_radii = 8
-min_radius = 0.25
-radii = np.linspace(min_radius, 0.95, n_radii)
-
-angles = np.linspace(0, 2*math.pi, n_angles, endpoint=False)
-angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1)
-angles[:, 1::2] += math.pi/n_angles
-
-x = (radii*np.cos(angles)).flatten()
-y = (radii*np.sin(angles)).flatten()
-z = (np.cos(radii)*np.cos(angles*3.0)).flatten()
-
-# Create the Triangulation; no triangles so Delaunay triangulation created.
-triang = tri.Triangulation(x, y)
-
-# Mask off unwanted triangles.
-xmid = x[triang.triangles].mean(axis=1)
-ymid = y[triang.triangles].mean(axis=1)
-mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0)
-triang.set_mask(mask)
-
-# pcolor plot.
-plt.figure()
-plt.gca().set_aspect('equal')
-plt.tricontourf(triang, z)
-plt.colorbar()
-plt.tricontour(triang, z, colors='k')
-plt.title('Contour plot of Delaunay triangulation')
-
-# You can specify your own triangulation rather than perform a Delaunay
-# triangulation of the points, where each triangle is given by the indices of
-# the three points that make up the triangle, ordered in either a clockwise or
-# anticlockwise manner.
-
-xy = np.asarray([
-    [-0.101, 0.872], [-0.080, 0.883], [-0.069, 0.888], [-0.054, 0.890],
-    [-0.045, 0.897], [-0.057, 0.895], [-0.073, 0.900], [-0.087, 0.898],
-    [-0.090, 0.904], [-0.069, 0.907], [-0.069, 0.921], [-0.080, 0.919],
-    [-0.073, 0.928], [-0.052, 0.930], [-0.048, 0.942], [-0.062, 0.949],
-    [-0.054, 0.958], [-0.069, 0.954], [-0.087, 0.952], [-0.087, 0.959],
-    [-0.080, 0.966], [-0.085, 0.973], [-0.087, 0.965], [-0.097, 0.965],
-    [-0.097, 0.975], [-0.092, 0.984], [-0.101, 0.980], [-0.108, 0.980],
-    [-0.104, 0.987], [-0.102, 0.993], [-0.115, 1.001], [-0.099, 0.996],
-    [-0.101, 1.007], [-0.090, 1.010], [-0.087, 1.021], [-0.069, 1.021],
-    [-0.052, 1.022], [-0.052, 1.017], [-0.069, 1.010], [-0.064, 1.005],
-    [-0.048, 1.005], [-0.031, 1.005], [-0.031, 0.996], [-0.040, 0.987],
-    [-0.045, 0.980], [-0.052, 0.975], [-0.040, 0.973], [-0.026, 0.968],
-    [-0.020, 0.954], [-0.006, 0.947], [ 0.003, 0.935], [ 0.006, 0.926],
-    [ 0.005, 0.921], [ 0.022, 0.923], [ 0.033, 0.912], [ 0.029, 0.905],
-    [ 0.017, 0.900], [ 0.012, 0.895], [ 0.027, 0.893], [ 0.019, 0.886],
-    [ 0.001, 0.883], [-0.012, 0.884], [-0.029, 0.883], [-0.038, 0.879],
-    [-0.057, 0.881], [-0.062, 0.876], [-0.078, 0.876], [-0.087, 0.872],
-    [-0.030, 0.907], [-0.007, 0.905], [-0.057, 0.916], [-0.025, 0.933],
-    [-0.077, 0.990], [-0.059, 0.993]])
-x = np.degrees(xy[:, 0])
-y = np.degrees(xy[:, 1])
-x0 = -5
-y0 = 52
-z = np.exp(-0.01*((x - x0)*(x - x0) + (y - y0)*(y - y0)))
-
-triangles = np.asarray([
-    [67, 66,  1], [65,  2, 66], [ 1, 66,  2], [64,  2, 65], [63,  3, 64],
-    [60, 59, 57], [ 2, 64,  3], [ 3, 63,  4], [ 0, 67,  1], [62,  4, 63],
-    [57, 59, 56], [59, 58, 56], [61, 60, 69], [57, 69, 60], [ 4, 62, 68],
-    [ 6,  5,  9], [61, 68, 62], [69, 68, 61], [ 9,  5, 70], [ 6,  8,  7],
-    [ 4, 70,  5], [ 8,  6,  9], [56, 69, 57], [69, 56, 52], [70, 10,  9],
-    [54, 53, 55], [56, 55, 53], [68, 70,  4], [52, 56, 53], [11, 10, 12],
-    [69, 71, 68], [68, 13, 70], [10, 70, 13], [51, 50, 52], [13, 68, 71],
-    [52, 71, 69], [12, 10, 13], [71, 52, 50], [71, 14, 13], [50, 49, 71],
-    [49, 48, 71], [14, 16, 15], [14, 71, 48], [17, 19, 18], [17, 20, 19],
-    [48, 16, 14], [48, 47, 16], [47, 46, 16], [16, 46, 45], [23, 22, 24],
-    [21, 24, 22], [17, 16, 45], [20, 17, 45], [21, 25, 24], [27, 26, 28],
-    [20, 72, 21], [25, 21, 72], [45, 72, 20], [25, 28, 26], [44, 73, 45],
-    [72, 45, 73], [28, 25, 29], [29, 25, 31], [43, 73, 44], [73, 43, 40],
-    [72, 73, 39], [72, 31, 25], [42, 40, 43], [31, 30, 29], [39, 73, 40],
-    [42, 41, 40], [72, 33, 31], [32, 31, 33], [39, 38, 72], [33, 72, 38],
-    [33, 38, 34], [37, 35, 38], [34, 38, 35], [35, 37, 36]])
-
-# Rather than create a Triangulation object, can simply pass x, y and triangles
-# arrays to tripcolor directly.  It would be better to use a Triangulation
-# object if the same triangulation was to be used more than once to save
-# duplicated calculations.
-plt.figure()
-plt.gca().set_aspect('equal')
-plt.tricontourf(x, y, triangles, z)
-plt.colorbar()
-plt.title('Contour plot of user-specified triangulation')
-plt.xlabel('Longitude (degrees)')
-plt.ylabel('Latitude (degrees)')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/tricontour_smooth_delaunay.html b/examples/pylab_examples/tricontour_smooth_delaunay.html deleted file mode 100644 index 2da09f8fbc4..00000000000 --- a/examples/pylab_examples/tricontour_smooth_delaunay.html +++ /dev/null @@ -1,455 +0,0 @@ - - - - - - - - pylab_examples example code: tricontour_smooth_delaunay.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: tricontour_smooth_delaunay.py

-

(Source code, png, pdf)

-
-../../_images/tricontour_smooth_delaunay.png -
-
"""
-Demonstrates high-resolution tricontouring of a random set of points ;
-a matplotlib.tri.TriAnalyzer is used to improve the plot quality.
-
-The initial data points and triangular grid for this demo are:
-    - a set of random points is instantiated, inside [-1, 1] x [-1, 1] square
-    - A Delaunay triangulation of these points is then computed, of which a
-    random subset of triangles is masked out by the user (based on
-    *init_mask_frac* parameter). This simulates invalidated data.
-
-The proposed generic procedure to obtain a high resolution contouring of such
-a data set is the following:
-    1) Compute an extended mask with a matplotlib.tri.TriAnalyzer, which will
-    exclude badly shaped (flat) triangles from the border of the
-    triangulation. Apply the mask to the triangulation (using set_mask).
-    2) Refine and interpolate the data using a
-    matplotlib.tri.UniformTriRefiner.
-    3) Plot the refined data with tricontour.
-
-"""
-from matplotlib.tri import Triangulation, TriAnalyzer, UniformTriRefiner
-import matplotlib.pyplot as plt
-import matplotlib.cm as cm
-import numpy as np
-
-
-#-----------------------------------------------------------------------------
-# Analytical test function
-#-----------------------------------------------------------------------------
-def experiment_res(x, y):
-    """ An analytic function representing experiment results """
-    x = 2.*x
-    r1 = np.sqrt((0.5 - x)**2 + (0.5 - y)**2)
-    theta1 = np.arctan2(0.5 - x, 0.5 - y)
-    r2 = np.sqrt((-x - 0.2)**2 + (-y - 0.2)**2)
-    theta2 = np.arctan2(-x - 0.2, -y - 0.2)
-    z = (4*(np.exp((r1/10)**2) - 1)*30. * np.cos(3*theta1) +
-         (np.exp((r2/10)**2) - 1)*30. * np.cos(5*theta2) +
-         2*(x**2 + y**2))
-    return (np.max(z) - z)/(np.max(z) - np.min(z))
-
-#-----------------------------------------------------------------------------
-# Generating the initial data test points and triangulation for the demo
-#-----------------------------------------------------------------------------
-# User parameters for data test points
-n_test = 200  # Number of test data points, tested from 3 to 5000 for subdiv=3
-
-subdiv = 3  # Number of recursive subdivisions of the initial mesh for smooth
-            # plots. Values >3 might result in a very high number of triangles
-            # for the refine mesh: new triangles numbering = (4**subdiv)*ntri
-
-init_mask_frac = 0.0    # Float > 0. adjusting the proportion of
-                        # (invalid) initial triangles which will be masked
-                        # out. Enter 0 for no mask.
-
-min_circle_ratio = .01  # Minimum circle ratio - border triangles with circle
-                        # ratio below this will be masked if they touch a
-                        # border. Suggested value 0.01 ; Use -1 to keep
-                        # all triangles.
-
-# Random points
-random_gen = np.random.mtrand.RandomState(seed=127260)
-x_test = random_gen.uniform(-1., 1., size=n_test)
-y_test = random_gen.uniform(-1., 1., size=n_test)
-z_test = experiment_res(x_test, y_test)
-
-# meshing with Delaunay triangulation
-tri = Triangulation(x_test, y_test)
-ntri = tri.triangles.shape[0]
-
-# Some invalid data are masked out
-mask_init = np.zeros(ntri, dtype=np.bool)
-masked_tri = random_gen.randint(0, ntri, int(ntri*init_mask_frac))
-mask_init[masked_tri] = True
-tri.set_mask(mask_init)
-
-
-#-----------------------------------------------------------------------------
-# Improving the triangulation before high-res plots: removing flat triangles
-#-----------------------------------------------------------------------------
-# masking badly shaped triangles at the border of the triangular mesh.
-mask = TriAnalyzer(tri).get_flat_tri_mask(min_circle_ratio)
-tri.set_mask(mask)
-
-# refining the data
-refiner = UniformTriRefiner(tri)
-tri_refi, z_test_refi = refiner.refine_field(z_test, subdiv=subdiv)
-
-# analytical 'results' for comparison
-z_expected = experiment_res(tri_refi.x, tri_refi.y)
-
-# for the demo: loading the 'flat' triangles for plot
-flat_tri = Triangulation(x_test, y_test)
-flat_tri.set_mask(~mask)
-
-
-#-----------------------------------------------------------------------------
-# Now the plots
-#-----------------------------------------------------------------------------
-# User options for plots
-plot_tri = True          # plot of base triangulation
-plot_masked_tri = True   # plot of excessively flat excluded triangles
-plot_refi_tri = False    # plot of refined triangulation
-plot_expected = False    # plot of analytical function values for comparison
-
-
-# Graphical options for tricontouring
-levels = np.arange(0., 1., 0.025)
-cmap = cm.get_cmap(name='Blues', lut=None)
-
-plt.figure()
-plt.gca().set_aspect('equal')
-plt.title("Filtering a Delaunay mesh\n" +
-          "(application to high-resolution tricontouring)")
-
-# 1) plot of the refined (computed) data contours:
-plt.tricontour(tri_refi, z_test_refi, levels=levels, cmap=cmap,
-               linewidths=[2.0, 0.5, 1.0, 0.5])
-# 2) plot of the expected (analytical) data contours (dashed):
-if plot_expected:
-    plt.tricontour(tri_refi, z_expected, levels=levels, cmap=cmap,
-                   linestyles='--')
-# 3) plot of the fine mesh on which interpolation was done:
-if plot_refi_tri:
-    plt.triplot(tri_refi, color='0.97')
-# 4) plot of the initial 'coarse' mesh:
-if plot_tri:
-    plt.triplot(tri, color='0.7')
-# 4) plot of the unvalidated triangles from naive Delaunay Triangulation:
-if plot_masked_tri:
-    plt.triplot(flat_tri, color='red')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/tricontour_smooth_user.html b/examples/pylab_examples/tricontour_smooth_user.html deleted file mode 100644 index 30619373f76..00000000000 --- a/examples/pylab_examples/tricontour_smooth_user.html +++ /dev/null @@ -1,398 +0,0 @@ - - - - - - - - pylab_examples example code: tricontour_smooth_user.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: tricontour_smooth_user.py

-

(Source code, png, pdf)

-
-../../_images/tricontour_smooth_user.png -
-
"""
-Demonstrates high-resolution tricontouring on user-defined triangular grids
-with matplotlib.tri.UniformTriRefiner
-"""
-import matplotlib.tri as tri
-import matplotlib.pyplot as plt
-import matplotlib.cm as cm
-import numpy as np
-import math
-
-
-#-----------------------------------------------------------------------------
-# Analytical test function
-#-----------------------------------------------------------------------------
-def function_z(x, y):
-    """ A function of 2 variables """
-    r1 = np.sqrt((0.5 - x)**2 + (0.5 - y)**2)
-    theta1 = np.arctan2(0.5 - x, 0.5 - y)
-    r2 = np.sqrt((-x - 0.2)**2 + (-y - 0.2)**2)
-    theta2 = np.arctan2(-x - 0.2, -y - 0.2)
-    z = -(2*(np.exp((r1/10)**2) - 1)*30. * np.cos(7.*theta1) +
-          (np.exp((r2/10)**2) - 1)*30. * np.cos(11.*theta2) +
-          0.7*(x**2 + y**2))
-    return (np.max(z) - z)/(np.max(z) - np.min(z))
-
-#-----------------------------------------------------------------------------
-# Creating a Triangulation
-#-----------------------------------------------------------------------------
-# First create the x and y coordinates of the points.
-n_angles = 20
-n_radii = 10
-min_radius = 0.15
-radii = np.linspace(min_radius, 0.95, n_radii)
-
-angles = np.linspace(0, 2*math.pi, n_angles, endpoint=False)
-angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1)
-angles[:, 1::2] += math.pi/n_angles
-
-x = (radii*np.cos(angles)).flatten()
-y = (radii*np.sin(angles)).flatten()
-z = function_z(x, y)
-
-# Now create the Triangulation.
-# (Creating a Triangulation without specifying the triangles results in the
-# Delaunay triangulation of the points.)
-triang = tri.Triangulation(x, y)
-
-# Mask off unwanted triangles.
-xmid = x[triang.triangles].mean(axis=1)
-ymid = y[triang.triangles].mean(axis=1)
-mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0)
-triang.set_mask(mask)
-
-#-----------------------------------------------------------------------------
-# Refine data
-#-----------------------------------------------------------------------------
-refiner = tri.UniformTriRefiner(triang)
-tri_refi, z_test_refi = refiner.refine_field(z, subdiv=3)
-
-#-----------------------------------------------------------------------------
-# Plot the triangulation and the high-res iso-contours
-#-----------------------------------------------------------------------------
-plt.figure()
-plt.gca().set_aspect('equal')
-plt.triplot(triang, lw=0.5, color='white')
-
-levels = np.arange(0., 1., 0.025)
-cmap = cm.get_cmap(name='terrain', lut=None)
-plt.tricontourf(tri_refi, z_test_refi, levels=levels, cmap=cmap)
-plt.tricontour(tri_refi, z_test_refi, levels=levels,
-               colors=['0.25', '0.5', '0.5', '0.5', '0.5'],
-               linewidths=[1.0, 0.5, 0.5, 0.5, 0.5])
-
-plt.title("High-resolution tricontouring")
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/tricontour_vs_griddata.html b/examples/pylab_examples/tricontour_vs_griddata.html deleted file mode 100644 index 9dc77b2b8b4..00000000000 --- a/examples/pylab_examples/tricontour_vs_griddata.html +++ /dev/null @@ -1,375 +0,0 @@ - - - - - - - - pylab_examples example code: tricontour_vs_griddata.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: tricontour_vs_griddata.py

-

(Source code, png, pdf)

-
-../../_images/tricontour_vs_griddata.png -
-
"""
-Comparison of griddata and tricontour for an unstructured triangular grid.
-"""
-from __future__ import print_function
-import matplotlib.pyplot as plt
-import matplotlib.tri as tri
-import numpy as np
-import numpy.random as rnd
-import matplotlib.mlab as mlab
-import time
-
-rnd.seed(0)
-npts = 200
-ngridx = 100
-ngridy = 200
-x = rnd.uniform(-2, 2, npts)
-y = rnd.uniform(-2, 2, npts)
-z = x*np.exp(-x**2 - y**2)
-
-# griddata and contour.
-start = time.clock()
-plt.subplot(211)
-xi = np.linspace(-2.1, 2.1, ngridx)
-yi = np.linspace(-2.1, 2.1, ngridy)
-zi = mlab.griddata(x, y, z, xi, yi, interp='linear')
-plt.contour(xi, yi, zi, 15, linewidths=0.5, colors='k')
-plt.contourf(xi, yi, zi, 15,
-             norm=plt.Normalize(vmax=abs(zi).max(), vmin=-abs(zi).max()))
-plt.colorbar()  # draw colorbar
-plt.plot(x, y, 'ko', ms=3)
-plt.xlim(-2, 2)
-plt.ylim(-2, 2)
-plt.title('griddata and contour (%d points, %d grid points)' %
-          (npts, ngridx*ngridy))
-print('griddata and contour seconds: %f' % (time.clock() - start))
-
-# tricontour.
-start = time.clock()
-plt.subplot(212)
-triang = tri.Triangulation(x, y)
-plt.tricontour(x, y, z, 15, linewidths=0.5, colors='k')
-plt.tricontourf(x, y, z, 15,
-                norm=plt.Normalize(vmax=abs(zi).max(), vmin=-abs(zi).max()))
-plt.colorbar()
-plt.plot(x, y, 'ko', ms=3)
-plt.xlim(-2, 2)
-plt.ylim(-2, 2)
-plt.title('tricontour (%d points)' % npts)
-print('tricontour seconds: %f' % (time.clock() - start))
-
-plt.subplots_adjust(hspace=0.5)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/trigradient_demo.html b/examples/pylab_examples/trigradient_demo.html deleted file mode 100644 index 89d59fa3cd1..00000000000 --- a/examples/pylab_examples/trigradient_demo.html +++ /dev/null @@ -1,407 +0,0 @@ - - - - - - - - pylab_examples example code: trigradient_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: trigradient_demo.py

-

(Source code, png, pdf)

-
-../../_images/trigradient_demo.png -
-
"""
-Demonstrates computation of gradient with matplotlib.tri.CubicTriInterpolator.
-"""
-from matplotlib.tri import Triangulation, UniformTriRefiner,\
-    CubicTriInterpolator
-import matplotlib.pyplot as plt
-import matplotlib.cm as cm
-import numpy as np
-import math
-
-
-#-----------------------------------------------------------------------------
-# Electrical potential of a dipole
-#-----------------------------------------------------------------------------
-def dipole_potential(x, y):
-    """ The electric dipole potential V """
-    r_sq = x**2 + y**2
-    theta = np.arctan2(y, x)
-    z = np.cos(theta)/r_sq
-    return (np.max(z) - z) / (np.max(z) - np.min(z))
-
-
-#-----------------------------------------------------------------------------
-# Creating a Triangulation
-#-----------------------------------------------------------------------------
-# First create the x and y coordinates of the points.
-n_angles = 30
-n_radii = 10
-min_radius = 0.2
-radii = np.linspace(min_radius, 0.95, n_radii)
-
-angles = np.linspace(0, 2*math.pi, n_angles, endpoint=False)
-angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1)
-angles[:, 1::2] += math.pi/n_angles
-
-x = (radii*np.cos(angles)).flatten()
-y = (radii*np.sin(angles)).flatten()
-V = dipole_potential(x, y)
-
-# Create the Triangulation; no triangles specified so Delaunay triangulation
-# created.
-triang = Triangulation(x, y)
-
-# Mask off unwanted triangles.
-xmid = x[triang.triangles].mean(axis=1)
-ymid = y[triang.triangles].mean(axis=1)
-mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0)
-triang.set_mask(mask)
-
-#-----------------------------------------------------------------------------
-# Refine data - interpolates the electrical potential V
-#-----------------------------------------------------------------------------
-refiner = UniformTriRefiner(triang)
-tri_refi, z_test_refi = refiner.refine_field(V, subdiv=3)
-
-#-----------------------------------------------------------------------------
-# Computes the electrical field (Ex, Ey) as gradient of electrical potential
-#-----------------------------------------------------------------------------
-tci = CubicTriInterpolator(triang, -V)
-# Gradient requested here at the mesh nodes but could be anywhere else:
-(Ex, Ey) = tci.gradient(triang.x, triang.y)
-E_norm = np.sqrt(Ex**2 + Ey**2)
-
-#-----------------------------------------------------------------------------
-# Plot the triangulation, the potential iso-contours and the vector field
-#-----------------------------------------------------------------------------
-fig, ax = plt.subplots()
-ax.set_aspect('equal')
-# Enforce the margins, and enlarge them to give room for the vectors.
-ax.use_sticky_edges = False
-ax.margins(0.07)
-
-ax.triplot(triang, color='0.8')
-
-levels = np.arange(0., 1., 0.01)
-cmap = cm.get_cmap(name='hot', lut=None)
-ax.tricontour(tri_refi, z_test_refi, levels=levels, cmap=cmap,
-              linewidths=[2.0, 1.0, 1.0, 1.0])
-# Plots direction of the electrical vector field
-ax.quiver(triang.x, triang.y, Ex/E_norm, Ey/E_norm,
-          units='xy', scale=10., zorder=3, color='blue',
-          width=0.007, headwidth=3., headlength=4.)
-
-ax.set_title('Gradient plot: an electrical dipole')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/triinterp_demo.html b/examples/pylab_examples/triinterp_demo.html deleted file mode 100644 index 6a98065ae05..00000000000 --- a/examples/pylab_examples/triinterp_demo.html +++ /dev/null @@ -1,379 +0,0 @@ - - - - - - - - pylab_examples example code: triinterp_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: triinterp_demo.py

-

(Source code, png, pdf)

-
-../../_images/triinterp_demo.png -
-
"""
-Interpolation from triangular grid to quad grid.
-"""
-import matplotlib.pyplot as plt
-import matplotlib.tri as mtri
-import numpy as np
-
-# Create triangulation.
-x = np.asarray([0, 1, 2, 3, 0.5, 1.5, 2.5, 1, 2, 1.5])
-y = np.asarray([0, 0, 0, 0, 1.0, 1.0, 1.0, 2, 2, 3.0])
-triangles = [[0, 1, 4], [1, 2, 5], [2, 3, 6], [1, 5, 4], [2, 6, 5], [4, 5, 7],
-             [5, 6, 8], [5, 8, 7], [7, 8, 9]]
-triang = mtri.Triangulation(x, y, triangles)
-
-# Interpolate to regularly-spaced quad grid.
-z = np.cos(1.5*x)*np.cos(1.5*y)
-xi, yi = np.meshgrid(np.linspace(0, 3, 20), np.linspace(0, 3, 20))
-
-interp_lin = mtri.LinearTriInterpolator(triang, z)
-zi_lin = interp_lin(xi, yi)
-
-interp_cubic_geom = mtri.CubicTriInterpolator(triang, z, kind='geom')
-zi_cubic_geom = interp_cubic_geom(xi, yi)
-
-interp_cubic_min_E = mtri.CubicTriInterpolator(triang, z, kind='min_E')
-zi_cubic_min_E = interp_cubic_min_E(xi, yi)
-
-
-# Plot the triangulation.
-plt.subplot(221)
-plt.tricontourf(triang, z)
-plt.triplot(triang, 'ko-')
-plt.title('Triangular grid')
-
-# Plot linear interpolation to quad grid.
-plt.subplot(222)
-plt.contourf(xi, yi, zi_lin)
-plt.plot(xi, yi, 'k-', lw=0.5, alpha=0.5)
-plt.plot(xi.T, yi.T, 'k-', lw=0.5, alpha=0.5)
-plt.title("Linear interpolation")
-
-# Plot cubic interpolation to quad grid, kind=geom
-plt.subplot(223)
-plt.contourf(xi, yi, zi_cubic_geom)
-plt.plot(xi, yi, 'k-', lw=0.5, alpha=0.5)
-plt.plot(xi.T, yi.T, 'k-', lw=0.5, alpha=0.5)
-plt.title("Cubic interpolation,\nkind='geom'")
-
-# Plot cubic interpolation to quad grid, kind=min_E
-plt.subplot(224)
-plt.contourf(xi, yi, zi_cubic_min_E)
-plt.plot(xi, yi, 'k-', lw=0.5, alpha=0.5)
-plt.plot(xi.T, yi.T, 'k-', lw=0.5, alpha=0.5)
-plt.title("Cubic interpolation,\nkind='min_E'")
-
-plt.tight_layout()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/tripcolor_demo.html b/examples/pylab_examples/tripcolor_demo.html deleted file mode 100644 index cc08e4e6cb4..00000000000 --- a/examples/pylab_examples/tripcolor_demo.html +++ /dev/null @@ -1,447 +0,0 @@ - - - - - - - - pylab_examples example code: tripcolor_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: tripcolor_demo.py

-

(Source code)

-
-../../_images/tripcolor_demo_001.png -

(png, pdf)

-
-
-../../_images/tripcolor_demo_011.png -

(png, pdf)

-
-
-../../_images/tripcolor_demo_021.png -

(png, pdf)

-
-
"""
-Pseudocolor plots of unstructured triangular grids.
-"""
-import matplotlib.pyplot as plt
-import matplotlib.tri as tri
-import numpy as np
-import math
-
-# Creating a Triangulation without specifying the triangles results in the
-# Delaunay triangulation of the points.
-
-# First create the x and y coordinates of the points.
-n_angles = 36
-n_radii = 8
-min_radius = 0.25
-radii = np.linspace(min_radius, 0.95, n_radii)
-
-angles = np.linspace(0, 2*math.pi, n_angles, endpoint=False)
-angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1)
-angles[:, 1::2] += math.pi/n_angles
-
-x = (radii*np.cos(angles)).flatten()
-y = (radii*np.sin(angles)).flatten()
-z = (np.cos(radii)*np.cos(angles*3.0)).flatten()
-
-# Create the Triangulation; no triangles so Delaunay triangulation created.
-triang = tri.Triangulation(x, y)
-
-# Mask off unwanted triangles.
-xmid = x[triang.triangles].mean(axis=1)
-ymid = y[triang.triangles].mean(axis=1)
-mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0)
-triang.set_mask(mask)
-
-# tripcolor plot.
-plt.figure()
-plt.gca().set_aspect('equal')
-plt.tripcolor(triang, z, shading='flat')
-plt.colorbar()
-plt.title('tripcolor of Delaunay triangulation, flat shading')
-
-# Illustrate Gouraud shading.
-plt.figure()
-plt.gca().set_aspect('equal')
-plt.tripcolor(triang, z, shading='gouraud')
-plt.colorbar()
-plt.title('tripcolor of Delaunay triangulation, gouraud shading')
-
-
-# You can specify your own triangulation rather than perform a Delaunay
-# triangulation of the points, where each triangle is given by the indices of
-# the three points that make up the triangle, ordered in either a clockwise or
-# anticlockwise manner.
-
-xy = np.asarray([
-    [-0.101, 0.872], [-0.080, 0.883], [-0.069, 0.888], [-0.054, 0.890],
-    [-0.045, 0.897], [-0.057, 0.895], [-0.073, 0.900], [-0.087, 0.898],
-    [-0.090, 0.904], [-0.069, 0.907], [-0.069, 0.921], [-0.080, 0.919],
-    [-0.073, 0.928], [-0.052, 0.930], [-0.048, 0.942], [-0.062, 0.949],
-    [-0.054, 0.958], [-0.069, 0.954], [-0.087, 0.952], [-0.087, 0.959],
-    [-0.080, 0.966], [-0.085, 0.973], [-0.087, 0.965], [-0.097, 0.965],
-    [-0.097, 0.975], [-0.092, 0.984], [-0.101, 0.980], [-0.108, 0.980],
-    [-0.104, 0.987], [-0.102, 0.993], [-0.115, 1.001], [-0.099, 0.996],
-    [-0.101, 1.007], [-0.090, 1.010], [-0.087, 1.021], [-0.069, 1.021],
-    [-0.052, 1.022], [-0.052, 1.017], [-0.069, 1.010], [-0.064, 1.005],
-    [-0.048, 1.005], [-0.031, 1.005], [-0.031, 0.996], [-0.040, 0.987],
-    [-0.045, 0.980], [-0.052, 0.975], [-0.040, 0.973], [-0.026, 0.968],
-    [-0.020, 0.954], [-0.006, 0.947], [ 0.003, 0.935], [ 0.006, 0.926],
-    [ 0.005, 0.921], [ 0.022, 0.923], [ 0.033, 0.912], [ 0.029, 0.905],
-    [ 0.017, 0.900], [ 0.012, 0.895], [ 0.027, 0.893], [ 0.019, 0.886],
-    [ 0.001, 0.883], [-0.012, 0.884], [-0.029, 0.883], [-0.038, 0.879],
-    [-0.057, 0.881], [-0.062, 0.876], [-0.078, 0.876], [-0.087, 0.872],
-    [-0.030, 0.907], [-0.007, 0.905], [-0.057, 0.916], [-0.025, 0.933],
-    [-0.077, 0.990], [-0.059, 0.993]])
-x = xy[:, 0]*180/3.14159
-y = xy[:, 1]*180/3.14159
-
-triangles = np.asarray([
-    [67, 66,  1], [65,  2, 66], [ 1, 66,  2], [64,  2, 65], [63,  3, 64],
-    [60, 59, 57], [ 2, 64,  3], [ 3, 63,  4], [ 0, 67,  1], [62,  4, 63],
-    [57, 59, 56], [59, 58, 56], [61, 60, 69], [57, 69, 60], [ 4, 62, 68],
-    [ 6,  5,  9], [61, 68, 62], [69, 68, 61], [ 9,  5, 70], [ 6,  8,  7],
-    [ 4, 70,  5], [ 8,  6,  9], [56, 69, 57], [69, 56, 52], [70, 10,  9],
-    [54, 53, 55], [56, 55, 53], [68, 70,  4], [52, 56, 53], [11, 10, 12],
-    [69, 71, 68], [68, 13, 70], [10, 70, 13], [51, 50, 52], [13, 68, 71],
-    [52, 71, 69], [12, 10, 13], [71, 52, 50], [71, 14, 13], [50, 49, 71],
-    [49, 48, 71], [14, 16, 15], [14, 71, 48], [17, 19, 18], [17, 20, 19],
-    [48, 16, 14], [48, 47, 16], [47, 46, 16], [16, 46, 45], [23, 22, 24],
-    [21, 24, 22], [17, 16, 45], [20, 17, 45], [21, 25, 24], [27, 26, 28],
-    [20, 72, 21], [25, 21, 72], [45, 72, 20], [25, 28, 26], [44, 73, 45],
-    [72, 45, 73], [28, 25, 29], [29, 25, 31], [43, 73, 44], [73, 43, 40],
-    [72, 73, 39], [72, 31, 25], [42, 40, 43], [31, 30, 29], [39, 73, 40],
-    [42, 41, 40], [72, 33, 31], [32, 31, 33], [39, 38, 72], [33, 72, 38],
-    [33, 38, 34], [37, 35, 38], [34, 38, 35], [35, 37, 36]])
-
-xmid = x[triangles].mean(axis=1)
-ymid = y[triangles].mean(axis=1)
-x0 = -5
-y0 = 52
-zfaces = np.exp(-0.01*((xmid - x0)*(xmid - x0) + (ymid - y0)*(ymid - y0)))
-
-# Rather than create a Triangulation object, can simply pass x, y and triangles
-# arrays to tripcolor directly.  It would be better to use a Triangulation
-# object if the same triangulation was to be used more than once to save
-# duplicated calculations.
-# Can specify one color value per face rather than one per point by using the
-# facecolors kwarg.
-plt.figure()
-plt.gca().set_aspect('equal')
-plt.tripcolor(x, y, triangles, facecolors=zfaces, edgecolors='k')
-plt.colorbar()
-plt.title('tripcolor of user-specified triangulation')
-plt.xlabel('Longitude (degrees)')
-plt.ylabel('Latitude (degrees)')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/triplot_demo.html b/examples/pylab_examples/triplot_demo.html deleted file mode 100644 index 6b37853f5bb..00000000000 --- a/examples/pylab_examples/triplot_demo.html +++ /dev/null @@ -1,425 +0,0 @@ - - - - - - - - pylab_examples example code: triplot_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: triplot_demo.py

-

(Source code)

-
-../../_images/triplot_demo_001.png -

(png, pdf)

-
-
-../../_images/triplot_demo_011.png -

(png, pdf)

-
-
"""
-Creating and plotting unstructured triangular grids.
-"""
-import matplotlib.pyplot as plt
-import matplotlib.tri as tri
-import numpy as np
-import math
-
-# Creating a Triangulation without specifying the triangles results in the
-# Delaunay triangulation of the points.
-
-# First create the x and y coordinates of the points.
-n_angles = 36
-n_radii = 8
-min_radius = 0.25
-radii = np.linspace(min_radius, 0.95, n_radii)
-
-angles = np.linspace(0, 2*math.pi, n_angles, endpoint=False)
-angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1)
-angles[:, 1::2] += math.pi/n_angles
-
-x = (radii*np.cos(angles)).flatten()
-y = (radii*np.sin(angles)).flatten()
-
-# Create the Triangulation; no triangles so Delaunay triangulation created.
-triang = tri.Triangulation(x, y)
-
-# Mask off unwanted triangles.
-xmid = x[triang.triangles].mean(axis=1)
-ymid = y[triang.triangles].mean(axis=1)
-mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0)
-triang.set_mask(mask)
-
-# Plot the triangulation.
-plt.figure()
-plt.gca().set_aspect('equal')
-plt.triplot(triang, 'bo-', lw=1)
-plt.title('triplot of Delaunay triangulation')
-
-
-# You can specify your own triangulation rather than perform a Delaunay
-# triangulation of the points, where each triangle is given by the indices of
-# the three points that make up the triangle, ordered in either a clockwise or
-# anticlockwise manner.
-
-xy = np.asarray([
-    [-0.101, 0.872], [-0.080, 0.883], [-0.069, 0.888], [-0.054, 0.890],
-    [-0.045, 0.897], [-0.057, 0.895], [-0.073, 0.900], [-0.087, 0.898],
-    [-0.090, 0.904], [-0.069, 0.907], [-0.069, 0.921], [-0.080, 0.919],
-    [-0.073, 0.928], [-0.052, 0.930], [-0.048, 0.942], [-0.062, 0.949],
-    [-0.054, 0.958], [-0.069, 0.954], [-0.087, 0.952], [-0.087, 0.959],
-    [-0.080, 0.966], [-0.085, 0.973], [-0.087, 0.965], [-0.097, 0.965],
-    [-0.097, 0.975], [-0.092, 0.984], [-0.101, 0.980], [-0.108, 0.980],
-    [-0.104, 0.987], [-0.102, 0.993], [-0.115, 1.001], [-0.099, 0.996],
-    [-0.101, 1.007], [-0.090, 1.010], [-0.087, 1.021], [-0.069, 1.021],
-    [-0.052, 1.022], [-0.052, 1.017], [-0.069, 1.010], [-0.064, 1.005],
-    [-0.048, 1.005], [-0.031, 1.005], [-0.031, 0.996], [-0.040, 0.987],
-    [-0.045, 0.980], [-0.052, 0.975], [-0.040, 0.973], [-0.026, 0.968],
-    [-0.020, 0.954], [-0.006, 0.947], [ 0.003, 0.935], [ 0.006, 0.926],
-    [ 0.005, 0.921], [ 0.022, 0.923], [ 0.033, 0.912], [ 0.029, 0.905],
-    [ 0.017, 0.900], [ 0.012, 0.895], [ 0.027, 0.893], [ 0.019, 0.886],
-    [ 0.001, 0.883], [-0.012, 0.884], [-0.029, 0.883], [-0.038, 0.879],
-    [-0.057, 0.881], [-0.062, 0.876], [-0.078, 0.876], [-0.087, 0.872],
-    [-0.030, 0.907], [-0.007, 0.905], [-0.057, 0.916], [-0.025, 0.933],
-    [-0.077, 0.990], [-0.059, 0.993]])
-x = np.degrees(xy[:, 0])
-y = np.degrees(xy[:, 1])
-
-triangles = np.asarray([
-    [67, 66,  1], [65,  2, 66], [ 1, 66,  2], [64,  2, 65], [63,  3, 64],
-    [60, 59, 57], [ 2, 64,  3], [ 3, 63,  4], [ 0, 67,  1], [62,  4, 63],
-    [57, 59, 56], [59, 58, 56], [61, 60, 69], [57, 69, 60], [ 4, 62, 68],
-    [ 6,  5,  9], [61, 68, 62], [69, 68, 61], [ 9,  5, 70], [ 6,  8,  7],
-    [ 4, 70,  5], [ 8,  6,  9], [56, 69, 57], [69, 56, 52], [70, 10,  9],
-    [54, 53, 55], [56, 55, 53], [68, 70,  4], [52, 56, 53], [11, 10, 12],
-    [69, 71, 68], [68, 13, 70], [10, 70, 13], [51, 50, 52], [13, 68, 71],
-    [52, 71, 69], [12, 10, 13], [71, 52, 50], [71, 14, 13], [50, 49, 71],
-    [49, 48, 71], [14, 16, 15], [14, 71, 48], [17, 19, 18], [17, 20, 19],
-    [48, 16, 14], [48, 47, 16], [47, 46, 16], [16, 46, 45], [23, 22, 24],
-    [21, 24, 22], [17, 16, 45], [20, 17, 45], [21, 25, 24], [27, 26, 28],
-    [20, 72, 21], [25, 21, 72], [45, 72, 20], [25, 28, 26], [44, 73, 45],
-    [72, 45, 73], [28, 25, 29], [29, 25, 31], [43, 73, 44], [73, 43, 40],
-    [72, 73, 39], [72, 31, 25], [42, 40, 43], [31, 30, 29], [39, 73, 40],
-    [42, 41, 40], [72, 33, 31], [32, 31, 33], [39, 38, 72], [33, 72, 38],
-    [33, 38, 34], [37, 35, 38], [34, 38, 35], [35, 37, 36]])
-
-# Rather than create a Triangulation object, can simply pass x, y and triangles
-# arrays to triplot directly.  It would be better to use a Triangulation object
-# if the same triangulation was to be used more than once to save duplicated
-# calculations.
-plt.figure()
-plt.gca().set_aspect('equal')
-plt.triplot(x, y, triangles, 'go-', lw=1.0)
-plt.title('triplot of user-specified triangulation')
-plt.xlabel('Longitude (degrees)')
-plt.ylabel('Latitude (degrees)')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/usetex_baseline_test.html b/examples/pylab_examples/usetex_baseline_test.html deleted file mode 100644 index d211c12d181..00000000000 --- a/examples/pylab_examples/usetex_baseline_test.html +++ /dev/null @@ -1,398 +0,0 @@ - - - - - - - - pylab_examples example code: usetex_baseline_test.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: usetex_baseline_test.py

-

(Source code, png, pdf)

-
-../../_images/usetex_baseline_test.png -
-
import matplotlib
-import matplotlib.pyplot as plt
-import matplotlib.axes as maxes
-
-from matplotlib import rcParams
-rcParams['text.usetex'] = True
-rcParams['text.latex.unicode'] = True
-
-
-class Axes(maxes.Axes):
-    """
-    A hackish way to simultaneously draw texts w/ usetex=True and
-    usetex=False in the same figure. It does not work in the ps backend.
-    """
-
-    def __init__(self, *kl, **kw):
-        self.usetex = kw.pop("usetex", "False")
-        self.preview = kw.pop("preview", "False")
-
-        maxes.Axes.__init__(self, *kl, **kw)
-
-    def draw(self, renderer):
-        usetex = plt.rcParams["text.usetex"]
-        preview = plt.rcParams["text.latex.preview"]
-        plt.rcParams["text.usetex"] = self.usetex
-        plt.rcParams["text.latex.preview"] = self.preview
-
-        maxes.Axes.draw(self, renderer)
-
-        plt.rcParams["text.usetex"] = usetex
-        plt.rcParams["text.latex.preview"] = preview
-
-subplot = maxes.subplot_class_factory(Axes)
-
-
-def test_window_extent(ax, usetex, preview):
-
-    va = "baseline"
-    ax.xaxis.set_visible(False)
-    ax.yaxis.set_visible(False)
-
-    #t = ax.text(0., 0., r"mlp", va="baseline", size=150)
-    text_kw = dict(va=va,
-                   size=50,
-                   bbox=dict(pad=0., ec="k", fc="none"))
-
-    test_strings = ["lg", r"$\frac{1}{2}\pi$",
-                    r"$p^{3^A}$", r"$p_{3_2}$"]
-
-    ax.axvline(0, color="r")
-
-    for i, s in enumerate(test_strings):
-
-        ax.axhline(i, color="r")
-        ax.text(0., 3 - i, s, **text_kw)
-
-    ax.set_xlim(-0.1, 1.1)
-    ax.set_ylim(-.8, 3.9)
-
-    ax.set_title("usetex=%s\npreview=%s" % (str(usetex), str(preview)))
-
-
-fig = plt.figure(figsize=(2.*3, 6.5))
-
-for i, usetex, preview in [[0, False, False],
-                           [1, True, False],
-                           [2, True, True]]:
-    ax = subplot(fig, 1, 3, i + 1, usetex=usetex, preview=preview)
-    fig.add_subplot(ax)
-    fig.subplots_adjust(top=0.85)
-
-    test_window_extent(ax, usetex=usetex, preview=preview)
-
-
-plt.draw()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/usetex_demo.html b/examples/pylab_examples/usetex_demo.html deleted file mode 100644 index f2b634a21aa..00000000000 --- a/examples/pylab_examples/usetex_demo.html +++ /dev/null @@ -1,392 +0,0 @@ - - - - - - - - pylab_examples example code: usetex_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: usetex_demo.py

-

(Source code, png, pdf)

-
-../../_images/usetex_demo.png -
-
import matplotlib
-matplotlib.rc('text', usetex=True)
-import matplotlib.pyplot as plt
-import numpy as np
-
-# interface tracking profiles
-N = 500
-delta = 0.6
-X = np.linspace(-1, 1, N)
-plt.plot(X, (1 - np.tanh(4.*X/delta))/2,    # phase field tanh profiles
-           X, (X + 1)/2,                      # level set distance function
-           X, (1.4 + np.tanh(4.*X/delta))/4,  # composition profile
-           X, X < 0, 'k--',                   # sharp interface
-           )
-
-# legend
-plt.legend(('phase field', 'level set', 'composition', 'sharp interface'), shadow=True, loc=(0.01, 0.55))
-
-ltext = plt.gca().get_legend().get_texts()
-plt.setp(ltext[0], fontsize=20)
-plt.setp(ltext[1], fontsize=20)
-plt.setp(ltext[2], fontsize=20)
-plt.setp(ltext[3], fontsize=20)
-
-# the arrow
-height = 0.1
-offset = 0.02
-plt.plot((-delta / 2., delta / 2), (height, height), 'k', linewidth=2)
-plt.plot((-delta / 2, -delta / 2 + offset * 2), (height, height - offset), 'k', linewidth=2)
-plt.plot((-delta / 2, -delta / 2 + offset * 2), (height, height + offset), 'k', linewidth=2)
-plt.plot((delta / 2, delta / 2 - offset * 2), (height, height - offset), 'k', linewidth=2)
-plt.plot((delta / 2, delta / 2 - offset * 2), (height, height + offset), 'k', linewidth=2)
-plt.text(-0.06, height - 0.06, r'$\delta$', {'color': 'k', 'fontsize': 24})
-
-# X-axis label
-plt.xticks((-1, 0, 1), ('-1', '0', '1'), color='k', size=20)
-
-# Left Y-axis labels
-plt.ylabel(r'\bf{phase field} $\phi$', {'color': 'b',
-                                          'fontsize': 20})
-plt.yticks((0, 0.5, 1), ('0', '.5', '1'), color='k', size=20)
-
-# Right Y-axis labels
-plt.text(1.05, 0.5, r"\bf{level set} $\phi$", {'color': 'g', 'fontsize': 20},
-           horizontalalignment='left',
-           verticalalignment='center',
-           rotation=90,
-           clip_on=False)
-plt.text(1.01, -0.02, "-1", {'color': 'k', 'fontsize': 20})
-plt.text(1.01, 0.98, "1", {'color': 'k', 'fontsize': 20})
-plt.text(1.01, 0.48, "0", {'color': 'k', 'fontsize': 20})
-
-# level set equations
-plt.text(0.1, 0.85,
-           r'$|\nabla\phi| = 1,$ \newline $ \frac{\partial \phi}{\partial t}'
-           r'+ U|\nabla \phi| = 0$',
-           {'color': 'g', 'fontsize': 20})
-
-# phase field equations
-plt.text(0.2, 0.15,
-           r'$\mathcal{F} = \int f\left( \phi, c \right) dV,$ \newline '
-           r'$ \frac{ \partial \phi } { \partial t } = -M_{ \phi } '
-           r'\frac{ \delta \mathcal{F} } { \delta \phi }$',
-           {'color': 'b', 'fontsize': 20})
-
-# these went wrong in pdf in a previous version
-plt.text(-.9, .42, r'gamma: $\gamma$', {'color': 'r', 'fontsize': 20})
-plt.text(-.9, .36, r'Omega: $\Omega$', {'color': 'b', 'fontsize': 20})
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/usetex_fonteffects.html b/examples/pylab_examples/usetex_fonteffects.html deleted file mode 100644 index 56bb8c5efe6..00000000000 --- a/examples/pylab_examples/usetex_fonteffects.html +++ /dev/null @@ -1,345 +0,0 @@ - - - - - - - - pylab_examples example code: usetex_fonteffects.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: usetex_fonteffects.py

-

(Source code, png, pdf)

-
-../../_images/usetex_fonteffects.png -
-
# This script demonstrates that font effects specified in your pdftex.map
-# are now supported in pdf usetex.
-
-import matplotlib
-import matplotlib.pyplot as plt
-matplotlib.rc('text', usetex=True)
-
-
-def setfont(font):
-    return r'\font\a %s at 14pt\a ' % font
-
-for y, font, text in zip(range(5),
-                         ['ptmr8r', 'ptmri8r', 'ptmro8r', 'ptmr8rn', 'ptmrr8re'],
-                         ['Nimbus Roman No9 L ' + x for x in
-                          ['', 'Italics (real italics for comparison)',
-                           '(slanted)', '(condensed)', '(extended)']]):
-    plt.text(0, y, setfont(font) + text)
-
-plt.ylim(-1, 5)
-plt.xlim(-0.2, 0.6)
-plt.setp(plt.gca(), frame_on=False, xticks=(), yticks=())
-plt.title('Usetex font effects')
-plt.savefig('usetex_fonteffects.pdf')
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/vline_hline_demo.html b/examples/pylab_examples/vline_hline_demo.html deleted file mode 100644 index c92ed0e3dcb..00000000000 --- a/examples/pylab_examples/vline_hline_demo.html +++ /dev/null @@ -1,355 +0,0 @@ - - - - - - - - pylab_examples example code: vline_hline_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: vline_hline_demo.py

-

(Source code, png, pdf)

-
-../../_images/vline_hline_demo1.png -
-
"""
-Small demonstration of the hlines and vlines plots.
-"""
-
-import matplotlib.pyplot as plt
-import numpy as np
-import numpy.random as rnd
-
-
-def f(t):
-    s1 = np.sin(2 * np.pi * t)
-    e1 = np.exp(-t)
-    return np.absolute((s1 * e1)) + .05
-
-t = np.arange(0.0, 5.0, 0.1)
-s = f(t)
-nse = rnd.normal(0.0, 0.3, t.shape) * s
-
-fig = plt.figure(figsize=(12, 6))
-vax = fig.add_subplot(121)
-hax = fig.add_subplot(122)
-
-vax.plot(t, s + nse, '^')
-vax.vlines(t, [0], s)
-vax.set_xlabel('time (s)')
-vax.set_title('Vertical lines demo')
-
-hax.plot(s + nse, t, '^')
-hax.hlines(t, [0], s, lw=2)
-hax.set_xlabel('time (s)')
-hax.set_title('Horizontal lines demo')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/webapp_demo.html b/examples/pylab_examples/webapp_demo.html deleted file mode 100644 index 68333d98bf9..00000000000 --- a/examples/pylab_examples/webapp_demo.html +++ /dev/null @@ -1,377 +0,0 @@ - - - - - - - - pylab_examples example code: webapp_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: webapp_demo.py

-

[source code]

-
# -*- noplot -*-
-"""
-This example shows how to use the agg backend directly to create
-images, which may be of use to web application developers who want
-full control over their code without using the pyplot interface to
-manage figures, figure closing etc.
-
-.. note::
-
-    It is not necessary to avoid using the pyplot interface in order to
-    create figures without a graphical front-end - simply setting
-    the backend to "Agg" would be sufficient.
-
-
-It is also worth noting that, because matplotlib can save figures to file-like
-object, matplotlib can also be used inside a cgi-script *without* needing to
-write a figure to disk.
-
-"""
-
-from matplotlib.backends.backend_agg import FigureCanvasAgg
-from matplotlib.figure import Figure
-import numpy as np
-
-
-def make_fig():
-    """
-    Make a figure and save it to "webagg.png".
-
-    """
-    fig = Figure()
-    ax = fig.add_subplot(1, 1, 1)
-
-    ax.plot([1, 2, 3], 'ro--', markersize=12, markerfacecolor='g')
-
-    # make a translucent scatter collection
-    x = np.random.rand(100)
-    y = np.random.rand(100)
-    area = np.pi * (10 * np.random.rand(100)) ** 2  # 0 to 10 point radii
-    c = ax.scatter(x, y, area)
-    c.set_alpha(0.5)
-
-    # add some text decoration
-    ax.set_title('My first image')
-    ax.set_ylabel('Some numbers')
-    ax.set_xticks((.2, .4, .6, .8))
-    labels = ax.set_xticklabels(('Bill', 'Fred', 'Ted', 'Ed'))
-
-    # To set object properties, you can either iterate over the
-    # objects manually, or define you own set command, as in setapi
-    # above.
-    for label in labels:
-        label.set_rotation(45)
-        label.set_fontsize(12)
-
-    FigureCanvasAgg(fig).print_png('webapp.png', dpi=150)
-
-make_fig()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/webapp_demo.py b/examples/pylab_examples/webapp_demo.py deleted file mode 100644 index 273fcbd70ed..00000000000 --- a/examples/pylab_examples/webapp_demo.py +++ /dev/null @@ -1,58 +0,0 @@ -# -*- noplot -*- -""" -This example shows how to use the agg backend directly to create -images, which may be of use to web application developers who want -full control over their code without using the pyplot interface to -manage figures, figure closing etc. - -.. note:: - - It is not necessary to avoid using the pyplot interface in order to - create figures without a graphical front-end - simply setting - the backend to "Agg" would be sufficient. - - -It is also worth noting that, because matplotlib can save figures to file-like -object, matplotlib can also be used inside a cgi-script *without* needing to -write a figure to disk. - -""" - -from matplotlib.backends.backend_agg import FigureCanvasAgg -from matplotlib.figure import Figure -import numpy as np - - -def make_fig(): - """ - Make a figure and save it to "webagg.png". - - """ - fig = Figure() - ax = fig.add_subplot(1, 1, 1) - - ax.plot([1, 2, 3], 'ro--', markersize=12, markerfacecolor='g') - - # make a translucent scatter collection - x = np.random.rand(100) - y = np.random.rand(100) - area = np.pi * (10 * np.random.rand(100)) ** 2 # 0 to 10 point radii - c = ax.scatter(x, y, area) - c.set_alpha(0.5) - - # add some text decoration - ax.set_title('My first image') - ax.set_ylabel('Some numbers') - ax.set_xticks((.2, .4, .6, .8)) - labels = ax.set_xticklabels(('Bill', 'Fred', 'Ted', 'Ed')) - - # To set object properties, you can either iterate over the - # objects manually, or define you own set command, as in setapi - # above. - for label in labels: - label.set_rotation(45) - label.set_fontsize(12) - - FigureCanvasAgg(fig).print_png('webapp.png', dpi=150) - -make_fig() diff --git a/examples/pylab_examples/xcorr_demo.html b/examples/pylab_examples/xcorr_demo.html deleted file mode 100644 index fdfc7f69fc9..00000000000 --- a/examples/pylab_examples/xcorr_demo.html +++ /dev/null @@ -1,341 +0,0 @@ - - - - - - - - pylab_examples example code: xcorr_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: xcorr_demo.py

-

(Source code, png, pdf)

-
-../../_images/xcorr_demo1.png -
-
import matplotlib.pyplot as plt
-import numpy as np
-
-
-np.random.seed(0)
-
-x, y = np.random.randn(2, 100)
-fig = plt.figure()
-ax1 = fig.add_subplot(211)
-ax1.xcorr(x, y, usevlines=True, maxlags=50, normed=True, lw=2)
-ax1.grid(True)
-ax1.axhline(0, color='black', lw=2)
-
-ax2 = fig.add_subplot(212, sharex=ax1)
-ax2.acorr(x, usevlines=True, normed=True, maxlags=50, lw=2)
-ax2.grid(True)
-ax2.axhline(0, color='black', lw=2)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pylab_examples/zorder_demo.html b/examples/pylab_examples/zorder_demo.html deleted file mode 100644 index 16089f2fe71..00000000000 --- a/examples/pylab_examples/zorder_demo.html +++ /dev/null @@ -1,378 +0,0 @@ - - - - - - - - pylab_examples example code: zorder_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pylab_examples example code: zorder_demo.py

-

(Source code)

-
-../../_images/zorder_demo_00.png -

(png, pdf)

-
-
-../../_images/zorder_demo_01.png -

(png, pdf)

-
-
"""
-The default drawing order for axes is patches, lines, text.  This
-order is determined by the zorder attribute.  The following defaults
-are set
-
-Artist                      Z-order
-Patch / PatchCollection      1
-Line2D / LineCollection      2
-Text                         3
-
-You can change the order for individual artists by setting the zorder.  Any
-individual plot() call can set a value for the zorder of that particular item.
-
-In the fist subplot below, the lines are drawn above the patch
-collection from the scatter, which is the default.
-
-In the subplot below, the order is reversed.
-
-The second figure shows how to control the zorder of individual lines.
-"""
-
-import matplotlib.pyplot as plt
-import numpy as np
-
-x = np.random.random(20)
-y = np.random.random(20)
-
-# Lines on top of scatter
-plt.figure()
-plt.subplot(211)
-plt.plot(x, y, 'r', lw=3)
-plt.scatter(x, y, s=120)
-plt.title('Lines on top of dots')
-
-# Scatter plot on top of lines
-plt.subplot(212)
-plt.plot(x, y, 'r', zorder=1, lw=3)
-plt.scatter(x, y, s=120, zorder=2)
-plt.title('Dots on top of lines')
-
-# A new figure, with individually ordered items
-x = np.linspace(0, 2*np.pi, 100)
-plt.figure()
-plt.plot(x, np.sin(x), linewidth=10, color='black', label='zorder=10', zorder=10)  # on top
-plt.plot(x, np.cos(1.3*x), linewidth=10, color='red', label='zorder=1', zorder=1)  # bottom
-plt.plot(x, np.sin(2.1*x), linewidth=10, color='green', label='zorder=3', zorder=3)
-plt.axhline(0, linewidth=10, color='blue', label='zorder=2', zorder=2)
-plt.title('Custom order of elements')
-l = plt.legend()
-l.set_zorder(20)  # put the legend on top
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/align_ylabels.html b/examples/pyplots/align_ylabels.html deleted file mode 100644 index 060aaef3c4a..00000000000 --- a/examples/pyplots/align_ylabels.html +++ /dev/null @@ -1,356 +0,0 @@ - - - - - - - - pyplots example code: align_ylabels.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: align_ylabels.py

-

[source code]

-
import numpy as np
-import matplotlib.pyplot as plt
-
-box = dict(facecolor='yellow', pad=5, alpha=0.2)
-
-fig = plt.figure()
-fig.subplots_adjust(left=0.2, wspace=0.6)
-
-# Fixing random state for reproducibility
-np.random.seed(19680801)
-
-ax1 = fig.add_subplot(221)
-ax1.plot(2000*np.random.rand(10))
-ax1.set_title('ylabels not aligned')
-ax1.set_ylabel('misaligned 1', bbox=box)
-ax1.set_ylim(0, 2000)
-ax3 = fig.add_subplot(223)
-ax3.set_ylabel('misaligned 2',bbox=box)
-ax3.plot(np.random.rand(10))
-
-
-labelx = -0.3  # axes coords
-
-ax2 = fig.add_subplot(222)
-ax2.set_title('ylabels aligned')
-ax2.plot(2000*np.random.rand(10))
-ax2.set_ylabel('aligned 1', bbox=box)
-ax2.yaxis.set_label_coords(labelx, 0.5)
-ax2.set_ylim(0, 2000)
-
-ax4 = fig.add_subplot(224)
-ax4.plot(np.random.rand(10))
-ax4.set_ylabel('aligned 2', bbox=box)
-ax4.yaxis.set_label_coords(labelx, 0.5)
-
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/align_ylabels.py b/examples/pyplots/align_ylabels.py deleted file mode 100644 index 44f78845b68..00000000000 --- a/examples/pyplots/align_ylabels.py +++ /dev/null @@ -1,37 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -box = dict(facecolor='yellow', pad=5, alpha=0.2) - -fig = plt.figure() -fig.subplots_adjust(left=0.2, wspace=0.6) - -# Fixing random state for reproducibility -np.random.seed(19680801) - -ax1 = fig.add_subplot(221) -ax1.plot(2000*np.random.rand(10)) -ax1.set_title('ylabels not aligned') -ax1.set_ylabel('misaligned 1', bbox=box) -ax1.set_ylim(0, 2000) -ax3 = fig.add_subplot(223) -ax3.set_ylabel('misaligned 2',bbox=box) -ax3.plot(np.random.rand(10)) - - -labelx = -0.3 # axes coords - -ax2 = fig.add_subplot(222) -ax2.set_title('ylabels aligned') -ax2.plot(2000*np.random.rand(10)) -ax2.set_ylabel('aligned 1', bbox=box) -ax2.yaxis.set_label_coords(labelx, 0.5) -ax2.set_ylim(0, 2000) - -ax4 = fig.add_subplot(224) -ax4.plot(np.random.rand(10)) -ax4.set_ylabel('aligned 2', bbox=box) -ax4.yaxis.set_label_coords(labelx, 0.5) - - -plt.show() diff --git a/examples/pyplots/annotate_transform.html b/examples/pyplots/annotate_transform.html deleted file mode 100644 index 7b6529ce33d..00000000000 --- a/examples/pyplots/annotate_transform.html +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - pyplots example code: annotate_transform.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: annotate_transform.py

-

[source code]

-
import numpy as np
-import matplotlib.pyplot as plt
-
-x = np.arange(0, 10, 0.005)
-y = np.exp(-x/2.) * np.sin(2*np.pi*x)
-
-fig = plt.figure()
-ax = fig.add_subplot(111)
-ax.plot(x, y)
-ax.set_xlim(0, 10)
-ax.set_ylim(-1, 1)
-
-xdata, ydata = 5, 0
-xdisplay, ydisplay = ax.transData.transform_point((xdata, ydata))
-
-bbox = dict(boxstyle="round", fc="0.8")
-arrowprops = dict(
-    arrowstyle = "->",
-    connectionstyle = "angle,angleA=0,angleB=90,rad=10")
-
-offset = 72
-ax.annotate('data = (%.1f, %.1f)'%(xdata, ydata),
-            (xdata, ydata), xytext=(-2*offset, offset), textcoords='offset points',
-            bbox=bbox, arrowprops=arrowprops)
-
-
-disp = ax.annotate('display = (%.1f, %.1f)'%(xdisplay, ydisplay),
-            (xdisplay, ydisplay), xytext=(0.5*offset, -offset),
-            xycoords='figure pixels',
-            textcoords='offset points',
-            bbox=bbox, arrowprops=arrowprops)
-
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/annotate_transform.py b/examples/pyplots/annotate_transform.py deleted file mode 100644 index c3abd236985..00000000000 --- a/examples/pyplots/annotate_transform.py +++ /dev/null @@ -1,34 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -x = np.arange(0, 10, 0.005) -y = np.exp(-x/2.) * np.sin(2*np.pi*x) - -fig = plt.figure() -ax = fig.add_subplot(111) -ax.plot(x, y) -ax.set_xlim(0, 10) -ax.set_ylim(-1, 1) - -xdata, ydata = 5, 0 -xdisplay, ydisplay = ax.transData.transform_point((xdata, ydata)) - -bbox = dict(boxstyle="round", fc="0.8") -arrowprops = dict( - arrowstyle = "->", - connectionstyle = "angle,angleA=0,angleB=90,rad=10") - -offset = 72 -ax.annotate('data = (%.1f, %.1f)'%(xdata, ydata), - (xdata, ydata), xytext=(-2*offset, offset), textcoords='offset points', - bbox=bbox, arrowprops=arrowprops) - - -disp = ax.annotate('display = (%.1f, %.1f)'%(xdisplay, ydisplay), - (xdisplay, ydisplay), xytext=(0.5*offset, -offset), - xycoords='figure pixels', - textcoords='offset points', - bbox=bbox, arrowprops=arrowprops) - - -plt.show() diff --git a/examples/pyplots/annotation_basic.html b/examples/pyplots/annotation_basic.html deleted file mode 100644 index 9ad76f58793..00000000000 --- a/examples/pyplots/annotation_basic.html +++ /dev/null @@ -1,335 +0,0 @@ - - - - - - - - pyplots example code: annotation_basic.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: annotation_basic.py

-

[source code]

-
import numpy as np
-import matplotlib.pyplot as plt
-
-fig = plt.figure()
-ax = fig.add_subplot(111)
-
-t = np.arange(0.0, 5.0, 0.01)
-s = np.cos(2*np.pi*t)
-line, = ax.plot(t, s, lw=2)
-
-ax.annotate('local max', xy=(2, 1), xytext=(3, 1.5),
-            arrowprops=dict(facecolor='black', shrink=0.05),
-            )
-
-ax.set_ylim(-2,2)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/annotation_basic.py b/examples/pyplots/annotation_basic.py deleted file mode 100644 index 846afd7b901..00000000000 --- a/examples/pyplots/annotation_basic.py +++ /dev/null @@ -1,16 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -fig = plt.figure() -ax = fig.add_subplot(111) - -t = np.arange(0.0, 5.0, 0.01) -s = np.cos(2*np.pi*t) -line, = ax.plot(t, s, lw=2) - -ax.annotate('local max', xy=(2, 1), xytext=(3, 1.5), - arrowprops=dict(facecolor='black', shrink=0.05), - ) - -ax.set_ylim(-2,2) -plt.show() diff --git a/examples/pyplots/annotation_polar.html b/examples/pyplots/annotation_polar.html deleted file mode 100644 index 60e8c155c7b..00000000000 --- a/examples/pyplots/annotation_polar.html +++ /dev/null @@ -1,340 +0,0 @@ - - - - - - - - pyplots example code: annotation_polar.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: annotation_polar.py

-

[source code]

-
import numpy as np
-import matplotlib.pyplot as plt
-
-fig = plt.figure()
-ax = fig.add_subplot(111, polar=True)
-r = np.arange(0,1,0.001)
-theta = 2*2*np.pi*r
-line, = ax.plot(theta, r, color='#ee8d18', lw=3)
-
-ind = 800
-thisr, thistheta = r[ind], theta[ind]
-ax.plot([thistheta], [thisr], 'o')
-ax.annotate('a polar annotation',
-            xy=(thistheta, thisr),  # theta, radius
-            xytext=(0.05, 0.05),    # fraction, fraction
-            textcoords='figure fraction',
-            arrowprops=dict(facecolor='black', shrink=0.05),
-            horizontalalignment='left',
-            verticalalignment='bottom',
-            )
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/annotation_polar.py b/examples/pyplots/annotation_polar.py deleted file mode 100644 index 9eba8cfe0d7..00000000000 --- a/examples/pyplots/annotation_polar.py +++ /dev/null @@ -1,21 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -fig = plt.figure() -ax = fig.add_subplot(111, polar=True) -r = np.arange(0,1,0.001) -theta = 2*2*np.pi*r -line, = ax.plot(theta, r, color='#ee8d18', lw=3) - -ind = 800 -thisr, thistheta = r[ind], theta[ind] -ax.plot([thistheta], [thisr], 'o') -ax.annotate('a polar annotation', - xy=(thistheta, thisr), # theta, radius - xytext=(0.05, 0.05), # fraction, fraction - textcoords='figure fraction', - arrowprops=dict(facecolor='black', shrink=0.05), - horizontalalignment='left', - verticalalignment='bottom', - ) -plt.show() diff --git a/examples/pyplots/auto_subplots_adjust.html b/examples/pyplots/auto_subplots_adjust.html deleted file mode 100644 index eb7c36cbe50..00000000000 --- a/examples/pyplots/auto_subplots_adjust.html +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - pyplots example code: auto_subplots_adjust.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: auto_subplots_adjust.py

-

[source code]

-
import matplotlib.pyplot as plt
-import matplotlib.transforms as mtransforms
-fig = plt.figure()
-ax = fig.add_subplot(111)
-ax.plot(range(10))
-ax.set_yticks((2,5,7))
-labels = ax.set_yticklabels(('really, really, really', 'long', 'labels'))
-
-def on_draw(event):
-   bboxes = []
-   for label in labels:
-       bbox = label.get_window_extent()
-       # the figure transform goes from relative coords->pixels and we
-       # want the inverse of that
-       bboxi = bbox.inverse_transformed(fig.transFigure)
-       bboxes.append(bboxi)
-
-   # this is the bbox that bounds all the bboxes, again in relative
-   # figure coords
-   bbox = mtransforms.Bbox.union(bboxes)
-   if fig.subplotpars.left < bbox.width:
-       # we need to move it over
-       fig.subplots_adjust(left=1.1*bbox.width) # pad a little
-       fig.canvas.draw()
-   return False
-
-fig.canvas.mpl_connect('draw_event', on_draw)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/auto_subplots_adjust.py b/examples/pyplots/auto_subplots_adjust.py deleted file mode 100644 index ca7f04144be..00000000000 --- a/examples/pyplots/auto_subplots_adjust.py +++ /dev/null @@ -1,30 +0,0 @@ -import matplotlib.pyplot as plt -import matplotlib.transforms as mtransforms -fig = plt.figure() -ax = fig.add_subplot(111) -ax.plot(range(10)) -ax.set_yticks((2,5,7)) -labels = ax.set_yticklabels(('really, really, really', 'long', 'labels')) - -def on_draw(event): - bboxes = [] - for label in labels: - bbox = label.get_window_extent() - # the figure transform goes from relative coords->pixels and we - # want the inverse of that - bboxi = bbox.inverse_transformed(fig.transFigure) - bboxes.append(bboxi) - - # this is the bbox that bounds all the bboxes, again in relative - # figure coords - bbox = mtransforms.Bbox.union(bboxes) - if fig.subplotpars.left < bbox.width: - # we need to move it over - fig.subplots_adjust(left=1.1*bbox.width) # pad a little - fig.canvas.draw() - return False - -fig.canvas.mpl_connect('draw_event', on_draw) - -plt.show() - diff --git a/examples/pyplots/boxplot_demo.html b/examples/pyplots/boxplot_demo.html deleted file mode 100644 index 2a550436732..00000000000 --- a/examples/pyplots/boxplot_demo.html +++ /dev/null @@ -1,383 +0,0 @@ - - - - - - - - pyplots example code: boxplot_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: boxplot_demo.py

-

[source code]

-
#!/usr/bin/python
-
-#
-# Example boxplot code
-#
-
-import numpy as np
-import matplotlib.pyplot as plt
-
-# Fixing random state for reproducibility
-np.random.seed(19680801)
-
-# fake up some data
-spread = np.random.rand(50) * 100
-center = np.ones(25) * 50
-flier_high = np.random.rand(10) * 100 + 100
-flier_low = np.random.rand(10) * -100
-data = np.concatenate((spread, center, flier_high, flier_low), 0)
-
-fig1, ax1 = plt.subplots()
-ax1.set_title('Basic Plot')
-ax1.boxplot(data)
-
-fig2, ax2 = plt.subplots()
-ax2.set_title('Notched boxes')
-ax2.boxplot(data, notch=True)
-
-green_diamond = dict(markerfacecolor='g', marker='D')
-fig3, ax3 = plt.subplots()
-ax3.set_title('Changed Outlier Symbols')
-ax3.boxplot(data, flierprops=green_diamond)
-
-fig4, ax4 = plt.subplots()
-ax4.set_title('Hide Outlier Points')
-ax4.boxplot(data, showfliers=False)
-
-red_square = dict(markerfacecolor='r', marker='s')
-fig5, ax5 = plt.subplots()
-ax5.set_title('Horizontal Boxes')
-ax5.boxplot(data, vert=False, flierprops=red_square)
-
-fig6, ax6 = plt.subplots()
-ax6.set_title('Shorter Whisker Length')
-ax6.boxplot(data, flierprops=red_square, vert=False, whis=0.75)
-
-# fake up some more data
-spread = np.random.rand(50) * 100
-center = np.ones(25) * 40
-flier_high = np.random.rand(10) * 100 + 100
-flier_low = np.random.rand(10) * -100
-d2 = np.concatenate((spread, center, flier_high, flier_low), 0)
-data.shape = (-1, 1)
-d2.shape = (-1, 1)
-
-# Making a 2-D array only works if all the columns are the
-# same length.  If they are not, then use a list instead.
-# This is actually more efficient because boxplot converts
-# a 2-D array into a list of vectors internally anyway.
-data = [data, d2, d2[::2,0]]
-fig7, ax7 = plt.subplots()
-ax7.set_title('Multiple Samples with Different sizes')
-ax7.boxplot(data)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/boxplot_demo.py b/examples/pyplots/boxplot_demo.py deleted file mode 100644 index 9c38f0aa9e4..00000000000 --- a/examples/pyplots/boxplot_demo.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/python - -# -# Example boxplot code -# - -import numpy as np -import matplotlib.pyplot as plt - -# Fixing random state for reproducibility -np.random.seed(19680801) - -# fake up some data -spread = np.random.rand(50) * 100 -center = np.ones(25) * 50 -flier_high = np.random.rand(10) * 100 + 100 -flier_low = np.random.rand(10) * -100 -data = np.concatenate((spread, center, flier_high, flier_low), 0) - -fig1, ax1 = plt.subplots() -ax1.set_title('Basic Plot') -ax1.boxplot(data) - -fig2, ax2 = plt.subplots() -ax2.set_title('Notched boxes') -ax2.boxplot(data, notch=True) - -green_diamond = dict(markerfacecolor='g', marker='D') -fig3, ax3 = plt.subplots() -ax3.set_title('Changed Outlier Symbols') -ax3.boxplot(data, flierprops=green_diamond) - -fig4, ax4 = plt.subplots() -ax4.set_title('Hide Outlier Points') -ax4.boxplot(data, showfliers=False) - -red_square = dict(markerfacecolor='r', marker='s') -fig5, ax5 = plt.subplots() -ax5.set_title('Horizontal Boxes') -ax5.boxplot(data, vert=False, flierprops=red_square) - -fig6, ax6 = plt.subplots() -ax6.set_title('Shorter Whisker Length') -ax6.boxplot(data, flierprops=red_square, vert=False, whis=0.75) - -# fake up some more data -spread = np.random.rand(50) * 100 -center = np.ones(25) * 40 -flier_high = np.random.rand(10) * 100 + 100 -flier_low = np.random.rand(10) * -100 -d2 = np.concatenate((spread, center, flier_high, flier_low), 0) -data.shape = (-1, 1) -d2.shape = (-1, 1) - -# Making a 2-D array only works if all the columns are the -# same length. If they are not, then use a list instead. -# This is actually more efficient because boxplot converts -# a 2-D array into a list of vectors internally anyway. -data = [data, d2, d2[::2,0]] -fig7, ax7 = plt.subplots() -ax7.set_title('Multiple Samples with Different sizes') -ax7.boxplot(data) - -plt.show() diff --git a/examples/pyplots/compound_path_demo.html b/examples/pyplots/compound_path_demo.html deleted file mode 100644 index 5cfe19c4d81..00000000000 --- a/examples/pyplots/compound_path_demo.html +++ /dev/null @@ -1,364 +0,0 @@ - - - - - - - - pyplots example code: compound_path_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: compound_path_demo.py

-

[source code]

-
import numpy as np
-
-import matplotlib.pyplot as plt
-import matplotlib.patches as patches
-import matplotlib.path as path
-
-fig = plt.figure()
-ax = fig.add_subplot(111)
-
-# Fixing random state for reproducibility
-np.random.seed(19680801)
-
-# histogram our data with numpy
-data = np.random.randn(1000)
-n, bins = np.histogram(data, 100)
-
-# get the corners of the rectangles for the histogram
-left = np.array(bins[:-1])
-right = np.array(bins[1:])
-bottom = np.zeros(len(left))
-top = bottom + n
-nrects = len(left)
-
-nverts = nrects*(1+3+1)
-verts = np.zeros((nverts, 2))
-codes = np.ones(nverts, int) * path.Path.LINETO
-codes[0::5] = path.Path.MOVETO
-codes[4::5] = path.Path.CLOSEPOLY
-verts[0::5,0] = left
-verts[0::5,1] = bottom
-verts[1::5,0] = left
-verts[1::5,1] = top
-verts[2::5,0] = right
-verts[2::5,1] = top
-verts[3::5,0] = right
-verts[3::5,1] = bottom
-
-barpath = path.Path(verts, codes)
-patch = patches.PathPatch(barpath, facecolor='green', edgecolor='yellow', alpha=0.5)
-ax.add_patch(patch)
-
-ax.set_xlim(left[0], right[-1])
-ax.set_ylim(bottom.min(), top.max())
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/compound_path_demo.py b/examples/pyplots/compound_path_demo.py deleted file mode 100644 index ed7e7d6ce32..00000000000 --- a/examples/pyplots/compound_path_demo.py +++ /dev/null @@ -1,45 +0,0 @@ -import numpy as np - -import matplotlib.pyplot as plt -import matplotlib.patches as patches -import matplotlib.path as path - -fig = plt.figure() -ax = fig.add_subplot(111) - -# Fixing random state for reproducibility -np.random.seed(19680801) - -# histogram our data with numpy -data = np.random.randn(1000) -n, bins = np.histogram(data, 100) - -# get the corners of the rectangles for the histogram -left = np.array(bins[:-1]) -right = np.array(bins[1:]) -bottom = np.zeros(len(left)) -top = bottom + n -nrects = len(left) - -nverts = nrects*(1+3+1) -verts = np.zeros((nverts, 2)) -codes = np.ones(nverts, int) * path.Path.LINETO -codes[0::5] = path.Path.MOVETO -codes[4::5] = path.Path.CLOSEPOLY -verts[0::5,0] = left -verts[0::5,1] = bottom -verts[1::5,0] = left -verts[1::5,1] = top -verts[2::5,0] = right -verts[2::5,1] = top -verts[3::5,0] = right -verts[3::5,1] = bottom - -barpath = path.Path(verts, codes) -patch = patches.PathPatch(barpath, facecolor='green', edgecolor='yellow', alpha=0.5) -ax.add_patch(patch) - -ax.set_xlim(left[0], right[-1]) -ax.set_ylim(bottom.min(), top.max()) - -plt.show() diff --git a/examples/pyplots/dollar_ticks.html b/examples/pyplots/dollar_ticks.html deleted file mode 100644 index 4d55e33a390..00000000000 --- a/examples/pyplots/dollar_ticks.html +++ /dev/null @@ -1,339 +0,0 @@ - - - - - - - - pyplots example code: dollar_ticks.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: dollar_ticks.py

-

[source code]

-
import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.ticker as ticker
-
-# Fixing random state for reproducibility
-np.random.seed(19680801)
-
-fig = plt.figure()
-ax = fig.add_subplot(111)
-ax.plot(100*np.random.rand(20))
-
-formatter = ticker.FormatStrFormatter('$%1.2f')
-ax.yaxis.set_major_formatter(formatter)
-
-for tick in ax.yaxis.get_major_ticks():
-    tick.label1On = False
-    tick.label2On = True
-    tick.label2.set_color('green')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/dollar_ticks.py b/examples/pyplots/dollar_ticks.py deleted file mode 100644 index ca1069dabb7..00000000000 --- a/examples/pyplots/dollar_ticks.py +++ /dev/null @@ -1,20 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.ticker as ticker - -# Fixing random state for reproducibility -np.random.seed(19680801) - -fig = plt.figure() -ax = fig.add_subplot(111) -ax.plot(100*np.random.rand(20)) - -formatter = ticker.FormatStrFormatter('$%1.2f') -ax.yaxis.set_major_formatter(formatter) - -for tick in ax.yaxis.get_major_ticks(): - tick.label1On = False - tick.label2On = True - tick.label2.set_color('green') - -plt.show() diff --git a/examples/pyplots/fig_axes_customize_simple.html b/examples/pyplots/fig_axes_customize_simple.html deleted file mode 100644 index 12cc9de5b05..00000000000 --- a/examples/pyplots/fig_axes_customize_simple.html +++ /dev/null @@ -1,345 +0,0 @@ - - - - - - - - pyplots example code: fig_axes_customize_simple.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: fig_axes_customize_simple.py

-

[source code]

-
import numpy as np
-import matplotlib.pyplot as plt
-
-# plt.figure creates a matplotlib.figure.Figure instance
-fig = plt.figure()
-rect = fig.patch # a rectangle instance
-rect.set_facecolor('lightgoldenrodyellow')
-
-ax1 = fig.add_axes([0.1, 0.3, 0.4, 0.4])
-rect = ax1.patch
-rect.set_facecolor('lightslategray')
-
-
-for label in ax1.xaxis.get_ticklabels():
-    # label is a Text instance
-    label.set_color('red')
-    label.set_rotation(45)
-    label.set_fontsize(16)
-
-for line in ax1.yaxis.get_ticklines():
-    # line is a Line2D instance
-    line.set_color('green')
-    line.set_markersize(25)
-    line.set_markeredgewidth(3)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/fig_axes_customize_simple.py b/examples/pyplots/fig_axes_customize_simple.py deleted file mode 100644 index ab557794e70..00000000000 --- a/examples/pyplots/fig_axes_customize_simple.py +++ /dev/null @@ -1,26 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -# plt.figure creates a matplotlib.figure.Figure instance -fig = plt.figure() -rect = fig.patch # a rectangle instance -rect.set_facecolor('lightgoldenrodyellow') - -ax1 = fig.add_axes([0.1, 0.3, 0.4, 0.4]) -rect = ax1.patch -rect.set_facecolor('lightslategray') - - -for label in ax1.xaxis.get_ticklabels(): - # label is a Text instance - label.set_color('red') - label.set_rotation(45) - label.set_fontsize(16) - -for line in ax1.yaxis.get_ticklines(): - # line is a Line2D instance - line.set_color('green') - line.set_markersize(25) - line.set_markeredgewidth(3) - -plt.show() diff --git a/examples/pyplots/fig_axes_labels_simple.html b/examples/pyplots/fig_axes_labels_simple.html deleted file mode 100644 index 71565d0a5a9..00000000000 --- a/examples/pyplots/fig_axes_labels_simple.html +++ /dev/null @@ -1,341 +0,0 @@ - - - - - - - - pyplots example code: fig_axes_labels_simple.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: fig_axes_labels_simple.py

-

[source code]

-
import numpy as np
-import matplotlib.pyplot as plt
-
-fig = plt.figure()
-fig.subplots_adjust(top=0.8)
-ax1 = fig.add_subplot(211)
-ax1.set_ylabel('volts')
-ax1.set_title('a sine wave')
-
-t = np.arange(0.0, 1.0, 0.01)
-s = np.sin(2*np.pi*t)
-line, = ax1.plot(t, s, color='blue', lw=2)
-
-# Fixing random state for reproducibility
-np.random.seed(19680801)
-
-ax2 = fig.add_axes([0.15, 0.1, 0.7, 0.3])
-n, bins, patches = ax2.hist(np.random.randn(1000), 50,
-    facecolor='yellow', edgecolor='yellow')
-ax2.set_xlabel('time (s)')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/fig_axes_labels_simple.py b/examples/pyplots/fig_axes_labels_simple.py deleted file mode 100644 index 50b6dd65f3e..00000000000 --- a/examples/pyplots/fig_axes_labels_simple.py +++ /dev/null @@ -1,22 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -fig = plt.figure() -fig.subplots_adjust(top=0.8) -ax1 = fig.add_subplot(211) -ax1.set_ylabel('volts') -ax1.set_title('a sine wave') - -t = np.arange(0.0, 1.0, 0.01) -s = np.sin(2*np.pi*t) -line, = ax1.plot(t, s, color='blue', lw=2) - -# Fixing random state for reproducibility -np.random.seed(19680801) - -ax2 = fig.add_axes([0.15, 0.1, 0.7, 0.3]) -n, bins, patches = ax2.hist(np.random.randn(1000), 50, - facecolor='yellow', edgecolor='yellow') -ax2.set_xlabel('time (s)') - -plt.show() diff --git a/examples/pyplots/fig_x.html b/examples/pyplots/fig_x.html deleted file mode 100644 index 9de44b0c355..00000000000 --- a/examples/pyplots/fig_x.html +++ /dev/null @@ -1,333 +0,0 @@ - - - - - - - - pyplots example code: fig_x.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: fig_x.py

-

[source code]

-
import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.lines as lines
-
-
-fig = plt.figure()
-
-l1 = lines.Line2D([0, 1], [0, 1], transform=fig.transFigure, figure=fig)
-
-l2 = lines.Line2D([0, 1], [1, 0], transform=fig.transFigure, figure=fig)
-
-fig.lines.extend([l1, l2])
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/fig_x.py b/examples/pyplots/fig_x.py deleted file mode 100644 index c573f226630..00000000000 --- a/examples/pyplots/fig_x.py +++ /dev/null @@ -1,14 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.lines as lines - - -fig = plt.figure() - -l1 = lines.Line2D([0, 1], [0, 1], transform=fig.transFigure, figure=fig) - -l2 = lines.Line2D([0, 1], [1, 0], transform=fig.transFigure, figure=fig) - -fig.lines.extend([l1, l2]) - -plt.show() diff --git a/examples/pyplots/index.html b/examples/pyplots/index.html deleted file mode 100644 index de18d29b439..00000000000 --- a/examples/pyplots/index.html +++ /dev/null @@ -1,355 +0,0 @@ - - - - - - - - pyplots Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- - - - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/pyplot_annotate.html b/examples/pyplots/pyplot_annotate.html deleted file mode 100644 index ae873a74abb..00000000000 --- a/examples/pyplots/pyplot_annotate.html +++ /dev/null @@ -1,334 +0,0 @@ - - - - - - - - pyplots example code: pyplot_annotate.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: pyplot_annotate.py

-

[source code]

-
import numpy as np
-import matplotlib.pyplot as plt
-
-ax = plt.subplot(111)
-
-t = np.arange(0.0, 5.0, 0.01)
-s = np.cos(2*np.pi*t)
-line, = plt.plot(t, s, lw=2)
-
-plt.annotate('local max', xy=(2, 1), xytext=(3, 1.5),
-            arrowprops=dict(facecolor='black', shrink=0.05),
-            )
-
-plt.ylim(-2,2)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/pyplot_annotate.py b/examples/pyplots/pyplot_annotate.py deleted file mode 100644 index 88390ca7c07..00000000000 --- a/examples/pyplots/pyplot_annotate.py +++ /dev/null @@ -1,15 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -ax = plt.subplot(111) - -t = np.arange(0.0, 5.0, 0.01) -s = np.cos(2*np.pi*t) -line, = plt.plot(t, s, lw=2) - -plt.annotate('local max', xy=(2, 1), xytext=(3, 1.5), - arrowprops=dict(facecolor='black', shrink=0.05), - ) - -plt.ylim(-2,2) -plt.show() diff --git a/examples/pyplots/pyplot_formatstr.html b/examples/pyplots/pyplot_formatstr.html deleted file mode 100644 index e4a2fb3dc91..00000000000 --- a/examples/pyplots/pyplot_formatstr.html +++ /dev/null @@ -1,323 +0,0 @@ - - - - - - - - pyplots example code: pyplot_formatstr.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: pyplot_formatstr.py

-

[source code]

-
import matplotlib.pyplot as plt
-plt.plot([1,2,3,4], [1,4,9,16], 'ro')
-plt.axis([0, 6, 0, 20])
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/pyplot_formatstr.py b/examples/pyplots/pyplot_formatstr.py deleted file mode 100644 index b7a7786a602..00000000000 --- a/examples/pyplots/pyplot_formatstr.py +++ /dev/null @@ -1,4 +0,0 @@ -import matplotlib.pyplot as plt -plt.plot([1,2,3,4], [1,4,9,16], 'ro') -plt.axis([0, 6, 0, 20]) -plt.show() diff --git a/examples/pyplots/pyplot_mathtext.html b/examples/pyplots/pyplot_mathtext.html deleted file mode 100644 index d5caaf1c371..00000000000 --- a/examples/pyplots/pyplot_mathtext.html +++ /dev/null @@ -1,332 +0,0 @@ - - - - - - - - pyplots example code: pyplot_mathtext.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: pyplot_mathtext.py

-

[source code]

-
import numpy as np
-import matplotlib.pyplot as plt
-t = np.arange(0.0, 2.0, 0.01)
-s = np.sin(2*np.pi*t)
-
-plt.plot(t,s)
-plt.title(r'$\alpha_i > \beta_i$', fontsize=20)
-plt.text(1, -0.6, r'$\sum_{i=0}^\infty x_i$', fontsize=20)
-plt.text(0.6, 0.6, r'$\mathcal{A}\mathrm{sin}(2 \omega t)$',
-         fontsize=20)
-plt.xlabel('time (s)')
-plt.ylabel('volts (mV)')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/pyplot_mathtext.py b/examples/pyplots/pyplot_mathtext.py deleted file mode 100644 index d90f5cbb381..00000000000 --- a/examples/pyplots/pyplot_mathtext.py +++ /dev/null @@ -1,13 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -t = np.arange(0.0, 2.0, 0.01) -s = np.sin(2*np.pi*t) - -plt.plot(t,s) -plt.title(r'$\alpha_i > \beta_i$', fontsize=20) -plt.text(1, -0.6, r'$\sum_{i=0}^\infty x_i$', fontsize=20) -plt.text(0.6, 0.6, r'$\mathcal{A}\mathrm{sin}(2 \omega t)$', - fontsize=20) -plt.xlabel('time (s)') -plt.ylabel('volts (mV)') -plt.show() diff --git a/examples/pyplots/pyplot_scales.html b/examples/pyplots/pyplot_scales.html deleted file mode 100644 index ce5631ba880..00000000000 --- a/examples/pyplots/pyplot_scales.html +++ /dev/null @@ -1,374 +0,0 @@ - - - - - - - - pyplots example code: pyplot_scales.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: pyplot_scales.py

-

[source code]

-
import numpy as np
-import matplotlib.pyplot as plt
-
-from matplotlib.ticker import NullFormatter  # useful for `logit` scale
-
-# Fixing random state for reproducibility
-np.random.seed(19680801)
-
-# make up some data in the interval ]0, 1[
-y = np.random.normal(loc=0.5, scale=0.4, size=1000)
-y = y[(y > 0) & (y < 1)]
-y.sort()
-x = np.arange(len(y))
-
-# plot with various axes scales
-plt.figure(1)
-
-# linear
-plt.subplot(221)
-plt.plot(x, y)
-plt.yscale('linear')
-plt.title('linear')
-plt.grid(True)
-
-
-# log
-plt.subplot(222)
-plt.plot(x, y)
-plt.yscale('log')
-plt.title('log')
-plt.grid(True)
-
-
-# symmetric log
-plt.subplot(223)
-plt.plot(x, y - y.mean())
-plt.yscale('symlog', linthreshy=0.01)
-plt.title('symlog')
-plt.grid(True)
-
-# logit
-plt.subplot(224)
-plt.plot(x, y)
-plt.yscale('logit')
-plt.title('logit')
-plt.grid(True)
-# Format the minor tick labels of the y-axis into empty strings with
-# `NullFormatter`, to avoid cumbering the axis with too many labels.
-plt.gca().yaxis.set_minor_formatter(NullFormatter())
-# Adjust the subplot layout, because the logit one may take more space
-# than usual, due to y-tick labels like "1 - 10^{-3}"
-plt.subplots_adjust(top=0.92, bottom=0.08, left=0.10, right=0.95, hspace=0.25,
-                    wspace=0.35)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/pyplot_scales.py b/examples/pyplots/pyplot_scales.py deleted file mode 100644 index bdf2fb82370..00000000000 --- a/examples/pyplots/pyplot_scales.py +++ /dev/null @@ -1,55 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -from matplotlib.ticker import NullFormatter # useful for `logit` scale - -# Fixing random state for reproducibility -np.random.seed(19680801) - -# make up some data in the interval ]0, 1[ -y = np.random.normal(loc=0.5, scale=0.4, size=1000) -y = y[(y > 0) & (y < 1)] -y.sort() -x = np.arange(len(y)) - -# plot with various axes scales -plt.figure(1) - -# linear -plt.subplot(221) -plt.plot(x, y) -plt.yscale('linear') -plt.title('linear') -plt.grid(True) - - -# log -plt.subplot(222) -plt.plot(x, y) -plt.yscale('log') -plt.title('log') -plt.grid(True) - - -# symmetric log -plt.subplot(223) -plt.plot(x, y - y.mean()) -plt.yscale('symlog', linthreshy=0.01) -plt.title('symlog') -plt.grid(True) - -# logit -plt.subplot(224) -plt.plot(x, y) -plt.yscale('logit') -plt.title('logit') -plt.grid(True) -# Format the minor tick labels of the y-axis into empty strings with -# `NullFormatter`, to avoid cumbering the axis with too many labels. -plt.gca().yaxis.set_minor_formatter(NullFormatter()) -# Adjust the subplot layout, because the logit one may take more space -# than usual, due to y-tick labels like "1 - 10^{-3}" -plt.subplots_adjust(top=0.92, bottom=0.08, left=0.10, right=0.95, hspace=0.25, - wspace=0.35) - -plt.show() diff --git a/examples/pyplots/pyplot_simple.html b/examples/pyplots/pyplot_simple.html deleted file mode 100644 index b1e66720c75..00000000000 --- a/examples/pyplots/pyplot_simple.html +++ /dev/null @@ -1,323 +0,0 @@ - - - - - - - - pyplots example code: pyplot_simple.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: pyplot_simple.py

-

[source code]

-
import matplotlib.pyplot as plt
-plt.plot([1,2,3,4])
-plt.ylabel('some numbers')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/pyplot_simple.py b/examples/pyplots/pyplot_simple.py deleted file mode 100644 index 46b9f225a97..00000000000 --- a/examples/pyplots/pyplot_simple.py +++ /dev/null @@ -1,4 +0,0 @@ -import matplotlib.pyplot as plt -plt.plot([1,2,3,4]) -plt.ylabel('some numbers') -plt.show() diff --git a/examples/pyplots/pyplot_text.html b/examples/pyplots/pyplot_text.html deleted file mode 100644 index 1f54fd99964..00000000000 --- a/examples/pyplots/pyplot_text.html +++ /dev/null @@ -1,339 +0,0 @@ - - - - - - - - pyplots example code: pyplot_text.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: pyplot_text.py

-

[source code]

-
import numpy as np
-import matplotlib.pyplot as plt
-
-# Fixing random state for reproducibility
-np.random.seed(19680801)
-
-mu, sigma = 100, 15
-x = mu + sigma * np.random.randn(10000)
-
-# the histogram of the data
-n, bins, patches = plt.hist(x, 50, normed=1, facecolor='g', alpha=0.75)
-
-
-plt.xlabel('Smarts')
-plt.ylabel('Probability')
-plt.title('Histogram of IQ')
-plt.text(60, .025, r'$\mu=100,\ \sigma=15$')
-plt.axis([40, 160, 0, 0.03])
-plt.grid(True)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/pyplot_text.py b/examples/pyplots/pyplot_text.py deleted file mode 100644 index b54a0f939da..00000000000 --- a/examples/pyplots/pyplot_text.py +++ /dev/null @@ -1,20 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -# Fixing random state for reproducibility -np.random.seed(19680801) - -mu, sigma = 100, 15 -x = mu + sigma * np.random.randn(10000) - -# the histogram of the data -n, bins, patches = plt.hist(x, 50, normed=1, facecolor='g', alpha=0.75) - - -plt.xlabel('Smarts') -plt.ylabel('Probability') -plt.title('Histogram of IQ') -plt.text(60, .025, r'$\mu=100,\ \sigma=15$') -plt.axis([40, 160, 0, 0.03]) -plt.grid(True) -plt.show() diff --git a/examples/pyplots/pyplot_three.html b/examples/pyplots/pyplot_three.html deleted file mode 100644 index 365d18c99c8..00000000000 --- a/examples/pyplots/pyplot_three.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - pyplots example code: pyplot_three.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: pyplot_three.py

-

[source code]

-
import numpy as np
-import matplotlib.pyplot as plt
-
-# evenly sampled time at 200ms intervals
-t = np.arange(0., 5., 0.2)
-
-# red dashes, blue squares and green triangles
-plt.plot(t, t, 'r--', t, t**2, 'bs', t, t**3, 'g^')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/pyplot_three.py b/examples/pyplots/pyplot_three.py deleted file mode 100644 index 2762d7cbd1d..00000000000 --- a/examples/pyplots/pyplot_three.py +++ /dev/null @@ -1,9 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -# evenly sampled time at 200ms intervals -t = np.arange(0., 5., 0.2) - -# red dashes, blue squares and green triangles -plt.plot(t, t, 'r--', t, t**2, 'bs', t, t**3, 'g^') -plt.show() diff --git a/examples/pyplots/pyplot_two_subplots.html b/examples/pyplots/pyplot_two_subplots.html deleted file mode 100644 index fd397cfd540..00000000000 --- a/examples/pyplots/pyplot_two_subplots.html +++ /dev/null @@ -1,335 +0,0 @@ - - - - - - - - pyplots example code: pyplot_two_subplots.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: pyplot_two_subplots.py

-

[source code]

-
import numpy as np
-import matplotlib.pyplot as plt
-
-def f(t):
-    return np.exp(-t) * np.cos(2*np.pi*t)
-
-t1 = np.arange(0.0, 5.0, 0.1)
-t2 = np.arange(0.0, 5.0, 0.02)
-
-plt.figure(1)
-plt.subplot(211)
-plt.plot(t1, f(t1), 'bo', t2, f(t2), 'k')
-
-plt.subplot(212)
-plt.plot(t2, np.cos(2*np.pi*t2), 'r--')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/pyplot_two_subplots.py b/examples/pyplots/pyplot_two_subplots.py deleted file mode 100644 index bfc6ebc121d..00000000000 --- a/examples/pyplots/pyplot_two_subplots.py +++ /dev/null @@ -1,16 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -def f(t): - return np.exp(-t) * np.cos(2*np.pi*t) - -t1 = np.arange(0.0, 5.0, 0.1) -t2 = np.arange(0.0, 5.0, 0.02) - -plt.figure(1) -plt.subplot(211) -plt.plot(t1, f(t1), 'bo', t2, f(t2), 'k') - -plt.subplot(212) -plt.plot(t2, np.cos(2*np.pi*t2), 'r--') -plt.show() diff --git a/examples/pyplots/tex_demo.html b/examples/pyplots/tex_demo.html deleted file mode 100644 index 0b0edb17b1b..00000000000 --- a/examples/pyplots/tex_demo.html +++ /dev/null @@ -1,354 +0,0 @@ - - - - - - - - pyplots example code: tex_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: tex_demo.py

-

[source code]

-
"""
-Demo of TeX rendering.
-
-You can use TeX to render all of your matplotlib text if the rc
-parameter text.usetex is set.  This works currently on the agg and ps
-backends, and requires that you have tex and the other dependencies
-described at http://matplotlib.org/users/usetex.html
-properly installed on your system.  The first time you run a script
-you will see a lot of output from tex and associated tools.  The next
-time, the run may be silent, as a lot of the information is cached in
-~/.tex.cache
-
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-# Example data
-t = np.arange(0.0, 1.0 + 0.01, 0.01)
-s = np.cos(4 * np.pi * t) + 2
-
-plt.rc('text', usetex=True)
-plt.rc('font', family='serif')
-plt.plot(t, s)
-
-plt.xlabel(r'\textbf{time} (s)')
-plt.ylabel(r'\textit{voltage} (mV)',fontsize=16)
-plt.title(r"\TeX\ is Number "
-          r"$\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!",
-          fontsize=16, color='gray')
-# Make room for the ridiculously large title.
-plt.subplots_adjust(top=0.8)
-
-plt.savefig('tex_demo')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/tex_demo.py b/examples/pyplots/tex_demo.py deleted file mode 100644 index 7b228376e72..00000000000 --- a/examples/pyplots/tex_demo.py +++ /dev/null @@ -1,35 +0,0 @@ -""" -Demo of TeX rendering. - -You can use TeX to render all of your matplotlib text if the rc -parameter text.usetex is set. This works currently on the agg and ps -backends, and requires that you have tex and the other dependencies -described at http://matplotlib.org/users/usetex.html -properly installed on your system. The first time you run a script -you will see a lot of output from tex and associated tools. The next -time, the run may be silent, as a lot of the information is cached in -~/.tex.cache - -""" -import numpy as np -import matplotlib.pyplot as plt - - -# Example data -t = np.arange(0.0, 1.0 + 0.01, 0.01) -s = np.cos(4 * np.pi * t) + 2 - -plt.rc('text', usetex=True) -plt.rc('font', family='serif') -plt.plot(t, s) - -plt.xlabel(r'\textbf{time} (s)') -plt.ylabel(r'\textit{voltage} (mV)',fontsize=16) -plt.title(r"\TeX\ is Number " - r"$\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!", - fontsize=16, color='gray') -# Make room for the ridiculously large title. -plt.subplots_adjust(top=0.8) - -plt.savefig('tex_demo') -plt.show() diff --git a/examples/pyplots/text_commands.html b/examples/pyplots/text_commands.html deleted file mode 100644 index 23d54757468..00000000000 --- a/examples/pyplots/text_commands.html +++ /dev/null @@ -1,352 +0,0 @@ - - - - - - - - pyplots example code: text_commands.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: text_commands.py

-

[source code]

-
# -*- coding: utf-8 -*-
-import matplotlib.pyplot as plt
-
-fig = plt.figure()
-fig.suptitle('bold figure suptitle', fontsize=14, fontweight='bold')
-
-ax = fig.add_subplot(111)
-fig.subplots_adjust(top=0.85)
-ax.set_title('axes title')
-
-ax.set_xlabel('xlabel')
-ax.set_ylabel('ylabel')
-
-ax.text(3, 8, 'boxed italics text in data coords', style='italic',
-        bbox={'facecolor':'red', 'alpha':0.5, 'pad':10})
-
-ax.text(2, 6, r'an equation: $E=mc^2$', fontsize=15)
-
-ax.text(3, 2, u'unicode: Institut f\374r Festk\366rperphysik')
-
-ax.text(0.95, 0.01, 'colored text in axes coords',
-        verticalalignment='bottom', horizontalalignment='right',
-        transform=ax.transAxes,
-        color='green', fontsize=15)
-
-
-ax.plot([2], [1], 'o')
-ax.annotate('annotate', xy=(2, 1), xytext=(3, 4),
-            arrowprops=dict(facecolor='black', shrink=0.05))
-
-ax.axis([0, 10, 0, 10])
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/text_commands.py b/examples/pyplots/text_commands.py deleted file mode 100644 index 92f40b60b9c..00000000000 --- a/examples/pyplots/text_commands.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -import matplotlib.pyplot as plt - -fig = plt.figure() -fig.suptitle('bold figure suptitle', fontsize=14, fontweight='bold') - -ax = fig.add_subplot(111) -fig.subplots_adjust(top=0.85) -ax.set_title('axes title') - -ax.set_xlabel('xlabel') -ax.set_ylabel('ylabel') - -ax.text(3, 8, 'boxed italics text in data coords', style='italic', - bbox={'facecolor':'red', 'alpha':0.5, 'pad':10}) - -ax.text(2, 6, r'an equation: $E=mc^2$', fontsize=15) - -ax.text(3, 2, u'unicode: Institut f\374r Festk\366rperphysik') - -ax.text(0.95, 0.01, 'colored text in axes coords', - verticalalignment='bottom', horizontalalignment='right', - transform=ax.transAxes, - color='green', fontsize=15) - - -ax.plot([2], [1], 'o') -ax.annotate('annotate', xy=(2, 1), xytext=(3, 4), - arrowprops=dict(facecolor='black', shrink=0.05)) - -ax.axis([0, 10, 0, 10]) - -plt.show() diff --git a/examples/pyplots/text_layout.html b/examples/pyplots/text_layout.html deleted file mode 100644 index 0b94d5efc8a..00000000000 --- a/examples/pyplots/text_layout.html +++ /dev/null @@ -1,396 +0,0 @@ - - - - - - - - pyplots example code: text_layout.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: text_layout.py

-

[source code]

-
import matplotlib.pyplot as plt
-import matplotlib.patches as patches
-
-# build a rectangle in axes coords
-left, width = .25, .5
-bottom, height = .25, .5
-right = left + width
-top = bottom + height
-
-fig = plt.figure()
-ax = fig.add_axes([0,0,1,1])
-
-# axes coordinates are 0,0 is bottom left and 1,1 is upper right
-p = patches.Rectangle(
-    (left, bottom), width, height,
-    fill=False, transform=ax.transAxes, clip_on=False
-    )
-
-ax.add_patch(p)
-
-ax.text(left, bottom, 'left top',
-        horizontalalignment='left',
-        verticalalignment='top',
-        transform=ax.transAxes)
-
-ax.text(left, bottom, 'left bottom',
-        horizontalalignment='left',
-        verticalalignment='bottom',
-        transform=ax.transAxes)
-
-ax.text(right, top, 'right bottom',
-        horizontalalignment='right',
-        verticalalignment='bottom',
-        transform=ax.transAxes)
-
-ax.text(right, top, 'right top',
-        horizontalalignment='right',
-        verticalalignment='top',
-        transform=ax.transAxes)
-
-ax.text(right, bottom, 'center top',
-        horizontalalignment='center',
-        verticalalignment='top',
-        transform=ax.transAxes)
-
-ax.text(left, 0.5*(bottom+top), 'right center',
-        horizontalalignment='right',
-        verticalalignment='center',
-        rotation='vertical',
-        transform=ax.transAxes)
-
-ax.text(left, 0.5*(bottom+top), 'left center',
-        horizontalalignment='left',
-        verticalalignment='center',
-        rotation='vertical',
-        transform=ax.transAxes)
-
-ax.text(0.5*(left+right), 0.5*(bottom+top), 'middle',
-        horizontalalignment='center',
-        verticalalignment='center',
-        fontsize=20, color='red',
-        transform=ax.transAxes)
-
-ax.text(right, 0.5*(bottom+top), 'centered',
-        horizontalalignment='center',
-        verticalalignment='center',
-        rotation='vertical',
-        transform=ax.transAxes)
-
-ax.text(left, top, 'rotated\nwith newlines',
-        horizontalalignment='center',
-        verticalalignment='center',
-        rotation=45,
-        transform=ax.transAxes)
-
-ax.set_axis_off()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/text_layout.py b/examples/pyplots/text_layout.py deleted file mode 100644 index 860c20d2211..00000000000 --- a/examples/pyplots/text_layout.py +++ /dev/null @@ -1,77 +0,0 @@ -import matplotlib.pyplot as plt -import matplotlib.patches as patches - -# build a rectangle in axes coords -left, width = .25, .5 -bottom, height = .25, .5 -right = left + width -top = bottom + height - -fig = plt.figure() -ax = fig.add_axes([0,0,1,1]) - -# axes coordinates are 0,0 is bottom left and 1,1 is upper right -p = patches.Rectangle( - (left, bottom), width, height, - fill=False, transform=ax.transAxes, clip_on=False - ) - -ax.add_patch(p) - -ax.text(left, bottom, 'left top', - horizontalalignment='left', - verticalalignment='top', - transform=ax.transAxes) - -ax.text(left, bottom, 'left bottom', - horizontalalignment='left', - verticalalignment='bottom', - transform=ax.transAxes) - -ax.text(right, top, 'right bottom', - horizontalalignment='right', - verticalalignment='bottom', - transform=ax.transAxes) - -ax.text(right, top, 'right top', - horizontalalignment='right', - verticalalignment='top', - transform=ax.transAxes) - -ax.text(right, bottom, 'center top', - horizontalalignment='center', - verticalalignment='top', - transform=ax.transAxes) - -ax.text(left, 0.5*(bottom+top), 'right center', - horizontalalignment='right', - verticalalignment='center', - rotation='vertical', - transform=ax.transAxes) - -ax.text(left, 0.5*(bottom+top), 'left center', - horizontalalignment='left', - verticalalignment='center', - rotation='vertical', - transform=ax.transAxes) - -ax.text(0.5*(left+right), 0.5*(bottom+top), 'middle', - horizontalalignment='center', - verticalalignment='center', - fontsize=20, color='red', - transform=ax.transAxes) - -ax.text(right, 0.5*(bottom+top), 'centered', - horizontalalignment='center', - verticalalignment='center', - rotation='vertical', - transform=ax.transAxes) - -ax.text(left, top, 'rotated\nwith newlines', - horizontalalignment='center', - verticalalignment='center', - rotation=45, - transform=ax.transAxes) - -ax.set_axis_off() -plt.show() diff --git a/examples/pyplots/whats_new_1_subplot3d.html b/examples/pyplots/whats_new_1_subplot3d.html deleted file mode 100644 index 05d897034a5..00000000000 --- a/examples/pyplots/whats_new_1_subplot3d.html +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - pyplots example code: whats_new_1_subplot3d.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: whats_new_1_subplot3d.py

-

[source code]

-
from mpl_toolkits.mplot3d.axes3d import Axes3D
-from matplotlib import cm
-#from matplotlib.ticker import LinearLocator, FixedLocator, FormatStrFormatter
-import matplotlib.pyplot as plt
-import numpy as np
-
-fig = plt.figure()
-
-ax = fig.add_subplot(1, 2, 1, projection='3d')
-X = np.arange(-5, 5, 0.25)
-Y = np.arange(-5, 5, 0.25)
-X, Y = np.meshgrid(X, Y)
-R = np.sqrt(X**2 + Y**2)
-Z = np.sin(R)
-surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet,
-        linewidth=0, antialiased=False)
-ax.set_zlim3d(-1.01, 1.01)
-
-#ax.w_zaxis.set_major_locator(LinearLocator(10))
-#ax.w_zaxis.set_major_formatter(FormatStrFormatter('%.03f'))
-
-fig.colorbar(surf, shrink=0.5, aspect=5)
-
-from mpl_toolkits.mplot3d.axes3d import get_test_data
-ax = fig.add_subplot(1, 2, 2, projection='3d')
-X, Y, Z = get_test_data(0.05)
-ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/whats_new_1_subplot3d.py b/examples/pyplots/whats_new_1_subplot3d.py deleted file mode 100644 index 379157b0c5e..00000000000 --- a/examples/pyplots/whats_new_1_subplot3d.py +++ /dev/null @@ -1,30 +0,0 @@ -from mpl_toolkits.mplot3d.axes3d import Axes3D -from matplotlib import cm -#from matplotlib.ticker import LinearLocator, FixedLocator, FormatStrFormatter -import matplotlib.pyplot as plt -import numpy as np - -fig = plt.figure() - -ax = fig.add_subplot(1, 2, 1, projection='3d') -X = np.arange(-5, 5, 0.25) -Y = np.arange(-5, 5, 0.25) -X, Y = np.meshgrid(X, Y) -R = np.sqrt(X**2 + Y**2) -Z = np.sin(R) -surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet, - linewidth=0, antialiased=False) -ax.set_zlim3d(-1.01, 1.01) - -#ax.w_zaxis.set_major_locator(LinearLocator(10)) -#ax.w_zaxis.set_major_formatter(FormatStrFormatter('%.03f')) - -fig.colorbar(surf, shrink=0.5, aspect=5) - -from mpl_toolkits.mplot3d.axes3d import get_test_data -ax = fig.add_subplot(1, 2, 2, projection='3d') -X, Y, Z = get_test_data(0.05) -ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10) - -plt.show() - diff --git a/examples/pyplots/whats_new_98_4_fancy.html b/examples/pyplots/whats_new_98_4_fancy.html deleted file mode 100644 index 2f1ed8c1223..00000000000 --- a/examples/pyplots/whats_new_98_4_fancy.html +++ /dev/null @@ -1,373 +0,0 @@ - - - - - - - - pyplots example code: whats_new_98_4_fancy.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: whats_new_98_4_fancy.py

-

[source code]

-
import matplotlib.patches as mpatch
-import matplotlib.pyplot as plt
-
-figheight = 8
-fig = plt.figure(1, figsize=(9, figheight), dpi=80)
-fontsize = 0.4 * fig.dpi
-
-def make_boxstyles(ax):
-    styles = mpatch.BoxStyle.get_styles()
-
-    for i, (stylename, styleclass) in enumerate(sorted(styles.items())):
-        ax.text(0.5, (float(len(styles)) - 0.5 - i)/len(styles), stylename,
-                  ha="center",
-                  size=fontsize,
-                  transform=ax.transAxes,
-                  bbox=dict(boxstyle=stylename, fc="w", ec="k"))
-
-def make_arrowstyles(ax):
-    styles = mpatch.ArrowStyle.get_styles()
-
-    ax.set_xlim(0, 4)
-    ax.set_ylim(0, figheight)
-
-    for i, (stylename, styleclass) in enumerate(sorted(styles.items())):
-        y = (float(len(styles)) -0.25 - i) # /figheight
-        p = mpatch.Circle((3.2, y), 0.2, fc="w")
-        ax.add_patch(p)
-
-        ax.annotate(stylename, (3.2, y),
-                    (2., y),
-                    #xycoords="figure fraction", textcoords="figure fraction",
-                    ha="right", va="center",
-                    size=fontsize,
-                    arrowprops=dict(arrowstyle=stylename,
-                                    patchB=p,
-                                    shrinkA=5,
-                                    shrinkB=5,
-                                    fc="w", ec="k",
-                                    connectionstyle="arc3,rad=-0.05",
-                                    ),
-                    bbox=dict(boxstyle="square", fc="w"))
-
-    ax.xaxis.set_visible(False)
-    ax.yaxis.set_visible(False)
-
-
-ax1 = fig.add_subplot(121, frameon=False, xticks=[], yticks=[])
-make_boxstyles(ax1)
-
-ax2 = fig.add_subplot(122, frameon=False, xticks=[], yticks=[])
-make_arrowstyles(ax2)
-
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/whats_new_98_4_fancy.py b/examples/pyplots/whats_new_98_4_fancy.py deleted file mode 100644 index e7ca6bf9471..00000000000 --- a/examples/pyplots/whats_new_98_4_fancy.py +++ /dev/null @@ -1,54 +0,0 @@ -import matplotlib.patches as mpatch -import matplotlib.pyplot as plt - -figheight = 8 -fig = plt.figure(1, figsize=(9, figheight), dpi=80) -fontsize = 0.4 * fig.dpi - -def make_boxstyles(ax): - styles = mpatch.BoxStyle.get_styles() - - for i, (stylename, styleclass) in enumerate(sorted(styles.items())): - ax.text(0.5, (float(len(styles)) - 0.5 - i)/len(styles), stylename, - ha="center", - size=fontsize, - transform=ax.transAxes, - bbox=dict(boxstyle=stylename, fc="w", ec="k")) - -def make_arrowstyles(ax): - styles = mpatch.ArrowStyle.get_styles() - - ax.set_xlim(0, 4) - ax.set_ylim(0, figheight) - - for i, (stylename, styleclass) in enumerate(sorted(styles.items())): - y = (float(len(styles)) -0.25 - i) # /figheight - p = mpatch.Circle((3.2, y), 0.2, fc="w") - ax.add_patch(p) - - ax.annotate(stylename, (3.2, y), - (2., y), - #xycoords="figure fraction", textcoords="figure fraction", - ha="right", va="center", - size=fontsize, - arrowprops=dict(arrowstyle=stylename, - patchB=p, - shrinkA=5, - shrinkB=5, - fc="w", ec="k", - connectionstyle="arc3,rad=-0.05", - ), - bbox=dict(boxstyle="square", fc="w")) - - ax.xaxis.set_visible(False) - ax.yaxis.set_visible(False) - - -ax1 = fig.add_subplot(121, frameon=False, xticks=[], yticks=[]) -make_boxstyles(ax1) - -ax2 = fig.add_subplot(122, frameon=False, xticks=[], yticks=[]) -make_arrowstyles(ax2) - - -plt.show() diff --git a/examples/pyplots/whats_new_98_4_fill_between.html b/examples/pyplots/whats_new_98_4_fill_between.html deleted file mode 100644 index e1c66caeb5d..00000000000 --- a/examples/pyplots/whats_new_98_4_fill_between.html +++ /dev/null @@ -1,335 +0,0 @@ - - - - - - - - pyplots example code: whats_new_98_4_fill_between.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: whats_new_98_4_fill_between.py

-

[source code]

-
#!/usr/bin/env python
-import matplotlib.mlab as mlab
-import matplotlib.pyplot as plt
-import numpy as np
-
-x = np.arange(0.0, 2, 0.01)
-y1 = np.sin(2*np.pi*x)
-y2 = 1.2*np.sin(4*np.pi*x)
-
-fig, ax = plt.subplots()
-ax.plot(x, y1, x, y2, color='black')
-ax.fill_between(x, y1, y2, where=y2>y1, facecolor='green')
-ax.fill_between(x, y1, y2, where=y2<=y1, facecolor='red')
-ax.set_title('fill between where')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/whats_new_98_4_fill_between.py b/examples/pyplots/whats_new_98_4_fill_between.py deleted file mode 100644 index 33670729131..00000000000 --- a/examples/pyplots/whats_new_98_4_fill_between.py +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env python -import matplotlib.mlab as mlab -import matplotlib.pyplot as plt -import numpy as np - -x = np.arange(0.0, 2, 0.01) -y1 = np.sin(2*np.pi*x) -y2 = 1.2*np.sin(4*np.pi*x) - -fig, ax = plt.subplots() -ax.plot(x, y1, x, y2, color='black') -ax.fill_between(x, y1, y2, where=y2>y1, facecolor='green') -ax.fill_between(x, y1, y2, where=y2<=y1, facecolor='red') -ax.set_title('fill between where') - -plt.show() diff --git a/examples/pyplots/whats_new_98_4_legend.html b/examples/pyplots/whats_new_98_4_legend.html deleted file mode 100644 index d6169240538..00000000000 --- a/examples/pyplots/whats_new_98_4_legend.html +++ /dev/null @@ -1,334 +0,0 @@ - - - - - - - - pyplots example code: whats_new_98_4_legend.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: whats_new_98_4_legend.py

-

[source code]

-
import matplotlib.pyplot as plt
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-ax = plt.subplot(111)
-t1 = np.arange(0.0, 1.0, 0.01)
-for n in [1, 2, 3, 4]:
-    plt.plot(t1, t1**n, label="n=%d"%(n,))
-
-leg = plt.legend(loc='best', ncol=2, mode="expand", shadow=True, fancybox=True)
-leg.get_frame().set_alpha(0.5)
-
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/whats_new_98_4_legend.py b/examples/pyplots/whats_new_98_4_legend.py deleted file mode 100644 index 2a806126f3c..00000000000 --- a/examples/pyplots/whats_new_98_4_legend.py +++ /dev/null @@ -1,18 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np -import matplotlib.pyplot as plt - - -ax = plt.subplot(111) -t1 = np.arange(0.0, 1.0, 0.01) -for n in [1, 2, 3, 4]: - plt.plot(t1, t1**n, label="n=%d"%(n,)) - -leg = plt.legend(loc='best', ncol=2, mode="expand", shadow=True, fancybox=True) -leg.get_frame().set_alpha(0.5) - - -plt.show() - - - diff --git a/examples/pyplots/whats_new_99_axes_grid.html b/examples/pyplots/whats_new_99_axes_grid.html deleted file mode 100644 index 9c8e0ed994e..00000000000 --- a/examples/pyplots/whats_new_99_axes_grid.html +++ /dev/null @@ -1,366 +0,0 @@ - - - - - - - - pyplots example code: whats_new_99_axes_grid.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: whats_new_99_axes_grid.py

-

[source code]

-
import numpy as np
-import matplotlib.pyplot as plt
-from mpl_toolkits.axes_grid.axes_rgb import RGBAxes
-
-def get_demo_image():
-    # prepare image
-    delta = 0.5
-
-    extent = (-3,4,-4,3)
-    x = np.arange(-3.0, 4.001, delta)
-    y = np.arange(-4.0, 3.001, delta)
-    X, Y = np.meshgrid(x, y)
-    import matplotlib.mlab as mlab
-    Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
-    Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
-    Z = (Z1 - Z2) * 10
-
-    return Z, extent
-
-
-
-def get_rgb():
-    Z, extent = get_demo_image()
-
-    Z[Z<0] = 0.
-    Z = Z/Z.max()
-
-    R = Z[:13,:13]
-    G = Z[2:,2:]
-    B = Z[:13,2:]
-
-    return R, G, B
-
-
-fig = plt.figure(1)
-ax = RGBAxes(fig, [0.1, 0.1, 0.8, 0.8])
-
-r, g, b = get_rgb()
-kwargs = dict(origin="lower", interpolation="nearest")
-ax.imshow_rgb(r, g, b, **kwargs)
-
-ax.RGB.set_xlim(0., 9.5)
-ax.RGB.set_ylim(0.9, 10.6)
-
-
-plt.draw()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/whats_new_99_axes_grid.py b/examples/pyplots/whats_new_99_axes_grid.py deleted file mode 100644 index e3cb7fa4217..00000000000 --- a/examples/pyplots/whats_new_99_axes_grid.py +++ /dev/null @@ -1,47 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid.axes_rgb import RGBAxes - -def get_demo_image(): - # prepare image - delta = 0.5 - - extent = (-3,4,-4,3) - x = np.arange(-3.0, 4.001, delta) - y = np.arange(-4.0, 3.001, delta) - X, Y = np.meshgrid(x, y) - import matplotlib.mlab as mlab - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - Z = (Z1 - Z2) * 10 - - return Z, extent - - - -def get_rgb(): - Z, extent = get_demo_image() - - Z[Z<0] = 0. - Z = Z/Z.max() - - R = Z[:13,:13] - G = Z[2:,2:] - B = Z[:13,2:] - - return R, G, B - - -fig = plt.figure(1) -ax = RGBAxes(fig, [0.1, 0.1, 0.8, 0.8]) - -r, g, b = get_rgb() -kwargs = dict(origin="lower", interpolation="nearest") -ax.imshow_rgb(r, g, b, **kwargs) - -ax.RGB.set_xlim(0., 9.5) -ax.RGB.set_ylim(0.9, 10.6) - - -plt.draw() -plt.show() diff --git a/examples/pyplots/whats_new_99_mplot3d.html b/examples/pyplots/whats_new_99_mplot3d.html deleted file mode 100644 index 9a117c8014e..00000000000 --- a/examples/pyplots/whats_new_99_mplot3d.html +++ /dev/null @@ -1,337 +0,0 @@ - - - - - - - - pyplots example code: whats_new_99_mplot3d.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: whats_new_99_mplot3d.py

-

[source code]

-
import random
-
-import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib import cm
-from mpl_toolkits.mplot3d import Axes3D
-
-X = np.arange(-5, 5, 0.25)
-Y = np.arange(-5, 5, 0.25)
-X, Y = np.meshgrid(X, Y)
-R = np.sqrt(X**2 + Y**2)
-Z = np.sin(R)
-
-fig = plt.figure()
-ax = Axes3D(fig)
-ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.viridis)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/whats_new_99_mplot3d.py b/examples/pyplots/whats_new_99_mplot3d.py deleted file mode 100644 index bffb607105f..00000000000 --- a/examples/pyplots/whats_new_99_mplot3d.py +++ /dev/null @@ -1,18 +0,0 @@ -import random - -import numpy as np -import matplotlib.pyplot as plt -from matplotlib import cm -from mpl_toolkits.mplot3d import Axes3D - -X = np.arange(-5, 5, 0.25) -Y = np.arange(-5, 5, 0.25) -X, Y = np.meshgrid(X, Y) -R = np.sqrt(X**2 + Y**2) -Z = np.sin(R) - -fig = plt.figure() -ax = Axes3D(fig) -ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.viridis) - -plt.show() diff --git a/examples/pyplots/whats_new_99_spines.html b/examples/pyplots/whats_new_99_spines.html deleted file mode 100644 index 55682187348..00000000000 --- a/examples/pyplots/whats_new_99_spines.html +++ /dev/null @@ -1,365 +0,0 @@ - - - - - - - - pyplots example code: whats_new_99_spines.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

pyplots example code: whats_new_99_spines.py

-

[source code]

-
import matplotlib.pyplot as plt
-import numpy as np
-
-
-def adjust_spines(ax,spines):
-    for loc, spine in ax.spines.items():
-        if loc in spines:
-            spine.set_position(('outward',10)) # outward by 10 points
-        else:
-            spine.set_color('none') # don't draw spine
-
-    # turn off ticks where there is no spine
-    if 'left' in spines:
-        ax.yaxis.set_ticks_position('left')
-    else:
-        # no yaxis ticks
-        ax.yaxis.set_ticks([])
-
-    if 'bottom' in spines:
-        ax.xaxis.set_ticks_position('bottom')
-    else:
-        # no xaxis ticks
-        ax.xaxis.set_ticks([])
-
-fig = plt.figure()
-
-x = np.linspace(0,2*np.pi,100)
-y = 2*np.sin(x)
-
-ax = fig.add_subplot(2,2,1)
-ax.plot(x,y)
-adjust_spines(ax,['left'])
-
-ax = fig.add_subplot(2,2,2)
-ax.plot(x,y)
-adjust_spines(ax,[])
-
-ax = fig.add_subplot(2,2,3)
-ax.plot(x,y)
-adjust_spines(ax,['left','bottom'])
-
-ax = fig.add_subplot(2,2,4)
-ax.plot(x,y)
-adjust_spines(ax,['bottom'])
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/pyplots/whats_new_99_spines.py b/examples/pyplots/whats_new_99_spines.py deleted file mode 100644 index de95522f062..00000000000 --- a/examples/pyplots/whats_new_99_spines.py +++ /dev/null @@ -1,46 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - - -def adjust_spines(ax,spines): - for loc, spine in ax.spines.items(): - if loc in spines: - spine.set_position(('outward',10)) # outward by 10 points - else: - spine.set_color('none') # don't draw spine - - # turn off ticks where there is no spine - if 'left' in spines: - ax.yaxis.set_ticks_position('left') - else: - # no yaxis ticks - ax.yaxis.set_ticks([]) - - if 'bottom' in spines: - ax.xaxis.set_ticks_position('bottom') - else: - # no xaxis ticks - ax.xaxis.set_ticks([]) - -fig = plt.figure() - -x = np.linspace(0,2*np.pi,100) -y = 2*np.sin(x) - -ax = fig.add_subplot(2,2,1) -ax.plot(x,y) -adjust_spines(ax,['left']) - -ax = fig.add_subplot(2,2,2) -ax.plot(x,y) -adjust_spines(ax,[]) - -ax = fig.add_subplot(2,2,3) -ax.plot(x,y) -adjust_spines(ax,['left','bottom']) - -ax = fig.add_subplot(2,2,4) -ax.plot(x,y) -adjust_spines(ax,['bottom']) - -plt.show() diff --git a/examples/scales/index.html b/examples/scales/index.html deleted file mode 100644 index 1a334559b9f..00000000000 --- a/examples/scales/index.html +++ /dev/null @@ -1,327 +0,0 @@ - - - - - - - - scales Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

scales Examples

- --- - - - - - -
Release:2.0.2
Date:May 10, 2017
-
- -
-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/scales/scales.html b/examples/scales/scales.html deleted file mode 100644 index 6c0d147b9e7..00000000000 --- a/examples/scales/scales.html +++ /dev/null @@ -1,373 +0,0 @@ - - - - - - - - scales example code: scales.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

scales example code: scales.py

-

(Source code, png, pdf)

-
-../../_images/scales.png -
-
"""
-Illustrate the scale transformations applied to axes, e.g. log, symlog, logit.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.ticker import NullFormatter
-
-np.random.seed(1)
-# make up some data in the interval ]0, 1[
-y = np.random.normal(loc=0.5, scale=0.4, size=1000)
-y = y[(y > 0) & (y < 1)]
-y.sort()
-x = np.arange(len(y))
-
-# plot with various axes scales
-fig, axs = plt.subplots(2, 2, sharex=True)
-fig.subplots_adjust(left=0.08, right=0.98, wspace=0.3)
-
-# linear
-ax = axs[0, 0]
-ax.plot(x, y)
-ax.set_yscale('linear')
-ax.set_title('linear')
-ax.grid(True)
-
-
-# log
-ax = axs[0, 1]
-ax.plot(x, y)
-ax.set_yscale('log')
-ax.set_title('log')
-ax.grid(True)
-
-
-# symmetric log
-ax = axs[1, 1]
-ax.plot(x, y - y.mean())
-ax.set_yscale('symlog', linthreshy=0.02)
-ax.set_title('symlog')
-ax.grid(True)
-
-# logit
-ax = axs[1, 0]
-ax.plot(x, y)
-ax.set_yscale('logit')
-ax.set_title('logit')
-ax.grid(True)
-ax.yaxis.set_minor_formatter(NullFormatter())
-
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/shapes_and_collections/artist_reference.html b/examples/shapes_and_collections/artist_reference.html deleted file mode 100644 index 4f9dbf6a4c2..00000000000 --- a/examples/shapes_and_collections/artist_reference.html +++ /dev/null @@ -1,426 +0,0 @@ - - - - - - - - shapes_and_collections example code: artist_reference.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

shapes_and_collections example code: artist_reference.py

-

(Source code, png, pdf)

-
-../../_images/artist_reference.png -
-
"""
-Reference for matplotlib artists
-
-This example displays several of matplotlib's graphics primitives (artists)
-drawn using matplotlib API. A full list of artists and the documentation is
-available at http://matplotlib.org/api/artist_api.html.
-
-Copyright (c) 2010, Bartosz Telenczuk
-BSD License
-"""
-import matplotlib.pyplot as plt
-plt.rcdefaults()
-
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.path as mpath
-import matplotlib.lines as mlines
-import matplotlib.patches as mpatches
-from matplotlib.collections import PatchCollection
-
-
-def label(xy, text):
-    y = xy[1] - 0.15  # shift y-value for label so that it's below the artist
-    plt.text(xy[0], y, text, ha="center", family='sans-serif', size=14)
-
-
-fig, ax = plt.subplots()
-# create 3x3 grid to plot the artists
-grid = np.mgrid[0.2:0.8:3j, 0.2:0.8:3j].reshape(2, -1).T
-
-patches = []
-
-# add a circle
-circle = mpatches.Circle(grid[0], 0.1, ec="none")
-patches.append(circle)
-label(grid[0], "Circle")
-
-# add a rectangle
-rect = mpatches.Rectangle(grid[1] - [0.025, 0.05], 0.05, 0.1, ec="none")
-patches.append(rect)
-label(grid[1], "Rectangle")
-
-# add a wedge
-wedge = mpatches.Wedge(grid[2], 0.1, 30, 270, ec="none")
-patches.append(wedge)
-label(grid[2], "Wedge")
-
-# add a Polygon
-polygon = mpatches.RegularPolygon(grid[3], 5, 0.1)
-patches.append(polygon)
-label(grid[3], "Polygon")
-
-# add an ellipse
-ellipse = mpatches.Ellipse(grid[4], 0.2, 0.1)
-patches.append(ellipse)
-label(grid[4], "Ellipse")
-
-# add an arrow
-arrow = mpatches.Arrow(grid[5, 0] - 0.05, grid[5, 1] - 0.05, 0.1, 0.1, width=0.1)
-patches.append(arrow)
-label(grid[5], "Arrow")
-
-# add a path patch
-Path = mpath.Path
-path_data = [
-    (Path.MOVETO, [0.018, -0.11]),
-    (Path.CURVE4, [-0.031, -0.051]),
-    (Path.CURVE4, [-0.115,  0.073]),
-    (Path.CURVE4, [-0.03 ,  0.073]),
-    (Path.LINETO, [-0.011,  0.039]),
-    (Path.CURVE4, [0.043,  0.121]),
-    (Path.CURVE4, [0.075, -0.005]),
-    (Path.CURVE4, [0.035, -0.027]),
-    (Path.CLOSEPOLY, [0.018, -0.11])
-    ]
-codes, verts = zip(*path_data)
-path = mpath.Path(verts + grid[6], codes)
-patch = mpatches.PathPatch(path)
-patches.append(patch)
-label(grid[6], "PathPatch")
-
-# add a fancy box
-fancybox = mpatches.FancyBboxPatch(
-    grid[7] - [0.025, 0.05], 0.05, 0.1,
-    boxstyle=mpatches.BoxStyle("Round", pad=0.02))
-patches.append(fancybox)
-label(grid[7], "FancyBboxPatch")
-
-# add a line
-x, y = np.array([[-0.06, 0.0, 0.1], [0.05, -0.05, 0.05]])
-line = mlines.Line2D(x + grid[8, 0], y + grid[8, 1], lw=5., alpha=0.3)
-label(grid[8], "Line2D")
-
-colors = np.linspace(0, 1, len(patches))
-collection = PatchCollection(patches, cmap=plt.cm.hsv, alpha=0.3)
-collection.set_array(np.array(colors))
-ax.add_collection(collection)
-ax.add_line(line)
-
-plt.subplots_adjust(left=0, right=1, bottom=0, top=1)
-plt.axis('equal')
-plt.axis('off')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/shapes_and_collections/index.html b/examples/shapes_and_collections/index.html deleted file mode 100644 index 95638271d0f..00000000000 --- a/examples/shapes_and_collections/index.html +++ /dev/null @@ -1,329 +0,0 @@ - - - - - - - - shapes_and_collections Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

shapes_and_collections Examples

- --- - - - - - -
Release:2.0.2
Date:May 10, 2017
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/shapes_and_collections/path_patch_demo.html b/examples/shapes_and_collections/path_patch_demo.html deleted file mode 100644 index dc3c0df0fbd..00000000000 --- a/examples/shapes_and_collections/path_patch_demo.html +++ /dev/null @@ -1,356 +0,0 @@ - - - - - - - - shapes_and_collections example code: path_patch_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

shapes_and_collections example code: path_patch_demo.py

-

(Source code, png, pdf)

-
-../../_images/path_patch_demo.png -
-
"""
-Demo of a PathPatch object.
-"""
-import matplotlib.path as mpath
-import matplotlib.patches as mpatches
-import matplotlib.pyplot as plt
-
-
-fig, ax = plt.subplots()
-
-Path = mpath.Path
-path_data = [
-    (Path.MOVETO, (1.58, -2.57)),
-    (Path.CURVE4, (0.35, -1.1)),
-    (Path.CURVE4, (-1.75, 2.0)),
-    (Path.CURVE4, (0.375, 2.0)),
-    (Path.LINETO, (0.85, 1.15)),
-    (Path.CURVE4, (2.2, 3.2)),
-    (Path.CURVE4, (3, 0.05)),
-    (Path.CURVE4, (2.0, -0.5)),
-    (Path.CLOSEPOLY, (1.58, -2.57)),
-    ]
-codes, verts = zip(*path_data)
-path = mpath.Path(verts, codes)
-patch = mpatches.PathPatch(path, facecolor='r', alpha=0.5)
-ax.add_patch(patch)
-
-# plot control points and connecting lines
-x, y = zip(*path.vertices)
-line, = ax.plot(x, y, 'go-')
-
-ax.grid()
-ax.axis('equal')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/shapes_and_collections/scatter_demo.html b/examples/shapes_and_collections/scatter_demo.html deleted file mode 100644 index f080f7ea2d4..00000000000 --- a/examples/shapes_and_collections/scatter_demo.html +++ /dev/null @@ -1,337 +0,0 @@ - - - - - - - - shapes_and_collections example code: scatter_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

shapes_and_collections example code: scatter_demo.py

-

(Source code, png, pdf)

-
-../../_images/scatter_demo.png -
-
"""
-Simple demo of a scatter plot.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-N = 50
-x = np.random.rand(N)
-y = np.random.rand(N)
-colors = np.random.rand(N)
-area = np.pi * (15 * np.random.rand(N))**2  # 0 to 15 point radii
-
-plt.scatter(x, y, s=area, c=colors, alpha=0.5)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/showcase/anatomy.html b/examples/showcase/anatomy.html deleted file mode 100644 index 7001cef8f87..00000000000 --- a/examples/showcase/anatomy.html +++ /dev/null @@ -1,462 +0,0 @@ - - - - - - - - showcase example code: anatomy.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

showcase example code: anatomy.py

-

(Source code, png, pdf)

-
-../../_images/anatomy.png -
-
# This figure shows the name of several matplotlib elements composing a figure
-
-import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.ticker import AutoMinorLocator, MultipleLocator, FuncFormatter
-
-
-np.random.seed(19680801)
-
-X = np.linspace(0.5, 3.5, 100)
-Y1 = 3+np.cos(X)
-Y2 = 1+np.cos(1+X/0.75)/2
-Y3 = np.random.uniform(Y1, Y2, len(X))
-
-fig = plt.figure(figsize=(8, 8))
-ax = fig.add_subplot(1, 1, 1, aspect=1)
-
-
-def minor_tick(x, pos):
-    if not x % 1.0:
-        return ""
-    return "%.2f" % x
-
-ax.xaxis.set_major_locator(MultipleLocator(1.000))
-ax.xaxis.set_minor_locator(AutoMinorLocator(4))
-ax.yaxis.set_major_locator(MultipleLocator(1.000))
-ax.yaxis.set_minor_locator(AutoMinorLocator(4))
-ax.xaxis.set_minor_formatter(FuncFormatter(minor_tick))
-
-ax.set_xlim(0, 4)
-ax.set_ylim(0, 4)
-
-ax.tick_params(which='major', width=1.0)
-ax.tick_params(which='major', length=10)
-ax.tick_params(which='minor', width=1.0, labelsize=10)
-ax.tick_params(which='minor', length=5, labelsize=10, labelcolor='0.25')
-
-ax.grid(linestyle="--", linewidth=0.5, color='.25', zorder=-10)
-
-ax.plot(X, Y1, c=(0.25, 0.25, 1.00), lw=2, label="Blue signal", zorder=10)
-ax.plot(X, Y2, c=(1.00, 0.25, 0.25), lw=2, label="Red signal")
-ax.plot(X, Y3, linewidth=0,
-        marker='o', markerfacecolor='w', markeredgecolor='k')
-
-ax.set_title("Anatomy of a figure", fontsize=20, verticalalignment='bottom')
-ax.set_xlabel("X axis label")
-ax.set_ylabel("Y axis label")
-
-ax.legend()
-
-
-def circle(x, y, radius=0.15):
-    from matplotlib.patches import Circle
-    from matplotlib.patheffects import withStroke
-    circle = Circle((x, y), radius, clip_on=False, zorder=10, linewidth=1,
-                    edgecolor='black', facecolor=(0, 0, 0, .0125),
-                    path_effects=[withStroke(linewidth=5, foreground='w')])
-    ax.add_artist(circle)
-
-
-def text(x, y, text):
-    ax.text(x, y, text, backgroundcolor="white",
-            ha='center', va='top', weight='bold', color='blue')
-
-
-# Minor tick
-circle(0.50, -0.10)
-text(0.50, -0.32, "Minor tick label")
-
-# Major tick
-circle(-0.03, 4.00)
-text(0.03, 3.80, "Major tick")
-
-# Minor tick
-circle(0.00, 3.50)
-text(0.00, 3.30, "Minor tick")
-
-# Major tick label
-circle(-0.15, 3.00)
-text(-0.15, 2.80, "Major tick label")
-
-# X Label
-circle(1.80, -0.27)
-text(1.80, -0.45, "X axis label")
-
-# Y Label
-circle(-0.27, 1.80)
-text(-0.27, 1.6, "Y axis label")
-
-# Title
-circle(1.60, 4.13)
-text(1.60, 3.93, "Title")
-
-# Blue plot
-circle(1.75, 2.80)
-text(1.75, 2.60, "Line\n(line plot)")
-
-# Red plot
-circle(1.20, 0.60)
-text(1.20, 0.40, "Line\n(line plot)")
-
-# Scatter plot
-circle(3.20, 1.75)
-text(3.20, 1.55, "Markers\n(scatter plot)")
-
-# Grid
-circle(3.00, 3.00)
-text(3.00, 2.80, "Grid")
-
-# Legend
-circle(3.70, 3.80)
-text(3.70, 3.60, "Legend")
-
-# Axes
-circle(0.5, 0.5)
-text(0.5, 0.3, "Axes")
-
-# Figure
-circle(-0.3, 0.65)
-text(-0.3, 0.45, "Figure")
-
-color = 'blue'
-ax.annotate('Spines', xy=(4.0, 0.35), xycoords='data',
-            xytext=(3.3, 0.5), textcoords='data',
-            weight='bold', color=color,
-            arrowprops=dict(arrowstyle='->',
-                            connectionstyle="arc3",
-                            color=color))
-
-ax.annotate('', xy=(3.15, 0.0), xycoords='data',
-            xytext=(3.45, 0.45), textcoords='data',
-            weight='bold', color=color,
-            arrowprops=dict(arrowstyle='->',
-                            connectionstyle="arc3",
-                            color=color))
-
-ax.text(4.0, -0.4, "Made with http://matplotlib.org",
-        fontsize=10, ha="right", color='.5')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/showcase/bachelors_degrees_by_gender.html b/examples/showcase/bachelors_degrees_by_gender.html deleted file mode 100644 index dd8916020e6..00000000000 --- a/examples/showcase/bachelors_degrees_by_gender.html +++ /dev/null @@ -1,423 +0,0 @@ - - - - - - - - showcase example code: bachelors_degrees_by_gender.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

showcase example code: bachelors_degrees_by_gender.py

-

(Source code, png, pdf)

-
-../../_images/bachelors_degrees_by_gender.png -
-
import matplotlib.pyplot as plt
-from matplotlib.mlab import csv2rec
-from matplotlib.cbook import get_sample_data
-
-fname = get_sample_data('percent_bachelors_degrees_women_usa.csv')
-gender_degree_data = csv2rec(fname)
-
-# These are the colors that will be used in the plot
-color_sequence = ['#1f77b4', '#aec7e8', '#ff7f0e', '#ffbb78', '#2ca02c',
-                  '#98df8a', '#d62728', '#ff9896', '#9467bd', '#c5b0d5',
-                  '#8c564b', '#c49c94', '#e377c2', '#f7b6d2', '#7f7f7f',
-                  '#c7c7c7', '#bcbd22', '#dbdb8d', '#17becf', '#9edae5']
-
-# You typically want your plot to be ~1.33x wider than tall. This plot
-# is a rare exception because of the number of lines being plotted on it.
-# Common sizes: (10, 7.5) and (12, 9)
-fig, ax = plt.subplots(1, 1, figsize=(12, 14))
-
-# Remove the plot frame lines. They are unnecessary here.
-ax.spines['top'].set_visible(False)
-ax.spines['bottom'].set_visible(False)
-ax.spines['right'].set_visible(False)
-ax.spines['left'].set_visible(False)
-
-# Ensure that the axis ticks only show up on the bottom and left of the plot.
-# Ticks on the right and top of the plot are generally unnecessary.
-ax.get_xaxis().tick_bottom()
-ax.get_yaxis().tick_left()
-
-fig.subplots_adjust(left=.06, right=.75, bottom=.02, top=.94)
-# Limit the range of the plot to only where the data is.
-# Avoid unnecessary whitespace.
-ax.set_xlim(1969.5, 2011.1)
-ax.set_ylim(-0.25, 90)
-
-# Make sure your axis ticks are large enough to be easily read.
-# You don't want your viewers squinting to read your plot.
-plt.xticks(range(1970, 2011, 10), fontsize=14)
-plt.yticks(range(0, 91, 10), fontsize=14)
-ax.xaxis.set_major_formatter(plt.FuncFormatter('{:.0f}'.format))
-ax.yaxis.set_major_formatter(plt.FuncFormatter('{:.0f}%'.format))
-
-# Provide tick lines across the plot to help your viewers trace along
-# the axis ticks. Make sure that the lines are light and small so they
-# don't obscure the primary data lines.
-plt.grid(True, 'major', 'y', ls='--', lw=.5, c='k', alpha=.3)
-
-# Remove the tick marks; they are unnecessary with the tick lines we just
-# plotted.
-plt.tick_params(axis='both', which='both', bottom='off', top='off',
-                labelbottom='on', left='off', right='off', labelleft='on')
-
-# Now that the plot is prepared, it's time to actually plot the data!
-# Note that I plotted the majors in order of the highest % in the final year.
-majors = ['Health Professions', 'Public Administration', 'Education',
-          'Psychology', 'Foreign Languages', 'English',
-          'Communications\nand Journalism', 'Art and Performance', 'Biology',
-          'Agriculture', 'Social Sciences and History', 'Business',
-          'Math and Statistics', 'Architecture', 'Physical Sciences',
-          'Computer Science', 'Engineering']
-
-y_offsets = {'Foreign Languages': 0.5, 'English': -0.5,
-             'Communications\nand Journalism': 0.75,
-             'Art and Performance': -0.25, 'Agriculture': 1.25,
-             'Social Sciences and History': 0.25, 'Business': -0.75,
-             'Math and Statistics': 0.75, 'Architecture': -0.75,
-             'Computer Science': 0.75, 'Engineering': -0.25}
-
-for rank, column in enumerate(majors):
-    # Plot each line separately with its own color.
-    column_rec_name = column.replace('\n', '_').replace(' ', '_').lower()
-
-    line = plt.plot(gender_degree_data.year,
-                    gender_degree_data[column_rec_name],
-                    lw=2.5,
-                    color=color_sequence[rank])
-
-    # Add a text label to the right end of every line. Most of the code below
-    # is adding specific offsets y position because some labels overlapped.
-    y_pos = gender_degree_data[column_rec_name][-1] - 0.5
-
-    if column in y_offsets:
-        y_pos += y_offsets[column]
-
-    # Again, make sure that all labels are large enough to be easily read
-    # by the viewer.
-    plt.text(2011.5, y_pos, column, fontsize=14, color=color_sequence[rank])
-
-# Make the title big enough so it spans the entire plot, but don't make it
-# so big that it requires two lines to show.
-
-# Note that if the title is descriptive enough, it is unnecessary to include
-# axis labels; they are self-evident, in this plot's case.
-fig.suptitle('Percentage of Bachelor\'s degrees conferred to women in '
-             'the U.S.A. by major (1970-2011)\n', fontsize=18, ha='center')
-
-# Finally, save the figure as a PNG.
-# You can also save it as a PDF, JPEG, etc.
-# Just change the file extension in this call.
-# plt.savefig('percent-bachelors-degrees-women-usa.png', bbox_inches='tight')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/showcase/firefox.html b/examples/showcase/firefox.html deleted file mode 100644 index fc5ecebeeb9..00000000000 --- a/examples/showcase/firefox.html +++ /dev/null @@ -1,393 +0,0 @@ - - - - - - - - showcase example code: firefox.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

showcase example code: firefox.py

-

(Source code, png, pdf)

-
-../../_images/firefox.png -
-
"""
-=======
-Firefox
-=======
-
-This example shows how to create the Firefox logo with path and patches.
-"""
-
-import re
-import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.path import Path
-import matplotlib.patches as patches
-
-# From: http://raphaeljs.com/icons/#firefox
-firefox = "M28.4,22.469c0.479-0.964,0.851-1.991,1.095-3.066c0.953-3.661,0.666-6.854,0.666-6.854l-0.327,2.104c0,0-0.469-3.896-1.044-5.353c-0.881-2.231-1.273-2.214-1.274-2.21c0.542,1.379,0.494,2.169,0.483,2.288c-0.01-0.016-0.019-0.032-0.027-0.047c-0.131-0.324-0.797-1.819-2.225-2.878c-2.502-2.481-5.943-4.014-9.745-4.015c-4.056,0-7.705,1.745-10.238,4.525C5.444,6.5,5.183,5.938,5.159,5.317c0,0-0.002,0.002-0.006,0.005c0-0.011-0.003-0.021-0.003-0.031c0,0-1.61,1.247-1.436,4.612c-0.299,0.574-0.56,1.172-0.777,1.791c-0.375,0.817-0.75,2.004-1.059,3.746c0,0,0.133-0.422,0.399-0.988c-0.064,0.482-0.103,0.971-0.116,1.467c-0.09,0.845-0.118,1.865-0.039,3.088c0,0,0.032-0.406,0.136-1.021c0.834,6.854,6.667,12.165,13.743,12.165l0,0c1.86,0,3.636-0.37,5.256-1.036C24.938,27.771,27.116,25.196,28.4,22.469zM16.002,3.356c2.446,0,4.73,0.68,6.68,1.86c-2.274-0.528-3.433-0.261-3.423-0.248c0.013,0.015,3.384,0.589,3.981,1.411c0,0-1.431,0-2.856,0.41c-0.065,0.019,5.242,0.663,6.327,5.966c0,0-0.582-1.213-1.301-1.42c0.473,1.439,0.351,4.17-0.1,5.528c-0.058,0.174-0.118-0.755-1.004-1.155c0.284,2.037-0.018,5.268-1.432,6.158c-0.109,0.07,0.887-3.189,0.201-1.93c-4.093,6.276-8.959,2.539-10.934,1.208c1.585,0.388,3.267,0.108,4.242-0.559c0.982-0.672,1.564-1.162,2.087-1.047c0.522,0.117,0.87-0.407,0.464-0.872c-0.405-0.466-1.392-1.105-2.725-0.757c-0.94,0.247-2.107,1.287-3.886,0.233c-1.518-0.899-1.507-1.63-1.507-2.095c0-0.366,0.257-0.88,0.734-1.028c0.58,0.062,1.044,0.214,1.537,0.466c0.005-0.135,0.006-0.315-0.001-0.519c0.039-0.077,0.015-0.311-0.047-0.596c-0.036-0.287-0.097-0.582-0.19-0.851c0.01-0.002,0.017-0.007,0.021-0.021c0.076-0.344,2.147-1.544,2.299-1.659c0.153-0.114,0.55-0.378,0.506-1.183c-0.015-0.265-0.058-0.294-2.232-0.286c-0.917,0.003-1.425-0.894-1.589-1.245c0.222-1.231,0.863-2.11,1.919-2.704c0.02-0.011,0.015-0.021-0.008-0.027c0.219-0.127-2.524-0.006-3.76,1.604C9.674,8.045,9.219,7.95,8.71,7.95c-0.638,0-1.139,0.07-1.603,0.187c-0.05,0.013-0.122,0.011-0.208-0.001C6.769,8.04,6.575,7.88,6.365,7.672c0.161-0.18,0.324-0.356,0.495-0.526C9.201,4.804,12.43,3.357,16.002,3.356z"
-
-
-def svg_parse(path):
-    commands = {'M': (Path.MOVETO,),
-                'L': (Path.LINETO,),
-                'Q': (Path.CURVE3,)*2,
-                'C': (Path.CURVE4,)*3,
-                'Z': (Path.CLOSEPOLY,)}
-    path_re = re.compile(r'([MLHVCSQTAZ])([^MLHVCSQTAZ]+)', re.IGNORECASE)
-    float_re = re.compile(r'(?:[\s,]*)([+-]?\d+(?:\.\d+)?)')
-    vertices = []
-    codes = []
-    last = (0, 0)
-    for cmd, values in path_re.findall(path):
-        points = [float(v) for v in float_re.findall(values)]
-        points = np.array(points).reshape((len(points)//2, 2))
-        if cmd.islower():
-            points += last
-        cmd = cmd.capitalize()
-        last = points[-1]
-        codes.extend(commands[cmd])
-        vertices.extend(points.tolist())
-    return codes, vertices
-
-# SVG to matplotlib
-codes, verts = svg_parse(firefox)
-verts = np.array(verts)
-path = Path(verts, codes)
-
-# Make upside down
-verts[:, 1] *= -1
-xmin, xmax = verts[:, 0].min()-1, verts[:, 0].max()+1
-ymin, ymax = verts[:, 1].min()-1, verts[:, 1].max()+1
-
-fig = plt.figure(figsize=(5, 5))
-ax = fig.add_axes([0.0, 0.0, 1.0, 1.0], frameon=False, aspect=1)
-
-# White outline (width = 6)
-patch = patches.PathPatch(path, facecolor='None', edgecolor='w', lw=6)
-ax.add_patch(patch)
-
-# Actual shape with black outline
-patch = patches.PathPatch(path, facecolor='orange', edgecolor='k', lw=2)
-ax.add_patch(patch)
-
-# Centering
-ax.set_xlim(xmin, xmax)
-ax.set_ylim(ymin, ymax)
-
-# No ticks
-ax.set_xticks([])
-ax.set_yticks([])
-
-# Display
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/showcase/index.html b/examples/showcase/index.html deleted file mode 100644 index 77c6c8dff8a..00000000000 --- a/examples/showcase/index.html +++ /dev/null @@ -1,332 +0,0 @@ - - - - - - - - showcase Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

showcase Examples

- --- - - - - - -
Release:2.0.2
Date:May 10, 2017
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/showcase/integral_demo.html b/examples/showcase/integral_demo.html deleted file mode 100644 index 61c6fec77f9..00000000000 --- a/examples/showcase/integral_demo.html +++ /dev/null @@ -1,373 +0,0 @@ - - - - - - - - showcase example code: integral_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

showcase example code: integral_demo.py

-

(Source code, png, pdf)

-
-../../_images/integral_demo.png -
-
"""
-Plot demonstrating the integral as the area under a curve.
-
-Although this is a simple example, it demonstrates some important tweaks:
-
-    * A simple line plot with custom color and line width.
-    * A shaded region created using a Polygon patch.
-    * A text label with mathtext rendering.
-    * figtext calls to label the x- and y-axes.
-    * Use of axis spines to hide the top and right spines.
-    * Custom tick placement and labels.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.patches import Polygon
-
-
-def func(x):
-    return (x - 3) * (x - 5) * (x - 7) + 85
-
-
-a, b = 2, 9  # integral limits
-x = np.linspace(0, 10)
-y = func(x)
-
-fig, ax = plt.subplots()
-plt.plot(x, y, 'r', linewidth=2)
-plt.ylim(ymin=0)
-
-# Make the shaded region
-ix = np.linspace(a, b)
-iy = func(ix)
-verts = [(a, 0)] + list(zip(ix, iy)) + [(b, 0)]
-poly = Polygon(verts, facecolor='0.9', edgecolor='0.5')
-ax.add_patch(poly)
-
-plt.text(0.5 * (a + b), 30, r"$\int_a^b f(x)\mathrm{d}x$",
-         horizontalalignment='center', fontsize=20)
-
-plt.figtext(0.9, 0.05, '$x$')
-plt.figtext(0.1, 0.9, '$y$')
-
-ax.spines['right'].set_visible(False)
-ax.spines['top'].set_visible(False)
-ax.xaxis.set_ticks_position('bottom')
-
-ax.set_xticks((a, b))
-ax.set_xticklabels(('$a$', '$b$'))
-ax.set_yticks([])
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/showcase/mandelbrot.html b/examples/showcase/mandelbrot.html deleted file mode 100644 index 4ea18401c42..00000000000 --- a/examples/showcase/mandelbrot.html +++ /dev/null @@ -1,398 +0,0 @@ - - - - - - - - showcase example code: mandelbrot.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

showcase example code: mandelbrot.py

-

(Source code, png, pdf)

-
-../../_images/mandelbrot.png -
-
"""
-===================================
-Shaded & power normalized rendering
-===================================
-
-The Mandelbrot set rendering can be improved by using a normalized recount
-associated with a power normalized colormap (gamma=0.3). Rendering can be
-further enhanced thanks to shading.
-
-The `maxiter` gives the precision of the computation. `maxiter=200` should
-take a few seconds on most modern laptops.
-"""
-import numpy as np
-
-
-def mandelbrot_set(xmin, xmax, ymin, ymax, xn, yn, maxiter, horizon=2.0):
-    X = np.linspace(xmin, xmax, xn, dtype=np.float32)
-    Y = np.linspace(ymin, ymax, yn, dtype=np.float32)
-    C = X + Y[:, None]*1j
-    N = np.zeros(C.shape, dtype=int)
-    Z = np.zeros(C.shape, np.complex64)
-    for n in range(maxiter):
-        I = np.less(abs(Z), horizon)
-        N[I] = n
-        Z[I] = Z[I]**2 + C[I]
-    N[N == maxiter-1] = 0
-    return Z, N
-
-
-if __name__ == '__main__':
-    import time
-    import matplotlib
-    from matplotlib import colors
-    import matplotlib.pyplot as plt
-
-    xmin, xmax, xn = -2.25, +0.75, 3000/2
-    ymin, ymax, yn = -1.25, +1.25, 2500/2
-    maxiter = 200
-    horizon = 2.0 ** 40
-    log_horizon = np.log(np.log(horizon))/np.log(2)
-    Z, N = mandelbrot_set(xmin, xmax, ymin, ymax, xn, yn, maxiter, horizon)
-
-    # Normalized recount as explained in:
-    # https://linas.org/art-gallery/escape/smooth.html
-    # https://www.ibm.com/developerworks/community/blogs/jfp/entry/My_Christmas_Gift
-
-    # This line will generate warnings for null values but it is faster to
-    # process them afterwards using the nan_to_num
-    with np.errstate(invalid='ignore'):
-        M = np.nan_to_num(N + 1 -
-                          np.log(np.log(abs(Z)))/np.log(2) +
-                          log_horizon)
-
-    dpi = 72
-    width = 10
-    height = 10*yn/xn
-    fig = plt.figure(figsize=(width, height), dpi=dpi)
-    ax = fig.add_axes([0.0, 0.0, 1.0, 1.0], frameon=False, aspect=1)
-
-    # Shaded rendering
-    light = colors.LightSource(azdeg=315, altdeg=10)
-    M = light.shade(M, cmap=plt.cm.hot, vert_exag=1.5,
-                    norm=colors.PowerNorm(0.3), blend_mode='hsv')
-    plt.imshow(M, extent=[xmin, xmax, ymin, ymax], interpolation="bicubic")
-    ax.set_xticks([])
-    ax.set_yticks([])
-
-    # Some advertisement for matplotlib
-    year = time.strftime("%Y")
-    major, minor, micro = matplotlib.__version__.split('.', 2)
-    text = ("The Mandelbrot fractal set\n"
-            "Rendered with matplotlib %s.%s, %s - http://matplotlib.org"
-            % (major, minor, year))
-    ax.text(xmin+.025, ymin+.025, text, color="white", fontsize=12, alpha=0.5)
-
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/showcase/xkcd.html b/examples/showcase/xkcd.html deleted file mode 100644 index 5e3f60ab319..00000000000 --- a/examples/showcase/xkcd.html +++ /dev/null @@ -1,388 +0,0 @@ - - - - - - - - showcase example code: xkcd.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

showcase example code: xkcd.py

-

(Source code)

-
-../../_images/xkcd_002.png -

(png, pdf)

-
-
-../../_images/xkcd_012.png -

(png, pdf)

-
-
"""
-====
-XKCD
-====
-
-Shows how to create an xkcd-like plot.
-"""
-import matplotlib.pyplot as plt
-import numpy as np
-
-with plt.xkcd():
-    # Based on "Stove Ownership" from XKCD by Randall Monroe
-    # http://xkcd.com/418/
-
-    fig = plt.figure()
-    ax = fig.add_axes((0.1, 0.2, 0.8, 0.7))
-    ax.spines['right'].set_color('none')
-    ax.spines['top'].set_color('none')
-    plt.xticks([])
-    plt.yticks([])
-    ax.set_ylim([-30, 10])
-
-    data = np.ones(100)
-    data[70:] -= np.arange(30)
-
-    plt.annotate(
-        'THE DAY I REALIZED\nI COULD COOK BACON\nWHENEVER I WANTED',
-        xy=(70, 1), arrowprops=dict(arrowstyle='->'), xytext=(15, -10))
-
-    plt.plot(data)
-
-    plt.xlabel('time')
-    plt.ylabel('my overall health')
-    fig.text(
-        0.5, 0.05,
-        '"Stove Ownership" from xkcd by Randall Monroe',
-        ha='center')
-
-    # Based on "The Data So Far" from XKCD by Randall Monroe
-    # http://xkcd.com/373/
-
-    fig = plt.figure()
-    ax = fig.add_axes((0.1, 0.2, 0.8, 0.7))
-    ax.bar([0, 1], [0, 100], 0.25)
-    ax.spines['right'].set_color('none')
-    ax.spines['top'].set_color('none')
-    ax.xaxis.set_ticks_position('bottom')
-    ax.set_xticks([0, 1])
-    ax.set_xlim([-0.5, 1.5])
-    ax.set_ylim([0, 110])
-    ax.set_xticklabels(['CONFIRMED BY\nEXPERIMENT', 'REFUTED BY\nEXPERIMENT'])
-    plt.yticks([])
-
-    plt.title("CLAIMS OF SUPERNATURAL POWERS")
-
-    fig.text(
-        0.5, 0.05,
-        '"The Data So Far" from xkcd by Randall Monroe',
-        ha='center')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/specialty_plots/advanced_hillshading.html b/examples/specialty_plots/advanced_hillshading.html deleted file mode 100644 index 629872a89ea..00000000000 --- a/examples/specialty_plots/advanced_hillshading.html +++ /dev/null @@ -1,402 +0,0 @@ - - - - - - - - specialty_plots example code: advanced_hillshading.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

specialty_plots example code: advanced_hillshading.py

-

(Source code)

-
-../../_images/advanced_hillshading_00.png -

(png, pdf)

-
-
-../../_images/advanced_hillshading_01.png -

(png, pdf)

-
-
-../../_images/advanced_hillshading_02.png -

(png, pdf)

-
-
"""
-Demonstrates a few common tricks with shaded plots.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.colors import LightSource, Normalize
-
-
-def display_colorbar():
-    """Display a correct numeric colorbar for a shaded plot."""
-    y, x = np.mgrid[-4:2:200j, -4:2:200j]
-    z = 10 * np.cos(x**2 + y**2)
-
-    cmap = plt.cm.copper
-    ls = LightSource(315, 45)
-    rgb = ls.shade(z, cmap)
-
-    fig, ax = plt.subplots()
-    ax.imshow(rgb, interpolation='bilinear')
-
-    # Use a proxy artist for the colorbar...
-    im = ax.imshow(z, cmap=cmap)
-    im.remove()
-    fig.colorbar(im)
-
-    ax.set_title('Using a colorbar with a shaded plot', size='x-large')
-
-
-def avoid_outliers():
-    """Use a custom norm to control the displayed z-range of a shaded plot."""
-    y, x = np.mgrid[-4:2:200j, -4:2:200j]
-    z = 10 * np.cos(x**2 + y**2)
-
-    # Add some outliers...
-    z[100, 105] = 2000
-    z[120, 110] = -9000
-
-    ls = LightSource(315, 45)
-    fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(8, 4.5))
-
-    rgb = ls.shade(z, plt.cm.copper)
-    ax1.imshow(rgb, interpolation='bilinear')
-    ax1.set_title('Full range of data')
-
-    rgb = ls.shade(z, plt.cm.copper, vmin=-10, vmax=10)
-    ax2.imshow(rgb, interpolation='bilinear')
-    ax2.set_title('Manually set range')
-
-    fig.suptitle('Avoiding Outliers in Shaded Plots', size='x-large')
-
-
-def shade_other_data():
-    """Demonstrates displaying different variables through shade and color."""
-    y, x = np.mgrid[-4:2:200j, -4:2:200j]
-    z1 = np.sin(x**2)  # Data to hillshade
-    z2 = np.cos(x**2 + y**2)  # Data to color
-
-    norm = Normalize(z2.min(), z2.max())
-    cmap = plt.cm.RdBu
-
-    ls = LightSource(315, 45)
-    rgb = ls.shade_rgb(cmap(norm(z2)), z1)
-
-    fig, ax = plt.subplots()
-    ax.imshow(rgb, interpolation='bilinear')
-    ax.set_title('Shade by one variable, color by another', size='x-large')
-
-display_colorbar()
-avoid_outliers()
-shade_other_data()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/specialty_plots/hinton_demo.html b/examples/specialty_plots/hinton_demo.html deleted file mode 100644 index 2e43adeb95d..00000000000 --- a/examples/specialty_plots/hinton_demo.html +++ /dev/null @@ -1,362 +0,0 @@ - - - - - - - - specialty_plots example code: hinton_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

specialty_plots example code: hinton_demo.py

-

(Source code, png, pdf)

-
-../../_images/hinton_demo.png -
-
"""
-Demo of a function to create Hinton diagrams.
-
-Hinton diagrams are useful for visualizing the values of a 2D array (e.g.
-a weight matrix): Positive and negative values are represented by white and
-black squares, respectively, and the size of each square represents the
-magnitude of each value.
-
-Initial idea from David Warde-Farley on the SciPy Cookbook
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-def hinton(matrix, max_weight=None, ax=None):
-    """Draw Hinton diagram for visualizing a weight matrix."""
-    ax = ax if ax is not None else plt.gca()
-
-    if not max_weight:
-        max_weight = 2 ** np.ceil(np.log(np.abs(matrix).max()) / np.log(2))
-
-    ax.patch.set_facecolor('gray')
-    ax.set_aspect('equal', 'box')
-    ax.xaxis.set_major_locator(plt.NullLocator())
-    ax.yaxis.set_major_locator(plt.NullLocator())
-
-    for (x, y), w in np.ndenumerate(matrix):
-        color = 'white' if w > 0 else 'black'
-        size = np.sqrt(np.abs(w) / max_weight)
-        rect = plt.Rectangle([x - size / 2, y - size / 2], size, size,
-                             facecolor=color, edgecolor=color)
-        ax.add_patch(rect)
-
-    ax.autoscale_view()
-    ax.invert_yaxis()
-
-
-if __name__ == '__main__':
-    hinton(np.random.rand(20, 20) - 0.5)
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/specialty_plots/index.html b/examples/specialty_plots/index.html deleted file mode 100644 index 03a6c48ed19..00000000000 --- a/examples/specialty_plots/index.html +++ /dev/null @@ -1,329 +0,0 @@ - - - - - - - - specialty_plots Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

specialty_plots Examples

- --- - - - - - -
Release:2.0.2
Date:May 10, 2017
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/specialty_plots/topographic_hillshading.html b/examples/specialty_plots/topographic_hillshading.html deleted file mode 100644 index a2e1a071ac0..00000000000 --- a/examples/specialty_plots/topographic_hillshading.html +++ /dev/null @@ -1,392 +0,0 @@ - - - - - - - - specialty_plots example code: topographic_hillshading.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

specialty_plots example code: topographic_hillshading.py

-

(Source code, png, pdf)

-
-../../_images/topographic_hillshading.png -
-
"""
-Demonstrates the visual effect of varying blend mode and vertical exaggeration
-on "hillshaded" plots.
-
-Note that the "overlay" and "soft" blend modes work well for complex surfaces
-such as this example, while the default "hsv" blend mode works best for smooth
-surfaces such as many mathematical functions.
-
-In most cases, hillshading is used purely for visual purposes, and *dx*/*dy*
-can be safely ignored. In that case, you can tweak *vert_exag* (vertical
-exaggeration) by trial and error to give the desired visual effect. However,
-this example demonstrates how to use the *dx* and *dy* kwargs to ensure that
-the *vert_exag* parameter is the true vertical exaggeration.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.cbook import get_sample_data
-from matplotlib.colors import LightSource
-
-dem = np.load(get_sample_data('jacksboro_fault_dem.npz'))
-z = dem['elevation']
-
-#-- Optional dx and dy for accurate vertical exaggeration --------------------
-# If you need topographically accurate vertical exaggeration, or you don't want
-# to guess at what *vert_exag* should be, you'll need to specify the cellsize
-# of the grid (i.e. the *dx* and *dy* parameters).  Otherwise, any *vert_exag*
-# value you specify will be relative to the grid spacing of your input data
-# (in other words, *dx* and *dy* default to 1.0, and *vert_exag* is calculated
-# relative to those parameters).  Similarly, *dx* and *dy* are assumed to be in
-# the same units as your input z-values.  Therefore, we'll need to convert the
-# given dx and dy from decimal degrees to meters.
-dx, dy = dem['dx'], dem['dy']
-dy = 111200 * dy
-dx = 111200 * dx * np.cos(np.radians(dem['ymin']))
-#-----------------------------------------------------------------------------
-
-# Shade from the northwest, with the sun 45 degrees from horizontal
-ls = LightSource(azdeg=315, altdeg=45)
-cmap = plt.cm.gist_earth
-
-fig, axes = plt.subplots(nrows=4, ncols=3, figsize=(8, 9))
-plt.setp(axes.flat, xticks=[], yticks=[])
-
-# Vary vertical exaggeration and blend mode and plot all combinations
-for col, ve in zip(axes.T, [0.1, 1, 10]):
-    # Show the hillshade intensity image in the first row
-    col[0].imshow(ls.hillshade(z, vert_exag=ve, dx=dx, dy=dy), cmap='gray')
-
-    # Place hillshaded plots with different blend modes in the rest of the rows
-    for ax, mode in zip(col[1:], ['hsv', 'overlay', 'soft']):
-        rgb = ls.shade(z, cmap=cmap, blend_mode=mode,
-                       vert_exag=ve, dx=dx, dy=dy)
-        ax.imshow(rgb)
-
-# Label rows and columns
-for ax, ve in zip(axes[0], [0.1, 1, 10]):
-    ax.set_title('{0}'.format(ve), size=18)
-for ax, mode in zip(axes[:, 0], ['Hillshade', 'hsv', 'overlay', 'soft']):
-    ax.set_ylabel(mode, size=18)
-
-# Group labels...
-axes[0, 1].annotate('Vertical Exaggeration', (0.5, 1), xytext=(0, 30),
-                    textcoords='offset points', xycoords='axes fraction',
-                    ha='center', va='bottom', size=20)
-axes[2, 0].annotate('Blend Mode', (0, 0.5), xytext=(-30, 0),
-                    textcoords='offset points', xycoords='axes fraction',
-                    ha='right', va='center', size=20, rotation=90)
-fig.subplots_adjust(bottom=0.05, right=0.95)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/statistics/boxplot_color_demo.html b/examples/statistics/boxplot_color_demo.html deleted file mode 100644 index f9febc3188a..00000000000 --- a/examples/statistics/boxplot_color_demo.html +++ /dev/null @@ -1,375 +0,0 @@ - - - - - - - - statistics example code: boxplot_color_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

statistics example code: boxplot_color_demo.py

-

(Source code, png, pdf)

-
-../../_images/boxplot_color_demo.png -
-
"""
-=================================
-Box plots with custom fill colors
-=================================
-
-This plot illustrates how to create two types of box plots
-(rectangular and notched), and how to fill them with custom
-colors by accessing the properties of the artists of the
-box plots. Additionally, the ``labels`` parameter is used to
-provide x-tick labels for each sample.
-
-A good general reference on boxplots and their history can be found
-here: http://vita.had.co.nz/papers/boxplots.pdf
-"""
-
-import matplotlib.pyplot as plt
-import numpy as np
-
-# Random test data
-np.random.seed(123)
-all_data = [np.random.normal(0, std, 100) for std in range(1, 4)]
-
-fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(9, 4))
-
-# rectangular box plot
-bplot1 = axes[0].boxplot(all_data,
-                         vert=True,   # vertical box aligmnent
-                         patch_artist=True)   # fill with color
-
-# notch shape box plot
-bplot2 = axes[1].boxplot(all_data,
-                         notch=True,  # notch shape
-                         vert=True,   # vertical box aligmnent
-                         patch_artist=True)   # fill with color
-
-# fill with colors
-colors = ['pink', 'lightblue', 'lightgreen']
-for bplot in (bplot1, bplot2):
-    for patch, color in zip(bplot['boxes'], colors):
-        patch.set_facecolor(color)
-
-# adding horizontal grid lines
-for ax in axes:
-    ax.yaxis.grid(True)
-    ax.set_xticks([y+1 for y in range(len(all_data))], )
-    ax.set_xlabel('xlabel')
-    ax.set_ylabel('ylabel')
-
-# add x-tick labels
-plt.setp(axes, xticks=[y+1 for y in range(len(all_data))],
-         xticklabels=['x1', 'x2', 'x3', 'x4'])
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/statistics/boxplot_demo.html b/examples/statistics/boxplot_demo.html deleted file mode 100644 index f7428d8943c..00000000000 --- a/examples/statistics/boxplot_demo.html +++ /dev/null @@ -1,419 +0,0 @@ - - - - - - - - statistics example code: boxplot_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

statistics example code: boxplot_demo.py

-

(Source code, png, pdf)

-
-../../_images/boxplot_demo_00_001.png -
-

(png, pdf)

-
-../../_images/boxplot_demo_01_001.png -
-
"""
-=========================================
-Demo of artist customization in box plots
-=========================================
-
-This example demonstrates how to use the various kwargs
-to fully customize box plots. The first figure demonstrates
-how to remove and add individual components (note that the
-mean is the only value not shown by default). The second
-figure demonstrates how the styles of the artists can
-be customized. It also demonstrates how to set the limit
-of the whiskers to specific percentiles (lower right axes)
-
-A good general reference on boxplots and their history can be found
-here: http://vita.had.co.nz/papers/boxplots.pdf
-
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-
-# fake data
-np.random.seed(937)
-data = np.random.lognormal(size=(37, 4), mean=1.5, sigma=1.75)
-labels = list('ABCD')
-fs = 10  # fontsize
-
-# demonstrate how to toggle the display of different elements:
-fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(6, 6), sharey=True)
-axes[0, 0].boxplot(data, labels=labels)
-axes[0, 0].set_title('Default', fontsize=fs)
-
-axes[0, 1].boxplot(data, labels=labels, showmeans=True)
-axes[0, 1].set_title('showmeans=True', fontsize=fs)
-
-axes[0, 2].boxplot(data, labels=labels, showmeans=True, meanline=True)
-axes[0, 2].set_title('showmeans=True,\nmeanline=True', fontsize=fs)
-
-axes[1, 0].boxplot(data, labels=labels, showbox=False, showcaps=False)
-tufte_title = 'Tufte Style \n(showbox=False,\nshowcaps=False)'
-axes[1, 0].set_title(tufte_title, fontsize=fs)
-
-axes[1, 1].boxplot(data, labels=labels, notch=True, bootstrap=10000)
-axes[1, 1].set_title('notch=True,\nbootstrap=10000', fontsize=fs)
-
-axes[1, 2].boxplot(data, labels=labels, showfliers=False)
-axes[1, 2].set_title('showfliers=False', fontsize=fs)
-
-for ax in axes.flatten():
-    ax.set_yscale('log')
-    ax.set_yticklabels([])
-
-fig.subplots_adjust(hspace=0.4)
-plt.show()
-
-
-# demonstrate how to customize the display different elements:
-boxprops = dict(linestyle='--', linewidth=3, color='darkgoldenrod')
-flierprops = dict(marker='o', markerfacecolor='green', markersize=12,
-                  linestyle='none')
-medianprops = dict(linestyle='-.', linewidth=2.5, color='firebrick')
-meanpointprops = dict(marker='D', markeredgecolor='black',
-                      markerfacecolor='firebrick')
-meanlineprops = dict(linestyle='--', linewidth=2.5, color='purple')
-
-fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(6, 6), sharey=True)
-axes[0, 0].boxplot(data, boxprops=boxprops)
-axes[0, 0].set_title('Custom boxprops', fontsize=fs)
-
-axes[0, 1].boxplot(data, flierprops=flierprops, medianprops=medianprops)
-axes[0, 1].set_title('Custom medianprops\nand flierprops', fontsize=fs)
-
-axes[0, 2].boxplot(data, whis='range')
-axes[0, 2].set_title('whis="range"', fontsize=fs)
-
-axes[1, 0].boxplot(data, meanprops=meanpointprops, meanline=False,
-                   showmeans=True)
-axes[1, 0].set_title('Custom mean\nas point', fontsize=fs)
-
-axes[1, 1].boxplot(data, meanprops=meanlineprops, meanline=True,
-                   showmeans=True)
-axes[1, 1].set_title('Custom mean\nas line', fontsize=fs)
-
-axes[1, 2].boxplot(data, whis=[15, 85])
-axes[1, 2].set_title('whis=[15, 85]\n#percentiles', fontsize=fs)
-
-for ax in axes.flatten():
-    ax.set_yscale('log')
-    ax.set_yticklabels([])
-
-fig.suptitle("I never said they'd be pretty")
-fig.subplots_adjust(hspace=0.4)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/statistics/boxplot_vs_violin_demo.html b/examples/statistics/boxplot_vs_violin_demo.html deleted file mode 100644 index 1aaf8e4d3a4..00000000000 --- a/examples/statistics/boxplot_vs_violin_demo.html +++ /dev/null @@ -1,373 +0,0 @@ - - - - - - - - statistics example code: boxplot_vs_violin_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

statistics example code: boxplot_vs_violin_demo.py

-

(Source code, png, pdf)

-
-../../_images/boxplot_vs_violin_demo.png -
-
"""
-===================================
-Box plot vs. violin plot comparison
-===================================
-
-Note that although violin plots are closely related to Tukey's (1977)
-box plots, they add useful information such as the distribution of the
-sample data (density trace).
-
-By default, box plots show data points outside 1.5 * the inter-quartile
-range as outliers above or below the whiskers whereas violin plots show
-the whole range of the data.
-
-A good general reference on boxplots and their history can be found
-here: http://vita.had.co.nz/papers/boxplots.pdf
-
-Violin plots require matplotlib >= 1.4.
-
-For more information on violin plots, the scikit-learn docs have a great
-section: http://scikit-learn.org/stable/modules/density.html
-"""
-
-import matplotlib.pyplot as plt
-import numpy as np
-
-fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(9, 4))
-
-# generate some random test data
-all_data = [np.random.normal(0, std, 100) for std in range(6, 10)]
-
-# plot violin plot
-axes[0].violinplot(all_data,
-                   showmeans=False,
-                   showmedians=True)
-axes[0].set_title('violin plot')
-
-# plot box plot
-axes[1].boxplot(all_data)
-axes[1].set_title('box plot')
-
-# adding horizontal grid lines
-for ax in axes:
-    ax.yaxis.grid(True)
-    ax.set_xticks([y+1 for y in range(len(all_data))])
-    ax.set_xlabel('xlabel')
-    ax.set_ylabel('ylabel')
-
-# add x-tick labels
-plt.setp(axes, xticks=[y+1 for y in range(len(all_data))],
-         xticklabels=['x1', 'x2', 'x3', 'x4'])
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/statistics/bxp_demo.html b/examples/statistics/bxp_demo.html deleted file mode 100644 index 0e8fe84c844..00000000000 --- a/examples/statistics/bxp_demo.html +++ /dev/null @@ -1,423 +0,0 @@ - - - - - - - - statistics example code: bxp_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

statistics example code: bxp_demo.py

-

(Source code, png, pdf)

-
-../../_images/bxp_demo_00_001.png -
-

(png, pdf)

-
-../../_images/bxp_demo_01_001.png -
-
"""
-===================================
-Demo of the boxplot drawer function
-===================================
-
-This example demonstrates how to pass pre-computed box plot
-statistics to the box plot drawer. The first figure demonstrates
-how to remove and add individual components (note that the
-mean is the only value not shown by default). The second
-figure demonstrates how the styles of the artists can
-be customized.
-
-A good general reference on boxplots and their history can be found
-here: http://vita.had.co.nz/papers/boxplots.pdf
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.cbook as cbook
-
-# fake data
-np.random.seed(937)
-data = np.random.lognormal(size=(37, 4), mean=1.5, sigma=1.75)
-labels = list('ABCD')
-
-# compute the boxplot stats
-stats = cbook.boxplot_stats(data, labels=labels, bootstrap=10000)
-# After we've computed the stats, we can go through and change anything.
-# Just to prove it, I'll set the median of each set to the median of all
-# the data, and double the means
-for n in range(len(stats)):
-    stats[n]['med'] = np.median(data)
-    stats[n]['mean'] *= 2
-
-print(stats[0].keys())
-
-fs = 10  # fontsize
-
-# demonstrate how to toggle the display of different elements:
-fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(6, 6), sharey=True)
-axes[0, 0].bxp(stats)
-axes[0, 0].set_title('Default', fontsize=fs)
-
-axes[0, 1].bxp(stats, showmeans=True)
-axes[0, 1].set_title('showmeans=True', fontsize=fs)
-
-axes[0, 2].bxp(stats, showmeans=True, meanline=True)
-axes[0, 2].set_title('showmeans=True,\nmeanline=True', fontsize=fs)
-
-axes[1, 0].bxp(stats, showbox=False, showcaps=False)
-tufte_title = 'Tufte Style\n(showbox=False,\nshowcaps=False)'
-axes[1, 0].set_title(tufte_title, fontsize=fs)
-
-axes[1, 1].bxp(stats, shownotches=True)
-axes[1, 1].set_title('notch=True', fontsize=fs)
-
-axes[1, 2].bxp(stats, showfliers=False)
-axes[1, 2].set_title('showfliers=False', fontsize=fs)
-
-for ax in axes.flatten():
-    ax.set_yscale('log')
-    ax.set_yticklabels([])
-
-fig.subplots_adjust(hspace=0.4)
-plt.show()
-
-# demonstrate how to customize the display different elements:
-boxprops = dict(linestyle='--', linewidth=3, color='darkgoldenrod')
-flierprops = dict(marker='o', markerfacecolor='green', markersize=12,
-                  linestyle='none')
-medianprops = dict(linestyle='-.', linewidth=2.5, color='firebrick')
-meanpointprops = dict(marker='D', markeredgecolor='black',
-                      markerfacecolor='firebrick')
-meanlineprops = dict(linestyle='--', linewidth=2.5, color='purple')
-
-fig, axes = plt.subplots(nrows=2, ncols=2, figsize=(6, 6), sharey=True)
-axes[0, 0].bxp(stats, boxprops=boxprops)
-axes[0, 0].set_title('Custom boxprops', fontsize=fs)
-
-axes[0, 1].bxp(stats, flierprops=flierprops, medianprops=medianprops)
-axes[0, 1].set_title('Custom medianprops\nand flierprops', fontsize=fs)
-
-axes[1, 0].bxp(stats, meanprops=meanpointprops, meanline=False,
-               showmeans=True)
-axes[1, 0].set_title('Custom mean\nas point', fontsize=fs)
-
-axes[1, 1].bxp(stats, meanprops=meanlineprops, meanline=True,
-               showmeans=True)
-axes[1, 1].set_title('Custom mean\nas line', fontsize=fs)
-
-for ax in axes.flatten():
-    ax.set_yscale('log')
-    ax.set_yticklabels([])
-
-fig.suptitle("I never said they'd be pretty")
-fig.subplots_adjust(hspace=0.4)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/statistics/customized_violin_demo.html b/examples/statistics/customized_violin_demo.html deleted file mode 100644 index df9d3993d4a..00000000000 --- a/examples/statistics/customized_violin_demo.html +++ /dev/null @@ -1,398 +0,0 @@ - - - - - - - - statistics example code: customized_violin_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

statistics example code: customized_violin_demo.py

-

(Source code, png, pdf)

-
-../../_images/customized_violin_demo.png -
-
"""
-=================================
-Demo of violin plot customization
-=================================
-
-This example demonstrates how to fully customize violin plots.
-The first plot shows the default style by providing only
-the data. The second plot first limits what matplotlib draws
-with additional kwargs. Then a simplified representation of
-a box plot is drawn on top. Lastly, the styles of the artists
-of the violins are modified.
-
-For more information on violin plots, the scikit-learn docs have a great
-section: http://scikit-learn.org/stable/modules/density.html
-"""
-
-import matplotlib.pyplot as plt
-import numpy as np
-
-
-def adjacent_values(vals, q1, q3):
-    upper_adjacent_value = q3 + (q3 - q1) * 1.5
-    upper_adjacent_value = np.clip(upper_adjacent_value, q3, vals[-1])
-
-    lower_adjacent_value = q1 - (q3 - q1) * 1.5
-    lower_adjacent_value = np.clip(lower_adjacent_value, vals[0], q1)
-    return lower_adjacent_value, upper_adjacent_value
-
-
-def set_axis_style(ax, labels):
-    ax.get_xaxis().set_tick_params(direction='out')
-    ax.xaxis.set_ticks_position('bottom')
-    ax.set_xticks(np.arange(1, len(labels) + 1))
-    ax.set_xticklabels(labels)
-    ax.set_xlim(0.25, len(labels) + 0.75)
-    ax.set_xlabel('Sample name')
-
-
-# create test data
-np.random.seed(123)
-data = [sorted(np.random.normal(0, std, 100)) for std in range(1, 5)]
-
-fig, (ax1, ax2) = plt.subplots(nrows=1, ncols=2, figsize=(9, 4), sharey=True)
-
-ax1.set_title('Default violin plot')
-ax1.set_ylabel('Observed values')
-ax1.violinplot(data)
-
-ax2.set_title('Customized violin plot')
-parts = ax2.violinplot(
-        data, showmeans=False, showmedians=False,
-        showextrema=False)
-
-for pc in parts['bodies']:
-    pc.set_facecolor('#D43F3A')
-    pc.set_edgecolor('black')
-    pc.set_alpha(1)
-
-quartile1, medians, quartile3 = np.percentile(data, [25, 50, 75], axis=1)
-whiskers = np.array([
-    adjacent_values(sorted_array, q1, q3)
-    for sorted_array, q1, q3 in zip(data, quartile1, quartile3)])
-whiskersMin, whiskersMax = whiskers[:, 0], whiskers[:, 1]
-
-inds = np.arange(1, len(medians) + 1)
-ax2.scatter(inds, medians, marker='o', color='white', s=30, zorder=3)
-ax2.vlines(inds, quartile1, quartile3, color='k', linestyle='-', lw=5)
-ax2.vlines(inds, whiskersMin, whiskersMax, color='k', linestyle='-', lw=1)
-
-# set style for the axes
-labels = ['A', 'B', 'C', 'D']
-for ax in [ax1, ax2]:
-    set_axis_style(ax, labels)
-
-plt.subplots_adjust(bottom=0.15, wspace=0.05)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/statistics/errorbar_demo.html b/examples/statistics/errorbar_demo.html deleted file mode 100644 index 83749551107..00000000000 --- a/examples/statistics/errorbar_demo.html +++ /dev/null @@ -1,342 +0,0 @@ - - - - - - - - statistics example code: errorbar_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

statistics example code: errorbar_demo.py

-

(Source code, png, pdf)

-
-../../_images/errorbar_demo1.png -
-
"""
-=============================
-Demo of the errorbar function
-=============================
-
-This exhibits the most basic use of the error bar method.
-In this case, constant values are provided for the error
-in both the x- and y-directions.
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-
-# example data
-x = np.arange(0.1, 4, 0.5)
-y = np.exp(-x)
-
-fig, ax = plt.subplots()
-ax.errorbar(x, y, xerr=0.2, yerr=0.4)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/statistics/errorbar_demo_features.html b/examples/statistics/errorbar_demo_features.html deleted file mode 100644 index 98686ee0777..00000000000 --- a/examples/statistics/errorbar_demo_features.html +++ /dev/null @@ -1,369 +0,0 @@ - - - - - - - - statistics example code: errorbar_demo_features.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

statistics example code: errorbar_demo_features.py

-

(Source code, png, pdf)

-
-../../_images/errorbar_demo_features.png -
-
"""
-===================================================
-Demo of the different ways of specifying error bars
-===================================================
-
-Errors can be specified as a constant value (as shown in
-`errorbar_demo.py`). However, this example demonstrates
-how they vary by specifying arrays of error values.
-
-If the raw ``x`` and ``y`` data have length N, there are two options:
-
-Array of shape (N,):
-    Error varies for each point, but the error values are
-    symmetric (i.e. the lower and upper values are equal).
-
-Array of shape (2, N):
-    Error varies for each point, and the lower and upper limits
-    (in that order) are different (asymmetric case)
-
-In addition, this example demonstrates how to use log
-scale with error bars.
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-
-# example data
-x = np.arange(0.1, 4, 0.5)
-y = np.exp(-x)
-
-# example error bar values that vary with x-position
-error = 0.1 + 0.2 * x
-
-fig, (ax0, ax1) = plt.subplots(nrows=2, sharex=True)
-ax0.errorbar(x, y, yerr=error, fmt='-o')
-ax0.set_title('variable, symmetric error')
-
-# error bar values w/ different -/+ errors that
-# also vary with the x-position
-lower_error = 0.4 * error
-upper_error = error
-asymmetric_error = [lower_error, upper_error]
-
-ax1.errorbar(x, y, xerr=asymmetric_error, fmt='o')
-ax1.set_title('variable, asymmetric error')
-ax1.set_yscale('log')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/statistics/errorbar_limits.html b/examples/statistics/errorbar_limits.html deleted file mode 100644 index 803b7690d8c..00000000000 --- a/examples/statistics/errorbar_limits.html +++ /dev/null @@ -1,398 +0,0 @@ - - - - - - - - statistics example code: errorbar_limits.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

statistics example code: errorbar_limits.py

-

(Source code, png, pdf)

-
-../../_images/errorbar_limits.png -
-
"""
-===========================================================
-Demo of how to include upper and lower limits in error bars
-===========================================================
-
-In matplotlib, errors bars can have "limits". Applying limits to the
-error bars essentially makes the error unidirectional. Because of that,
-upper and lower limits can be applied in both the y- and x-directions
-via the ``uplims``, ``lolims``, ``xuplims``, and ``xlolims`` parameters,
-respectively. These parameters can be scalar or boolean arrays.
-
-For example, if ``xlolims`` is ``True``, the x-error bars will only
-extend from the data towards increasing values. If ``uplims`` is an
-array filled with ``False`` except for the 4th and 7th values, all of the
-y-error bars will be bidirectional, except the 4th and 7th bars, which
-will extend from the data towards decreasing y-values.
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-
-# example data
-x = np.array([0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0])
-y = np.exp(-x)
-xerr = 0.1
-yerr = 0.2
-
-# lower & upper limits of the error
-lolims = np.array([0, 0, 1, 0, 1, 0, 0, 0, 1, 0], dtype=bool)
-uplims = np.array([0, 1, 0, 0, 0, 1, 0, 0, 0, 1], dtype=bool)
-ls = 'dotted'
-
-fig, ax = plt.subplots(figsize=(7, 4))
-
-# standard error bars
-ax.errorbar(x, y, xerr=xerr, yerr=yerr, linestyle=ls)
-
-# including upper limits
-ax.errorbar(x, y + 0.5, xerr=xerr, yerr=yerr, uplims=uplims,
-            linestyle=ls)
-
-# including lower limits
-ax.errorbar(x, y + 1.0, xerr=xerr, yerr=yerr, lolims=lolims,
-            linestyle=ls)
-
-# including upper and lower limits
-ax.errorbar(x, y + 1.5, xerr=xerr, yerr=yerr,
-            lolims=lolims, uplims=uplims,
-            marker='o', markersize=8,
-            linestyle=ls)
-
-# Plot a series with lower and upper limits in both x & y
-# constant x-error with varying y-error
-xerr = 0.2
-yerr = np.zeros(x.shape) + 0.2
-yerr[[3, 6]] = 0.3
-
-# mock up some limits by modifying previous data
-xlolims = lolims
-xuplims = uplims
-lolims = np.zeros(x.shape)
-uplims = np.zeros(x.shape)
-lolims[[6]] = True  # only limited at this index
-uplims[[3]] = True  # only limited at this index
-
-# do the plotting
-ax.errorbar(x, y + 2.1, xerr=xerr, yerr=yerr,
-            xlolims=xlolims, xuplims=xuplims,
-            uplims=uplims, lolims=lolims,
-            marker='o', markersize=8,
-            linestyle='none')
-
-# tidy up the figure
-ax.set_xlim((0, 5.5))
-ax.set_title('Errorbar upper and lower limits')
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/statistics/errorbars_and_boxes.html b/examples/statistics/errorbars_and_boxes.html deleted file mode 100644 index 35903220b34..00000000000 --- a/examples/statistics/errorbars_and_boxes.html +++ /dev/null @@ -1,395 +0,0 @@ - - - - - - - - statistics example code: errorbars_and_boxes.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

statistics example code: errorbars_and_boxes.py

-

(Source code, png, pdf)

-
-../../_images/errorbars_and_boxes.png -
-
"""
-============================================================
-Demo on creating boxes from error bars using PatchCollection
-============================================================
-
-In this example, we snazz up a pretty standard error bar plot by adding
-a rectangle patch defined by the limits of the bars in both the x- and
-y- directions. To do this, we have to write our own custom function
-called ``make_error_boxes``. Close inspection of this function will
-reveal the preferred pattern in writing functions for matplotlib:
-
-  1. an ``Axes`` object is passed directly to the function
-  2. the function operates on the `Axes` methods directly, not through
-     the ``pyplot`` interface
-  3. plotting kwargs that could be abbreviated are spelled out for
-     better code readability in the future (for example we use
-     ``facecolor`` instead of ``fc``)
-  4. the artists returned by the ``Axes`` plotting methods are then
-     returned by the function so that, if desired, their styles
-     can be modified later outside of the function (they are not
-     modified in this example).
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.collections import PatchCollection
-from matplotlib.patches import Rectangle
-
-# Number of data points
-n = 5
-
-# Dummy data
-np.random.seed(10)
-x = np.arange(0, n, 1)
-y = np.random.rand(n) * 5.
-
-# Dummy errors (above and below)
-xerr = np.random.rand(2, n) + 0.1
-yerr = np.random.rand(2, n) + 0.2
-
-
-def make_error_boxes(ax, xdata, ydata, xerror, yerror, facecolor='r',
-                     edgecolor='None', alpha=0.5):
-
-    # Create list for all the error patches
-    errorboxes = []
-
-    # Loop over data points; create box from errors at each point
-    for x, y, xe, ye in zip(xdata, ydata, xerror.T, yerror.T):
-        rect = Rectangle((x - xe[0], y - ye[0]), xe.sum(), ye.sum())
-        errorboxes.append(rect)
-
-    # Create patch collection with specified colour/alpha
-    pc = PatchCollection(errorboxes, facecolor=facecolor, alpha=alpha,
-                         edgecolor=edgecolor)
-
-    # Add collection to axes
-    ax.add_collection(pc)
-
-    # Plot errorbars
-    artists = ax.errorbar(xdata, ydata, xerr=xerror, yerr=yerror,
-                          fmt='None', ecolor='k')
-
-    return artists
-
-
-# Create figure and axes
-fig, ax = plt.subplots(1)
-
-# Call function to create error boxes
-_ = make_error_boxes(ax, x, y, xerr, yerr)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/statistics/histogram_demo_cumulative.html b/examples/statistics/histogram_demo_cumulative.html deleted file mode 100644 index 174b22952ad..00000000000 --- a/examples/statistics/histogram_demo_cumulative.html +++ /dev/null @@ -1,394 +0,0 @@ - - - - - - - - statistics example code: histogram_demo_cumulative.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

statistics example code: histogram_demo_cumulative.py

-

(Source code, png, pdf)

-
-../../_images/histogram_demo_cumulative.png -
-
"""
-==========================================================
-Demo of using histograms to plot a cumulative distribution
-==========================================================
-
-This shows how to plot a cumulative, normalized histogram as a
-step function in order to visualize the empirical cumulative
-distribution function (CDF) of a sample. We also use the ``mlab``
-module to show the theoretical CDF.
-
-A couple of other options to the ``hist`` function are demonstrated.
-Namely, we use the ``normed`` parameter to normalize the histogram and
-a couple of different options to the ``cumulative`` parameter.
-The ``normed`` parameter takes a boolean value. When ``True``, the bin
-heights are scaled such that the total area of the histogram is 1. The
-``cumulative`` kwarg is a little more nuanced. Like ``normed``, you
-can pass it True or False, but you can also pass it -1 to reverse the
-distribution.
-
-Since we're showing a normalized and cumulative histogram, these curves
-are effectively the cumulative distribution functions (CDFs) of the
-samples. In engineering, empirical CDFs are sometimes called
-"non-exceedance" curves. In other words, you can look at the
-y-value for a given-x-value to get the probability of and observation
-from the sample not exceeding that x-value. For example, the value of
-225 on the x-axis corresponds to about 0.85 on the y-axis, so there's an
-85% chance that an observation in the sample does not exceed 225.
-Conversely, setting, ``cumulative`` to -1 as is done in the
-last series for this example, creates a "exceedance" curve.
-
-Selecting different bin counts and sizes can significantly affect the
-shape of a histogram. The Astropy docs have a great section on how to
-select these parameters:
-http://docs.astropy.org/en/stable/visualization/histogram.html
-
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib import mlab
-
-np.random.seed(0)
-
-mu = 200
-sigma = 25
-n_bins = 50
-x = np.random.normal(mu, sigma, size=100)
-
-fig, ax = plt.subplots(figsize=(8, 4))
-
-# plot the cumulative histogram
-n, bins, patches = ax.hist(x, n_bins, normed=1, histtype='step',
-                           cumulative=True, label='Empirical')
-
-# Add a line showing the expected distribution.
-y = mlab.normpdf(bins, mu, sigma).cumsum()
-y /= y[-1]
-
-ax.plot(bins, y, 'k--', linewidth=1.5, label='Theoretical')
-
-# Overlay a reversed cumulative histogram.
-ax.hist(x, bins=bins, normed=1, histtype='step', cumulative=-1,
-        label='Reversed emp.')
-
-# tidy up the figure
-ax.grid(True)
-ax.legend(loc='right')
-ax.set_title('Cumulative step histograms')
-ax.set_xlabel('Annual rainfall (mm)')
-ax.set_ylabel('Likelihood of occurrence')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/statistics/histogram_demo_features.html b/examples/statistics/histogram_demo_features.html deleted file mode 100644 index 9e4b106b4fb..00000000000 --- a/examples/statistics/histogram_demo_features.html +++ /dev/null @@ -1,371 +0,0 @@ - - - - - - - - statistics example code: histogram_demo_features.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

statistics example code: histogram_demo_features.py

-

(Source code, png, pdf)

-
-../../_images/histogram_demo_features2.png -
-
"""
-=========================================================
-Demo of the histogram (hist) function with a few features
-=========================================================
-
-In addition to the basic histogram, this demo shows a few optional
-features:
-
-    * Setting the number of data bins
-    * The ``normed`` flag, which normalizes bin heights so that the
-      integral of the histogram is 1. The resulting histogram is an
-      approximation of the probability density function.
-    * Setting the face color of the bars
-    * Setting the opacity (alpha value).
-
-Selecting different bin counts and sizes can significantly affect the
-shape of a histogram. The Astropy docs have a great section on how to
-select these parameters:
-http://docs.astropy.org/en/stable/visualization/histogram.html
-"""
-
-import numpy as np
-import matplotlib.mlab as mlab
-import matplotlib.pyplot as plt
-
-np.random.seed(0)
-
-# example data
-mu = 100  # mean of distribution
-sigma = 15  # standard deviation of distribution
-x = mu + sigma * np.random.randn(437)
-
-num_bins = 50
-
-fig, ax = plt.subplots()
-
-# the histogram of the data
-n, bins, patches = ax.hist(x, num_bins, normed=1)
-
-# add a 'best fit' line
-y = mlab.normpdf(bins, mu, sigma)
-ax.plot(bins, y, '--')
-ax.set_xlabel('Smarts')
-ax.set_ylabel('Probability density')
-ax.set_title(r'Histogram of IQ: $\mu=100$, $\sigma=15$')
-
-# Tweak spacing to prevent clipping of ylabel
-fig.tight_layout()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/statistics/histogram_demo_histtypes.html b/examples/statistics/histogram_demo_histtypes.html deleted file mode 100644 index a7f48106bd5..00000000000 --- a/examples/statistics/histogram_demo_histtypes.html +++ /dev/null @@ -1,357 +0,0 @@ - - - - - - - - statistics example code: histogram_demo_histtypes.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

statistics example code: histogram_demo_histtypes.py

-

(Source code, png, pdf)

-
-../../_images/histogram_demo_histtypes.png -
-
"""
-================================================================
-Demo of the histogram function's different ``histtype`` settings
-================================================================
-
-* Histogram with step curve that has a color fill.
-* Histogram with custom and unequal bin widths.
-
-Selecting different bin counts and sizes can significantly affect the
-shape of a histogram. The Astropy docs have a great section on how to
-select these parameters:
-http://docs.astropy.org/en/stable/visualization/histogram.html
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-
-np.random.seed(0)
-
-mu = 200
-sigma = 25
-x = np.random.normal(mu, sigma, size=100)
-
-fig, (ax0, ax1) = plt.subplots(ncols=2, figsize=(8, 4))
-
-ax0.hist(x, 20, normed=1, histtype='stepfilled', facecolor='g', alpha=0.75)
-ax0.set_title('stepfilled')
-
-# Create a histogram by providing the bin edges (unequally spaced).
-bins = [100, 150, 180, 195, 205, 220, 250, 300]
-ax1.hist(x, bins, normed=1, histtype='bar', rwidth=0.8)
-ax1.set_title('unequal bins')
-
-fig.tight_layout()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/statistics/histogram_demo_multihist.html b/examples/statistics/histogram_demo_multihist.html deleted file mode 100644 index 82d0286abaa..00000000000 --- a/examples/statistics/histogram_demo_multihist.html +++ /dev/null @@ -1,369 +0,0 @@ - - - - - - - - statistics example code: histogram_demo_multihist.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

statistics example code: histogram_demo_multihist.py

-

(Source code, png, pdf)

-
-../../_images/histogram_demo_multihist.png -
-
"""
-=============================================================
-Demo of the histogram (hist) function with multiple data sets
-=============================================================
-
-Plot histogram with multiple sample sets and demonstrate:
-
-    * Use of legend with multiple sample sets
-    * Stacked bars
-    * Step curve with no fill
-    * Data sets of different sample sizes
-
-Selecting different bin counts and sizes can significantly affect the
-shape of a histogram. The Astropy docs have a great section on how to
-select these parameters:
-http://docs.astropy.org/en/stable/visualization/histogram.html
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-
-np.random.seed(0)
-
-n_bins = 10
-x = np.random.randn(1000, 3)
-
-fig, axes = plt.subplots(nrows=2, ncols=2)
-ax0, ax1, ax2, ax3 = axes.flatten()
-
-colors = ['red', 'tan', 'lime']
-ax0.hist(x, n_bins, normed=1, histtype='bar', color=colors, label=colors)
-ax0.legend(prop={'size': 10})
-ax0.set_title('bars with legend')
-
-ax1.hist(x, n_bins, normed=1, histtype='bar', stacked=True)
-ax1.set_title('stacked bar')
-
-ax2.hist(x, n_bins, histtype='step', stacked=True, fill=False)
-ax2.set_title('stack step (unfilled)')
-
-# Make a multiple-histogram of data-sets with different length.
-x_multi = [np.random.randn(n) for n in [10000, 5000, 2000]]
-ax3.hist(x_multi, n_bins, histtype='bar')
-ax3.set_title('different sample sizes')
-
-fig.tight_layout()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/statistics/index.html b/examples/statistics/index.html deleted file mode 100644 index fe262a779ce..00000000000 --- a/examples/statistics/index.html +++ /dev/null @@ -1,341 +0,0 @@ - - - - - - - - statistics Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- - - - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/statistics/multiple_histograms_side_by_side.html b/examples/statistics/multiple_histograms_side_by_side.html deleted file mode 100644 index 965b4f16eef..00000000000 --- a/examples/statistics/multiple_histograms_side_by_side.html +++ /dev/null @@ -1,385 +0,0 @@ - - - - - - - - statistics example code: multiple_histograms_side_by_side.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

statistics example code: multiple_histograms_side_by_side.py

-

(Source code, png, pdf)

-
-../../_images/multiple_histograms_side_by_side.png -
-
"""
-=======================================================
-Demo of how to produce multiple histograms side by side
-=======================================================
-
-This example plots horizontal histograms of different samples along
-a categorical x-axis. Additionally, the histograms are plotted to
-be symmetrical about their x-position, thus making them very similar
-to violin plots.
-
-To make this highly specialized plot, we can't use the standard ``hist``
-method. Instead we use ``barh`` to draw the horizontal bars directly. The
-vertical positions and lengths of the bars are computed via the
-``np.histogram`` function. The histograms for all the samples are
-computed using the same range (min and max values) and number of bins,
-so that the bins for each sample are in the same vertical positions.
-
-Selecting different bin counts and sizes can significantly affect the
-shape of a histogram. The Astropy docs have a great section on how to
-select these parameters:
-http://docs.astropy.org/en/stable/visualization/histogram.html
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-
-np.random.seed(0)
-number_of_bins = 20
-
-# An example of three data sets to compare
-number_of_data_points = 387
-labels = ["A", "B", "C"]
-data_sets = [np.random.normal(0, 1, number_of_data_points),
-             np.random.normal(6, 1, number_of_data_points),
-             np.random.normal(-3, 1, number_of_data_points)]
-
-# Computed quantities to aid plotting
-hist_range = (np.min(data_sets), np.max(data_sets))
-binned_data_sets = [
-    np.histogram(d, range=hist_range, bins=number_of_bins)[0]
-    for d in data_sets
-]
-binned_maximums = np.max(binned_data_sets, axis=1)
-x_locations = np.arange(0, sum(binned_maximums), np.max(binned_maximums))
-
-# The bin_edges are the same for all of the histograms
-bin_edges = np.linspace(hist_range[0], hist_range[1], number_of_bins + 1)
-centers = 0.5 * (bin_edges + np.roll(bin_edges, 1))[:-1]
-heights = np.diff(bin_edges)
-
-# Cycle through and plot each histogram
-fig, ax = plt.subplots()
-for x_loc, binned_data in zip(x_locations, binned_data_sets):
-    lefts = x_loc - 0.5 * binned_data
-    ax.barh(centers, binned_data, height=heights, left=lefts)
-
-ax.set_xticks(x_locations)
-ax.set_xticklabels(labels)
-
-ax.set_ylabel("Data values")
-ax.set_xlabel("Data sets")
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/statistics/violinplot_demo.html b/examples/statistics/violinplot_demo.html deleted file mode 100644 index 25278ee3f54..00000000000 --- a/examples/statistics/violinplot_demo.html +++ /dev/null @@ -1,384 +0,0 @@ - - - - - - - - statistics example code: violinplot_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

statistics example code: violinplot_demo.py

-

(Source code, png, pdf)

-
-../../_images/violinplot_demo.png -
-
"""
-==================================
-Demo of the basics of violin plots
-==================================
-
-Violin plots are similar to histograms and box plots in that they show
-an abstract representation of the probability distribution of the
-sample. Rather than showing counts of data points that fall into bins
-or order statistics, violin plots use kernel density estimation (KDE) to
-compute an empirical distribution of the sample. That computation
-is controlled by several parameters. This example demonstrates how to
-modify the number of points at which the KDE is evaluated (``points``)
-and how to modify the band-width of the KDE (``bw_method``).
-
-For more information on violin plots and KDE, the scikit-learn docs
-have a great section: http://scikit-learn.org/stable/modules/density.html
-"""
-
-import random
-import numpy as np
-import matplotlib.pyplot as plt
-
-# fake data
-fs = 10  # fontsize
-pos = [1, 2, 4, 5, 7, 8]
-data = [np.random.normal(0, std, size=100) for std in pos]
-
-fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(6, 6))
-
-axes[0, 0].violinplot(data, pos, points=20, widths=0.3,
-                      showmeans=True, showextrema=True, showmedians=True)
-axes[0, 0].set_title('Custom violinplot 1', fontsize=fs)
-
-axes[0, 1].violinplot(data, pos, points=40, widths=0.5,
-                      showmeans=True, showextrema=True, showmedians=True,
-                      bw_method='silverman')
-axes[0, 1].set_title('Custom violinplot 2', fontsize=fs)
-
-axes[0, 2].violinplot(data, pos, points=60, widths=0.7, showmeans=True,
-                      showextrema=True, showmedians=True, bw_method=0.5)
-axes[0, 2].set_title('Custom violinplot 3', fontsize=fs)
-
-axes[1, 0].violinplot(data, pos, points=80, vert=False, widths=0.7,
-                      showmeans=True, showextrema=True, showmedians=True)
-axes[1, 0].set_title('Custom violinplot 4', fontsize=fs)
-
-axes[1, 1].violinplot(data, pos, points=100, vert=False, widths=0.9,
-                      showmeans=True, showextrema=True, showmedians=True,
-                      bw_method='silverman')
-axes[1, 1].set_title('Custom violinplot 5', fontsize=fs)
-
-axes[1, 2].violinplot(data, pos, points=200, vert=False, widths=1.1,
-                      showmeans=True, showextrema=True, showmedians=True,
-                      bw_method=0.5)
-axes[1, 2].set_title('Custom violinplot 6', fontsize=fs)
-
-for ax in axes.flatten():
-    ax.set_yticklabels([])
-
-fig.suptitle("Violin Plotting Examples")
-fig.subplots_adjust(hspace=0.4)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/style_sheets/index.html b/examples/style_sheets/index.html deleted file mode 100644 index 93a6cc7832b..00000000000 --- a/examples/style_sheets/index.html +++ /dev/null @@ -1,332 +0,0 @@ - - - - - - - - style_sheets Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

style_sheets Examples

- --- - - - - - -
Release:2.0.2
Date:May 10, 2017
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/style_sheets/plot_bmh.html b/examples/style_sheets/plot_bmh.html deleted file mode 100644 index 8ea32233b67..00000000000 --- a/examples/style_sheets/plot_bmh.html +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - style_sheets example code: plot_bmh.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

style_sheets example code: plot_bmh.py

-

(Source code, png, pdf)

-
-../../_images/plot_bmh.png -
-
"""
-========================================
-Bayesian Methods for Hackers style sheet
-========================================
-
-This example demonstrates the style used in the Bayesian Methods for Hackers
-[1]_ online book.
-
-.. [1] http://camdavidsonpilon.github.io/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/
-
-"""
-from numpy.random import beta
-import matplotlib.pyplot as plt
-
-
-plt.style.use('bmh')
-
-
-def plot_beta_hist(ax, a, b):
-    ax.hist(beta(a, b, size=10000), histtype="stepfilled",
-            bins=25, alpha=0.8, normed=True)
-
-
-fig, ax = plt.subplots()
-plot_beta_hist(ax, 10, 10)
-plot_beta_hist(ax, 4, 12)
-plot_beta_hist(ax, 50, 12)
-plot_beta_hist(ax, 6, 55)
-ax.set_title("'bmh' style sheet")
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/style_sheets/plot_dark_background.html b/examples/style_sheets/plot_dark_background.html deleted file mode 100644 index dc215a3cb70..00000000000 --- a/examples/style_sheets/plot_dark_background.html +++ /dev/null @@ -1,351 +0,0 @@ - - - - - - - - style_sheets example code: plot_dark_background.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

style_sheets example code: plot_dark_background.py

-

(Source code, png, pdf)

-
-../../_images/plot_dark_background.png -
-
"""
-===========================
-Dark background style sheet
-===========================
-
-This example demonstrates the "dark_background" style, which uses white for
-elements that are typically black (text, borders, etc). Note that not all plot
-elements default to colors defined by an rc parameter.
-
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-plt.style.use('dark_background')
-
-fig, ax = plt.subplots()
-
-L = 6
-x = np.linspace(0, L)
-ncolors = len(plt.rcParams['axes.prop_cycle'])
-shift = np.linspace(0, L, ncolors, endpoint=False)
-for s in shift:
-    ax.plot(x, np.sin(x + s), 'o-')
-ax.set_xlabel('x-axis')
-ax.set_ylabel('y-axis')
-ax.set_title("'dark_background' style sheet")
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/style_sheets/plot_fivethirtyeight.html b/examples/style_sheets/plot_fivethirtyeight.html deleted file mode 100644 index 14693e51c76..00000000000 --- a/examples/style_sheets/plot_fivethirtyeight.html +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - style_sheets example code: plot_fivethirtyeight.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

style_sheets example code: plot_fivethirtyeight.py

-

(Source code, png, pdf)

-
-../../_images/plot_fivethirtyeight.png -
-
"""
-===========================
-FiveThirtyEight style sheet
-===========================
-
-This shows an example of the "fivethirtyeight" styling, which
-tries to replicate the styles from FiveThirtyEight.com.
-"""
-
-from matplotlib import pyplot as plt
-import numpy as np
-
-
-plt.style.use('fivethirtyeight')
-
-x = np.linspace(0, 10)
-
-# Fixing random state for reproducibility
-np.random.seed(19680801)
-
-fig, ax = plt.subplots()
-
-ax.plot(x, np.sin(x) + x + np.random.randn(50))
-ax.plot(x, np.sin(x) + 0.5 * x + np.random.randn(50))
-ax.plot(x, np.sin(x) + 2 * x + np.random.randn(50))
-ax.plot(x, np.sin(x) - 0.5 * x + np.random.randn(50))
-ax.plot(x, np.sin(x) - 2 * x + np.random.randn(50))
-ax.plot(x, np.sin(x) + np.random.randn(50))
-ax.set_title("'fivethirtyeight' style sheet")
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/style_sheets/plot_ggplot.html b/examples/style_sheets/plot_ggplot.html deleted file mode 100644 index 6464dc7505f..00000000000 --- a/examples/style_sheets/plot_ggplot.html +++ /dev/null @@ -1,377 +0,0 @@ - - - - - - - - style_sheets example code: plot_ggplot.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

style_sheets example code: plot_ggplot.py

-

(Source code, png, pdf)

-
-../../_images/plot_ggplot.png -
-
"""
-==================
-ggplot style sheet
-==================
-
-This example demonstrates the "ggplot" style, which adjusts the style to
-emulate ggplot_ (a popular plotting package for R_).
-
-These settings were shamelessly stolen from [1]_ (with permission).
-
-.. [1] http://www.huyng.com/posts/sane-color-scheme-for-matplotlib/
-
-.. _ggplot: http://ggplot2.org/
-.. _R: https://www.r-project.org/
-
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-plt.style.use('ggplot')
-
-fig, axes = plt.subplots(ncols=2, nrows=2)
-ax1, ax2, ax3, ax4 = axes.ravel()
-
-# scatter plot (Note: `plt.scatter` doesn't use default colors)
-x, y = np.random.normal(size=(2, 200))
-ax1.plot(x, y, 'o')
-
-# sinusoidal lines with colors from default color cycle
-L = 2*np.pi
-x = np.linspace(0, L)
-ncolors = len(plt.rcParams['axes.prop_cycle'])
-shift = np.linspace(0, L, ncolors, endpoint=False)
-for s in shift:
-    ax2.plot(x, np.sin(x + s), '-')
-ax2.margins(0)
-
-# bar graphs
-x = np.arange(5)
-y1, y2 = np.random.randint(1, 25, size=(2, 5))
-width = 0.25
-ax3.bar(x, y1, width)
-ax3.bar(x + width, y2, width,
-        color=list(plt.rcParams['axes.prop_cycle'])[2]['color'])
-ax3.set_xticks(x + width)
-ax3.set_xticklabels(['a', 'b', 'c', 'd', 'e'])
-
-# circles with colors from default color cycle
-for i, color in enumerate(plt.rcParams['axes.prop_cycle']):
-    xy = np.random.normal(size=2)
-    ax4.add_patch(plt.Circle(xy, radius=0.3, color=color['color']))
-ax4.axis('equal')
-ax4.margins(0)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/style_sheets/plot_grayscale.html b/examples/style_sheets/plot_grayscale.html deleted file mode 100644 index 20a89bb6402..00000000000 --- a/examples/style_sheets/plot_grayscale.html +++ /dev/null @@ -1,360 +0,0 @@ - - - - - - - - style_sheets example code: plot_grayscale.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

style_sheets example code: plot_grayscale.py

-

(Source code, png, pdf)

-
-../../_images/plot_grayscale.png -
-
"""
-=====================
-Grayscale style sheet
-=====================
-
-This example demonstrates the "grayscale" style sheet, which changes all colors
-that are defined as rc parameters to grayscale. Note, however, that not all
-plot elements default to colors defined by an rc parameter.
-
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-def color_cycle_example(ax):
-    L = 6
-    x = np.linspace(0, L)
-    ncolors = len(plt.rcParams['axes.prop_cycle'])
-    shift = np.linspace(0, L, ncolors, endpoint=False)
-    for s in shift:
-        ax.plot(x, np.sin(x + s), 'o-')
-
-
-def image_and_patch_example(ax):
-    ax.imshow(np.random.random(size=(20, 20)), interpolation='none')
-    c = plt.Circle((5, 5), radius=5, label='patch')
-    ax.add_patch(c)
-
-
-plt.style.use('grayscale')
-
-fig, (ax1, ax2) = plt.subplots(ncols=2)
-fig.suptitle("'grayscale' style sheet")
-
-color_cycle_example(ax1)
-image_and_patch_example(ax2)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/style_sheets/style_sheets_reference.html b/examples/style_sheets/style_sheets_reference.html deleted file mode 100644 index e9bd414fdfe..00000000000 --- a/examples/style_sheets/style_sheets_reference.html +++ /dev/null @@ -1,561 +0,0 @@ - - - - - - - - style_sheets example code: style_sheets_reference.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

style_sheets example code: style_sheets_reference.py

-

(Source code)

-
-../../_images/style_sheets_reference_00.png -

(png, pdf)

-
-
-../../_images/style_sheets_reference_01.png -

(png, pdf)

-
-
-../../_images/style_sheets_reference_02.png -

(png, pdf)

-
-
-../../_images/style_sheets_reference_03.png -

(png, pdf)

-
-
-../../_images/style_sheets_reference_04.png -

(png, pdf)

-
-
-../../_images/style_sheets_reference_05.png -

(png, pdf)

-
-
-../../_images/style_sheets_reference_06.png -

(png, pdf)

-
-
-../../_images/style_sheets_reference_07.png -

(png, pdf)

-
-
-../../_images/style_sheets_reference_08.png -

(png, pdf)

-
-
-../../_images/style_sheets_reference_09.png -

(png, pdf)

-
-
-../../_images/style_sheets_reference_10.png -

(png, pdf)

-
-
-../../_images/style_sheets_reference_11.png -

(png, pdf)

-
-
-../../_images/style_sheets_reference_12.png -

(png, pdf)

-
-
-../../_images/style_sheets_reference_13.png -

(png, pdf)

-
-
-../../_images/style_sheets_reference_14.png -

(png, pdf)

-
-
-../../_images/style_sheets_reference_15.png -

(png, pdf)

-
-
-../../_images/style_sheets_reference_16.png -

(png, pdf)

-
-
-../../_images/style_sheets_reference_17.png -

(png, pdf)

-
-
-../../_images/style_sheets_reference_18.png -

(png, pdf)

-
-
-../../_images/style_sheets_reference_19.png -

(png, pdf)

-
-
-../../_images/style_sheets_reference_20.png -

(png, pdf)

-
-
-../../_images/style_sheets_reference_21.png -

(png, pdf)

-
-
-../../_images/style_sheets_reference_22.png -

(png, pdf)

-
-
-../../_images/style_sheets_reference_23.png -

(png, pdf)

-
-
"""
-======================
-Style sheets reference
-======================
-
-This script demonstrates the different available style sheets on a
-common set of example plots: scatter plot, image, bar graph, patches,
-line plot and histogram,
-
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-def plot_scatter(ax, prng, nb_samples=100):
-    """Scatter plot.
-    """
-    for mu, sigma, marker in [(-.5, 0.75, 'o'), (0.75, 1., 's')]:
-        x, y = prng.normal(loc=mu, scale=sigma, size=(2, nb_samples))
-        ax.plot(x, y, ls='none', marker=marker)
-    ax.set_xlabel('X-label')
-    return ax
-
-
-def plot_colored_sinusoidal_lines(ax):
-    """Plot sinusoidal lines with colors following the style color cycle.
-    """
-    L = 2 * np.pi
-    x = np.linspace(0, L)
-    nb_colors = len(plt.rcParams['axes.prop_cycle'])
-    shift = np.linspace(0, L, nb_colors, endpoint=False)
-    for s in shift:
-        ax.plot(x, np.sin(x + s), '-')
-    ax.set_xlim([x[0], x[-1]])
-    return ax
-
-
-def plot_bar_graphs(ax, prng, min_value=5, max_value=25, nb_samples=5):
-    """Plot two bar graphs side by side, with letters as x-tick labels.
-    """
-    x = np.arange(nb_samples)
-    ya, yb = prng.randint(min_value, max_value, size=(2, nb_samples))
-    width = 0.25
-    ax.bar(x, ya, width)
-    ax.bar(x + width, yb, width, color='C2')
-    ax.set_xticks(x + width)
-    ax.set_xticklabels(['a', 'b', 'c', 'd', 'e'])
-    return ax
-
-
-def plot_colored_circles(ax, prng, nb_samples=15):
-    """Plot circle patches.
-
-    NB: draws a fixed amount of samples, rather than using the length of
-    the color cycle, because different styles may have different numbers
-    of colors.
-    """
-    for sty_dict, j in zip(plt.rcParams['axes.prop_cycle'], range(nb_samples)):
-        ax.add_patch(plt.Circle(prng.normal(scale=3, size=2),
-                                radius=1.0, color=sty_dict['color']))
-    # Force the limits to be the same across the styles (because different
-    # styles may have different numbers of available colors).
-    ax.set_xlim([-4, 8])
-    ax.set_ylim([-5, 6])
-    ax.set_aspect('equal', adjustable='box')  # to plot circles as circles
-    return ax
-
-
-def plot_image_and_patch(ax, prng, size=(20, 20)):
-    """Plot an image with random values and superimpose a circular patch.
-    """
-    values = prng.random_sample(size=size)
-    ax.imshow(values, interpolation='none')
-    c = plt.Circle((5, 5), radius=5, label='patch')
-    ax.add_patch(c)
-    # Remove ticks
-    ax.set_xticks([])
-    ax.set_yticks([])
-
-
-def plot_histograms(ax, prng, nb_samples=10000):
-    """Plot 4 histograms and a text annotation.
-    """
-    params = ((10, 10), (4, 12), (50, 12), (6, 55))
-    for a, b in params:
-        values = prng.beta(a, b, size=nb_samples)
-        ax.hist(values, histtype="stepfilled", bins=30, alpha=0.8, normed=True)
-    # Add a small annotation.
-    ax.annotate('Annotation', xy=(0.25, 4.25), xycoords='data',
-                xytext=(0.9, 0.9), textcoords='axes fraction',
-                va="top", ha="right",
-                bbox=dict(boxstyle="round", alpha=0.2),
-                arrowprops=dict(
-                          arrowstyle="->",
-                          connectionstyle="angle,angleA=-95,angleB=35,rad=10"),
-                )
-    return ax
-
-
-def plot_figure(style_label=""):
-    """Setup and plot the demonstration figure with a given style.
-    """
-    # Use a dedicated RandomState instance to draw the same "random" values
-    # across the different figures.
-    prng = np.random.RandomState(96917002)
-
-    # Tweak the figure size to be better suited for a row of numerous plots:
-    # double the width and halve the height. NB: use relative changes because
-    # some styles may have a figure size different from the default one.
-    (fig_width, fig_height) = plt.rcParams['figure.figsize']
-    fig_size = [fig_width * 2, fig_height / 2]
-
-    fig, axes = plt.subplots(ncols=6, nrows=1, num=style_label,
-                             figsize=fig_size, squeeze=True)
-    axes[0].set_ylabel(style_label)
-
-    plot_scatter(axes[0], prng)
-    plot_image_and_patch(axes[1], prng)
-    plot_bar_graphs(axes[2], prng)
-    plot_colored_circles(axes[3], prng)
-    plot_colored_sinusoidal_lines(axes[4])
-    plot_histograms(axes[5], prng)
-
-    fig.tight_layout()
-
-    return fig
-
-
-if __name__ == "__main__":
-
-    # Setup a list of all available styles, in alphabetical order but
-    # the `default` and `classic` ones, which will be forced resp. in
-    # first and second position.
-    style_list = list(plt.style.available)  # *new* list: avoids side effects.
-    style_list.remove('classic')  # `classic` is in the list: first remove it.
-    style_list.sort()
-    style_list.insert(0, u'default')
-    style_list.insert(1, u'classic')
-
-    # Plot a demonstration figure for every available style sheet.
-    for style_label in style_list:
-        with plt.style.context(style_label):
-            fig = plot_figure(style_label=style_label)
-
-    plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/subplots_axes_and_figures/fahrenheit_celsius_scales.html b/examples/subplots_axes_and_figures/fahrenheit_celsius_scales.html deleted file mode 100644 index fb068d13b02..00000000000 --- a/examples/subplots_axes_and_figures/fahrenheit_celsius_scales.html +++ /dev/null @@ -1,359 +0,0 @@ - - - - - - - - subplots_axes_and_figures example code: fahrenheit_celsius_scales.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

subplots_axes_and_figures example code: fahrenheit_celsius_scales.py

-

(Source code, png, pdf)

-
-../../_images/fahrenheit_celsius_scales.png -
-
"""
-Demo of how to display two scales on the left and right y axis.
-
-This example uses the Fahrenheit and Celsius scales.
-"""
-import matplotlib.pyplot as plt
-import numpy as np
-
-
-def fahrenheit2celsius(temp):
-    """
-    Returns temperature in Celsius.
-    """
-    return (5. / 9.) * (temp - 32)
-
-
-def convert_ax_c_to_celsius(ax_f):
-    """
-    Update second axis according with first axis.
-    """
-    y1, y2 = ax_f.get_ylim()
-    ax_c.set_ylim(fahrenheit2celsius(y1), fahrenheit2celsius(y2))
-    ax_c.figure.canvas.draw()
-
-fig, ax_f = plt.subplots()
-ax_c = ax_f.twinx()
-
-# automatically update ylim of ax2 when ylim of ax1 changes.
-ax_f.callbacks.connect("ylim_changed", convert_ax_c_to_celsius)
-ax_f.plot(np.linspace(-40, 120, 100))
-ax_f.set_xlim(0, 100)
-
-ax_f.set_title('Two scales: Fahrenheit and Celsius')
-ax_f.set_ylabel('Fahrenheit')
-ax_c.set_ylabel('Celsius')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/subplots_axes_and_figures/index.html b/examples/subplots_axes_and_figures/index.html deleted file mode 100644 index 06fd2a38a2f..00000000000 --- a/examples/subplots_axes_and_figures/index.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - subplots_axes_and_figures Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

subplots_axes_and_figures Examples

- --- - - - - - -
Release:2.0.2
Date:May 10, 2017
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/subplots_axes_and_figures/subplot_demo.html b/examples/subplots_axes_and_figures/subplot_demo.html deleted file mode 100644 index 1b726786fbd..00000000000 --- a/examples/subplots_axes_and_figures/subplot_demo.html +++ /dev/null @@ -1,346 +0,0 @@ - - - - - - - - subplots_axes_and_figures example code: subplot_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

subplots_axes_and_figures example code: subplot_demo.py

-

(Source code, png, pdf)

-
-../../_images/subplot_demo.png -
-
"""
-Simple demo with multiple subplots.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-x1 = np.linspace(0.0, 5.0)
-x2 = np.linspace(0.0, 2.0)
-
-y1 = np.cos(2 * np.pi * x1) * np.exp(-x1)
-y2 = np.cos(2 * np.pi * x2)
-
-plt.subplot(2, 1, 1)
-plt.plot(x1, y1, 'o-')
-plt.title('A tale of 2 subplots')
-plt.ylabel('Damped oscillation')
-
-plt.subplot(2, 1, 2)
-plt.plot(x2, y2, '.-')
-plt.xlabel('time (s)')
-plt.ylabel('Undamped')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/tests/backend_driver.html b/examples/tests/backend_driver.html deleted file mode 100644 index 765be4a1292..00000000000 --- a/examples/tests/backend_driver.html +++ /dev/null @@ -1,844 +0,0 @@ - - - - - - - - tests example code: backend_driver.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

tests example code: backend_driver.py

-

[source code]

-
"""
-This is used to drive many of the examples across the backends, for
-regression testing, and comparing backend efficiency.
-
-You can specify the backends to be tested either via the --backends
-switch, which takes a comma-separated list, or as separate arguments,
-e.g.
-
-    python backend_driver.py agg ps
-
-would test the agg and ps backends. If no arguments are given, a
-default list of backends will be tested.
-
-Interspersed with the backend arguments can be switches for the Python
-interpreter executing the tests. If entering such arguments causes an
-option parsing error with the driver script, separate them from driver
-switches with a --.
-"""
-
-from __future__ import print_function, division
-import os
-import time
-import sys
-import glob
-from optparse import OptionParser
-
-import matplotlib.rcsetup as rcsetup
-from matplotlib.cbook import Bunch, dedent
-
-
-all_backends = list(rcsetup.all_backends)  # to leave the original list alone
-
-# actual physical directory for each dir
-dirs = dict(files=os.path.join('..', 'lines_bars_and_markers'),
-            shapes=os.path.join('..', 'shapes_and_collections'),
-            images=os.path.join('..', 'images_contours_and_fields'),
-            pie=os.path.join('..', 'pie_and_polar_charts'),
-            text=os.path.join('..', 'text_labels_and_annotations'),
-            ticks=os.path.join('..', 'ticks_and_spines'),
-            subplots=os.path.join('..', 'subplots_axes_and_figures'),
-            specialty=os.path.join('..', 'specialty_plots'),
-            showcase=os.path.join('..', 'showcase'),
-            pylab=os.path.join('..', 'pylab_examples'),
-            api=os.path.join('..', 'api'),
-            units=os.path.join('..', 'units'),
-            mplot3d=os.path.join('..', 'mplot3d'),
-            colors=os.path.join('..', 'color'))
-
-
-# files in each dir
-files = dict()
-
-files['lines'] = [
-    'barh_demo.py',
-    'fill_demo.py',
-    'fill_demo_features.py',
-    'line_demo_dash_control.py',
-    'line_styles_reference.py',
-    'scatter_with_legend.py'
-    ]
-
-files['shapes'] = [
-    'path_patch_demo.py',
-    'scatter_demo.py',
-    ]
-
-files['colors'] = [
-    'color_cycle_default.py',
-    'color_cycle_demo.py',
-    ]
-
-files['images'] = [
-    'image_demo.py',
-    'contourf_log.py',
-    ]
-
-files['statistics'] = [
-    'errorbar_demo.py',
-    'errorbar_demo_features.py',
-    'histogram_demo_cumulative.py',
-    'histogram_demo_features.py',
-    'histogram_demo_histtypes.py',
-    'histogram_demo_multihist.py',
-    ]
-
-files['pie'] = [
-    'pie_demo.py',
-    'polar_bar_demo.py',
-    'polar_scatter_demo.py',
-    ]
-
-files['text_labels_and_annotations'] = [
-    'text_demo_fontdict.py',
-    'unicode_demo.py',
-    ]
-
-files['ticks_and_spines'] = [
-    'spines_demo_bounds.py',
-    'ticklabels_demo_rotation.py',
-    ]
-
-files['subplots_axes_and_figures'] = [
-    'subplot_demo.py',
-    ]
-
-files['showcase'] = [
-    'integral_demo.py',
-    ]
-
-files['pylab'] = [
-    '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',
-    'axes_demo.py',
-    'axes_props.py',
-    'axhspan_demo.py',
-    'axis_equal_demo.py',
-    'bar_stacked.py',
-    'barb_demo.py',
-    'barchart_demo.py',
-    'barcode_demo.py',
-    'boxplot_demo.py',
-    'broken_barh.py',
-    'cohere_demo.py',
-    'color_by_yvalue.py',
-    'color_demo.py',
-    'colorbar_tick_labelling_demo.py',
-    'contour_demo.py',
-    'contour_image.py',
-    'contour_label_demo.py',
-    'contourf_demo.py',
-    'coords_demo.py',
-    'coords_report.py',
-    'csd_demo.py',
-    'cursor_demo.py',
-    'custom_cmap.py',
-    'custom_figure_class.py',
-    'custom_ticker1.py',
-    'customize_rc.py',
-    'dashpointlabel.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_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_demo.py',
-    'fill_spiral.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',
-    'vline_hline_demo.py',
-
-    'image_clip_path.py',
-    'image_demo.py',
-    'image_demo2.py',
-    'image_interp.py',
-    'image_masked.py',
-    'image_nonuniform.py',
-    'image_origin.py',
-    'image_slices_viewer.py',
-    'interp_demo.py',
-    'invert_axes.py',
-    'layer_images.py',
-    'legend_demo2.py',
-    'legend_demo3.py',
-    'line_collection.py',
-    'line_collection2.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',
-    'matshow.py',
-    'mri_demo.py',
-    'mri_with_eeg.py',
-    'multi_image.py',
-    'multiline.py',
-    'multiple_figs_demo.py',
-    'nan_test.py',
-    'newscalarformatter_demo.py',
-    'pcolor_demo.py',
-    'pcolor_log.py',
-    'pcolor_small.py',
-    'pie_demo2.py',
-    'plotfile_demo.py',
-    'polar_demo.py',
-    'polar_legend.py',
-    'psd_demo.py',
-    'psd_demo2.py',
-    'psd_demo3.py',
-    'quadmesh_demo.py',
-    'quiver_demo.py',
-    'scatter_custom_symbol.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',
-    'simple_plot.py',
-    'specgram_demo.py',
-    'spine_placement_demo.py',
-    'spy_demos.py',
-    'stem_plot.py',
-    'step_demo.py',
-    'stix_fonts_demo.py',
-    'subplots_adjust.py',
-    'symlog_demo.py',
-    'table_demo.py',
-    'text_handles.py',
-    'text_rotation.py',
-    'text_rotation_relative_to_line.py',
-    'transoffset.py',
-    'xcorr_demo.py',
-    'zorder_demo.py',
-    ]
-
-
-files['api'] = [
-    'agg_oo.py',
-    'barchart_demo.py',
-    'bbox_intersect.py',
-    'collections_demo.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',
-    'image_zcoord.py',
-    'joinstyle.py',
-    'legend_demo.py',
-    'line_with_text.py',
-    'logo2.py',
-    'mathtext_asarray.py',
-    'patch_collection.py',
-    'quad_bezier.py',
-    'scatter_piecharts.py',
-    'span_regions.py',
-    'two_scales.py',
-    'unicode_minus.py',
-    'watermark_image.py',
-    'watermark_text.py',
-]
-
-files['units'] = [
-    'annotate_with_units.py',
-    #'artist_tests.py',  # broken, fixme
-    'bar_demo2.py',
-    #'bar_unit_demo.py', # broken, fixme
-    #'ellipse_with_units.py',  # broken, fixme
-    'radian_demo.py',
-    'units_sample.py',
-    #'units_scatter.py', # broken, fixme
-
-    ]
-
-files['mplot3d'] = [
-    '2dcollections3d_demo.py',
-    'bars3d_demo.py',
-    'contour3d_demo.py',
-    'contour3d_demo2.py',
-    'contourf3d_demo.py',
-    'lines3d_demo.py',
-    'polys3d_demo.py',
-    'scatter3d_demo.py',
-    'surface3d_demo.py',
-    'surface3d_demo2.py',
-    'text3d_demo.py',
-    'wire3d_demo.py',
-    ]
-
-# dict from dir to files we know we don't want to test (e.g., examples
-# not using pyplot, examples requiring user input, animation examples,
-# examples that may only work in certain environs (usetex examples?),
-# examples that generate multiple figures
-
-excluded = {
-    'pylab': ['__init__.py', 'toggle_images.py', ],
-    'units': ['__init__.py', 'date_support.py', ],
-}
-
-
-def report_missing(dir, flist):
-    'report the py files in dir that are not in flist'
-    globstr = os.path.join(dir, '*.py')
-    fnames = glob.glob(globstr)
-
-    pyfiles = set([os.path.split(fullpath)[-1] for fullpath in set(fnames)])
-
-    exclude = set(excluded.get(dir, []))
-    flist = set(flist)
-    missing = list(pyfiles - flist - exclude)
-    missing.sort()
-    if missing:
-        print('%s files not tested: %s' % (dir, ', '.join(missing)))
-
-
-def report_all_missing(directories):
-    for f in directories:
-        report_missing(dirs[f], files[f])
-
-
-# tests known to fail on a given backend
-
-failbackend = dict(
-    svg=('tex_demo.py', ),
-    agg=('hyperlinks.py', ),
-    pdf=('hyperlinks.py', ),
-    ps=('hyperlinks.py', ),
-    )
-
-
-try:
-    import subprocess
-
-    def run(arglist):
-        try:
-            ret = subprocess.call(arglist)
-        except KeyboardInterrupt:
-            sys.exit()
-        else:
-            return ret
-except ImportError:
-    def run(arglist):
-        os.system(' '.join(arglist))
-
-
-def drive(backend, directories, python=['python'], switches=[]):
-    exclude = failbackend.get(backend, [])
-
-    # Clear the destination directory for the examples
-    path = backend
-    if os.path.exists(path):
-        import glob
-        for fname in os.listdir(path):
-            os.unlink(os.path.join(path, fname))
-    else:
-        os.mkdir(backend)
-    failures = []
-
-    testcases = [os.path.join(dirs[d], fname)
-                 for d in directories
-                 for fname in files[d]]
-
-    for fullpath in testcases:
-        print('\tdriving %-40s' % (fullpath))
-        sys.stdout.flush()
-        fpath, fname = os.path.split(fullpath)
-
-        if fname in exclude:
-            print('\tSkipping %s, known to fail on backend: %s' % backend)
-            continue
-
-        basename, ext = os.path.splitext(fname)
-        outfile = os.path.join(path, basename)
-        tmpfile_name = '_tmp_%s.py' % basename
-        tmpfile = open(tmpfile_name, 'w')
-
-        future_imports = 'from __future__ import division, print_function'
-        for line in open(fullpath):
-            line_lstrip = line.lstrip()
-            if line_lstrip.startswith("#"):
-                tmpfile.write(line)
-            elif 'unicode_literals' in line:
-                future_imports = future_imports + ', unicode_literals'
-
-        tmpfile.writelines((
-            future_imports + '\n',
-            'import sys\n',
-            'sys.path.append("%s")\n' % fpath.replace('\\', '\\\\'),
-            'import matplotlib\n',
-            'matplotlib.use("%s")\n' % backend,
-            'from pylab import savefig\n',
-            'import numpy\n',
-            'numpy.seterr(invalid="ignore")\n',
-            ))
-        for line in open(fullpath):
-            line_lstrip = line.lstrip()
-            if (line_lstrip.startswith('from __future__ import') or
-                    line_lstrip.startswith('matplotlib.use') or
-                    line_lstrip.startswith('savefig') or
-                    line_lstrip.startswith('show')):
-                continue
-            tmpfile.write(line)
-        if backend in rcsetup.interactive_bk:
-            tmpfile.write('show()')
-        else:
-            tmpfile.write('\nsavefig(r"%s", dpi=150)' % outfile)
-
-        tmpfile.close()
-        start_time = time.time()
-        program = [x % {'name': basename} for x in python]
-        ret = run(program + [tmpfile_name] + switches)
-        end_time = time.time()
-        print("%s %s" % ((end_time - start_time), ret))
-        #os.system('%s %s %s' % (python, tmpfile_name, ' '.join(switches)))
-        os.remove(tmpfile_name)
-        if ret:
-            failures.append(fullpath)
-    return failures
-
-
-def parse_options():
-    doc = (__doc__ and __doc__.split('\n\n')) or "  "
-    op = OptionParser(description=doc[0].strip(),
-                      usage='%prog [options] [--] [backends and switches]',
-                      #epilog='\n'.join(doc[1:])  # epilog not supported on my python2.4 machine: JDH
-                      )
-    op.disable_interspersed_args()
-    op.set_defaults(dirs='pylab,api,units,mplot3d',
-                    clean=False, coverage=False, valgrind=False)
-    op.add_option('-d', '--dirs', '--directories', type='string',
-                  dest='dirs', help=dedent('''
-      Run only the tests in these directories; comma-separated list of
-      one or more of: pylab (or pylab_examples), api, units, mplot3d'''))
-    op.add_option('-b', '--backends', type='string', dest='backends',
-                  help=dedent('''
-      Run tests only for these backends; comma-separated list of
-      one or more of: agg, ps, svg, pdf, template, cairo,
-      Default is everything except cairo.'''))
-    op.add_option('--clean', action='store_true', dest='clean',
-                  help='Remove result directories, run no tests')
-    op.add_option('-c', '--coverage', action='store_true', dest='coverage',
-                  help='Run in coverage.py')
-    op.add_option('-v', '--valgrind', action='store_true', dest='valgrind',
-                  help='Run in valgrind')
-
-    options, args = op.parse_args()
-    switches = [x for x in args if x.startswith('--')]
-    backends = [x.lower() for x in args if not x.startswith('--')]
-    if options.backends:
-        backends += [be.lower() for be in options.backends.split(',')]
-
-    result = Bunch(
-        dirs=options.dirs.split(','),
-        backends=backends or ['agg', 'ps', 'svg', 'pdf', 'template'],
-        clean=options.clean,
-        coverage=options.coverage,
-        valgrind=options.valgrind,
-        switches=switches)
-    if 'pylab_examples' in result.dirs:
-        result.dirs[result.dirs.index('pylab_examples')] = 'pylab'
-    #print(result)
-    return (result)
-
-if __name__ == '__main__':
-    times = {}
-    failures = {}
-    options = parse_options()
-
-    if options.clean:
-        localdirs = [d for d in glob.glob('*') if os.path.isdir(d)]
-        all_backends_set = set(all_backends)
-        for d in localdirs:
-            if d.lower() not in all_backends_set:
-                continue
-            print('removing %s' % d)
-            for fname in glob.glob(os.path.join(d, '*')):
-                os.remove(fname)
-            os.rmdir(d)
-        for fname in glob.glob('_tmp*.py'):
-            os.remove(fname)
-
-        print('all clean...')
-        raise SystemExit
-    if options.coverage:
-        python = ['coverage.py', '-x']
-    elif options.valgrind:
-        python = ['valgrind', '--tool=memcheck', '--leak-check=yes',
-                  '--log-file=%(name)s', sys.executable]
-    elif sys.platform == 'win32':
-        python = [sys.executable]
-    else:
-        python = [sys.executable]
-
-    report_all_missing(options.dirs)
-    for backend in options.backends:
-        print('testing %s %s' % (backend, ' '.join(options.switches)))
-        t0 = time.time()
-        failures[backend] = \
-            drive(backend, options.dirs, python, options.switches)
-        t1 = time.time()
-        times[backend] = (t1 - t0)/60.0
-
-    #print(times)
-    for backend, elapsed in times.items():
-        print('Backend %s took %1.2f minutes to complete' % (backend, elapsed))
-        failed = failures[backend]
-        if failed:
-            print('  Failures: %s' % failed)
-        if 'template' in times:
-            print('\ttemplate ratio %1.3f, template residual %1.3f' % (
-                elapsed/times['template'], elapsed - times['template']))
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/tests/backend_driver.py b/examples/tests/backend_driver.py deleted file mode 100644 index 4bc22f81751..00000000000 --- a/examples/tests/backend_driver.py +++ /dev/null @@ -1,525 +0,0 @@ -""" -This is used to drive many of the examples across the backends, for -regression testing, and comparing backend efficiency. - -You can specify the backends to be tested either via the --backends -switch, which takes a comma-separated list, or as separate arguments, -e.g. - - python backend_driver.py agg ps - -would test the agg and ps backends. If no arguments are given, a -default list of backends will be tested. - -Interspersed with the backend arguments can be switches for the Python -interpreter executing the tests. If entering such arguments causes an -option parsing error with the driver script, separate them from driver -switches with a --. -""" - -from __future__ import print_function, division -import os -import time -import sys -import glob -from optparse import OptionParser - -import matplotlib.rcsetup as rcsetup -from matplotlib.cbook import Bunch, dedent - - -all_backends = list(rcsetup.all_backends) # to leave the original list alone - -# actual physical directory for each dir -dirs = dict(files=os.path.join('..', 'lines_bars_and_markers'), - shapes=os.path.join('..', 'shapes_and_collections'), - images=os.path.join('..', 'images_contours_and_fields'), - pie=os.path.join('..', 'pie_and_polar_charts'), - text=os.path.join('..', 'text_labels_and_annotations'), - ticks=os.path.join('..', 'ticks_and_spines'), - subplots=os.path.join('..', 'subplots_axes_and_figures'), - specialty=os.path.join('..', 'specialty_plots'), - showcase=os.path.join('..', 'showcase'), - pylab=os.path.join('..', 'pylab_examples'), - api=os.path.join('..', 'api'), - units=os.path.join('..', 'units'), - mplot3d=os.path.join('..', 'mplot3d'), - colors=os.path.join('..', 'color')) - - -# files in each dir -files = dict() - -files['lines'] = [ - 'barh_demo.py', - 'fill_demo.py', - 'fill_demo_features.py', - 'line_demo_dash_control.py', - 'line_styles_reference.py', - 'scatter_with_legend.py' - ] - -files['shapes'] = [ - 'path_patch_demo.py', - 'scatter_demo.py', - ] - -files['colors'] = [ - 'color_cycle_default.py', - 'color_cycle_demo.py', - ] - -files['images'] = [ - 'image_demo.py', - 'contourf_log.py', - ] - -files['statistics'] = [ - 'errorbar_demo.py', - 'errorbar_demo_features.py', - 'histogram_demo_cumulative.py', - 'histogram_demo_features.py', - 'histogram_demo_histtypes.py', - 'histogram_demo_multihist.py', - ] - -files['pie'] = [ - 'pie_demo.py', - 'polar_bar_demo.py', - 'polar_scatter_demo.py', - ] - -files['text_labels_and_annotations'] = [ - 'text_demo_fontdict.py', - 'unicode_demo.py', - ] - -files['ticks_and_spines'] = [ - 'spines_demo_bounds.py', - 'ticklabels_demo_rotation.py', - ] - -files['subplots_axes_and_figures'] = [ - 'subplot_demo.py', - ] - -files['showcase'] = [ - 'integral_demo.py', - ] - -files['pylab'] = [ - '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', - 'axes_demo.py', - 'axes_props.py', - 'axhspan_demo.py', - 'axis_equal_demo.py', - 'bar_stacked.py', - 'barb_demo.py', - 'barchart_demo.py', - 'barcode_demo.py', - 'boxplot_demo.py', - 'broken_barh.py', - 'cohere_demo.py', - 'color_by_yvalue.py', - 'color_demo.py', - 'colorbar_tick_labelling_demo.py', - 'contour_demo.py', - 'contour_image.py', - 'contour_label_demo.py', - 'contourf_demo.py', - 'coords_demo.py', - 'coords_report.py', - 'csd_demo.py', - 'cursor_demo.py', - 'custom_cmap.py', - 'custom_figure_class.py', - 'custom_ticker1.py', - 'customize_rc.py', - 'dashpointlabel.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_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_demo.py', - 'fill_spiral.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', - 'vline_hline_demo.py', - - 'image_clip_path.py', - 'image_demo.py', - 'image_demo2.py', - 'image_interp.py', - 'image_masked.py', - 'image_nonuniform.py', - 'image_origin.py', - 'image_slices_viewer.py', - 'interp_demo.py', - 'invert_axes.py', - 'layer_images.py', - 'legend_demo2.py', - 'legend_demo3.py', - 'line_collection.py', - 'line_collection2.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', - 'matshow.py', - 'mri_demo.py', - 'mri_with_eeg.py', - 'multi_image.py', - 'multiline.py', - 'multiple_figs_demo.py', - 'nan_test.py', - 'newscalarformatter_demo.py', - 'pcolor_demo.py', - 'pcolor_log.py', - 'pcolor_small.py', - 'pie_demo2.py', - 'plotfile_demo.py', - 'polar_demo.py', - 'polar_legend.py', - 'psd_demo.py', - 'psd_demo2.py', - 'psd_demo3.py', - 'quadmesh_demo.py', - 'quiver_demo.py', - 'scatter_custom_symbol.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', - 'simple_plot.py', - 'specgram_demo.py', - 'spine_placement_demo.py', - 'spy_demos.py', - 'stem_plot.py', - 'step_demo.py', - 'stix_fonts_demo.py', - 'subplots_adjust.py', - 'symlog_demo.py', - 'table_demo.py', - 'text_handles.py', - 'text_rotation.py', - 'text_rotation_relative_to_line.py', - 'transoffset.py', - 'xcorr_demo.py', - 'zorder_demo.py', - ] - - -files['api'] = [ - 'agg_oo.py', - 'barchart_demo.py', - 'bbox_intersect.py', - 'collections_demo.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', - 'image_zcoord.py', - 'joinstyle.py', - 'legend_demo.py', - 'line_with_text.py', - 'logo2.py', - 'mathtext_asarray.py', - 'patch_collection.py', - 'quad_bezier.py', - 'scatter_piecharts.py', - 'span_regions.py', - 'two_scales.py', - 'unicode_minus.py', - 'watermark_image.py', - 'watermark_text.py', -] - -files['units'] = [ - 'annotate_with_units.py', - #'artist_tests.py', # broken, fixme - 'bar_demo2.py', - #'bar_unit_demo.py', # broken, fixme - #'ellipse_with_units.py', # broken, fixme - 'radian_demo.py', - 'units_sample.py', - #'units_scatter.py', # broken, fixme - - ] - -files['mplot3d'] = [ - '2dcollections3d_demo.py', - 'bars3d_demo.py', - 'contour3d_demo.py', - 'contour3d_demo2.py', - 'contourf3d_demo.py', - 'lines3d_demo.py', - 'polys3d_demo.py', - 'scatter3d_demo.py', - 'surface3d_demo.py', - 'surface3d_demo2.py', - 'text3d_demo.py', - 'wire3d_demo.py', - ] - -# dict from dir to files we know we don't want to test (e.g., examples -# not using pyplot, examples requiring user input, animation examples, -# examples that may only work in certain environs (usetex examples?), -# examples that generate multiple figures - -excluded = { - 'pylab': ['__init__.py', 'toggle_images.py', ], - 'units': ['__init__.py', 'date_support.py', ], -} - - -def report_missing(dir, flist): - 'report the py files in dir that are not in flist' - globstr = os.path.join(dir, '*.py') - fnames = glob.glob(globstr) - - pyfiles = set([os.path.split(fullpath)[-1] for fullpath in set(fnames)]) - - exclude = set(excluded.get(dir, [])) - flist = set(flist) - missing = list(pyfiles - flist - exclude) - missing.sort() - if missing: - print('%s files not tested: %s' % (dir, ', '.join(missing))) - - -def report_all_missing(directories): - for f in directories: - report_missing(dirs[f], files[f]) - - -# tests known to fail on a given backend - -failbackend = dict( - svg=('tex_demo.py', ), - agg=('hyperlinks.py', ), - pdf=('hyperlinks.py', ), - ps=('hyperlinks.py', ), - ) - - -try: - import subprocess - - def run(arglist): - try: - ret = subprocess.call(arglist) - except KeyboardInterrupt: - sys.exit() - else: - return ret -except ImportError: - def run(arglist): - os.system(' '.join(arglist)) - - -def drive(backend, directories, python=['python'], switches=[]): - exclude = failbackend.get(backend, []) - - # Clear the destination directory for the examples - path = backend - if os.path.exists(path): - import glob - for fname in os.listdir(path): - os.unlink(os.path.join(path, fname)) - else: - os.mkdir(backend) - failures = [] - - testcases = [os.path.join(dirs[d], fname) - for d in directories - for fname in files[d]] - - for fullpath in testcases: - print('\tdriving %-40s' % (fullpath)) - sys.stdout.flush() - fpath, fname = os.path.split(fullpath) - - if fname in exclude: - print('\tSkipping %s, known to fail on backend: %s' % backend) - continue - - basename, ext = os.path.splitext(fname) - outfile = os.path.join(path, basename) - tmpfile_name = '_tmp_%s.py' % basename - tmpfile = open(tmpfile_name, 'w') - - future_imports = 'from __future__ import division, print_function' - for line in open(fullpath): - line_lstrip = line.lstrip() - if line_lstrip.startswith("#"): - tmpfile.write(line) - elif 'unicode_literals' in line: - future_imports = future_imports + ', unicode_literals' - - tmpfile.writelines(( - future_imports + '\n', - 'import sys\n', - 'sys.path.append("%s")\n' % fpath.replace('\\', '\\\\'), - 'import matplotlib\n', - 'matplotlib.use("%s")\n' % backend, - 'from pylab import savefig\n', - 'import numpy\n', - 'numpy.seterr(invalid="ignore")\n', - )) - for line in open(fullpath): - line_lstrip = line.lstrip() - if (line_lstrip.startswith('from __future__ import') or - line_lstrip.startswith('matplotlib.use') or - line_lstrip.startswith('savefig') or - line_lstrip.startswith('show')): - continue - tmpfile.write(line) - if backend in rcsetup.interactive_bk: - tmpfile.write('show()') - else: - tmpfile.write('\nsavefig(r"%s", dpi=150)' % outfile) - - tmpfile.close() - start_time = time.time() - program = [x % {'name': basename} for x in python] - ret = run(program + [tmpfile_name] + switches) - end_time = time.time() - print("%s %s" % ((end_time - start_time), ret)) - #os.system('%s %s %s' % (python, tmpfile_name, ' '.join(switches))) - os.remove(tmpfile_name) - if ret: - failures.append(fullpath) - return failures - - -def parse_options(): - doc = (__doc__ and __doc__.split('\n\n')) or " " - op = OptionParser(description=doc[0].strip(), - usage='%prog [options] [--] [backends and switches]', - #epilog='\n'.join(doc[1:]) # epilog not supported on my python2.4 machine: JDH - ) - op.disable_interspersed_args() - op.set_defaults(dirs='pylab,api,units,mplot3d', - clean=False, coverage=False, valgrind=False) - op.add_option('-d', '--dirs', '--directories', type='string', - dest='dirs', help=dedent(''' - Run only the tests in these directories; comma-separated list of - one or more of: pylab (or pylab_examples), api, units, mplot3d''')) - op.add_option('-b', '--backends', type='string', dest='backends', - help=dedent(''' - Run tests only for these backends; comma-separated list of - one or more of: agg, ps, svg, pdf, template, cairo, - Default is everything except cairo.''')) - op.add_option('--clean', action='store_true', dest='clean', - help='Remove result directories, run no tests') - op.add_option('-c', '--coverage', action='store_true', dest='coverage', - help='Run in coverage.py') - op.add_option('-v', '--valgrind', action='store_true', dest='valgrind', - help='Run in valgrind') - - options, args = op.parse_args() - switches = [x for x in args if x.startswith('--')] - backends = [x.lower() for x in args if not x.startswith('--')] - if options.backends: - backends += [be.lower() for be in options.backends.split(',')] - - result = Bunch( - dirs=options.dirs.split(','), - backends=backends or ['agg', 'ps', 'svg', 'pdf', 'template'], - clean=options.clean, - coverage=options.coverage, - valgrind=options.valgrind, - switches=switches) - if 'pylab_examples' in result.dirs: - result.dirs[result.dirs.index('pylab_examples')] = 'pylab' - #print(result) - return (result) - -if __name__ == '__main__': - times = {} - failures = {} - options = parse_options() - - if options.clean: - localdirs = [d for d in glob.glob('*') if os.path.isdir(d)] - all_backends_set = set(all_backends) - for d in localdirs: - if d.lower() not in all_backends_set: - continue - print('removing %s' % d) - for fname in glob.glob(os.path.join(d, '*')): - os.remove(fname) - os.rmdir(d) - for fname in glob.glob('_tmp*.py'): - os.remove(fname) - - print('all clean...') - raise SystemExit - if options.coverage: - python = ['coverage.py', '-x'] - elif options.valgrind: - python = ['valgrind', '--tool=memcheck', '--leak-check=yes', - '--log-file=%(name)s', sys.executable] - elif sys.platform == 'win32': - python = [sys.executable] - else: - python = [sys.executable] - - report_all_missing(options.dirs) - for backend in options.backends: - print('testing %s %s' % (backend, ' '.join(options.switches))) - t0 = time.time() - failures[backend] = \ - drive(backend, options.dirs, python, options.switches) - t1 = time.time() - times[backend] = (t1 - t0)/60.0 - - #print(times) - for backend, elapsed in times.items(): - print('Backend %s took %1.2f minutes to complete' % (backend, elapsed)) - failed = failures[backend] - if failed: - print(' Failures: %s' % failed) - if 'template' in times: - print('\ttemplate ratio %1.3f, template residual %1.3f' % ( - elapsed/times['template'], elapsed - times['template'])) diff --git a/examples/tests/index.html b/examples/tests/index.html deleted file mode 100644 index 0f226fe803d..00000000000 --- a/examples/tests/index.html +++ /dev/null @@ -1,327 +0,0 @@ - - - - - - - - tests Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

tests Examples

- --- - - - - - -
Release:2.0.2
Date:May 10, 2017
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/text_labels_and_annotations/autowrap_demo.html b/examples/text_labels_and_annotations/autowrap_demo.html deleted file mode 100644 index 5886232d5c2..00000000000 --- a/examples/text_labels_and_annotations/autowrap_demo.html +++ /dev/null @@ -1,347 +0,0 @@ - - - - - - - - text_labels_and_annotations example code: autowrap_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

text_labels_and_annotations example code: autowrap_demo.py

-

(Source code, png, pdf)

-
-../../_images/autowrap_demo.png -
-
"""
-==================
-Auto-wrapping text
-==================
-
-Matplotlib can wrap text automatically, but if it's too long, the text will be
-displayed slightly outside of the boundaries of the axis anyways.
-"""
-
-import matplotlib.pyplot as plt
-
-fig = plt.figure()
-plt.axis([0, 10, 0, 10])
-t = "This is a really long string that I'd rather have wrapped so that it"\
-    " doesn't go outside of the figure, but if it's long enough it will go"\
-    " off the top or bottom!"
-plt.text(4, 1, t, ha='left', rotation=15, wrap=True)
-plt.text(6, 5, t, ha='left', rotation=15, wrap=True)
-plt.text(5, 5, t, ha='right', rotation=-15, wrap=True)
-plt.text(5, 10, t, fontsize=18, style='oblique', ha='center',
-         va='top', wrap=True)
-plt.text(3, 4, t, family='serif', style='italic', ha='right', wrap=True)
-plt.text(-1, 0, t, ha='left', rotation=-15, wrap=True)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/text_labels_and_annotations/index.html b/examples/text_labels_and_annotations/index.html deleted file mode 100644 index ddc0915720a..00000000000 --- a/examples/text_labels_and_annotations/index.html +++ /dev/null @@ -1,330 +0,0 @@ - - - - - - - - text_labels_and_annotations Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

text_labels_and_annotations Examples

- --- - - - - - -
Release:2.0.2
Date:May 10, 2017
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/text_labels_and_annotations/rainbow_text.html b/examples/text_labels_and_annotations/rainbow_text.html deleted file mode 100644 index 097c79bf7cf..00000000000 --- a/examples/text_labels_and_annotations/rainbow_text.html +++ /dev/null @@ -1,384 +0,0 @@ - - - - - - - - text_labels_and_annotations example code: rainbow_text.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

text_labels_and_annotations example code: rainbow_text.py

-

(Source code, png, pdf)

-
-../../_images/rainbow_text.png -
-
# -*- coding: utf-8 -*-
-"""
-The example shows how to string together several text objects.
-
-HISTORY
--------
-On the matplotlib-users list back in February 2012, Gökhan Sever asked the
-following question:
-
-    Is there a way in matplotlib to partially specify the color of a string?
-
-    Example:
-
-    plt.ylabel("Today is cloudy.")
-    How can I show "today" as red, "is" as green and "cloudy." as blue?
-
-    Thanks.
-
-Paul Ivanov responded with this answer:
-"""
-import matplotlib.pyplot as plt
-from matplotlib import transforms
-
-
-def rainbow_text(x, y, strings, colors, ax=None, **kw):
-    """
-    Take a list of ``strings`` and ``colors`` and place them next to each
-    other, with text strings[i] being shown in colors[i].
-
-    This example shows how to do both vertical and horizontal text, and will
-    pass all keyword arguments to plt.text, so you can set the font size,
-    family, etc.
-
-    The text will get added to the ``ax`` axes, if provided, otherwise the
-    currently active axes will be used.
-    """
-    if ax is None:
-        ax = plt.gca()
-    t = ax.transData
-    canvas = ax.figure.canvas
-
-    # horizontal version
-    for s, c in zip(strings, colors):
-        text = ax.text(x, y, s + " ", color=c, transform=t, **kw)
-        text.draw(canvas.get_renderer())
-        ex = text.get_window_extent()
-        t = transforms.offset_copy(text._transform, x=ex.width, units='dots')
-
-    # vertical version
-    for s, c in zip(strings, colors):
-        text = ax.text(x, y, s + " ", color=c, transform=t,
-                       rotation=90, va='bottom', ha='center', **kw)
-        text.draw(canvas.get_renderer())
-        ex = text.get_window_extent()
-        t = transforms.offset_copy(text._transform, y=ex.height, units='dots')
-
-
-rainbow_text(0, 0, "all unicorns poop rainbows ! ! !".split(),
-             ['red', 'cyan', 'brown', 'green', 'blue', 'purple', 'black'],
-             size=16)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/text_labels_and_annotations/text_demo_fontdict.html b/examples/text_labels_and_annotations/text_demo_fontdict.html deleted file mode 100644 index 0d451581ef0..00000000000 --- a/examples/text_labels_and_annotations/text_demo_fontdict.html +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - text_labels_and_annotations example code: text_demo_fontdict.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

text_labels_and_annotations example code: text_demo_fontdict.py

-

(Source code, png, pdf)

-
-../../_images/text_demo_fontdict.png -
-
"""
-=======================================================
-Controlling style of text and labels using a dictionary
-=======================================================
-
-This example shows how to share parameters across many text objects and labels
-by creating a dictionary of options passed across several functions.
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-font = {'family': 'serif',
-        'color':  'darkred',
-        'weight': 'normal',
-        'size': 16,
-        }
-
-x = np.linspace(0.0, 5.0, 100)
-y = np.cos(2*np.pi*x) * np.exp(-x)
-
-plt.plot(x, y, 'k')
-plt.title('Damped exponential decay', fontdict=font)
-plt.text(2, 0.65, r'$\cos(2 \pi t) \exp(-t)$', fontdict=font)
-plt.xlabel('time (s)', fontdict=font)
-plt.ylabel('voltage (mV)', fontdict=font)
-
-# Tweak spacing to prevent clipping of ylabel
-plt.subplots_adjust(left=0.15)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/text_labels_and_annotations/unicode_demo.html b/examples/text_labels_and_annotations/unicode_demo.html deleted file mode 100644 index 1033d984cd3..00000000000 --- a/examples/text_labels_and_annotations/unicode_demo.html +++ /dev/null @@ -1,338 +0,0 @@ - - - - - - - - text_labels_and_annotations example code: unicode_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

text_labels_and_annotations example code: unicode_demo.py

-

(Source code, png, pdf)

-
-../../_images/unicode_demo.png -
-
# -*- coding: utf-8 -*-
-"""
-Demo of unicode support in text and labels.
-"""
-from __future__ import unicode_literals
-
-import matplotlib.pyplot as plt
-
-
-plt.title('Développés et fabriqués')
-plt.xlabel("réactivité nous permettent d'être sélectionnés et adoptés")
-plt.ylabel('André was here!')
-plt.text(0.2, 0.8, 'Institut für Festkörperphysik', rotation=45)
-plt.text(0.4, 0.2, 'AVA (check kerning)')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/ticks_and_spines/index.html b/examples/ticks_and_spines/index.html deleted file mode 100644 index bbdb3243c51..00000000000 --- a/examples/ticks_and_spines/index.html +++ /dev/null @@ -1,333 +0,0 @@ - - - - - - - - ticks_and_spines Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

ticks_and_spines Examples

- --- - - - - - -
Release:2.0.2
Date:May 10, 2017
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/ticks_and_spines/spines_demo.html b/examples/ticks_and_spines/spines_demo.html deleted file mode 100644 index 51f3b675bdd..00000000000 --- a/examples/ticks_and_spines/spines_demo.html +++ /dev/null @@ -1,368 +0,0 @@ - - - - - - - - ticks_and_spines example code: spines_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

ticks_and_spines example code: spines_demo.py

-

(Source code, png, pdf)

-
-../../_images/spines_demo.png -
-
"""
-======
-Spines
-======
-
-This demo compares:
-    - normal axes, with spines on all four sides;
-    - an axes with spines only on the left and bottom;
-    - an axes using custom bounds to limit the extent of the spine.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-x = np.linspace(0, 2 * np.pi, 100)
-y = 2 * np.sin(x)
-
-fig, (ax0, ax1, ax2) = plt.subplots(nrows=3)
-
-ax0.plot(x, y)
-ax0.set_title('normal spines')
-
-ax1.plot(x, y)
-ax1.set_title('bottom-left spines')
-
-# Hide the right and top spines
-ax1.spines['right'].set_visible(False)
-ax1.spines['top'].set_visible(False)
-# Only show ticks on the left and bottom spines
-ax1.yaxis.set_ticks_position('left')
-ax1.xaxis.set_ticks_position('bottom')
-
-ax2.plot(x, y)
-
-# Only draw spine between the y-ticks
-ax2.spines['left'].set_bounds(-1, 1)
-# Hide the right and top spines
-ax2.spines['right'].set_visible(False)
-ax2.spines['top'].set_visible(False)
-# Only show ticks on the left and bottom spines
-ax2.yaxis.set_ticks_position('left')
-ax2.xaxis.set_ticks_position('bottom')
-
-# Tweak spacing between subplots to prevent labels from overlapping
-plt.subplots_adjust(hspace=0.5)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/ticks_and_spines/spines_demo_bounds.html b/examples/ticks_and_spines/spines_demo_bounds.html deleted file mode 100644 index 7734e848346..00000000000 --- a/examples/ticks_and_spines/spines_demo_bounds.html +++ /dev/null @@ -1,354 +0,0 @@ - - - - - - - - ticks_and_spines example code: spines_demo_bounds.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

ticks_and_spines example code: spines_demo_bounds.py

-

(Source code, png, pdf)

-
-../../_images/spines_demo_bounds.png -
-
"""
-Demo of spines using custom bounds to limit the extent of the spine.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-x = np.linspace(0, 2*np.pi, 50)
-y = np.sin(x)
-y2 = y + 0.1 * np.random.normal(size=x.shape)
-
-fig, ax = plt.subplots()
-ax.plot(x, y, 'k--')
-ax.plot(x, y2, 'ro')
-
-# set ticks and tick labels
-ax.set_xlim((0, 2*np.pi))
-ax.set_xticks([0, np.pi, 2*np.pi])
-ax.set_xticklabels(['0', '$\pi$', '2$\pi$'])
-ax.set_ylim((-1.5, 1.5))
-ax.set_yticks([-1, 0, 1])
-
-# Only draw spine between the y-ticks
-ax.spines['left'].set_bounds(-1, 1)
-# Hide the right and top spines
-ax.spines['right'].set_visible(False)
-ax.spines['top'].set_visible(False)
-# Only show ticks on the left and bottom spines
-ax.yaxis.set_ticks_position('left')
-ax.xaxis.set_ticks_position('bottom')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/ticks_and_spines/spines_demo_dropped.html b/examples/ticks_and_spines/spines_demo_dropped.html deleted file mode 100644 index c63bc34a219..00000000000 --- a/examples/ticks_and_spines/spines_demo_dropped.html +++ /dev/null @@ -1,350 +0,0 @@ - - - - - - - - ticks_and_spines example code: spines_demo_dropped.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

ticks_and_spines example code: spines_demo_dropped.py

-

(Source code, png, pdf)

-
-../../_images/spines_demo_dropped.png -
-
"""
-==============
-Dropped spines
-==============
-
-Demo of spines offset from the axes (a.k.a. "dropped spines").
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-fig, ax = plt.subplots()
-
-image = np.random.uniform(size=(10, 10))
-ax.imshow(image, cmap=plt.cm.gray, interpolation='nearest')
-ax.set_title('dropped spines')
-
-# Move left and bottom spines outward by 10 points
-ax.spines['left'].set_position(('outward', 10))
-ax.spines['bottom'].set_position(('outward', 10))
-# Hide the right and top spines
-ax.spines['right'].set_visible(False)
-ax.spines['top'].set_visible(False)
-# Only show ticks on the left and bottom spines
-ax.yaxis.set_ticks_position('left')
-ax.xaxis.set_ticks_position('bottom')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/ticks_and_spines/tick-formatters.html b/examples/ticks_and_spines/tick-formatters.html deleted file mode 100644 index a00b7d47de6..00000000000 --- a/examples/ticks_and_spines/tick-formatters.html +++ /dev/null @@ -1,420 +0,0 @@ - - - - - - - - ticks_and_spines example code: tick-formatters.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

ticks_and_spines example code: tick-formatters.py

-

(Source code, png, pdf)

-
-../../_images/tick-formatters.png -
-
"""
-===============
-Tick formatters
-===============
-
-Show the different tick formatters.
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.ticker as ticker
-
-
-# Setup a plot such that only the bottom spine is shown
-def setup(ax):
-    ax.spines['right'].set_color('none')
-    ax.spines['left'].set_color('none')
-    ax.yaxis.set_major_locator(ticker.NullLocator())
-    ax.spines['top'].set_color('none')
-    ax.xaxis.set_ticks_position('bottom')
-    ax.tick_params(which='major', width=1.00, length=5)
-    ax.tick_params(which='minor', width=0.75, length=2.5, labelsize=10)
-    ax.set_xlim(0, 5)
-    ax.set_ylim(0, 1)
-    ax.patch.set_alpha(0.0)
-
-
-plt.figure(figsize=(8, 5))
-n = 6
-
-# Null formatter
-ax = plt.subplot(n, 1, 1)
-setup(ax)
-ax.xaxis.set_major_locator(ticker.MultipleLocator(1.00))
-ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.25))
-ax.xaxis.set_major_formatter(ticker.NullFormatter())
-ax.xaxis.set_minor_formatter(ticker.NullFormatter())
-ax.text(0.0, 0.1, "NullFormatter()", fontsize=16, transform=ax.transAxes)
-
-# Fixed formatter
-ax = plt.subplot(n, 1, 2)
-setup(ax)
-ax.xaxis.set_major_locator(ticker.MultipleLocator(1.0))
-ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.25))
-majors = ["", "0", "1", "2", "3", "4", "5"]
-ax.xaxis.set_major_formatter(ticker.FixedFormatter(majors))
-minors = [""] + ["%.2f" % (x-int(x)) if (x-int(x))
-                 else "" for x in np.arange(0, 5, 0.25)]
-ax.xaxis.set_minor_formatter(ticker.FixedFormatter(minors))
-ax.text(0.0, 0.1, "FixedFormatter(['', '0', '1', ...])",
-        fontsize=15, transform=ax.transAxes)
-
-
-# Func formatter
-def major_formatter(x, pos):
-    return "[%.2f]" % x
-
-
-ax = plt.subplot(n, 1, 3)
-setup(ax)
-ax.xaxis.set_major_locator(ticker.MultipleLocator(1.00))
-ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.25))
-ax.xaxis.set_major_formatter(ticker.FuncFormatter(major_formatter))
-ax.text(0.0, 0.1, 'FuncFormatter(lambda x, pos: "[%.2f]" % x)',
-        fontsize=15, transform=ax.transAxes)
-
-
-# FormatStr formatter
-ax = plt.subplot(n, 1, 4)
-setup(ax)
-ax.xaxis.set_major_locator(ticker.MultipleLocator(1.00))
-ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.25))
-ax.xaxis.set_major_formatter(ticker.FormatStrFormatter(">%d<"))
-ax.text(0.0, 0.1, "FormatStrFormatter('>%d<')",
-        fontsize=15, transform=ax.transAxes)
-
-# Scalar formatter
-ax = plt.subplot(n, 1, 5)
-setup(ax)
-ax.xaxis.set_major_locator(ticker.AutoLocator())
-ax.xaxis.set_minor_locator(ticker.AutoMinorLocator())
-ax.xaxis.set_major_formatter(ticker.ScalarFormatter(useMathText=True))
-ax.text(0.0, 0.1, "ScalarFormatter()", fontsize=15, transform=ax.transAxes)
-
-# StrMethod formatter
-ax = plt.subplot(n, 1, 6)
-setup(ax)
-ax.xaxis.set_major_locator(ticker.MultipleLocator(1.00))
-ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.25))
-ax.xaxis.set_major_formatter(ticker.StrMethodFormatter("{x}"))
-ax.text(0.0, 0.1, "StrMethodFormatter('{x}')",
-        fontsize=15, transform=ax.transAxes)
-
-# Push the top of the top axes outside the figure because we only show the
-# bottom spine.
-plt.subplots_adjust(left=0.05, right=0.95, bottom=0.05, top=1.05)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/ticks_and_spines/tick-locators.html b/examples/ticks_and_spines/tick-locators.html deleted file mode 100644 index 0077cc90b2a..00000000000 --- a/examples/ticks_and_spines/tick-locators.html +++ /dev/null @@ -1,423 +0,0 @@ - - - - - - - - ticks_and_spines example code: tick-locators.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

ticks_and_spines example code: tick-locators.py

-

(Source code, png, pdf)

-
-../../_images/tick-locators.png -
-
"""
-=============
-Tick locators
-=============
-
-Show the different tick locators.
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.ticker as ticker
-
-
-# Setup a plot such that only the bottom spine is shown
-def setup(ax):
-    ax.spines['right'].set_color('none')
-    ax.spines['left'].set_color('none')
-    ax.yaxis.set_major_locator(ticker.NullLocator())
-    ax.spines['top'].set_color('none')
-    ax.xaxis.set_ticks_position('bottom')
-    ax.tick_params(which='major', width=1.00)
-    ax.tick_params(which='major', length=5)
-    ax.tick_params(which='minor', width=0.75)
-    ax.tick_params(which='minor', length=2.5)
-    ax.set_xlim(0, 5)
-    ax.set_ylim(0, 1)
-    ax.patch.set_alpha(0.0)
-
-
-plt.figure(figsize=(8, 6))
-n = 8
-
-# Null Locator
-ax = plt.subplot(n, 1, 1)
-setup(ax)
-ax.xaxis.set_major_locator(ticker.NullLocator())
-ax.xaxis.set_minor_locator(ticker.NullLocator())
-ax.text(0.0, 0.1, "NullLocator()", fontsize=14, transform=ax.transAxes)
-
-# Multiple Locator
-ax = plt.subplot(n, 1, 2)
-setup(ax)
-ax.xaxis.set_major_locator(ticker.MultipleLocator(0.5))
-ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.1))
-ax.text(0.0, 0.1, "MultipleLocator(0.5)", fontsize=14,
-        transform=ax.transAxes)
-
-# Fixed Locator
-ax = plt.subplot(n, 1, 3)
-setup(ax)
-majors = [0, 1, 5]
-ax.xaxis.set_major_locator(ticker.FixedLocator(majors))
-minors = np.linspace(0, 1, 11)[1:-1]
-ax.xaxis.set_minor_locator(ticker.FixedLocator(minors))
-ax.text(0.0, 0.1, "FixedLocator([0, 1, 5])", fontsize=14,
-        transform=ax.transAxes)
-
-# Linear Locator
-ax = plt.subplot(n, 1, 4)
-setup(ax)
-ax.xaxis.set_major_locator(ticker.LinearLocator(3))
-ax.xaxis.set_minor_locator(ticker.LinearLocator(31))
-ax.text(0.0, 0.1, "LinearLocator(numticks=3)",
-        fontsize=14, transform=ax.transAxes)
-
-# Index Locator
-ax = plt.subplot(n, 1, 5)
-setup(ax)
-ax.plot(range(0, 5), [0]*5, color='White')
-ax.xaxis.set_major_locator(ticker.IndexLocator(base=.5, offset=.25))
-ax.text(0.0, 0.1, "IndexLocator(base=0.5, offset=0.25)",
-        fontsize=14, transform=ax.transAxes)
-
-# Auto Locator
-ax = plt.subplot(n, 1, 6)
-setup(ax)
-ax.xaxis.set_major_locator(ticker.AutoLocator())
-ax.xaxis.set_minor_locator(ticker.AutoMinorLocator())
-ax.text(0.0, 0.1, "AutoLocator()", fontsize=14, transform=ax.transAxes)
-
-# MaxN Locator
-ax = plt.subplot(n, 1, 7)
-setup(ax)
-ax.xaxis.set_major_locator(ticker.MaxNLocator(4))
-ax.xaxis.set_minor_locator(ticker.MaxNLocator(40))
-ax.text(0.0, 0.1, "MaxNLocator(n=4)", fontsize=14, transform=ax.transAxes)
-
-# Log Locator
-ax = plt.subplot(n, 1, 8)
-setup(ax)
-ax.set_xlim(10**3, 10**10)
-ax.set_xscale('log')
-ax.xaxis.set_major_locator(ticker.LogLocator(base=10.0, numticks=15))
-ax.text(0.0, 0.1, "LogLocator(base=10, numticks=15)",
-        fontsize=15, transform=ax.transAxes)
-
-# Push the top of the top axes outside the figure because we only show the
-# bottom spine.
-plt.subplots_adjust(left=0.05, right=0.95, bottom=0.05, top=1.05)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/ticks_and_spines/tick_labels_from_values.html b/examples/ticks_and_spines/tick_labels_from_values.html deleted file mode 100644 index 136e80d5795..00000000000 --- a/examples/ticks_and_spines/tick_labels_from_values.html +++ /dev/null @@ -1,359 +0,0 @@ - - - - - - - - ticks_and_spines example code: tick_labels_from_values.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

ticks_and_spines example code: tick_labels_from_values.py

-

(Source code, png, pdf)

-
-../../_images/tick_labels_from_values.png -
-
"""
-=========================================
-Setting tick labels from a list of values
-=========================================
-
-Using ax.set_xticks causes the tick labels to be set on the currently
-chosen ticks. However, you may want to allow matplotlib to dynamically
-choose the number of ticks and their spacing.
-
-In this case it may be better to determine the tick label from the
-value at the tick. The following example shows how to do this.
-
-NB: The MaxNLocator is used here to ensure that the tick values
-take integer values.
-
-"""
-
-import matplotlib.pyplot as plt
-from matplotlib.ticker import FuncFormatter, MaxNLocator
-fig = plt.figure()
-ax = fig.add_subplot(111)
-xs = range(26)
-ys = range(26)
-labels = list('abcdefghijklmnopqrstuvwxyz')
-
-
-def format_fn(tick_val, tick_pos):
-    if int(tick_val) in xs:
-        return labels[int(tick_val)]
-    else:
-        return ''
-
-
-ax.xaxis.set_major_formatter(FuncFormatter(format_fn))
-ax.xaxis.set_major_locator(MaxNLocator(integer=True))
-ax.plot(xs, ys)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/ticks_and_spines/ticklabels_demo_rotation.html b/examples/ticks_and_spines/ticklabels_demo_rotation.html deleted file mode 100644 index ff35b026ad3..00000000000 --- a/examples/ticks_and_spines/ticklabels_demo_rotation.html +++ /dev/null @@ -1,344 +0,0 @@ - - - - - - - - ticks_and_spines example code: ticklabels_demo_rotation.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

ticks_and_spines example code: ticklabels_demo_rotation.py

-

(Source code, png, pdf)

-
-../../_images/ticklabels_demo_rotation.png -
-
"""
-===========================
-Rotating custom tick labels
-===========================
-
-Demo of custom tick-labels with user-defined rotation.
-"""
-import matplotlib.pyplot as plt
-
-
-x = [1, 2, 3, 4]
-y = [1, 4, 9, 6]
-labels = ['Frogs', 'Hogs', 'Bogs', 'Slogs']
-
-plt.plot(x, y, 'ro')
-# You can specify a rotation for the tick labels in degrees or with keywords.
-plt.xticks(x, labels, rotation='vertical')
-# Pad margins so that markers don't get clipped by the axes
-plt.margins(0.2)
-# Tweak spacing to prevent clipping of tick-labels
-plt.subplots_adjust(bottom=0.15)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/units/annotate_with_units.html b/examples/units/annotate_with_units.html deleted file mode 100644 index 95d724961f8..00000000000 --- a/examples/units/annotate_with_units.html +++ /dev/null @@ -1,354 +0,0 @@ - - - - - - - - units example code: annotate_with_units.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

units example code: annotate_with_units.py

-

(Source code, png, pdf)

-
-../../_images/annotate_with_units.png -
-
"""
-=====================
-Annotation with units
-=====================
-
-The example illustrates how to create text and arrow
-annotations using a centimeter-scale plot.
-
-"""
-import matplotlib.pyplot as plt
-from basic_units import cm
-
-fig, ax = plt.subplots()
-
-ax.annotate("Note 01", [0.5*cm, 0.5*cm])
-
-# xy and text both unitized
-ax.annotate('local max', xy=(3*cm, 1*cm), xycoords='data',
-            xytext=(0.8*cm, 0.95*cm), textcoords='data',
-            arrowprops=dict(facecolor='black', shrink=0.05),
-            horizontalalignment='right', verticalalignment='top')
-
-# mixing units w/ nonunits
-ax.annotate('local max', xy=(3*cm, 1*cm), xycoords='data',
-            xytext=(0.8, 0.95), textcoords='axes fraction',
-            arrowprops=dict(facecolor='black', shrink=0.05),
-            horizontalalignment='right', verticalalignment='top')
-
-
-ax.set_xlim(0*cm, 4*cm)
-ax.set_ylim(0*cm, 4*cm)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/units/artist_tests.html b/examples/units/artist_tests.html deleted file mode 100644 index 52b62228ee4..00000000000 --- a/examples/units/artist_tests.html +++ /dev/null @@ -1,380 +0,0 @@ - - - - - - - - units example code: artist_tests.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

units example code: artist_tests.py

-

(Source code, png, pdf)

-
-../../_images/artist_tests.png -
-
"""
-============
-Artist tests
-============
-
-Test unit support with each of the Matplotlib primitive artist types.
-
-The axis handles unit conversions and the artists keep a pointer to their axis
-parent. You must initialize the artists with the axis instance if you want to
-use them with unit data, or else they will not know how to convert the units
-to scalars.
-"""
-import random
-import matplotlib.lines as lines
-import matplotlib.patches as patches
-import matplotlib.text as text
-import matplotlib.collections as collections
-
-from basic_units import cm, inch
-import numpy as np
-import matplotlib.pyplot as plt
-
-fig, ax = plt.subplots()
-ax.xaxis.set_units(cm)
-ax.yaxis.set_units(cm)
-
-if 0:
-    # test a line collection
-    # Not supported at present.
-    verts = []
-    for i in range(10):
-        # a random line segment in inches
-        verts.append(zip(*inch*10*np.random.rand(2, random.randint(2, 15))))
-    lc = collections.LineCollection(verts, axes=ax)
-    ax.add_collection(lc)
-
-# test a plain-ol-line
-line = lines.Line2D([0*cm, 1.5*cm], [0*cm, 2.5*cm],
-                    lw=2, color='black', axes=ax)
-ax.add_line(line)
-
-if 0:
-    # test a patch
-    # Not supported at present.
-    rect = patches.Rectangle((1*cm, 1*cm), width=5*cm, height=2*cm,
-                             alpha=0.2, axes=ax)
-    ax.add_patch(rect)
-
-
-t = text.Text(3*cm, 2.5*cm, 'text label', ha='left', va='bottom', axes=ax)
-ax.add_artist(t)
-
-ax.set_xlim(-1*cm, 10*cm)
-ax.set_ylim(-1*cm, 10*cm)
-# ax.xaxis.set_units(inch)
-ax.grid(True)
-ax.set_title("Artists with units")
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/units/bar_demo2.html b/examples/units/bar_demo2.html deleted file mode 100644 index 11a38bd8a78..00000000000 --- a/examples/units/bar_demo2.html +++ /dev/null @@ -1,356 +0,0 @@ - - - - - - - - units example code: bar_demo2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

units example code: bar_demo2.py

-

(Source code, png, pdf)

-
-../../_images/bar_demo2.png -
-
"""
-===================
-Bar demo with units
-===================
-
-A plot using a variety of centimetre and inch conversions. This example shows
-how default unit introspection works (ax1), how various keywords can be used to
-set the x and y units to override the defaults (ax2, ax3, ax4) and how one can
-set the xlimits using scalars (ax3, current units assumed) or units
-(conversions applied to get the numbers to current units).
-
-"""
-import numpy as np
-from basic_units import cm, inch
-import matplotlib.pyplot as plt
-
-cms = cm * np.arange(0, 10, 2)
-bottom = 0 * cm
-width = 0.8 * cm
-
-fig, axs = plt.subplots(2, 2)
-
-axs[0, 0].bar(cms, cms, bottom=bottom)
-
-axs[0, 1].bar(cms, cms, bottom=bottom, width=width, xunits=cm, yunits=inch)
-
-axs[1, 0].bar(cms, cms, bottom=bottom, width=width, xunits=inch, yunits=cm)
-axs[1, 0].set_xlim(2, 6)  # scalars are interpreted in current units
-
-axs[1, 1].bar(cms, cms, bottom=bottom, width=width, xunits=inch, yunits=inch)
-axs[1, 1].set_xlim(2 * cm, 6 * cm)  # cm are converted to inches
-
-fig.tight_layout()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/units/bar_unit_demo.html b/examples/units/bar_unit_demo.html deleted file mode 100644 index 86648060eab..00000000000 --- a/examples/units/bar_unit_demo.html +++ /dev/null @@ -1,362 +0,0 @@ - - - - - - - - units example code: bar_unit_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

units example code: bar_unit_demo.py

-

(Source code, png, pdf)

-
-../../_images/bar_unit_demo.png -
-
"""
-=========================
-Group barchart with units
-=========================
-
-This is the same example as
-<a href='http://matplotlib.org/examples/api/barchart_demo.html'>
-the barchart demo</a> in centimeters.
-"""
-
-import numpy as np
-from basic_units import cm, inch
-import matplotlib.pyplot as plt
-
-
-N = 5
-menMeans = (150*cm, 160*cm, 146*cm, 172*cm, 155*cm)
-menStd = (20*cm, 30*cm, 32*cm, 10*cm, 20*cm)
-
-fig, ax = plt.subplots()
-
-ind = np.arange(N)    # the x locations for the groups
-width = 0.35         # the width of the bars
-p1 = ax.bar(ind, menMeans, width, color='r', bottom=0*cm, yerr=menStd)
-
-
-womenMeans = (145*cm, 149*cm, 172*cm, 165*cm, 200*cm)
-womenStd = (30*cm, 25*cm, 20*cm, 31*cm, 22*cm)
-p2 = ax.bar(ind + width, womenMeans, width,
-            color='y', bottom=0*cm, yerr=womenStd)
-
-ax.set_title('Scores by group and gender')
-ax.set_xticks(ind + width / 2)
-ax.set_xticklabels(('G1', 'G2', 'G3', 'G4', 'G5'))
-
-ax.legend((p1[0], p2[0]), ('Men', 'Women'))
-ax.yaxis.set_units(inch)
-ax.autoscale_view()
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/units/basic_units.html b/examples/units/basic_units.html deleted file mode 100644 index e50577f0463..00000000000 --- a/examples/units/basic_units.html +++ /dev/null @@ -1,689 +0,0 @@ - - - - - - - - units example code: basic_units.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

units example code: basic_units.py

-

(Source code)

-
import math
-
-import numpy as np
-
-import matplotlib.units as units
-import matplotlib.ticker as ticker
-from matplotlib.axes import Axes
-from matplotlib.cbook import iterable
-
-
-class ProxyDelegate(object):
-    def __init__(self, fn_name, proxy_type):
-        self.proxy_type = proxy_type
-        self.fn_name = fn_name
-
-    def __get__(self, obj, objtype=None):
-        return self.proxy_type(self.fn_name, obj)
-
-
-class TaggedValueMeta (type):
-    def __init__(cls, name, bases, dict):
-        for fn_name in cls._proxies.keys():
-            try:
-                dummy = getattr(cls, fn_name)
-            except AttributeError:
-                setattr(cls, fn_name,
-                        ProxyDelegate(fn_name, cls._proxies[fn_name]))
-
-
-class PassThroughProxy(object):
-    def __init__(self, fn_name, obj):
-        self.fn_name = fn_name
-        self.target = obj.proxy_target
-
-    def __call__(self, *args):
-        fn = getattr(self.target, self.fn_name)
-        ret = fn(*args)
-        return ret
-
-
-class ConvertArgsProxy(PassThroughProxy):
-    def __init__(self, fn_name, obj):
-        PassThroughProxy.__init__(self, fn_name, obj)
-        self.unit = obj.unit
-
-    def __call__(self, *args):
-        converted_args = []
-        for a in args:
-            try:
-                converted_args.append(a.convert_to(self.unit))
-            except AttributeError:
-                converted_args.append(TaggedValue(a, self.unit))
-        converted_args = tuple([c.get_value() for c in converted_args])
-        return PassThroughProxy.__call__(self, *converted_args)
-
-
-class ConvertReturnProxy(PassThroughProxy):
-    def __init__(self, fn_name, obj):
-        PassThroughProxy.__init__(self, fn_name, obj)
-        self.unit = obj.unit
-
-    def __call__(self, *args):
-        ret = PassThroughProxy.__call__(self, *args)
-        if (type(ret) == type(NotImplemented)):
-            return NotImplemented
-        return TaggedValue(ret, self.unit)
-
-
-class ConvertAllProxy(PassThroughProxy):
-    def __init__(self, fn_name, obj):
-        PassThroughProxy.__init__(self, fn_name, obj)
-        self.unit = obj.unit
-
-    def __call__(self, *args):
-        converted_args = []
-        arg_units = [self.unit]
-        for a in args:
-            if hasattr(a, 'get_unit') and not hasattr(a, 'convert_to'):
-                # if this arg has a unit type but no conversion ability,
-                # this operation is prohibited
-                return NotImplemented
-
-            if hasattr(a, 'convert_to'):
-                try:
-                    a = a.convert_to(self.unit)
-                except:
-                    pass
-                arg_units.append(a.get_unit())
-                converted_args.append(a.get_value())
-            else:
-                converted_args.append(a)
-                if hasattr(a, 'get_unit'):
-                    arg_units.append(a.get_unit())
-                else:
-                    arg_units.append(None)
-        converted_args = tuple(converted_args)
-        ret = PassThroughProxy.__call__(self, *converted_args)
-        if (type(ret) == type(NotImplemented)):
-            return NotImplemented
-        ret_unit = unit_resolver(self.fn_name, arg_units)
-        if (ret_unit == NotImplemented):
-            return NotImplemented
-        return TaggedValue(ret, ret_unit)
-
-
-class _TaggedValue(object):
-
-    _proxies = {'__add__': ConvertAllProxy,
-                '__sub__': ConvertAllProxy,
-                '__mul__': ConvertAllProxy,
-                '__rmul__': ConvertAllProxy,
-                '__cmp__': ConvertAllProxy,
-                '__lt__': ConvertAllProxy,
-                '__gt__': ConvertAllProxy,
-                '__len__': PassThroughProxy}
-
-    def __new__(cls, value, unit):
-        # generate a new subclass for value
-        value_class = type(value)
-        try:
-            subcls = type('TaggedValue_of_%s' % (value_class.__name__),
-                          tuple([cls, value_class]),
-                          {})
-            if subcls not in units.registry:
-                units.registry[subcls] = basicConverter
-            return object.__new__(subcls)
-        except TypeError:
-            if cls not in units.registry:
-                units.registry[cls] = basicConverter
-            return object.__new__(cls)
-
-    def __init__(self, value, unit):
-        self.value = value
-        self.unit = unit
-        self.proxy_target = self.value
-
-    def __getattribute__(self, name):
-        if (name.startswith('__')):
-            return object.__getattribute__(self, name)
-        variable = object.__getattribute__(self, 'value')
-        if (hasattr(variable, name) and name not in self.__class__.__dict__):
-            return getattr(variable, name)
-        return object.__getattribute__(self, name)
-
-    def __array__(self, t=None, context=None):
-        if t is not None:
-            return np.asarray(self.value).astype(t)
-        else:
-            return np.asarray(self.value, 'O')
-
-    def __array_wrap__(self, array, context):
-        return TaggedValue(array, self.unit)
-
-    def __repr__(self):
-        return 'TaggedValue(' + repr(self.value) + ', ' + repr(self.unit) + ')'
-
-    def __str__(self):
-        return str(self.value) + ' in ' + str(self.unit)
-
-    def __len__(self):
-        return len(self.value)
-
-    def __iter__(self):
-        class IteratorProxy(object):
-            def __init__(self, iter, unit):
-                self.iter = iter
-                self.unit = unit
-
-            def __next__(self):
-                value = next(self.iter)
-                return TaggedValue(value, self.unit)
-            next = __next__  # for Python 2
-        return IteratorProxy(iter(self.value), self.unit)
-
-    def get_compressed_copy(self, mask):
-        new_value = np.ma.masked_array(self.value, mask=mask).compressed()
-        return TaggedValue(new_value, self.unit)
-
-    def convert_to(self, unit):
-        if (unit == self.unit or not unit):
-            return self
-        new_value = self.unit.convert_value_to(self.value, unit)
-        return TaggedValue(new_value, unit)
-
-    def get_value(self):
-        return self.value
-
-    def get_unit(self):
-        return self.unit
-
-
-TaggedValue = TaggedValueMeta('TaggedValue', (_TaggedValue, ), {})
-
-
-class BasicUnit(object):
-    def __init__(self, name, fullname=None):
-        self.name = name
-        if fullname is None:
-            fullname = name
-        self.fullname = fullname
-        self.conversions = dict()
-
-    def __repr__(self):
-        return 'BasicUnit(%s)' % self.name
-
-    def __str__(self):
-        return self.fullname
-
-    def __call__(self, value):
-        return TaggedValue(value, self)
-
-    def __mul__(self, rhs):
-        value = rhs
-        unit = self
-        if hasattr(rhs, 'get_unit'):
-            value = rhs.get_value()
-            unit = rhs.get_unit()
-            unit = unit_resolver('__mul__', (self, unit))
-        if (unit == NotImplemented):
-            return NotImplemented
-        return TaggedValue(value, unit)
-
-    def __rmul__(self, lhs):
-        return self*lhs
-
-    def __array_wrap__(self, array, context):
-        return TaggedValue(array, self)
-
-    def __array__(self, t=None, context=None):
-        ret = np.array([1])
-        if t is not None:
-            return ret.astype(t)
-        else:
-            return ret
-
-    def add_conversion_factor(self, unit, factor):
-        def convert(x):
-            return x*factor
-        self.conversions[unit] = convert
-
-    def add_conversion_fn(self, unit, fn):
-        self.conversions[unit] = fn
-
-    def get_conversion_fn(self, unit):
-        return self.conversions[unit]
-
-    def convert_value_to(self, value, unit):
-        conversion_fn = self.conversions[unit]
-        ret = conversion_fn(value)
-        return ret
-
-    def get_unit(self):
-        return self
-
-
-class UnitResolver(object):
-    def addition_rule(self, units):
-        for unit_1, unit_2 in zip(units[:-1], units[1:]):
-            if (unit_1 != unit_2):
-                return NotImplemented
-        return units[0]
-
-    def multiplication_rule(self, units):
-        non_null = [u for u in units if u]
-        if (len(non_null) > 1):
-            return NotImplemented
-        return non_null[0]
-
-    op_dict = {
-        '__mul__': multiplication_rule,
-        '__rmul__': multiplication_rule,
-        '__add__': addition_rule,
-        '__radd__': addition_rule,
-        '__sub__': addition_rule,
-        '__rsub__': addition_rule}
-
-    def __call__(self, operation, units):
-        if (operation not in self.op_dict):
-            return NotImplemented
-
-        return self.op_dict[operation](self, units)
-
-
-unit_resolver = UnitResolver()
-
-cm = BasicUnit('cm', 'centimeters')
-inch = BasicUnit('inch', 'inches')
-inch.add_conversion_factor(cm, 2.54)
-cm.add_conversion_factor(inch, 1/2.54)
-
-radians = BasicUnit('rad', 'radians')
-degrees = BasicUnit('deg', 'degrees')
-radians.add_conversion_factor(degrees, 180.0/np.pi)
-degrees.add_conversion_factor(radians, np.pi/180.0)
-
-secs = BasicUnit('s', 'seconds')
-hertz = BasicUnit('Hz', 'Hertz')
-minutes = BasicUnit('min', 'minutes')
-
-secs.add_conversion_fn(hertz, lambda x: 1./x)
-secs.add_conversion_factor(minutes, 1/60.0)
-
-
-# radians formatting
-def rad_fn(x, pos=None):
-    n = int((x / np.pi) * 2.0 + 0.25)
-    if n == 0:
-        return '0'
-    elif n == 1:
-        return r'$\pi/2$'
-    elif n == 2:
-        return r'$\pi$'
-    elif n % 2 == 0:
-        return r'$%s\pi$' % (n//2,)
-    else:
-        return r'$%s\pi/2$' % (n,)
-
-
-class BasicUnitConverter(units.ConversionInterface):
-    @staticmethod
-    def axisinfo(unit, axis):
-        'return AxisInfo instance for x and unit'
-
-        if unit == radians:
-            return units.AxisInfo(
-                majloc=ticker.MultipleLocator(base=np.pi/2),
-                majfmt=ticker.FuncFormatter(rad_fn),
-                label=unit.fullname,
-            )
-        elif unit == degrees:
-            return units.AxisInfo(
-                majloc=ticker.AutoLocator(),
-                majfmt=ticker.FormatStrFormatter(r'$%i^\circ$'),
-                label=unit.fullname,
-            )
-        elif unit is not None:
-            if hasattr(unit, 'fullname'):
-                return units.AxisInfo(label=unit.fullname)
-            elif hasattr(unit, 'unit'):
-                return units.AxisInfo(label=unit.unit.fullname)
-        return None
-
-    @staticmethod
-    def convert(val, unit, axis):
-        if units.ConversionInterface.is_numlike(val):
-            return val
-        if iterable(val):
-            return [thisval.convert_to(unit).get_value() for thisval in val]
-        else:
-            return val.convert_to(unit).get_value()
-
-    @staticmethod
-    def default_units(x, axis):
-        'return the default unit for x or None'
-        if iterable(x):
-            for thisx in x:
-                return thisx.unit
-        return x.unit
-
-
-def cos(x):
-    if iterable(x):
-        return [math.cos(val.convert_to(radians).get_value()) for val in x]
-    else:
-        return math.cos(x.convert_to(radians).get_value())
-
-
-basicConverter = BasicUnitConverter()
-units.registry[BasicUnit] = basicConverter
-units.registry[TaggedValue] = basicConverter
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/units/ellipse_with_units.html b/examples/units/ellipse_with_units.html deleted file mode 100644 index 223ba844597..00000000000 --- a/examples/units/ellipse_with_units.html +++ /dev/null @@ -1,397 +0,0 @@ - - - - - - - - units example code: ellipse_with_units.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

units example code: ellipse_with_units.py

-

(Source code)

-
-../../_images/ellipse_with_units_00.png -

(png, pdf)

-
-
-../../_images/ellipse_with_units_01.png -

(png, pdf)

-
-
"""
-Compare the ellipse generated with arcs versus a polygonal approximation
-"""
-from basic_units import cm
-import numpy as np
-from matplotlib import patches
-import matplotlib.pyplot as plt
-
-
-xcenter, ycenter = 0.38*cm, 0.52*cm
-#xcenter, ycenter = 0., 0.
-width, height = 1e-1*cm, 3e-1*cm
-angle = -30
-
-theta = np.arange(0.0, 360.0, 1.0)*np.pi/180.0
-x = 0.5 * width * np.cos(theta)
-y = 0.5 * height * np.sin(theta)
-
-rtheta = np.radians(angle)
-R = np.array([
-    [np.cos(rtheta), -np.sin(rtheta)],
-    [np.sin(rtheta),  np.cos(rtheta)],
-    ])
-
-
-x, y = np.dot(R, np.array([x, y]))
-x += xcenter
-y += ycenter
-
-fig = plt.figure()
-ax = fig.add_subplot(211, aspect='auto')
-ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1)
-
-e1 = patches.Ellipse((xcenter, ycenter), width, height,
-                     angle=angle, linewidth=2, fill=False, zorder=2)
-
-ax.add_patch(e1)
-
-ax = fig.add_subplot(212, aspect='equal')
-ax.fill(x, y, alpha=0.2, facecolor='green', edgecolor='green', zorder=1)
-e2 = patches.Ellipse((xcenter, ycenter), width, height,
-                     angle=angle, linewidth=2, fill=False, zorder=2)
-
-
-ax.add_patch(e2)
-
-#fig.savefig('ellipse_compare.png')
-fig.savefig('ellipse_compare')
-
-fig = plt.figure()
-ax = fig.add_subplot(211, aspect='auto')
-ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1)
-
-e1 = patches.Arc((xcenter, ycenter), width, height,
-                 angle=angle, linewidth=2, fill=False, zorder=2)
-
-ax.add_patch(e1)
-
-ax = fig.add_subplot(212, aspect='equal')
-ax.fill(x, y, alpha=0.2, facecolor='green', edgecolor='green', zorder=1)
-e2 = patches.Arc((xcenter, ycenter), width, height,
-                 angle=angle, linewidth=2, fill=False, zorder=2)
-
-
-ax.add_patch(e2)
-
-#fig.savefig('arc_compare.png')
-fig.savefig('arc_compare')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/units/evans_test.html b/examples/units/evans_test.html deleted file mode 100644 index bb38f1879e2..00000000000 --- a/examples/units/evans_test.html +++ /dev/null @@ -1,420 +0,0 @@ - - - - - - - - units example code: evans_test.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

units example code: evans_test.py

-

(Source code, png, pdf)

-
-../../_images/evans_test.png -
-
"""
-==========
-Evans test
-==========
-
-A mockup "Foo" units class which supports
-conversion and different tick formatting depending on the "unit".
-Here the "unit" is just a scalar conversion factor, but this example shows mpl
-is entirely agnostic to what kind of units client packages use.
-
-"""
-from matplotlib.cbook import iterable
-import matplotlib.units as units
-import matplotlib.ticker as ticker
-import matplotlib.pyplot as plt
-
-
-class Foo(object):
-    def __init__(self, val, unit=1.0):
-        self.unit = unit
-        self._val = val * unit
-
-    def value(self, unit):
-        if unit is None:
-            unit = self.unit
-        return self._val / unit
-
-
-class FooConverter(object):
-    @staticmethod
-    def axisinfo(unit, axis):
-        'return the Foo AxisInfo'
-        if unit == 1.0 or unit == 2.0:
-            return units.AxisInfo(
-                majloc=ticker.IndexLocator(8, 0),
-                majfmt=ticker.FormatStrFormatter("VAL: %s"),
-                label='foo',
-                )
-
-        else:
-            return None
-
-    @staticmethod
-    def convert(obj, unit, axis):
-        """
-        convert obj using unit.  If obj is a sequence, return the
-        converted sequence
-        """
-        if units.ConversionInterface.is_numlike(obj):
-            return obj
-
-        if iterable(obj):
-            return [o.value(unit) for o in obj]
-        else:
-            return obj.value(unit)
-
-    @staticmethod
-    def default_units(x, axis):
-        'return the default unit for x or None'
-        if iterable(x):
-            for thisx in x:
-                return thisx.unit
-        else:
-            return x.unit
-
-
-units.registry[Foo] = FooConverter()
-
-# create some Foos
-x = []
-for val in range(0, 50, 2):
-    x.append(Foo(val, 1.0))
-
-# and some arbitrary y data
-y = [i for i in range(len(x))]
-
-
-# plot specifying units
-fig = plt.figure()
-fig.suptitle("Custom units")
-fig.subplots_adjust(bottom=0.2)
-ax = fig.add_subplot(1, 2, 2)
-ax.plot(x, y, 'o', xunits=2.0)
-for label in ax.get_xticklabels():
-    label.set_rotation(30)
-    label.set_ha('right')
-ax.set_title("xunits = 2.0")
-
-
-# plot without specifying units; will use the None branch for axisinfo
-ax = fig.add_subplot(1, 2, 1)
-ax.plot(x, y)  # uses default units
-ax.set_title('default units')
-for label in ax.get_xticklabels():
-    label.set_rotation(30)
-    label.set_ha('right')
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/units/index.html b/examples/units/index.html deleted file mode 100644 index 97d0e1e49cb..00000000000 --- a/examples/units/index.html +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - - - units Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

units Examples

- --- - - - - - -
Release:2.0.2
Date:May 10, 2017
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/units/radian_demo.html b/examples/units/radian_demo.html deleted file mode 100644 index ffc111502d6..00000000000 --- a/examples/units/radian_demo.html +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - units example code: radian_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

units example code: radian_demo.py

-

(Source code, png, pdf)

-
-../../_images/radian_demo.png -
-
"""
-============
-Radian ticks
-============
-
-Plot with radians from the basic_units mockup example package.
-
-This example shows how the unit class can determine the tick locating,
-formatting and axis labeling.
-"""
-import numpy as np
-from basic_units import radians, degrees, cos
-from matplotlib.pyplot import figure, show
-
-x = [val*radians for val in np.arange(0, 15, 0.01)]
-
-fig = figure()
-fig.subplots_adjust(hspace=0.3)
-
-ax = fig.add_subplot(211)
-line1, = ax.plot(x, cos(x), xunits=radians)
-
-ax = fig.add_subplot(212)
-line2, = ax.plot(x, cos(x), xunits=degrees)
-
-show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/units/units_sample.html b/examples/units/units_sample.html deleted file mode 100644 index 98c191370e2..00000000000 --- a/examples/units/units_sample.html +++ /dev/null @@ -1,356 +0,0 @@ - - - - - - - - units example code: units_sample.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

units example code: units_sample.py

-

(Source code, png, pdf)

-
-../../_images/units_sample.png -
-
"""
-======================
-Inches and Centimeters
-======================
-
-The example illustrates the ability to override default x and y units (ax1) to
-inches and centimeters using the `xunits` and `yunits` parameters for the
-`plot` function. Note that conversions are applied to get numbers to correct
-units.
-
-"""
-from basic_units import cm, inch
-import matplotlib.pyplot as plt
-import numpy
-
-cms = cm * numpy.arange(0, 10, 2)
-
-fig = plt.figure()
-
-ax1 = fig.add_subplot(2, 2, 1)
-ax1.plot(cms, cms)
-
-ax2 = fig.add_subplot(2, 2, 2)
-ax2.plot(cms, cms, xunits=cm, yunits=inch)
-
-ax3 = fig.add_subplot(2, 2, 3)
-ax3.plot(cms, cms, xunits=inch, yunits=cm)
-ax3.set_xlim(3, 6)  # scalars are interpreted in current units
-
-ax4 = fig.add_subplot(2, 2, 4)
-ax4.plot(cms, cms, xunits=inch, yunits=inch)
-ax4.set_xlim(3*cm, 6*cm)  # cm are converted to inches
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/units/units_scatter.html b/examples/units/units_scatter.html deleted file mode 100644 index 80068c9f571..00000000000 --- a/examples/units/units_scatter.html +++ /dev/null @@ -1,357 +0,0 @@ - - - - - - - - units example code: units_scatter.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

units example code: units_scatter.py

-

(Source code, png, pdf)

-
-../../_images/units_scatter.png -
-
"""
-=============
-Unit handling
-=============
-
-basic_units is a mockup of a true units package used for testing
-purposed, which illustrates the basic interface that a units package
-must provide to matplotlib.
-
-The example below shows support for unit conversions over masked
-arrays.
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-from basic_units import secs, hertz, minutes
-
-# create masked array
-data = (1, 2, 3, 4, 5, 6, 7, 8)
-mask = (1, 0, 1, 0, 0, 0, 1, 0)
-xsecs = secs * np.ma.MaskedArray(data, mask, float)
-
-fig, (ax1, ax2, ax3) = plt.subplots(nrows=3, sharex=True)
-ax1.scatter(xsecs, xsecs)
-ax1.yaxis.set_units(secs)
-ax1.axis([0, 10, 0, 10])
-
-ax2.scatter(xsecs, xsecs, yunits=hertz)
-ax2.axis([0, 10, 0, 1])
-
-ax3.scatter(xsecs, xsecs, yunits=hertz)
-ax3.yaxis.set_units(minutes)
-ax3.axis([0, 10, 0, 1])
-
-fig.tight_layout()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/embedding_in_gtk.html b/examples/user_interfaces/embedding_in_gtk.html deleted file mode 100644 index a6cf46f7fc5..00000000000 --- a/examples/user_interfaces/embedding_in_gtk.html +++ /dev/null @@ -1,351 +0,0 @@ - - - - - - - - user_interfaces example code: embedding_in_gtk.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: embedding_in_gtk.py

-

[source code]

-
"""
-show how to add a matplotlib FigureCanvasGTK or FigureCanvasGTKAgg widget to a
-gtk.Window
-"""
-
-import gtk
-
-from matplotlib.figure import Figure
-from numpy import arange, sin, pi
-
-# uncomment to select /GTK/GTKAgg/GTKCairo
-#from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
-from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas
-#from matplotlib.backends.backend_gtkcairo import FigureCanvasGTKCairo as FigureCanvas
-
-
-win = gtk.Window()
-win.connect("destroy", lambda x: gtk.main_quit())
-win.set_default_size(400, 300)
-win.set_title("Embedding in GTK")
-
-f = Figure(figsize=(5, 4), dpi=100)
-a = f.add_subplot(111)
-t = arange(0.0, 3.0, 0.01)
-s = sin(2*pi*t)
-a.plot(t, s)
-
-canvas = FigureCanvas(f)  # a gtk.DrawingArea
-win.add(canvas)
-
-win.show_all()
-gtk.main()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/embedding_in_gtk.py b/examples/user_interfaces/embedding_in_gtk.py deleted file mode 100644 index 7cb9467f554..00000000000 --- a/examples/user_interfaces/embedding_in_gtk.py +++ /dev/null @@ -1,32 +0,0 @@ -""" -show how to add a matplotlib FigureCanvasGTK or FigureCanvasGTKAgg widget to a -gtk.Window -""" - -import gtk - -from matplotlib.figure import Figure -from numpy import arange, sin, pi - -# uncomment to select /GTK/GTKAgg/GTKCairo -#from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas -from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas -#from matplotlib.backends.backend_gtkcairo import FigureCanvasGTKCairo as FigureCanvas - - -win = gtk.Window() -win.connect("destroy", lambda x: gtk.main_quit()) -win.set_default_size(400, 300) -win.set_title("Embedding in GTK") - -f = Figure(figsize=(5, 4), dpi=100) -a = f.add_subplot(111) -t = arange(0.0, 3.0, 0.01) -s = sin(2*pi*t) -a.plot(t, s) - -canvas = FigureCanvas(f) # a gtk.DrawingArea -win.add(canvas) - -win.show_all() -gtk.main() diff --git a/examples/user_interfaces/embedding_in_gtk2.html b/examples/user_interfaces/embedding_in_gtk2.html deleted file mode 100644 index 68714fc2194..00000000000 --- a/examples/user_interfaces/embedding_in_gtk2.html +++ /dev/null @@ -1,370 +0,0 @@ - - - - - - - - user_interfaces example code: embedding_in_gtk2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: embedding_in_gtk2.py

-

[source code]

-
"""
-show how to add a matplotlib FigureCanvasGTK or FigureCanvasGTKAgg widget and
-a toolbar to a gtk.Window
-"""
-import gtk
-
-from matplotlib.figure import Figure
-from numpy import arange, sin, pi
-
-# uncomment to select /GTK/GTKAgg/GTKCairo
-#from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
-from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas
-#from matplotlib.backends.backend_gtkcairo import FigureCanvasGTKCairo as FigureCanvas
-
-# or NavigationToolbar for classic
-#from matplotlib.backends.backend_gtk import NavigationToolbar2GTK as NavigationToolbar
-from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar
-
-# implement the default mpl key bindings
-from matplotlib.backend_bases import key_press_handler
-
-win = gtk.Window()
-win.connect("destroy", lambda x: gtk.main_quit())
-win.set_default_size(400, 300)
-win.set_title("Embedding in GTK")
-
-vbox = gtk.VBox()
-win.add(vbox)
-
-fig = Figure(figsize=(5, 4), dpi=100)
-ax = fig.add_subplot(111)
-t = arange(0.0, 3.0, 0.01)
-s = sin(2*pi*t)
-
-ax.plot(t, s)
-
-
-canvas = FigureCanvas(fig)  # a gtk.DrawingArea
-vbox.pack_start(canvas)
-toolbar = NavigationToolbar(canvas, win)
-vbox.pack_start(toolbar, False, False)
-
-
-def on_key_event(event):
-    print('you pressed %s' % event.key)
-    key_press_handler(event, canvas, toolbar)
-
-canvas.mpl_connect('key_press_event', on_key_event)
-
-win.show_all()
-gtk.main()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/embedding_in_gtk2.py b/examples/user_interfaces/embedding_in_gtk2.py deleted file mode 100644 index 2665e3123b2..00000000000 --- a/examples/user_interfaces/embedding_in_gtk2.py +++ /dev/null @@ -1,51 +0,0 @@ -""" -show how to add a matplotlib FigureCanvasGTK or FigureCanvasGTKAgg widget and -a toolbar to a gtk.Window -""" -import gtk - -from matplotlib.figure import Figure -from numpy import arange, sin, pi - -# uncomment to select /GTK/GTKAgg/GTKCairo -#from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas -from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas -#from matplotlib.backends.backend_gtkcairo import FigureCanvasGTKCairo as FigureCanvas - -# or NavigationToolbar for classic -#from matplotlib.backends.backend_gtk import NavigationToolbar2GTK as NavigationToolbar -from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar - -# implement the default mpl key bindings -from matplotlib.backend_bases import key_press_handler - -win = gtk.Window() -win.connect("destroy", lambda x: gtk.main_quit()) -win.set_default_size(400, 300) -win.set_title("Embedding in GTK") - -vbox = gtk.VBox() -win.add(vbox) - -fig = Figure(figsize=(5, 4), dpi=100) -ax = fig.add_subplot(111) -t = arange(0.0, 3.0, 0.01) -s = sin(2*pi*t) - -ax.plot(t, s) - - -canvas = FigureCanvas(fig) # a gtk.DrawingArea -vbox.pack_start(canvas) -toolbar = NavigationToolbar(canvas, win) -vbox.pack_start(toolbar, False, False) - - -def on_key_event(event): - print('you pressed %s' % event.key) - key_press_handler(event, canvas, toolbar) - -canvas.mpl_connect('key_press_event', on_key_event) - -win.show_all() -gtk.main() diff --git a/examples/user_interfaces/embedding_in_gtk3.html b/examples/user_interfaces/embedding_in_gtk3.html deleted file mode 100644 index a9794151880..00000000000 --- a/examples/user_interfaces/embedding_in_gtk3.html +++ /dev/null @@ -1,352 +0,0 @@ - - - - - - - - user_interfaces example code: embedding_in_gtk3.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: embedding_in_gtk3.py

-

[source code]

-
"""
-demonstrate adding a FigureCanvasGTK3Agg widget to a Gtk.ScrolledWindow
-using GTK3 accessed via pygobject
-"""
-
-from gi.repository import Gtk
-
-from matplotlib.figure import Figure
-from numpy import arange, sin, pi
-from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanvas
-
-win = Gtk.Window()
-win.connect("delete-event", Gtk.main_quit)
-win.set_default_size(400, 300)
-win.set_title("Embedding in GTK")
-
-f = Figure(figsize=(5, 4), dpi=100)
-a = f.add_subplot(111)
-t = arange(0.0, 3.0, 0.01)
-s = sin(2*pi*t)
-a.plot(t, s)
-
-sw = Gtk.ScrolledWindow()
-win.add(sw)
-# A scrolled window border goes outside the scrollbars and viewport
-sw.set_border_width(10)
-
-canvas = FigureCanvas(f)  # a Gtk.DrawingArea
-canvas.set_size_request(800, 600)
-sw.add_with_viewport(canvas)
-
-win.show_all()
-Gtk.main()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/embedding_in_gtk3.py b/examples/user_interfaces/embedding_in_gtk3.py deleted file mode 100644 index a8d2f59822a..00000000000 --- a/examples/user_interfaces/embedding_in_gtk3.py +++ /dev/null @@ -1,33 +0,0 @@ -""" -demonstrate adding a FigureCanvasGTK3Agg widget to a Gtk.ScrolledWindow -using GTK3 accessed via pygobject -""" - -from gi.repository import Gtk - -from matplotlib.figure import Figure -from numpy import arange, sin, pi -from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanvas - -win = Gtk.Window() -win.connect("delete-event", Gtk.main_quit) -win.set_default_size(400, 300) -win.set_title("Embedding in GTK") - -f = Figure(figsize=(5, 4), dpi=100) -a = f.add_subplot(111) -t = arange(0.0, 3.0, 0.01) -s = sin(2*pi*t) -a.plot(t, s) - -sw = Gtk.ScrolledWindow() -win.add(sw) -# A scrolled window border goes outside the scrollbars and viewport -sw.set_border_width(10) - -canvas = FigureCanvas(f) # a Gtk.DrawingArea -canvas.set_size_request(800, 600) -sw.add_with_viewport(canvas) - -win.show_all() -Gtk.main() diff --git a/examples/user_interfaces/embedding_in_gtk3_panzoom.html b/examples/user_interfaces/embedding_in_gtk3_panzoom.html deleted file mode 100644 index 88c0aba9cfd..00000000000 --- a/examples/user_interfaces/embedding_in_gtk3_panzoom.html +++ /dev/null @@ -1,354 +0,0 @@ - - - - - - - - user_interfaces example code: embedding_in_gtk3_panzoom.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: embedding_in_gtk3_panzoom.py

-

[source code]

-
"""
-demonstrate NavigationToolbar with GTK3 accessed via pygobject
-"""
-
-from gi.repository import Gtk
-
-from matplotlib.figure import Figure
-from numpy import arange, sin, pi
-from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanvas
-from matplotlib.backends.backend_gtk3 import NavigationToolbar2GTK3 as NavigationToolbar
-
-win = Gtk.Window()
-win.connect("delete-event", Gtk.main_quit)
-win.set_default_size(400, 300)
-win.set_title("Embedding in GTK")
-
-f = Figure(figsize=(5, 4), dpi=100)
-a = f.add_subplot(1, 1, 1)
-t = arange(0.0, 3.0, 0.01)
-s = sin(2*pi*t)
-a.plot(t, s)
-
-vbox = Gtk.VBox()
-win.add(vbox)
-
-# Add canvas to vbox
-canvas = FigureCanvas(f)  # a Gtk.DrawingArea
-vbox.pack_start(canvas, True, True, 0)
-
-# Create toolbar
-toolbar = NavigationToolbar(canvas, win)
-vbox.pack_start(toolbar, False, False, 0)
-
-win.show_all()
-Gtk.main()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/embedding_in_gtk3_panzoom.py b/examples/user_interfaces/embedding_in_gtk3_panzoom.py deleted file mode 100644 index 34331a3e2e2..00000000000 --- a/examples/user_interfaces/embedding_in_gtk3_panzoom.py +++ /dev/null @@ -1,35 +0,0 @@ -""" -demonstrate NavigationToolbar with GTK3 accessed via pygobject -""" - -from gi.repository import Gtk - -from matplotlib.figure import Figure -from numpy import arange, sin, pi -from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanvas -from matplotlib.backends.backend_gtk3 import NavigationToolbar2GTK3 as NavigationToolbar - -win = Gtk.Window() -win.connect("delete-event", Gtk.main_quit) -win.set_default_size(400, 300) -win.set_title("Embedding in GTK") - -f = Figure(figsize=(5, 4), dpi=100) -a = f.add_subplot(1, 1, 1) -t = arange(0.0, 3.0, 0.01) -s = sin(2*pi*t) -a.plot(t, s) - -vbox = Gtk.VBox() -win.add(vbox) - -# Add canvas to vbox -canvas = FigureCanvas(f) # a Gtk.DrawingArea -vbox.pack_start(canvas, True, True, 0) - -# Create toolbar -toolbar = NavigationToolbar(canvas, win) -vbox.pack_start(toolbar, False, False, 0) - -win.show_all() -Gtk.main() diff --git a/examples/user_interfaces/embedding_in_qt.html b/examples/user_interfaces/embedding_in_qt.html deleted file mode 100644 index cb04d5ca9bd..00000000000 --- a/examples/user_interfaces/embedding_in_qt.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/user_interfaces/embedding_in_qt4.html b/examples/user_interfaces/embedding_in_qt4.html deleted file mode 100644 index 92dd01960f1..00000000000 --- a/examples/user_interfaces/embedding_in_qt4.html +++ /dev/null @@ -1,453 +0,0 @@ - - - - - - - - user_interfaces example code: embedding_in_qt4.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: embedding_in_qt4.py

-

[source code]

-
# embedding_in_qt4.py --- Simple Qt4 application embedding matplotlib canvases
-#
-# Copyright (C) 2005 Florent Rougon
-#               2006 Darren Dale
-#
-# This file is an example program for matplotlib. It may be used and
-# modified with no restriction; raw copies as well as modified versions
-# may be distributed without limitation.
-
-from __future__ import unicode_literals
-import sys
-import os
-import random
-from matplotlib.backends import qt_compat
-use_pyside = qt_compat.QT_API == qt_compat.QT_API_PYSIDE
-if use_pyside:
-    from PySide import QtGui, QtCore
-else:
-    from PyQt4 import QtGui, QtCore
-
-from numpy import arange, sin, pi
-from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
-from matplotlib.figure import Figure
-
-progname = os.path.basename(sys.argv[0])
-progversion = "0.1"
-
-
-class MyMplCanvas(FigureCanvas):
-    """Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.)."""
-
-    def __init__(self, parent=None, width=5, height=4, dpi=100):
-        fig = Figure(figsize=(width, height), dpi=dpi)
-        self.axes = fig.add_subplot(111)
-
-        self.compute_initial_figure()
-
-        FigureCanvas.__init__(self, fig)
-        self.setParent(parent)
-
-        FigureCanvas.setSizePolicy(self,
-                                   QtGui.QSizePolicy.Expanding,
-                                   QtGui.QSizePolicy.Expanding)
-        FigureCanvas.updateGeometry(self)
-
-    def compute_initial_figure(self):
-        pass
-
-
-class MyStaticMplCanvas(MyMplCanvas):
-    """Simple canvas with a sine plot."""
-
-    def compute_initial_figure(self):
-        t = arange(0.0, 3.0, 0.01)
-        s = sin(2*pi*t)
-        self.axes.plot(t, s)
-
-
-class MyDynamicMplCanvas(MyMplCanvas):
-    """A canvas that updates itself every second with a new plot."""
-
-    def __init__(self, *args, **kwargs):
-        MyMplCanvas.__init__(self, *args, **kwargs)
-        timer = QtCore.QTimer(self)
-        timer.timeout.connect(self.update_figure)
-        timer.start(1000)
-
-    def compute_initial_figure(self):
-        self.axes.plot([0, 1, 2, 3], [1, 2, 0, 4], 'r')
-
-    def update_figure(self):
-        # Build a list of 4 random integers between 0 and 10 (both inclusive)
-        l = [random.randint(0, 10) for i in range(4)]
-        self.axes.cla()
-        self.axes.plot([0, 1, 2, 3], l, 'r')
-        self.draw()
-
-
-class ApplicationWindow(QtGui.QMainWindow):
-    def __init__(self):
-        QtGui.QMainWindow.__init__(self)
-        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
-        self.setWindowTitle("application main window")
-
-        self.file_menu = QtGui.QMenu('&File', self)
-        self.file_menu.addAction('&Quit', self.fileQuit,
-                                 QtCore.Qt.CTRL + QtCore.Qt.Key_Q)
-        self.menuBar().addMenu(self.file_menu)
-
-        self.help_menu = QtGui.QMenu('&Help', self)
-        self.menuBar().addSeparator()
-        self.menuBar().addMenu(self.help_menu)
-
-        self.help_menu.addAction('&About', self.about)
-
-        self.main_widget = QtGui.QWidget(self)
-
-        l = QtGui.QVBoxLayout(self.main_widget)
-        sc = MyStaticMplCanvas(self.main_widget, width=5, height=4, dpi=100)
-        dc = MyDynamicMplCanvas(self.main_widget, width=5, height=4, dpi=100)
-        l.addWidget(sc)
-        l.addWidget(dc)
-
-        self.main_widget.setFocus()
-        self.setCentralWidget(self.main_widget)
-
-        self.statusBar().showMessage("All hail matplotlib!", 2000)
-
-    def fileQuit(self):
-        self.close()
-
-    def closeEvent(self, ce):
-        self.fileQuit()
-
-    def about(self):
-        QtGui.QMessageBox.about(self, "About",
-                                """embedding_in_qt4.py example
-Copyright 2005 Florent Rougon, 2006 Darren Dale
-
-This program is a simple example of a Qt4 application embedding matplotlib
-canvases.
-
-It may be used and modified with no restriction; raw copies as well as
-modified versions may be distributed without limitation."""
-                                )
-
-
-qApp = QtGui.QApplication(sys.argv)
-
-aw = ApplicationWindow()
-aw.setWindowTitle("%s" % progname)
-aw.show()
-sys.exit(qApp.exec_())
-#qApp.exec_()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/embedding_in_qt4.py b/examples/user_interfaces/embedding_in_qt4.py deleted file mode 100644 index cef8369344f..00000000000 --- a/examples/user_interfaces/embedding_in_qt4.py +++ /dev/null @@ -1,135 +0,0 @@ - -# embedding_in_qt4.py --- Simple Qt4 application embedding matplotlib canvases -# -# Copyright (C) 2005 Florent Rougon -# 2006 Darren Dale -# -# This file is an example program for matplotlib. It may be used and -# modified with no restriction; raw copies as well as modified versions -# may be distributed without limitation. - -from __future__ import unicode_literals -import sys -import os -import random -from matplotlib.backends import qt_compat -use_pyside = qt_compat.QT_API == qt_compat.QT_API_PYSIDE -if use_pyside: - from PySide import QtGui, QtCore -else: - from PyQt4 import QtGui, QtCore - -from numpy import arange, sin, pi -from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas -from matplotlib.figure import Figure - -progname = os.path.basename(sys.argv[0]) -progversion = "0.1" - - -class MyMplCanvas(FigureCanvas): - """Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.).""" - - def __init__(self, parent=None, width=5, height=4, dpi=100): - fig = Figure(figsize=(width, height), dpi=dpi) - self.axes = fig.add_subplot(111) - - self.compute_initial_figure() - - FigureCanvas.__init__(self, fig) - self.setParent(parent) - - FigureCanvas.setSizePolicy(self, - QtGui.QSizePolicy.Expanding, - QtGui.QSizePolicy.Expanding) - FigureCanvas.updateGeometry(self) - - def compute_initial_figure(self): - pass - - -class MyStaticMplCanvas(MyMplCanvas): - """Simple canvas with a sine plot.""" - - def compute_initial_figure(self): - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - self.axes.plot(t, s) - - -class MyDynamicMplCanvas(MyMplCanvas): - """A canvas that updates itself every second with a new plot.""" - - def __init__(self, *args, **kwargs): - MyMplCanvas.__init__(self, *args, **kwargs) - timer = QtCore.QTimer(self) - timer.timeout.connect(self.update_figure) - timer.start(1000) - - def compute_initial_figure(self): - self.axes.plot([0, 1, 2, 3], [1, 2, 0, 4], 'r') - - def update_figure(self): - # Build a list of 4 random integers between 0 and 10 (both inclusive) - l = [random.randint(0, 10) for i in range(4)] - self.axes.cla() - self.axes.plot([0, 1, 2, 3], l, 'r') - self.draw() - - -class ApplicationWindow(QtGui.QMainWindow): - def __init__(self): - QtGui.QMainWindow.__init__(self) - self.setAttribute(QtCore.Qt.WA_DeleteOnClose) - self.setWindowTitle("application main window") - - self.file_menu = QtGui.QMenu('&File', self) - self.file_menu.addAction('&Quit', self.fileQuit, - QtCore.Qt.CTRL + QtCore.Qt.Key_Q) - self.menuBar().addMenu(self.file_menu) - - self.help_menu = QtGui.QMenu('&Help', self) - self.menuBar().addSeparator() - self.menuBar().addMenu(self.help_menu) - - self.help_menu.addAction('&About', self.about) - - self.main_widget = QtGui.QWidget(self) - - l = QtGui.QVBoxLayout(self.main_widget) - sc = MyStaticMplCanvas(self.main_widget, width=5, height=4, dpi=100) - dc = MyDynamicMplCanvas(self.main_widget, width=5, height=4, dpi=100) - l.addWidget(sc) - l.addWidget(dc) - - self.main_widget.setFocus() - self.setCentralWidget(self.main_widget) - - self.statusBar().showMessage("All hail matplotlib!", 2000) - - def fileQuit(self): - self.close() - - def closeEvent(self, ce): - self.fileQuit() - - def about(self): - QtGui.QMessageBox.about(self, "About", - """embedding_in_qt4.py example -Copyright 2005 Florent Rougon, 2006 Darren Dale - -This program is a simple example of a Qt4 application embedding matplotlib -canvases. - -It may be used and modified with no restriction; raw copies as well as -modified versions may be distributed without limitation.""" - ) - - -qApp = QtGui.QApplication(sys.argv) - -aw = ApplicationWindow() -aw.setWindowTitle("%s" % progname) -aw.show() -sys.exit(qApp.exec_()) -#qApp.exec_() diff --git a/examples/user_interfaces/embedding_in_qt4_wtoolbar.html b/examples/user_interfaces/embedding_in_qt4_wtoolbar.html deleted file mode 100644 index 3ff5222c780..00000000000 --- a/examples/user_interfaces/embedding_in_qt4_wtoolbar.html +++ /dev/null @@ -1,393 +0,0 @@ - - - - - - - - user_interfaces example code: embedding_in_qt4_wtoolbar.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: embedding_in_qt4_wtoolbar.py

-

[source code]

-
from __future__ import print_function
-
-import sys
-
-import numpy as np
-from matplotlib.figure import Figure
-from matplotlib.backend_bases import key_press_handler
-from matplotlib.backends.backend_qt4agg import (
-    FigureCanvasQTAgg as FigureCanvas,
-    NavigationToolbar2QT as NavigationToolbar)
-from matplotlib.backends import qt4_compat
-use_pyside = qt4_compat.QT_API == qt4_compat.QT_API_PYSIDE
-
-if use_pyside:
-    from PySide.QtCore import *
-    from PySide.QtGui import *
-else:
-    from PyQt4.QtCore import *
-    from PyQt4.QtGui import *
-
-
-class AppForm(QMainWindow):
-    def __init__(self, parent=None):
-        QMainWindow.__init__(self, parent)
-        #self.x, self.y = self.get_data()
-        self.data = self.get_data2()
-        self.create_main_frame()
-        self.on_draw()
-
-    def create_main_frame(self):
-        self.main_frame = QWidget()
-
-        self.fig = Figure((5.0, 4.0), dpi=100)
-        self.canvas = FigureCanvas(self.fig)
-        self.canvas.setParent(self.main_frame)
-        self.canvas.setFocusPolicy(Qt.StrongFocus)
-        self.canvas.setFocus()
-
-        self.mpl_toolbar = NavigationToolbar(self.canvas, self.main_frame)
-
-        self.canvas.mpl_connect('key_press_event', self.on_key_press)
-
-        vbox = QVBoxLayout()
-        vbox.addWidget(self.canvas)  # the matplotlib canvas
-        vbox.addWidget(self.mpl_toolbar)
-        self.main_frame.setLayout(vbox)
-        self.setCentralWidget(self.main_frame)
-
-    def get_data2(self):
-        return np.arange(20).reshape([4, 5]).copy()
-
-    def on_draw(self):
-        self.fig.clear()
-        self.axes = self.fig.add_subplot(111)
-        #self.axes.plot(self.x, self.y, 'ro')
-        self.axes.imshow(self.data, interpolation='nearest')
-        #self.axes.plot([1,2,3])
-        self.canvas.draw()
-
-    def on_key_press(self, event):
-        print('you pressed', event.key)
-        # implement the default mpl key press events described at
-        # http://matplotlib.org/users/navigation_toolbar.html#navigation-keyboard-shortcuts
-        key_press_handler(event, self.canvas, self.mpl_toolbar)
-
-
-def main():
-    app = QApplication(sys.argv)
-    form = AppForm()
-    form.show()
-    app.exec_()
-
-if __name__ == "__main__":
-    main()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/embedding_in_qt4_wtoolbar.py b/examples/user_interfaces/embedding_in_qt4_wtoolbar.py deleted file mode 100644 index b087e9d73df..00000000000 --- a/examples/user_interfaces/embedding_in_qt4_wtoolbar.py +++ /dev/null @@ -1,74 +0,0 @@ -from __future__ import print_function - -import sys - -import numpy as np -from matplotlib.figure import Figure -from matplotlib.backend_bases import key_press_handler -from matplotlib.backends.backend_qt4agg import ( - FigureCanvasQTAgg as FigureCanvas, - NavigationToolbar2QT as NavigationToolbar) -from matplotlib.backends import qt4_compat -use_pyside = qt4_compat.QT_API == qt4_compat.QT_API_PYSIDE - -if use_pyside: - from PySide.QtCore import * - from PySide.QtGui import * -else: - from PyQt4.QtCore import * - from PyQt4.QtGui import * - - -class AppForm(QMainWindow): - def __init__(self, parent=None): - QMainWindow.__init__(self, parent) - #self.x, self.y = self.get_data() - self.data = self.get_data2() - self.create_main_frame() - self.on_draw() - - def create_main_frame(self): - self.main_frame = QWidget() - - self.fig = Figure((5.0, 4.0), dpi=100) - self.canvas = FigureCanvas(self.fig) - self.canvas.setParent(self.main_frame) - self.canvas.setFocusPolicy(Qt.StrongFocus) - self.canvas.setFocus() - - self.mpl_toolbar = NavigationToolbar(self.canvas, self.main_frame) - - self.canvas.mpl_connect('key_press_event', self.on_key_press) - - vbox = QVBoxLayout() - vbox.addWidget(self.canvas) # the matplotlib canvas - vbox.addWidget(self.mpl_toolbar) - self.main_frame.setLayout(vbox) - self.setCentralWidget(self.main_frame) - - def get_data2(self): - return np.arange(20).reshape([4, 5]).copy() - - def on_draw(self): - self.fig.clear() - self.axes = self.fig.add_subplot(111) - #self.axes.plot(self.x, self.y, 'ro') - self.axes.imshow(self.data, interpolation='nearest') - #self.axes.plot([1,2,3]) - self.canvas.draw() - - def on_key_press(self, event): - print('you pressed', event.key) - # implement the default mpl key press events described at - # http://matplotlib.org/users/navigation_toolbar.html#navigation-keyboard-shortcuts - key_press_handler(event, self.canvas, self.mpl_toolbar) - - -def main(): - app = QApplication(sys.argv) - form = AppForm() - form.show() - app.exec_() - -if __name__ == "__main__": - main() diff --git a/examples/user_interfaces/embedding_in_qt5.html b/examples/user_interfaces/embedding_in_qt5.html deleted file mode 100644 index 2494f810282..00000000000 --- a/examples/user_interfaces/embedding_in_qt5.html +++ /dev/null @@ -1,455 +0,0 @@ - - - - - - - - user_interfaces example code: embedding_in_qt5.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: embedding_in_qt5.py

-

[source code]

-
# embedding_in_qt5.py --- Simple Qt5 application embedding matplotlib canvases
-#
-# Copyright (C) 2005 Florent Rougon
-#               2006 Darren Dale
-#               2015 Jens H Nielsen
-#
-# This file is an example program for matplotlib. It may be used and
-# modified with no restriction; raw copies as well as modified versions
-# may be distributed without limitation.
-
-from __future__ import unicode_literals
-import sys
-import os
-import random
-import matplotlib
-# Make sure that we are using QT5
-matplotlib.use('Qt5Agg')
-from PyQt5 import QtCore, QtWidgets
-
-from numpy import arange, sin, pi
-from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
-from matplotlib.figure import Figure
-
-progname = os.path.basename(sys.argv[0])
-progversion = "0.1"
-
-
-class MyMplCanvas(FigureCanvas):
-    """Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.)."""
-
-    def __init__(self, parent=None, width=5, height=4, dpi=100):
-        fig = Figure(figsize=(width, height), dpi=dpi)
-        self.axes = fig.add_subplot(111)
-
-        self.compute_initial_figure()
-
-        FigureCanvas.__init__(self, fig)
-        self.setParent(parent)
-
-        FigureCanvas.setSizePolicy(self,
-                                   QtWidgets.QSizePolicy.Expanding,
-                                   QtWidgets.QSizePolicy.Expanding)
-        FigureCanvas.updateGeometry(self)
-
-    def compute_initial_figure(self):
-        pass
-
-
-class MyStaticMplCanvas(MyMplCanvas):
-    """Simple canvas with a sine plot."""
-
-    def compute_initial_figure(self):
-        t = arange(0.0, 3.0, 0.01)
-        s = sin(2*pi*t)
-        self.axes.plot(t, s)
-
-
-class MyDynamicMplCanvas(MyMplCanvas):
-    """A canvas that updates itself every second with a new plot."""
-
-    def __init__(self, *args, **kwargs):
-        MyMplCanvas.__init__(self, *args, **kwargs)
-        timer = QtCore.QTimer(self)
-        timer.timeout.connect(self.update_figure)
-        timer.start(1000)
-
-    def compute_initial_figure(self):
-        self.axes.plot([0, 1, 2, 3], [1, 2, 0, 4], 'r')
-
-    def update_figure(self):
-        # Build a list of 4 random integers between 0 and 10 (both inclusive)
-        l = [random.randint(0, 10) for i in range(4)]
-        self.axes.cla()
-        self.axes.plot([0, 1, 2, 3], l, 'r')
-        self.draw()
-
-
-class ApplicationWindow(QtWidgets.QMainWindow):
-    def __init__(self):
-        QtWidgets.QMainWindow.__init__(self)
-        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
-        self.setWindowTitle("application main window")
-
-        self.file_menu = QtWidgets.QMenu('&File', self)
-        self.file_menu.addAction('&Quit', self.fileQuit,
-                                 QtCore.Qt.CTRL + QtCore.Qt.Key_Q)
-        self.menuBar().addMenu(self.file_menu)
-
-        self.help_menu = QtWidgets.QMenu('&Help', self)
-        self.menuBar().addSeparator()
-        self.menuBar().addMenu(self.help_menu)
-
-        self.help_menu.addAction('&About', self.about)
-
-        self.main_widget = QtWidgets.QWidget(self)
-
-        l = QtWidgets.QVBoxLayout(self.main_widget)
-        sc = MyStaticMplCanvas(self.main_widget, width=5, height=4, dpi=100)
-        dc = MyDynamicMplCanvas(self.main_widget, width=5, height=4, dpi=100)
-        l.addWidget(sc)
-        l.addWidget(dc)
-
-        self.main_widget.setFocus()
-        self.setCentralWidget(self.main_widget)
-
-        self.statusBar().showMessage("All hail matplotlib!", 2000)
-
-    def fileQuit(self):
-        self.close()
-
-    def closeEvent(self, ce):
-        self.fileQuit()
-
-    def about(self):
-        QtWidgets.QMessageBox.about(self, "About",
-                                    """embedding_in_qt5.py example
-Copyright 2005 Florent Rougon, 2006 Darren Dale, 2015 Jens H Nielsen
-
-This program is a simple example of a Qt5 application embedding matplotlib
-canvases.
-
-It may be used and modified with no restriction; raw copies as well as
-modified versions may be distributed without limitation.
-
-This is modified from the embedding in qt4 example to show the difference
-between qt4 and qt5"""
-                                )
-
-
-qApp = QtWidgets.QApplication(sys.argv)
-
-aw = ApplicationWindow()
-aw.setWindowTitle("%s" % progname)
-aw.show()
-sys.exit(qApp.exec_())
-#qApp.exec_()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/embedding_in_qt5.py b/examples/user_interfaces/embedding_in_qt5.py deleted file mode 100644 index 8d2cbce51b1..00000000000 --- a/examples/user_interfaces/embedding_in_qt5.py +++ /dev/null @@ -1,137 +0,0 @@ - -# embedding_in_qt5.py --- Simple Qt5 application embedding matplotlib canvases -# -# Copyright (C) 2005 Florent Rougon -# 2006 Darren Dale -# 2015 Jens H Nielsen -# -# This file is an example program for matplotlib. It may be used and -# modified with no restriction; raw copies as well as modified versions -# may be distributed without limitation. - -from __future__ import unicode_literals -import sys -import os -import random -import matplotlib -# Make sure that we are using QT5 -matplotlib.use('Qt5Agg') -from PyQt5 import QtCore, QtWidgets - -from numpy import arange, sin, pi -from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas -from matplotlib.figure import Figure - -progname = os.path.basename(sys.argv[0]) -progversion = "0.1" - - -class MyMplCanvas(FigureCanvas): - """Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.).""" - - def __init__(self, parent=None, width=5, height=4, dpi=100): - fig = Figure(figsize=(width, height), dpi=dpi) - self.axes = fig.add_subplot(111) - - self.compute_initial_figure() - - FigureCanvas.__init__(self, fig) - self.setParent(parent) - - FigureCanvas.setSizePolicy(self, - QtWidgets.QSizePolicy.Expanding, - QtWidgets.QSizePolicy.Expanding) - FigureCanvas.updateGeometry(self) - - def compute_initial_figure(self): - pass - - -class MyStaticMplCanvas(MyMplCanvas): - """Simple canvas with a sine plot.""" - - def compute_initial_figure(self): - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - self.axes.plot(t, s) - - -class MyDynamicMplCanvas(MyMplCanvas): - """A canvas that updates itself every second with a new plot.""" - - def __init__(self, *args, **kwargs): - MyMplCanvas.__init__(self, *args, **kwargs) - timer = QtCore.QTimer(self) - timer.timeout.connect(self.update_figure) - timer.start(1000) - - def compute_initial_figure(self): - self.axes.plot([0, 1, 2, 3], [1, 2, 0, 4], 'r') - - def update_figure(self): - # Build a list of 4 random integers between 0 and 10 (both inclusive) - l = [random.randint(0, 10) for i in range(4)] - self.axes.cla() - self.axes.plot([0, 1, 2, 3], l, 'r') - self.draw() - - -class ApplicationWindow(QtWidgets.QMainWindow): - def __init__(self): - QtWidgets.QMainWindow.__init__(self) - self.setAttribute(QtCore.Qt.WA_DeleteOnClose) - self.setWindowTitle("application main window") - - self.file_menu = QtWidgets.QMenu('&File', self) - self.file_menu.addAction('&Quit', self.fileQuit, - QtCore.Qt.CTRL + QtCore.Qt.Key_Q) - self.menuBar().addMenu(self.file_menu) - - self.help_menu = QtWidgets.QMenu('&Help', self) - self.menuBar().addSeparator() - self.menuBar().addMenu(self.help_menu) - - self.help_menu.addAction('&About', self.about) - - self.main_widget = QtWidgets.QWidget(self) - - l = QtWidgets.QVBoxLayout(self.main_widget) - sc = MyStaticMplCanvas(self.main_widget, width=5, height=4, dpi=100) - dc = MyDynamicMplCanvas(self.main_widget, width=5, height=4, dpi=100) - l.addWidget(sc) - l.addWidget(dc) - - self.main_widget.setFocus() - self.setCentralWidget(self.main_widget) - - self.statusBar().showMessage("All hail matplotlib!", 2000) - - def fileQuit(self): - self.close() - - def closeEvent(self, ce): - self.fileQuit() - - def about(self): - QtWidgets.QMessageBox.about(self, "About", - """embedding_in_qt5.py example -Copyright 2005 Florent Rougon, 2006 Darren Dale, 2015 Jens H Nielsen - -This program is a simple example of a Qt5 application embedding matplotlib -canvases. - -It may be used and modified with no restriction; raw copies as well as -modified versions may be distributed without limitation. - -This is modified from the embedding in qt4 example to show the difference -between qt4 and qt5""" - ) - - -qApp = QtWidgets.QApplication(sys.argv) - -aw = ApplicationWindow() -aw.setWindowTitle("%s" % progname) -aw.show() -sys.exit(qApp.exec_()) -#qApp.exec_() diff --git a/examples/user_interfaces/embedding_in_tk.html b/examples/user_interfaces/embedding_in_tk.html deleted file mode 100644 index 25a799919be..00000000000 --- a/examples/user_interfaces/embedding_in_tk.html +++ /dev/null @@ -1,376 +0,0 @@ - - - - - - - - user_interfaces example code: embedding_in_tk.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: embedding_in_tk.py

-

[source code]

-
import matplotlib
-matplotlib.use('TkAgg')
-
-from numpy import arange, sin, pi
-from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
-# implement the default mpl key bindings
-from matplotlib.backend_bases import key_press_handler
-
-
-from matplotlib.figure import Figure
-
-import sys
-if sys.version_info[0] < 3:
-    import Tkinter as Tk
-else:
-    import tkinter as Tk
-
-root = Tk.Tk()
-root.wm_title("Embedding in TK")
-
-
-f = Figure(figsize=(5, 4), dpi=100)
-a = f.add_subplot(111)
-t = arange(0.0, 3.0, 0.01)
-s = sin(2*pi*t)
-
-a.plot(t, s)
-
-
-# a tk.DrawingArea
-canvas = FigureCanvasTkAgg(f, master=root)
-canvas.show()
-canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
-
-toolbar = NavigationToolbar2TkAgg(canvas, root)
-toolbar.update()
-canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
-
-
-def on_key_event(event):
-    print('you pressed %s' % event.key)
-    key_press_handler(event, canvas, toolbar)
-
-canvas.mpl_connect('key_press_event', on_key_event)
-
-
-def _quit():
-    root.quit()     # stops mainloop
-    root.destroy()  # this is necessary on Windows to prevent
-                    # Fatal Python Error: PyEval_RestoreThread: NULL tstate
-
-button = Tk.Button(master=root, text='Quit', command=_quit)
-button.pack(side=Tk.BOTTOM)
-
-Tk.mainloop()
-# If you put root.destroy() here, it will cause an error if
-# the window is closed with the window manager.
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/embedding_in_tk.py b/examples/user_interfaces/embedding_in_tk.py deleted file mode 100644 index b4aacd416b7..00000000000 --- a/examples/user_interfaces/embedding_in_tk.py +++ /dev/null @@ -1,57 +0,0 @@ -import matplotlib -matplotlib.use('TkAgg') - -from numpy import arange, sin, pi -from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg -# implement the default mpl key bindings -from matplotlib.backend_bases import key_press_handler - - -from matplotlib.figure import Figure - -import sys -if sys.version_info[0] < 3: - import Tkinter as Tk -else: - import tkinter as Tk - -root = Tk.Tk() -root.wm_title("Embedding in TK") - - -f = Figure(figsize=(5, 4), dpi=100) -a = f.add_subplot(111) -t = arange(0.0, 3.0, 0.01) -s = sin(2*pi*t) - -a.plot(t, s) - - -# a tk.DrawingArea -canvas = FigureCanvasTkAgg(f, master=root) -canvas.show() -canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1) - -toolbar = NavigationToolbar2TkAgg(canvas, root) -toolbar.update() -canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1) - - -def on_key_event(event): - print('you pressed %s' % event.key) - key_press_handler(event, canvas, toolbar) - -canvas.mpl_connect('key_press_event', on_key_event) - - -def _quit(): - root.quit() # stops mainloop - root.destroy() # this is necessary on Windows to prevent - # Fatal Python Error: PyEval_RestoreThread: NULL tstate - -button = Tk.Button(master=root, text='Quit', command=_quit) -button.pack(side=Tk.BOTTOM) - -Tk.mainloop() -# If you put root.destroy() here, it will cause an error if -# the window is closed with the window manager. diff --git a/examples/user_interfaces/embedding_in_tk2.html b/examples/user_interfaces/embedding_in_tk2.html deleted file mode 100644 index c9f0dd6ffee..00000000000 --- a/examples/user_interfaces/embedding_in_tk2.html +++ /dev/null @@ -1,362 +0,0 @@ - - - - - - - - user_interfaces example code: embedding_in_tk2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: embedding_in_tk2.py

-

[source code]

-
import matplotlib
-matplotlib.use('TkAgg')
-
-from numpy import arange, sin, pi
-from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
-from matplotlib.figure import Figure
-
-import sys
-if sys.version_info[0] < 3:
-    import Tkinter as Tk
-else:
-    import tkinter as Tk
-
-
-def destroy(e):
-    sys.exit()
-
-root = Tk.Tk()
-root.wm_title("Embedding in TK")
-
-
-f = Figure(figsize=(5, 4), dpi=100)
-a = f.add_subplot(111)
-t = arange(0.0, 3.0, 0.01)
-s = sin(2*pi*t)
-
-a.plot(t, s)
-a.set_title('Tk embedding')
-a.set_xlabel('X axis label')
-a.set_ylabel('Y label')
-
-
-# a tk.DrawingArea
-canvas = FigureCanvasTkAgg(f, master=root)
-canvas.show()
-canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
-
-canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
-
-button = Tk.Button(master=root, text='Quit', command=sys.exit)
-button.pack(side=Tk.BOTTOM)
-
-Tk.mainloop()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/embedding_in_tk2.py b/examples/user_interfaces/embedding_in_tk2.py deleted file mode 100644 index ab6c98b66de..00000000000 --- a/examples/user_interfaces/embedding_in_tk2.py +++ /dev/null @@ -1,43 +0,0 @@ -import matplotlib -matplotlib.use('TkAgg') - -from numpy import arange, sin, pi -from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg -from matplotlib.figure import Figure - -import sys -if sys.version_info[0] < 3: - import Tkinter as Tk -else: - import tkinter as Tk - - -def destroy(e): - sys.exit() - -root = Tk.Tk() -root.wm_title("Embedding in TK") - - -f = Figure(figsize=(5, 4), dpi=100) -a = f.add_subplot(111) -t = arange(0.0, 3.0, 0.01) -s = sin(2*pi*t) - -a.plot(t, s) -a.set_title('Tk embedding') -a.set_xlabel('X axis label') -a.set_ylabel('Y label') - - -# a tk.DrawingArea -canvas = FigureCanvasTkAgg(f, master=root) -canvas.show() -canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1) - -canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1) - -button = Tk.Button(master=root, text='Quit', command=sys.exit) -button.pack(side=Tk.BOTTOM) - -Tk.mainloop() diff --git a/examples/user_interfaces/embedding_in_tk_canvas.html b/examples/user_interfaces/embedding_in_tk_canvas.html deleted file mode 100644 index 793b3e3c9ec..00000000000 --- a/examples/user_interfaces/embedding_in_tk_canvas.html +++ /dev/null @@ -1,382 +0,0 @@ - - - - - - - - user_interfaces example code: embedding_in_tk_canvas.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: embedding_in_tk_canvas.py

-

[source code]

-
# -*- noplot -*-
-
-import matplotlib as mpl
-import numpy as np
-import sys
-if sys.version_info[0] < 3:
-    import Tkinter as tk
-else:
-    import tkinter as tk
-import matplotlib.backends.tkagg as tkagg
-from matplotlib.backends.backend_agg import FigureCanvasAgg
-
-
-def draw_figure(canvas, figure, loc=(0, 0)):
-    """ Draw a matplotlib figure onto a Tk canvas
-
-    loc: location of top-left corner of figure on canvas in pixels.
-
-    Inspired by matplotlib source: lib/matplotlib/backends/backend_tkagg.py
-    """
-    figure_canvas_agg = FigureCanvasAgg(figure)
-    figure_canvas_agg.draw()
-    figure_x, figure_y, figure_w, figure_h = figure.bbox.bounds
-    figure_w, figure_h = int(figure_w), int(figure_h)
-    photo = tk.PhotoImage(master=canvas, width=figure_w, height=figure_h)
-
-    # Position: convert from top-left anchor to center anchor
-    canvas.create_image(loc[0] + figure_w/2, loc[1] + figure_h/2, image=photo)
-
-    # Unfortunately, there's no accessor for the pointer to the native renderer
-    tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2)
-
-    # Return a handle which contains a reference to the photo object
-    # which must be kept live or else the picture disappears
-    return photo
-
-# Create a canvas
-w, h = 300, 200
-window = tk.Tk()
-window.title("A figure in a canvas")
-canvas = tk.Canvas(window, width=w, height=h)
-canvas.pack()
-
-# Generate some example data
-X = np.linspace(0, 2.0*3.14, 50)
-Y = np.sin(X)
-
-# Create the figure we desire to add to an existing canvas
-fig = mpl.figure.Figure(figsize=(2, 1))
-ax = fig.add_axes([0, 0, 1, 1])
-ax.plot(X, Y)
-
-# Keep this handle alive, or else figure will disappear
-fig_x, fig_y = 100, 100
-fig_photo = draw_figure(canvas, fig, loc=(fig_x, fig_y))
-fig_w, fig_h = fig_photo.width(), fig_photo.height()
-
-# Add more elements to the canvas, potentially on top of the figure
-canvas.create_line(200, 50, fig_x + fig_w / 2, fig_y + fig_h / 2)
-canvas.create_text(200, 50, text="Zero-crossing", anchor="s")
-
-# Let Tk take over
-tk.mainloop()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/embedding_in_tk_canvas.py b/examples/user_interfaces/embedding_in_tk_canvas.py deleted file mode 100644 index d3698769444..00000000000 --- a/examples/user_interfaces/embedding_in_tk_canvas.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- noplot -*- - -import matplotlib as mpl -import numpy as np -import sys -if sys.version_info[0] < 3: - import Tkinter as tk -else: - import tkinter as tk -import matplotlib.backends.tkagg as tkagg -from matplotlib.backends.backend_agg import FigureCanvasAgg - - -def draw_figure(canvas, figure, loc=(0, 0)): - """ Draw a matplotlib figure onto a Tk canvas - - loc: location of top-left corner of figure on canvas in pixels. - - Inspired by matplotlib source: lib/matplotlib/backends/backend_tkagg.py - """ - figure_canvas_agg = FigureCanvasAgg(figure) - figure_canvas_agg.draw() - figure_x, figure_y, figure_w, figure_h = figure.bbox.bounds - figure_w, figure_h = int(figure_w), int(figure_h) - photo = tk.PhotoImage(master=canvas, width=figure_w, height=figure_h) - - # Position: convert from top-left anchor to center anchor - canvas.create_image(loc[0] + figure_w/2, loc[1] + figure_h/2, image=photo) - - # Unfortunately, there's no accessor for the pointer to the native renderer - tkagg.blit(photo, figure_canvas_agg.get_renderer()._renderer, colormode=2) - - # Return a handle which contains a reference to the photo object - # which must be kept live or else the picture disappears - return photo - -# Create a canvas -w, h = 300, 200 -window = tk.Tk() -window.title("A figure in a canvas") -canvas = tk.Canvas(window, width=w, height=h) -canvas.pack() - -# Generate some example data -X = np.linspace(0, 2.0*3.14, 50) -Y = np.sin(X) - -# Create the figure we desire to add to an existing canvas -fig = mpl.figure.Figure(figsize=(2, 1)) -ax = fig.add_axes([0, 0, 1, 1]) -ax.plot(X, Y) - -# Keep this handle alive, or else figure will disappear -fig_x, fig_y = 100, 100 -fig_photo = draw_figure(canvas, fig, loc=(fig_x, fig_y)) -fig_w, fig_h = fig_photo.width(), fig_photo.height() - -# Add more elements to the canvas, potentially on top of the figure -canvas.create_line(200, 50, fig_x + fig_w / 2, fig_y + fig_h / 2) -canvas.create_text(200, 50, text="Zero-crossing", anchor="s") - -# Let Tk take over -tk.mainloop() diff --git a/examples/user_interfaces/embedding_in_wx2.html b/examples/user_interfaces/embedding_in_wx2.html deleted file mode 100644 index f2b5efe52de..00000000000 --- a/examples/user_interfaces/embedding_in_wx2.html +++ /dev/null @@ -1,393 +0,0 @@ - - - - - - - - user_interfaces example code: embedding_in_wx2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: embedding_in_wx2.py

-

[source code]

-
"""
-An example of how to use wx or wxagg in an application with the new
-toolbar - comment out the setA_toolbar line for no toolbar
-"""
-
-# matplotlib requires wxPython 2.8+
-# set the wxPython version in lib\site-packages\wx.pth file
-# or if you have wxversion installed un-comment the lines below
-#import wxversion
-#wxversion.ensureMinimal('2.8')
-
-from numpy import arange, sin, pi
-
-import matplotlib
-
-# uncomment the following to use wx rather than wxagg
-#matplotlib.use('WX')
-#from matplotlib.backends.backend_wx import FigureCanvasWx as FigureCanvas
-
-# comment out the following to use wx rather than wxagg
-matplotlib.use('WXAgg')
-from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
-
-from matplotlib.backends.backend_wx import NavigationToolbar2Wx
-
-from matplotlib.figure import Figure
-
-import wx
-import wx.lib.mixins.inspection as WIT
-
-
-class CanvasFrame(wx.Frame):
-    def __init__(self):
-        wx.Frame.__init__(self, None, -1,
-                          'CanvasFrame', size=(550, 350))
-
-        self.figure = Figure()
-        self.axes = self.figure.add_subplot(111)
-        t = arange(0.0, 3.0, 0.01)
-        s = sin(2 * pi * t)
-
-        self.axes.plot(t, s)
-        self.canvas = FigureCanvas(self, -1, self.figure)
-
-        self.sizer = wx.BoxSizer(wx.VERTICAL)
-        self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.EXPAND)
-        self.SetSizer(self.sizer)
-        self.Fit()
-
-        self.add_toolbar()  # comment this out for no toolbar
-
-    def add_toolbar(self):
-        self.toolbar = NavigationToolbar2Wx(self.canvas)
-        self.toolbar.Realize()
-        # By adding toolbar in sizer, we are able to put it at the bottom
-        # of the frame - so appearance is closer to GTK version.
-        self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND)
-        # update the axes menu on the toolbar
-        self.toolbar.update()
-
-
-# alternatively you could use
-#class App(wx.App):
-class App(WIT.InspectableApp):
-    def OnInit(self):
-        'Create the main window and insert the custom frame'
-        self.Init()
-        frame = CanvasFrame()
-        frame.Show(True)
-
-        return True
-
-app = App(0)
-app.MainLoop()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/embedding_in_wx2.py b/examples/user_interfaces/embedding_in_wx2.py deleted file mode 100644 index 55c1580babb..00000000000 --- a/examples/user_interfaces/embedding_in_wx2.py +++ /dev/null @@ -1,74 +0,0 @@ -""" -An example of how to use wx or wxagg in an application with the new -toolbar - comment out the setA_toolbar line for no toolbar -""" - -# matplotlib requires wxPython 2.8+ -# set the wxPython version in lib\site-packages\wx.pth file -# or if you have wxversion installed un-comment the lines below -#import wxversion -#wxversion.ensureMinimal('2.8') - -from numpy import arange, sin, pi - -import matplotlib - -# uncomment the following to use wx rather than wxagg -#matplotlib.use('WX') -#from matplotlib.backends.backend_wx import FigureCanvasWx as FigureCanvas - -# comment out the following to use wx rather than wxagg -matplotlib.use('WXAgg') -from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas - -from matplotlib.backends.backend_wx import NavigationToolbar2Wx - -from matplotlib.figure import Figure - -import wx -import wx.lib.mixins.inspection as WIT - - -class CanvasFrame(wx.Frame): - def __init__(self): - wx.Frame.__init__(self, None, -1, - 'CanvasFrame', size=(550, 350)) - - self.figure = Figure() - self.axes = self.figure.add_subplot(111) - t = arange(0.0, 3.0, 0.01) - s = sin(2 * pi * t) - - self.axes.plot(t, s) - self.canvas = FigureCanvas(self, -1, self.figure) - - self.sizer = wx.BoxSizer(wx.VERTICAL) - self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.EXPAND) - self.SetSizer(self.sizer) - self.Fit() - - self.add_toolbar() # comment this out for no toolbar - - def add_toolbar(self): - self.toolbar = NavigationToolbar2Wx(self.canvas) - self.toolbar.Realize() - # By adding toolbar in sizer, we are able to put it at the bottom - # of the frame - so appearance is closer to GTK version. - self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) - # update the axes menu on the toolbar - self.toolbar.update() - - -# alternatively you could use -#class App(wx.App): -class App(WIT.InspectableApp): - def OnInit(self): - 'Create the main window and insert the custom frame' - self.Init() - frame = CanvasFrame() - frame.Show(True) - - return True - -app = App(0) -app.MainLoop() diff --git a/examples/user_interfaces/embedding_in_wx3.html b/examples/user_interfaces/embedding_in_wx3.html deleted file mode 100644 index ac959b78255..00000000000 --- a/examples/user_interfaces/embedding_in_wx3.html +++ /dev/null @@ -1,480 +0,0 @@ - - - - - - - - user_interfaces example code: embedding_in_wx3.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: embedding_in_wx3.py

-

[source code]

-
"""
-Copyright (C) 2003-2004 Andrew Straw, Jeremy O'Donoghue and others
-
-License: This work is licensed under the PSF. A copy should be included
-with this source code, and is also available at
-http://www.python.org/psf/license.html
-
-This is yet another example of using matplotlib with wx.  Hopefully
-this is pretty full-featured:
-
-  - both matplotlib toolbar and WX buttons manipulate plot
-  - full wxApp framework, including widget interaction
-  - XRC (XML wxWidgets resource) file to create GUI (made with XRCed)
-
-This was derived from embedding_in_wx and dynamic_image_wxagg.
-
-Thanks to matplotlib and wx teams for creating such great software!
-
-"""
-from __future__ import print_function
-
-# matplotlib requires wxPython 2.8+
-# set the wxPython version in lib\site-packages\wx.pth file
-# or if you have wxversion installed un-comment the lines below
-#import wxversion
-#wxversion.ensureMinimal('2.8')
-
-import sys
-import time
-import os
-import gc
-import matplotlib
-matplotlib.use('WXAgg')
-import matplotlib.cm as cm
-import matplotlib.cbook as cbook
-from matplotlib.backends.backend_wxagg import Toolbar, FigureCanvasWxAgg
-from matplotlib.figure import Figure
-import numpy as np
-
-import wx
-import wx.xrc as xrc
-
-ERR_TOL = 1e-5  # floating point slop for peak-detection
-
-
-matplotlib.rc('image', origin='lower')
-
-
-class PlotPanel(wx.Panel):
-    def __init__(self, parent):
-        wx.Panel.__init__(self, parent, -1)
-
-        self.fig = Figure((5, 4), 75)
-        self.canvas = FigureCanvasWxAgg(self, -1, self.fig)
-        self.toolbar = Toolbar(self.canvas)  # matplotlib toolbar
-        self.toolbar.Realize()
-        # self.toolbar.set_active([0,1])
-
-        # Now put all into a sizer
-        sizer = wx.BoxSizer(wx.VERTICAL)
-        # This way of adding to sizer allows resizing
-        sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
-        # Best to allow the toolbar to resize!
-        sizer.Add(self.toolbar, 0, wx.GROW)
-        self.SetSizer(sizer)
-        self.Fit()
-
-    def init_plot_data(self):
-        a = self.fig.add_subplot(111)
-
-        x = np.arange(120.0) * 2 * np.pi / 60.0
-        y = np.arange(100.0) * 2 * np.pi / 50.0
-        self.x, self.y = np.meshgrid(x, y)
-        z = np.sin(self.x) + np.cos(self.y)
-        self.im = a.imshow(z, cmap=cm.RdBu)  # , interpolation='nearest')
-
-        zmax = np.amax(z) - ERR_TOL
-        ymax_i, xmax_i = np.nonzero(z >= zmax)
-        if self.im.origin == 'upper':
-            ymax_i = z.shape[0] - ymax_i
-        self.lines = a.plot(xmax_i, ymax_i, 'ko')
-
-        self.toolbar.update()  # Not sure why this is needed - ADS
-
-    def GetToolBar(self):
-        # You will need to override GetToolBar if you are using an
-        # unmanaged toolbar in your frame
-        return self.toolbar
-
-    def OnWhiz(self, evt):
-        self.x += np.pi / 15
-        self.y += np.pi / 20
-        z = np.sin(self.x) + np.cos(self.y)
-        self.im.set_array(z)
-
-        zmax = np.amax(z) - ERR_TOL
-        ymax_i, xmax_i = np.nonzero(z >= zmax)
-        if self.im.origin == 'upper':
-            ymax_i = z.shape[0] - ymax_i
-        self.lines[0].set_data(xmax_i, ymax_i)
-
-        self.canvas.draw()
-
-    def onEraseBackground(self, evt):
-        # this is supposed to prevent redraw flicker on some X servers...
-        pass
-
-
-class MyApp(wx.App):
-    def OnInit(self):
-        xrcfile = cbook.get_sample_data('embedding_in_wx3.xrc',
-                                        asfileobj=False)
-        print('loading', xrcfile)
-
-        self.res = xrc.XmlResource(xrcfile)
-
-        # main frame and panel ---------
-
-        self.frame = self.res.LoadFrame(None, "MainFrame")
-        self.panel = xrc.XRCCTRL(self.frame, "MainPanel")
-
-        # matplotlib panel -------------
-
-        # container for matplotlib panel (I like to make a container
-        # panel for our panel so I know where it'll go when in XRCed.)
-        plot_container = xrc.XRCCTRL(self.frame, "plot_container_panel")
-        sizer = wx.BoxSizer(wx.VERTICAL)
-
-        # matplotlib panel itself
-        self.plotpanel = PlotPanel(plot_container)
-        self.plotpanel.init_plot_data()
-
-        # wx boilerplate
-        sizer.Add(self.plotpanel, 1, wx.EXPAND)
-        plot_container.SetSizer(sizer)
-
-        # whiz button ------------------
-        whiz_button = xrc.XRCCTRL(self.frame, "whiz_button")
-        whiz_button.Bind(wx.EVT_BUTTON, self.plotpanel.OnWhiz)
-
-        # bang button ------------------
-        bang_button = xrc.XRCCTRL(self.frame, "bang_button")
-        bang_button.Bind(wx.EVT_BUTTON, self.OnBang)
-
-        # final setup ------------------
-        sizer = self.panel.GetSizer()
-        self.frame.Show(1)
-
-        self.SetTopWindow(self.frame)
-
-        return True
-
-    def OnBang(self, event):
-        bang_count = xrc.XRCCTRL(self.frame, "bang_count")
-        bangs = bang_count.GetValue()
-        bangs = int(bangs) + 1
-        bang_count.SetValue(str(bangs))
-
-if __name__ == '__main__':
-    app = MyApp(0)
-    app.MainLoop()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/embedding_in_wx3.py b/examples/user_interfaces/embedding_in_wx3.py deleted file mode 100644 index 76cd4196c51..00000000000 --- a/examples/user_interfaces/embedding_in_wx3.py +++ /dev/null @@ -1,161 +0,0 @@ -""" -Copyright (C) 2003-2004 Andrew Straw, Jeremy O'Donoghue and others - -License: This work is licensed under the PSF. A copy should be included -with this source code, and is also available at -http://www.python.org/psf/license.html - -This is yet another example of using matplotlib with wx. Hopefully -this is pretty full-featured: - - - both matplotlib toolbar and WX buttons manipulate plot - - full wxApp framework, including widget interaction - - XRC (XML wxWidgets resource) file to create GUI (made with XRCed) - -This was derived from embedding_in_wx and dynamic_image_wxagg. - -Thanks to matplotlib and wx teams for creating such great software! - -""" -from __future__ import print_function - -# matplotlib requires wxPython 2.8+ -# set the wxPython version in lib\site-packages\wx.pth file -# or if you have wxversion installed un-comment the lines below -#import wxversion -#wxversion.ensureMinimal('2.8') - -import sys -import time -import os -import gc -import matplotlib -matplotlib.use('WXAgg') -import matplotlib.cm as cm -import matplotlib.cbook as cbook -from matplotlib.backends.backend_wxagg import Toolbar, FigureCanvasWxAgg -from matplotlib.figure import Figure -import numpy as np - -import wx -import wx.xrc as xrc - -ERR_TOL = 1e-5 # floating point slop for peak-detection - - -matplotlib.rc('image', origin='lower') - - -class PlotPanel(wx.Panel): - def __init__(self, parent): - wx.Panel.__init__(self, parent, -1) - - self.fig = Figure((5, 4), 75) - self.canvas = FigureCanvasWxAgg(self, -1, self.fig) - self.toolbar = Toolbar(self.canvas) # matplotlib toolbar - self.toolbar.Realize() - # self.toolbar.set_active([0,1]) - - # Now put all into a sizer - sizer = wx.BoxSizer(wx.VERTICAL) - # This way of adding to sizer allows resizing - sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) - # Best to allow the toolbar to resize! - sizer.Add(self.toolbar, 0, wx.GROW) - self.SetSizer(sizer) - self.Fit() - - def init_plot_data(self): - a = self.fig.add_subplot(111) - - x = np.arange(120.0) * 2 * np.pi / 60.0 - y = np.arange(100.0) * 2 * np.pi / 50.0 - self.x, self.y = np.meshgrid(x, y) - z = np.sin(self.x) + np.cos(self.y) - self.im = a.imshow(z, cmap=cm.RdBu) # , interpolation='nearest') - - zmax = np.amax(z) - ERR_TOL - ymax_i, xmax_i = np.nonzero(z >= zmax) - if self.im.origin == 'upper': - ymax_i = z.shape[0] - ymax_i - self.lines = a.plot(xmax_i, ymax_i, 'ko') - - self.toolbar.update() # Not sure why this is needed - ADS - - def GetToolBar(self): - # You will need to override GetToolBar if you are using an - # unmanaged toolbar in your frame - return self.toolbar - - def OnWhiz(self, evt): - self.x += np.pi / 15 - self.y += np.pi / 20 - z = np.sin(self.x) + np.cos(self.y) - self.im.set_array(z) - - zmax = np.amax(z) - ERR_TOL - ymax_i, xmax_i = np.nonzero(z >= zmax) - if self.im.origin == 'upper': - ymax_i = z.shape[0] - ymax_i - self.lines[0].set_data(xmax_i, ymax_i) - - self.canvas.draw() - - def onEraseBackground(self, evt): - # this is supposed to prevent redraw flicker on some X servers... - pass - - -class MyApp(wx.App): - def OnInit(self): - xrcfile = cbook.get_sample_data('embedding_in_wx3.xrc', - asfileobj=False) - print('loading', xrcfile) - - self.res = xrc.XmlResource(xrcfile) - - # main frame and panel --------- - - self.frame = self.res.LoadFrame(None, "MainFrame") - self.panel = xrc.XRCCTRL(self.frame, "MainPanel") - - # matplotlib panel ------------- - - # container for matplotlib panel (I like to make a container - # panel for our panel so I know where it'll go when in XRCed.) - plot_container = xrc.XRCCTRL(self.frame, "plot_container_panel") - sizer = wx.BoxSizer(wx.VERTICAL) - - # matplotlib panel itself - self.plotpanel = PlotPanel(plot_container) - self.plotpanel.init_plot_data() - - # wx boilerplate - sizer.Add(self.plotpanel, 1, wx.EXPAND) - plot_container.SetSizer(sizer) - - # whiz button ------------------ - whiz_button = xrc.XRCCTRL(self.frame, "whiz_button") - whiz_button.Bind(wx.EVT_BUTTON, self.plotpanel.OnWhiz) - - # bang button ------------------ - bang_button = xrc.XRCCTRL(self.frame, "bang_button") - bang_button.Bind(wx.EVT_BUTTON, self.OnBang) - - # final setup ------------------ - sizer = self.panel.GetSizer() - self.frame.Show(1) - - self.SetTopWindow(self.frame) - - return True - - def OnBang(self, event): - bang_count = xrc.XRCCTRL(self.frame, "bang_count") - bangs = bang_count.GetValue() - bangs = int(bangs) + 1 - bang_count.SetValue(str(bangs)) - -if __name__ == '__main__': - app = MyApp(0) - app.MainLoop() diff --git a/examples/user_interfaces/embedding_in_wx4.html b/examples/user_interfaces/embedding_in_wx4.html deleted file mode 100644 index c3001954a10..00000000000 --- a/examples/user_interfaces/embedding_in_wx4.html +++ /dev/null @@ -1,430 +0,0 @@ - - - - - - - - user_interfaces example code: embedding_in_wx4.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: embedding_in_wx4.py

-

[source code]

-
"""
-An example of how to use wx or wxagg in an application with a custom
-toolbar
-"""
-
-# matplotlib requires wxPython 2.8+
-# set the wxPython version in lib\site-packages\wx.pth file
-# or if you have wxversion installed un-comment the lines below
-#import wxversion
-#wxversion.ensureMinimal('2.8')
-
-from numpy import arange, sin, pi
-
-import matplotlib
-
-matplotlib.use('WXAgg')
-from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
-from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg
-
-from matplotlib.backends.backend_wx import _load_bitmap
-from matplotlib.figure import Figure
-from numpy.random import rand
-
-import wx
-
-
-class MyNavigationToolbar(NavigationToolbar2WxAgg):
-    """
-    Extend the default wx toolbar with your own event handlers
-    """
-    ON_CUSTOM = wx.NewId()
-
-    def __init__(self, canvas, cankill):
-        NavigationToolbar2WxAgg.__init__(self, canvas)
-
-        # for simplicity I'm going to reuse a bitmap from wx, you'll
-        # probably want to add your own.
-        if 'phoenix' in wx.PlatformInfo:
-            self.AddTool(self.ON_CUSTOM, 'Click me',
-                         _load_bitmap('back.png'),
-                         'Activate custom contol')
-            self.Bind(wx.EVT_TOOL, self._on_custom, id=self.ON_CUSTOM)
-        else:
-            self.AddSimpleTool(self.ON_CUSTOM, _load_bitmap('back.png'),
-                               'Click me', 'Activate custom contol')
-            self.Bind(wx.EVT_TOOL, self._on_custom, id=self.ON_CUSTOM)
-
-    def _on_custom(self, evt):
-        # add some text to the axes in a random location in axes (0,1)
-        # coords) with a random color
-
-        # get the axes
-        ax = self.canvas.figure.axes[0]
-
-        # generate a random location can color
-        x, y = tuple(rand(2))
-        rgb = tuple(rand(3))
-
-        # add the text and draw
-        ax.text(x, y, 'You clicked me',
-                transform=ax.transAxes,
-                color=rgb)
-        self.canvas.draw()
-        evt.Skip()
-
-
-class CanvasFrame(wx.Frame):
-    def __init__(self):
-        wx.Frame.__init__(self, None, -1,
-                          'CanvasFrame', size=(550, 350))
-
-        self.figure = Figure(figsize=(5, 4), dpi=100)
-        self.axes = self.figure.add_subplot(111)
-        t = arange(0.0, 3.0, 0.01)
-        s = sin(2 * pi * t)
-
-        self.axes.plot(t, s)
-
-        self.canvas = FigureCanvas(self, -1, self.figure)
-
-        self.sizer = wx.BoxSizer(wx.VERTICAL)
-        self.sizer.Add(self.canvas, 1, wx.TOP | wx.LEFT | wx.EXPAND)
-        # Capture the paint message
-        self.Bind(wx.EVT_PAINT, self.OnPaint)
-
-        self.toolbar = MyNavigationToolbar(self.canvas, True)
-        self.toolbar.Realize()
-        # By adding toolbar in sizer, we are able to put it at the bottom
-        # of the frame - so appearance is closer to GTK version.
-        self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND)
-
-        # update the axes menu on the toolbar
-        self.toolbar.update()
-        self.SetSizer(self.sizer)
-        self.Fit()
-
-    def OnPaint(self, event):
-        self.canvas.draw()
-        event.Skip()
-
-
-class App(wx.App):
-    def OnInit(self):
-        'Create the main window and insert the custom frame'
-        frame = CanvasFrame()
-        frame.Show(True)
-
-        return True
-
-app = App(0)
-app.MainLoop()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/embedding_in_wx4.py b/examples/user_interfaces/embedding_in_wx4.py deleted file mode 100644 index af8999afb73..00000000000 --- a/examples/user_interfaces/embedding_in_wx4.py +++ /dev/null @@ -1,111 +0,0 @@ -""" -An example of how to use wx or wxagg in an application with a custom -toolbar -""" - -# matplotlib requires wxPython 2.8+ -# set the wxPython version in lib\site-packages\wx.pth file -# or if you have wxversion installed un-comment the lines below -#import wxversion -#wxversion.ensureMinimal('2.8') - -from numpy import arange, sin, pi - -import matplotlib - -matplotlib.use('WXAgg') -from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas -from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg - -from matplotlib.backends.backend_wx import _load_bitmap -from matplotlib.figure import Figure -from numpy.random import rand - -import wx - - -class MyNavigationToolbar(NavigationToolbar2WxAgg): - """ - Extend the default wx toolbar with your own event handlers - """ - ON_CUSTOM = wx.NewId() - - def __init__(self, canvas, cankill): - NavigationToolbar2WxAgg.__init__(self, canvas) - - # for simplicity I'm going to reuse a bitmap from wx, you'll - # probably want to add your own. - if 'phoenix' in wx.PlatformInfo: - self.AddTool(self.ON_CUSTOM, 'Click me', - _load_bitmap('back.png'), - 'Activate custom contol') - self.Bind(wx.EVT_TOOL, self._on_custom, id=self.ON_CUSTOM) - else: - self.AddSimpleTool(self.ON_CUSTOM, _load_bitmap('back.png'), - 'Click me', 'Activate custom contol') - self.Bind(wx.EVT_TOOL, self._on_custom, id=self.ON_CUSTOM) - - def _on_custom(self, evt): - # add some text to the axes in a random location in axes (0,1) - # coords) with a random color - - # get the axes - ax = self.canvas.figure.axes[0] - - # generate a random location can color - x, y = tuple(rand(2)) - rgb = tuple(rand(3)) - - # add the text and draw - ax.text(x, y, 'You clicked me', - transform=ax.transAxes, - color=rgb) - self.canvas.draw() - evt.Skip() - - -class CanvasFrame(wx.Frame): - def __init__(self): - wx.Frame.__init__(self, None, -1, - 'CanvasFrame', size=(550, 350)) - - self.figure = Figure(figsize=(5, 4), dpi=100) - self.axes = self.figure.add_subplot(111) - t = arange(0.0, 3.0, 0.01) - s = sin(2 * pi * t) - - self.axes.plot(t, s) - - self.canvas = FigureCanvas(self, -1, self.figure) - - self.sizer = wx.BoxSizer(wx.VERTICAL) - self.sizer.Add(self.canvas, 1, wx.TOP | wx.LEFT | wx.EXPAND) - # Capture the paint message - self.Bind(wx.EVT_PAINT, self.OnPaint) - - self.toolbar = MyNavigationToolbar(self.canvas, True) - self.toolbar.Realize() - # By adding toolbar in sizer, we are able to put it at the bottom - # of the frame - so appearance is closer to GTK version. - self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) - - # update the axes menu on the toolbar - self.toolbar.update() - self.SetSizer(self.sizer) - self.Fit() - - def OnPaint(self, event): - self.canvas.draw() - event.Skip() - - -class App(wx.App): - def OnInit(self): - 'Create the main window and insert the custom frame' - frame = CanvasFrame() - frame.Show(True) - - return True - -app = App(0) -app.MainLoop() diff --git a/examples/user_interfaces/embedding_in_wx5.html b/examples/user_interfaces/embedding_in_wx5.html deleted file mode 100644 index 99b897e5f21..00000000000 --- a/examples/user_interfaces/embedding_in_wx5.html +++ /dev/null @@ -1,383 +0,0 @@ - - - - - - - - user_interfaces example code: embedding_in_wx5.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: embedding_in_wx5.py

-

[source code]

-
# matplotlib requires wxPython 2.8+
-# set the wxPython version in lib\site-packages\wx.pth file
-# or if you have wxversion installed un-comment the lines below
-#import wxversion
-#wxversion.ensureMinimal('2.8')
-
-import wx
-import wx.lib.mixins.inspection as wit
-
-if 'phoenix' in wx.PlatformInfo:
-    import wx.lib.agw.aui as aui
-else:
-    import wx.aui as aui
-
-import matplotlib as mpl
-from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas
-from matplotlib.backends.backend_wxagg import NavigationToolbar2Wx as Toolbar
-
-
-class Plot(wx.Panel):
-    def __init__(self, parent, id=-1, dpi=None, **kwargs):
-        wx.Panel.__init__(self, parent, id=id, **kwargs)
-        self.figure = mpl.figure.Figure(dpi=dpi, figsize=(2, 2))
-        self.canvas = Canvas(self, -1, self.figure)
-        self.toolbar = Toolbar(self.canvas)
-        self.toolbar.Realize()
-
-        sizer = wx.BoxSizer(wx.VERTICAL)
-        sizer.Add(self.canvas, 1, wx.EXPAND)
-        sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND)
-        self.SetSizer(sizer)
-
-
-class PlotNotebook(wx.Panel):
-    def __init__(self, parent, id=-1):
-        wx.Panel.__init__(self, parent, id=id)
-        self.nb = aui.AuiNotebook(self)
-        sizer = wx.BoxSizer()
-        sizer.Add(self.nb, 1, wx.EXPAND)
-        self.SetSizer(sizer)
-
-    def add(self, name="plot"):
-        page = Plot(self.nb)
-        self.nb.AddPage(page, name)
-        return page.figure
-
-
-def demo():
-    # alternatively you could use
-    #app = wx.App()
-    # InspectableApp is a great debug tool, see:
-    # http://wiki.wxpython.org/Widget%20Inspection%20Tool
-    app = wit.InspectableApp()
-    frame = wx.Frame(None, -1, 'Plotter')
-    plotter = PlotNotebook(frame)
-    axes1 = plotter.add('figure 1').gca()
-    axes1.plot([1, 2, 3], [2, 1, 4])
-    axes2 = plotter.add('figure 2').gca()
-    axes2.plot([1, 2, 3, 4, 5], [2, 1, 4, 2, 3])
-    frame.Show()
-    app.MainLoop()
-
-if __name__ == "__main__":
-    demo()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/embedding_in_wx5.py b/examples/user_interfaces/embedding_in_wx5.py deleted file mode 100644 index 83db43c545d..00000000000 --- a/examples/user_interfaces/embedding_in_wx5.py +++ /dev/null @@ -1,64 +0,0 @@ -# matplotlib requires wxPython 2.8+ -# set the wxPython version in lib\site-packages\wx.pth file -# or if you have wxversion installed un-comment the lines below -#import wxversion -#wxversion.ensureMinimal('2.8') - -import wx -import wx.lib.mixins.inspection as wit - -if 'phoenix' in wx.PlatformInfo: - import wx.lib.agw.aui as aui -else: - import wx.aui as aui - -import matplotlib as mpl -from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas -from matplotlib.backends.backend_wxagg import NavigationToolbar2Wx as Toolbar - - -class Plot(wx.Panel): - def __init__(self, parent, id=-1, dpi=None, **kwargs): - wx.Panel.__init__(self, parent, id=id, **kwargs) - self.figure = mpl.figure.Figure(dpi=dpi, figsize=(2, 2)) - self.canvas = Canvas(self, -1, self.figure) - self.toolbar = Toolbar(self.canvas) - self.toolbar.Realize() - - sizer = wx.BoxSizer(wx.VERTICAL) - sizer.Add(self.canvas, 1, wx.EXPAND) - sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) - self.SetSizer(sizer) - - -class PlotNotebook(wx.Panel): - def __init__(self, parent, id=-1): - wx.Panel.__init__(self, parent, id=id) - self.nb = aui.AuiNotebook(self) - sizer = wx.BoxSizer() - sizer.Add(self.nb, 1, wx.EXPAND) - self.SetSizer(sizer) - - def add(self, name="plot"): - page = Plot(self.nb) - self.nb.AddPage(page, name) - return page.figure - - -def demo(): - # alternatively you could use - #app = wx.App() - # InspectableApp is a great debug tool, see: - # http://wiki.wxpython.org/Widget%20Inspection%20Tool - app = wit.InspectableApp() - frame = wx.Frame(None, -1, 'Plotter') - plotter = PlotNotebook(frame) - axes1 = plotter.add('figure 1').gca() - axes1.plot([1, 2, 3], [2, 1, 4]) - axes2 = plotter.add('figure 2').gca() - axes2.plot([1, 2, 3, 4, 5], [2, 1, 4, 2, 3]) - frame.Show() - app.MainLoop() - -if __name__ == "__main__": - demo() diff --git a/examples/user_interfaces/embedding_webagg.html b/examples/user_interfaces/embedding_webagg.html deleted file mode 100644 index e370e90e80e..00000000000 --- a/examples/user_interfaces/embedding_webagg.html +++ /dev/null @@ -1,565 +0,0 @@ - - - - - - - - user_interfaces example code: embedding_webagg.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: embedding_webagg.py

-

[source code]

-
"""
-This example demonstrates how to embed matplotlib WebAgg interactive
-plotting in your own web application and framework.  It is not
-necessary to do all this if you merely want to display a plot in a
-browser or use matplotlib's built-in Tornado-based server "on the
-side".
-
-The framework being used must support web sockets.
-"""
-
-import io
-
-try:
-    import tornado
-except ImportError:
-    raise RuntimeError("This example requires tornado.")
-import tornado.web
-import tornado.httpserver
-import tornado.ioloop
-import tornado.websocket
-
-
-from matplotlib.backends.backend_webagg_core import (
-    FigureManagerWebAgg, new_figure_manager_given_figure)
-from matplotlib.figure import Figure
-
-import numpy as np
-
-import json
-
-
-def create_figure():
-    """
-    Creates a simple example figure.
-    """
-    fig = Figure()
-    a = fig.add_subplot(111)
-    t = np.arange(0.0, 3.0, 0.01)
-    s = np.sin(2 * np.pi * t)
-    a.plot(t, s)
-    return fig
-
-
-# The following is the content of the web page.  You would normally
-# generate this using some sort of template facility in your web
-# framework, but here we just use Python string formatting.
-html_content = """
-<html>
-  <head>
-    <!-- TODO: There should be a way to include all of the required javascript
-               and CSS so matplotlib can add to the set in the future if it
-               needs to. -->
-    <link rel="stylesheet" href="_static/css/page.css" type="text/css">
-    <link rel="stylesheet" href="_static/css/boilerplate.css" type="text/css" />
-    <link rel="stylesheet" href="_static/css/fbm.css" type="text/css" />
-    <link rel="stylesheet" href="_static/jquery/css/themes/base/jquery-ui.min.css" >
-    <script src="_static/jquery/js/jquery-1.11.3.min.js"></script>
-    <script src="_static/jquery/js/jquery-ui.min.js"></script>
-    <script src="mpl.js"></script>
-
-    <script>
-      /* This is a callback that is called when the user saves
-         (downloads) a file.  Its purpose is really to map from a
-         figure and file format to a url in the application. */
-      function ondownload(figure, format) {
-        window.open('download.' + format, '_blank');
-      };
-
-      $(document).ready(
-        function() {
-          /* It is up to the application to provide a websocket that the figure
-             will use to communicate to the server.  This websocket object can
-             also be a "fake" websocket that underneath multiplexes messages
-             from multiple figures, if necessary. */
-          var websocket_type = mpl.get_websocket_type();
-          var websocket = new websocket_type("%(ws_uri)sws");
-
-          // mpl.figure creates a new figure on the webpage.
-          var fig = new mpl.figure(
-              // A unique numeric identifier for the figure
-              %(fig_id)s,
-              // A websocket object (or something that behaves like one)
-              websocket,
-              // A function called when a file type is selected for download
-              ondownload,
-              // The HTML element in which to place the figure
-              $('div#figure'));
-        }
-      );
-    </script>
-
-    <title>matplotlib</title>
-  </head>
-
-  <body>
-    <div id="figure">
-    </div>
-  </body>
-</html>
-"""
-
-
-class MyApplication(tornado.web.Application):
-    class MainPage(tornado.web.RequestHandler):
-        """
-        Serves the main HTML page.
-        """
-
-        def get(self):
-            manager = self.application.manager
-            ws_uri = "ws://{req.host}/".format(req=self.request)
-            content = html_content % {
-                "ws_uri": ws_uri, "fig_id": manager.num}
-            self.write(content)
-
-    class MplJs(tornado.web.RequestHandler):
-        """
-        Serves the generated matplotlib javascript file.  The content
-        is dynamically generated based on which toolbar functions the
-        user has defined.  Call `FigureManagerWebAgg` to get its
-        content.
-        """
-
-        def get(self):
-            self.set_header('Content-Type', 'application/javascript')
-            js_content = FigureManagerWebAgg.get_javascript()
-
-            self.write(js_content)
-
-    class Download(tornado.web.RequestHandler):
-        """
-        Handles downloading of the figure in various file formats.
-        """
-
-        def get(self, fmt):
-            manager = self.application.manager
-
-            mimetypes = {
-                'ps': 'application/postscript',
-                'eps': 'application/postscript',
-                'pdf': 'application/pdf',
-                'svg': 'image/svg+xml',
-                'png': 'image/png',
-                'jpeg': 'image/jpeg',
-                'tif': 'image/tiff',
-                'emf': 'application/emf'
-            }
-
-            self.set_header('Content-Type', mimetypes.get(fmt, 'binary'))
-
-            buff = io.BytesIO()
-            manager.canvas.print_figure(buff, format=fmt)
-            self.write(buff.getvalue())
-
-    class WebSocket(tornado.websocket.WebSocketHandler):
-        """
-        A websocket for interactive communication between the plot in
-        the browser and the server.
-
-        In addition to the methods required by tornado, it is required to
-        have two callback methods:
-
-            - ``send_json(json_content)`` is called by matplotlib when
-              it needs to send json to the browser.  `json_content` is
-              a JSON tree (Python dictionary), and it is the responsibility
-              of this implementation to encode it as a string to send over
-              the socket.
-
-            - ``send_binary(blob)`` is called to send binary image data
-              to the browser.
-        """
-        supports_binary = True
-
-        def open(self):
-            # Register the websocket with the FigureManager.
-            manager = self.application.manager
-            manager.add_web_socket(self)
-            if hasattr(self, 'set_nodelay'):
-                self.set_nodelay(True)
-
-        def on_close(self):
-            # When the socket is closed, deregister the websocket with
-            # the FigureManager.
-            manager = self.application.manager
-            manager.remove_web_socket(self)
-
-        def on_message(self, message):
-            # The 'supports_binary' message is relevant to the
-            # websocket itself.  The other messages get passed along
-            # to matplotlib as-is.
-
-            # Every message has a "type" and a "figure_id".
-            message = json.loads(message)
-            if message['type'] == 'supports_binary':
-                self.supports_binary = message['value']
-            else:
-                manager = self.application.manager
-                manager.handle_json(message)
-
-        def send_json(self, content):
-            self.write_message(json.dumps(content))
-
-        def send_binary(self, blob):
-            if self.supports_binary:
-                self.write_message(blob, binary=True)
-            else:
-                data_uri = "data:image/png;base64,{0}".format(
-                    blob.encode('base64').replace('\n', ''))
-                self.write_message(data_uri)
-
-    def __init__(self, figure):
-        self.figure = figure
-        self.manager = new_figure_manager_given_figure(
-            id(figure), figure)
-
-        super(MyApplication, self).__init__([
-            # Static files for the CSS and JS
-            (r'/_static/(.*)',
-             tornado.web.StaticFileHandler,
-             {'path': FigureManagerWebAgg.get_static_file_path()}),
-
-            # The page that contains all of the pieces
-            ('/', self.MainPage),
-
-            ('/mpl.js', self.MplJs),
-
-            # Sends images and events to the browser, and receives
-            # events from the browser
-            ('/ws', self.WebSocket),
-
-            # Handles the downloading (i.e., saving) of static images
-            (r'/download.([a-z0-9.]+)', self.Download),
-        ])
-
-
-if __name__ == "__main__":
-    figure = create_figure()
-    application = MyApplication(figure)
-
-    http_server = tornado.httpserver.HTTPServer(application)
-    http_server.listen(8080)
-
-    print("http://127.0.0.1:8080/")
-    print("Press Ctrl+C to quit")
-
-    tornado.ioloop.IOLoop.instance().start()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/embedding_webagg.py b/examples/user_interfaces/embedding_webagg.py deleted file mode 100644 index ba208fd0c07..00000000000 --- a/examples/user_interfaces/embedding_webagg.py +++ /dev/null @@ -1,246 +0,0 @@ -""" -This example demonstrates how to embed matplotlib WebAgg interactive -plotting in your own web application and framework. It is not -necessary to do all this if you merely want to display a plot in a -browser or use matplotlib's built-in Tornado-based server "on the -side". - -The framework being used must support web sockets. -""" - -import io - -try: - import tornado -except ImportError: - raise RuntimeError("This example requires tornado.") -import tornado.web -import tornado.httpserver -import tornado.ioloop -import tornado.websocket - - -from matplotlib.backends.backend_webagg_core import ( - FigureManagerWebAgg, new_figure_manager_given_figure) -from matplotlib.figure import Figure - -import numpy as np - -import json - - -def create_figure(): - """ - Creates a simple example figure. - """ - fig = Figure() - a = fig.add_subplot(111) - t = np.arange(0.0, 3.0, 0.01) - s = np.sin(2 * np.pi * t) - a.plot(t, s) - return fig - - -# The following is the content of the web page. You would normally -# generate this using some sort of template facility in your web -# framework, but here we just use Python string formatting. -html_content = """ - - - - - - - - - - - - - - matplotlib - - - -
-
- - -""" - - -class MyApplication(tornado.web.Application): - class MainPage(tornado.web.RequestHandler): - """ - Serves the main HTML page. - """ - - def get(self): - manager = self.application.manager - ws_uri = "ws://{req.host}/".format(req=self.request) - content = html_content % { - "ws_uri": ws_uri, "fig_id": manager.num} - self.write(content) - - class MplJs(tornado.web.RequestHandler): - """ - Serves the generated matplotlib javascript file. The content - is dynamically generated based on which toolbar functions the - user has defined. Call `FigureManagerWebAgg` to get its - content. - """ - - def get(self): - self.set_header('Content-Type', 'application/javascript') - js_content = FigureManagerWebAgg.get_javascript() - - self.write(js_content) - - class Download(tornado.web.RequestHandler): - """ - Handles downloading of the figure in various file formats. - """ - - def get(self, fmt): - manager = self.application.manager - - mimetypes = { - 'ps': 'application/postscript', - 'eps': 'application/postscript', - 'pdf': 'application/pdf', - 'svg': 'image/svg+xml', - 'png': 'image/png', - 'jpeg': 'image/jpeg', - 'tif': 'image/tiff', - 'emf': 'application/emf' - } - - self.set_header('Content-Type', mimetypes.get(fmt, 'binary')) - - buff = io.BytesIO() - manager.canvas.print_figure(buff, format=fmt) - self.write(buff.getvalue()) - - class WebSocket(tornado.websocket.WebSocketHandler): - """ - A websocket for interactive communication between the plot in - the browser and the server. - - In addition to the methods required by tornado, it is required to - have two callback methods: - - - ``send_json(json_content)`` is called by matplotlib when - it needs to send json to the browser. `json_content` is - a JSON tree (Python dictionary), and it is the responsibility - of this implementation to encode it as a string to send over - the socket. - - - ``send_binary(blob)`` is called to send binary image data - to the browser. - """ - supports_binary = True - - def open(self): - # Register the websocket with the FigureManager. - manager = self.application.manager - manager.add_web_socket(self) - if hasattr(self, 'set_nodelay'): - self.set_nodelay(True) - - def on_close(self): - # When the socket is closed, deregister the websocket with - # the FigureManager. - manager = self.application.manager - manager.remove_web_socket(self) - - def on_message(self, message): - # The 'supports_binary' message is relevant to the - # websocket itself. The other messages get passed along - # to matplotlib as-is. - - # Every message has a "type" and a "figure_id". - message = json.loads(message) - if message['type'] == 'supports_binary': - self.supports_binary = message['value'] - else: - manager = self.application.manager - manager.handle_json(message) - - def send_json(self, content): - self.write_message(json.dumps(content)) - - def send_binary(self, blob): - if self.supports_binary: - self.write_message(blob, binary=True) - else: - data_uri = "data:image/png;base64,{0}".format( - blob.encode('base64').replace('\n', '')) - self.write_message(data_uri) - - def __init__(self, figure): - self.figure = figure - self.manager = new_figure_manager_given_figure( - id(figure), figure) - - super(MyApplication, self).__init__([ - # Static files for the CSS and JS - (r'/_static/(.*)', - tornado.web.StaticFileHandler, - {'path': FigureManagerWebAgg.get_static_file_path()}), - - # The page that contains all of the pieces - ('/', self.MainPage), - - ('/mpl.js', self.MplJs), - - # Sends images and events to the browser, and receives - # events from the browser - ('/ws', self.WebSocket), - - # Handles the downloading (i.e., saving) of static images - (r'/download.([a-z0-9.]+)', self.Download), - ]) - - -if __name__ == "__main__": - figure = create_figure() - application = MyApplication(figure) - - http_server = tornado.httpserver.HTTPServer(application) - http_server.listen(8080) - - print("http://127.0.0.1:8080/") - print("Press Ctrl+C to quit") - - tornado.ioloop.IOLoop.instance().start() diff --git a/examples/user_interfaces/fourier_demo_wx.html b/examples/user_interfaces/fourier_demo_wx.html deleted file mode 100644 index 45cb5c49de0..00000000000 --- a/examples/user_interfaces/fourier_demo_wx.html +++ /dev/null @@ -1,564 +0,0 @@ - - - - - - - - user_interfaces example code: fourier_demo_wx.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: fourier_demo_wx.py

-

[source code]

-
import numpy as np
-
-# matplotlib requires wxPython 2.8+
-# set the wxPython version in lib\site-packages\wx.pth file
-# or if you have wxversion installed un-comment the lines below
-#import wxversion
-#wxversion.ensureMinimal('2.8')
-
-import wx
-import matplotlib
-matplotlib.interactive(False)
-matplotlib.use('WXAgg')
-from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
-from matplotlib.figure import Figure
-from matplotlib.pyplot import gcf, setp
-
-
-class Knob(object):
-    """
-    Knob - simple class with a "setKnob" method.
-    A Knob instance is attached to a Param instance, e.g., param.attach(knob)
-    Base class is for documentation purposes.
-    """
-
-    def setKnob(self, value):
-        pass
-
-
-class Param(object):
-    """
-    The idea of the "Param" class is that some parameter in the GUI may have
-    several knobs that both control it and reflect the parameter's state, e.g.
-    a slider, text, and dragging can all change the value of the frequency in
-    the waveform of this example.
-    The class allows a cleaner way to update/"feedback" to the other knobs when
-    one is being changed.  Also, this class handles min/max constraints for all
-    the knobs.
-    Idea - knob list - in "set" method, knob object is passed as well
-      - the other knobs in the knob list have a "set" method which gets
-        called for the others.
-    """
-
-    def __init__(self, initialValue=None, minimum=0., maximum=1.):
-        self.minimum = minimum
-        self.maximum = maximum
-        if initialValue != self.constrain(initialValue):
-            raise ValueError('illegal initial value')
-        self.value = initialValue
-        self.knobs = []
-
-    def attach(self, knob):
-        self.knobs += [knob]
-
-    def set(self, value, knob=None):
-        self.value = value
-        self.value = self.constrain(value)
-        for feedbackKnob in self.knobs:
-            if feedbackKnob != knob:
-                feedbackKnob.setKnob(self.value)
-        return self.value
-
-    def constrain(self, value):
-        if value <= self.minimum:
-            value = self.minimum
-        if value >= self.maximum:
-            value = self.maximum
-        return value
-
-
-class SliderGroup(Knob):
-    def __init__(self, parent, label, param):
-        self.sliderLabel = wx.StaticText(parent, label=label)
-        self.sliderText = wx.TextCtrl(parent, -1, style=wx.TE_PROCESS_ENTER)
-        self.slider = wx.Slider(parent, -1)
-        # self.slider.SetMax(param.maximum*1000)
-        self.slider.SetRange(0, param.maximum * 1000)
-        self.setKnob(param.value)
-
-        sizer = wx.BoxSizer(wx.HORIZONTAL)
-        sizer.Add(self.sliderLabel, 0,
-                  wx.EXPAND | wx.ALIGN_CENTER | wx.ALL,
-                  border=2)
-        sizer.Add(self.sliderText, 0,
-                  wx.EXPAND | wx.ALIGN_CENTER | wx.ALL,
-                  border=2)
-        sizer.Add(self.slider, 1, wx.EXPAND)
-        self.sizer = sizer
-
-        self.slider.Bind(wx.EVT_SLIDER, self.sliderHandler)
-        self.sliderText.Bind(wx.EVT_TEXT_ENTER, self.sliderTextHandler)
-
-        self.param = param
-        self.param.attach(self)
-
-    def sliderHandler(self, evt):
-        value = evt.GetInt() / 1000.
-        self.param.set(value)
-
-    def sliderTextHandler(self, evt):
-        value = float(self.sliderText.GetValue())
-        self.param.set(value)
-
-    def setKnob(self, value):
-        self.sliderText.SetValue('%g' % value)
-        self.slider.SetValue(value * 1000)
-
-
-class FourierDemoFrame(wx.Frame):
-    def __init__(self, *args, **kwargs):
-        wx.Frame.__init__(self, *args, **kwargs)
-
-        self.fourierDemoWindow = FourierDemoWindow(self)
-        self.frequencySliderGroup = SliderGroup(
-            self,
-            label='Frequency f0:',
-            param=self.fourierDemoWindow.f0)
-        self.amplitudeSliderGroup = SliderGroup(self, label=' Amplitude a:',
-                                                param=self.fourierDemoWindow.A)
-
-        sizer = wx.BoxSizer(wx.VERTICAL)
-        sizer.Add(self.fourierDemoWindow, 1, wx.EXPAND)
-        sizer.Add(self.frequencySliderGroup.sizer, 0,
-                  wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=5)
-        sizer.Add(self.amplitudeSliderGroup.sizer, 0,
-                  wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=5)
-        self.SetSizer(sizer)
-
-
-class FourierDemoWindow(wx.Window, Knob):
-    def __init__(self, *args, **kwargs):
-        wx.Window.__init__(self, *args, **kwargs)
-        self.lines = []
-        self.figure = Figure()
-        self.canvas = FigureCanvasWxAgg(self, -1, self.figure)
-        self.canvas.callbacks.connect('button_press_event', self.mouseDown)
-        self.canvas.callbacks.connect('motion_notify_event', self.mouseMotion)
-        self.canvas.callbacks.connect('button_release_event', self.mouseUp)
-        self.state = ''
-        self.mouseInfo = (None, None, None, None)
-        self.f0 = Param(2., minimum=0., maximum=6.)
-        self.A = Param(1., minimum=0.01, maximum=2.)
-        self.draw()
-
-        # Not sure I like having two params attached to the same Knob,
-        # but that is what we have here... it works but feels kludgy -
-        # although maybe it's not too bad since the knob changes both params
-        # at the same time (both f0 and A are affected during a drag)
-        self.f0.attach(self)
-        self.A.attach(self)
-        self.Bind(wx.EVT_SIZE, self.sizeHandler)
-
-        self.Bind(wx.EVT_PAINT, self.OnPaint)
-
-    def OnPaint(self, event):
-        self.canvas.draw()
-        event.Skip()
-
-    def sizeHandler(self, *args, **kwargs):
-        self.canvas.SetSize(self.GetSize())
-
-    def mouseDown(self, evt):
-        if self.lines[0] in self.figure.hitlist(evt):
-            self.state = 'frequency'
-        elif self.lines[1] in self.figure.hitlist(evt):
-            self.state = 'time'
-        else:
-            self.state = ''
-        self.mouseInfo = (evt.xdata, evt.ydata,
-                          max(self.f0.value, .1),
-                          self.A.value)
-
-    def mouseMotion(self, evt):
-        if self.state == '':
-            return
-        x, y = evt.xdata, evt.ydata
-        if x is None:  # outside the axes
-            return
-        x0, y0, f0Init, AInit = self.mouseInfo
-        self.A.set(AInit + (AInit * (y - y0) / y0), self)
-        if self.state == 'frequency':
-            self.f0.set(f0Init + (f0Init * (x - x0) / x0))
-        elif self.state == 'time':
-            if (x - x0) / x0 != -1.:
-                self.f0.set(1. / (1. / f0Init + (1. / f0Init * (x - x0) / x0)))
-
-    def mouseUp(self, evt):
-        self.state = ''
-
-    def draw(self):
-        if not hasattr(self, 'subplot1'):
-            self.subplot1 = self.figure.add_subplot(211)
-            self.subplot2 = self.figure.add_subplot(212)
-        x1, y1, x2, y2 = self.compute(self.f0.value, self.A.value)
-        color = (1., 0., 0.)
-        self.lines += self.subplot1.plot(x1, y1, color=color, linewidth=2)
-        self.lines += self.subplot2.plot(x2, y2, color=color, linewidth=2)
-        # Set some plot attributes
-        self.subplot1.set_title(
-            "Click and drag waveforms to change frequency and amplitude",
-            fontsize=12)
-        self.subplot1.set_ylabel("Frequency Domain Waveform X(f)", fontsize=8)
-        self.subplot1.set_xlabel("frequency f", fontsize=8)
-        self.subplot2.set_ylabel("Time Domain Waveform x(t)", fontsize=8)
-        self.subplot2.set_xlabel("time t", fontsize=8)
-        self.subplot1.set_xlim([-6, 6])
-        self.subplot1.set_ylim([0, 1])
-        self.subplot2.set_xlim([-2, 2])
-        self.subplot2.set_ylim([-2, 2])
-        self.subplot1.text(0.05, .95,
-                           r'$X(f) = \mathcal{F}\{x(t)\}$',
-                           verticalalignment='top',
-                           transform=self.subplot1.transAxes)
-        self.subplot2.text(0.05, .95,
-                           r'$x(t) = a \cdot \cos(2\pi f_0 t) e^{-\pi t^2}$',
-                           verticalalignment='top',
-                           transform=self.subplot2.transAxes)
-
-    def compute(self, f0, A):
-        f = np.arange(-6., 6., 0.02)
-        t = np.arange(-2., 2., 0.01)
-        x = A * np.cos(2 * np.pi * f0 * t) * np.exp(-np.pi * t ** 2)
-        X = A / 2 * \
-            (np.exp(-np.pi * (f - f0) ** 2) + np.exp(-np.pi * (f + f0) ** 2))
-        return f, X, t, x
-
-    def repaint(self):
-        self.canvas.draw()
-
-    def setKnob(self, value):
-        # Note, we ignore value arg here and just go by state of the params
-        x1, y1, x2, y2 = self.compute(self.f0.value, self.A.value)
-        setp(self.lines[0], xdata=x1, ydata=y1)
-        setp(self.lines[1], xdata=x2, ydata=y2)
-        self.repaint()
-
-
-class App(wx.App):
-    def OnInit(self):
-        self.frame1 = FourierDemoFrame(parent=None, title="Fourier Demo",
-                                       size=(640, 480))
-        self.frame1.Show()
-        return True
-
-app = App()
-app.MainLoop()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/fourier_demo_wx.py b/examples/user_interfaces/fourier_demo_wx.py deleted file mode 100644 index d07b07bb388..00000000000 --- a/examples/user_interfaces/fourier_demo_wx.py +++ /dev/null @@ -1,245 +0,0 @@ -import numpy as np - -# matplotlib requires wxPython 2.8+ -# set the wxPython version in lib\site-packages\wx.pth file -# or if you have wxversion installed un-comment the lines below -#import wxversion -#wxversion.ensureMinimal('2.8') - -import wx -import matplotlib -matplotlib.interactive(False) -matplotlib.use('WXAgg') -from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg -from matplotlib.figure import Figure -from matplotlib.pyplot import gcf, setp - - -class Knob(object): - """ - Knob - simple class with a "setKnob" method. - A Knob instance is attached to a Param instance, e.g., param.attach(knob) - Base class is for documentation purposes. - """ - - def setKnob(self, value): - pass - - -class Param(object): - """ - The idea of the "Param" class is that some parameter in the GUI may have - several knobs that both control it and reflect the parameter's state, e.g. - a slider, text, and dragging can all change the value of the frequency in - the waveform of this example. - The class allows a cleaner way to update/"feedback" to the other knobs when - one is being changed. Also, this class handles min/max constraints for all - the knobs. - Idea - knob list - in "set" method, knob object is passed as well - - the other knobs in the knob list have a "set" method which gets - called for the others. - """ - - def __init__(self, initialValue=None, minimum=0., maximum=1.): - self.minimum = minimum - self.maximum = maximum - if initialValue != self.constrain(initialValue): - raise ValueError('illegal initial value') - self.value = initialValue - self.knobs = [] - - def attach(self, knob): - self.knobs += [knob] - - def set(self, value, knob=None): - self.value = value - self.value = self.constrain(value) - for feedbackKnob in self.knobs: - if feedbackKnob != knob: - feedbackKnob.setKnob(self.value) - return self.value - - def constrain(self, value): - if value <= self.minimum: - value = self.minimum - if value >= self.maximum: - value = self.maximum - return value - - -class SliderGroup(Knob): - def __init__(self, parent, label, param): - self.sliderLabel = wx.StaticText(parent, label=label) - self.sliderText = wx.TextCtrl(parent, -1, style=wx.TE_PROCESS_ENTER) - self.slider = wx.Slider(parent, -1) - # self.slider.SetMax(param.maximum*1000) - self.slider.SetRange(0, param.maximum * 1000) - self.setKnob(param.value) - - sizer = wx.BoxSizer(wx.HORIZONTAL) - sizer.Add(self.sliderLabel, 0, - wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, - border=2) - sizer.Add(self.sliderText, 0, - wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, - border=2) - sizer.Add(self.slider, 1, wx.EXPAND) - self.sizer = sizer - - self.slider.Bind(wx.EVT_SLIDER, self.sliderHandler) - self.sliderText.Bind(wx.EVT_TEXT_ENTER, self.sliderTextHandler) - - self.param = param - self.param.attach(self) - - def sliderHandler(self, evt): - value = evt.GetInt() / 1000. - self.param.set(value) - - def sliderTextHandler(self, evt): - value = float(self.sliderText.GetValue()) - self.param.set(value) - - def setKnob(self, value): - self.sliderText.SetValue('%g' % value) - self.slider.SetValue(value * 1000) - - -class FourierDemoFrame(wx.Frame): - def __init__(self, *args, **kwargs): - wx.Frame.__init__(self, *args, **kwargs) - - self.fourierDemoWindow = FourierDemoWindow(self) - self.frequencySliderGroup = SliderGroup( - self, - label='Frequency f0:', - param=self.fourierDemoWindow.f0) - self.amplitudeSliderGroup = SliderGroup(self, label=' Amplitude a:', - param=self.fourierDemoWindow.A) - - sizer = wx.BoxSizer(wx.VERTICAL) - sizer.Add(self.fourierDemoWindow, 1, wx.EXPAND) - sizer.Add(self.frequencySliderGroup.sizer, 0, - wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=5) - sizer.Add(self.amplitudeSliderGroup.sizer, 0, - wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=5) - self.SetSizer(sizer) - - -class FourierDemoWindow(wx.Window, Knob): - def __init__(self, *args, **kwargs): - wx.Window.__init__(self, *args, **kwargs) - self.lines = [] - self.figure = Figure() - self.canvas = FigureCanvasWxAgg(self, -1, self.figure) - self.canvas.callbacks.connect('button_press_event', self.mouseDown) - self.canvas.callbacks.connect('motion_notify_event', self.mouseMotion) - self.canvas.callbacks.connect('button_release_event', self.mouseUp) - self.state = '' - self.mouseInfo = (None, None, None, None) - self.f0 = Param(2., minimum=0., maximum=6.) - self.A = Param(1., minimum=0.01, maximum=2.) - self.draw() - - # Not sure I like having two params attached to the same Knob, - # but that is what we have here... it works but feels kludgy - - # although maybe it's not too bad since the knob changes both params - # at the same time (both f0 and A are affected during a drag) - self.f0.attach(self) - self.A.attach(self) - self.Bind(wx.EVT_SIZE, self.sizeHandler) - - self.Bind(wx.EVT_PAINT, self.OnPaint) - - def OnPaint(self, event): - self.canvas.draw() - event.Skip() - - def sizeHandler(self, *args, **kwargs): - self.canvas.SetSize(self.GetSize()) - - def mouseDown(self, evt): - if self.lines[0] in self.figure.hitlist(evt): - self.state = 'frequency' - elif self.lines[1] in self.figure.hitlist(evt): - self.state = 'time' - else: - self.state = '' - self.mouseInfo = (evt.xdata, evt.ydata, - max(self.f0.value, .1), - self.A.value) - - def mouseMotion(self, evt): - if self.state == '': - return - x, y = evt.xdata, evt.ydata - if x is None: # outside the axes - return - x0, y0, f0Init, AInit = self.mouseInfo - self.A.set(AInit + (AInit * (y - y0) / y0), self) - if self.state == 'frequency': - self.f0.set(f0Init + (f0Init * (x - x0) / x0)) - elif self.state == 'time': - if (x - x0) / x0 != -1.: - self.f0.set(1. / (1. / f0Init + (1. / f0Init * (x - x0) / x0))) - - def mouseUp(self, evt): - self.state = '' - - def draw(self): - if not hasattr(self, 'subplot1'): - self.subplot1 = self.figure.add_subplot(211) - self.subplot2 = self.figure.add_subplot(212) - x1, y1, x2, y2 = self.compute(self.f0.value, self.A.value) - color = (1., 0., 0.) - self.lines += self.subplot1.plot(x1, y1, color=color, linewidth=2) - self.lines += self.subplot2.plot(x2, y2, color=color, linewidth=2) - # Set some plot attributes - self.subplot1.set_title( - "Click and drag waveforms to change frequency and amplitude", - fontsize=12) - self.subplot1.set_ylabel("Frequency Domain Waveform X(f)", fontsize=8) - self.subplot1.set_xlabel("frequency f", fontsize=8) - self.subplot2.set_ylabel("Time Domain Waveform x(t)", fontsize=8) - self.subplot2.set_xlabel("time t", fontsize=8) - self.subplot1.set_xlim([-6, 6]) - self.subplot1.set_ylim([0, 1]) - self.subplot2.set_xlim([-2, 2]) - self.subplot2.set_ylim([-2, 2]) - self.subplot1.text(0.05, .95, - r'$X(f) = \mathcal{F}\{x(t)\}$', - verticalalignment='top', - transform=self.subplot1.transAxes) - self.subplot2.text(0.05, .95, - r'$x(t) = a \cdot \cos(2\pi f_0 t) e^{-\pi t^2}$', - verticalalignment='top', - transform=self.subplot2.transAxes) - - def compute(self, f0, A): - f = np.arange(-6., 6., 0.02) - t = np.arange(-2., 2., 0.01) - x = A * np.cos(2 * np.pi * f0 * t) * np.exp(-np.pi * t ** 2) - X = A / 2 * \ - (np.exp(-np.pi * (f - f0) ** 2) + np.exp(-np.pi * (f + f0) ** 2)) - return f, X, t, x - - def repaint(self): - self.canvas.draw() - - def setKnob(self, value): - # Note, we ignore value arg here and just go by state of the params - x1, y1, x2, y2 = self.compute(self.f0.value, self.A.value) - setp(self.lines[0], xdata=x1, ydata=y1) - setp(self.lines[1], xdata=x2, ydata=y2) - self.repaint() - - -class App(wx.App): - def OnInit(self): - self.frame1 = FourierDemoFrame(parent=None, title="Fourier Demo", - size=(640, 480)) - self.frame1.Show() - return True - -app = App() -app.MainLoop() diff --git a/examples/user_interfaces/gtk_spreadsheet.html b/examples/user_interfaces/gtk_spreadsheet.html deleted file mode 100644 index 34c4b8a821a..00000000000 --- a/examples/user_interfaces/gtk_spreadsheet.html +++ /dev/null @@ -1,409 +0,0 @@ - - - - - - - - user_interfaces example code: gtk_spreadsheet.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: gtk_spreadsheet.py

-

[source code]

-
"""
-Example of embedding matplotlib in an application and interacting with
-a treeview to store data.  Double click on an entry to update plot
-data
-
-"""
-import pygtk
-pygtk.require('2.0')
-import gtk
-from gtk import gdk
-
-import matplotlib
-matplotlib.use('GTKAgg')  # or 'GTK'
-from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
-
-from numpy.random import random
-from matplotlib.figure import Figure
-
-
-class DataManager(gtk.Window):
-    numRows, numCols = 20, 10
-
-    data = random((numRows, numCols))
-
-    def __init__(self):
-        gtk.Window.__init__(self)
-        self.set_default_size(600, 600)
-        self.connect('destroy', lambda win: gtk.main_quit())
-
-        self.set_title('GtkListStore demo')
-        self.set_border_width(8)
-
-        vbox = gtk.VBox(False, 8)
-        self.add(vbox)
-
-        label = gtk.Label('Double click a row to plot the data')
-
-        vbox.pack_start(label, False, False)
-
-        sw = gtk.ScrolledWindow()
-        sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
-        sw.set_policy(gtk.POLICY_NEVER,
-                      gtk.POLICY_AUTOMATIC)
-        vbox.pack_start(sw, True, True)
-
-        model = self.create_model()
-
-        self.treeview = gtk.TreeView(model)
-        self.treeview.set_rules_hint(True)
-
-        # matplotlib stuff
-        fig = Figure(figsize=(6, 4))
-
-        self.canvas = FigureCanvas(fig)  # a gtk.DrawingArea
-        vbox.pack_start(self.canvas, True, True)
-        ax = fig.add_subplot(111)
-        self.line, = ax.plot(self.data[0, :], 'go')  # plot the first row
-
-        self.treeview.connect('row-activated', self.plot_row)
-        sw.add(self.treeview)
-
-        self.add_columns()
-
-        self.add_events(gdk.BUTTON_PRESS_MASK |
-                        gdk.KEY_PRESS_MASK |
-                        gdk.KEY_RELEASE_MASK)
-
-    def plot_row(self, treeview, path, view_column):
-        ind, = path  # get the index into data
-        points = self.data[ind, :]
-        self.line.set_ydata(points)
-        self.canvas.draw()
-
-    def add_columns(self):
-        for i in range(self.numCols):
-            column = gtk.TreeViewColumn('%d' % i, gtk.CellRendererText(), text=i)
-            self.treeview.append_column(column)
-
-    def create_model(self):
-        types = [float]*self.numCols
-        store = gtk.ListStore(*types)
-
-        for row in self.data:
-            store.append(row)
-        return store
-
-
-manager = DataManager()
-manager.show_all()
-gtk.main()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/gtk_spreadsheet.py b/examples/user_interfaces/gtk_spreadsheet.py deleted file mode 100644 index 85798b0ca69..00000000000 --- a/examples/user_interfaces/gtk_spreadsheet.py +++ /dev/null @@ -1,90 +0,0 @@ -""" -Example of embedding matplotlib in an application and interacting with -a treeview to store data. Double click on an entry to update plot -data - -""" -import pygtk -pygtk.require('2.0') -import gtk -from gtk import gdk - -import matplotlib -matplotlib.use('GTKAgg') # or 'GTK' -from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas - -from numpy.random import random -from matplotlib.figure import Figure - - -class DataManager(gtk.Window): - numRows, numCols = 20, 10 - - data = random((numRows, numCols)) - - def __init__(self): - gtk.Window.__init__(self) - self.set_default_size(600, 600) - self.connect('destroy', lambda win: gtk.main_quit()) - - self.set_title('GtkListStore demo') - self.set_border_width(8) - - vbox = gtk.VBox(False, 8) - self.add(vbox) - - label = gtk.Label('Double click a row to plot the data') - - vbox.pack_start(label, False, False) - - sw = gtk.ScrolledWindow() - sw.set_shadow_type(gtk.SHADOW_ETCHED_IN) - sw.set_policy(gtk.POLICY_NEVER, - gtk.POLICY_AUTOMATIC) - vbox.pack_start(sw, True, True) - - model = self.create_model() - - self.treeview = gtk.TreeView(model) - self.treeview.set_rules_hint(True) - - # matplotlib stuff - fig = Figure(figsize=(6, 4)) - - self.canvas = FigureCanvas(fig) # a gtk.DrawingArea - vbox.pack_start(self.canvas, True, True) - ax = fig.add_subplot(111) - self.line, = ax.plot(self.data[0, :], 'go') # plot the first row - - self.treeview.connect('row-activated', self.plot_row) - sw.add(self.treeview) - - self.add_columns() - - self.add_events(gdk.BUTTON_PRESS_MASK | - gdk.KEY_PRESS_MASK | - gdk.KEY_RELEASE_MASK) - - def plot_row(self, treeview, path, view_column): - ind, = path # get the index into data - points = self.data[ind, :] - self.line.set_ydata(points) - self.canvas.draw() - - def add_columns(self): - for i in range(self.numCols): - column = gtk.TreeViewColumn('%d' % i, gtk.CellRendererText(), text=i) - self.treeview.append_column(column) - - def create_model(self): - types = [float]*self.numCols - store = gtk.ListStore(*types) - - for row in self.data: - store.append(row) - return store - - -manager = DataManager() -manager.show_all() -gtk.main() diff --git a/examples/user_interfaces/histogram_demo_canvasagg.html b/examples/user_interfaces/histogram_demo_canvasagg.html deleted file mode 100644 index 517996a5df1..00000000000 --- a/examples/user_interfaces/histogram_demo_canvasagg.html +++ /dev/null @@ -1,377 +0,0 @@ - - - - - - - - user_interfaces example code: histogram_demo_canvasagg.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: histogram_demo_canvasagg.py

-

[source code]

-
"""
-This is an example that shows you how to work directly with the agg
-figure canvas to create a figure using the pythonic API.
-
-In this example, the contents of the agg canvas are extracted to a
-string, which can in turn be passed off to PIL or put in a numeric
-array
-
-
-"""
-from matplotlib.backends.backend_agg import FigureCanvasAgg
-from matplotlib.figure import Figure
-from matplotlib.mlab import normpdf
-from numpy.random import randn
-import numpy
-
-fig = Figure(figsize=(5, 4), dpi=100)
-ax = fig.add_subplot(111)
-
-canvas = FigureCanvasAgg(fig)
-
-mu, sigma = 100, 15
-x = mu + sigma*randn(10000)
-
-# the histogram of the data
-n, bins, patches = ax.hist(x, 50, normed=1)
-
-# add a 'best fit' line
-y = normpdf(bins, mu, sigma)
-line, = ax.plot(bins, y, 'r--')
-line.set_linewidth(1)
-
-ax.set_xlabel('Smarts')
-ax.set_ylabel('Probability')
-ax.set_title(r'$\mathrm{Histogram of IQ: }\mu=100, \sigma=15$')
-
-ax.set_xlim((40, 160))
-ax.set_ylim((0, 0.03))
-
-canvas.draw()
-
-s = canvas.tostring_rgb()  # save this and convert to bitmap as needed
-
-# get the figure dimensions for creating bitmaps or numpy arrays,
-# etc.
-l, b, w, h = fig.bbox.bounds
-w, h = int(w), int(h)
-
-if 0:
-    # convert to a numpy array
-    X = numpy.fromstring(s, numpy.uint8)
-    X.shape = h, w, 3
-
-if 0:
-    # pass off to PIL
-    from PIL import Image
-    im = Image.fromstring("RGB", (w, h), s)
-    im.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/histogram_demo_canvasagg.py b/examples/user_interfaces/histogram_demo_canvasagg.py deleted file mode 100644 index 11a13ba1218..00000000000 --- a/examples/user_interfaces/histogram_demo_canvasagg.py +++ /dev/null @@ -1,58 +0,0 @@ -""" -This is an example that shows you how to work directly with the agg -figure canvas to create a figure using the pythonic API. - -In this example, the contents of the agg canvas are extracted to a -string, which can in turn be passed off to PIL or put in a numeric -array - - -""" -from matplotlib.backends.backend_agg import FigureCanvasAgg -from matplotlib.figure import Figure -from matplotlib.mlab import normpdf -from numpy.random import randn -import numpy - -fig = Figure(figsize=(5, 4), dpi=100) -ax = fig.add_subplot(111) - -canvas = FigureCanvasAgg(fig) - -mu, sigma = 100, 15 -x = mu + sigma*randn(10000) - -# the histogram of the data -n, bins, patches = ax.hist(x, 50, normed=1) - -# add a 'best fit' line -y = normpdf(bins, mu, sigma) -line, = ax.plot(bins, y, 'r--') -line.set_linewidth(1) - -ax.set_xlabel('Smarts') -ax.set_ylabel('Probability') -ax.set_title(r'$\mathrm{Histogram of IQ: }\mu=100, \sigma=15$') - -ax.set_xlim((40, 160)) -ax.set_ylim((0, 0.03)) - -canvas.draw() - -s = canvas.tostring_rgb() # save this and convert to bitmap as needed - -# get the figure dimensions for creating bitmaps or numpy arrays, -# etc. -l, b, w, h = fig.bbox.bounds -w, h = int(w), int(h) - -if 0: - # convert to a numpy array - X = numpy.fromstring(s, numpy.uint8) - X.shape = h, w, 3 - -if 0: - # pass off to PIL - from PIL import Image - im = Image.fromstring("RGB", (w, h), s) - im.show() diff --git a/examples/user_interfaces/index.html b/examples/user_interfaces/index.html deleted file mode 100644 index 748612abcbb..00000000000 --- a/examples/user_interfaces/index.html +++ /dev/null @@ -1,357 +0,0 @@ - - - - - - - - user_interfaces Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- - - - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/interactive.html b/examples/user_interfaces/interactive.html deleted file mode 100644 index 17c07cc7b79..00000000000 --- a/examples/user_interfaces/interactive.html +++ /dev/null @@ -1,562 +0,0 @@ - - - - - - - - user_interfaces example code: interactive.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: interactive.py

-

[source code]

-
"""Multithreaded interactive interpreter with GTK and Matplotlib support.
-
-WARNING:
-As of 2010/06/25, this is not working, at least on Linux.
-I have disabled it as a runnable script. - EF
-
-
-Usage:
-
-  pyint-gtk.py -> starts shell with gtk thread running separately
-
-  pyint-gtk.py -pylab [filename] -> initializes matplotlib, optionally running
-  the named file.  The shell starts after the file is executed.
-
-Threading code taken from:
-http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by Brian
-McErlean and John Finlay.
-
-Matplotlib support taken from interactive.py in the matplotlib distribution.
-
-Also borrows liberally from code.py in the Python standard library."""
-
-from __future__ import print_function
-
-__author__ = "Fernando Perez <Fernando.Perez@colorado.edu>"
-
-import sys
-import code
-import threading
-
-import gobject
-import gtk
-
-try:
-    import readline
-except ImportError:
-    has_readline = False
-else:
-    has_readline = True
-
-
-class MTConsole(code.InteractiveConsole):
-    """Simple multi-threaded shell"""
-
-    def __init__(self, on_kill=None, *args, **kw):
-        code.InteractiveConsole.__init__(self, *args, **kw)
-        self.code_to_run = None
-        self.ready = threading.Condition()
-        self._kill = False
-        if on_kill is None:
-            on_kill = []
-        # Check that all things to kill are callable:
-        for _ in on_kill:
-            if not callable(_):
-                raise TypeError('on_kill must be a list of callables')
-        self.on_kill = on_kill
-        # Set up tab-completer
-        if has_readline:
-            import rlcompleter
-            try:  # this form only works with python 2.3
-                self.completer = rlcompleter.Completer(self.locals)
-            except:  # simpler for py2.2
-                self.completer = rlcompleter.Completer()
-
-            readline.set_completer(self.completer.complete)
-            # Use tab for completions
-            readline.parse_and_bind('tab: complete')
-            # This forces readline to automatically print the above list when tab
-            # completion is set to 'complete'.
-            readline.parse_and_bind('set show-all-if-ambiguous on')
-            # Bindings for incremental searches in the history. These searches
-            # use the string typed so far on the command line and search
-            # anything in the previous input history containing them.
-            readline.parse_and_bind('"\C-r": reverse-search-history')
-            readline.parse_and_bind('"\C-s": forward-search-history')
-
-    def runsource(self, source, filename="<input>", symbol="single"):
-        """Compile and run some source in the interpreter.
-
-        Arguments are as for compile_command().
-
-        One several things can happen:
-
-        1) The input is incorrect; compile_command() raised an
-        exception (SyntaxError or OverflowError).  A syntax traceback
-        will be printed by calling the showsyntaxerror() method.
-
-        2) The input is incomplete, and more input is required;
-        compile_command() returned None.  Nothing happens.
-
-        3) The input is complete; compile_command() returned a code
-        object.  The code is executed by calling self.runcode() (which
-        also handles run-time exceptions, except for SystemExit).
-
-        The return value is True in case 2, False in the other cases (unless
-        an exception is raised).  The return value can be used to
-        decide whether to use sys.ps1 or sys.ps2 to prompt the next
-        line.
-        """
-        try:
-            code = self.compile(source, filename, symbol)
-        except (OverflowError, SyntaxError, ValueError):
-            # Case 1
-            self.showsyntaxerror(filename)
-            return False
-
-        if code is None:
-            # Case 2
-            return True
-
-        # Case 3
-        # Store code in self, so the execution thread can handle it
-        self.ready.acquire()
-        self.code_to_run = code
-        self.ready.wait()  # Wait until processed in timeout interval
-        self.ready.release()
-
-        return False
-
-    def runcode(self):
-        """Execute a code object.
-
-        When an exception occurs, self.showtraceback() is called to display a
-        traceback."""
-
-        self.ready.acquire()
-        if self._kill:
-            print('Closing threads...')
-            sys.stdout.flush()
-            for tokill in self.on_kill:
-                tokill()
-            print('Done.')
-
-        if self.code_to_run is not None:
-            self.ready.notify()
-            code.InteractiveConsole.runcode(self, self.code_to_run)
-
-        self.code_to_run = None
-        self.ready.release()
-        return True
-
-    def kill(self):
-        """Kill the thread, returning when it has been shut down."""
-        self.ready.acquire()
-        self._kill = True
-        self.ready.release()
-
-
-class GTKInterpreter(threading.Thread):
-    """Run gtk.main in the main thread and a python interpreter in a
-    separate thread.
-    Python commands can be passed to the thread where they will be executed.
-    This is implemented by periodically checking for passed code using a
-    GTK timeout callback.
-    """
-    TIMEOUT = 100  # Millisecond interval between timeouts.
-
-    def __init__(self, banner=None):
-        threading.Thread.__init__(self)
-        self.banner = banner
-        self.shell = MTConsole(on_kill=[gtk.main_quit])
-
-    def run(self):
-        self.pre_interact()
-        self.shell.interact(self.banner)
-        self.shell.kill()
-
-    def mainloop(self):
-        self.start()
-        gobject.timeout_add(self.TIMEOUT, self.shell.runcode)
-        try:
-            if gtk.gtk_version[0] >= 2:
-                gtk.gdk.threads_init()
-        except AttributeError:
-            pass
-        gtk.main()
-        self.join()
-
-    def pre_interact(self):
-        """This method should be overridden by subclasses.
-
-        It gets called right before interact(), but after the thread starts.
-        Typically used to push initialization code into the interpreter"""
-
-        pass
-
-
-class MatplotLibInterpreter(GTKInterpreter):
-    """Threaded interpreter with matplotlib support.
-
-    Note that this explicitly sets GTKAgg as the backend, since it has
-    specific GTK hooks in it."""
-
-    def __init__(self, banner=None):
-        banner = """\nWelcome to matplotlib, a MATLAB-like python environment.
-    help(matlab)   -> help on matlab compatible commands from matplotlib.
-    help(plotting) -> help on plotting commands.
-    """
-        GTKInterpreter.__init__(self, banner)
-
-    def pre_interact(self):
-        """Initialize matplotlib before user interaction begins"""
-
-        push = self.shell.push
-        # Code to execute in user's namespace
-        lines = ["import matplotlib",
-                 "matplotlib.use('GTKAgg')",
-                 "matplotlib.interactive(1)",
-                 "import matplotlib.pylab as pylab",
-                 "from matplotlib.pylab import *\n"]
-
-        map(push, lines)
-
-        # Execute file if given.
-        if len(sys.argv) > 1:
-            import matplotlib
-            matplotlib.interactive(0)  # turn off interaction
-            fname = sys.argv[1]
-            try:
-                inFile = file(fname, 'r')
-            except IOError:
-                print('*** ERROR *** Could not read file <%s>' % fname)
-            else:
-                print('*** Executing file <%s>:' % fname)
-                for line in inFile:
-                    if line.lstrip().find('show()') == 0:
-                        continue
-                    print('>>', line)
-                    push(line)
-                inFile.close()
-            matplotlib.interactive(1)   # turn on interaction
-
-if __name__ == '__main__':
-    print("This demo is not presently functional, so running")
-    print("it as a script has been disabled.")
-    sys.exit()
-    # Quick sys.argv hack to extract the option and leave filenames in sys.argv.
-    # For real option handling, use optparse or getopt.
-    if len(sys.argv) > 1 and sys.argv[1] == '-pylab':
-        sys.argv = [sys.argv[0]] + sys.argv[2:]
-        MatplotLibInterpreter().mainloop()
-    else:
-        GTKInterpreter().mainloop()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/interactive.py b/examples/user_interfaces/interactive.py deleted file mode 100644 index adc54264d76..00000000000 --- a/examples/user_interfaces/interactive.py +++ /dev/null @@ -1,243 +0,0 @@ -"""Multithreaded interactive interpreter with GTK and Matplotlib support. - -WARNING: -As of 2010/06/25, this is not working, at least on Linux. -I have disabled it as a runnable script. - EF - - -Usage: - - pyint-gtk.py -> starts shell with gtk thread running separately - - pyint-gtk.py -pylab [filename] -> initializes matplotlib, optionally running - the named file. The shell starts after the file is executed. - -Threading code taken from: -http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by Brian -McErlean and John Finlay. - -Matplotlib support taken from interactive.py in the matplotlib distribution. - -Also borrows liberally from code.py in the Python standard library.""" - -from __future__ import print_function - -__author__ = "Fernando Perez " - -import sys -import code -import threading - -import gobject -import gtk - -try: - import readline -except ImportError: - has_readline = False -else: - has_readline = True - - -class MTConsole(code.InteractiveConsole): - """Simple multi-threaded shell""" - - def __init__(self, on_kill=None, *args, **kw): - code.InteractiveConsole.__init__(self, *args, **kw) - self.code_to_run = None - self.ready = threading.Condition() - self._kill = False - if on_kill is None: - on_kill = [] - # Check that all things to kill are callable: - for _ in on_kill: - if not callable(_): - raise TypeError('on_kill must be a list of callables') - self.on_kill = on_kill - # Set up tab-completer - if has_readline: - import rlcompleter - try: # this form only works with python 2.3 - self.completer = rlcompleter.Completer(self.locals) - except: # simpler for py2.2 - self.completer = rlcompleter.Completer() - - readline.set_completer(self.completer.complete) - # Use tab for completions - readline.parse_and_bind('tab: complete') - # This forces readline to automatically print the above list when tab - # completion is set to 'complete'. - readline.parse_and_bind('set show-all-if-ambiguous on') - # Bindings for incremental searches in the history. These searches - # use the string typed so far on the command line and search - # anything in the previous input history containing them. - readline.parse_and_bind('"\C-r": reverse-search-history') - readline.parse_and_bind('"\C-s": forward-search-history') - - def runsource(self, source, filename="", symbol="single"): - """Compile and run some source in the interpreter. - - Arguments are as for compile_command(). - - One several things can happen: - - 1) The input is incorrect; compile_command() raised an - exception (SyntaxError or OverflowError). A syntax traceback - will be printed by calling the showsyntaxerror() method. - - 2) The input is incomplete, and more input is required; - compile_command() returned None. Nothing happens. - - 3) The input is complete; compile_command() returned a code - object. The code is executed by calling self.runcode() (which - also handles run-time exceptions, except for SystemExit). - - The return value is True in case 2, False in the other cases (unless - an exception is raised). The return value can be used to - decide whether to use sys.ps1 or sys.ps2 to prompt the next - line. - """ - try: - code = self.compile(source, filename, symbol) - except (OverflowError, SyntaxError, ValueError): - # Case 1 - self.showsyntaxerror(filename) - return False - - if code is None: - # Case 2 - return True - - # Case 3 - # Store code in self, so the execution thread can handle it - self.ready.acquire() - self.code_to_run = code - self.ready.wait() # Wait until processed in timeout interval - self.ready.release() - - return False - - def runcode(self): - """Execute a code object. - - When an exception occurs, self.showtraceback() is called to display a - traceback.""" - - self.ready.acquire() - if self._kill: - print('Closing threads...') - sys.stdout.flush() - for tokill in self.on_kill: - tokill() - print('Done.') - - if self.code_to_run is not None: - self.ready.notify() - code.InteractiveConsole.runcode(self, self.code_to_run) - - self.code_to_run = None - self.ready.release() - return True - - def kill(self): - """Kill the thread, returning when it has been shut down.""" - self.ready.acquire() - self._kill = True - self.ready.release() - - -class GTKInterpreter(threading.Thread): - """Run gtk.main in the main thread and a python interpreter in a - separate thread. - Python commands can be passed to the thread where they will be executed. - This is implemented by periodically checking for passed code using a - GTK timeout callback. - """ - TIMEOUT = 100 # Millisecond interval between timeouts. - - def __init__(self, banner=None): - threading.Thread.__init__(self) - self.banner = banner - self.shell = MTConsole(on_kill=[gtk.main_quit]) - - def run(self): - self.pre_interact() - self.shell.interact(self.banner) - self.shell.kill() - - def mainloop(self): - self.start() - gobject.timeout_add(self.TIMEOUT, self.shell.runcode) - try: - if gtk.gtk_version[0] >= 2: - gtk.gdk.threads_init() - except AttributeError: - pass - gtk.main() - self.join() - - def pre_interact(self): - """This method should be overridden by subclasses. - - It gets called right before interact(), but after the thread starts. - Typically used to push initialization code into the interpreter""" - - pass - - -class MatplotLibInterpreter(GTKInterpreter): - """Threaded interpreter with matplotlib support. - - Note that this explicitly sets GTKAgg as the backend, since it has - specific GTK hooks in it.""" - - def __init__(self, banner=None): - banner = """\nWelcome to matplotlib, a MATLAB-like python environment. - help(matlab) -> help on matlab compatible commands from matplotlib. - help(plotting) -> help on plotting commands. - """ - GTKInterpreter.__init__(self, banner) - - def pre_interact(self): - """Initialize matplotlib before user interaction begins""" - - push = self.shell.push - # Code to execute in user's namespace - lines = ["import matplotlib", - "matplotlib.use('GTKAgg')", - "matplotlib.interactive(1)", - "import matplotlib.pylab as pylab", - "from matplotlib.pylab import *\n"] - - map(push, lines) - - # Execute file if given. - if len(sys.argv) > 1: - import matplotlib - matplotlib.interactive(0) # turn off interaction - fname = sys.argv[1] - try: - inFile = file(fname, 'r') - except IOError: - print('*** ERROR *** Could not read file <%s>' % fname) - else: - print('*** Executing file <%s>:' % fname) - for line in inFile: - if line.lstrip().find('show()') == 0: - continue - print('>>', line) - push(line) - inFile.close() - matplotlib.interactive(1) # turn on interaction - -if __name__ == '__main__': - print("This demo is not presently functional, so running") - print("it as a script has been disabled.") - sys.exit() - # Quick sys.argv hack to extract the option and leave filenames in sys.argv. - # For real option handling, use optparse or getopt. - if len(sys.argv) > 1 and sys.argv[1] == '-pylab': - sys.argv = [sys.argv[0]] + sys.argv[2:] - MatplotLibInterpreter().mainloop() - else: - GTKInterpreter().mainloop() diff --git a/examples/user_interfaces/interactive2.html b/examples/user_interfaces/interactive2.html deleted file mode 100644 index a326b618764..00000000000 --- a/examples/user_interfaces/interactive2.html +++ /dev/null @@ -1,700 +0,0 @@ - - - - - - - - user_interfaces example code: interactive2.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: interactive2.py

-

[source code]

-
from __future__ import print_function
-
-#  GTK Interactive Console
-#  (C) 2003, Jon Anderson
-#  See www.python.org/2.2/license.html for
-#  license details.
-#
-import gtk
-import gtk.gdk
-
-import code
-import os
-import sys
-import pango
-
-import __builtin__
-import __main__
-
-
-banner = """GTK Interactive Python Console
-Thanks to Jon Anderson
-%s
-""" % sys.version
-
-banner += """
-
-Welcome to matplotlib.
-
-    help(matplotlib) -- some general information about matplotlib
-    help(plotting) -- shows a list of plot specific commands
-
-"""
-
-
-class Completer(object):
-    """
-    Taken from rlcompleter, with readline references stripped, and a local dictionary to use.
-    """
-
-    def __init__(self, locals):
-        self.locals = locals
-
-    def complete(self, text, state):
-        """Return the next possible completion for 'text'.
-        This is called successively with state == 0, 1, 2, ... until it
-        returns None.  The completion should begin with 'text'.
-
-        """
-        if state == 0:
-            if "." in text:
-                self.matches = self.attr_matches(text)
-            else:
-                self.matches = self.global_matches(text)
-        try:
-            return self.matches[state]
-        except IndexError:
-            return None
-
-    def global_matches(self, text):
-        """Compute matches when text is a simple name.
-
-        Return a list of all keywords, built-in functions and names
-        currently defines in __main__ that match.
-
-        """
-        import keyword
-        matches = []
-        n = len(text)
-        for list in [keyword.kwlist, __builtin__.__dict__.keys(), __main__.__dict__.keys(), self.locals.keys()]:
-            for word in list:
-                if word[:n] == text and word != "__builtins__":
-                    matches.append(word)
-        return matches
-
-    def attr_matches(self, text):
-        """Compute matches when text contains a dot.
-
-        Assuming the text is of the form NAME.NAME....[NAME], and is
-        evaluatable in the globals of __main__, it will be evaluated
-        and its attributes (as revealed by dir()) are used as possible
-        completions.  (For class instances, class members are are also
-        considered.)
-
-        WARNING: this can still invoke arbitrary C code, if an object
-        with a __getattr__ hook is evaluated.
-
-        """
-        import re
-        m = re.match(r"(\w+(\.\w+)*)\.(\w*)", text)
-        if not m:
-            return
-        expr, attr = m.group(1, 3)
-        object = eval(expr, __main__.__dict__, self.locals)
-        words = dir(object)
-        if hasattr(object, '__class__'):
-            words.append('__class__')
-            words = words + get_class_members(object.__class__)
-        matches = []
-        n = len(attr)
-        for word in words:
-            if word[:n] == attr and word != "__builtins__":
-                matches.append("%s.%s" % (expr, word))
-        return matches
-
-
-def get_class_members(klass):
-    ret = dir(klass)
-    if hasattr(klass, '__bases__'):
-        for base in klass.__bases__:
-            ret = ret + get_class_members(base)
-    return ret
-
-
-class OutputStream(object):
-    """
-    A Multiplexing output stream.
-    It can replace another stream, and tee output to the original stream and too
-    a GTK textview.
-    """
-
-    def __init__(self, view, old_out, style):
-        self.view = view
-        self.buffer = view.get_buffer()
-        self.mark = self.buffer.create_mark("End", self.buffer.get_end_iter(), False)
-        self.out = old_out
-        self.style = style
-        self.tee = 1
-
-    def write(self, text):
-        if self.tee:
-            self.out.write(text)
-
-        end = self.buffer.get_end_iter()
-
-        if self.view is not None:
-            self.view.scroll_to_mark(self.mark, 0, True, 1, 1)
-
-        self.buffer.insert_with_tags(end, text, self.style)
-
-
-class GTKInterpreterConsole(gtk.ScrolledWindow):
-    """
-    An InteractiveConsole for GTK. It's an actual widget,
-    so it can be dropped in just about anywhere.
-    """
-
-    def __init__(self):
-        gtk.ScrolledWindow.__init__(self)
-        self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
-
-        self.text = gtk.TextView()
-        self.text.set_wrap_mode(True)
-
-        self.interpreter = code.InteractiveInterpreter()
-
-        self.completer = Completer(self.interpreter.locals)
-        self.buffer = []
-        self.history = []
-        self.banner = banner
-        self.ps1 = ">>> "
-        self.ps2 = "... "
-
-        self.text.add_events(gtk.gdk.KEY_PRESS_MASK)
-        self.text.connect("key_press_event", self.key_pressed)
-
-        self.current_history = -1
-
-        self.mark = self.text.get_buffer().create_mark("End", self.text.get_buffer().get_end_iter(), False)
-
-        # setup colors
-        self.style_banner = gtk.TextTag("banner")
-        self.style_banner.set_property("foreground", "saddle brown")
-
-        self.style_ps1 = gtk.TextTag("ps1")
-        self.style_ps1.set_property("foreground", "DarkOrchid4")
-        self.style_ps1.set_property("editable", False)
-        self.style_ps1.set_property("font", "courier")
-
-        self.style_ps2 = gtk.TextTag("ps2")
-        self.style_ps2.set_property("foreground", "DarkOliveGreen")
-        self.style_ps2.set_property("editable", False)
-        self.style_ps2.set_property("font", "courier")
-
-        self.style_out = gtk.TextTag("stdout")
-        self.style_out.set_property("foreground", "midnight blue")
-        self.style_err = gtk.TextTag("stderr")
-        self.style_err.set_property("style", pango.STYLE_ITALIC)
-        self.style_err.set_property("foreground", "red")
-
-        self.text.get_buffer().get_tag_table().add(self.style_banner)
-        self.text.get_buffer().get_tag_table().add(self.style_ps1)
-        self.text.get_buffer().get_tag_table().add(self.style_ps2)
-        self.text.get_buffer().get_tag_table().add(self.style_out)
-        self.text.get_buffer().get_tag_table().add(self.style_err)
-
-        self.stdout = OutputStream(self.text, sys.stdout, self.style_out)
-        self.stderr = OutputStream(self.text, sys.stderr, self.style_err)
-
-        sys.stderr = self.stderr
-        sys.stdout = self.stdout
-
-        self.current_prompt = None
-
-        self.write_line(self.banner, self.style_banner)
-        self.prompt_ps1()
-
-        self.add(self.text)
-        self.text.show()
-
-    def reset_history(self):
-        self.history = []
-
-    def reset_buffer(self):
-        self.buffer = []
-
-    def prompt_ps1(self):
-        self.current_prompt = self.prompt_ps1
-        self.write_line(self.ps1, self.style_ps1)
-
-    def prompt_ps2(self):
-        self.current_prompt = self.prompt_ps2
-        self.write_line(self.ps2, self.style_ps2)
-
-    def write_line(self, text, style=None):
-        start, end = self.text.get_buffer().get_bounds()
-        if style is None:
-            self.text.get_buffer().insert(end, text)
-        else:
-            self.text.get_buffer().insert_with_tags(end, text, style)
-
-        self.text.scroll_to_mark(self.mark, 0, True, 1, 1)
-
-    def push(self, line):
-
-        self.buffer.append(line)
-        if len(line) > 0:
-            self.history.append(line)
-
-        source = "\n".join(self.buffer)
-
-        more = self.interpreter.runsource(source, "<<console>>")
-
-        if not more:
-            self.reset_buffer()
-
-        return more
-
-    def key_pressed(self, widget, event):
-        if event.keyval == gtk.gdk.keyval_from_name('Return'):
-            return self.execute_line()
-
-        if event.keyval == gtk.gdk.keyval_from_name('Up'):
-            self.current_history = self.current_history - 1
-            if self.current_history < - len(self.history):
-                self.current_history = - len(self.history)
-            return self.show_history()
-        elif event.keyval == gtk.gdk.keyval_from_name('Down'):
-            self.current_history = self.current_history + 1
-            if self.current_history > 0:
-                self.current_history = 0
-            return self.show_history()
-        elif event.keyval == gtk.gdk.keyval_from_name('Home'):
-            l = self.text.get_buffer().get_line_count() - 1
-            start = self.text.get_buffer().get_iter_at_line_offset(l, 4)
-            self.text.get_buffer().place_cursor(start)
-            return True
-        elif event.keyval == gtk.gdk.keyval_from_name('space') and event.state & gtk.gdk.CONTROL_MASK:
-            return self.complete_line()
-        return False
-
-    def show_history(self):
-        if self.current_history == 0:
-            return True
-        else:
-            self.replace_line(self.history[self.current_history])
-            return True
-
-    def current_line(self):
-        start, end = self.current_line_bounds()
-        return self.text.get_buffer().get_text(start, end, True)
-
-    def current_line_bounds(self):
-        txt_buffer = self.text.get_buffer()
-        l = txt_buffer.get_line_count() - 1
-
-        start = txt_buffer.get_iter_at_line(l)
-        if start.get_chars_in_line() >= 4:
-            start.forward_chars(4)
-        end = txt_buffer.get_end_iter()
-        return start, end
-
-    def replace_line(self, txt):
-        start, end = self.current_line_bounds()
-        self.text.get_buffer().delete(start, end)
-        self.write_line(txt)
-
-    def execute_line(self, line=None):
-        if line is None:
-            line = self.current_line()
-            self.write_line("\n")
-        else:
-            self.write_line(line + "\n")
-
-        more = self.push(line)
-
-        self.text.get_buffer().place_cursor(self.text.get_buffer().get_end_iter())
-
-        if more:
-            self.prompt_ps2()
-        else:
-            self.prompt_ps1()
-
-        self.current_history = 0
-
-        self.window.raise_()
-
-        return True
-
-    def complete_line(self):
-        line = self.current_line()
-        tokens = line.split()
-        token = tokens[-1]
-
-        completions = []
-        p = self.completer.complete(token, len(completions))
-        while p is not None:
-            completions.append(p)
-            p = self.completer.complete(token, len(completions))
-
-        if len(completions) != 1:
-            self.write_line("\n")
-            self.write_line("\n".join(completions), self.style_ps1)
-            self.write_line("\n")
-            self.current_prompt()
-            self.write_line(line)
-        else:
-            i = line.rfind(token)
-            line = line[0:i] + completions[0]
-            self.replace_line(line)
-
-        return True
-
-
-def main():
-    w = gtk.Window()
-    console = GTKInterpreterConsole()
-    console.set_size_request(640, 480)
-    w.add(console)
-
-    def destroy(arg=None):
-        gtk.main_quit()
-
-    def key_event(widget, event):
-        if gtk.gdk.keyval_name(event.keyval) == 'd' and \
-                event.state & gtk.gdk.CONTROL_MASK:
-            destroy()
-        return False
-
-    w.connect("destroy", destroy)
-
-    w.add_events(gtk.gdk.KEY_PRESS_MASK)
-    w.connect('key_press_event', key_event)
-    w.show_all()
-
-    console.execute_line('import matplotlib')
-    console.execute_line("matplotlib.use('GTKAgg')")
-    console.execute_line('matplotlib.interactive(1)')
-    console.execute_line('from pylab import *')
-
-    if len(sys.argv) > 1:
-        fname = sys.argv[1]
-        if not os.path.exists(fname):
-            print('%s does not exist' % fname)
-        for line in file(fname):
-            line = line.strip()
-
-            console.execute_line(line)
-    gtk.main()
-
-if __name__ == '__main__':
-    main()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/interactive2.py b/examples/user_interfaces/interactive2.py deleted file mode 100644 index a6e7b700a11..00000000000 --- a/examples/user_interfaces/interactive2.py +++ /dev/null @@ -1,381 +0,0 @@ -from __future__ import print_function - -# GTK Interactive Console -# (C) 2003, Jon Anderson -# See www.python.org/2.2/license.html for -# license details. -# -import gtk -import gtk.gdk - -import code -import os -import sys -import pango - -import __builtin__ -import __main__ - - -banner = """GTK Interactive Python Console -Thanks to Jon Anderson -%s -""" % sys.version - -banner += """ - -Welcome to matplotlib. - - help(matplotlib) -- some general information about matplotlib - help(plotting) -- shows a list of plot specific commands - -""" - - -class Completer(object): - """ - Taken from rlcompleter, with readline references stripped, and a local dictionary to use. - """ - - def __init__(self, locals): - self.locals = locals - - def complete(self, text, state): - """Return the next possible completion for 'text'. - This is called successively with state == 0, 1, 2, ... until it - returns None. The completion should begin with 'text'. - - """ - if state == 0: - if "." in text: - self.matches = self.attr_matches(text) - else: - self.matches = self.global_matches(text) - try: - return self.matches[state] - except IndexError: - return None - - def global_matches(self, text): - """Compute matches when text is a simple name. - - Return a list of all keywords, built-in functions and names - currently defines in __main__ that match. - - """ - import keyword - matches = [] - n = len(text) - for list in [keyword.kwlist, __builtin__.__dict__.keys(), __main__.__dict__.keys(), self.locals.keys()]: - for word in list: - if word[:n] == text and word != "__builtins__": - matches.append(word) - return matches - - def attr_matches(self, text): - """Compute matches when text contains a dot. - - Assuming the text is of the form NAME.NAME....[NAME], and is - evaluatable in the globals of __main__, it will be evaluated - and its attributes (as revealed by dir()) are used as possible - completions. (For class instances, class members are are also - considered.) - - WARNING: this can still invoke arbitrary C code, if an object - with a __getattr__ hook is evaluated. - - """ - import re - m = re.match(r"(\w+(\.\w+)*)\.(\w*)", text) - if not m: - return - expr, attr = m.group(1, 3) - object = eval(expr, __main__.__dict__, self.locals) - words = dir(object) - if hasattr(object, '__class__'): - words.append('__class__') - words = words + get_class_members(object.__class__) - matches = [] - n = len(attr) - for word in words: - if word[:n] == attr and word != "__builtins__": - matches.append("%s.%s" % (expr, word)) - return matches - - -def get_class_members(klass): - ret = dir(klass) - if hasattr(klass, '__bases__'): - for base in klass.__bases__: - ret = ret + get_class_members(base) - return ret - - -class OutputStream(object): - """ - A Multiplexing output stream. - It can replace another stream, and tee output to the original stream and too - a GTK textview. - """ - - def __init__(self, view, old_out, style): - self.view = view - self.buffer = view.get_buffer() - self.mark = self.buffer.create_mark("End", self.buffer.get_end_iter(), False) - self.out = old_out - self.style = style - self.tee = 1 - - def write(self, text): - if self.tee: - self.out.write(text) - - end = self.buffer.get_end_iter() - - if self.view is not None: - self.view.scroll_to_mark(self.mark, 0, True, 1, 1) - - self.buffer.insert_with_tags(end, text, self.style) - - -class GTKInterpreterConsole(gtk.ScrolledWindow): - """ - An InteractiveConsole for GTK. It's an actual widget, - so it can be dropped in just about anywhere. - """ - - def __init__(self): - gtk.ScrolledWindow.__init__(self) - self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) - - self.text = gtk.TextView() - self.text.set_wrap_mode(True) - - self.interpreter = code.InteractiveInterpreter() - - self.completer = Completer(self.interpreter.locals) - self.buffer = [] - self.history = [] - self.banner = banner - self.ps1 = ">>> " - self.ps2 = "... " - - self.text.add_events(gtk.gdk.KEY_PRESS_MASK) - self.text.connect("key_press_event", self.key_pressed) - - self.current_history = -1 - - self.mark = self.text.get_buffer().create_mark("End", self.text.get_buffer().get_end_iter(), False) - - # setup colors - self.style_banner = gtk.TextTag("banner") - self.style_banner.set_property("foreground", "saddle brown") - - self.style_ps1 = gtk.TextTag("ps1") - self.style_ps1.set_property("foreground", "DarkOrchid4") - self.style_ps1.set_property("editable", False) - self.style_ps1.set_property("font", "courier") - - self.style_ps2 = gtk.TextTag("ps2") - self.style_ps2.set_property("foreground", "DarkOliveGreen") - self.style_ps2.set_property("editable", False) - self.style_ps2.set_property("font", "courier") - - self.style_out = gtk.TextTag("stdout") - self.style_out.set_property("foreground", "midnight blue") - self.style_err = gtk.TextTag("stderr") - self.style_err.set_property("style", pango.STYLE_ITALIC) - self.style_err.set_property("foreground", "red") - - self.text.get_buffer().get_tag_table().add(self.style_banner) - self.text.get_buffer().get_tag_table().add(self.style_ps1) - self.text.get_buffer().get_tag_table().add(self.style_ps2) - self.text.get_buffer().get_tag_table().add(self.style_out) - self.text.get_buffer().get_tag_table().add(self.style_err) - - self.stdout = OutputStream(self.text, sys.stdout, self.style_out) - self.stderr = OutputStream(self.text, sys.stderr, self.style_err) - - sys.stderr = self.stderr - sys.stdout = self.stdout - - self.current_prompt = None - - self.write_line(self.banner, self.style_banner) - self.prompt_ps1() - - self.add(self.text) - self.text.show() - - def reset_history(self): - self.history = [] - - def reset_buffer(self): - self.buffer = [] - - def prompt_ps1(self): - self.current_prompt = self.prompt_ps1 - self.write_line(self.ps1, self.style_ps1) - - def prompt_ps2(self): - self.current_prompt = self.prompt_ps2 - self.write_line(self.ps2, self.style_ps2) - - def write_line(self, text, style=None): - start, end = self.text.get_buffer().get_bounds() - if style is None: - self.text.get_buffer().insert(end, text) - else: - self.text.get_buffer().insert_with_tags(end, text, style) - - self.text.scroll_to_mark(self.mark, 0, True, 1, 1) - - def push(self, line): - - self.buffer.append(line) - if len(line) > 0: - self.history.append(line) - - source = "\n".join(self.buffer) - - more = self.interpreter.runsource(source, "<>") - - if not more: - self.reset_buffer() - - return more - - def key_pressed(self, widget, event): - if event.keyval == gtk.gdk.keyval_from_name('Return'): - return self.execute_line() - - if event.keyval == gtk.gdk.keyval_from_name('Up'): - self.current_history = self.current_history - 1 - if self.current_history < - len(self.history): - self.current_history = - len(self.history) - return self.show_history() - elif event.keyval == gtk.gdk.keyval_from_name('Down'): - self.current_history = self.current_history + 1 - if self.current_history > 0: - self.current_history = 0 - return self.show_history() - elif event.keyval == gtk.gdk.keyval_from_name('Home'): - l = self.text.get_buffer().get_line_count() - 1 - start = self.text.get_buffer().get_iter_at_line_offset(l, 4) - self.text.get_buffer().place_cursor(start) - return True - elif event.keyval == gtk.gdk.keyval_from_name('space') and event.state & gtk.gdk.CONTROL_MASK: - return self.complete_line() - return False - - def show_history(self): - if self.current_history == 0: - return True - else: - self.replace_line(self.history[self.current_history]) - return True - - def current_line(self): - start, end = self.current_line_bounds() - return self.text.get_buffer().get_text(start, end, True) - - def current_line_bounds(self): - txt_buffer = self.text.get_buffer() - l = txt_buffer.get_line_count() - 1 - - start = txt_buffer.get_iter_at_line(l) - if start.get_chars_in_line() >= 4: - start.forward_chars(4) - end = txt_buffer.get_end_iter() - return start, end - - def replace_line(self, txt): - start, end = self.current_line_bounds() - self.text.get_buffer().delete(start, end) - self.write_line(txt) - - def execute_line(self, line=None): - if line is None: - line = self.current_line() - self.write_line("\n") - else: - self.write_line(line + "\n") - - more = self.push(line) - - self.text.get_buffer().place_cursor(self.text.get_buffer().get_end_iter()) - - if more: - self.prompt_ps2() - else: - self.prompt_ps1() - - self.current_history = 0 - - self.window.raise_() - - return True - - def complete_line(self): - line = self.current_line() - tokens = line.split() - token = tokens[-1] - - completions = [] - p = self.completer.complete(token, len(completions)) - while p is not None: - completions.append(p) - p = self.completer.complete(token, len(completions)) - - if len(completions) != 1: - self.write_line("\n") - self.write_line("\n".join(completions), self.style_ps1) - self.write_line("\n") - self.current_prompt() - self.write_line(line) - else: - i = line.rfind(token) - line = line[0:i] + completions[0] - self.replace_line(line) - - return True - - -def main(): - w = gtk.Window() - console = GTKInterpreterConsole() - console.set_size_request(640, 480) - w.add(console) - - def destroy(arg=None): - gtk.main_quit() - - def key_event(widget, event): - if gtk.gdk.keyval_name(event.keyval) == 'd' and \ - event.state & gtk.gdk.CONTROL_MASK: - destroy() - return False - - w.connect("destroy", destroy) - - w.add_events(gtk.gdk.KEY_PRESS_MASK) - w.connect('key_press_event', key_event) - w.show_all() - - console.execute_line('import matplotlib') - console.execute_line("matplotlib.use('GTKAgg')") - console.execute_line('matplotlib.interactive(1)') - console.execute_line('from pylab import *') - - if len(sys.argv) > 1: - fname = sys.argv[1] - if not os.path.exists(fname): - print('%s does not exist' % fname) - for line in file(fname): - line = line.strip() - - console.execute_line(line) - gtk.main() - -if __name__ == '__main__': - main() diff --git a/examples/user_interfaces/lineprops_dialog_gtk.html b/examples/user_interfaces/lineprops_dialog_gtk.html deleted file mode 100644 index 4274f4a4f08..00000000000 --- a/examples/user_interfaces/lineprops_dialog_gtk.html +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - - - user_interfaces example code: lineprops_dialog_gtk.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: lineprops_dialog_gtk.py

-

[source code]

-
import matplotlib
-matplotlib.use('GTKAgg')
-from matplotlib.backends.backend_gtk import DialogLineprops
-
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-def f(t):
-    s1 = np.cos(2*np.pi*t)
-    e1 = np.exp(-t)
-    return np.multiply(s1, e1)
-
-t1 = np.arange(0.0, 5.0, 0.1)
-t2 = np.arange(0.0, 5.0, 0.02)
-t3 = np.arange(0.0, 2.0, 0.01)
-
-fig, ax = plt.subplots()
-l1, = ax.plot(t1, f(t1), 'bo', label='line 1')
-l2, = ax.plot(t2, f(t2), 'k--', label='line 2')
-
-dlg = DialogLineprops([l1, l2])
-dlg.show()
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/lineprops_dialog_gtk.py b/examples/user_interfaces/lineprops_dialog_gtk.py deleted file mode 100644 index 49e86407196..00000000000 --- a/examples/user_interfaces/lineprops_dialog_gtk.py +++ /dev/null @@ -1,24 +0,0 @@ -import matplotlib -matplotlib.use('GTKAgg') -from matplotlib.backends.backend_gtk import DialogLineprops - -import numpy as np -import matplotlib.pyplot as plt - - -def f(t): - s1 = np.cos(2*np.pi*t) - e1 = np.exp(-t) - return np.multiply(s1, e1) - -t1 = np.arange(0.0, 5.0, 0.1) -t2 = np.arange(0.0, 5.0, 0.02) -t3 = np.arange(0.0, 2.0, 0.01) - -fig, ax = plt.subplots() -l1, = ax.plot(t1, f(t1), 'bo', label='line 1') -l2, = ax.plot(t2, f(t2), 'k--', label='line 2') - -dlg = DialogLineprops([l1, l2]) -dlg.show() -plt.show() diff --git a/examples/user_interfaces/mathtext_wx.html b/examples/user_interfaces/mathtext_wx.html deleted file mode 100644 index ad995af6c23..00000000000 --- a/examples/user_interfaces/mathtext_wx.html +++ /dev/null @@ -1,440 +0,0 @@ - - - - - - - - user_interfaces example code: mathtext_wx.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: mathtext_wx.py

-

[source code]

-
"""
-Demonstrates how to convert mathtext to a wx.Bitmap for display in various
-controls on wxPython.
-"""
-
-import matplotlib
-matplotlib.use("WxAgg")
-from numpy import arange, sin, pi, cos, log
-from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
-from matplotlib.backends.backend_wx import NavigationToolbar2Wx, wxc
-from matplotlib.figure import Figure
-
-import wx
-
-IS_GTK = 'wxGTK' in wx.PlatformInfo
-IS_WIN = 'wxMSW' in wx.PlatformInfo
-
-############################################################
-# This is where the "magic" happens.
-from matplotlib.mathtext import MathTextParser
-mathtext_parser = MathTextParser("Bitmap")
-
-
-def mathtext_to_wxbitmap(s):
-    ftimage, depth = mathtext_parser.parse(s, 150)
-    return wxc.BitmapFromBuffer(
-        ftimage.get_width(), ftimage.get_height(),
-        ftimage.as_rgba_str())
-############################################################
-
-functions = [
-    (r'$\sin(2 \pi x)$', lambda x: sin(2*pi*x)),
-    (r'$\frac{4}{3}\pi x^3$', lambda x: (4.0/3.0)*pi*x**3),
-    (r'$\cos(2 \pi x)$', lambda x: cos(2*pi*x)),
-    (r'$\log(x)$', lambda x: log(x))
-]
-
-
-class CanvasFrame(wx.Frame):
-    def __init__(self, parent, title):
-        wx.Frame.__init__(self, parent, -1, title, size=(550, 350))
-        self.SetBackgroundColour(wxc.NamedColour("WHITE"))
-
-        self.figure = Figure()
-        self.axes = self.figure.add_subplot(111)
-
-        self.canvas = FigureCanvas(self, -1, self.figure)
-
-        self.change_plot(0)
-
-        self.sizer = wx.BoxSizer(wx.VERTICAL)
-        self.add_buttonbar()
-        self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
-        self.add_toolbar()  # comment this out for no toolbar
-
-        menuBar = wx.MenuBar()
-
-        # File Menu
-        menu = wx.Menu()
-        menu.Append(wx.ID_EXIT, "E&xit\tAlt-X", "Exit this simple sample")
-        menuBar.Append(menu, "&File")
-
-        if IS_GTK or IS_WIN:
-            # Equation Menu
-            menu = wx.Menu()
-            for i, (mt, func) in enumerate(functions):
-                bm = mathtext_to_wxbitmap(mt)
-                item = wx.MenuItem(menu, 1000 + i, " ")
-                item.SetBitmap(bm)
-                menu.AppendItem(item)
-                self.Bind(wx.EVT_MENU, self.OnChangePlot, item)
-            menuBar.Append(menu, "&Functions")
-
-        self.SetMenuBar(menuBar)
-
-        self.SetSizer(self.sizer)
-        self.Fit()
-
-    def add_buttonbar(self):
-        self.button_bar = wx.Panel(self)
-        self.button_bar_sizer = wx.BoxSizer(wx.HORIZONTAL)
-        self.sizer.Add(self.button_bar, 0, wx.LEFT | wx.TOP | wx.GROW)
-
-        for i, (mt, func) in enumerate(functions):
-            bm = mathtext_to_wxbitmap(mt)
-            button = wx.BitmapButton(self.button_bar, 1000 + i, bm)
-            self.button_bar_sizer.Add(button, 1, wx.GROW)
-            self.Bind(wx.EVT_BUTTON, self.OnChangePlot, button)
-
-        self.button_bar.SetSizer(self.button_bar_sizer)
-
-    def add_toolbar(self):
-        """Copied verbatim from embedding_wx2.py"""
-        self.toolbar = NavigationToolbar2Wx(self.canvas)
-        self.toolbar.Realize()
-        # By adding toolbar in sizer, we are able to put it at the bottom
-        # of the frame - so appearance is closer to GTK version.
-        self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND)
-        # update the axes menu on the toolbar
-        self.toolbar.update()
-
-    def OnChangePlot(self, event):
-        self.change_plot(event.GetId() - 1000)
-
-    def change_plot(self, plot_number):
-        t = arange(1.0, 3.0, 0.01)
-        s = functions[plot_number][1](t)
-        self.axes.clear()
-        self.axes.plot(t, s)
-        self.canvas.draw()
-
-
-class MyApp(wx.App):
-    def OnInit(self):
-        frame = CanvasFrame(None, "wxPython mathtext demo app")
-        self.SetTopWindow(frame)
-        frame.Show(True)
-        return True
-
-app = MyApp()
-app.MainLoop()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/mathtext_wx.py b/examples/user_interfaces/mathtext_wx.py deleted file mode 100644 index 24ad8db59a0..00000000000 --- a/examples/user_interfaces/mathtext_wx.py +++ /dev/null @@ -1,121 +0,0 @@ -""" -Demonstrates how to convert mathtext to a wx.Bitmap for display in various -controls on wxPython. -""" - -import matplotlib -matplotlib.use("WxAgg") -from numpy import arange, sin, pi, cos, log -from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas -from matplotlib.backends.backend_wx import NavigationToolbar2Wx, wxc -from matplotlib.figure import Figure - -import wx - -IS_GTK = 'wxGTK' in wx.PlatformInfo -IS_WIN = 'wxMSW' in wx.PlatformInfo - -############################################################ -# This is where the "magic" happens. -from matplotlib.mathtext import MathTextParser -mathtext_parser = MathTextParser("Bitmap") - - -def mathtext_to_wxbitmap(s): - ftimage, depth = mathtext_parser.parse(s, 150) - return wxc.BitmapFromBuffer( - ftimage.get_width(), ftimage.get_height(), - ftimage.as_rgba_str()) -############################################################ - -functions = [ - (r'$\sin(2 \pi x)$', lambda x: sin(2*pi*x)), - (r'$\frac{4}{3}\pi x^3$', lambda x: (4.0/3.0)*pi*x**3), - (r'$\cos(2 \pi x)$', lambda x: cos(2*pi*x)), - (r'$\log(x)$', lambda x: log(x)) -] - - -class CanvasFrame(wx.Frame): - def __init__(self, parent, title): - wx.Frame.__init__(self, parent, -1, title, size=(550, 350)) - self.SetBackgroundColour(wxc.NamedColour("WHITE")) - - self.figure = Figure() - self.axes = self.figure.add_subplot(111) - - self.canvas = FigureCanvas(self, -1, self.figure) - - self.change_plot(0) - - self.sizer = wx.BoxSizer(wx.VERTICAL) - self.add_buttonbar() - self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) - self.add_toolbar() # comment this out for no toolbar - - menuBar = wx.MenuBar() - - # File Menu - menu = wx.Menu() - menu.Append(wx.ID_EXIT, "E&xit\tAlt-X", "Exit this simple sample") - menuBar.Append(menu, "&File") - - if IS_GTK or IS_WIN: - # Equation Menu - menu = wx.Menu() - for i, (mt, func) in enumerate(functions): - bm = mathtext_to_wxbitmap(mt) - item = wx.MenuItem(menu, 1000 + i, " ") - item.SetBitmap(bm) - menu.AppendItem(item) - self.Bind(wx.EVT_MENU, self.OnChangePlot, item) - menuBar.Append(menu, "&Functions") - - self.SetMenuBar(menuBar) - - self.SetSizer(self.sizer) - self.Fit() - - def add_buttonbar(self): - self.button_bar = wx.Panel(self) - self.button_bar_sizer = wx.BoxSizer(wx.HORIZONTAL) - self.sizer.Add(self.button_bar, 0, wx.LEFT | wx.TOP | wx.GROW) - - for i, (mt, func) in enumerate(functions): - bm = mathtext_to_wxbitmap(mt) - button = wx.BitmapButton(self.button_bar, 1000 + i, bm) - self.button_bar_sizer.Add(button, 1, wx.GROW) - self.Bind(wx.EVT_BUTTON, self.OnChangePlot, button) - - self.button_bar.SetSizer(self.button_bar_sizer) - - def add_toolbar(self): - """Copied verbatim from embedding_wx2.py""" - self.toolbar = NavigationToolbar2Wx(self.canvas) - self.toolbar.Realize() - # By adding toolbar in sizer, we are able to put it at the bottom - # of the frame - so appearance is closer to GTK version. - self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) - # update the axes menu on the toolbar - self.toolbar.update() - - def OnChangePlot(self, event): - self.change_plot(event.GetId() - 1000) - - def change_plot(self, plot_number): - t = arange(1.0, 3.0, 0.01) - s = functions[plot_number][1](t) - self.axes.clear() - self.axes.plot(t, s) - self.canvas.draw() - - -class MyApp(wx.App): - def OnInit(self): - frame = CanvasFrame(None, "wxPython mathtext demo app") - self.SetTopWindow(frame) - frame.Show(True) - return True - -app = MyApp() -app.MainLoop() diff --git a/examples/user_interfaces/mpl_with_glade.html b/examples/user_interfaces/mpl_with_glade.html deleted file mode 100644 index e4e3af51fe6..00000000000 --- a/examples/user_interfaces/mpl_with_glade.html +++ /dev/null @@ -1,419 +0,0 @@ - - - - - - - - user_interfaces example code: mpl_with_glade.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: mpl_with_glade.py

-

[source code]

-
from __future__ import print_function
-import matplotlib
-matplotlib.use('GTK')
-
-from matplotlib.figure import Figure
-from matplotlib.axes import Subplot
-from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas
-from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar
-from matplotlib.widgets import SpanSelector
-
-from numpy import arange, sin, pi
-import gtk
-import gtk.glade
-
-
-def simple_msg(msg, parent=None, title=None):
-    dialog = gtk.MessageDialog(
-        parent=None,
-        type=gtk.MESSAGE_INFO,
-        buttons=gtk.BUTTONS_OK,
-        message_format=msg)
-    if parent is not None:
-        dialog.set_transient_for(parent)
-    if title is not None:
-        dialog.set_title(title)
-    dialog.show()
-    dialog.run()
-    dialog.destroy()
-    return None
-
-
-class GladeHandlers(object):
-    def on_buttonClickMe_clicked(event):
-        simple_msg('Nothing to say, really',
-                   parent=widgets['windowMain'],
-                   title='Thanks!')
-
-
-class WidgetsWrapper(object):
-    def __init__(self):
-        self.widgets = gtk.glade.XML('mpl_with_glade.glade')
-        self.widgets.signal_autoconnect(GladeHandlers.__dict__)
-
-        self['windowMain'].connect('destroy', lambda x: gtk.main_quit())
-        self['windowMain'].move(10, 10)
-        self.figure = Figure(figsize=(8, 6), dpi=72)
-        self.axis = self.figure.add_subplot(111)
-
-        t = arange(0.0, 3.0, 0.01)
-        s = sin(2*pi*t)
-        self.axis.plot(t, s)
-        self.axis.set_xlabel('time (s)')
-        self.axis.set_ylabel('voltage')
-
-        self.canvas = FigureCanvas(self.figure)  # a gtk.DrawingArea
-        self.canvas.show()
-        self.canvas.set_size_request(600, 400)
-        self.canvas.set_events(
-            gtk.gdk.BUTTON_PRESS_MASK |
-            gtk.gdk.KEY_PRESS_MASK |
-            gtk.gdk.KEY_RELEASE_MASK
-            )
-        self.canvas.set_flags(gtk.HAS_FOCUS | gtk.CAN_FOCUS)
-        self.canvas.grab_focus()
-
-        def keypress(widget, event):
-            print('key press')
-
-        def buttonpress(widget, event):
-            print('button press')
-
-        self.canvas.connect('key_press_event', keypress)
-        self.canvas.connect('button_press_event', buttonpress)
-
-        def onselect(xmin, xmax):
-            print(xmin, xmax)
-
-        span = SpanSelector(self.axis, onselect, 'horizontal', useblit=False,
-                            rectprops=dict(alpha=0.5, facecolor='red'))
-
-        self['vboxMain'].pack_start(self.canvas, True, True)
-        self['vboxMain'].show()
-
-        # below is optional if you want the navigation toolbar
-        self.navToolbar = NavigationToolbar(self.canvas, self['windowMain'])
-        self.navToolbar.lastDir = '/var/tmp/'
-        self['vboxMain'].pack_start(self.navToolbar)
-        self.navToolbar.show()
-
-        sep = gtk.HSeparator()
-        sep.show()
-        self['vboxMain'].pack_start(sep, True, True)
-
-        self['vboxMain'].reorder_child(self['buttonClickMe'], -1)
-
-    def __getitem__(self, key):
-        return self.widgets.get_widget(key)
-
-widgets = WidgetsWrapper()
-gtk.main()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/mpl_with_glade.py b/examples/user_interfaces/mpl_with_glade.py deleted file mode 100644 index 340092ebeba..00000000000 --- a/examples/user_interfaces/mpl_with_glade.py +++ /dev/null @@ -1,100 +0,0 @@ -from __future__ import print_function -import matplotlib -matplotlib.use('GTK') - -from matplotlib.figure import Figure -from matplotlib.axes import Subplot -from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas -from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar -from matplotlib.widgets import SpanSelector - -from numpy import arange, sin, pi -import gtk -import gtk.glade - - -def simple_msg(msg, parent=None, title=None): - dialog = gtk.MessageDialog( - parent=None, - type=gtk.MESSAGE_INFO, - buttons=gtk.BUTTONS_OK, - message_format=msg) - if parent is not None: - dialog.set_transient_for(parent) - if title is not None: - dialog.set_title(title) - dialog.show() - dialog.run() - dialog.destroy() - return None - - -class GladeHandlers(object): - def on_buttonClickMe_clicked(event): - simple_msg('Nothing to say, really', - parent=widgets['windowMain'], - title='Thanks!') - - -class WidgetsWrapper(object): - def __init__(self): - self.widgets = gtk.glade.XML('mpl_with_glade.glade') - self.widgets.signal_autoconnect(GladeHandlers.__dict__) - - self['windowMain'].connect('destroy', lambda x: gtk.main_quit()) - self['windowMain'].move(10, 10) - self.figure = Figure(figsize=(8, 6), dpi=72) - self.axis = self.figure.add_subplot(111) - - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - self.axis.plot(t, s) - self.axis.set_xlabel('time (s)') - self.axis.set_ylabel('voltage') - - self.canvas = FigureCanvas(self.figure) # a gtk.DrawingArea - self.canvas.show() - self.canvas.set_size_request(600, 400) - self.canvas.set_events( - gtk.gdk.BUTTON_PRESS_MASK | - gtk.gdk.KEY_PRESS_MASK | - gtk.gdk.KEY_RELEASE_MASK - ) - self.canvas.set_flags(gtk.HAS_FOCUS | gtk.CAN_FOCUS) - self.canvas.grab_focus() - - def keypress(widget, event): - print('key press') - - def buttonpress(widget, event): - print('button press') - - self.canvas.connect('key_press_event', keypress) - self.canvas.connect('button_press_event', buttonpress) - - def onselect(xmin, xmax): - print(xmin, xmax) - - span = SpanSelector(self.axis, onselect, 'horizontal', useblit=False, - rectprops=dict(alpha=0.5, facecolor='red')) - - self['vboxMain'].pack_start(self.canvas, True, True) - self['vboxMain'].show() - - # below is optional if you want the navigation toolbar - self.navToolbar = NavigationToolbar(self.canvas, self['windowMain']) - self.navToolbar.lastDir = '/var/tmp/' - self['vboxMain'].pack_start(self.navToolbar) - self.navToolbar.show() - - sep = gtk.HSeparator() - sep.show() - self['vboxMain'].pack_start(sep, True, True) - - self['vboxMain'].reorder_child(self['buttonClickMe'], -1) - - def __getitem__(self, key): - return self.widgets.get_widget(key) - -widgets = WidgetsWrapper() -gtk.main() diff --git a/examples/user_interfaces/mpl_with_glade_316.html b/examples/user_interfaces/mpl_with_glade_316.html deleted file mode 100644 index e881a5fd9f2..00000000000 --- a/examples/user_interfaces/mpl_with_glade_316.html +++ /dev/null @@ -1,359 +0,0 @@ - - - - - - - - user_interfaces example code: mpl_with_glade_316.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: mpl_with_glade_316.py

-

[source code]

-
from gi.repository import Gtk
-
-from matplotlib.figure import Figure
-from matplotlib.axes import Subplot
-from numpy import arange, sin, pi
-from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanvas
-
-
-class Window1Signals(object):
-    def on_window1_destroy(self, widget):
-        Gtk.main_quit()
-
-
-def main():
-    builder = Gtk.Builder()
-    builder.add_objects_from_file("mpl_with_glade_316.glade", ("window1", ""))
-    builder.connect_signals(Window1Signals())
-    window = builder.get_object("window1")
-    sw = builder.get_object("scrolledwindow1")
-
-    # Start of Matplotlib specific code
-    figure = Figure(figsize=(8, 6), dpi=71)
-    axis = figure.add_subplot(111)
-    t = arange(0.0, 3.0, 0.01)
-    s = sin(2*pi*t)
-    axis.plot(t, s)
-
-    axis.set_xlabel('time [s]')
-    axis.set_ylabel('voltage [V]')
-
-    canvas = FigureCanvas(figure)  # a Gtk.DrawingArea
-    canvas.set_size_request(800, 600)
-    sw.add_with_viewport(canvas)
-    # End of Matplotlib specific code
-
-    window.show_all()
-    Gtk.main()
-
-if __name__ == "__main__":
-    main()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/mpl_with_glade_316.py b/examples/user_interfaces/mpl_with_glade_316.py deleted file mode 100644 index ca537b508de..00000000000 --- a/examples/user_interfaces/mpl_with_glade_316.py +++ /dev/null @@ -1,40 +0,0 @@ -from gi.repository import Gtk - -from matplotlib.figure import Figure -from matplotlib.axes import Subplot -from numpy import arange, sin, pi -from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanvas - - -class Window1Signals(object): - def on_window1_destroy(self, widget): - Gtk.main_quit() - - -def main(): - builder = Gtk.Builder() - builder.add_objects_from_file("mpl_with_glade_316.glade", ("window1", "")) - builder.connect_signals(Window1Signals()) - window = builder.get_object("window1") - sw = builder.get_object("scrolledwindow1") - - # Start of Matplotlib specific code - figure = Figure(figsize=(8, 6), dpi=71) - axis = figure.add_subplot(111) - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - axis.plot(t, s) - - axis.set_xlabel('time [s]') - axis.set_ylabel('voltage [V]') - - canvas = FigureCanvas(figure) # a Gtk.DrawingArea - canvas.set_size_request(800, 600) - sw.add_with_viewport(canvas) - # End of Matplotlib specific code - - window.show_all() - Gtk.main() - -if __name__ == "__main__": - main() diff --git a/examples/user_interfaces/pylab_with_gtk.html b/examples/user_interfaces/pylab_with_gtk.html deleted file mode 100644 index e71f960f569..00000000000 --- a/examples/user_interfaces/pylab_with_gtk.html +++ /dev/null @@ -1,378 +0,0 @@ - - - - - - - - user_interfaces example code: pylab_with_gtk.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: pylab_with_gtk.py

-

[source code]

-
"""
-An example of how to use pylab to manage your figure windows, but
-modify the GUI by accessing the underlying gtk widgets
-"""
-from __future__ import print_function
-import matplotlib
-matplotlib.use('GTKAgg')
-import matplotlib.pyplot as plt
-
-
-fig, ax = plt.subplots()
-plt.plot([1, 2, 3], 'ro-', label='easy as 1 2 3')
-plt.plot([1, 4, 9], 'gs--', label='easy as 1 2 3 squared')
-plt.legend()
-
-
-manager = plt.get_current_fig_manager()
-# you can also access the window or vbox attributes this way
-toolbar = manager.toolbar
-
-# now let's add a button to the toolbar
-import gtk
-next = 8  # where to insert this in the mpl toolbar
-button = gtk.Button('Click me')
-button.show()
-
-
-def clicked(button):
-    print('hi mom')
-button.connect('clicked', clicked)
-
-toolitem = gtk.ToolItem()
-toolitem.show()
-toolitem.set_tooltip(
-    toolbar.tooltips,
-    'Click me for fun and profit')
-
-toolitem.add(button)
-toolbar.insert(toolitem, next)
-next += 1
-
-# now let's add a widget to the vbox
-label = gtk.Label()
-label.set_markup('Drag mouse over axes for position')
-label.show()
-vbox = manager.vbox
-vbox.pack_start(label, False, False)
-vbox.reorder_child(manager.toolbar, -1)
-
-
-def update(event):
-    if event.xdata is None:
-        label.set_markup('Drag mouse over axes for position')
-    else:
-        label.set_markup('<span color="#ef0000">x,y=(%f, %f)</span>' % (event.xdata, event.ydata))
-
-plt.connect('motion_notify_event', update)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/pylab_with_gtk.py b/examples/user_interfaces/pylab_with_gtk.py deleted file mode 100644 index 06479b03b69..00000000000 --- a/examples/user_interfaces/pylab_with_gtk.py +++ /dev/null @@ -1,59 +0,0 @@ -""" -An example of how to use pylab to manage your figure windows, but -modify the GUI by accessing the underlying gtk widgets -""" -from __future__ import print_function -import matplotlib -matplotlib.use('GTKAgg') -import matplotlib.pyplot as plt - - -fig, ax = plt.subplots() -plt.plot([1, 2, 3], 'ro-', label='easy as 1 2 3') -plt.plot([1, 4, 9], 'gs--', label='easy as 1 2 3 squared') -plt.legend() - - -manager = plt.get_current_fig_manager() -# you can also access the window or vbox attributes this way -toolbar = manager.toolbar - -# now let's add a button to the toolbar -import gtk -next = 8 # where to insert this in the mpl toolbar -button = gtk.Button('Click me') -button.show() - - -def clicked(button): - print('hi mom') -button.connect('clicked', clicked) - -toolitem = gtk.ToolItem() -toolitem.show() -toolitem.set_tooltip( - toolbar.tooltips, - 'Click me for fun and profit') - -toolitem.add(button) -toolbar.insert(toolitem, next) -next += 1 - -# now let's add a widget to the vbox -label = gtk.Label() -label.set_markup('Drag mouse over axes for position') -label.show() -vbox = manager.vbox -vbox.pack_start(label, False, False) -vbox.reorder_child(manager.toolbar, -1) - - -def update(event): - if event.xdata is None: - label.set_markup('Drag mouse over axes for position') - else: - label.set_markup('x,y=(%f, %f)' % (event.xdata, event.ydata)) - -plt.connect('motion_notify_event', update) - -plt.show() diff --git a/examples/user_interfaces/rec_edit_gtk_custom.html b/examples/user_interfaces/rec_edit_gtk_custom.html deleted file mode 100644 index 3fa6cfa978f..00000000000 --- a/examples/user_interfaces/rec_edit_gtk_custom.html +++ /dev/null @@ -1,361 +0,0 @@ - - - - - - - - user_interfaces example code: rec_edit_gtk_custom.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: rec_edit_gtk_custom.py

-

[source code]

-
"""
-generate an editable gtk treeview widget for record arrays with custom
-formatting of the cells and show how to limit string entries to a list
-of strings
-"""
-from __future__ import print_function
-import gtk
-import numpy as np
-import matplotlib.mlab as mlab
-import matplotlib.cbook as cbook
-import mpl_toolkits.gtktools as gtktools
-
-
-datafile = cbook.get_sample_data('demodata.csv', asfileobj=False)
-r = mlab.csv2rec(datafile, converterd={'weekdays': str})
-
-
-formatd = mlab.get_formatd(r)
-formatd['date'] = mlab.FormatDate('%Y-%m-%d')
-formatd['prices'] = mlab.FormatMillions(precision=1)
-formatd['gain'] = mlab.FormatPercent(precision=2)
-
-# use a drop down combo for weekdays
-stringd = dict(weekdays=['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'])
-constant = ['clientid']   # block editing of this field
-
-
-liststore = gtktools.RecListStore(r, formatd=formatd, stringd=stringd)
-treeview = gtktools.RecTreeView(liststore, constant=constant)
-
-
-def mycallback(liststore, rownum, colname, oldval, newval):
-    print('verify: old=%s, new=%s, rec=%s' % (oldval, newval, liststore.r[rownum][colname]))
-
-liststore.callbacks.connect('cell_changed', mycallback)
-
-win = gtk.Window()
-win.set_title('click to edit')
-win.add(treeview)
-win.show_all()
-win.connect('delete-event', lambda *args: gtk.main_quit())
-gtk.main()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/rec_edit_gtk_custom.py b/examples/user_interfaces/rec_edit_gtk_custom.py deleted file mode 100644 index 0d3a2037481..00000000000 --- a/examples/user_interfaces/rec_edit_gtk_custom.py +++ /dev/null @@ -1,42 +0,0 @@ -""" -generate an editable gtk treeview widget for record arrays with custom -formatting of the cells and show how to limit string entries to a list -of strings -""" -from __future__ import print_function -import gtk -import numpy as np -import matplotlib.mlab as mlab -import matplotlib.cbook as cbook -import mpl_toolkits.gtktools as gtktools - - -datafile = cbook.get_sample_data('demodata.csv', asfileobj=False) -r = mlab.csv2rec(datafile, converterd={'weekdays': str}) - - -formatd = mlab.get_formatd(r) -formatd['date'] = mlab.FormatDate('%Y-%m-%d') -formatd['prices'] = mlab.FormatMillions(precision=1) -formatd['gain'] = mlab.FormatPercent(precision=2) - -# use a drop down combo for weekdays -stringd = dict(weekdays=['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']) -constant = ['clientid'] # block editing of this field - - -liststore = gtktools.RecListStore(r, formatd=formatd, stringd=stringd) -treeview = gtktools.RecTreeView(liststore, constant=constant) - - -def mycallback(liststore, rownum, colname, oldval, newval): - print('verify: old=%s, new=%s, rec=%s' % (oldval, newval, liststore.r[rownum][colname])) - -liststore.callbacks.connect('cell_changed', mycallback) - -win = gtk.Window() -win.set_title('click to edit') -win.add(treeview) -win.show_all() -win.connect('delete-event', lambda *args: gtk.main_quit()) -gtk.main() diff --git a/examples/user_interfaces/rec_edit_gtk_simple.html b/examples/user_interfaces/rec_edit_gtk_simple.html deleted file mode 100644 index d8cc7175805..00000000000 --- a/examples/user_interfaces/rec_edit_gtk_simple.html +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - - - user_interfaces example code: rec_edit_gtk_simple.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: rec_edit_gtk_simple.py

-

[source code]

-
"""
-Load a CSV file into a record array and edit it in a gtk treeview
-"""
-
-import gtk
-import numpy as np
-import matplotlib.mlab as mlab
-import matplotlib.cbook as cbook
-import mpl_toolkits.gtktools as gtktools
-
-datafile = cbook.get_sample_data('demodata.csv', asfileobj=False)
-r = mlab.csv2rec(datafile, converterd={'weekdays': str})
-
-liststore, treeview, win = gtktools.edit_recarray(r)
-win.set_title('click to edit')
-win.connect('delete-event', lambda *args: gtk.main_quit())
-gtk.main()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/rec_edit_gtk_simple.py b/examples/user_interfaces/rec_edit_gtk_simple.py deleted file mode 100644 index 4d01056604f..00000000000 --- a/examples/user_interfaces/rec_edit_gtk_simple.py +++ /dev/null @@ -1,17 +0,0 @@ -""" -Load a CSV file into a record array and edit it in a gtk treeview -""" - -import gtk -import numpy as np -import matplotlib.mlab as mlab -import matplotlib.cbook as cbook -import mpl_toolkits.gtktools as gtktools - -datafile = cbook.get_sample_data('demodata.csv', asfileobj=False) -r = mlab.csv2rec(datafile, converterd={'weekdays': str}) - -liststore, treeview, win = gtktools.edit_recarray(r) -win.set_title('click to edit') -win.connect('delete-event', lambda *args: gtk.main_quit()) -gtk.main() diff --git a/examples/user_interfaces/svg_histogram.html b/examples/user_interfaces/svg_histogram.html deleted file mode 100644 index 0d36e4f7376..00000000000 --- a/examples/user_interfaces/svg_histogram.html +++ /dev/null @@ -1,472 +0,0 @@ - - - - - - - - user_interfaces example code: svg_histogram.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: svg_histogram.py

-

[source code]

-
"""
-Demonstrate how to create an interactive histogram, in which bars
-are hidden or shown by clicking on legend markers.
-
-The interactivity is encoded in ecmascript (javascript) and inserted in
-the SVG code in a post-processing step. To render the image, open it in
-a web browser. SVG is supported in most web browsers used by Linux and
-OSX users. Windows IE9 supports SVG, but earlier versions do not.
-
-Notes
------
-The matplotlib backend lets us assign ids to each object. This is the
-mechanism used here to relate matplotlib objects created in python and
-the corresponding SVG constructs that are parsed in the second step.
-While flexible, ids are cumbersome to use for large collection of
-objects. Two mechanisms could be used to simplify things:
- * systematic grouping of objects into SVG <g> tags,
- * assigning classes to each SVG object according to its origin.
-
-For example, instead of modifying the properties of each individual bar,
-the bars from the `hist` function could either be grouped in
-a PatchCollection, or be assigned a class="hist_##" attribute.
-
-CSS could also be used more extensively to replace repetitive markup
-throughout the generated SVG.
-
-Author: david.huard@gmail.com
-
-"""
-
-
-import numpy as np
-import matplotlib.pyplot as plt
-import xml.etree.ElementTree as ET
-from io import BytesIO
-import json
-
-
-plt.rcParams['svg.fonttype'] = 'none'
-
-# Apparently, this `register_namespace` method works only with
-# python 2.7 and up and is necessary to avoid garbling the XML name
-# space with ns0.
-ET.register_namespace("", "http://www.w3.org/2000/svg")
-
-
-# --- Create histogram, legend and title ---
-plt.figure()
-r = np.random.randn(100)
-r1 = r + 1
-labels = ['Rabbits', 'Frogs']
-H = plt.hist([r, r1], label=labels)
-containers = H[-1]
-leg = plt.legend(frameon=False)
-plt.title("From a web browser, click on the legend\n"
-          "marker to toggle the corresponding histogram.")
-
-
-# --- Add ids to the svg objects we'll modify
-
-hist_patches = {}
-for ic, c in enumerate(containers):
-    hist_patches['hist_%d' % ic] = []
-    for il, element in enumerate(c):
-        element.set_gid('hist_%d_patch_%d' % (ic, il))
-        hist_patches['hist_%d' % ic].append('hist_%d_patch_%d' % (ic, il))
-
-# Set ids for the legend patches
-for i, t in enumerate(leg.get_patches()):
-    t.set_gid('leg_patch_%d' % i)
-
-# Set ids for the text patches
-for i, t in enumerate(leg.get_texts()):
-    t.set_gid('leg_text_%d' % i)
-
-# Save SVG in a fake file object.
-f = BytesIO()
-plt.savefig(f, format="svg")
-
-# Create XML tree from the SVG file.
-tree, xmlid = ET.XMLID(f.getvalue())
-
-
-# --- Add interactivity ---
-
-# Add attributes to the patch objects.
-for i, t in enumerate(leg.get_patches()):
-    el = xmlid['leg_patch_%d' % i]
-    el.set('cursor', 'pointer')
-    el.set('onclick', "toggle_hist(this)")
-
-# Add attributes to the text objects.
-for i, t in enumerate(leg.get_texts()):
-    el = xmlid['leg_text_%d' % i]
-    el.set('cursor', 'pointer')
-    el.set('onclick', "toggle_hist(this)")
-
-# Create script defining the function `toggle_hist`.
-# We create a global variable `container` that stores the patches id
-# belonging to each histogram. Then a function "toggle_element" sets the
-# visibility attribute of all patches of each histogram and the opacity
-# of the marker itself.
-
-script = """
-<script type="text/ecmascript">
-<![CDATA[
-var container = %s
-
-function toggle(oid, attribute, values) {
-    /* Toggle the style attribute of an object between two values.
-
-    Parameters
-    ----------
-    oid : str
-      Object identifier.
-    attribute : str
-      Name of style attribute.
-    values : [on state, off state]
-      The two values that are switched between.
-    */
-    var obj = document.getElementById(oid);
-    var a = obj.style[attribute];
-
-    a = (a == values[0] || a == "") ? values[1] : values[0];
-    obj.style[attribute] = a;
-    }
-
-function toggle_hist(obj) {
-
-    var num = obj.id.slice(-1);
-
-    toggle('leg_patch_' + num, 'opacity', [1, 0.3]);
-    toggle('leg_text_' + num, 'opacity', [1, 0.5]);
-
-    var names = container['hist_'+num]
-
-    for (var i=0; i < names.length; i++) {
-        toggle(names[i], 'opacity', [1,0])
-    };
-    }
-]]>
-</script>
-""" % json.dumps(hist_patches)
-
-# Add a transition effect
-css = tree.getchildren()[0][0]
-css.text = css.text + "g {-webkit-transition:opacity 0.4s ease-out;" + \
-    "-moz-transition:opacity 0.4s ease-out;}"
-
-# Insert the script and save to file.
-tree.insert(0, ET.XML(script))
-
-ET.ElementTree(tree).write("svg_histogram.svg")
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/svg_histogram.py b/examples/user_interfaces/svg_histogram.py deleted file mode 100644 index 4238e5efa0f..00000000000 --- a/examples/user_interfaces/svg_histogram.py +++ /dev/null @@ -1,153 +0,0 @@ -""" -Demonstrate how to create an interactive histogram, in which bars -are hidden or shown by clicking on legend markers. - -The interactivity is encoded in ecmascript (javascript) and inserted in -the SVG code in a post-processing step. To render the image, open it in -a web browser. SVG is supported in most web browsers used by Linux and -OSX users. Windows IE9 supports SVG, but earlier versions do not. - -Notes ------ -The matplotlib backend lets us assign ids to each object. This is the -mechanism used here to relate matplotlib objects created in python and -the corresponding SVG constructs that are parsed in the second step. -While flexible, ids are cumbersome to use for large collection of -objects. Two mechanisms could be used to simplify things: - * systematic grouping of objects into SVG tags, - * assigning classes to each SVG object according to its origin. - -For example, instead of modifying the properties of each individual bar, -the bars from the `hist` function could either be grouped in -a PatchCollection, or be assigned a class="hist_##" attribute. - -CSS could also be used more extensively to replace repetitive markup -throughout the generated SVG. - -Author: david.huard@gmail.com - -""" - - -import numpy as np -import matplotlib.pyplot as plt -import xml.etree.ElementTree as ET -from io import BytesIO -import json - - -plt.rcParams['svg.fonttype'] = 'none' - -# Apparently, this `register_namespace` method works only with -# python 2.7 and up and is necessary to avoid garbling the XML name -# space with ns0. -ET.register_namespace("", "http://www.w3.org/2000/svg") - - -# --- Create histogram, legend and title --- -plt.figure() -r = np.random.randn(100) -r1 = r + 1 -labels = ['Rabbits', 'Frogs'] -H = plt.hist([r, r1], label=labels) -containers = H[-1] -leg = plt.legend(frameon=False) -plt.title("From a web browser, click on the legend\n" - "marker to toggle the corresponding histogram.") - - -# --- Add ids to the svg objects we'll modify - -hist_patches = {} -for ic, c in enumerate(containers): - hist_patches['hist_%d' % ic] = [] - for il, element in enumerate(c): - element.set_gid('hist_%d_patch_%d' % (ic, il)) - hist_patches['hist_%d' % ic].append('hist_%d_patch_%d' % (ic, il)) - -# Set ids for the legend patches -for i, t in enumerate(leg.get_patches()): - t.set_gid('leg_patch_%d' % i) - -# Set ids for the text patches -for i, t in enumerate(leg.get_texts()): - t.set_gid('leg_text_%d' % i) - -# Save SVG in a fake file object. -f = BytesIO() -plt.savefig(f, format="svg") - -# Create XML tree from the SVG file. -tree, xmlid = ET.XMLID(f.getvalue()) - - -# --- Add interactivity --- - -# Add attributes to the patch objects. -for i, t in enumerate(leg.get_patches()): - el = xmlid['leg_patch_%d' % i] - el.set('cursor', 'pointer') - el.set('onclick', "toggle_hist(this)") - -# Add attributes to the text objects. -for i, t in enumerate(leg.get_texts()): - el = xmlid['leg_text_%d' % i] - el.set('cursor', 'pointer') - el.set('onclick', "toggle_hist(this)") - -# Create script defining the function `toggle_hist`. -# We create a global variable `container` that stores the patches id -# belonging to each histogram. Then a function "toggle_element" sets the -# visibility attribute of all patches of each histogram and the opacity -# of the marker itself. - -script = """ - -""" % json.dumps(hist_patches) - -# Add a transition effect -css = tree.getchildren()[0][0] -css.text = css.text + "g {-webkit-transition:opacity 0.4s ease-out;" + \ - "-moz-transition:opacity 0.4s ease-out;}" - -# Insert the script and save to file. -tree.insert(0, ET.XML(script)) - -ET.ElementTree(tree).write("svg_histogram.svg") diff --git a/examples/user_interfaces/svg_tooltip.html b/examples/user_interfaces/svg_tooltip.html deleted file mode 100644 index 70bae6c1f44..00000000000 --- a/examples/user_interfaces/svg_tooltip.html +++ /dev/null @@ -1,426 +0,0 @@ - - - - - - - - user_interfaces example code: svg_tooltip.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: svg_tooltip.py

-

[source code]

-
"""
-SVG tooltip example
-===================
-
-This example shows how to create a tooltip that will show up when
-hovering over a matplotlib patch.
-
-Although it is possible to create the tooltip from CSS or javascript,
-here we create it in matplotlib and simply toggle its visibility on
-when hovering over the patch. This approach provides total control over
-the tooltip placement and appearance, at the expense of more code up
-front.
-
-The alternative approach would be to put the tooltip content in `title`
-attributes of SVG objects. Then, using an existing js/CSS library, it
-would be relatively straightforward to create the tooltip in the
-browser. The content would be dictated by the `title` attribute, and
-the appearance by the CSS.
-
-
-:author: David Huard
-"""
-
-
-import matplotlib.pyplot as plt
-import xml.etree.ElementTree as ET
-from io import BytesIO
-
-ET.register_namespace("", "http://www.w3.org/2000/svg")
-
-fig, ax = plt.subplots()
-
-# Create patches to which tooltips will be assigned.
-rect1 = plt.Rectangle((10, -20), 10, 5, fc='blue')
-rect2 = plt.Rectangle((-20, 15), 10, 5, fc='green')
-
-shapes = [rect1, rect2]
-labels = ['This is a blue rectangle.', 'This is a green rectangle']
-
-for i, (item, label) in enumerate(zip(shapes, labels)):
-    patch = ax.add_patch(item)
-    annotate = ax.annotate(labels[i], xy=item.get_xy(), xytext=(0, 0),
-                           textcoords='offset points', color='w', ha='center',
-                           fontsize=8, bbox=dict(boxstyle='round, pad=.5',
-                                                 fc=(.1, .1, .1, .92),
-                                                 ec=(1., 1., 1.), lw=1,
-                                                 zorder=1))
-
-    ax.add_patch(patch)
-    patch.set_gid('mypatch_{:03d}'.format(i))
-    annotate.set_gid('mytooltip_{:03d}'.format(i))
-
-# Save the figure in a fake file object
-ax.set_xlim(-30, 30)
-ax.set_ylim(-30, 30)
-ax.set_aspect('equal')
-
-f = BytesIO()
-plt.savefig(f, format="svg")
-
-# --- Add interactivity ---
-
-# Create XML tree from the SVG file.
-tree, xmlid = ET.XMLID(f.getvalue())
-tree.set('onload', 'init(evt)')
-
-for i in shapes:
-    # Get the index of the shape
-    index = shapes.index(i)
-    # Hide the tooltips
-    tooltip = xmlid['mytooltip_{:03d}'.format(index)]
-    tooltip.set('visibility', 'hidden')
-    # Assign onmouseover and onmouseout callbacks to patches.
-    mypatch = xmlid['mypatch_{:03d}'.format(index)]
-    mypatch.set('onmouseover', "ShowTooltip(this)")
-    mypatch.set('onmouseout', "HideTooltip(this)")
-
-# This is the script defining the ShowTooltip and HideTooltip functions.
-script = """
-    <script type="text/ecmascript">
-    <![CDATA[
-
-    function init(evt) {
-        if ( window.svgDocument == null ) {
-            svgDocument = evt.target.ownerDocument;
-            }
-        }
-
-    function ShowTooltip(obj) {
-        var cur = obj.id.split("_")[1];
-        var tip = svgDocument.getElementById('mytooltip_' + cur);
-        tip.setAttribute('visibility',"visible")
-        }
-
-    function HideTooltip(obj) {
-        var cur = obj.id.split("_")[1];
-        var tip = svgDocument.getElementById('mytooltip_' + cur);
-        tip.setAttribute('visibility',"hidden")
-        }
-
-    ]]>
-    </script>
-    """
-
-# Insert the script at the top of the file and save it.
-tree.insert(0, ET.XML(script))
-ET.ElementTree(tree).write('svg_tooltip.svg')
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/svg_tooltip.py b/examples/user_interfaces/svg_tooltip.py deleted file mode 100644 index 33556022513..00000000000 --- a/examples/user_interfaces/svg_tooltip.py +++ /dev/null @@ -1,107 +0,0 @@ -""" -SVG tooltip example -=================== - -This example shows how to create a tooltip that will show up when -hovering over a matplotlib patch. - -Although it is possible to create the tooltip from CSS or javascript, -here we create it in matplotlib and simply toggle its visibility on -when hovering over the patch. This approach provides total control over -the tooltip placement and appearance, at the expense of more code up -front. - -The alternative approach would be to put the tooltip content in `title` -attributes of SVG objects. Then, using an existing js/CSS library, it -would be relatively straightforward to create the tooltip in the -browser. The content would be dictated by the `title` attribute, and -the appearance by the CSS. - - -:author: David Huard -""" - - -import matplotlib.pyplot as plt -import xml.etree.ElementTree as ET -from io import BytesIO - -ET.register_namespace("", "http://www.w3.org/2000/svg") - -fig, ax = plt.subplots() - -# Create patches to which tooltips will be assigned. -rect1 = plt.Rectangle((10, -20), 10, 5, fc='blue') -rect2 = plt.Rectangle((-20, 15), 10, 5, fc='green') - -shapes = [rect1, rect2] -labels = ['This is a blue rectangle.', 'This is a green rectangle'] - -for i, (item, label) in enumerate(zip(shapes, labels)): - patch = ax.add_patch(item) - annotate = ax.annotate(labels[i], xy=item.get_xy(), xytext=(0, 0), - textcoords='offset points', color='w', ha='center', - fontsize=8, bbox=dict(boxstyle='round, pad=.5', - fc=(.1, .1, .1, .92), - ec=(1., 1., 1.), lw=1, - zorder=1)) - - ax.add_patch(patch) - patch.set_gid('mypatch_{:03d}'.format(i)) - annotate.set_gid('mytooltip_{:03d}'.format(i)) - -# Save the figure in a fake file object -ax.set_xlim(-30, 30) -ax.set_ylim(-30, 30) -ax.set_aspect('equal') - -f = BytesIO() -plt.savefig(f, format="svg") - -# --- Add interactivity --- - -# Create XML tree from the SVG file. -tree, xmlid = ET.XMLID(f.getvalue()) -tree.set('onload', 'init(evt)') - -for i in shapes: - # Get the index of the shape - index = shapes.index(i) - # Hide the tooltips - tooltip = xmlid['mytooltip_{:03d}'.format(index)] - tooltip.set('visibility', 'hidden') - # Assign onmouseover and onmouseout callbacks to patches. - mypatch = xmlid['mypatch_{:03d}'.format(index)] - mypatch.set('onmouseover', "ShowTooltip(this)") - mypatch.set('onmouseout', "HideTooltip(this)") - -# This is the script defining the ShowTooltip and HideTooltip functions. -script = """ - - """ - -# Insert the script at the top of the file and save it. -tree.insert(0, ET.XML(script)) -ET.ElementTree(tree).write('svg_tooltip.svg') diff --git a/examples/user_interfaces/toolmanager.html b/examples/user_interfaces/toolmanager.html deleted file mode 100644 index df5d5817b95..00000000000 --- a/examples/user_interfaces/toolmanager.html +++ /dev/null @@ -1,411 +0,0 @@ - - - - - - - - user_interfaces example code: toolmanager.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: toolmanager.py

-

[source code]

-
'''This example demonstrates how to:
-* Modify the Toolbar
-* Create tools
-* Add tools
-* Remove tools
-Using `matplotlib.backend_managers.ToolManager`
-'''
-
-
-from __future__ import print_function
-import matplotlib
-matplotlib.use('GTK3Cairo')
-matplotlib.rcParams['toolbar'] = 'toolmanager'
-import matplotlib.pyplot as plt
-from matplotlib.backend_tools import ToolBase, ToolToggleBase
-from gi.repository import Gtk, Gdk
-
-
-class ListTools(ToolBase):
-    '''List all the tools controlled by the `ToolManager`'''
-    # keyboard shortcut
-    default_keymap = 'm'
-    description = 'List Tools'
-
-    def trigger(self, *args, **kwargs):
-        print('_' * 80)
-        print("{0:12} {1:45} {2}".format('Name (id)',
-                                         'Tool description',
-                                         'Keymap'))
-        print('-' * 80)
-        tools = self.toolmanager.tools
-        for name in sorted(tools.keys()):
-            if not tools[name].description:
-                continue
-            keys = ', '.join(sorted(self.toolmanager.get_tool_keymap(name)))
-            print("{0:12} {1:45} {2}".format(name,
-                                             tools[name].description,
-                                             keys))
-        print('_' * 80)
-        print("Active Toggle tools")
-        print("{0:12} {1:45}".format("Group", "Active"))
-        print('-' * 80)
-        for group, active in self.toolmanager.active_toggle.items():
-            print("{0:12} {1:45}".format(group, active))
-
-
-class GroupHideTool(ToolToggleBase):
-    '''Hide lines with a given gid'''
-    default_keymap = 'G'
-    description = 'Hide by gid'
-
-    def __init__(self, *args, **kwargs):
-        self.gid = kwargs.pop('gid')
-        ToolToggleBase.__init__(self, *args, **kwargs)
-
-    def enable(self, *args):
-        self.set_lines_visibility(False)
-
-    def disable(self, *args):
-        self.set_lines_visibility(True)
-
-    def set_lines_visibility(self, state):
-        gr_lines = []
-        for ax in self.figure.get_axes():
-            for line in ax.get_lines():
-                if line.get_gid() == self.gid:
-                    line.set_visible(state)
-        self.figure.canvas.draw()
-
-
-fig = plt.figure()
-plt.plot([1, 2, 3], gid='mygroup')
-plt.plot([2, 3, 4], gid='unknown')
-plt.plot([3, 2, 1], gid='mygroup')
-
-# Add the custom tools that we created
-fig.canvas.manager.toolmanager.add_tool('List', ListTools)
-fig.canvas.manager.toolmanager.add_tool('Hide', GroupHideTool, gid='mygroup')
-
-
-# Add an existing tool to new group `foo`.
-# It can be added as many times as we want
-fig.canvas.manager.toolbar.add_tool('zoom', 'foo')
-
-# Remove the forward button
-fig.canvas.manager.toolmanager.remove_tool('forward')
-
-# To add a custom tool to the toolbar at specific location inside
-# the navigation group
-fig.canvas.manager.toolbar.add_tool('Hide', 'navigation', 1)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/toolmanager.py b/examples/user_interfaces/toolmanager.py deleted file mode 100644 index 5240bab239c..00000000000 --- a/examples/user_interfaces/toolmanager.py +++ /dev/null @@ -1,92 +0,0 @@ -'''This example demonstrates how to: -* Modify the Toolbar -* Create tools -* Add tools -* Remove tools -Using `matplotlib.backend_managers.ToolManager` -''' - - -from __future__ import print_function -import matplotlib -matplotlib.use('GTK3Cairo') -matplotlib.rcParams['toolbar'] = 'toolmanager' -import matplotlib.pyplot as plt -from matplotlib.backend_tools import ToolBase, ToolToggleBase -from gi.repository import Gtk, Gdk - - -class ListTools(ToolBase): - '''List all the tools controlled by the `ToolManager`''' - # keyboard shortcut - default_keymap = 'm' - description = 'List Tools' - - def trigger(self, *args, **kwargs): - print('_' * 80) - print("{0:12} {1:45} {2}".format('Name (id)', - 'Tool description', - 'Keymap')) - print('-' * 80) - tools = self.toolmanager.tools - for name in sorted(tools.keys()): - if not tools[name].description: - continue - keys = ', '.join(sorted(self.toolmanager.get_tool_keymap(name))) - print("{0:12} {1:45} {2}".format(name, - tools[name].description, - keys)) - print('_' * 80) - print("Active Toggle tools") - print("{0:12} {1:45}".format("Group", "Active")) - print('-' * 80) - for group, active in self.toolmanager.active_toggle.items(): - print("{0:12} {1:45}".format(group, active)) - - -class GroupHideTool(ToolToggleBase): - '''Hide lines with a given gid''' - default_keymap = 'G' - description = 'Hide by gid' - - def __init__(self, *args, **kwargs): - self.gid = kwargs.pop('gid') - ToolToggleBase.__init__(self, *args, **kwargs) - - def enable(self, *args): - self.set_lines_visibility(False) - - def disable(self, *args): - self.set_lines_visibility(True) - - def set_lines_visibility(self, state): - gr_lines = [] - for ax in self.figure.get_axes(): - for line in ax.get_lines(): - if line.get_gid() == self.gid: - line.set_visible(state) - self.figure.canvas.draw() - - -fig = plt.figure() -plt.plot([1, 2, 3], gid='mygroup') -plt.plot([2, 3, 4], gid='unknown') -plt.plot([3, 2, 1], gid='mygroup') - -# Add the custom tools that we created -fig.canvas.manager.toolmanager.add_tool('List', ListTools) -fig.canvas.manager.toolmanager.add_tool('Hide', GroupHideTool, gid='mygroup') - - -# Add an existing tool to new group `foo`. -# It can be added as many times as we want -fig.canvas.manager.toolbar.add_tool('zoom', 'foo') - -# Remove the forward button -fig.canvas.manager.toolmanager.remove_tool('forward') - -# To add a custom tool to the toolbar at specific location inside -# the navigation group -fig.canvas.manager.toolbar.add_tool('Hide', 'navigation', 1) - -plt.show() diff --git a/examples/user_interfaces/wxcursor_demo.html b/examples/user_interfaces/wxcursor_demo.html deleted file mode 100644 index 22bda4f318f..00000000000 --- a/examples/user_interfaces/wxcursor_demo.html +++ /dev/null @@ -1,394 +0,0 @@ - - - - - - - - user_interfaces example code: wxcursor_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

user_interfaces example code: wxcursor_demo.py

-

[source code]

-
"""
-Example to draw a cursor and report the data coords in wx
-"""
-# matplotlib requires wxPython 2.8+
-# set the wxPython version in lib\site-packages\wx.pth file
-# or if you have wxversion installed un-comment the lines below
-#import wxversion
-#wxversion.ensureMinimal('2.8')
-
-import matplotlib
-matplotlib.use('WXAgg')
-
-from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
-from matplotlib.backends.backend_wx import NavigationToolbar2Wx, wxc
-from matplotlib.figure import Figure
-from numpy import arange, sin, pi
-
-import wx
-
-
-class CanvasFrame(wx.Frame):
-    def __init__(self, ):
-        wx.Frame.__init__(self, None, -1,
-                          'CanvasFrame', size=(550, 350))
-
-        self.SetBackgroundColour(wxc.NamedColour("WHITE"))
-
-        self.figure = Figure()
-        self.axes = self.figure.add_subplot(111)
-        t = arange(0.0, 3.0, 0.01)
-        s = sin(2*pi*t)
-
-        self.axes.plot(t, s)
-        self.axes.set_xlabel('t')
-        self.axes.set_ylabel('sin(t)')
-        self.figure_canvas = FigureCanvas(self, -1, self.figure)
-
-        # Note that event is a MplEvent
-        self.figure_canvas.mpl_connect('motion_notify_event', self.UpdateStatusBar)
-        self.figure_canvas.Bind(wx.EVT_ENTER_WINDOW, self.ChangeCursor)
-
-        self.sizer = wx.BoxSizer(wx.VERTICAL)
-        self.sizer.Add(self.figure_canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
-        self.SetSizer(self.sizer)
-        self.Fit()
-
-        self.statusBar = wx.StatusBar(self, -1)
-        self.SetStatusBar(self.statusBar)
-
-        self.toolbar = NavigationToolbar2Wx(self.figure_canvas)
-        self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND)
-        self.toolbar.Show()
-
-    def ChangeCursor(self, event):
-        self.figure_canvas.SetCursor(wxc.StockCursor(wx.CURSOR_BULLSEYE))
-
-    def UpdateStatusBar(self, event):
-        if event.inaxes:
-            x, y = event.xdata, event.ydata
-            self.statusBar.SetStatusText(("x= " + str(x) +
-                                          "  y=" + str(y)),
-                                         0)
-
-
-class App(wx.App):
-    def OnInit(self):
-        'Create the main window and insert the custom frame'
-        frame = CanvasFrame()
-        self.SetTopWindow(frame)
-        frame.Show(True)
-        return True
-
-if __name__ == '__main__':
-    app = App(0)
-    app.MainLoop()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/user_interfaces/wxcursor_demo.py b/examples/user_interfaces/wxcursor_demo.py deleted file mode 100644 index eab1562c1bc..00000000000 --- a/examples/user_interfaces/wxcursor_demo.py +++ /dev/null @@ -1,75 +0,0 @@ -""" -Example to draw a cursor and report the data coords in wx -""" -# matplotlib requires wxPython 2.8+ -# set the wxPython version in lib\site-packages\wx.pth file -# or if you have wxversion installed un-comment the lines below -#import wxversion -#wxversion.ensureMinimal('2.8') - -import matplotlib -matplotlib.use('WXAgg') - -from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas -from matplotlib.backends.backend_wx import NavigationToolbar2Wx, wxc -from matplotlib.figure import Figure -from numpy import arange, sin, pi - -import wx - - -class CanvasFrame(wx.Frame): - def __init__(self, ): - wx.Frame.__init__(self, None, -1, - 'CanvasFrame', size=(550, 350)) - - self.SetBackgroundColour(wxc.NamedColour("WHITE")) - - self.figure = Figure() - self.axes = self.figure.add_subplot(111) - t = arange(0.0, 3.0, 0.01) - s = sin(2*pi*t) - - self.axes.plot(t, s) - self.axes.set_xlabel('t') - self.axes.set_ylabel('sin(t)') - self.figure_canvas = FigureCanvas(self, -1, self.figure) - - # Note that event is a MplEvent - self.figure_canvas.mpl_connect('motion_notify_event', self.UpdateStatusBar) - self.figure_canvas.Bind(wx.EVT_ENTER_WINDOW, self.ChangeCursor) - - self.sizer = wx.BoxSizer(wx.VERTICAL) - self.sizer.Add(self.figure_canvas, 1, wx.LEFT | wx.TOP | wx.GROW) - self.SetSizer(self.sizer) - self.Fit() - - self.statusBar = wx.StatusBar(self, -1) - self.SetStatusBar(self.statusBar) - - self.toolbar = NavigationToolbar2Wx(self.figure_canvas) - self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) - self.toolbar.Show() - - def ChangeCursor(self, event): - self.figure_canvas.SetCursor(wxc.StockCursor(wx.CURSOR_BULLSEYE)) - - def UpdateStatusBar(self, event): - if event.inaxes: - x, y = event.xdata, event.ydata - self.statusBar.SetStatusText(("x= " + str(x) + - " y=" + str(y)), - 0) - - -class App(wx.App): - def OnInit(self): - 'Create the main window and insert the custom frame' - frame = CanvasFrame() - self.SetTopWindow(frame) - frame.Show(True) - return True - -if __name__ == '__main__': - app = App(0) - app.MainLoop() diff --git a/examples/widgets/buttons.html b/examples/widgets/buttons.html deleted file mode 100644 index c28d53fbbca..00000000000 --- a/examples/widgets/buttons.html +++ /dev/null @@ -1,358 +0,0 @@ - - - - - - - - widgets example code: buttons.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

widgets example code: buttons.py

-

[source code]

-
import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.widgets import Button
-
-freqs = np.arange(2, 20, 3)
-
-fig, ax = plt.subplots()
-plt.subplots_adjust(bottom=0.2)
-t = np.arange(0.0, 1.0, 0.001)
-s = np.sin(2*np.pi*freqs[0]*t)
-l, = plt.plot(t, s, lw=2)
-
-
-class Index(object):
-    ind = 0
-
-    def next(self, event):
-        self.ind += 1
-        i = self.ind % len(freqs)
-        ydata = np.sin(2*np.pi*freqs[i]*t)
-        l.set_ydata(ydata)
-        plt.draw()
-
-    def prev(self, event):
-        self.ind -= 1
-        i = self.ind % len(freqs)
-        ydata = np.sin(2*np.pi*freqs[i]*t)
-        l.set_ydata(ydata)
-        plt.draw()
-
-callback = Index()
-axprev = plt.axes([0.7, 0.05, 0.1, 0.075])
-axnext = plt.axes([0.81, 0.05, 0.1, 0.075])
-bnext = Button(axnext, 'Next')
-bnext.on_clicked(callback.next)
-bprev = Button(axprev, 'Previous')
-bprev.on_clicked(callback.prev)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/widgets/buttons.py b/examples/widgets/buttons.py deleted file mode 100644 index d2655211cca..00000000000 --- a/examples/widgets/buttons.py +++ /dev/null @@ -1,40 +0,0 @@ - -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.widgets import Button - -freqs = np.arange(2, 20, 3) - -fig, ax = plt.subplots() -plt.subplots_adjust(bottom=0.2) -t = np.arange(0.0, 1.0, 0.001) -s = np.sin(2*np.pi*freqs[0]*t) -l, = plt.plot(t, s, lw=2) - - -class Index(object): - ind = 0 - - def next(self, event): - self.ind += 1 - i = self.ind % len(freqs) - ydata = np.sin(2*np.pi*freqs[i]*t) - l.set_ydata(ydata) - plt.draw() - - def prev(self, event): - self.ind -= 1 - i = self.ind % len(freqs) - ydata = np.sin(2*np.pi*freqs[i]*t) - l.set_ydata(ydata) - plt.draw() - -callback = Index() -axprev = plt.axes([0.7, 0.05, 0.1, 0.075]) -axnext = plt.axes([0.81, 0.05, 0.1, 0.075]) -bnext = Button(axnext, 'Next') -bnext.on_clicked(callback.next) -bprev = Button(axprev, 'Previous') -bprev.on_clicked(callback.prev) - -plt.show() diff --git a/examples/widgets/check_buttons.html b/examples/widgets/check_buttons.html deleted file mode 100644 index bf697b91424..00000000000 --- a/examples/widgets/check_buttons.html +++ /dev/null @@ -1,349 +0,0 @@ - - - - - - - - widgets example code: check_buttons.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

widgets example code: check_buttons.py

-

[source code]

-
import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.widgets import CheckButtons
-
-t = np.arange(0.0, 2.0, 0.01)
-s0 = np.sin(2*np.pi*t)
-s1 = np.sin(4*np.pi*t)
-s2 = np.sin(6*np.pi*t)
-
-fig, ax = plt.subplots()
-l0, = ax.plot(t, s0, visible=False, lw=2)
-l1, = ax.plot(t, s1, lw=2)
-l2, = ax.plot(t, s2, lw=2)
-plt.subplots_adjust(left=0.2)
-
-rax = plt.axes([0.05, 0.4, 0.1, 0.15])
-check = CheckButtons(rax, ('2 Hz', '4 Hz', '6 Hz'), (False, True, True))
-
-
-def func(label):
-    if label == '2 Hz':
-        l0.set_visible(not l0.get_visible())
-    elif label == '4 Hz':
-        l1.set_visible(not l1.get_visible())
-    elif label == '6 Hz':
-        l2.set_visible(not l2.get_visible())
-    plt.draw()
-check.on_clicked(func)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/widgets/check_buttons.py b/examples/widgets/check_buttons.py deleted file mode 100644 index 936e6d96341..00000000000 --- a/examples/widgets/check_buttons.py +++ /dev/null @@ -1,30 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.widgets import CheckButtons - -t = np.arange(0.0, 2.0, 0.01) -s0 = np.sin(2*np.pi*t) -s1 = np.sin(4*np.pi*t) -s2 = np.sin(6*np.pi*t) - -fig, ax = plt.subplots() -l0, = ax.plot(t, s0, visible=False, lw=2) -l1, = ax.plot(t, s1, lw=2) -l2, = ax.plot(t, s2, lw=2) -plt.subplots_adjust(left=0.2) - -rax = plt.axes([0.05, 0.4, 0.1, 0.15]) -check = CheckButtons(rax, ('2 Hz', '4 Hz', '6 Hz'), (False, True, True)) - - -def func(label): - if label == '2 Hz': - l0.set_visible(not l0.get_visible()) - elif label == '4 Hz': - l1.set_visible(not l1.get_visible()) - elif label == '6 Hz': - l2.set_visible(not l2.get_visible()) - plt.draw() -check.on_clicked(func) - -plt.show() diff --git a/examples/widgets/cursor.html b/examples/widgets/cursor.html deleted file mode 100644 index 0c47600b3f1..00000000000 --- a/examples/widgets/cursor.html +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - - - widgets example code: cursor.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

widgets example code: cursor.py

-

[source code]

-
from matplotlib.widgets import Cursor
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-fig = plt.figure(figsize=(8, 6))
-ax = fig.add_subplot(111, facecolor='#FFFFCC')
-
-x, y = 4*(np.random.rand(2, 100) - .5)
-ax.plot(x, y, 'o')
-ax.set_xlim(-2, 2)
-ax.set_ylim(-2, 2)
-
-# set useblit = True on gtkagg for enhanced performance
-cursor = Cursor(ax, useblit=True, color='red', linewidth=2)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/widgets/cursor.py b/examples/widgets/cursor.py deleted file mode 100644 index 209223b72a1..00000000000 --- a/examples/widgets/cursor.py +++ /dev/null @@ -1,17 +0,0 @@ -from matplotlib.widgets import Cursor -import numpy as np -import matplotlib.pyplot as plt - - -fig = plt.figure(figsize=(8, 6)) -ax = fig.add_subplot(111, facecolor='#FFFFCC') - -x, y = 4*(np.random.rand(2, 100) - .5) -ax.plot(x, y, 'o') -ax.set_xlim(-2, 2) -ax.set_ylim(-2, 2) - -# set useblit = True on gtkagg for enhanced performance -cursor = Cursor(ax, useblit=True, color='red', linewidth=2) - -plt.show() diff --git a/examples/widgets/index.html b/examples/widgets/index.html deleted file mode 100644 index a90468c0318..00000000000 --- a/examples/widgets/index.html +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - - - widgets Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

widgets Examples

- --- - - - - - -
Release:2.0.2
Date:May 10, 2017
- -
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/widgets/lasso_selector_demo.html b/examples/widgets/lasso_selector_demo.html deleted file mode 100644 index e2cf4cc0b1a..00000000000 --- a/examples/widgets/lasso_selector_demo.html +++ /dev/null @@ -1,405 +0,0 @@ - - - - - - - - widgets example code: lasso_selector_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

widgets example code: lasso_selector_demo.py

-

[source code]

-
from __future__ import print_function
-
-from six.moves import input
-
-import numpy as np
-
-from matplotlib.widgets import LassoSelector
-from matplotlib.path import Path
-
-
-class SelectFromCollection(object):
-    """Select indices from a matplotlib collection using `LassoSelector`.
-
-    Selected indices are saved in the `ind` attribute. This tool highlights
-    selected points by fading them out (i.e., reducing their alpha values).
-    If your collection has alpha < 1, this tool will permanently alter them.
-
-    Note that this tool selects collection objects based on their *origins*
-    (i.e., `offsets`).
-
-    Parameters
-    ----------
-    ax : :class:`~matplotlib.axes.Axes`
-        Axes to interact with.
-
-    collection : :class:`matplotlib.collections.Collection` subclass
-        Collection you want to select from.
-
-    alpha_other : 0 <= float <= 1
-        To highlight a selection, this tool sets all selected points to an
-        alpha value of 1 and non-selected points to `alpha_other`.
-    """
-
-    def __init__(self, ax, collection, alpha_other=0.3):
-        self.canvas = ax.figure.canvas
-        self.collection = collection
-        self.alpha_other = alpha_other
-
-        self.xys = collection.get_offsets()
-        self.Npts = len(self.xys)
-
-        # Ensure that we have separate colors for each object
-        self.fc = collection.get_facecolors()
-        if len(self.fc) == 0:
-            raise ValueError('Collection must have a facecolor')
-        elif len(self.fc) == 1:
-            self.fc = np.tile(self.fc, self.Npts).reshape(self.Npts, -1)
-
-        self.lasso = LassoSelector(ax, onselect=self.onselect)
-        self.ind = []
-
-    def onselect(self, verts):
-        path = Path(verts)
-        self.ind = np.nonzero([path.contains_point(xy) for xy in self.xys])[0]
-        self.fc[:, -1] = self.alpha_other
-        self.fc[self.ind, -1] = 1
-        self.collection.set_facecolors(self.fc)
-        self.canvas.draw_idle()
-
-    def disconnect(self):
-        self.lasso.disconnect_events()
-        self.fc[:, -1] = 1
-        self.collection.set_facecolors(self.fc)
-        self.canvas.draw_idle()
-
-
-if __name__ == '__main__':
-    import matplotlib.pyplot as plt
-
-    plt.ion()
-    data = np.random.rand(100, 2)
-
-    subplot_kw = dict(xlim=(0, 1), ylim=(0, 1), autoscale_on=False)
-    fig, ax = plt.subplots(subplot_kw=subplot_kw)
-
-    pts = ax.scatter(data[:, 0], data[:, 1], s=80)
-    selector = SelectFromCollection(ax, pts)
-
-    plt.draw()
-    input('Press Enter to accept selected points')
-    print("Selected points:")
-    print(selector.xys[selector.ind])
-    selector.disconnect()
-
-    # Block end of script so you can check that the lasso is disconnected.
-    input('Press Enter to quit')
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/widgets/lasso_selector_demo.py b/examples/widgets/lasso_selector_demo.py deleted file mode 100644 index 3f5b47fa81f..00000000000 --- a/examples/widgets/lasso_selector_demo.py +++ /dev/null @@ -1,86 +0,0 @@ -from __future__ import print_function - -from six.moves import input - -import numpy as np - -from matplotlib.widgets import LassoSelector -from matplotlib.path import Path - - -class SelectFromCollection(object): - """Select indices from a matplotlib collection using `LassoSelector`. - - Selected indices are saved in the `ind` attribute. This tool highlights - selected points by fading them out (i.e., reducing their alpha values). - If your collection has alpha < 1, this tool will permanently alter them. - - Note that this tool selects collection objects based on their *origins* - (i.e., `offsets`). - - Parameters - ---------- - ax : :class:`~matplotlib.axes.Axes` - Axes to interact with. - - collection : :class:`matplotlib.collections.Collection` subclass - Collection you want to select from. - - alpha_other : 0 <= float <= 1 - To highlight a selection, this tool sets all selected points to an - alpha value of 1 and non-selected points to `alpha_other`. - """ - - def __init__(self, ax, collection, alpha_other=0.3): - self.canvas = ax.figure.canvas - self.collection = collection - self.alpha_other = alpha_other - - self.xys = collection.get_offsets() - self.Npts = len(self.xys) - - # Ensure that we have separate colors for each object - self.fc = collection.get_facecolors() - if len(self.fc) == 0: - raise ValueError('Collection must have a facecolor') - elif len(self.fc) == 1: - self.fc = np.tile(self.fc, self.Npts).reshape(self.Npts, -1) - - self.lasso = LassoSelector(ax, onselect=self.onselect) - self.ind = [] - - def onselect(self, verts): - path = Path(verts) - self.ind = np.nonzero([path.contains_point(xy) for xy in self.xys])[0] - self.fc[:, -1] = self.alpha_other - self.fc[self.ind, -1] = 1 - self.collection.set_facecolors(self.fc) - self.canvas.draw_idle() - - def disconnect(self): - self.lasso.disconnect_events() - self.fc[:, -1] = 1 - self.collection.set_facecolors(self.fc) - self.canvas.draw_idle() - - -if __name__ == '__main__': - import matplotlib.pyplot as plt - - plt.ion() - data = np.random.rand(100, 2) - - subplot_kw = dict(xlim=(0, 1), ylim=(0, 1), autoscale_on=False) - fig, ax = plt.subplots(subplot_kw=subplot_kw) - - pts = ax.scatter(data[:, 0], data[:, 1], s=80) - selector = SelectFromCollection(ax, pts) - - plt.draw() - input('Press Enter to accept selected points') - print("Selected points:") - print(selector.xys[selector.ind]) - selector.disconnect() - - # Block end of script so you can check that the lasso is disconnected. - input('Press Enter to quit') diff --git a/examples/widgets/menu.html b/examples/widgets/menu.html deleted file mode 100644 index 1c5eb548090..00000000000 --- a/examples/widgets/menu.html +++ /dev/null @@ -1,495 +0,0 @@ - - - - - - - - widgets example code: menu.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

widgets example code: menu.py

-

[source code]

-
from __future__ import division, print_function
-import numpy as np
-import matplotlib
-import matplotlib.colors as colors
-import matplotlib.patches as patches
-import matplotlib.mathtext as mathtext
-import matplotlib.pyplot as plt
-import matplotlib.artist as artist
-import matplotlib.image as image
-
-
-class ItemProperties(object):
-    def __init__(self, fontsize=14, labelcolor='black', bgcolor='yellow',
-                 alpha=1.0):
-        self.fontsize = fontsize
-        self.labelcolor = labelcolor
-        self.bgcolor = bgcolor
-        self.alpha = alpha
-
-        self.labelcolor_rgb = colors.to_rgba(labelcolor)[:3]
-        self.bgcolor_rgb = colors.to_rgba(bgcolor)[:3]
-
-
-class MenuItem(artist.Artist):
-    parser = mathtext.MathTextParser("Bitmap")
-    padx = 5
-    pady = 5
-
-    def __init__(self, fig, labelstr, props=None, hoverprops=None,
-                 on_select=None):
-        artist.Artist.__init__(self)
-
-        self.set_figure(fig)
-        self.labelstr = labelstr
-
-        if props is None:
-            props = ItemProperties()
-
-        if hoverprops is None:
-            hoverprops = ItemProperties()
-
-        self.props = props
-        self.hoverprops = hoverprops
-
-        self.on_select = on_select
-
-        x, self.depth = self.parser.to_mask(
-            labelstr, fontsize=props.fontsize, dpi=fig.dpi)
-
-        if props.fontsize != hoverprops.fontsize:
-            raise NotImplementedError(
-                'support for different font sizes not implemented')
-
-        self.labelwidth = x.shape[1]
-        self.labelheight = x.shape[0]
-
-        self.labelArray = np.zeros((x.shape[0], x.shape[1], 4))
-        self.labelArray[:, :, -1] = x/255.
-
-        self.label = image.FigureImage(fig, origin='upper')
-        self.label.set_array(self.labelArray)
-
-        # we'll update these later
-        self.rect = patches.Rectangle((0, 0), 1, 1)
-
-        self.set_hover_props(False)
-
-        fig.canvas.mpl_connect('button_release_event', self.check_select)
-
-    def check_select(self, event):
-        over, junk = self.rect.contains(event)
-        if not over:
-            return
-
-        if self.on_select is not None:
-            self.on_select(self)
-
-    def set_extent(self, x, y, w, h):
-        print(x, y, w, h)
-        self.rect.set_x(x)
-        self.rect.set_y(y)
-        self.rect.set_width(w)
-        self.rect.set_height(h)
-
-        self.label.ox = x + self.padx
-        self.label.oy = y - self.depth + self.pady/2.
-
-        self.rect._update_patch_transform()
-        self.hover = False
-
-    def draw(self, renderer):
-        self.rect.draw(renderer)
-        self.label.draw(renderer)
-
-    def set_hover_props(self, b):
-        if b:
-            props = self.hoverprops
-        else:
-            props = self.props
-
-        r, g, b = props.labelcolor_rgb
-        self.labelArray[:, :, 0] = r
-        self.labelArray[:, :, 1] = g
-        self.labelArray[:, :, 2] = b
-        self.label.set_array(self.labelArray)
-        self.rect.set(facecolor=props.bgcolor, alpha=props.alpha)
-
-    def set_hover(self, event):
-        'check the hover status of event and return true if status is changed'
-        b, junk = self.rect.contains(event)
-
-        changed = (b != self.hover)
-
-        if changed:
-            self.set_hover_props(b)
-
-        self.hover = b
-        return changed
-
-
-class Menu(object):
-    def __init__(self, fig, menuitems):
-        self.figure = fig
-        fig.suppressComposite = True
-
-        self.menuitems = menuitems
-        self.numitems = len(menuitems)
-
-        maxw = max([item.labelwidth for item in menuitems])
-        maxh = max([item.labelheight for item in menuitems])
-
-        totalh = self.numitems*maxh + (self.numitems + 1)*2*MenuItem.pady
-
-        x0 = 100
-        y0 = 400
-
-        width = maxw + 2*MenuItem.padx
-        height = maxh + MenuItem.pady
-
-        for item in menuitems:
-            left = x0
-            bottom = y0 - maxh - MenuItem.pady
-
-            item.set_extent(left, bottom, width, height)
-
-            fig.artists.append(item)
-            y0 -= maxh + MenuItem.pady
-
-        fig.canvas.mpl_connect('motion_notify_event', self.on_move)
-
-    def on_move(self, event):
-        draw = False
-        for item in self.menuitems:
-            draw = item.set_hover(event)
-            if draw:
-                self.figure.canvas.draw()
-                break
-
-
-fig = plt.figure()
-fig.subplots_adjust(left=0.3)
-props = ItemProperties(labelcolor='black', bgcolor='yellow',
-                       fontsize=15, alpha=0.2)
-hoverprops = ItemProperties(labelcolor='white', bgcolor='blue',
-                            fontsize=15, alpha=0.2)
-
-menuitems = []
-for label in ('open', 'close', 'save', 'save as', 'quit'):
-    def on_select(item):
-        print('you selected %s' % item.labelstr)
-    item = MenuItem(fig, label, props=props, hoverprops=hoverprops,
-                    on_select=on_select)
-    menuitems.append(item)
-
-menu = Menu(fig, menuitems)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/widgets/menu.py b/examples/widgets/menu.py deleted file mode 100644 index 846dd5ce191..00000000000 --- a/examples/widgets/menu.py +++ /dev/null @@ -1,176 +0,0 @@ -from __future__ import division, print_function -import numpy as np -import matplotlib -import matplotlib.colors as colors -import matplotlib.patches as patches -import matplotlib.mathtext as mathtext -import matplotlib.pyplot as plt -import matplotlib.artist as artist -import matplotlib.image as image - - -class ItemProperties(object): - def __init__(self, fontsize=14, labelcolor='black', bgcolor='yellow', - alpha=1.0): - self.fontsize = fontsize - self.labelcolor = labelcolor - self.bgcolor = bgcolor - self.alpha = alpha - - self.labelcolor_rgb = colors.to_rgba(labelcolor)[:3] - self.bgcolor_rgb = colors.to_rgba(bgcolor)[:3] - - -class MenuItem(artist.Artist): - parser = mathtext.MathTextParser("Bitmap") - padx = 5 - pady = 5 - - def __init__(self, fig, labelstr, props=None, hoverprops=None, - on_select=None): - artist.Artist.__init__(self) - - self.set_figure(fig) - self.labelstr = labelstr - - if props is None: - props = ItemProperties() - - if hoverprops is None: - hoverprops = ItemProperties() - - self.props = props - self.hoverprops = hoverprops - - self.on_select = on_select - - x, self.depth = self.parser.to_mask( - labelstr, fontsize=props.fontsize, dpi=fig.dpi) - - if props.fontsize != hoverprops.fontsize: - raise NotImplementedError( - 'support for different font sizes not implemented') - - self.labelwidth = x.shape[1] - self.labelheight = x.shape[0] - - self.labelArray = np.zeros((x.shape[0], x.shape[1], 4)) - self.labelArray[:, :, -1] = x/255. - - self.label = image.FigureImage(fig, origin='upper') - self.label.set_array(self.labelArray) - - # we'll update these later - self.rect = patches.Rectangle((0, 0), 1, 1) - - self.set_hover_props(False) - - fig.canvas.mpl_connect('button_release_event', self.check_select) - - def check_select(self, event): - over, junk = self.rect.contains(event) - if not over: - return - - if self.on_select is not None: - self.on_select(self) - - def set_extent(self, x, y, w, h): - print(x, y, w, h) - self.rect.set_x(x) - self.rect.set_y(y) - self.rect.set_width(w) - self.rect.set_height(h) - - self.label.ox = x + self.padx - self.label.oy = y - self.depth + self.pady/2. - - self.rect._update_patch_transform() - self.hover = False - - def draw(self, renderer): - self.rect.draw(renderer) - self.label.draw(renderer) - - def set_hover_props(self, b): - if b: - props = self.hoverprops - else: - props = self.props - - r, g, b = props.labelcolor_rgb - self.labelArray[:, :, 0] = r - self.labelArray[:, :, 1] = g - self.labelArray[:, :, 2] = b - self.label.set_array(self.labelArray) - self.rect.set(facecolor=props.bgcolor, alpha=props.alpha) - - def set_hover(self, event): - 'check the hover status of event and return true if status is changed' - b, junk = self.rect.contains(event) - - changed = (b != self.hover) - - if changed: - self.set_hover_props(b) - - self.hover = b - return changed - - -class Menu(object): - def __init__(self, fig, menuitems): - self.figure = fig - fig.suppressComposite = True - - self.menuitems = menuitems - self.numitems = len(menuitems) - - maxw = max([item.labelwidth for item in menuitems]) - maxh = max([item.labelheight for item in menuitems]) - - totalh = self.numitems*maxh + (self.numitems + 1)*2*MenuItem.pady - - x0 = 100 - y0 = 400 - - width = maxw + 2*MenuItem.padx - height = maxh + MenuItem.pady - - for item in menuitems: - left = x0 - bottom = y0 - maxh - MenuItem.pady - - item.set_extent(left, bottom, width, height) - - fig.artists.append(item) - y0 -= maxh + MenuItem.pady - - fig.canvas.mpl_connect('motion_notify_event', self.on_move) - - def on_move(self, event): - draw = False - for item in self.menuitems: - draw = item.set_hover(event) - if draw: - self.figure.canvas.draw() - break - - -fig = plt.figure() -fig.subplots_adjust(left=0.3) -props = ItemProperties(labelcolor='black', bgcolor='yellow', - fontsize=15, alpha=0.2) -hoverprops = ItemProperties(labelcolor='white', bgcolor='blue', - fontsize=15, alpha=0.2) - -menuitems = [] -for label in ('open', 'close', 'save', 'save as', 'quit'): - def on_select(item): - print('you selected %s' % item.labelstr) - item = MenuItem(fig, label, props=props, hoverprops=hoverprops, - on_select=on_select) - menuitems.append(item) - -menu = Menu(fig, menuitems) -plt.show() diff --git a/examples/widgets/multicursor.html b/examples/widgets/multicursor.html deleted file mode 100644 index e7f1143c357..00000000000 --- a/examples/widgets/multicursor.html +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - - - widgets example code: multicursor.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

widgets example code: multicursor.py

-

[source code]

-
import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.widgets import MultiCursor
-
-t = np.arange(0.0, 2.0, 0.01)
-s1 = np.sin(2*np.pi*t)
-s2 = np.sin(4*np.pi*t)
-fig = plt.figure()
-ax1 = fig.add_subplot(211)
-ax1.plot(t, s1)
-
-
-ax2 = fig.add_subplot(212, sharex=ax1)
-ax2.plot(t, s2)
-
-multi = MultiCursor(fig.canvas, (ax1, ax2), color='r', lw=1)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/widgets/multicursor.py b/examples/widgets/multicursor.py deleted file mode 100644 index f6c5a36bff8..00000000000 --- a/examples/widgets/multicursor.py +++ /dev/null @@ -1,17 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.widgets import MultiCursor - -t = np.arange(0.0, 2.0, 0.01) -s1 = np.sin(2*np.pi*t) -s2 = np.sin(4*np.pi*t) -fig = plt.figure() -ax1 = fig.add_subplot(211) -ax1.plot(t, s1) - - -ax2 = fig.add_subplot(212, sharex=ax1) -ax2.plot(t, s2) - -multi = MultiCursor(fig.canvas, (ax1, ax2), color='r', lw=1) -plt.show() diff --git a/examples/widgets/radio_buttons.html b/examples/widgets/radio_buttons.html deleted file mode 100644 index 586f6ae011a..00000000000 --- a/examples/widgets/radio_buttons.html +++ /dev/null @@ -1,363 +0,0 @@ - - - - - - - - widgets example code: radio_buttons.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

widgets example code: radio_buttons.py

-

[source code]

-
import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.widgets import RadioButtons
-
-t = np.arange(0.0, 2.0, 0.01)
-s0 = np.sin(2*np.pi*t)
-s1 = np.sin(4*np.pi*t)
-s2 = np.sin(8*np.pi*t)
-
-fig, ax = plt.subplots()
-l, = ax.plot(t, s0, lw=2, color='red')
-plt.subplots_adjust(left=0.3)
-
-axcolor = 'lightgoldenrodyellow'
-rax = plt.axes([0.05, 0.7, 0.15, 0.15], facecolor=axcolor)
-radio = RadioButtons(rax, ('2 Hz', '4 Hz', '8 Hz'))
-
-
-def hzfunc(label):
-    hzdict = {'2 Hz': s0, '4 Hz': s1, '8 Hz': s2}
-    ydata = hzdict[label]
-    l.set_ydata(ydata)
-    plt.draw()
-radio.on_clicked(hzfunc)
-
-rax = plt.axes([0.05, 0.4, 0.15, 0.15], facecolor=axcolor)
-radio2 = RadioButtons(rax, ('red', 'blue', 'green'))
-
-
-def colorfunc(label):
-    l.set_color(label)
-    plt.draw()
-radio2.on_clicked(colorfunc)
-
-rax = plt.axes([0.05, 0.1, 0.15, 0.15], facecolor=axcolor)
-radio3 = RadioButtons(rax, ('-', '--', '-.', 'steps', ':'))
-
-
-def stylefunc(label):
-    l.set_linestyle(label)
-    plt.draw()
-radio3.on_clicked(stylefunc)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/widgets/radio_buttons.py b/examples/widgets/radio_buttons.py deleted file mode 100644 index f993db59bf7..00000000000 --- a/examples/widgets/radio_buttons.py +++ /dev/null @@ -1,44 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.widgets import RadioButtons - -t = np.arange(0.0, 2.0, 0.01) -s0 = np.sin(2*np.pi*t) -s1 = np.sin(4*np.pi*t) -s2 = np.sin(8*np.pi*t) - -fig, ax = plt.subplots() -l, = ax.plot(t, s0, lw=2, color='red') -plt.subplots_adjust(left=0.3) - -axcolor = 'lightgoldenrodyellow' -rax = plt.axes([0.05, 0.7, 0.15, 0.15], facecolor=axcolor) -radio = RadioButtons(rax, ('2 Hz', '4 Hz', '8 Hz')) - - -def hzfunc(label): - hzdict = {'2 Hz': s0, '4 Hz': s1, '8 Hz': s2} - ydata = hzdict[label] - l.set_ydata(ydata) - plt.draw() -radio.on_clicked(hzfunc) - -rax = plt.axes([0.05, 0.4, 0.15, 0.15], facecolor=axcolor) -radio2 = RadioButtons(rax, ('red', 'blue', 'green')) - - -def colorfunc(label): - l.set_color(label) - plt.draw() -radio2.on_clicked(colorfunc) - -rax = plt.axes([0.05, 0.1, 0.15, 0.15], facecolor=axcolor) -radio3 = RadioButtons(rax, ('-', '--', '-.', 'steps', ':')) - - -def stylefunc(label): - l.set_linestyle(label) - plt.draw() -radio3.on_clicked(stylefunc) - -plt.show() diff --git a/examples/widgets/rectangle_selector.html b/examples/widgets/rectangle_selector.html deleted file mode 100644 index 3bcf29ac91f..00000000000 --- a/examples/widgets/rectangle_selector.html +++ /dev/null @@ -1,371 +0,0 @@ - - - - - - - - widgets example code: rectangle_selector.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

widgets example code: rectangle_selector.py

-

[source code]

-
from __future__ import print_function
-"""
-Do a mouseclick somewhere, move the mouse to some destination, release
-the button.  This class gives click- and release-events and also draws
-a line or a box from the click-point to the actual mouseposition
-(within the same axes) until the button is released.  Within the
-method 'self.ignore()' it is checked whether the button from eventpress
-and eventrelease are the same.
-
-"""
-from matplotlib.widgets import RectangleSelector
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-def line_select_callback(eclick, erelease):
-    'eclick and erelease are the press and release events'
-    x1, y1 = eclick.xdata, eclick.ydata
-    x2, y2 = erelease.xdata, erelease.ydata
-    print("(%3.2f, %3.2f) --> (%3.2f, %3.2f)" % (x1, y1, x2, y2))
-    print(" The button you used were: %s %s" % (eclick.button, erelease.button))
-
-
-def toggle_selector(event):
-    print(' Key pressed.')
-    if event.key in ['Q', 'q'] and toggle_selector.RS.active:
-        print(' RectangleSelector deactivated.')
-        toggle_selector.RS.set_active(False)
-    if event.key in ['A', 'a'] and not toggle_selector.RS.active:
-        print(' RectangleSelector activated.')
-        toggle_selector.RS.set_active(True)
-
-
-fig, current_ax = plt.subplots()                 # make a new plotting range
-N = 100000                                       # If N is large one can see
-x = np.linspace(0.0, 10.0, N)                    # improvement by use blitting!
-
-plt.plot(x, +np.sin(.2*np.pi*x), lw=3.5, c='b', alpha=.7)  # plot something
-plt.plot(x, +np.cos(.2*np.pi*x), lw=3.5, c='r', alpha=.5)
-plt.plot(x, -np.sin(.2*np.pi*x), lw=3.5, c='g', alpha=.3)
-
-print("\n      click  -->  release")
-
-# drawtype is 'box' or 'line' or 'none'
-toggle_selector.RS = RectangleSelector(current_ax, line_select_callback,
-                                       drawtype='box', useblit=True,
-                                       button=[1, 3],  # don't use middle button
-                                       minspanx=5, minspany=5,
-                                       spancoords='pixels',
-                                       interactive=True)
-plt.connect('key_press_event', toggle_selector)
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/widgets/rectangle_selector.py b/examples/widgets/rectangle_selector.py deleted file mode 100644 index e80ffa6f885..00000000000 --- a/examples/widgets/rectangle_selector.py +++ /dev/null @@ -1,52 +0,0 @@ -from __future__ import print_function -""" -Do a mouseclick somewhere, move the mouse to some destination, release -the button. This class gives click- and release-events and also draws -a line or a box from the click-point to the actual mouseposition -(within the same axes) until the button is released. Within the -method 'self.ignore()' it is checked whether the button from eventpress -and eventrelease are the same. - -""" -from matplotlib.widgets import RectangleSelector -import numpy as np -import matplotlib.pyplot as plt - - -def line_select_callback(eclick, erelease): - 'eclick and erelease are the press and release events' - x1, y1 = eclick.xdata, eclick.ydata - x2, y2 = erelease.xdata, erelease.ydata - print("(%3.2f, %3.2f) --> (%3.2f, %3.2f)" % (x1, y1, x2, y2)) - print(" The button you used were: %s %s" % (eclick.button, erelease.button)) - - -def toggle_selector(event): - print(' Key pressed.') - if event.key in ['Q', 'q'] and toggle_selector.RS.active: - print(' RectangleSelector deactivated.') - toggle_selector.RS.set_active(False) - if event.key in ['A', 'a'] and not toggle_selector.RS.active: - print(' RectangleSelector activated.') - toggle_selector.RS.set_active(True) - - -fig, current_ax = plt.subplots() # make a new plotting range -N = 100000 # If N is large one can see -x = np.linspace(0.0, 10.0, N) # improvement by use blitting! - -plt.plot(x, +np.sin(.2*np.pi*x), lw=3.5, c='b', alpha=.7) # plot something -plt.plot(x, +np.cos(.2*np.pi*x), lw=3.5, c='r', alpha=.5) -plt.plot(x, -np.sin(.2*np.pi*x), lw=3.5, c='g', alpha=.3) - -print("\n click --> release") - -# drawtype is 'box' or 'line' or 'none' -toggle_selector.RS = RectangleSelector(current_ax, line_select_callback, - drawtype='box', useblit=True, - button=[1, 3], # don't use middle button - minspanx=5, minspany=5, - spancoords='pixels', - interactive=True) -plt.connect('key_press_event', toggle_selector) -plt.show() diff --git a/examples/widgets/slider_demo.html b/examples/widgets/slider_demo.html deleted file mode 100644 index fd7be7209fd..00000000000 --- a/examples/widgets/slider_demo.html +++ /dev/null @@ -1,367 +0,0 @@ - - - - - - - - widgets example code: slider_demo.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

widgets example code: slider_demo.py

-

[source code]

-
import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.widgets import Slider, Button, RadioButtons
-
-fig, ax = plt.subplots()
-plt.subplots_adjust(left=0.25, bottom=0.25)
-t = np.arange(0.0, 1.0, 0.001)
-a0 = 5
-f0 = 3
-s = a0*np.sin(2*np.pi*f0*t)
-l, = plt.plot(t, s, lw=2, color='red')
-plt.axis([0, 1, -10, 10])
-
-axcolor = 'lightgoldenrodyellow'
-axfreq = plt.axes([0.25, 0.1, 0.65, 0.03], facecolor=axcolor)
-axamp = plt.axes([0.25, 0.15, 0.65, 0.03], facecolor=axcolor)
-
-sfreq = Slider(axfreq, 'Freq', 0.1, 30.0, valinit=f0)
-samp = Slider(axamp, 'Amp', 0.1, 10.0, valinit=a0)
-
-
-def update(val):
-    amp = samp.val
-    freq = sfreq.val
-    l.set_ydata(amp*np.sin(2*np.pi*freq*t))
-    fig.canvas.draw_idle()
-sfreq.on_changed(update)
-samp.on_changed(update)
-
-resetax = plt.axes([0.8, 0.025, 0.1, 0.04])
-button = Button(resetax, 'Reset', color=axcolor, hovercolor='0.975')
-
-
-def reset(event):
-    sfreq.reset()
-    samp.reset()
-button.on_clicked(reset)
-
-rax = plt.axes([0.025, 0.5, 0.15, 0.15], facecolor=axcolor)
-radio = RadioButtons(rax, ('red', 'blue', 'green'), active=0)
-
-
-def colorfunc(label):
-    l.set_color(label)
-    fig.canvas.draw_idle()
-radio.on_clicked(colorfunc)
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/widgets/slider_demo.py b/examples/widgets/slider_demo.py deleted file mode 100644 index 70e6cb8d1ea..00000000000 --- a/examples/widgets/slider_demo.py +++ /dev/null @@ -1,48 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.widgets import Slider, Button, RadioButtons - -fig, ax = plt.subplots() -plt.subplots_adjust(left=0.25, bottom=0.25) -t = np.arange(0.0, 1.0, 0.001) -a0 = 5 -f0 = 3 -s = a0*np.sin(2*np.pi*f0*t) -l, = plt.plot(t, s, lw=2, color='red') -plt.axis([0, 1, -10, 10]) - -axcolor = 'lightgoldenrodyellow' -axfreq = plt.axes([0.25, 0.1, 0.65, 0.03], facecolor=axcolor) -axamp = plt.axes([0.25, 0.15, 0.65, 0.03], facecolor=axcolor) - -sfreq = Slider(axfreq, 'Freq', 0.1, 30.0, valinit=f0) -samp = Slider(axamp, 'Amp', 0.1, 10.0, valinit=a0) - - -def update(val): - amp = samp.val - freq = sfreq.val - l.set_ydata(amp*np.sin(2*np.pi*freq*t)) - fig.canvas.draw_idle() -sfreq.on_changed(update) -samp.on_changed(update) - -resetax = plt.axes([0.8, 0.025, 0.1, 0.04]) -button = Button(resetax, 'Reset', color=axcolor, hovercolor='0.975') - - -def reset(event): - sfreq.reset() - samp.reset() -button.on_clicked(reset) - -rax = plt.axes([0.025, 0.5, 0.15, 0.15], facecolor=axcolor) -radio = RadioButtons(rax, ('red', 'blue', 'green'), active=0) - - -def colorfunc(label): - l.set_color(label) - fig.canvas.draw_idle() -radio.on_clicked(colorfunc) - -plt.show() diff --git a/examples/widgets/span_selector.html b/examples/widgets/span_selector.html deleted file mode 100644 index 1577aea484b..00000000000 --- a/examples/widgets/span_selector.html +++ /dev/null @@ -1,358 +0,0 @@ - - - - - - - - widgets example code: span_selector.py — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-
-

This Page

- -
- - -
-
- -
-
-
-
- -
-

widgets example code: span_selector.py

-

[source code]

-
"""
-The SpanSelector is a mouse widget to select a xmin/xmax range and plot the
-detail view of the selected region in the lower axes
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.widgets import SpanSelector
-
-fig = plt.figure(figsize=(8, 6))
-ax = fig.add_subplot(211, facecolor='#FFFFCC')
-
-x = np.arange(0.0, 5.0, 0.01)
-y = np.sin(2*np.pi*x) + 0.5*np.random.randn(len(x))
-
-ax.plot(x, y, '-')
-ax.set_ylim(-2, 2)
-ax.set_title('Press left mouse button and drag to test')
-
-ax2 = fig.add_subplot(212, facecolor='#FFFFCC')
-line2, = ax2.plot(x, y, '-')
-
-
-def onselect(xmin, xmax):
-    indmin, indmax = np.searchsorted(x, (xmin, xmax))
-    indmax = min(len(x) - 1, indmax)
-
-    thisx = x[indmin:indmax]
-    thisy = y[indmin:indmax]
-    line2.set_data(thisx, thisy)
-    ax2.set_xlim(thisx[0], thisx[-1])
-    ax2.set_ylim(thisy.min(), thisy.max())
-    fig.canvas.draw()
-
-# set useblit True on gtkagg for enhanced performance
-span = SpanSelector(ax, onselect, 'horizontal', useblit=True,
-                    rectprops=dict(alpha=0.5, facecolor='red'))
-
-
-plt.show()
-
-
-

Keywords: python, matplotlib, pylab, example, codex (see Search examples)

-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/examples/widgets/span_selector.py b/examples/widgets/span_selector.py deleted file mode 100644 index 3b0f11e401c..00000000000 --- a/examples/widgets/span_selector.py +++ /dev/null @@ -1,39 +0,0 @@ -""" -The SpanSelector is a mouse widget to select a xmin/xmax range and plot the -detail view of the selected region in the lower axes -""" -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.widgets import SpanSelector - -fig = plt.figure(figsize=(8, 6)) -ax = fig.add_subplot(211, facecolor='#FFFFCC') - -x = np.arange(0.0, 5.0, 0.01) -y = np.sin(2*np.pi*x) + 0.5*np.random.randn(len(x)) - -ax.plot(x, y, '-') -ax.set_ylim(-2, 2) -ax.set_title('Press left mouse button and drag to test') - -ax2 = fig.add_subplot(212, facecolor='#FFFFCC') -line2, = ax2.plot(x, y, '-') - - -def onselect(xmin, xmax): - indmin, indmax = np.searchsorted(x, (xmin, xmax)) - indmax = min(len(x) - 1, indmax) - - thisx = x[indmin:indmax] - thisy = y[indmin:indmax] - line2.set_data(thisx, thisy) - ax2.set_xlim(thisx[0], thisx[-1]) - ax2.set_ylim(thisy.min(), thisy.max()) - fig.canvas.draw() - -# set useblit True on gtkagg for enhanced performance -span = SpanSelector(ax, onselect, 'horizontal', useblit=True, - rectprops=dict(alpha=0.5, facecolor='red')) - - -plt.show() diff --git a/faq/usage_faq.html b/faq/usage_faq.html deleted file mode 100644 index b75c933c1f3..00000000000 --- a/faq/usage_faq.html +++ /dev/null @@ -1,974 +0,0 @@ - - - - - - - - Usage — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - - - -
-
-
-
- -
-

Usage

- -
-

General Concepts

-

matplotlib has an extensive codebase that can be daunting to many -new users. However, most of matplotlib can be understood with a fairly -simple conceptual framework and knowledge of a few important points.

-

Plotting requires action on a range of levels, from the most general -(e.g., ‘contour this 2-D array’) to the most specific (e.g., ‘color -this screen pixel red’). The purpose of a plotting package is to assist -you in visualizing your data as easily as possible, with all the necessary -control – that is, by using relatively high-level commands most of -the time, and still have the ability to use the low-level commands when -needed.

-

Therefore, everything in matplotlib is organized in a hierarchy. At the top -of the hierarchy is the matplotlib “state-machine environment” which is -provided by the matplotlib.pyplot module. At this level, simple -functions are used to add plot elements (lines, images, text, etc.) to -the current axes in the current figure.

-
-

Note

-

Pyplot’s state-machine environment behaves similarly to MATLAB and -should be most familiar to users with MATLAB experience.

-
-

The next level down in the hierarchy is the first level of the object-oriented -interface, in which pyplot is used only for a few functions such as figure -creation, and the user explicitly creates and keeps track of the figure -and axes objects. At this level, the user uses pyplot to create figures, -and through those figures, one or more axes objects can be created. These -axes objects are then used for most plotting actions.

-

For even more control – which is essential for things like embedding -matplotlib plots in GUI applications – the pyplot level may be dropped -completely, leaving a purely object-oriented approach.

-
-
-

Parts of a Figure

-../_images/anatomy1.png -
-

Figure

-

The whole figure. The figure keeps -track of all the child Axes, a smattering of -‘special’ artists (titles, figure legends, etc), and the canvas. -(Don’t worry too much about the canvas, it is crucial as it is the -object that actually does the drawing to get you your plot, but as the -user it is more-or-less invisible to you). A figure can have any -number of Axes, but to be useful should have -at least one.

-

The easiest way to create a new figure is with pyplot:

-
fig = plt.figure()  # an empty figure with no axes
-fig, ax_lst = plt.subplots(2, 2)  # a figure with a 2x2 grid of Axes
-
-
-
-
-

Axes

-

This is what you think of as ‘a plot’, it is the region of the image -with the data space (marked as the inner blue box). A given figure -can contain many Axes, but a given Axes -object can only be in one Figure. The -Axes contains two (or three in the case of 3D) -Axis objects (be aware of the difference -between Axes and Axis) which take care of the data limits (the -data limits can also be controlled via set via the -set_xlim() and -set_ylim() Axes methods). Each -Axes has a title (set via -set_title()), an x-label (set via -set_xlabel()), and a y-label set via -set_ylabel()).

-

The Axes class and it’s member functions are the primary entry -point to working with the OO interface.

-
-
-

Axis

-

These are the number-line-like objects (circled in green). They take -care of setting the graph limits and generating the ticks (the marks -on the axis) and ticklabels (strings labeling the ticks). The -location of the ticks is determined by a -Locator object and the ticklabel strings -are formatted by a Formatter. The -combination of the correct Locator and Formatter gives -very fine control over the tick locations and labels.

-
-
-

Artist

-

Basically everything you can see on the figure is an artist (even the -Figure, Axes, and Axis objects). This -includes Text objects, Line2D objects, -collection objects, Patch objects ... (you get the -idea). When the figure is rendered, all of the artists are drawn to -the canvas. Most Artists are tied to an Axes; such an Artist -cannot be shared by multiple Axes, or moved from one to another.

-
-
-
-

Types of inputs to plotting functions

-

All of plotting functions expect np.array or np.ma.masked_array as -input. Classes that are ‘array-like’ such as pandas data objects -and np.matrix may or may not work as intended. It is best to -convert these to np.array objects prior to plotting.

-

For example, to covert a pandas.DataFrame

-
a = pandas.DataFrame(np.random.rand(4,5), columns = list('abcde'))
-a_asndarray = a.values
-
-
-

and to covert a np.matrix

-
b = np.matrix([[1,2],[3,4]])
-b_asarray = np.asarray(b)
-
-
-
- -
-

Coding Styles

-

When viewing this documentation and examples, you will find different -coding styles and usage patterns. These styles are perfectly valid -and have their pros and cons. Just about all of the examples can be -converted into another style and achieve the same results. -The only caveat is to avoid mixing the coding styles for your own code.

-
-

Note

-

Developers for matplotlib have to follow a specific style and guidelines. -See The Matplotlib Developers’ Guide.

-
-

Of the different styles, there are two that are officially supported. -Therefore, these are the preferred ways to use matplotlib.

-

For the pyplot style, the imports at the top of your -scripts will typically be:

-
import matplotlib.pyplot as plt
-import numpy as np
-
-
-

Then one calls, for example, np.arange, np.zeros, np.pi, plt.figure, -plt.plot, plt.show, etc. Use the pyplot interface -for creating figures, and then use the object methods for the rest:

-
import matplotlib.pyplot as plt
-import numpy as np
-x = np.arange(0, 10, 0.2)
-y = np.sin(x)
-fig = plt.figure()
-ax = fig.add_subplot(111)
-ax.plot(x, y)
-plt.show()
-
-
-

So, why all the extra typing instead of the MATLAB-style (which relies -on global state and a flat namespace)? For very simple things like -this example, the only advantage is academic: the wordier styles are -more explicit, more clear as to where things come from and what is -going on. For more complicated applications, this explicitness and -clarity becomes increasingly valuable, and the richer and more -complete object-oriented interface will likely make the program easier -to write and maintain.

-

Typically one finds oneself making the same plots over and over -again, but with different data sets, which leads to needing to write -specialized functions to do the plotting. The recommended function -signature is something like:

-
def my_plotter(ax, data1, data2, param_dict):
-    """
-    A helper function to make a graph
-
-    Parameters
-    ----------
-    ax : Axes
-        The axes to draw to
-
-    data1 : array
-       The x data
-
-    data2 : array
-       The y data
-
-    param_dict : dict
-       Dictionary of kwargs to pass to ax.plot
-
-    Returns
-    -------
-    out : list
-        list of artists added
-    """
-    out = ax.plot(data1, data2, **param_dict)
-    return out
-
-
-

which you would then use as:

-
fig, ax = plt.subplots(1, 1)
-my_plotter(ax, data1, data2, {'marker':'x'})
-
-
-

or if you wanted to have 2 sub-plots:

-
fig, (ax1, ax2) = plt.subplots(1, 2)
-my_plotter(ax1, data1, data2, {'marker':'x'})
-my_plotter(ax2, data3, data4, {'marker':'o'})
-
-
-

Again, for these simple examples this style seems like overkill, however -once the graphs get slightly more complex it pays off.

-
-
-

What is a backend?

-

A lot of documentation on the website and in the mailing lists refers -to the “backend” and many new users are confused by this term. -matplotlib targets many different use cases and output formats. Some -people use matplotlib interactively from the python shell and have -plotting windows pop up when they type commands. Some people embed -matplotlib into graphical user interfaces like wxpython or pygtk to -build rich applications. Others use matplotlib in batch scripts to -generate postscript images from some numerical simulations, and still -others in web application servers to dynamically serve up graphs.

-

To support all of these use cases, matplotlib can target different -outputs, and each of these capabilities is called a backend; the -“frontend” is the user facing code, i.e., the plotting code, whereas the -“backend” does all the hard work behind-the-scenes to make the figure. -There are two types of backends: user interface backends (for use in -pygtk, wxpython, tkinter, qt4, or macosx; also referred to as -“interactive backends”) and hardcopy backends to make image files -(PNG, SVG, PDF, PS; also referred to as “non-interactive backends”).

-

There are four ways to configure your backend. If they conflict each other, -the method mentioned last in the following list will be used, e.g. calling -use() will override the setting in your matplotlibrc.

-
    -
  1. The backend parameter in your matplotlibrc file (see -Customizing matplotlib):

    -
    backend : WXAgg   # use wxpython with antigrain (agg) rendering
    -
    -
    -
  2. -
  3. Setting the MPLBACKEND environment -variable, either for your current shell or for a single script:

    -
    > export MPLBACKEND="module://my_backend"
    -> python simple_plot.py
    -
    -> MPLBACKEND="module://my_backend" python simple_plot.py
    -
    -
    -

    Setting this environment variable will override the backend parameter -in any matplotlibrc, even if there is a matplotlibrc in your -current working directory. Therefore setting MPLBACKEND -globally, e.g. in your .bashrc or .profile, is discouraged as it -might lead to counter-intuitive behavior.

    -
  4. -
  5. To set the backend for a single script, you can alternatively use the -d -command line argument:

    -
    > python script.py -dbackend
    -
    -
    -

    This method is deprecated as the -d argument might conflict with -scripts which parse command line arguments (see issue -#1986). You -should use MPLBACKEND instead.

    -
  6. -
  7. If your script depends on a specific backend you can use the -use() function:

    -
    import matplotlib
    -matplotlib.use('PS')   # generate postscript output by default
    -
    -
    -

    If you use the use() function, this must be done before -importing matplotlib.pyplot. Calling use() after -pyplot has been imported will have no effect. Using -use() will require changes in your code if users want to -use a different backend. Therefore, you should avoid explicitly calling -use() unless absolutely necessary.

    -
  8. -
-
-

Note

-

Backend name specifications are not case-sensitive; e.g., ‘GTKAgg’ -and ‘gtkagg’ are equivalent.

-
-

With a typical installation of matplotlib, such as from a -binary installer or a linux distribution package, a good default -backend will already be set, allowing both interactive work and -plotting from scripts, with output to the screen and/or to -a file, so at least initially you will not need to use any of the -methods given above.

-

If, however, you want to write graphical user interfaces, or a web -application server (Matplotlib in a web application server), or need a better -understanding of what is going on, read on. To make things a little -more customizable for graphical user interfaces, matplotlib separates -the concept of the renderer (the thing that actually does the drawing) -from the canvas (the place where the drawing goes). The canonical -renderer for user interfaces is Agg which uses the Anti-Grain -Geometry C++ library to make a raster (pixel) image of the figure. -All of the user interfaces except macosx can be used with -agg rendering, e.g., -WXAgg, GTKAgg, QT4Agg, QT5Agg, TkAgg. In -addition, some of the user interfaces support other rendering engines. -For example, with GTK, you can also select GDK rendering (backend -GTK deprecated in 2.0) or Cairo rendering (backend GTKCairo).

-

For the rendering engines, one can also distinguish between vector or raster renderers. Vector -graphics languages issue drawing commands like “draw a line from this -point to this point” and hence are scale free, and raster backends -generate a pixel representation of the line whose accuracy depends on a -DPI setting.

-

Here is a summary of the matplotlib renderers (there is an eponymous -backed for each; these are non-interactive backends, capable of -writing to a file):

- ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RendererFiletypesDescription
AGGpngraster graphics – high quality images -using the Anti-Grain Geometry engine
PSps -epsvector graphicsPostscript output
PDFpdfvector graphics – -Portable Document Format
SVGsvgvector graphics – -Scalable Vector Graphics
Cairopng -ps -pdf -svg -...vector graphics – -Cairo graphics
GDKpng -jpg -tiff -...raster graphics – -the Gimp Drawing Kit Deprecated in 2.0
-

And here are the user interfaces and renderer combinations supported; -these are interactive backends, capable of displaying to the screen -and of using appropriate renderers from the table above to write to -a file:

- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BackendDescription
GTKAggAgg rendering to a GTK 2.x canvas (requires PyGTK and -pycairo or cairocffi; Python2 only)
GTK3AggAgg rendering to a GTK 3.x canvas (requires PyGObject -and pycairo or cairocffi)
GTKGDK rendering to a GTK 2.x canvas (not recommended and d -eprecated in 2.0) (requires PyGTK and pycairo or cairocffi; -Python2 only)
GTKCairoCairo rendering to a GTK 2.x canvas (requires PyGTK -and pycairo or cairocffi; Python2 only)
GTK3CairoCairo rendering to a GTK 3.x canvas (requires PyGObject -and pycairo or cairocffi)
WXAggAgg rendering to to a wxWidgets canvas -(requires wxPython)
WXNative wxWidgets drawing to a wxWidgets Canvas -(not recommended and deprecated in 2.0) (requires wxPython)
TkAggAgg rendering to a Tk canvas (requires TkInter)
Qt4AggAgg rendering to a Qt4 canvas (requires PyQt4 or pyside)
Qt5AggAgg rendering in a Qt5 canvas (requires PyQt5)
macosxCocoa rendering in OSX windows -(presently lacks blocking show() behavior when matplotlib -is in non-interactive mode)
-
-
-

WX backends

-

At present the release version of wxPython (also known as wxPython classic) -does not support python3. A work in progress redesigned version known as -wxPython-Phoenix does support python3. -Matplotlib should work with both versions.

-
-
-

GTK and Cairo

-

Both GTK2 and GTK3 have implicit dependencies on PyCairo regardless of the -specific Matplotlib backend used. Unfortunatly the latest release of PyCairo -for Python3 does not implement the Python wrappers needed for the GTK3Agg -backend. Cairocffi can be used as a replacement which implements the correct -wrapper.

-
-
-

How do I select PyQt4 or PySide?

-

You can choose either PyQt4 or PySide when using the qt4 backend by setting -the appropriate value for backend.qt4 in your matplotlibrc file. The -default value is PyQt4.

-

The setting in your matplotlibrc file can be overridden by setting the -QT_API environment variable to either pyqt or pyside to use PyQt4 or -PySide, respectively.

-

Since the default value for the bindings to be used is PyQt4, -matplotlib first tries to import it, if the import fails, it tries to -import PySide.

-
-
-

What is interactive mode?

-

Use of an interactive backend (see What is a backend?) -permits–but does not by itself require or ensure–plotting -to the screen. Whether and when plotting to the screen occurs, -and whether a script or shell session continues after a plot -is drawn on the screen, depends on the functions and methods -that are called, and on a state variable that determines whether -matplotlib is in “interactive mode”. The default Boolean value is set -by the matplotlibrc file, and may be customized like any other -configuration parameter (see Customizing matplotlib). It -may also be set via matplotlib.interactive(), and its -value may be queried via matplotlib.is_interactive(). Turning -interactive mode on and off in the middle of a stream of plotting -commands, whether in a script or in a shell, is rarely needed -and potentially confusing, so in the following we will assume all -plotting is done with interactive mode either on or off.

-
-

Note

-

Major changes related to interactivity, and in particular the -role and behavior of show(), were made in the -transition to matplotlib version 1.0, and bugs were fixed in -1.0.1. Here we describe the version 1.0.1 behavior for the -primary interactive backends, with the partial exception of -macosx.

-
-

Interactive mode may also be turned on via matplotlib.pyplot.ion(), -and turned off via matplotlib.pyplot.ioff().

-
-

Note

-

Interactive mode works with suitable backends in ipython and in -the ordinary python shell, but it does not work in the IDLE IDE. -If the default backend does not support interactivity, an interactive -backend can be explicitly activated using any of the methods discussed in What is a backend?.

-
-
-

Interactive example

-

From an ordinary python prompt, or after invoking ipython with no options, -try this:

-
import matplotlib.pyplot as plt
-plt.ion()
-plt.plot([1.6, 2.7])
-
-
-

Assuming you are running version 1.0.1 or higher, and you have -an interactive backend installed and selected by default, you should -see a plot, and your terminal prompt should also be active; you -can type additional commands such as:

-
plt.title("interactive test")
-plt.xlabel("index")
-
-
-

and you will see the plot being updated after each line. This is -because you are in interactive mode and you are using pyplot -functions. Now try an alternative method of modifying the -plot. Get a reference to the Axes instance, and -call a method of that instance:

-
ax = plt.gca()
-ax.plot([3.1, 2.2])
-
-
-

Nothing changed, because the Axes methods do not include an -automatic call to draw_if_interactive(); -that call is added by the pyplot functions. If you are using -methods, then when you want to update the plot on the screen, -you need to call draw():

-
plt.draw()
-
-
-

Now you should see the new line added to the plot.

-
-
-

Non-interactive example

-

Start a fresh session as in the previous example, but now -turn interactive mode off:

-
import matplotlib.pyplot as plt
-plt.ioff()
-plt.plot([1.6, 2.7])
-
-
-

Nothing happened–or at least nothing has shown up on the -screen (unless you are using macosx backend, which is -anomalous). To make the plot appear, you need to do this:

-
plt.show()
-
-
-

Now you see the plot, but your terminal command line is -unresponsive; the show() command blocks the input -of additional commands until you manually kill the plot -window.

-

What good is this–being forced to use a blocking function? -Suppose you need a script that plots the contents of a file -to the screen. You want to look at that plot, and then end -the script. Without some blocking command such as show(), the -script would flash up the plot and then end immediately, -leaving nothing on the screen.

-

In addition, non-interactive mode delays all drawing until -show() is called; this is more efficient than redrawing -the plot each time a line in the script adds a new feature.

-

Prior to version 1.0, show() generally could not be called -more than once in a single script (although sometimes one -could get away with it); for version 1.0.1 and above, this -restriction is lifted, so one can write a script like this:

-
import numpy as np
-import matplotlib.pyplot as plt
-plt.ioff()
-for i in range(3):
-    plt.plot(np.random.rand(10))
-    plt.show()
-
-
-

which makes three plots, one at a time.

-
-
-

Summary

-

In interactive mode, pyplot functions automatically draw -to the screen.

-

When plotting interactively, if using -object method calls in addition to pyplot functions, then -call draw() whenever you want to -refresh the plot.

-

Use non-interactive mode in scripts in which you want to -generate one or more figures and display them before ending -or generating a new set of figures. In that case, use -show() to display the figure(s) and -to block execution until you have manually destroyed them.

-
-
-
- - -
-
-
- -
-
- - - - -
- - - - - - -
-
-
-
-
-
- - -
- \ No newline at end of file diff --git a/gallery.html b/gallery.html deleted file mode 100644 index a95b43e7c28..00000000000 --- a/gallery.html +++ /dev/null @@ -1,2821 +0,0 @@ - - - - - - - - Thumbnail gallery — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - -
-matplotlib -
- - - - - - - -
-
- - - - -
- -Travis-CI: - - -
-

Related Topics

- -
- - -
-
- -
-
-
-
- - -

Click on any image to see full size image and source code

-
- -
  • Gallery - -
  • - -
    -

    - Lines, bars, and markers -

    -
    - barh_demo
    -
    barh_demo
    -
    - -
    - fill_demo
    -
    fill_demo
    -
    - -
    - fill_demo_features
    -
    fill_demo_features
    -
    - -
    - line_demo_dash_control
    -
    line_demo_dash_control
    -
    - -
    - line_styles_reference
    -
    line_styles_reference
    -
    - -
    - linestyles
    -
    linestyles
    -
    - -
    - marker_fillstyle_reference
    -
    marker_fillstyle_reference
    -
    - -
    - marker_reference
    -
    marker_reference
    -
    - -
    - marker_reference
    -
    marker_reference
    -
    - -
    - scatter_with_legend
    -
    scatter_with_legend
    -
    - -
    -
    -

    - Shapes and collections -

    -
    - artist_reference
    -
    artist_reference
    -
    - -
    - path_patch_demo
    -
    path_patch_demo
    -
    - -
    - scatter_demo
    -
    scatter_demo
    -
    - -
    -
    -

    - Statistical plots -

    -
    - boxplot_color_demo
    -
    boxplot_color_demo
    -
    - -
    - boxplot_demo
    -
    boxplot_demo
    -
    - -
    - boxplot_demo
    -
    boxplot_demo
    -
    - -
    - boxplot_vs_violin_demo
    -
    boxplot_vs_violin_demo
    -
    - -
    - bxp_demo
    -
    bxp_demo
    -
    - -
    - bxp_demo
    -
    bxp_demo
    -
    - -
    - customized_violin_demo
    -
    customized_violin_demo
    -
    - -
    - errorbar_demo
    -
    errorbar_demo
    -
    - -
    - errorbar_demo_features
    -
    errorbar_demo_features
    -
    - -
    - errorbar_limits
    -
    errorbar_limits
    -
    - -
    - errorbars_and_boxes
    -
    errorbars_and_boxes
    -
    - -
    - histogram_demo_cumulative
    -
    histogram_demo_cumulative
    -
    - -
    - histogram_demo_features
    -
    histogram_demo_features
    -
    - -
    - histogram_demo_histtypes
    -
    histogram_demo_histtypes
    -
    - -
    - histogram_demo_multihist
    -
    histogram_demo_multihist
    -
    - -
    - multiple_histograms_side_by_side
    -
    multiple_histograms_side_by_side
    -
    - -
    - violinplot_demo
    -
    violinplot_demo
    -
    - -
    -
    -

    - Images, contours, and fields -

    -
    - contourf_log
    -
    contourf_log
    -
    - -
    - image_demo
    -
    image_demo
    -
    - -
    - image_demo_clip_path
    -
    image_demo_clip_path
    -
    - -
    - interpolation_methods
    -
    interpolation_methods
    -
    - -
    - pcolormesh_levels
    -
    pcolormesh_levels
    -
    - -
    - streamplot_demo_features
    -
    streamplot_demo_features
    -
    - -
    - streamplot_demo_features
    -
    streamplot_demo_features
    -
    - -
    - streamplot_demo_masking
    -
    streamplot_demo_masking
    -
    - -
    - streamplot_demo_start_points
    -
    streamplot_demo_start_points
    -
    - -
    -
    -

    - Pie and polar charts -

    -
    - pie_demo_features
    -
    pie_demo_features
    -
    - -
    - polar_bar_demo
    -
    polar_bar_demo
    -
    - -
    - polar_scatter_demo
    -
    polar_scatter_demo
    -
    - -
    -
    -

    - Color -

    -
    - color_cycle_default
    -
    color_cycle_default
    -
    - -
    - color_cycle_demo
    -
    color_cycle_demo
    -
    - -
    - colormaps_reference
    -
    colormaps_reference
    -
    - -
    - colormaps_reference
    -
    colormaps_reference
    -
    - -
    - colormaps_reference
    -
    colormaps_reference
    -
    - -
    - colormaps_reference
    -
    colormaps_reference
    -
    - -
    - colormaps_reference
    -
    colormaps_reference
    -
    - -
    - colormaps_reference
    -
    colormaps_reference
    -
    - -
    - named_colors
    -
    named_colors
    -
    - -
    -
    -

    - Text, labels, and annotations -

    -
    - autowrap_demo
    -
    autowrap_demo
    -
    - -
    - rainbow_text
    -
    rainbow_text
    -
    - -
    - text_demo_fontdict
    -
    text_demo_fontdict
    -
    - -
    - unicode_demo
    -
    unicode_demo
    -
    - -
    -
    -

    - Ticks and spines -

    -
    - spines_demo
    -
    spines_demo
    -
    - -
    - spines_demo_bounds
    -
    spines_demo_bounds
    -
    - -
    - spines_demo_dropped
    -
    spines_demo_dropped
    -
    - -
    - tick-formatters
    -
    tick-formatters
    -
    - -
    - tick-locators
    -
    tick-locators
    -
    - -
    - tick_labels_from_values
    -
    tick_labels_from_values
    -
    - -
    - ticklabels_demo_rotation
    -
    ticklabels_demo_rotation
    -
    - -
    -
    -

    - Axis scales -

    -
    - scales
    -
    scales
    -
    - -
    -
    -

    - Subplots, axes, and figures -

    -
    - fahrenheit_celsius_scales
    -
    fahrenheit_celsius_scales
    -
    - -
    - subplot_demo
    -
    subplot_demo
    -
    - -
    - -
    -

    - Specialty plots -

    -
    - advanced_hillshading
    -
    advanced_hillshading
    -
    - -
    - advanced_hillshading
    -
    advanced_hillshading
    -
    - -
    - advanced_hillshading
    -
    advanced_hillshading
    -
    - -
    - hinton_demo
    -
    hinton_demo
    -
    - -
    - topographic_hillshading
    -
    topographic_hillshading
    -
    - -
    -
    -

    - Showcase -

    -
    - anatomy
    -
    anatomy
    -
    - -
    - bachelors_degrees_by_gender
    -
    bachelors_degrees_by_gender
    -
    - -
    - firefox
    -
    firefox
    -
    - -
    - integral_demo
    -
    integral_demo
    -
    - -
    - mandelbrot
    -
    mandelbrot
    -
    - -
    - xkcd
    -
    xkcd
    -
    - -
    - xkcd
    -
    xkcd
    -
    - -
    -
    -

    - API -

    -
    - barchart_demo
    -
    barchart_demo
    -
    - -
    - bbox_intersect
    -
    bbox_intersect
    -
    - -
    - collections_demo
    -
    collections_demo
    -
    - -
    - colorbar_basics
    -
    colorbar_basics
    -
    - -
    - colorbar_only
    -
    colorbar_only
    -
    - -
    - compound_path
    -
    compound_path
    -
    - -
    - custom_projection_example
    -
    custom_projection_example
    -
    - -
    - custom_scale_example
    -
    custom_scale_example
    -
    - -
    - date_demo
    -
    date_demo
    -
    - -
    - date_index_formatter
    -
    date_index_formatter
    -
    - -
    - demo_affine_image
    -
    demo_affine_image
    -
    - -
    - donut_demo
    -
    donut_demo
    -
    - -
    - engineering_formatter
    -
    engineering_formatter
    -
    - -
    - filled_step
    -
    filled_step
    -
    - -
    - filled_step
    -
    filled_step
    -
    - -
    - histogram_path_demo
    -
    histogram_path_demo
    -
    - -
    - image_zcoord
    -
    image_zcoord
    -
    - -
    - joinstyle
    -
    joinstyle
    -
    - -
    - legend_demo
    -
    legend_demo
    -
    - -
    - line_with_text
    -
    line_with_text
    -
    - -
    - logo2
    -
    logo2
    -
    - -
    - mathtext_asarray
    -
    mathtext_asarray
    -
    - -
    - patch_collection
    -
    patch_collection
    -
    - -
    - power_norm_demo
    -
    power_norm_demo
    -
    - -
    - quad_bezier
    -
    quad_bezier
    -
    - -
    - radar_chart
    -
    radar_chart
    -
    - -
    - sankey_demo_basics
    -
    sankey_demo_basics
    -
    - -
    - sankey_demo_basics
    -
    sankey_demo_basics
    -
    - -
    - sankey_demo_basics
    -
    sankey_demo_basics
    -
    - -
    - sankey_demo_links
    -
    sankey_demo_links
    -
    - -
    - sankey_demo_old
    -
    sankey_demo_old
    -
    - -
    - sankey_demo_rankine
    -
    sankey_demo_rankine
    -
    - -
    - scatter_piecharts
    -
    scatter_piecharts
    -
    - -
    - skewt
    -
    skewt
    -
    - -
    - span_regions
    -
    span_regions
    -
    - -
    - two_scales
    -
    two_scales
    -
    - -
    - unicode_minus
    -
    unicode_minus
    -
    - -
    - watermark_image
    -
    watermark_image
    -
    - -
    - watermark_text
    -
    watermark_text
    -
    - -
    -
    -

    - pylab examples -

    -
    - accented_text
    -
    accented_text
    -
    - -
    - agg_buffer
    -
    agg_buffer
    -
    - -
    - agg_buffer_to_array
    -
    agg_buffer_to_array
    -
    - -
    - agg_buffer_to_array
    -
    agg_buffer_to_array
    -
    - -
    - alignment_test
    -
    alignment_test
    -
    - -
    - anchored_artists
    -
    anchored_artists
    -
    - -
    - animation_demo
    -
    animation_demo
    -
    - -
    - annotation_demo2
    -
    annotation_demo2
    -
    - -
    - annotation_demo2
    -
    annotation_demo2
    -
    - -
    - annotation_demo3
    -
    annotation_demo3
    -
    - -
    - annotation_demo
    -
    annotation_demo
    -
    - -
    - annotation_demo
    -
    annotation_demo
    -
    - -
    - annotation_demo
    -
    annotation_demo
    -
    - -
    - anscombe
    -
    anscombe
    -
    - -
    - arctest
    -
    arctest
    -
    - -
    - arrow_demo
    -
    arrow_demo
    -
    - -
    - arrow_simple_demo
    -
    arrow_simple_demo
    -
    - -
    - aspect_loglog
    -
    aspect_loglog
    -
    - -
    - axes_demo
    -
    axes_demo
    -
    - -
    - axes_props
    -
    axes_props
    -
    - -
    - axes_zoom_effect
    -
    axes_zoom_effect
    -
    - -
    - axhspan_demo
    -
    axhspan_demo
    -
    - -
    - axis_equal_demo
    -
    axis_equal_demo
    -
    - -
    - bar_stacked
    -
    bar_stacked
    -
    - -
    - barb_demo
    -
    barb_demo
    -
    - -
    - barb_demo
    -
    barb_demo
    -
    - -
    - barchart_demo
    -
    barchart_demo
    -
    - -
    - barchart_demo2
    -
    barchart_demo2
    -
    - -
    - barcode_demo
    -
    barcode_demo
    -
    - -
    - boxplot_demo2
    -
    boxplot_demo2
    -
    - -
    - boxplot_demo3
    -
    boxplot_demo3
    -
    - -
    - boxplot_demo
    -
    boxplot_demo
    -
    - -
    - boxplot_demo
    -
    boxplot_demo
    -
    - -
    - boxplot_demo
    -
    boxplot_demo
    -
    - -
    - boxplot_demo
    -
    boxplot_demo
    -
    - -
    - boxplot_demo
    -
    boxplot_demo
    -
    - -
    - boxplot_demo
    -
    boxplot_demo
    -
    - -
    - boxplot_demo
    -
    boxplot_demo
    -
    - -
    - broken_axis
    -
    broken_axis
    -
    - -
    - broken_barh
    -
    broken_barh
    -
    - -
    - centered_ticklabels
    -
    centered_ticklabels
    -
    - -
    - cohere_demo
    -
    cohere_demo
    -
    - -
    - color_by_yvalue
    -
    color_by_yvalue
    -
    - -
    - color_demo
    -
    color_demo
    -
    - -
    - colorbar_tick_labelling_demo
    -
    colorbar_tick_labelling_demo
    -
    - -
    - colorbar_tick_labelling_demo
    -
    colorbar_tick_labelling_demo
    -
    - -
    - contour_corner_mask
    -
    contour_corner_mask
    -
    - -
    - contour_demo
    -
    contour_demo
    -
    - -
    - contour_demo
    -
    contour_demo
    -
    - -
    - contour_demo
    -
    contour_demo
    -
    - -
    - contour_demo
    -
    contour_demo
    -
    - -
    - contour_demo
    -
    contour_demo
    -
    - -
    - contour_demo
    -
    contour_demo
    -
    - -
    - contour_image
    -
    contour_image
    -
    - -
    - contour_label_demo
    -
    contour_label_demo
    -
    - -
    - contour_label_demo
    -
    contour_label_demo
    -
    - -
    - contour_label_demo
    -
    contour_label_demo
    -
    - -
    - contourf_demo
    -
    contourf_demo
    -
    - -
    - contourf_demo
    -
    contourf_demo
    -
    - -
    - contourf_demo
    -
    contourf_demo
    -
    - -
    - contourf_hatching
    -
    contourf_hatching
    -
    - -
    - contourf_hatching
    -
    contourf_hatching
    -
    - -
    - coords_demo
    -
    coords_demo
    -
    - -
    - coords_report
    -
    coords_report
    -
    - -
    - csd_demo
    -
    csd_demo
    -
    - -
    - custom_cmap
    -
    custom_cmap
    -
    - -
    - custom_cmap
    -
    custom_cmap
    -
    - -
    - custom_figure_class
    -
    custom_figure_class
    -
    - -
    - custom_ticker1
    -
    custom_ticker1
    -
    - -
    - customize_rc
    -
    customize_rc
    -
    - -
    - dashpointlabel
    -
    dashpointlabel
    -
    - -
    - date_demo_convert
    -
    date_demo_convert
    -
    - -
    - date_demo_rrule
    -
    date_demo_rrule
    -
    - -
    - date_index_formatter
    -
    date_index_formatter
    -
    - -
    - demo_agg_filter
    -
    demo_agg_filter
    -
    - -
    - demo_annotation_box
    -
    demo_annotation_box
    -
    - -
    - demo_bboximage
    -
    demo_bboximage
    -
    - -
    - demo_ribbon_box
    -
    demo_ribbon_box
    -
    - -
    - demo_text_path
    -
    demo_text_path
    -
    - -
    - demo_text_rotation_mode
    -
    demo_text_rotation_mode
    -
    - -
    - demo_tight_layout
    -
    demo_tight_layout
    -
    - -
    - demo_tight_layout
    -
    demo_tight_layout
    -
    - -
    - demo_tight_layout
    -
    demo_tight_layout
    -
    - -
    - demo_tight_layout
    -
    demo_tight_layout
    -
    - -
    - demo_tight_layout
    -
    demo_tight_layout
    -
    - -
    - demo_tight_layout
    -
    demo_tight_layout
    -
    - -
    - demo_tight_layout
    -
    demo_tight_layout
    -
    - -
    - demo_tight_layout
    -
    demo_tight_layout
    -
    - -
    - dolphin
    -
    dolphin
    -
    - -
    - ellipse_collection
    -
    ellipse_collection
    -
    - -
    - ellipse_demo
    -
    ellipse_demo
    -
    - -
    - ellipse_rotated
    -
    ellipse_rotated
    -
    - -
    - equal_aspect_ratio
    -
    equal_aspect_ratio
    -
    - -
    - errorbar_limits
    -
    errorbar_limits
    -
    - -
    - errorbar_limits
    -
    errorbar_limits
    -
    - -
    - errorbar_subsample
    -
    errorbar_subsample
    -
    - -
    - eventcollection_demo
    -
    eventcollection_demo
    -
    - -
    - eventplot_demo
    -
    eventplot_demo
    -
    - -
    - fancyarrow_demo
    -
    fancyarrow_demo
    -
    - -
    - fancybox_demo2
    -
    fancybox_demo2
    -
    - -
    - fancybox_demo
    -
    fancybox_demo
    -
    - -
    - fancytextbox_demo
    -
    fancytextbox_demo
    -
    - -
    - figimage_demo
    -
    figimage_demo
    -
    - -
    - figlegend_demo
    -
    figlegend_demo
    -
    - -
    - figure_title
    -
    figure_title
    -
    - -
    - fill_between_demo
    -
    fill_between_demo
    -
    - -
    - fill_between_demo
    -
    fill_between_demo
    -
    - -
    - fill_between_demo
    -
    fill_between_demo
    -
    - -
    - fill_betweenx_demo
    -
    fill_betweenx_demo
    -
    - -
    - fill_betweenx_demo
    -
    fill_betweenx_demo
    -
    - -
    - fill_spiral
    -
    fill_spiral
    -
    - -
    - findobj_demo
    -
    findobj_demo
    -
    - -
    - fonts_demo
    -
    fonts_demo
    -
    - -
    - fonts_demo_kw
    -
    fonts_demo_kw
    -
    - -
    - ganged_plots
    -
    ganged_plots
    -
    - -
    - geo_demo
    -
    geo_demo
    -
    - -
    - geo_demo
    -
    geo_demo
    -
    - -
    - geo_demo
    -
    geo_demo
    -
    - -
    - geo_demo
    -
    geo_demo
    -
    - -
    - gradient_bar
    -
    gradient_bar
    -
    - -
    - griddata_demo
    -
    griddata_demo
    -
    - -
    - hatch_demo
    -
    hatch_demo
    -
    - -
    - hexbin_demo
    -
    hexbin_demo
    -
    - -
    - hexbin_demo2
    -
    hexbin_demo2
    -
    - -
    - hist2d_demo
    -
    hist2d_demo
    -
    - -
    - hist2d_log_demo
    -
    hist2d_log_demo
    -
    - -
    - hist_colormapped
    -
    hist_colormapped
    -
    - -
    - histogram_percent_demo
    -
    histogram_percent_demo
    -
    - -
    - image_clip_path
    -
    image_clip_path
    -
    - -
    - image_demo
    -
    image_demo
    -
    - -
    - image_demo2
    -
    image_demo2
    -
    - -
    - image_interp
    -
    image_interp
    -
    - -
    - image_interp
    -
    image_interp
    -
    - -
    - image_interp
    -
    image_interp
    -
    - -
    - image_masked
    -
    image_masked
    -
    - -
    - image_nonuniform
    -
    image_nonuniform
    -
    - -
    - image_origin
    -
    image_origin
    -
    - -
    - image_slices_viewer
    -
    image_slices_viewer
    -
    - -
    - interp_demo
    -
    interp_demo
    -
    - -
    - invert_axes
    -
    invert_axes
    -
    - -
    - layer_images
    -
    layer_images
    -
    - -
    - leftventricle_bulleye
    -
    leftventricle_bulleye
    -
    - -
    - legend_demo2
    -
    legend_demo2
    -
    - -
    - legend_demo3
    -
    legend_demo3
    -
    - -
    - legend_demo4
    -
    legend_demo4
    -
    - -
    - legend_demo5
    -
    legend_demo5
    -
    - -
    - line_collection
    -
    line_collection
    -
    - -
    - line_collection2
    -
    line_collection2
    -
    - -
    - load_converter
    -
    load_converter
    -
    - -
    - loadrec
    -
    loadrec
    -
    - -
    - log_bar
    -
    log_bar
    -
    - -
    - log_demo
    -
    log_demo
    -
    - -
    - log_test
    -
    log_test
    -
    - -
    - logo
    -
    logo
    -
    - -
    - major_minor_demo1
    -
    major_minor_demo1
    -
    - -
    - major_minor_demo2
    -
    major_minor_demo2
    -
    - -
    - manual_axis
    -
    manual_axis
    -
    - -
    - marker_path
    -
    marker_path
    -
    - -
    - markevery_demo
    -
    markevery_demo
    -
    - -
    - markevery_demo
    -
    markevery_demo
    -
    - -
    - markevery_demo
    -
    markevery_demo
    -
    - -
    - markevery_demo
    -
    markevery_demo
    -
    - -
    - masked_demo
    -
    masked_demo
    -
    - -
    - mathtext_demo
    -
    mathtext_demo
    -
    - -
    - mathtext_examples
    -
    mathtext_examples
    -
    - -
    - matshow
    -
    matshow
    -
    - -
    - mri_demo
    -
    mri_demo
    -
    - -
    - mri_with_eeg
    -
    mri_with_eeg
    -
    - -
    - multi_image
    -
    multi_image
    -
    - -
    - multicolored_line
    -
    multicolored_line
    -
    - -
    - multicolored_line
    -
    multicolored_line
    -
    - -
    - multiline
    -
    multiline
    -
    - -
    - multiple_figs_demo
    -
    multiple_figs_demo
    -
    - -
    - multiple_figs_demo
    -
    multiple_figs_demo
    -
    - -
    - multiple_yaxis_with_spines
    -
    multiple_yaxis_with_spines
    -
    - -
    - nan_test
    -
    nan_test
    -
    - -
    - newscalarformatter_demo
    -
    newscalarformatter_demo
    -
    - -
    - newscalarformatter_demo
    -
    newscalarformatter_demo
    -
    - -
    - newscalarformatter_demo
    -
    newscalarformatter_demo
    -
    - -
    - newscalarformatter_demo
    -
    newscalarformatter_demo
    -
    - -
    - patheffect_demo
    -
    patheffect_demo
    -
    - -
    - pcolor_demo
    -
    pcolor_demo
    -
    - -
    - pcolor_log
    -
    pcolor_log
    -
    - -
    - pcolor_small
    -
    pcolor_small
    -
    - -
    - pie_demo2
    -
    pie_demo2
    -
    - -
    - plotfile_demo
    -
    plotfile_demo
    -
    - -
    - plotfile_demo
    -
    plotfile_demo
    -
    - -
    - plotfile_demo
    -
    plotfile_demo
    -
    - -
    - plotfile_demo
    -
    plotfile_demo
    -
    - -
    - plotfile_demo
    -
    plotfile_demo
    -
    - -
    - plotfile_demo
    -
    plotfile_demo
    -
    - -
    - plotfile_demo
    -
    plotfile_demo
    -
    - -
    - plotfile_demo
    -
    plotfile_demo
    -
    - -
    - polar_demo
    -
    polar_demo
    -
    - -
    - polar_legend
    -
    polar_legend
    -
    - -
    - psd_demo2
    -
    psd_demo2
    -
    - -
    - psd_demo3
    -
    psd_demo3
    -
    - -
    - psd_demo
    -
    psd_demo
    -
    - -
    - psd_demo_complex
    -
    psd_demo_complex
    -
    - -
    - pythonic_matplotlib
    -
    pythonic_matplotlib
    -
    - -
    - quadmesh_demo
    -
    quadmesh_demo
    -
    - -
    - quiver_demo
    -
    quiver_demo
    -
    - -
    - quiver_demo
    -
    quiver_demo
    -
    - -
    - quiver_demo
    -
    quiver_demo
    -
    - -
    - quiver_simple_demo
    -
    quiver_simple_demo
    -
    - -
    - scatter_custom_symbol
    -
    scatter_custom_symbol
    -
    - -
    - scatter_demo2
    -
    scatter_demo2
    -
    - -
    - scatter_hist
    -
    scatter_hist
    -
    - -
    - scatter_masked
    -
    scatter_masked
    -
    - -
    - scatter_profile
    -
    scatter_profile
    -
    - -
    - scatter_star_poly
    -
    scatter_star_poly
    -
    - -
    - scatter_symbol
    -
    scatter_symbol
    -
    - -
    - set_and_get
    -
    set_and_get
    -
    - -
    - shading_example
    -
    shading_example
    -
    - -
    - shading_example
    -
    shading_example
    -
    - -
    - shared_axis_across_figures
    -
    shared_axis_across_figures
    -
    - -
    - shared_axis_across_figures
    -
    shared_axis_across_figures
    -
    - -
    - shared_axis_demo
    -
    shared_axis_demo
    -
    - -
    - simple_plot
    -
    simple_plot
    -
    - -
    - specgram_demo
    -
    specgram_demo
    -
    - -
    - spectrum_demo
    -
    spectrum_demo
    -
    - -
    - spine_placement_demo
    -
    spine_placement_demo
    -
    - -
    - spine_placement_demo
    -
    spine_placement_demo
    -
    - -
    - spy_demos
    -
    spy_demos
    -
    - -
    - stackplot_demo2
    -
    stackplot_demo2
    -
    - -
    - stackplot_demo
    -
    stackplot_demo
    -
    - -
    - stackplot_demo
    -
    stackplot_demo
    -
    - -
    - stem_plot
    -
    stem_plot
    -
    - -
    - step_demo
    -
    step_demo
    -
    - -
    - stix_fonts_demo
    -
    stix_fonts_demo
    -
    - -
    - subplot_demo
    -
    subplot_demo
    -
    - -
    - subplot_toolbar
    -
    subplot_toolbar
    -
    - -
    - subplot_toolbar
    -
    subplot_toolbar
    -
    - -
    - subplots_adjust
    -
    subplots_adjust
    -
    - -
    - subplots_demo
    -
    subplots_demo
    -
    - -
    - subplots_demo
    -
    subplots_demo
    -
    - -
    - subplots_demo
    -
    subplots_demo
    -
    - -
    - subplots_demo
    -
    subplots_demo
    -
    - -
    - subplots_demo
    -
    subplots_demo
    -
    - -
    - subplots_demo
    -
    subplots_demo
    -
    - -
    - subplots_demo
    -
    subplots_demo
    -
    - -
    - symlog_demo
    -
    symlog_demo
    -
    - -
    - system_monitor
    -
    system_monitor
    -
    - -
    - table_demo
    -
    table_demo
    -
    - -
    - tex_demo
    -
    tex_demo
    -
    - -
    - tex_unicode_demo
    -
    tex_unicode_demo
    -
    - -
    - text_handles
    -
    text_handles
    -
    - -
    - text_rotation
    -
    text_rotation
    -
    - -
    - text_rotation_relative_to_line
    -
    text_rotation_relative_to_line
    -
    - -
    - titles_demo
    -
    titles_demo
    -
    - -
    - toggle_images
    -
    toggle_images
    -
    - -
    - transoffset
    -
    transoffset
    -
    - -
    - tricontour_demo
    -
    tricontour_demo
    -
    - -
    - tricontour_demo
    -
    tricontour_demo
    -
    - -
    - tricontour_smooth_delaunay
    -
    tricontour_smooth_delaunay
    -
    - -
    - tricontour_smooth_user
    -
    tricontour_smooth_user
    -
    - -
    - tricontour_vs_griddata
    -
    tricontour_vs_griddata
    -
    - -
    - trigradient_demo
    -
    trigradient_demo
    -
    - -
    - triinterp_demo
    -
    triinterp_demo
    -
    - -
    - tripcolor_demo
    -
    tripcolor_demo
    -
    - -
    - tripcolor_demo
    -
    tripcolor_demo
    -
    - -
    - tripcolor_demo
    -
    tripcolor_demo
    -
    - -
    - triplot_demo
    -
    triplot_demo
    -
    - -
    - triplot_demo
    -
    triplot_demo
    -
    - -
    - usetex_baseline_test
    -
    usetex_baseline_test
    -
    - -
    - usetex_demo
    -
    usetex_demo
    -
    - -
    - usetex_fonteffects
    -
    usetex_fonteffects
    -
    - -
    - vline_hline_demo
    -
    vline_hline_demo
    -
    - -
    - xcorr_demo
    -
    xcorr_demo
    -
    - -
    - zorder_demo
    -
    zorder_demo
    -
    - -
    - zorder_demo
    -
    zorder_demo
    -
    - -
    -
    -

    - mplot3d toolkit -

    -
    - 2dcollections3d_demo
    -
    2dcollections3d_demo
    -
    - -
    - bars3d_demo
    -
    bars3d_demo
    -
    - -
    - contour3d_demo
    -
    contour3d_demo
    -
    - -
    - contour3d_demo2
    -
    contour3d_demo2
    -
    - -
    - contour3d_demo3
    -
    contour3d_demo3
    -
    - -
    - contourf3d_demo
    -
    contourf3d_demo
    -
    - -
    - contourf3d_demo2
    -
    contourf3d_demo2
    -
    - -
    - custom_shaded_3d_surface
    -
    custom_shaded_3d_surface
    -
    - -
    - hist3d_demo
    -
    hist3d_demo
    -
    - -
    - lines3d_demo
    -
    lines3d_demo
    -
    - -
    - lorenz_attractor
    -
    lorenz_attractor
    -
    - -
    - mixed_subplots_demo
    -
    mixed_subplots_demo
    -
    - -
    - offset_demo
    -
    offset_demo
    -
    - -
    - pathpatch3d_demo
    -
    pathpatch3d_demo
    -
    - -
    - polys3d_demo
    -
    polys3d_demo
    -
    - -
    - quiver3d_demo
    -
    quiver3d_demo
    -
    - -
    - rotate_axes3d_demo
    -
    rotate_axes3d_demo
    -
    - -
    - scatter3d_demo
    -
    scatter3d_demo
    -
    - -
    - subplot3d_demo
    -
    subplot3d_demo
    -
    - -
    - surface3d_demo
    -
    surface3d_demo
    -
    - -
    - surface3d_demo2
    -
    surface3d_demo2
    -
    - -
    - surface3d_demo3
    -
    surface3d_demo3
    -
    - -
    - surface3d_radial_demo
    -
    surface3d_radial_demo
    -
    - -
    - text3d_demo
    -
    text3d_demo
    -
    - -
    - tricontour3d_demo
    -
    tricontour3d_demo
    -
    - -
    - tricontourf3d_demo
    -
    tricontourf3d_demo
    -
    - -
    - trisurf3d_demo
    -
    trisurf3d_demo
    -
    - -
    - trisurf3d_demo2
    -
    trisurf3d_demo2
    -
    - -
    - wire3d_animation_demo
    -
    wire3d_animation_demo
    -
    - -
    - wire3d_demo
    -
    wire3d_demo
    -
    - -
    - wire3d_zero_stride
    -
    wire3d_zero_stride
    -
    - -
    - -
    -

    - widgets -

    -
    - cursor
    -
    cursor
    -
    - -
    - slider_demo
    -
    slider_demo
    -
    - -
    -
    -

    - Miscellaneous examples -

    -
    - contour_manual
    -
    contour_manual
    -
    - -
    - contour_manual
    -
    contour_manual
    -
    - -
    - rasterization_demo
    -
    rasterization_demo
    -
    - -
    - sample_data_demo
    -
    sample_data_demo
    -
    - -
    - svg_filter_line
    -
    svg_filter_line
    -
    - -
    - svg_filter_pie
    -
    svg_filter_pie
    -
    - -
    - tight_bbox_test
    -
    tight_bbox_test
    -
    - -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/mpl_examples/api/barchart_demo.hires.png b/mpl_examples/api/barchart_demo.hires.png deleted file mode 100644 index d225a09c622..00000000000 Binary files a/mpl_examples/api/barchart_demo.hires.png and /dev/null differ diff --git a/mpl_examples/api/barchart_demo.pdf b/mpl_examples/api/barchart_demo.pdf deleted file mode 100644 index bf6a20567e6..00000000000 Binary files a/mpl_examples/api/barchart_demo.pdf and /dev/null differ diff --git a/mpl_examples/api/barchart_demo.png b/mpl_examples/api/barchart_demo.png deleted file mode 100644 index 7452e8793d9..00000000000 Binary files a/mpl_examples/api/barchart_demo.png and /dev/null differ diff --git a/mpl_examples/api/barchart_demo.py b/mpl_examples/api/barchart_demo.py deleted file mode 100644 index f5111d94506..00000000000 --- a/mpl_examples/api/barchart_demo.py +++ /dev/null @@ -1,47 +0,0 @@ -""" -======== -Barchart -======== - -A bar plot with errorbars and height labels on individual bars -""" -import numpy as np -import matplotlib.pyplot as plt - -N = 5 -men_means = (20, 35, 30, 35, 27) -men_std = (2, 3, 4, 1, 2) - -ind = np.arange(N) # the x locations for the groups -width = 0.35 # the width of the bars - -fig, ax = plt.subplots() -rects1 = ax.bar(ind, men_means, width, color='r', yerr=men_std) - -women_means = (25, 32, 34, 20, 25) -women_std = (3, 5, 2, 3, 3) -rects2 = ax.bar(ind + width, women_means, width, color='y', yerr=women_std) - -# add some text for labels, title and axes ticks -ax.set_ylabel('Scores') -ax.set_title('Scores by group and gender') -ax.set_xticks(ind + width / 2) -ax.set_xticklabels(('G1', 'G2', 'G3', 'G4', 'G5')) - -ax.legend((rects1[0], rects2[0]), ('Men', 'Women')) - - -def autolabel(rects): - """ - Attach a text label above each bar displaying its height - """ - for rect in rects: - height = rect.get_height() - ax.text(rect.get_x() + rect.get_width()/2., 1.05*height, - '%d' % int(height), - ha='center', va='bottom') - -autolabel(rects1) -autolabel(rects2) - -plt.show() diff --git a/mpl_examples/api/bbox_intersect.hires.png b/mpl_examples/api/bbox_intersect.hires.png deleted file mode 100644 index 9961acbb22a..00000000000 Binary files a/mpl_examples/api/bbox_intersect.hires.png and /dev/null differ diff --git a/mpl_examples/api/bbox_intersect.pdf b/mpl_examples/api/bbox_intersect.pdf deleted file mode 100644 index 3d5727e7741..00000000000 Binary files a/mpl_examples/api/bbox_intersect.pdf and /dev/null differ diff --git a/mpl_examples/api/bbox_intersect.png b/mpl_examples/api/bbox_intersect.png deleted file mode 100644 index bb9b7dc5e9d..00000000000 Binary files a/mpl_examples/api/bbox_intersect.png and /dev/null differ diff --git a/mpl_examples/api/bbox_intersect.py b/mpl_examples/api/bbox_intersect.py deleted file mode 100644 index 439bc83e31e..00000000000 --- a/mpl_examples/api/bbox_intersect.py +++ /dev/null @@ -1,33 +0,0 @@ -""" -=========================================== -Changing colors of lines intersecting a box -=========================================== - -The lines intersecting the rectangle are colored in red, while the others -are left as blue lines. This example showcases the `intersect_bbox` function. - -""" - -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.transforms import Bbox -from matplotlib.path import Path - -left, bottom, width, height = (-1, -1, 2, 2) -rect = plt.Rectangle((left, bottom), width, height, facecolor="#aaaaaa") - -fig, ax = plt.subplots() -ax.add_patch(rect) - -bbox = Bbox.from_bounds(left, bottom, width, height) - -for i in range(12): - vertices = (np.random.random((2, 2)) - 0.5) * 6.0 - path = Path(vertices) - if path.intersects_bbox(bbox): - color = 'r' - else: - color = 'b' - ax.plot(vertices[:, 0], vertices[:, 1], color=color) - -plt.show() diff --git a/mpl_examples/api/collections_demo.hires.png b/mpl_examples/api/collections_demo.hires.png deleted file mode 100644 index d176c7f9176..00000000000 Binary files a/mpl_examples/api/collections_demo.hires.png and /dev/null differ diff --git a/mpl_examples/api/collections_demo.pdf b/mpl_examples/api/collections_demo.pdf deleted file mode 100644 index 7016b12777e..00000000000 Binary files a/mpl_examples/api/collections_demo.pdf and /dev/null differ diff --git a/mpl_examples/api/collections_demo.png b/mpl_examples/api/collections_demo.png deleted file mode 100644 index 16642feb82b..00000000000 Binary files a/mpl_examples/api/collections_demo.png and /dev/null differ diff --git a/mpl_examples/api/collections_demo.py b/mpl_examples/api/collections_demo.py deleted file mode 100644 index a9259f048d8..00000000000 --- a/mpl_examples/api/collections_demo.py +++ /dev/null @@ -1,128 +0,0 @@ -''' -========================================================= -Line, Poly and RegularPoly Collection with autoscaling -========================================================= - -For the first two subplots, we will use spirals. Their -size will be set in plot units, not data units. Their positions -will be set in data units by using the "offsets" and "transOffset" -kwargs of the LineCollection and PolyCollection. - -The third subplot will make regular polygons, with the same -type of scaling and positioning as in the first two. - -The last subplot illustrates the use of "offsets=(xo,yo)", -that is, a single tuple instead of a list of tuples, to generate -successively offset curves, with the offset given in data -units. This behavior is available only for the LineCollection. - -''' - -import matplotlib.pyplot as plt -from matplotlib import collections, colors, transforms -import numpy as np - -nverts = 50 -npts = 100 - -# Make some spirals -r = np.arange(nverts) -theta = np.linspace(0, 2*np.pi, nverts) -xx = r * np.sin(theta) -yy = r * np.cos(theta) -spiral = list(zip(xx, yy)) - -# Make some offsets -rs = np.random.RandomState([12345678]) -xo = rs.randn(npts) -yo = rs.randn(npts) -xyo = list(zip(xo, yo)) - -# Make a list of colors cycling through the default series. -colors = [colors.to_rgba(c) - for c in plt.rcParams['axes.prop_cycle'].by_key()['color']] - -fig, axes = plt.subplots(2, 2) -fig.subplots_adjust(top=0.92, left=0.07, right=0.97, - hspace=0.3, wspace=0.3) -((ax1, ax2), (ax3, ax4)) = axes # unpack the axes - - -col = collections.LineCollection([spiral], offsets=xyo, - transOffset=ax1.transData) -trans = fig.dpi_scale_trans + transforms.Affine2D().scale(1.0/72.0) -col.set_transform(trans) # the points to pixels transform -# Note: the first argument to the collection initializer -# must be a list of sequences of x,y tuples; we have only -# one sequence, but we still have to put it in a list. -ax1.add_collection(col, autolim=True) -# autolim=True enables autoscaling. For collections with -# offsets like this, it is neither efficient nor accurate, -# but it is good enough to generate a plot that you can use -# as a starting point. If you know beforehand the range of -# x and y that you want to show, it is better to set them -# explicitly, leave out the autolim kwarg (or set it to False), -# and omit the 'ax1.autoscale_view()' call below. - -# Make a transform for the line segments such that their size is -# given in points: -col.set_color(colors) - -ax1.autoscale_view() # See comment above, after ax1.add_collection. -ax1.set_title('LineCollection using offsets') - - -# The same data as above, but fill the curves. -col = collections.PolyCollection([spiral], offsets=xyo, - transOffset=ax2.transData) -trans = transforms.Affine2D().scale(fig.dpi/72.0) -col.set_transform(trans) # the points to pixels transform -ax2.add_collection(col, autolim=True) -col.set_color(colors) - - -ax2.autoscale_view() -ax2.set_title('PolyCollection using offsets') - -# 7-sided regular polygons - -col = collections.RegularPolyCollection(7, - sizes=np.fabs(xx) * 10.0, offsets=xyo, - transOffset=ax3.transData) -trans = transforms.Affine2D().scale(fig.dpi / 72.0) -col.set_transform(trans) # the points to pixels transform -ax3.add_collection(col, autolim=True) -col.set_color(colors) -ax3.autoscale_view() -ax3.set_title('RegularPolyCollection using offsets') - - -# Simulate a series of ocean current profiles, successively -# offset by 0.1 m/s so that they form what is sometimes called -# a "waterfall" plot or a "stagger" plot. - -nverts = 60 -ncurves = 20 -offs = (0.1, 0.0) - -yy = np.linspace(0, 2*np.pi, nverts) -ym = np.amax(yy) -xx = (0.2 + (ym - yy)/ym)**2 * np.cos(yy - 0.4)*0.5 -segs = [] -for i in range(ncurves): - xxx = xx + 0.02*rs.randn(nverts) - curve = list(zip(xxx, yy*100)) - segs.append(curve) - -col = collections.LineCollection(segs, offsets=offs) -ax4.add_collection(col, autolim=True) -col.set_color(colors) -ax4.autoscale_view() -ax4.set_title('Successive data offsets') -ax4.set_xlabel('Zonal velocity component (m/s)') -ax4.set_ylabel('Depth (m)') -# Reverse the y-axis so depth increases downward -ax4.set_ylim(ax4.get_ylim()[::-1]) - - -plt.show() diff --git a/mpl_examples/api/colorbar_basics.pdf b/mpl_examples/api/colorbar_basics.pdf deleted file mode 100644 index 74f5f24187d..00000000000 Binary files a/mpl_examples/api/colorbar_basics.pdf and /dev/null differ diff --git a/mpl_examples/api/colorbar_basics.png b/mpl_examples/api/colorbar_basics.png deleted file mode 100644 index 5ef231da58e..00000000000 Binary files a/mpl_examples/api/colorbar_basics.png and /dev/null differ diff --git a/mpl_examples/api/colorbar_basics.py b/mpl_examples/api/colorbar_basics.py deleted file mode 100644 index 922d76d7072..00000000000 --- a/mpl_examples/api/colorbar_basics.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -======== -Colorbar -======== - -This example shows how to use colorbar by specifying the mappable object (here -the imshow returned object) and the axes to attach the colorbar to. -""" - -import numpy as np -import matplotlib.pyplot as plt - -# setup some generic data -N = 37 -x, y = np.mgrid[:N, :N] -Z = (np.cos(x*0.2) + np.sin(y*0.3)) - -# mask out the negative and positve values, respectively -Zpos = np.ma.masked_less(Z, 0) -Zneg = np.ma.masked_greater(Z, 0) - -fig, (ax1, ax2) = plt.subplots(figsize=(8, 3), ncols=2) - -# plot just the positive data and save the -# color "mappable" object returned by ax1.imshow -pos = ax1.imshow(Zpos, cmap='Blues', interpolation='none') - -# add the colorbar using the figure's method, -# telling which mappable we're talking about and -# which axes object it should be near -fig.colorbar(pos, ax=ax1) - -# repeat everything above for the the negative data -neg = ax2.imshow(Zneg, cmap='Reds_r', interpolation='none') -fig.colorbar(neg, ax=ax2) - -plt.show() diff --git a/mpl_examples/api/colorbar_only.hires.png b/mpl_examples/api/colorbar_only.hires.png deleted file mode 100644 index d537812431b..00000000000 Binary files a/mpl_examples/api/colorbar_only.hires.png and /dev/null differ diff --git a/mpl_examples/api/colorbar_only.pdf b/mpl_examples/api/colorbar_only.pdf deleted file mode 100644 index 2d30d79481b..00000000000 Binary files a/mpl_examples/api/colorbar_only.pdf and /dev/null differ diff --git a/mpl_examples/api/colorbar_only.png b/mpl_examples/api/colorbar_only.png deleted file mode 100644 index 6cc20cd1a9e..00000000000 Binary files a/mpl_examples/api/colorbar_only.png and /dev/null differ diff --git a/mpl_examples/api/colorbar_only.py b/mpl_examples/api/colorbar_only.py deleted file mode 100644 index a31600a600b..00000000000 --- a/mpl_examples/api/colorbar_only.py +++ /dev/null @@ -1,78 +0,0 @@ -''' -==================== -Customized colorbars -==================== - -This example shows how to build colorbars without an attached mappable. -''' - -import matplotlib.pyplot as plt -import matplotlib as mpl - -# Make a figure and axes with dimensions as desired. -fig = plt.figure(figsize=(8, 3)) -ax1 = fig.add_axes([0.05, 0.80, 0.9, 0.15]) -ax2 = fig.add_axes([0.05, 0.475, 0.9, 0.15]) -ax3 = fig.add_axes([0.05, 0.15, 0.9, 0.15]) - -# Set the colormap and norm to correspond to the data for which -# the colorbar will be used. -cmap = mpl.cm.cool -norm = mpl.colors.Normalize(vmin=5, vmax=10) - -# ColorbarBase derives from ScalarMappable and puts a colorbar -# in a specified axes, so it has everything needed for a -# standalone colorbar. There are many more kwargs, but the -# following gives a basic continuous colorbar with ticks -# and labels. -cb1 = mpl.colorbar.ColorbarBase(ax1, cmap=cmap, - norm=norm, - orientation='horizontal') -cb1.set_label('Some Units') - -# The second example illustrates the use of a ListedColormap, a -# BoundaryNorm, and extended ends to show the "over" and "under" -# value colors. -cmap = mpl.colors.ListedColormap(['r', 'g', 'b', 'c']) -cmap.set_over('0.25') -cmap.set_under('0.75') - -# If a ListedColormap is used, the length of the bounds array must be -# one greater than the length of the color list. The bounds must be -# monotonically increasing. -bounds = [1, 2, 4, 7, 8] -norm = mpl.colors.BoundaryNorm(bounds, cmap.N) -cb2 = mpl.colorbar.ColorbarBase(ax2, cmap=cmap, - norm=norm, - # to use 'extend', you must - # specify two extra boundaries: - boundaries=[0] + bounds + [13], - extend='both', - ticks=bounds, # optional - spacing='proportional', - orientation='horizontal') -cb2.set_label('Discrete intervals, some other units') - -# The third example illustrates the use of custom length colorbar -# extensions, used on a colorbar with discrete intervals. -cmap = mpl.colors.ListedColormap([[0., .4, 1.], [0., .8, 1.], - [1., .8, 0.], [1., .4, 0.]]) -cmap.set_over((1., 0., 0.)) -cmap.set_under((0., 0., 1.)) - -bounds = [-1., -.5, 0., .5, 1.] -norm = mpl.colors.BoundaryNorm(bounds, cmap.N) -cb3 = mpl.colorbar.ColorbarBase(ax3, cmap=cmap, - norm=norm, - boundaries=[-10] + bounds + [10], - extend='both', - # Make the length of each extension - # the same as the length of the - # interior colors: - extendfrac='auto', - ticks=bounds, - spacing='uniform', - orientation='horizontal') -cb3.set_label('Custom extension lengths, some other units') - -plt.show() diff --git a/mpl_examples/api/compound_path.hires.png b/mpl_examples/api/compound_path.hires.png deleted file mode 100644 index 779f68162f2..00000000000 Binary files a/mpl_examples/api/compound_path.hires.png and /dev/null differ diff --git a/mpl_examples/api/compound_path.pdf b/mpl_examples/api/compound_path.pdf deleted file mode 100644 index 0107a5cce17..00000000000 Binary files a/mpl_examples/api/compound_path.pdf and /dev/null differ diff --git a/mpl_examples/api/compound_path.png b/mpl_examples/api/compound_path.png deleted file mode 100644 index fd499004146..00000000000 Binary files a/mpl_examples/api/compound_path.png and /dev/null differ diff --git a/mpl_examples/api/compound_path.py b/mpl_examples/api/compound_path.py deleted file mode 100644 index 25dc23da6ad..00000000000 --- a/mpl_examples/api/compound_path.py +++ /dev/null @@ -1,38 +0,0 @@ -""" -============= -Compound path -============= - -Make a compound path -- in this case two simple polygons, a rectangle -and a triangle. Use CLOSEPOLY and MOVETO for the different parts of -the compound path -""" -import numpy as np -from matplotlib.path import Path -from matplotlib.patches import PathPatch -import matplotlib.pyplot as plt - - -vertices = [] -codes = [] - -codes = [Path.MOVETO] + [Path.LINETO]*3 + [Path.CLOSEPOLY] -vertices = [(1, 1), (1, 2), (2, 2), (2, 1), (0, 0)] - -codes += [Path.MOVETO] + [Path.LINETO]*2 + [Path.CLOSEPOLY] -vertices += [(4, 4), (5, 5), (5, 4), (0, 0)] - -vertices = np.array(vertices, float) -path = Path(vertices, codes) - -pathpatch = PathPatch(path, facecolor='None', edgecolor='green') - -fig, ax = plt.subplots() -ax.add_patch(pathpatch) -ax.set_title('A compound path') - -ax.dataLim.update_from_data_xy(vertices) -ax.autoscale_view() - - -plt.show() diff --git a/mpl_examples/api/custom_projection_example.hires.png b/mpl_examples/api/custom_projection_example.hires.png deleted file mode 100644 index 2f42f53927a..00000000000 Binary files a/mpl_examples/api/custom_projection_example.hires.png and /dev/null differ diff --git a/mpl_examples/api/custom_projection_example.pdf b/mpl_examples/api/custom_projection_example.pdf deleted file mode 100644 index 8805e25961d..00000000000 Binary files a/mpl_examples/api/custom_projection_example.pdf and /dev/null differ diff --git a/mpl_examples/api/custom_projection_example.png b/mpl_examples/api/custom_projection_example.png deleted file mode 100644 index a93a30c79aa..00000000000 Binary files a/mpl_examples/api/custom_projection_example.png and /dev/null differ diff --git a/mpl_examples/api/custom_projection_example.py b/mpl_examples/api/custom_projection_example.py deleted file mode 100644 index 4078d63652f..00000000000 --- a/mpl_examples/api/custom_projection_example.py +++ /dev/null @@ -1,477 +0,0 @@ -""" -================= -Custom projection -================= - -This example showcases the Hammer projection by alleviating many features of -matplotlib. -""" - - -from __future__ import unicode_literals - -import matplotlib -from matplotlib.axes import Axes -from matplotlib.patches import Circle -from matplotlib.path import Path -from matplotlib.ticker import NullLocator, Formatter, FixedLocator -from matplotlib.transforms import Affine2D, BboxTransformTo, Transform -from matplotlib.projections import register_projection -import matplotlib.spines as mspines -import matplotlib.axis as maxis -import numpy as np - -rcParams = matplotlib.rcParams - -# This example projection class is rather long, but it is designed to -# illustrate many features, not all of which will be used every time. -# It is also common to factor out a lot of these methods into common -# code used by a number of projections with similar characteristics -# (see geo.py). - - -class GeoAxes(Axes): - """ - An abstract base class for geographic projections - """ - class ThetaFormatter(Formatter): - """ - Used to format the theta tick labels. Converts the native - unit of radians into degrees and adds a degree symbol. - """ - def __init__(self, round_to=1.0): - self._round_to = round_to - - def __call__(self, x, pos=None): - degrees = (x / np.pi) * 180.0 - degrees = np.round(degrees / self._round_to) * self._round_to - if rcParams['text.usetex'] and not rcParams['text.latex.unicode']: - return r"$%0.0f^\circ$" % degrees - else: - return "%0.0f\u00b0" % degrees - - RESOLUTION = 75 - - def _init_axis(self): - self.xaxis = maxis.XAxis(self) - self.yaxis = maxis.YAxis(self) - # Do not register xaxis or yaxis with spines -- as done in - # Axes._init_axis() -- until GeoAxes.xaxis.cla() works. - # self.spines['geo'].register_axis(self.yaxis) - self._update_transScale() - - def cla(self): - Axes.cla(self) - - self.set_longitude_grid(30) - self.set_latitude_grid(15) - self.set_longitude_grid_ends(75) - self.xaxis.set_minor_locator(NullLocator()) - self.yaxis.set_minor_locator(NullLocator()) - self.xaxis.set_ticks_position('none') - self.yaxis.set_ticks_position('none') - self.yaxis.set_tick_params(label1On=True) - # Why do we need to turn on yaxis tick labels, but - # xaxis tick labels are already on? - - self.grid(rcParams['axes.grid']) - - Axes.set_xlim(self, -np.pi, np.pi) - Axes.set_ylim(self, -np.pi / 2.0, np.pi / 2.0) - - def _set_lim_and_transforms(self): - # A (possibly non-linear) projection on the (already scaled) data - - # There are three important coordinate spaces going on here: - # - # 1. Data space: The space of the data itself - # - # 2. Axes space: The unit rectangle (0, 0) to (1, 1) - # covering the entire plot area. - # - # 3. Display space: The coordinates of the resulting image, - # often in pixels or dpi/inch. - - # This function makes heavy use of the Transform classes in - # ``lib/matplotlib/transforms.py.`` For more information, see - # the inline documentation there. - - # The goal of the first two transformations is to get from the - # data space (in this case longitude and latitude) to axes - # space. It is separated into a non-affine and affine part so - # that the non-affine part does not have to be recomputed when - # a simple affine change to the figure has been made (such as - # resizing the window or changing the dpi). - - # 1) The core transformation from data space into - # rectilinear space defined in the HammerTransform class. - self.transProjection = self._get_core_transform(self.RESOLUTION) - - # 2) The above has an output range that is not in the unit - # rectangle, so scale and translate it so it fits correctly - # within the axes. The peculiar calculations of xscale and - # yscale are specific to a Aitoff-Hammer projection, so don't - # worry about them too much. - self.transAffine = self._get_affine_transform() - - # 3) This is the transformation from axes space to display - # space. - self.transAxes = BboxTransformTo(self.bbox) - - # Now put these 3 transforms together -- from data all the way - # to display coordinates. Using the '+' operator, these - # transforms will be applied "in order". The transforms are - # automatically simplified, if possible, by the underlying - # transformation framework. - self.transData = \ - self.transProjection + \ - self.transAffine + \ - self.transAxes - - # The main data transformation is set up. Now deal with - # gridlines and tick labels. - - # Longitude gridlines and ticklabels. The input to these - # transforms are in display space in x and axes space in y. - # Therefore, the input values will be in range (-xmin, 0), - # (xmax, 1). The goal of these transforms is to go from that - # space to display space. The tick labels will be offset 4 - # pixels from the equator. - self._xaxis_pretransform = \ - Affine2D() \ - .scale(1.0, self._longitude_cap * 2.0) \ - .translate(0.0, -self._longitude_cap) - self._xaxis_transform = \ - self._xaxis_pretransform + \ - self.transData - self._xaxis_text1_transform = \ - Affine2D().scale(1.0, 0.0) + \ - self.transData + \ - Affine2D().translate(0.0, 4.0) - self._xaxis_text2_transform = \ - Affine2D().scale(1.0, 0.0) + \ - self.transData + \ - Affine2D().translate(0.0, -4.0) - - # Now set up the transforms for the latitude ticks. The input to - # these transforms are in axes space in x and display space in - # y. Therefore, the input values will be in range (0, -ymin), - # (1, ymax). The goal of these transforms is to go from that - # space to display space. The tick labels will be offset 4 - # pixels from the edge of the axes ellipse. - yaxis_stretch = Affine2D().scale(np.pi*2, 1).translate(-np.pi, 0) - yaxis_space = Affine2D().scale(1.0, 1.1) - self._yaxis_transform = \ - yaxis_stretch + \ - self.transData - yaxis_text_base = \ - yaxis_stretch + \ - self.transProjection + \ - (yaxis_space + - self.transAffine + - self.transAxes) - self._yaxis_text1_transform = \ - yaxis_text_base + \ - Affine2D().translate(-8.0, 0.0) - self._yaxis_text2_transform = \ - yaxis_text_base + \ - Affine2D().translate(8.0, 0.0) - - def _get_affine_transform(self): - transform = self._get_core_transform(1) - xscale, _ = transform.transform_point((np.pi, 0)) - _, yscale = transform.transform_point((0, np.pi / 2.0)) - return Affine2D() \ - .scale(0.5 / xscale, 0.5 / yscale) \ - .translate(0.5, 0.5) - - def get_xaxis_transform(self, which='grid'): - """ - Override this method to provide a transformation for the - x-axis tick labels. - - Returns a tuple of the form (transform, valign, halign) - """ - if which not in ['tick1', 'tick2', 'grid']: - msg = "'which' must be on of [ 'tick1' | 'tick2' | 'grid' ]" - raise ValueError(msg) - return self._xaxis_transform - - def get_xaxis_text1_transform(self, pad): - return self._xaxis_text1_transform, 'bottom', 'center' - - def get_xaxis_text2_transform(self, pad): - """ - Override this method to provide a transformation for the - secondary x-axis tick labels. - - Returns a tuple of the form (transform, valign, halign) - """ - return self._xaxis_text2_transform, 'top', 'center' - - def get_yaxis_transform(self, which='grid'): - """ - Override this method to provide a transformation for the - y-axis grid and ticks. - """ - if which not in ['tick1', 'tick2', 'grid']: - msg = "'which' must be one of [ 'tick1' | 'tick2' | 'grid' ]" - raise ValueError(msg) - return self._yaxis_transform - - def get_yaxis_text1_transform(self, pad): - """ - Override this method to provide a transformation for the - y-axis tick labels. - - Returns a tuple of the form (transform, valign, halign) - """ - return self._yaxis_text1_transform, 'center', 'right' - - def get_yaxis_text2_transform(self, pad): - """ - Override this method to provide a transformation for the - secondary y-axis tick labels. - - Returns a tuple of the form (transform, valign, halign) - """ - return self._yaxis_text2_transform, 'center', 'left' - - def _gen_axes_patch(self): - """ - Override this method to define the shape that is used for the - background of the plot. It should be a subclass of Patch. - - In this case, it is a Circle (that may be warped by the axes - transform into an ellipse). Any data and gridlines will be - clipped to this shape. - """ - return Circle((0.5, 0.5), 0.5) - - def _gen_axes_spines(self): - return {'geo': mspines.Spine.circular_spine(self, (0.5, 0.5), 0.5)} - - def set_yscale(self, *args, **kwargs): - if args[0] != 'linear': - raise NotImplementedError - - # Prevent the user from applying scales to one or both of the - # axes. In this particular case, scaling the axes wouldn't make - # sense, so we don't allow it. - set_xscale = set_yscale - - # Prevent the user from changing the axes limits. In our case, we - # want to display the whole sphere all the time, so we override - # set_xlim and set_ylim to ignore any input. This also applies to - # interactive panning and zooming in the GUI interfaces. - def set_xlim(self, *args, **kwargs): - raise TypeError("It is not possible to change axes limits " - "for geographic projections. Please consider " - "using Basemap or Cartopy.") - - set_ylim = set_xlim - - def format_coord(self, lon, lat): - """ - Override this method to change how the values are displayed in - the status bar. - - In this case, we want them to be displayed in degrees N/S/E/W. - """ - lon = lon * (180.0 / np.pi) - lat = lat * (180.0 / np.pi) - if lat >= 0.0: - ns = 'N' - else: - ns = 'S' - if lon >= 0.0: - ew = 'E' - else: - ew = 'W' - return '%f\u00b0%s, %f\u00b0%s' % (abs(lat), ns, abs(lon), ew) - - def set_longitude_grid(self, degrees): - """ - Set the number of degrees between each longitude grid. - - This is an example method that is specific to this projection - class -- it provides a more convenient interface to set the - ticking than set_xticks would. - """ - number = (360.0 / degrees) + 1 - self.xaxis.set_major_locator( - FixedLocator( - np.linspace(-np.pi, np.pi, number, True)[1:-1])) - self.xaxis.set_major_formatter(self.ThetaFormatter(degrees)) - - def set_latitude_grid(self, degrees): - """ - Set the number of degrees between each longitude grid. - - This is an example method that is specific to this projection - class -- it provides a more convenient interface than - set_yticks would. - """ - number = (180.0 / degrees) + 1 - self.yaxis.set_major_locator( - FixedLocator( - np.linspace(-np.pi / 2.0, np.pi / 2.0, number, True)[1:-1])) - self.yaxis.set_major_formatter(self.ThetaFormatter(degrees)) - - def set_longitude_grid_ends(self, degrees): - """ - Set the latitude(s) at which to stop drawing the longitude grids. - - Often, in geographic projections, you wouldn't want to draw - longitude gridlines near the poles. This allows the user to - specify the degree at which to stop drawing longitude grids. - - This is an example method that is specific to this projection - class -- it provides an interface to something that has no - analogy in the base Axes class. - """ - self._longitude_cap = degrees * (np.pi / 180.0) - self._xaxis_pretransform \ - .clear() \ - .scale(1.0, self._longitude_cap * 2.0) \ - .translate(0.0, -self._longitude_cap) - - def get_data_ratio(self): - """ - Return the aspect ratio of the data itself. - - This method should be overridden by any Axes that have a - fixed data ratio. - """ - return 1.0 - - # Interactive panning and zooming is not supported with this projection, - # so we override all of the following methods to disable it. - def can_zoom(self): - """ - Return *True* if this axes supports the zoom box button functionality. - This axes object does not support interactive zoom box. - """ - return False - - def can_pan(self): - """ - Return *True* if this axes supports the pan/zoom button functionality. - This axes object does not support interactive pan/zoom. - """ - return False - - def start_pan(self, x, y, button): - pass - - def end_pan(self): - pass - - def drag_pan(self, button, key, x, y): - pass - - -class HammerAxes(GeoAxes): - """ - A custom class for the Aitoff-Hammer projection, an equal-area map - projection. - - https://en.wikipedia.org/wiki/Hammer_projection - """ - - # The projection must specify a name. This will be used by the - # user to select the projection, - # i.e. ``subplot(111, projection='custom_hammer')``. - name = 'custom_hammer' - - class HammerTransform(Transform): - """ - The base Hammer transform. - """ - input_dims = 2 - output_dims = 2 - is_separable = False - - def __init__(self, resolution): - """ - Create a new Hammer transform. Resolution is the number of steps - to interpolate between each input line segment to approximate its - path in curved Hammer space. - """ - Transform.__init__(self) - self._resolution = resolution - - def transform_non_affine(self, ll): - longitude = ll[:, 0:1] - latitude = ll[:, 1:2] - - # Pre-compute some values - half_long = longitude / 2.0 - cos_latitude = np.cos(latitude) - sqrt2 = np.sqrt(2.0) - - alpha = np.sqrt(1.0 + cos_latitude * np.cos(half_long)) - x = (2.0 * sqrt2) * (cos_latitude * np.sin(half_long)) / alpha - y = (sqrt2 * np.sin(latitude)) / alpha - return np.concatenate((x, y), 1) - transform_non_affine.__doc__ = Transform.transform_non_affine.__doc__ - - def transform_path_non_affine(self, path): - # vertices = path.vertices - ipath = path.interpolated(self._resolution) - return Path(self.transform(ipath.vertices), ipath.codes) - transform_path_non_affine.__doc__ = \ - Transform.transform_path_non_affine.__doc__ - - def inverted(self): - return HammerAxes.InvertedHammerTransform(self._resolution) - inverted.__doc__ = Transform.inverted.__doc__ - - class InvertedHammerTransform(Transform): - input_dims = 2 - output_dims = 2 - is_separable = False - - def __init__(self, resolution): - Transform.__init__(self) - self._resolution = resolution - - def transform_non_affine(self, xy): - x = xy[:, 0:1] - y = xy[:, 1:2] - - quarter_x = 0.25 * x - half_y = 0.5 * y - z = np.sqrt(1.0 - quarter_x*quarter_x - half_y*half_y) - longitude = 2 * np.arctan((z*x) / (2.0 * (2.0*z*z - 1.0))) - latitude = np.arcsin(y*z) - return np.concatenate((longitude, latitude), 1) - transform_non_affine.__doc__ = Transform.transform_non_affine.__doc__ - - def inverted(self): - return HammerAxes.HammerTransform(self._resolution) - inverted.__doc__ = Transform.inverted.__doc__ - - def __init__(self, *args, **kwargs): - self._longitude_cap = np.pi / 2.0 - GeoAxes.__init__(self, *args, **kwargs) - self.set_aspect(0.5, adjustable='box', anchor='C') - self.cla() - - def _get_core_transform(self, resolution): - return self.HammerTransform(resolution) - - -# Now register the projection with matplotlib so the user can select -# it. -register_projection(HammerAxes) - - -if __name__ == '__main__': - import matplotlib.pyplot as plt - # Now make a simple example using the custom projection. - plt.subplot(111, projection="custom_hammer") - p = plt.plot([-1, 1, 1], [-1, -1, 1], "o-") - plt.grid(True) - - plt.show() diff --git a/mpl_examples/api/custom_scale_example.hires.png b/mpl_examples/api/custom_scale_example.hires.png deleted file mode 100644 index bbe138a2174..00000000000 Binary files a/mpl_examples/api/custom_scale_example.hires.png and /dev/null differ diff --git a/mpl_examples/api/custom_scale_example.pdf b/mpl_examples/api/custom_scale_example.pdf deleted file mode 100644 index 9fd9d427b2b..00000000000 Binary files a/mpl_examples/api/custom_scale_example.pdf and /dev/null differ diff --git a/mpl_examples/api/custom_scale_example.png b/mpl_examples/api/custom_scale_example.png deleted file mode 100644 index 89db5193221..00000000000 Binary files a/mpl_examples/api/custom_scale_example.png and /dev/null differ diff --git a/mpl_examples/api/custom_scale_example.py b/mpl_examples/api/custom_scale_example.py deleted file mode 100644 index 0400ef1acd3..00000000000 --- a/mpl_examples/api/custom_scale_example.py +++ /dev/null @@ -1,186 +0,0 @@ -""" -============ -Custom scale -============ - -This example showcases how to create a custom scale, by implementing the -scaling use for latitude data in a Mercator Projection. -""" - - -from __future__ import unicode_literals - -import numpy as np -from numpy import ma -from matplotlib import scale as mscale -from matplotlib import transforms as mtransforms -from matplotlib.ticker import Formatter, FixedLocator -from matplotlib import rcParams - - -# BUG: this example fails with any other setting of axisbelow -rcParams['axes.axisbelow'] = False - - -class MercatorLatitudeScale(mscale.ScaleBase): - """ - Scales data in range -pi/2 to pi/2 (-90 to 90 degrees) using - the system used to scale latitudes in a Mercator projection. - - The scale function: - ln(tan(y) + sec(y)) - - The inverse scale function: - atan(sinh(y)) - - Since the Mercator scale tends to infinity at +/- 90 degrees, - there is user-defined threshold, above and below which nothing - will be plotted. This defaults to +/- 85 degrees. - - source: - http://en.wikipedia.org/wiki/Mercator_projection - """ - - # The scale class must have a member ``name`` that defines the - # string used to select the scale. For example, - # ``gca().set_yscale("mercator")`` would be used to select this - # scale. - name = 'mercator' - - def __init__(self, axis, **kwargs): - """ - Any keyword arguments passed to ``set_xscale`` and - ``set_yscale`` will be passed along to the scale's - constructor. - - thresh: The degree above which to crop the data. - """ - mscale.ScaleBase.__init__(self) - thresh = kwargs.pop("thresh", np.radians(85)) - if thresh >= np.pi / 2.0: - raise ValueError("thresh must be less than pi/2") - self.thresh = thresh - - def get_transform(self): - """ - Override this method to return a new instance that does the - actual transformation of the data. - - The MercatorLatitudeTransform class is defined below as a - nested class of this one. - """ - return self.MercatorLatitudeTransform(self.thresh) - - def set_default_locators_and_formatters(self, axis): - """ - Override to set up the locators and formatters to use with the - scale. This is only required if the scale requires custom - locators and formatters. Writing custom locators and - formatters is rather outside the scope of this example, but - there are many helpful examples in ``ticker.py``. - - In our case, the Mercator example uses a fixed locator from - -90 to 90 degrees and a custom formatter class to put convert - the radians to degrees and put a degree symbol after the - value:: - """ - class DegreeFormatter(Formatter): - def __call__(self, x, pos=None): - # \u00b0 : degree symbol - return "%d\u00b0" % (np.degrees(x)) - - axis.set_major_locator(FixedLocator( - np.radians(np.arange(-90, 90, 10)))) - axis.set_major_formatter(DegreeFormatter()) - axis.set_minor_formatter(DegreeFormatter()) - - def limit_range_for_scale(self, vmin, vmax, minpos): - """ - Override to limit the bounds of the axis to the domain of the - transform. In the case of Mercator, the bounds should be - limited to the threshold that was passed in. Unlike the - autoscaling provided by the tick locators, this range limiting - will always be adhered to, whether the axis range is set - manually, determined automatically or changed through panning - and zooming. - """ - return max(vmin, -self.thresh), min(vmax, self.thresh) - - class MercatorLatitudeTransform(mtransforms.Transform): - # There are two value members that must be defined. - # ``input_dims`` and ``output_dims`` specify number of input - # dimensions and output dimensions to the transformation. - # These are used by the transformation framework to do some - # error checking and prevent incompatible transformations from - # being connected together. When defining transforms for a - # scale, which are, by definition, separable and have only one - # dimension, these members should always be set to 1. - input_dims = 1 - output_dims = 1 - is_separable = True - - def __init__(self, thresh): - mtransforms.Transform.__init__(self) - self.thresh = thresh - - def transform_non_affine(self, a): - """ - This transform takes an Nx1 ``numpy`` array and returns a - transformed copy. Since the range of the Mercator scale - is limited by the user-specified threshold, the input - array must be masked to contain only valid values. - ``matplotlib`` will handle masked arrays and remove the - out-of-range data from the plot. Importantly, the - ``transform`` method *must* return an array that is the - same shape as the input array, since these values need to - remain synchronized with values in the other dimension. - """ - masked = ma.masked_where((a < -self.thresh) | (a > self.thresh), a) - if masked.mask.any(): - return ma.log(np.abs(ma.tan(masked) + 1.0 / ma.cos(masked))) - else: - return np.log(np.abs(np.tan(a) + 1.0 / np.cos(a))) - - def inverted(self): - """ - Override this method so matplotlib knows how to get the - inverse transform for this transform. - """ - return MercatorLatitudeScale.InvertedMercatorLatitudeTransform( - self.thresh) - - class InvertedMercatorLatitudeTransform(mtransforms.Transform): - input_dims = 1 - output_dims = 1 - is_separable = True - - def __init__(self, thresh): - mtransforms.Transform.__init__(self) - self.thresh = thresh - - def transform_non_affine(self, a): - return np.arctan(np.sinh(a)) - - def inverted(self): - return MercatorLatitudeScale.MercatorLatitudeTransform(self.thresh) - -# Now that the Scale class has been defined, it must be registered so -# that ``matplotlib`` can find it. -mscale.register_scale(MercatorLatitudeScale) - - -if __name__ == '__main__': - import matplotlib.pyplot as plt - - t = np.arange(-180.0, 180.0, 0.1) - s = np.radians(t)/2. - - plt.plot(t, s, '-', lw=2) - plt.gca().set_yscale('mercator') - - plt.xlabel('Longitude') - plt.ylabel('Latitude') - plt.title('Mercator: Projection of the Oppressor') - plt.grid(True) - - plt.show() diff --git a/mpl_examples/api/date_demo.hires.png b/mpl_examples/api/date_demo.hires.png deleted file mode 100644 index c0b7b4d76c5..00000000000 Binary files a/mpl_examples/api/date_demo.hires.png and /dev/null differ diff --git a/mpl_examples/api/date_demo.pdf b/mpl_examples/api/date_demo.pdf deleted file mode 100644 index 7dc5e0d1a22..00000000000 Binary files a/mpl_examples/api/date_demo.pdf and /dev/null differ diff --git a/mpl_examples/api/date_demo.png b/mpl_examples/api/date_demo.png deleted file mode 100644 index 15f3889c9aa..00000000000 Binary files a/mpl_examples/api/date_demo.png and /dev/null differ diff --git a/mpl_examples/api/date_demo.py b/mpl_examples/api/date_demo.py deleted file mode 100644 index 96635387706..00000000000 --- a/mpl_examples/api/date_demo.py +++ /dev/null @@ -1,66 +0,0 @@ -""" -================ -Date tick labels -================ - -Show how to make date plots in matplotlib using date tick locators and -formatters. See major_minor_demo1.py for more information on -controlling major and minor ticks - -All matplotlib date plotting is done by converting date instances into -days since the 0001-01-01 UTC. The conversion, tick locating and -formatting is done behind the scenes so this is most transparent to -you. The dates module provides several converter functions date2num -and num2date - -""" -import datetime -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.dates as mdates -import matplotlib.cbook as cbook - -years = mdates.YearLocator() # every year -months = mdates.MonthLocator() # every month -yearsFmt = mdates.DateFormatter('%Y') - -# load a numpy record array from yahoo csv data with fields date, -# open, close, volume, adj_close from the mpl-data/example directory. -# The record array stores python datetime.date as an object array in -# the date column -datafile = cbook.get_sample_data('goog.npy') -try: - # Python3 cannot load python2 .npy files with datetime(object) arrays - # unless the encoding is set to bytes. However this option was - # not added until numpy 1.10 so this example will only work with - # python 2 or with numpy 1.10 and later. - r = np.load(datafile, encoding='bytes').view(np.recarray) -except TypeError: - r = np.load(datafile).view(np.recarray) - -fig, ax = plt.subplots() -ax.plot(r.date, r.adj_close) - - -# format the ticks -ax.xaxis.set_major_locator(years) -ax.xaxis.set_major_formatter(yearsFmt) -ax.xaxis.set_minor_locator(months) - -datemin = datetime.date(r.date.min().year, 1, 1) -datemax = datetime.date(r.date.max().year + 1, 1, 1) -ax.set_xlim(datemin, datemax) - - -# format the coords message box -def price(x): - return '$%1.2f' % x -ax.format_xdata = mdates.DateFormatter('%Y-%m-%d') -ax.format_ydata = price -ax.grid(True) - -# rotates and right aligns the x labels, and moves the bottom of the -# axes up to make room for them -fig.autofmt_xdate() - -plt.show() diff --git a/mpl_examples/api/date_index_formatter.pdf b/mpl_examples/api/date_index_formatter.pdf deleted file mode 100644 index 05772604847..00000000000 Binary files a/mpl_examples/api/date_index_formatter.pdf and /dev/null differ diff --git a/mpl_examples/api/date_index_formatter.png b/mpl_examples/api/date_index_formatter.png deleted file mode 100644 index 8b7e2239212..00000000000 Binary files a/mpl_examples/api/date_index_formatter.png and /dev/null differ diff --git a/mpl_examples/api/date_index_formatter.py b/mpl_examples/api/date_index_formatter.py deleted file mode 100644 index c43559dfb89..00000000000 --- a/mpl_examples/api/date_index_formatter.py +++ /dev/null @@ -1,47 +0,0 @@ -""" -===================================== -Custom tick formatter for time series -===================================== - -When plotting time series, e.g., financial time series, one often wants -to leave out days on which there is no data, i.e. weekends. The example -below shows how to use an 'index formatter' to achieve the desired plot -""" -from __future__ import print_function -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.mlab as mlab -import matplotlib.cbook as cbook -import matplotlib.ticker as ticker - -datafile = cbook.get_sample_data('aapl.csv', asfileobj=False) -print('loading %s' % datafile) -r = mlab.csv2rec(datafile) - -r.sort() -r = r[-30:] # get the last 30 days - - -# first we'll do it the default way, with gaps on weekends -fig, axes = plt.subplots(ncols=2, figsize=(8, 4)) -ax = axes[0] -ax.plot(r.date, r.adj_close, 'o-') -ax.set_title("Default") -fig.autofmt_xdate() - -# next we'll write a custom formatter -N = len(r) -ind = np.arange(N) # the evenly spaced plot indices - - -def format_date(x, pos=None): - thisind = np.clip(int(x + 0.5), 0, N - 1) - return r.date[thisind].strftime('%Y-%m-%d') - -ax = axes[1] -ax.plot(ind, r.adj_close, 'o-') -ax.xaxis.set_major_formatter(ticker.FuncFormatter(format_date)) -ax.set_title("Custom tick formatter") -fig.autofmt_xdate() - -plt.show() diff --git a/mpl_examples/api/date_index_formatter_00.hires.png b/mpl_examples/api/date_index_formatter_00.hires.png deleted file mode 100644 index 2bc779768a8..00000000000 Binary files a/mpl_examples/api/date_index_formatter_00.hires.png and /dev/null differ diff --git a/mpl_examples/api/date_index_formatter_00.pdf b/mpl_examples/api/date_index_formatter_00.pdf deleted file mode 100644 index 2aaab381f18..00000000000 Binary files a/mpl_examples/api/date_index_formatter_00.pdf and /dev/null differ diff --git a/mpl_examples/api/date_index_formatter_00.png b/mpl_examples/api/date_index_formatter_00.png deleted file mode 100644 index 32bb52c67a1..00000000000 Binary files a/mpl_examples/api/date_index_formatter_00.png and /dev/null differ diff --git a/mpl_examples/api/date_index_formatter_01.hires.png b/mpl_examples/api/date_index_formatter_01.hires.png deleted file mode 100644 index b0ac663ee37..00000000000 Binary files a/mpl_examples/api/date_index_formatter_01.hires.png and /dev/null differ diff --git a/mpl_examples/api/date_index_formatter_01.pdf b/mpl_examples/api/date_index_formatter_01.pdf deleted file mode 100644 index 6d37205000f..00000000000 Binary files a/mpl_examples/api/date_index_formatter_01.pdf and /dev/null differ diff --git a/mpl_examples/api/date_index_formatter_01.png b/mpl_examples/api/date_index_formatter_01.png deleted file mode 100644 index b00cec8cf71..00000000000 Binary files a/mpl_examples/api/date_index_formatter_01.png and /dev/null differ diff --git a/mpl_examples/api/demo_affine_image.pdf b/mpl_examples/api/demo_affine_image.pdf deleted file mode 100644 index 1239fba8a44..00000000000 Binary files a/mpl_examples/api/demo_affine_image.pdf and /dev/null differ diff --git a/mpl_examples/api/demo_affine_image.png b/mpl_examples/api/demo_affine_image.png deleted file mode 100644 index d24b5a9b534..00000000000 Binary files a/mpl_examples/api/demo_affine_image.png and /dev/null differ diff --git a/mpl_examples/api/demo_affine_image.py b/mpl_examples/api/demo_affine_image.py deleted file mode 100644 index 9ce1cff0563..00000000000 --- a/mpl_examples/api/demo_affine_image.py +++ /dev/null @@ -1,60 +0,0 @@ -""" -============================ -Affine transform of an image -============================ - -For the backends that support draw_image with optional affine -transform (e.g., agg, ps backend), the image of the output should -have its boundary match the dashed yellow rectangle. -""" - -import numpy as np -import matplotlib.mlab as mlab -import matplotlib.pyplot as plt -import matplotlib.transforms as mtransforms - - -def get_image(): - delta = 0.25 - x = y = np.arange(-3.0, 3.0, delta) - X, Y = np.meshgrid(x, y) - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - Z = Z2 - Z1 # difference of Gaussians - return Z - - -def do_plot(ax, Z, transform): - im = ax.imshow(Z, interpolation='none', - origin='lower', - extent=[-2, 4, -3, 2], clip_on=True) - - trans_data = transform + ax.transData - im.set_transform(trans_data) - - # display intended extent of the image - x1, x2, y1, y2 = im.get_extent() - ax.plot([x1, x2, x2, x1, x1], [y1, y1, y2, y2, y1], "y--", - transform=trans_data) - ax.set_xlim(-5, 5) - ax.set_ylim(-4, 4) - - -# prepare image and figure -fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2) -Z = get_image() - -# image rotation -do_plot(ax1, Z, mtransforms.Affine2D().rotate_deg(30)) - -# image skew -do_plot(ax2, Z, mtransforms.Affine2D().skew_deg(30, 15)) - -# scale and reflection -do_plot(ax3, Z, mtransforms.Affine2D().scale(-1, .5)) - -# everything and a translation -do_plot(ax4, Z, mtransforms.Affine2D(). - rotate_deg(30).skew_deg(30, 15).scale(-1, .5).translate(.5, -1)) - -plt.show() diff --git a/mpl_examples/api/demo_affine_image_00_00.hires.png b/mpl_examples/api/demo_affine_image_00_00.hires.png deleted file mode 100644 index f58911747d7..00000000000 Binary files a/mpl_examples/api/demo_affine_image_00_00.hires.png and /dev/null differ diff --git a/mpl_examples/api/demo_affine_image_00_00.pdf b/mpl_examples/api/demo_affine_image_00_00.pdf deleted file mode 100644 index fe47fb0a169..00000000000 Binary files a/mpl_examples/api/demo_affine_image_00_00.pdf and /dev/null differ diff --git a/mpl_examples/api/demo_affine_image_00_00.png b/mpl_examples/api/demo_affine_image_00_00.png deleted file mode 100644 index 57b8e00f3b1..00000000000 Binary files a/mpl_examples/api/demo_affine_image_00_00.png and /dev/null differ diff --git a/mpl_examples/api/donut_demo.hires.png b/mpl_examples/api/donut_demo.hires.png deleted file mode 100644 index 69c04946f7f..00000000000 Binary files a/mpl_examples/api/donut_demo.hires.png and /dev/null differ diff --git a/mpl_examples/api/donut_demo.pdf b/mpl_examples/api/donut_demo.pdf deleted file mode 100644 index 6dd342d9fac..00000000000 Binary files a/mpl_examples/api/donut_demo.pdf and /dev/null differ diff --git a/mpl_examples/api/donut_demo.png b/mpl_examples/api/donut_demo.png deleted file mode 100644 index 6cd3686ee64..00000000000 Binary files a/mpl_examples/api/donut_demo.png and /dev/null differ diff --git a/mpl_examples/api/donut_demo.py b/mpl_examples/api/donut_demo.py deleted file mode 100644 index 3f96284f535..00000000000 --- a/mpl_examples/api/donut_demo.py +++ /dev/null @@ -1,62 +0,0 @@ -""" -============= -Mmh Donuts!!! -============= - -This example draws donuts (miam!) using Path and Patches. -""" - -import numpy as np -import matplotlib.path as mpath -import matplotlib.patches as mpatches -import matplotlib.pyplot as plt - - -def wise(v): - if v == 1: - return "CCW" - else: - return "CW" - - -def make_circle(r): - t = np.arange(0, np.pi * 2.0, 0.01) - t = t.reshape((len(t), 1)) - x = r * np.cos(t) - y = r * np.sin(t) - return np.hstack((x, y)) - -Path = mpath.Path - -fig, ax = plt.subplots() - -inside_vertices = make_circle(0.5) -outside_vertices = make_circle(1.0) -codes = np.ones( - len(inside_vertices), dtype=mpath.Path.code_type) * mpath.Path.LINETO -codes[0] = mpath.Path.MOVETO - -for i, (inside, outside) in enumerate(((1, 1), (1, -1), (-1, 1), (-1, -1))): - # Concatenate the inside and outside subpaths together, changing their - # order as needed - vertices = np.concatenate((outside_vertices[::outside], - inside_vertices[::inside])) - # Shift the path - vertices[:, 0] += i * 2.5 - # The codes will be all "LINETO" commands, except for "MOVETO"s at the - # beginning of each subpath - all_codes = np.concatenate((codes, codes)) - # Create the Path object - path = mpath.Path(vertices, all_codes) - # Add plot it - patch = mpatches.PathPatch(path, facecolor='#885500', edgecolor='black') - ax.add_patch(patch) - - ax.annotate("Outside %s,\nInside %s" % (wise(outside), wise(inside)), - (i * 2.5, -1.5), va="top", ha="center") - -ax.set_xlim(-2, 10) -ax.set_ylim(-3, 2) -ax.set_title('Mmm, donuts!') -ax.set_aspect(1.0) -plt.show() diff --git a/mpl_examples/api/engineering_formatter.hires.png b/mpl_examples/api/engineering_formatter.hires.png deleted file mode 100644 index d8b5c111263..00000000000 Binary files a/mpl_examples/api/engineering_formatter.hires.png and /dev/null differ diff --git a/mpl_examples/api/engineering_formatter.pdf b/mpl_examples/api/engineering_formatter.pdf deleted file mode 100644 index 59b5d25e1b0..00000000000 Binary files a/mpl_examples/api/engineering_formatter.pdf and /dev/null differ diff --git a/mpl_examples/api/engineering_formatter.png b/mpl_examples/api/engineering_formatter.png deleted file mode 100644 index 3e38f6e6801..00000000000 Binary files a/mpl_examples/api/engineering_formatter.png and /dev/null differ diff --git a/mpl_examples/api/engineering_formatter.py b/mpl_examples/api/engineering_formatter.py deleted file mode 100644 index 667b84dc6d7..00000000000 --- a/mpl_examples/api/engineering_formatter.py +++ /dev/null @@ -1,25 +0,0 @@ -''' -========================================= -Labeling ticks using engineering notation -========================================= - -Demo to show use of the engineering Formatter. -''' - -import matplotlib.pyplot as plt -import numpy as np - -from matplotlib.ticker import EngFormatter - -prng = np.random.RandomState(123) - -fig, ax = plt.subplots() -ax.set_xscale('log') -formatter = EngFormatter(unit='Hz') -ax.xaxis.set_major_formatter(formatter) - -xs = np.logspace(1, 9, 100) -ys = (0.8 + 0.4 * prng.uniform(size=100)) * np.log10(xs)**2 -ax.plot(xs, ys) - -plt.show() diff --git a/mpl_examples/api/filled_step.py b/mpl_examples/api/filled_step.py deleted file mode 100644 index 356dc1f1a4e..00000000000 --- a/mpl_examples/api/filled_step.py +++ /dev/null @@ -1,221 +0,0 @@ -""" -========================= -Hatch-filled histograms -========================= - -This example showcases the hatching capabilities of matplotlib by plotting -various histograms. -""" - -import itertools -from collections import OrderedDict -from functools import partial - -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.ticker as mticker -from cycler import cycler -from six.moves import zip - - -def filled_hist(ax, edges, values, bottoms=None, orientation='v', - **kwargs): - """ - Draw a histogram as a stepped patch. - - Extra kwargs are passed through to `fill_between` - - Parameters - ---------- - ax : Axes - The axes to plot to - - edges : array - A length n+1 array giving the left edges of each bin and the - right edge of the last bin. - - values : array - A length n array of bin counts or values - - bottoms : scalar or array, optional - A length n array of the bottom of the bars. If None, zero is used. - - orientation : {'v', 'h'} - Orientation of the histogram. 'v' (default) has - the bars increasing in the positive y-direction. - - Returns - ------- - ret : PolyCollection - Artist added to the Axes - """ - print(orientation) - if orientation not in set('hv'): - raise ValueError("orientation must be in {{'h', 'v'}} " - "not {o}".format(o=orientation)) - - kwargs.setdefault('step', 'post') - edges = np.asarray(edges) - values = np.asarray(values) - if len(edges) - 1 != len(values): - raise ValueError('Must provide one more bin edge than value not: ' - 'len(edges): {lb} len(values): {lv}'.format( - lb=len(edges), lv=len(values))) - - if bottoms is None: - bottoms = np.zeros_like(values) - if np.isscalar(bottoms): - bottoms = np.ones_like(values) * bottoms - - values = np.r_[values, values[-1]] - bottoms = np.r_[bottoms, bottoms[-1]] - if orientation == 'h': - return ax.fill_betweenx(edges, values, bottoms, - **kwargs) - elif orientation == 'v': - return ax.fill_between(edges, values, bottoms, - **kwargs) - else: - raise AssertionError("you should never be here") - - -def stack_hist(ax, stacked_data, sty_cycle, bottoms=None, - hist_func=None, labels=None, - plot_func=None, plot_kwargs=None): - """ - ax : axes.Axes - The axes to add artists too - - stacked_data : array or Mapping - A (N, M) shaped array. The first dimension will be iterated over to - compute histograms row-wise - - sty_cycle : Cycler or operable of dict - Style to apply to each set - - bottoms : array, optional - The initial positions of the bottoms, defaults to 0 - - hist_func : callable, optional - Must have signature `bin_vals, bin_edges = f(data)`. - `bin_edges` expected to be one longer than `bin_vals` - - labels : list of str, optional - The label for each set. - - If not given and stacked data is an array defaults to 'default set {n}' - - If stacked_data is a mapping, and labels is None, default to the keys - (which may come out in a random order). - - If stacked_data is a mapping and labels is given then only - the columns listed by be plotted. - - plot_func : callable, optional - Function to call to draw the histogram must have signature: - - ret = plot_func(ax, edges, top, bottoms=bottoms, - label=label, **kwargs) - - plot_kwargs : dict, optional - Any extra kwargs to pass through to the plotting function. This - will be the same for all calls to the plotting function and will - over-ride the values in cycle. - - Returns - ------- - arts : dict - Dictionary of artists keyed on their labels - """ - # deal with default binning function - if hist_func is None: - hist_func = np.histogram - - # deal with default plotting function - if plot_func is None: - plot_func = filled_hist - - # deal with default - if plot_kwargs is None: - plot_kwargs = {} - print(plot_kwargs) - try: - l_keys = stacked_data.keys() - label_data = True - if labels is None: - labels = l_keys - - except AttributeError: - label_data = False - if labels is None: - labels = itertools.repeat(None) - - if label_data: - loop_iter = enumerate((stacked_data[lab], lab, s) for lab, s in - zip(labels, sty_cycle)) - else: - loop_iter = enumerate(zip(stacked_data, labels, sty_cycle)) - - arts = {} - for j, (data, label, sty) in loop_iter: - if label is None: - label = 'dflt set {n}'.format(n=j) - label = sty.pop('label', label) - vals, edges = hist_func(data) - if bottoms is None: - bottoms = np.zeros_like(vals) - top = bottoms + vals - print(sty) - sty.update(plot_kwargs) - print(sty) - ret = plot_func(ax, edges, top, bottoms=bottoms, - label=label, **sty) - bottoms = top - arts[label] = ret - ax.legend(fontsize=10) - return arts - - -# set up histogram function to fixed bins -edges = np.linspace(-3, 3, 20, endpoint=True) -hist_func = partial(np.histogram, bins=edges) - -# set up style cycles -color_cycle = cycler(facecolor=plt.rcParams['axes.prop_cycle'][:4]) -label_cycle = cycler('label', ['set {n}'.format(n=n) for n in range(4)]) -hatch_cycle = cycler('hatch', ['/', '*', '+', '|']) - -# make some synthetic data -np.random.seed(0) -stack_data = np.random.randn(4, 12250) -dict_data = OrderedDict(zip((c['label'] for c in label_cycle), stack_data)) - -# work with plain arrays -fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(9, 4.5), tight_layout=True) -arts = stack_hist(ax1, stack_data, color_cycle + label_cycle + hatch_cycle, - hist_func=hist_func) - -arts = stack_hist(ax2, stack_data, color_cycle, - hist_func=hist_func, - plot_kwargs=dict(edgecolor='w', orientation='h')) -ax1.set_ylabel('counts') -ax1.set_xlabel('x') -ax2.set_xlabel('counts') -ax2.set_ylabel('x') - -# work with labeled data - -fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(9, 4.5), - tight_layout=True, sharey=True) - -arts = stack_hist(ax1, dict_data, color_cycle + hatch_cycle, - hist_func=hist_func) - -arts = stack_hist(ax2, dict_data, color_cycle + hatch_cycle, - hist_func=hist_func, labels=['set 0', 'set 3']) -ax1.xaxis.set_major_locator(mticker.MaxNLocator(5)) -ax1.set_xlabel('counts') -ax1.set_ylabel('x') -ax2.set_ylabel('x') - -plt.show() diff --git a/mpl_examples/api/filled_step_00.hires.png b/mpl_examples/api/filled_step_00.hires.png deleted file mode 100644 index 3c280311405..00000000000 Binary files a/mpl_examples/api/filled_step_00.hires.png and /dev/null differ diff --git a/mpl_examples/api/filled_step_00.pdf b/mpl_examples/api/filled_step_00.pdf deleted file mode 100644 index 103ba4849bf..00000000000 Binary files a/mpl_examples/api/filled_step_00.pdf and /dev/null differ diff --git a/mpl_examples/api/filled_step_00.png b/mpl_examples/api/filled_step_00.png deleted file mode 100644 index 1db676e2359..00000000000 Binary files a/mpl_examples/api/filled_step_00.png and /dev/null differ diff --git a/mpl_examples/api/filled_step_01.hires.png b/mpl_examples/api/filled_step_01.hires.png deleted file mode 100644 index c143ab4f4ae..00000000000 Binary files a/mpl_examples/api/filled_step_01.hires.png and /dev/null differ diff --git a/mpl_examples/api/filled_step_01.pdf b/mpl_examples/api/filled_step_01.pdf deleted file mode 100644 index b4f7395db8c..00000000000 Binary files a/mpl_examples/api/filled_step_01.pdf and /dev/null differ diff --git a/mpl_examples/api/filled_step_01.png b/mpl_examples/api/filled_step_01.png deleted file mode 100644 index c63b05f9950..00000000000 Binary files a/mpl_examples/api/filled_step_01.png and /dev/null differ diff --git a/mpl_examples/api/histogram_path_demo.hires.png b/mpl_examples/api/histogram_path_demo.hires.png deleted file mode 100644 index 9a35856313c..00000000000 Binary files a/mpl_examples/api/histogram_path_demo.hires.png and /dev/null differ diff --git a/mpl_examples/api/histogram_path_demo.pdf b/mpl_examples/api/histogram_path_demo.pdf deleted file mode 100644 index f94af8b36ec..00000000000 Binary files a/mpl_examples/api/histogram_path_demo.pdf and /dev/null differ diff --git a/mpl_examples/api/histogram_path_demo.png b/mpl_examples/api/histogram_path_demo.png deleted file mode 100644 index c4c90a59791..00000000000 Binary files a/mpl_examples/api/histogram_path_demo.png and /dev/null differ diff --git a/mpl_examples/api/histogram_path_demo.py b/mpl_examples/api/histogram_path_demo.py deleted file mode 100644 index 431252652a4..00000000000 --- a/mpl_examples/api/histogram_path_demo.py +++ /dev/null @@ -1,50 +0,0 @@ -""" -======================================================== -Building histograms using Rectangles and PolyCollections -======================================================== - -This example shows how to use a path patch to draw a bunch of -rectangles. The technique of using lots of Rectangle instances, or -the faster method of using PolyCollections, were implemented before we -had proper paths with moveto/lineto, closepoly etc in mpl. Now that -we have them, we can draw collections of regularly shaped objects with -homogeneous properties more efficiently with a PathCollection. This -example makes a histogram -- its more work to set up the vertex arrays -at the outset, but it should be much faster for large numbers of -objects -""" - -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.patches as patches -import matplotlib.path as path - -fig, ax = plt.subplots() - -# histogram our data with numpy -data = np.random.randn(1000) -n, bins = np.histogram(data, 50) - -# get the corners of the rectangles for the histogram -left = np.array(bins[:-1]) -right = np.array(bins[1:]) -bottom = np.zeros(len(left)) -top = bottom + n - - -# we need a (numrects x numsides x 2) numpy array for the path helper -# function to build a compound path -XY = np.array([[left, left, right, right], [bottom, top, top, bottom]]).T - -# get the Path object -barpath = path.Path.make_compound_path_from_polys(XY) - -# make a patch out of it -patch = patches.PathPatch(barpath) -ax.add_patch(patch) - -# update the view limits -ax.set_xlim(left[0], right[-1]) -ax.set_ylim(bottom.min(), top.max()) - -plt.show() diff --git a/mpl_examples/api/image_zcoord.hires.png b/mpl_examples/api/image_zcoord.hires.png deleted file mode 100644 index 5f4b0e0e9d0..00000000000 Binary files a/mpl_examples/api/image_zcoord.hires.png and /dev/null differ diff --git a/mpl_examples/api/image_zcoord.pdf b/mpl_examples/api/image_zcoord.pdf deleted file mode 100644 index f8fd814017b..00000000000 Binary files a/mpl_examples/api/image_zcoord.pdf and /dev/null differ diff --git a/mpl_examples/api/image_zcoord.png b/mpl_examples/api/image_zcoord.png deleted file mode 100644 index c1d4d1075c3..00000000000 Binary files a/mpl_examples/api/image_zcoord.png and /dev/null differ diff --git a/mpl_examples/api/image_zcoord.py b/mpl_examples/api/image_zcoord.py deleted file mode 100644 index 2eaddc486dd..00000000000 --- a/mpl_examples/api/image_zcoord.py +++ /dev/null @@ -1,30 +0,0 @@ -""" -================================== -Modifying the coordinate formatter -================================== - -Show how to modify the coordinate formatter to report the image "z" -value of the nearest pixel given x and y -""" -import numpy as np -import matplotlib.pyplot as plt - -X = 10*np.random.rand(5, 3) - -fig, ax = plt.subplots() -ax.imshow(X, interpolation='nearest') - -numrows, numcols = X.shape - - -def format_coord(x, y): - col = int(x + 0.5) - row = int(y + 0.5) - if col >= 0 and col < numcols and row >= 0 and row < numrows: - z = X[row, col] - return 'x=%1.4f, y=%1.4f, z=%1.4f' % (x, y, z) - else: - return 'x=%1.4f, y=%1.4f' % (x, y) - -ax.format_coord = format_coord -plt.show() diff --git a/mpl_examples/api/joinstyle.hires.png b/mpl_examples/api/joinstyle.hires.png deleted file mode 100644 index 559e10612cb..00000000000 Binary files a/mpl_examples/api/joinstyle.hires.png and /dev/null differ diff --git a/mpl_examples/api/joinstyle.pdf b/mpl_examples/api/joinstyle.pdf deleted file mode 100644 index d42cc6c6695..00000000000 Binary files a/mpl_examples/api/joinstyle.pdf and /dev/null differ diff --git a/mpl_examples/api/joinstyle.png b/mpl_examples/api/joinstyle.png deleted file mode 100644 index e0399143caf..00000000000 Binary files a/mpl_examples/api/joinstyle.png and /dev/null differ diff --git a/mpl_examples/api/joinstyle.py b/mpl_examples/api/joinstyle.py deleted file mode 100644 index 3a7e260ac26..00000000000 --- a/mpl_examples/api/joinstyle.py +++ /dev/null @@ -1,33 +0,0 @@ -""" -=========== -Join styles -=========== - -Illustrate the three different join styles -""" - -import numpy as np -import matplotlib.pyplot as plt - - -def plot_angle(ax, x, y, angle, style): - phi = np.radians(angle) - xx = [x + .5, x, x + .5*np.cos(phi)] - yy = [y, y, y + .5*np.sin(phi)] - ax.plot(xx, yy, lw=8, color='blue', solid_joinstyle=style) - ax.plot(xx[1:], yy[1:], lw=1, color='black') - ax.plot(xx[1::-1], yy[1::-1], lw=1, color='black') - ax.plot(xx[1:2], yy[1:2], 'o', color='red', markersize=3) - ax.text(x, y + .2, '%.0f degrees' % angle) - -fig, ax = plt.subplots() -ax.set_title('Join style') - -for x, style in enumerate((('miter', 'round', 'bevel'))): - ax.text(x, 5, style) - for i in range(5): - plot_angle(ax, x, i, pow(2.0, 3 + i), style) - -ax.set_xlim(-.5, 2.75) -ax.set_ylim(-.5, 5.5) -plt.show() diff --git a/mpl_examples/api/legend_demo.hires.png b/mpl_examples/api/legend_demo.hires.png deleted file mode 100644 index 252aeb434df..00000000000 Binary files a/mpl_examples/api/legend_demo.hires.png and /dev/null differ diff --git a/mpl_examples/api/legend_demo.pdf b/mpl_examples/api/legend_demo.pdf deleted file mode 100644 index d80f70481e2..00000000000 Binary files a/mpl_examples/api/legend_demo.pdf and /dev/null differ diff --git a/mpl_examples/api/legend_demo.png b/mpl_examples/api/legend_demo.png deleted file mode 100644 index 7a0a99787ad..00000000000 Binary files a/mpl_examples/api/legend_demo.png and /dev/null differ diff --git a/mpl_examples/api/legend_demo.py b/mpl_examples/api/legend_demo.py deleted file mode 100644 index de50130d222..00000000000 --- a/mpl_examples/api/legend_demo.py +++ /dev/null @@ -1,29 +0,0 @@ -""" -=============================== -Legend using pre-defined labels -=============================== - -Notice how the legend labels are defined with the plots! -""" - - -import numpy as np -import matplotlib.pyplot as plt - -# Make some fake data. -a = b = np.arange(0, 3, .02) -c = np.exp(a) -d = c[::-1] - -# Create plots with pre-defined labels. -fig, ax = plt.subplots() -ax.plot(a, c, 'k--', label='Model length') -ax.plot(a, d, 'k:', label='Data length') -ax.plot(a, c + d, 'k', label='Total message length') - -legend = ax.legend(loc='upper center', shadow=True, fontsize='x-large') - -# Put a nicer background color on the legend. -legend.get_frame().set_facecolor('#00FFCC') - -plt.show() diff --git a/mpl_examples/api/line_with_text.hires.png b/mpl_examples/api/line_with_text.hires.png deleted file mode 100644 index 60f253fe673..00000000000 Binary files a/mpl_examples/api/line_with_text.hires.png and /dev/null differ diff --git a/mpl_examples/api/line_with_text.pdf b/mpl_examples/api/line_with_text.pdf deleted file mode 100644 index 9867f12bfd3..00000000000 Binary files a/mpl_examples/api/line_with_text.pdf and /dev/null differ diff --git a/mpl_examples/api/line_with_text.png b/mpl_examples/api/line_with_text.png deleted file mode 100644 index a9749be4922..00000000000 Binary files a/mpl_examples/api/line_with_text.png and /dev/null differ diff --git a/mpl_examples/api/line_with_text.py b/mpl_examples/api/line_with_text.py deleted file mode 100644 index 4cbef9dbc87..00000000000 --- a/mpl_examples/api/line_with_text.py +++ /dev/null @@ -1,63 +0,0 @@ -""" -======================= -Artist within an artist -======================= - -Show how to override basic methods so an artist can contain another -artist. In this case, the line contains a Text instance to label it. -""" -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.lines as lines -import matplotlib.transforms as mtransforms -import matplotlib.text as mtext - - -class MyLine(lines.Line2D): - def __init__(self, *args, **kwargs): - # we'll update the position when the line data is set - self.text = mtext.Text(0, 0, '') - lines.Line2D.__init__(self, *args, **kwargs) - - # we can't access the label attr until *after* the line is - # inited - self.text.set_text(self.get_label()) - - def set_figure(self, figure): - self.text.set_figure(figure) - lines.Line2D.set_figure(self, figure) - - def set_axes(self, axes): - self.text.set_axes(axes) - lines.Line2D.set_axes(self, axes) - - def set_transform(self, transform): - # 2 pixel offset - texttrans = transform + mtransforms.Affine2D().translate(2, 2) - self.text.set_transform(texttrans) - lines.Line2D.set_transform(self, transform) - - def set_data(self, x, y): - if len(x): - self.text.set_position((x[-1], y[-1])) - - lines.Line2D.set_data(self, x, y) - - def draw(self, renderer): - # draw my label at the end of the line with 2 pixel offset - lines.Line2D.draw(self, renderer) - self.text.draw(renderer) - - -fig, ax = plt.subplots() -x, y = np.random.rand(2, 20) -line = MyLine(x, y, mfc='red', ms=12, label='line label') -#line.text.set_text('line label') -line.text.set_color('red') -line.text.set_fontsize(16) - - -ax.add_line(line) - - -plt.show() diff --git a/mpl_examples/api/logo2.hires.png b/mpl_examples/api/logo2.hires.png deleted file mode 100644 index fb9f87a4192..00000000000 Binary files a/mpl_examples/api/logo2.hires.png and /dev/null differ diff --git a/mpl_examples/api/logo2.pdf b/mpl_examples/api/logo2.pdf deleted file mode 100644 index be7115e9ecd..00000000000 Binary files a/mpl_examples/api/logo2.pdf and /dev/null differ diff --git a/mpl_examples/api/logo2.png b/mpl_examples/api/logo2.png deleted file mode 100644 index eceefd8b34e..00000000000 Binary files a/mpl_examples/api/logo2.png and /dev/null differ diff --git a/mpl_examples/api/logo2.py b/mpl_examples/api/logo2.py deleted file mode 100644 index 8360ac24c56..00000000000 --- a/mpl_examples/api/logo2.py +++ /dev/null @@ -1,89 +0,0 @@ -""" -========== -matplotlib -========== - -Thanks to Tony Yu for the logo design -""" - -import numpy as np -import matplotlib as mpl -import matplotlib.pyplot as plt -import matplotlib.cm as cm - -mpl.rcParams['xtick.labelsize'] = 10 -mpl.rcParams['ytick.labelsize'] = 12 -mpl.rcParams['axes.edgecolor'] = 'gray' - - -axalpha = 0.05 -figcolor = 'white' -dpi = 80 -fig = plt.figure(figsize=(6, 1.1), dpi=dpi) -fig.figurePatch.set_edgecolor(figcolor) -fig.figurePatch.set_facecolor(figcolor) - - -def add_math_background(): - ax = fig.add_axes([0., 0., 1., 1.]) - - text = [] - text.append( - (r"$W^{3\beta}_{\delta_1 \rho_1 \sigma_2} = " - r"U^{3\beta}_{\delta_1 \rho_1} + \frac{1}{8 \pi 2}" - r"\int^{\alpha_2}_{\alpha_2} d \alpha^\prime_2 " - r"\left[\frac{ U^{2\beta}_{\delta_1 \rho_1} - " - r"\alpha^\prime_2U^{1\beta}_{\rho_1 \sigma_2} " - r"}{U^{0\beta}_{\rho_1 \sigma_2}}\right]$", (0.7, 0.2), 20)) - text.append((r"$\frac{d\rho}{d t} + \rho \vec{v}\cdot\nabla\vec{v} " - r"= -\nabla p + \mu\nabla^2 \vec{v} + \rho \vec{g}$", - (0.35, 0.9), 20)) - text.append((r"$\int_{-\infty}^\infty e^{-x^2}dx=\sqrt{\pi}$", - (0.15, 0.3), 25)) - text.append((r"$F_G = G\frac{m_1m_2}{r^2}$", - (0.85, 0.7), 30)) - for eq, (x, y), size in text: - ax.text(x, y, eq, ha='center', va='center', color="#11557c", - alpha=0.25, transform=ax.transAxes, fontsize=size) - ax.set_axis_off() - return ax - - -def add_matplotlib_text(ax): - ax.text(0.95, 0.5, 'matplotlib', color='#11557c', fontsize=65, - ha='right', va='center', alpha=1.0, transform=ax.transAxes) - - -def add_polar_bar(): - ax = fig.add_axes([0.025, 0.075, 0.2, 0.85], projection='polar') - - ax.axesPatch.set_alpha(axalpha) - ax.set_axisbelow(True) - N = 7 - arc = 2. * np.pi - theta = np.arange(0.0, arc, arc/N) - radii = 10 * np.array([0.2, 0.6, 0.8, 0.7, 0.4, 0.5, 0.8]) - width = np.pi / 4 * np.array([0.4, 0.4, 0.6, 0.8, 0.2, 0.5, 0.3]) - bars = ax.bar(theta, radii, width=width, bottom=0.0) - for r, bar in zip(radii, bars): - bar.set_facecolor(cm.jet(r/10.)) - bar.set_alpha(0.6) - - for label in ax.get_xticklabels() + ax.get_yticklabels(): - label.set_visible(False) - - for line in ax.get_ygridlines() + ax.get_xgridlines(): - line.set_lw(0.8) - 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) - - -if __name__ == '__main__': - main_axes = add_math_background() - add_polar_bar() - add_matplotlib_text(main_axes) - plt.show() diff --git a/mpl_examples/api/mathtext_asarray.hires.png b/mpl_examples/api/mathtext_asarray.hires.png deleted file mode 100644 index 5e97a78ecaa..00000000000 Binary files a/mpl_examples/api/mathtext_asarray.hires.png and /dev/null differ diff --git a/mpl_examples/api/mathtext_asarray.pdf b/mpl_examples/api/mathtext_asarray.pdf deleted file mode 100644 index 464c97ecf79..00000000000 Binary files a/mpl_examples/api/mathtext_asarray.pdf and /dev/null differ diff --git a/mpl_examples/api/mathtext_asarray.png b/mpl_examples/api/mathtext_asarray.png deleted file mode 100644 index 7f2f2f5a0d8..00000000000 Binary files a/mpl_examples/api/mathtext_asarray.png and /dev/null differ diff --git a/mpl_examples/api/mathtext_asarray.py b/mpl_examples/api/mathtext_asarray.py deleted file mode 100644 index 417028d6e12..00000000000 --- a/mpl_examples/api/mathtext_asarray.py +++ /dev/null @@ -1,28 +0,0 @@ -""" -=============================== -A mathtext image as numpy array -=============================== - -This example shows how to make images from LaTeX strings. -""" - -import matplotlib.mathtext as mathtext -import matplotlib.pyplot as plt -import matplotlib -matplotlib.rc('image', origin='upper') - -parser = mathtext.MathTextParser("Bitmap") -parser.to_png('test2.png', - r'$\left[\left\lfloor\frac{5}{\frac{\left(3\right)}{4}} ' - r'y\right)\right]$', color='green', fontsize=14, dpi=100) - -rgba1, depth1 = parser.to_rgba( - r'IQ: $\sigma_i=15$', color='blue', fontsize=20, dpi=200) -rgba2, depth2 = parser.to_rgba( - r'some other string', color='red', fontsize=20, dpi=200) - -fig = plt.figure() -fig.figimage(rgba1.astype(float)/255., 100, 100) -fig.figimage(rgba2.astype(float)/255., 100, 300) - -plt.show() diff --git a/mpl_examples/api/patch_collection.hires.png b/mpl_examples/api/patch_collection.hires.png deleted file mode 100644 index 26024cfbf7e..00000000000 Binary files a/mpl_examples/api/patch_collection.hires.png and /dev/null differ diff --git a/mpl_examples/api/patch_collection.pdf b/mpl_examples/api/patch_collection.pdf deleted file mode 100644 index 709b8477804..00000000000 Binary files a/mpl_examples/api/patch_collection.pdf and /dev/null differ diff --git a/mpl_examples/api/patch_collection.png b/mpl_examples/api/patch_collection.png deleted file mode 100644 index d8a7e8bf8ad..00000000000 Binary files a/mpl_examples/api/patch_collection.png and /dev/null differ diff --git a/mpl_examples/api/patch_collection.py b/mpl_examples/api/patch_collection.py deleted file mode 100644 index d0765d704d0..00000000000 --- a/mpl_examples/api/patch_collection.py +++ /dev/null @@ -1,53 +0,0 @@ -""" -============================ -Circles, Wedges and Polygons -============================ -""" - -import numpy as np -import matplotlib -from matplotlib.patches import Circle, Wedge, Polygon -from matplotlib.collections import PatchCollection -import matplotlib.pyplot as plt - - -fig, ax = plt.subplots() - -resolution = 50 # the number of vertices -N = 3 -x = np.random.rand(N) -y = np.random.rand(N) -radii = 0.1*np.random.rand(N) -patches = [] -for x1, y1, r in zip(x, y, radii): - circle = Circle((x1, y1), r) - patches.append(circle) - -x = np.random.rand(N) -y = np.random.rand(N) -radii = 0.1*np.random.rand(N) -theta1 = 360.0*np.random.rand(N) -theta2 = 360.0*np.random.rand(N) -for x1, y1, r, t1, t2 in zip(x, y, radii, theta1, theta2): - wedge = Wedge((x1, y1), r, t1, t2) - patches.append(wedge) - -# Some limiting conditions on Wedge -patches += [ - Wedge((.3, .7), .1, 0, 360), # Full circle - Wedge((.7, .8), .2, 0, 360, width=0.05), # Full ring - Wedge((.8, .3), .2, 0, 45), # Full sector - Wedge((.8, .3), .2, 45, 90, width=0.10), # Ring sector -] - -for i in range(N): - polygon = Polygon(np.random.rand(N, 2), True) - patches.append(polygon) - -colors = 100*np.random.rand(len(patches)) -p = PatchCollection(patches, alpha=0.4) -p.set_array(np.array(colors)) -ax.add_collection(p) -fig.colorbar(p, ax=ax) - -plt.show() diff --git a/mpl_examples/api/power_norm_demo.hires.png b/mpl_examples/api/power_norm_demo.hires.png deleted file mode 100644 index 3115db0fcea..00000000000 Binary files a/mpl_examples/api/power_norm_demo.hires.png and /dev/null differ diff --git a/mpl_examples/api/power_norm_demo.pdf b/mpl_examples/api/power_norm_demo.pdf deleted file mode 100644 index 4968ce61353..00000000000 Binary files a/mpl_examples/api/power_norm_demo.pdf and /dev/null differ diff --git a/mpl_examples/api/power_norm_demo.png b/mpl_examples/api/power_norm_demo.png deleted file mode 100644 index 67af51a170c..00000000000 Binary files a/mpl_examples/api/power_norm_demo.png and /dev/null differ diff --git a/mpl_examples/api/power_norm_demo.py b/mpl_examples/api/power_norm_demo.py deleted file mode 100644 index 76f6d772a91..00000000000 --- a/mpl_examples/api/power_norm_demo.py +++ /dev/null @@ -1,34 +0,0 @@ -""" -======================== -Exploring normalizations -======================== - -Let's explore various normalization on a multivariate normal distribution. - -""" - -from matplotlib import pyplot as plt -import matplotlib.colors as mcolors -import numpy as np -from numpy.random import multivariate_normal - -data = np.vstack([ - multivariate_normal([10, 10], [[3, 2], [2, 3]], size=100000), - multivariate_normal([30, 20], [[2, 3], [1, 3]], size=1000) -]) - -gammas = [0.8, 0.5, 0.3] - -fig, axes = plt.subplots(nrows=2, ncols=2) - -axes[0, 0].set_title('Linear normalization') -axes[0, 0].hist2d(data[:, 0], data[:, 1], bins=100) - -for ax, gamma in zip(axes.flat[1:], gammas): - ax.set_title('Power law $(\gamma=%1.1f)$' % gamma) - ax.hist2d(data[:, 0], data[:, 1], - bins=100, norm=mcolors.PowerNorm(gamma)) - -fig.tight_layout() - -plt.show() diff --git a/mpl_examples/api/quad_bezier.hires.png b/mpl_examples/api/quad_bezier.hires.png deleted file mode 100644 index 617a234aee2..00000000000 Binary files a/mpl_examples/api/quad_bezier.hires.png and /dev/null differ diff --git a/mpl_examples/api/quad_bezier.pdf b/mpl_examples/api/quad_bezier.pdf deleted file mode 100644 index f79ecfb94c0..00000000000 Binary files a/mpl_examples/api/quad_bezier.pdf and /dev/null differ diff --git a/mpl_examples/api/quad_bezier.png b/mpl_examples/api/quad_bezier.png deleted file mode 100644 index 460b59e861e..00000000000 Binary files a/mpl_examples/api/quad_bezier.png and /dev/null differ diff --git a/mpl_examples/api/quad_bezier.py b/mpl_examples/api/quad_bezier.py deleted file mode 100644 index 6cf190ee073..00000000000 --- a/mpl_examples/api/quad_bezier.py +++ /dev/null @@ -1,26 +0,0 @@ -""" -============ -Bezier Curve -============ - -This example showcases the PathPatch object to create a Bezier polycurve path -patch. -""" - -import matplotlib.path as mpath -import matplotlib.patches as mpatches -import matplotlib.pyplot as plt - -Path = mpath.Path - -fig, ax = plt.subplots() -pp1 = mpatches.PathPatch( - Path([(0, 0), (1, 0), (1, 1), (0, 0)], - [Path.MOVETO, Path.CURVE3, Path.CURVE3, Path.CLOSEPOLY]), - fc="none", transform=ax.transData) - -ax.add_patch(pp1) -ax.plot([0.75], [0.25], "ro") -ax.set_title('The red point should be on the path') - -plt.show() diff --git a/mpl_examples/api/radar_chart.hires.png b/mpl_examples/api/radar_chart.hires.png deleted file mode 100644 index fc747aa2fac..00000000000 Binary files a/mpl_examples/api/radar_chart.hires.png and /dev/null differ diff --git a/mpl_examples/api/radar_chart.pdf b/mpl_examples/api/radar_chart.pdf deleted file mode 100644 index 96ee6b78855..00000000000 Binary files a/mpl_examples/api/radar_chart.pdf and /dev/null differ diff --git a/mpl_examples/api/radar_chart.png b/mpl_examples/api/radar_chart.png deleted file mode 100644 index 2e5392c44d7..00000000000 Binary files a/mpl_examples/api/radar_chart.png and /dev/null differ diff --git a/mpl_examples/api/radar_chart.py b/mpl_examples/api/radar_chart.py deleted file mode 100644 index 2660f56f6f2..00000000000 --- a/mpl_examples/api/radar_chart.py +++ /dev/null @@ -1,201 +0,0 @@ -""" -====================================== -Radar chart (aka spider or star chart) -====================================== - -This example creates a radar chart, also known as a spider or star chart [1]_. - -Although this example allows a frame of either 'circle' or 'polygon', polygon -frames don't have proper gridlines (the lines are circles instead of polygons). -It's possible to get a polygon grid by setting GRIDLINE_INTERPOLATION_STEPS in -matplotlib.axis to the desired number of vertices, but the orientation of the -polygon is not aligned with the radial axes. - -.. [1] http://en.wikipedia.org/wiki/Radar_chart -""" -import numpy as np - -import matplotlib.pyplot as plt -from matplotlib.path import Path -from matplotlib.spines import Spine -from matplotlib.projections.polar import PolarAxes -from matplotlib.projections import register_projection - - -def radar_factory(num_vars, frame='circle'): - """Create a radar chart with `num_vars` axes. - - This function creates a RadarAxes projection and registers it. - - Parameters - ---------- - num_vars : int - Number of variables for radar chart. - frame : {'circle' | 'polygon'} - Shape of frame surrounding axes. - - """ - # calculate evenly-spaced axis angles - theta = np.linspace(0, 2*np.pi, num_vars, endpoint=False) - # rotate theta such that the first axis is at the top - theta += np.pi/2 - - def draw_poly_patch(self): - verts = unit_poly_verts(theta) - return plt.Polygon(verts, closed=True, edgecolor='k') - - def draw_circle_patch(self): - # unit circle centered on (0.5, 0.5) - return plt.Circle((0.5, 0.5), 0.5) - - patch_dict = {'polygon': draw_poly_patch, 'circle': draw_circle_patch} - if frame not in patch_dict: - raise ValueError('unknown value for `frame`: %s' % frame) - - class RadarAxes(PolarAxes): - - name = 'radar' - # use 1 line segment to connect specified points - RESOLUTION = 1 - # define draw_frame method - draw_patch = patch_dict[frame] - - def fill(self, *args, **kwargs): - """Override fill so that line is closed by default""" - closed = kwargs.pop('closed', True) - return super(RadarAxes, self).fill(closed=closed, *args, **kwargs) - - def plot(self, *args, **kwargs): - """Override plot so that line is closed by default""" - lines = super(RadarAxes, self).plot(*args, **kwargs) - for line in lines: - self._close_line(line) - - def _close_line(self, line): - x, y = line.get_data() - # FIXME: markers at x[0], y[0] get doubled-up - if x[0] != x[-1]: - x = np.concatenate((x, [x[0]])) - y = np.concatenate((y, [y[0]])) - line.set_data(x, y) - - def set_varlabels(self, labels): - self.set_thetagrids(np.degrees(theta), labels) - - def _gen_axes_patch(self): - return self.draw_patch() - - def _gen_axes_spines(self): - if frame == 'circle': - return PolarAxes._gen_axes_spines(self) - # The following is a hack to get the spines (i.e. the axes frame) - # to draw correctly for a polygon frame. - - # spine_type must be 'left', 'right', 'top', 'bottom', or `circle`. - spine_type = 'circle' - verts = unit_poly_verts(theta) - # close off polygon by repeating first vertex - verts.append(verts[0]) - path = Path(verts) - - spine = Spine(self, spine_type, path) - spine.set_transform(self.transAxes) - return {'polar': spine} - - register_projection(RadarAxes) - return theta - - -def unit_poly_verts(theta): - """Return vertices of polygon for subplot axes. - - This polygon is circumscribed by a unit circle centered at (0.5, 0.5) - """ - x0, y0, r = [0.5] * 3 - verts = [(r*np.cos(t) + x0, r*np.sin(t) + y0) for t in theta] - return verts - - -def example_data(): - # The following data is from the Denver Aerosol Sources and Health study. - # See doi:10.1016/j.atmosenv.2008.12.017 - # - # The data are pollution source profile estimates for five modeled - # pollution sources (e.g., cars, wood-burning, etc) that emit 7-9 chemical - # species. The radar charts are experimented with here to see if we can - # nicely visualize how the modeled source profiles change across four - # scenarios: - # 1) No gas-phase species present, just seven particulate counts on - # Sulfate - # Nitrate - # Elemental Carbon (EC) - # Organic Carbon fraction 1 (OC) - # Organic Carbon fraction 2 (OC2) - # Organic Carbon fraction 3 (OC3) - # Pyrolized Organic Carbon (OP) - # 2)Inclusion of gas-phase specie carbon monoxide (CO) - # 3)Inclusion of gas-phase specie ozone (O3). - # 4)Inclusion of both gas-phase species is present... - data = [ - ['Sulfate', 'Nitrate', 'EC', 'OC1', 'OC2', 'OC3', 'OP', 'CO', 'O3'], - ('Basecase', [ - [0.88, 0.01, 0.03, 0.03, 0.00, 0.06, 0.01, 0.00, 0.00], - [0.07, 0.95, 0.04, 0.05, 0.00, 0.02, 0.01, 0.00, 0.00], - [0.01, 0.02, 0.85, 0.19, 0.05, 0.10, 0.00, 0.00, 0.00], - [0.02, 0.01, 0.07, 0.01, 0.21, 0.12, 0.98, 0.00, 0.00], - [0.01, 0.01, 0.02, 0.71, 0.74, 0.70, 0.00, 0.00, 0.00]]), - ('With CO', [ - [0.88, 0.02, 0.02, 0.02, 0.00, 0.05, 0.00, 0.05, 0.00], - [0.08, 0.94, 0.04, 0.02, 0.00, 0.01, 0.12, 0.04, 0.00], - [0.01, 0.01, 0.79, 0.10, 0.00, 0.05, 0.00, 0.31, 0.00], - [0.00, 0.02, 0.03, 0.38, 0.31, 0.31, 0.00, 0.59, 0.00], - [0.02, 0.02, 0.11, 0.47, 0.69, 0.58, 0.88, 0.00, 0.00]]), - ('With O3', [ - [0.89, 0.01, 0.07, 0.00, 0.00, 0.05, 0.00, 0.00, 0.03], - [0.07, 0.95, 0.05, 0.04, 0.00, 0.02, 0.12, 0.00, 0.00], - [0.01, 0.02, 0.86, 0.27, 0.16, 0.19, 0.00, 0.00, 0.00], - [0.01, 0.03, 0.00, 0.32, 0.29, 0.27, 0.00, 0.00, 0.95], - [0.02, 0.00, 0.03, 0.37, 0.56, 0.47, 0.87, 0.00, 0.00]]), - ('CO & O3', [ - [0.87, 0.01, 0.08, 0.00, 0.00, 0.04, 0.00, 0.00, 0.01], - [0.09, 0.95, 0.02, 0.03, 0.00, 0.01, 0.13, 0.06, 0.00], - [0.01, 0.02, 0.71, 0.24, 0.13, 0.16, 0.00, 0.50, 0.00], - [0.01, 0.03, 0.00, 0.28, 0.24, 0.23, 0.00, 0.44, 0.88], - [0.02, 0.00, 0.18, 0.45, 0.64, 0.55, 0.86, 0.00, 0.16]]) - ] - return data - - -if __name__ == '__main__': - N = 9 - theta = radar_factory(N, frame='polygon') - - data = example_data() - spoke_labels = data.pop(0) - - fig, axes = plt.subplots(figsize=(9, 9), nrows=2, ncols=2, - subplot_kw=dict(projection='radar')) - fig.subplots_adjust(wspace=0.25, hspace=0.20, top=0.85, bottom=0.05) - - colors = ['b', 'r', 'g', 'm', 'y'] - # Plot the four cases from the example data on separate axes - for ax, (title, case_data) in zip(axes.flatten(), data): - ax.set_rgrids([0.2, 0.4, 0.6, 0.8]) - ax.set_title(title, weight='bold', size='medium', position=(0.5, 1.1), - horizontalalignment='center', verticalalignment='center') - for d, color in zip(case_data, colors): - ax.plot(theta, d, color=color) - ax.fill(theta, d, facecolor=color, alpha=0.25) - ax.set_varlabels(spoke_labels) - - # add legend relative to top-left plot - ax = axes[0, 0] - labels = ('Factor 1', 'Factor 2', 'Factor 3', 'Factor 4', 'Factor 5') - legend = ax.legend(labels, loc=(0.9, .95), - labelspacing=0.1, fontsize='small') - - fig.text(0.5, 0.965, '5-Factor Solution Profiles Across Four Scenarios', - horizontalalignment='center', color='black', weight='bold', - size='large') - - plt.show() diff --git a/mpl_examples/api/sankey_demo_basics.py b/mpl_examples/api/sankey_demo_basics.py deleted file mode 100644 index b582fcfeee8..00000000000 --- a/mpl_examples/api/sankey_demo_basics.py +++ /dev/null @@ -1,81 +0,0 @@ -""" -================ -The Sankey class -================ - -Demonstrate the Sankey class by producing three basic diagrams. -""" -import numpy as np -import matplotlib.pyplot as plt - -from matplotlib.sankey import Sankey - - -# Example 1 -- Mostly defaults -# This demonstrates how to create a simple diagram by implicitly calling the -# Sankey.add() method and by appending finish() to the call to the class. -Sankey(flows=[0.25, 0.15, 0.60, -0.20, -0.15, -0.05, -0.50, -0.10], - labels=['', '', '', 'First', 'Second', 'Third', 'Fourth', 'Fifth'], - orientations=[-1, 1, 0, 1, 1, 1, 0, -1]).finish() -plt.title("The default settings produce a diagram like this.") -# Notice: -# 1. Axes weren't provided when Sankey() was instantiated, so they were -# created automatically. -# 2. The scale argument wasn't necessary since the data was already -# normalized. -# 3. By default, the lengths of the paths are justified. - -# Example 2 -# This demonstrates: -# 1. Setting one path longer than the others -# 2. Placing a label in the middle of the diagram -# 3. Using the scale argument to normalize the flows -# 4. Implicitly passing keyword arguments to PathPatch() -# 5. Changing the angle of the arrow heads -# 6. Changing the offset between the tips of the paths and their labels -# 7. Formatting the numbers in the path labels and the associated unit -# 8. Changing the appearance of the patch and the labels after the figure is -# created -fig = plt.figure() -ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[], - title="Flow Diagram of a Widget") -sankey = Sankey(ax=ax, scale=0.01, offset=0.2, head_angle=180, - format='%.0f', unit='%') -sankey.add(flows=[25, 0, 60, -10, -20, -5, -15, -10, -40], - labels=['', '', '', 'First', 'Second', 'Third', 'Fourth', - 'Fifth', 'Hurray!'], - orientations=[-1, 1, 0, 1, 1, 1, -1, -1, 0], - pathlengths=[0.25, 0.25, 0.25, 0.25, 0.25, 0.6, 0.25, 0.25, - 0.25], - patchlabel="Widget\nA") # Arguments to matplotlib.patches.PathPatch() -diagrams = sankey.finish() -diagrams[0].texts[-1].set_color('r') -diagrams[0].text.set_fontweight('bold') -# Notice: -# 1. Since the sum of the flows is nonzero, the width of the trunk isn't -# uniform. If verbose.level is helpful (in matplotlibrc), a message is -# given in the terminal window. -# 2. The second flow doesn't appear because its value is zero. Again, if -# verbose.level is helpful, a message is given in the terminal window. - -# Example 3 -# This demonstrates: -# 1. Connecting two systems -# 2. Turning off the labels of the quantities -# 3. Adding a legend -fig = plt.figure() -ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[], title="Two Systems") -flows = [0.25, 0.15, 0.60, -0.10, -0.05, -0.25, -0.15, -0.10, -0.35] -sankey = Sankey(ax=ax, unit=None) -sankey.add(flows=flows, label='one', - orientations=[-1, 1, 0, 1, 1, 1, -1, -1, 0]) -sankey.add(flows=[-0.25, 0.15, 0.1], label='two', - orientations=[-1, -1, -1], prior=0, connect=(0, 0)) -diagrams = sankey.finish() -diagrams[-1].patch.set_hatch('/') -plt.legend(loc='best') -# Notice that only one connection is specified, but the systems form a -# circuit since: (1) the lengths of the paths are justified and (2) the -# orientation and ordering of the flows is mirrored. - -plt.show() diff --git a/mpl_examples/api/sankey_demo_basics_00.hires.png b/mpl_examples/api/sankey_demo_basics_00.hires.png deleted file mode 100644 index ff514f4bff4..00000000000 Binary files a/mpl_examples/api/sankey_demo_basics_00.hires.png and /dev/null differ diff --git a/mpl_examples/api/sankey_demo_basics_00.pdf b/mpl_examples/api/sankey_demo_basics_00.pdf deleted file mode 100644 index 1f896d61e1a..00000000000 Binary files a/mpl_examples/api/sankey_demo_basics_00.pdf and /dev/null differ diff --git a/mpl_examples/api/sankey_demo_basics_00.png b/mpl_examples/api/sankey_demo_basics_00.png deleted file mode 100644 index d3c519d7fa5..00000000000 Binary files a/mpl_examples/api/sankey_demo_basics_00.png and /dev/null differ diff --git a/mpl_examples/api/sankey_demo_basics_01.hires.png b/mpl_examples/api/sankey_demo_basics_01.hires.png deleted file mode 100644 index e2946970a5f..00000000000 Binary files a/mpl_examples/api/sankey_demo_basics_01.hires.png and /dev/null differ diff --git a/mpl_examples/api/sankey_demo_basics_01.pdf b/mpl_examples/api/sankey_demo_basics_01.pdf deleted file mode 100644 index 85b5abd7b93..00000000000 Binary files a/mpl_examples/api/sankey_demo_basics_01.pdf and /dev/null differ diff --git a/mpl_examples/api/sankey_demo_basics_01.png b/mpl_examples/api/sankey_demo_basics_01.png deleted file mode 100644 index 396a0b36d86..00000000000 Binary files a/mpl_examples/api/sankey_demo_basics_01.png and /dev/null differ diff --git a/mpl_examples/api/sankey_demo_basics_02.hires.png b/mpl_examples/api/sankey_demo_basics_02.hires.png deleted file mode 100644 index 0e1d969e3dc..00000000000 Binary files a/mpl_examples/api/sankey_demo_basics_02.hires.png and /dev/null differ diff --git a/mpl_examples/api/sankey_demo_basics_02.pdf b/mpl_examples/api/sankey_demo_basics_02.pdf deleted file mode 100644 index ae8b8e1f7ea..00000000000 Binary files a/mpl_examples/api/sankey_demo_basics_02.pdf and /dev/null differ diff --git a/mpl_examples/api/sankey_demo_basics_02.png b/mpl_examples/api/sankey_demo_basics_02.png deleted file mode 100644 index 114b7b855f2..00000000000 Binary files a/mpl_examples/api/sankey_demo_basics_02.png and /dev/null differ diff --git a/mpl_examples/api/sankey_demo_links.hires.png b/mpl_examples/api/sankey_demo_links.hires.png deleted file mode 100644 index de78cea9f2b..00000000000 Binary files a/mpl_examples/api/sankey_demo_links.hires.png and /dev/null differ diff --git a/mpl_examples/api/sankey_demo_links.pdf b/mpl_examples/api/sankey_demo_links.pdf deleted file mode 100644 index 04c83442231..00000000000 Binary files a/mpl_examples/api/sankey_demo_links.pdf and /dev/null differ diff --git a/mpl_examples/api/sankey_demo_links.png b/mpl_examples/api/sankey_demo_links.png deleted file mode 100644 index b85bac224ff..00000000000 Binary files a/mpl_examples/api/sankey_demo_links.png and /dev/null differ diff --git a/mpl_examples/api/sankey_demo_links.py b/mpl_examples/api/sankey_demo_links.py deleted file mode 100644 index b8de4744edb..00000000000 --- a/mpl_examples/api/sankey_demo_links.py +++ /dev/null @@ -1,58 +0,0 @@ -""" -====================================== -Long chain of connections using Sankey -====================================== - -Demonstrate/test the Sankey class by producing a long chain of connections. -""" - -from itertools import cycle - -import matplotlib.pyplot as plt -from matplotlib.sankey import Sankey - -links_per_side = 6 - - -def side(sankey, n=1): - """Generate a side chain.""" - prior = len(sankey.diagrams) - for i in range(0, 2*n, 2): - sankey.add(flows=[1, -1], orientations=[-1, -1], - patchlabel=str(prior + i), - prior=prior + i - 1, connect=(1, 0), alpha=0.5) - sankey.add(flows=[1, -1], orientations=[1, 1], - patchlabel=str(prior + i + 1), - prior=prior + i, connect=(1, 0), alpha=0.5) - - -def corner(sankey): - """Generate a corner link.""" - prior = len(sankey.diagrams) - sankey.add(flows=[1, -1], orientations=[0, 1], - patchlabel=str(prior), facecolor='k', - prior=prior - 1, connect=(1, 0), alpha=0.5) - - -fig = plt.figure() -ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[], - title="Why would you want to do this?\n(But you could.)") -sankey = Sankey(ax=ax, unit=None) -sankey.add(flows=[1, -1], orientations=[0, 1], - patchlabel="0", facecolor='k', - rotation=45) -side(sankey, n=links_per_side) -corner(sankey) -side(sankey, n=links_per_side) -corner(sankey) -side(sankey, n=links_per_side) -corner(sankey) -side(sankey, n=links_per_side) -sankey.finish() -# Notice: -# 1. The alignment doesn't drift significantly (if at all; with 16007 -# subdiagrams there is still closure). -# 2. The first diagram is rotated 45 deg, so all other diagrams are rotated -# accordingly. - -plt.show() diff --git a/mpl_examples/api/sankey_demo_old.hires.png b/mpl_examples/api/sankey_demo_old.hires.png deleted file mode 100644 index 41ddc213072..00000000000 Binary files a/mpl_examples/api/sankey_demo_old.hires.png and /dev/null differ diff --git a/mpl_examples/api/sankey_demo_old.pdf b/mpl_examples/api/sankey_demo_old.pdf deleted file mode 100644 index 7bd16f74525..00000000000 Binary files a/mpl_examples/api/sankey_demo_old.pdf and /dev/null differ diff --git a/mpl_examples/api/sankey_demo_old.png b/mpl_examples/api/sankey_demo_old.png deleted file mode 100644 index d8a9b812610..00000000000 Binary files a/mpl_examples/api/sankey_demo_old.png and /dev/null differ diff --git a/mpl_examples/api/sankey_demo_old.py b/mpl_examples/api/sankey_demo_old.py deleted file mode 100644 index fbe3c5d47ae..00000000000 --- a/mpl_examples/api/sankey_demo_old.py +++ /dev/null @@ -1,200 +0,0 @@ -""" -========================== -Yet another Sankey diagram -========================== - -This example showcases a more complex sankey diagram. -""" - -from __future__ import print_function - -__author__ = "Yannick Copin " -__version__ = "Time-stamp: <10/02/2010 16:49 ycopin@lyopc548.in2p3.fr>" - -import numpy as np - - -def sankey(ax, - outputs=[100.], outlabels=None, - inputs=[100.], inlabels='', - dx=40, dy=10, outangle=45, w=3, inangle=30, offset=2, **kwargs): - """Draw a Sankey diagram. - - outputs: array of outputs, should sum up to 100% - outlabels: output labels (same length as outputs), - or None (use default labels) or '' (no labels) - inputs and inlabels: similar for inputs - dx: horizontal elongation - dy: vertical elongation - outangle: output arrow angle [deg] - w: output arrow shoulder - inangle: input dip angle - offset: text offset - **kwargs: propagated to Patch (e.g., fill=False) - - Return (patch,[intexts,outtexts]). - """ - import matplotlib.patches as mpatches - from matplotlib.path import Path - - outs = np.absolute(outputs) - outsigns = np.sign(outputs) - outsigns[-1] = 0 # Last output - - ins = np.absolute(inputs) - insigns = np.sign(inputs) - insigns[0] = 0 # First input - - assert sum(outs) == 100, "Outputs don't sum up to 100%" - assert sum(ins) == 100, "Inputs don't sum up to 100%" - - def add_output(path, loss, sign=1): - # Arrow tip height - h = (loss/2 + w) * np.tan(np.radians(outangle)) - move, (x, y) = path[-1] # Use last point as reference - if sign == 0: # Final loss (horizontal) - path.extend([(Path.LINETO, [x + dx, y]), - (Path.LINETO, [x + dx, y + w]), - (Path.LINETO, [x + dx + h, y - loss/2]), # Tip - (Path.LINETO, [x + dx, y - loss - w]), - (Path.LINETO, [x + dx, y - loss])]) - outtips.append((sign, path[-3][1])) - else: # Intermediate loss (vertical) - path.extend([(Path.CURVE4, [x + dx/2, y]), - (Path.CURVE4, [x + dx, y]), - (Path.CURVE4, [x + dx, y + sign*dy]), - (Path.LINETO, [x + dx - w, y + sign*dy]), - # Tip - (Path.LINETO, [ - x + dx + loss/2, y + sign*(dy + h)]), - (Path.LINETO, [x + dx + loss + w, y + sign*dy]), - (Path.LINETO, [x + dx + loss, y + sign*dy]), - (Path.CURVE3, [x + dx + loss, y - sign*loss]), - (Path.CURVE3, [x + dx/2 + loss, y - sign*loss])]) - outtips.append((sign, path[-5][1])) - - def add_input(path, gain, sign=1): - h = (gain / 2) * np.tan(np.radians(inangle)) # Dip depth - move, (x, y) = path[-1] # Use last point as reference - if sign == 0: # First gain (horizontal) - path.extend([(Path.LINETO, [x - dx, y]), - (Path.LINETO, [x - dx + h, y + gain/2]), # Dip - (Path.LINETO, [x - dx, y + gain])]) - xd, yd = path[-2][1] # Dip position - indips.append((sign, [xd - h, yd])) - else: # Intermediate gain (vertical) - path.extend([(Path.CURVE4, [x - dx/2, y]), - (Path.CURVE4, [x - dx, y]), - (Path.CURVE4, [x - dx, y + sign*dy]), - # Dip - (Path.LINETO, [ - x - dx - gain / 2, y + sign*(dy - h)]), - (Path.LINETO, [x - dx - gain, y + sign*dy]), - (Path.CURVE3, [x - dx - gain, y - sign*gain]), - (Path.CURVE3, [x - dx/2 - gain, y - sign*gain])]) - xd, yd = path[-4][1] # Dip position - indips.append((sign, [xd, yd + sign*h])) - - outtips = [] # Output arrow tip dir. and positions - urpath = [(Path.MOVETO, [0, 100])] # 1st point of upper right path - lrpath = [(Path.LINETO, [0, 0])] # 1st point of lower right path - for loss, sign in zip(outs, outsigns): - add_output(sign >= 0 and urpath or lrpath, loss, sign=sign) - - indips = [] # Input arrow tip dir. and positions - llpath = [(Path.LINETO, [0, 0])] # 1st point of lower left path - ulpath = [(Path.MOVETO, [0, 100])] # 1st point of upper left path - for gain, sign in reversed(list(zip(ins, insigns))): - add_input(sign <= 0 and llpath or ulpath, gain, sign=sign) - - def revert(path): - """A path is not just revertable by path[::-1] because of Bezier - curves.""" - rpath = [] - nextmove = Path.LINETO - for move, pos in path[::-1]: - rpath.append((nextmove, pos)) - nextmove = move - return rpath - - # Concatenate subpathes in correct order - path = urpath + revert(lrpath) + llpath + revert(ulpath) - - codes, verts = zip(*path) - verts = np.array(verts) - - # Path patch - path = Path(verts, codes) - patch = mpatches.PathPatch(path, **kwargs) - ax.add_patch(patch) - - if False: # DEBUG - print("urpath", urpath) - print("lrpath", revert(lrpath)) - print("llpath", llpath) - print("ulpath", revert(ulpath)) - xs, ys = zip(*verts) - ax.plot(xs, ys, 'go-') - - # Labels - - def set_labels(labels, values): - """Set or check labels according to values.""" - if labels == '': # No labels - return labels - elif labels is None: # Default labels - return ['%2d%%' % val for val in values] - else: - assert len(labels) == len(values) - return labels - - def put_labels(labels, positions, output=True): - """Put labels to positions.""" - texts = [] - lbls = output and labels or labels[::-1] - for i, label in enumerate(lbls): - s, (x, y) = positions[i] # Label direction and position - if s == 0: - t = ax.text(x + offset, y, label, - ha=output and 'left' or 'right', va='center') - elif s > 0: - t = ax.text(x, y + offset, label, ha='center', va='bottom') - else: - t = ax.text(x, y - offset, label, ha='center', va='top') - texts.append(t) - return texts - - outlabels = set_labels(outlabels, outs) - outtexts = put_labels(outlabels, outtips, output=True) - - inlabels = set_labels(inlabels, ins) - intexts = put_labels(inlabels, indips, output=False) - - # Axes management - ax.set_xlim(verts[:, 0].min() - dx, verts[:, 0].max() + dx) - ax.set_ylim(verts[:, 1].min() - dy, verts[:, 1].max() + dy) - ax.set_aspect('equal', adjustable='datalim') - - return patch, [intexts, outtexts] - - -if __name__ == '__main__': - - import matplotlib.pyplot as plt - - outputs = [10., -20., 5., 15., -10., 40.] - outlabels = ['First', 'Second', 'Third', 'Fourth', 'Fifth', 'Hurray!'] - outlabels = [s + '\n%d%%' % abs(l) for l, s in zip(outputs, outlabels)] - - inputs = [60., -25., 15.] - - fig = plt.figure() - ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[], title="Sankey diagram") - - patch, (intexts, outtexts) = sankey(ax, outputs=outputs, - outlabels=outlabels, inputs=inputs, - inlabels=None) - outtexts[1].set_color('r') - outtexts[-1].set_fontweight('bold') - - plt.show() diff --git a/mpl_examples/api/sankey_demo_rankine.hires.png b/mpl_examples/api/sankey_demo_rankine.hires.png deleted file mode 100644 index 6fc390001f9..00000000000 Binary files a/mpl_examples/api/sankey_demo_rankine.hires.png and /dev/null differ diff --git a/mpl_examples/api/sankey_demo_rankine.pdf b/mpl_examples/api/sankey_demo_rankine.pdf deleted file mode 100644 index 4da955f717b..00000000000 Binary files a/mpl_examples/api/sankey_demo_rankine.pdf and /dev/null differ diff --git a/mpl_examples/api/sankey_demo_rankine.png b/mpl_examples/api/sankey_demo_rankine.png deleted file mode 100644 index caa316a19d8..00000000000 Binary files a/mpl_examples/api/sankey_demo_rankine.png and /dev/null differ diff --git a/mpl_examples/api/sankey_demo_rankine.py b/mpl_examples/api/sankey_demo_rankine.py deleted file mode 100644 index 59f1174184a..00000000000 --- a/mpl_examples/api/sankey_demo_rankine.py +++ /dev/null @@ -1,84 +0,0 @@ -""" -=================== -Rankine power cycle -=================== - -Demonstrate the Sankey class with a practical example of a Rankine power -cycle. - -""" -import matplotlib.pyplot as plt - -from matplotlib.sankey import Sankey - -fig = plt.figure(figsize=(8, 9)) -ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[], - title="Rankine Power Cycle: Example 8.6 from Moran and " - "Shapiro\n\x22Fundamentals of Engineering Thermodynamics " - "\x22, 6th ed., 2008") -Hdot = [260.431, 35.078, 180.794, 221.115, 22.700, - 142.361, 10.193, 10.210, 43.670, 44.312, - 68.631, 10.758, 10.758, 0.017, 0.642, - 232.121, 44.559, 100.613, 132.168] # MW -sankey = Sankey(ax=ax, format='%.3G', unit=' MW', gap=0.5, scale=1.0/Hdot[0]) -sankey.add(patchlabel='\n\nPump 1', rotation=90, facecolor='#37c959', - flows=[Hdot[13], Hdot[6], -Hdot[7]], - labels=['Shaft power', '', None], - pathlengths=[0.4, 0.883, 0.25], - orientations=[1, -1, 0]) -sankey.add(patchlabel='\n\nOpen\nheater', facecolor='#37c959', - flows=[Hdot[11], Hdot[7], Hdot[4], -Hdot[8]], - labels=[None, '', None, None], - pathlengths=[0.25, 0.25, 1.93, 0.25], - orientations=[1, 0, -1, 0], prior=0, connect=(2, 1)) -sankey.add(patchlabel='\n\nPump 2', facecolor='#37c959', - flows=[Hdot[14], Hdot[8], -Hdot[9]], - labels=['Shaft power', '', None], - pathlengths=[0.4, 0.25, 0.25], - orientations=[1, 0, 0], prior=1, connect=(3, 1)) -sankey.add(patchlabel='Closed\nheater', trunklength=2.914, fc='#37c959', - flows=[Hdot[9], Hdot[1], -Hdot[11], -Hdot[10]], - pathlengths=[0.25, 1.543, 0.25, 0.25], - labels=['', '', None, None], - orientations=[0, -1, 1, -1], prior=2, connect=(2, 0)) -sankey.add(patchlabel='Trap', facecolor='#37c959', trunklength=5.102, - flows=[Hdot[11], -Hdot[12]], - labels=['\n', None], - pathlengths=[1.0, 1.01], - orientations=[1, 1], prior=3, connect=(2, 0)) -sankey.add(patchlabel='Steam\ngenerator', facecolor='#ff5555', - flows=[Hdot[15], Hdot[10], Hdot[2], -Hdot[3], -Hdot[0]], - labels=['Heat rate', '', '', None, None], - pathlengths=0.25, - orientations=[1, 0, -1, -1, -1], prior=3, connect=(3, 1)) -sankey.add(patchlabel='\n\n\nTurbine 1', facecolor='#37c959', - flows=[Hdot[0], -Hdot[16], -Hdot[1], -Hdot[2]], - labels=['', None, None, None], - pathlengths=[0.25, 0.153, 1.543, 0.25], - orientations=[0, 1, -1, -1], prior=5, connect=(4, 0)) -sankey.add(patchlabel='\n\n\nReheat', facecolor='#37c959', - flows=[Hdot[2], -Hdot[2]], - labels=[None, None], - pathlengths=[0.725, 0.25], - orientations=[-1, 0], prior=6, connect=(3, 0)) -sankey.add(patchlabel='Turbine 2', trunklength=3.212, facecolor='#37c959', - flows=[Hdot[3], Hdot[16], -Hdot[5], -Hdot[4], -Hdot[17]], - labels=[None, 'Shaft power', None, '', 'Shaft power'], - pathlengths=[0.751, 0.15, 0.25, 1.93, 0.25], - orientations=[0, -1, 0, -1, 1], prior=6, connect=(1, 1)) -sankey.add(patchlabel='Condenser', facecolor='#58b1fa', trunklength=1.764, - flows=[Hdot[5], -Hdot[18], -Hdot[6]], - labels=['', 'Heat rate', None], - pathlengths=[0.45, 0.25, 0.883], - orientations=[-1, 1, 0], prior=8, connect=(2, 0)) -diagrams = sankey.finish() -for diagram in diagrams: - diagram.text.set_fontweight('bold') - diagram.text.set_fontsize('10') - for text in diagram.texts: - text.set_fontsize('10') -# Notice that the explicit connections are handled automatically, but the -# implicit ones currently are not. The lengths of the paths and the trunks -# must be adjusted manually, and that is a bit tricky. - -plt.show() diff --git a/mpl_examples/api/scatter_piecharts.hires.png b/mpl_examples/api/scatter_piecharts.hires.png deleted file mode 100644 index ac17eb82ecb..00000000000 Binary files a/mpl_examples/api/scatter_piecharts.hires.png and /dev/null differ diff --git a/mpl_examples/api/scatter_piecharts.pdf b/mpl_examples/api/scatter_piecharts.pdf deleted file mode 100644 index 79f7f56f7f3..00000000000 Binary files a/mpl_examples/api/scatter_piecharts.pdf and /dev/null differ diff --git a/mpl_examples/api/scatter_piecharts.png b/mpl_examples/api/scatter_piecharts.png deleted file mode 100644 index 38ea81ffe09..00000000000 Binary files a/mpl_examples/api/scatter_piecharts.png and /dev/null differ diff --git a/mpl_examples/api/scatter_piecharts.py b/mpl_examples/api/scatter_piecharts.py deleted file mode 100644 index 8d401ec497c..00000000000 --- a/mpl_examples/api/scatter_piecharts.py +++ /dev/null @@ -1,50 +0,0 @@ -""" -=================================== -Scatter plot with pie chart markers -=================================== - -This example makes custom 'pie charts' as the markers for a scatter plot. - -Thanks to Manuel Metz for the example -""" -import math -import numpy as np -import matplotlib.pyplot as plt - -# first define the ratios -r1 = 0.2 # 20% -r2 = r1 + 0.4 # 40% - -# define some sizes of the scatter marker -sizes = [60, 80, 120] - -# calculate the points of the first pie marker -# -# these are just the origin (0,0) + -# some points on a circle cos,sin -x = [0] + np.cos(np.linspace(0, 2*math.pi*r1, 10)).tolist() -y = [0] + np.sin(np.linspace(0, 2*math.pi*r1, 10)).tolist() - -xy1 = list(zip(x, y)) -s1 = max(max(x), max(y)) - -# ... -x = [0] + np.cos(np.linspace(2*math.pi*r1, 2*math.pi*r2, 10)).tolist() -y = [0] + np.sin(np.linspace(2*math.pi*r1, 2*math.pi*r2, 10)).tolist() -xy2 = list(zip(x, y)) -s2 = max(max(x), max(y)) - -x = [0] + np.cos(np.linspace(2*math.pi*r2, 2*math.pi, 10)).tolist() -y = [0] + np.sin(np.linspace(2*math.pi*r2, 2*math.pi, 10)).tolist() -xy3 = list(zip(x, y)) -s3 = max(max(x), max(y)) - -fig, ax = plt.subplots() -ax.scatter(np.arange(3), np.arange(3), marker=(xy1, 0), - s=[s1*s1*_ for _ in sizes], facecolor='blue') -ax.scatter(np.arange(3), np.arange(3), marker=(xy2, 0), - s=[s2*s2*_ for _ in sizes], facecolor='green') -ax.scatter(np.arange(3), np.arange(3), marker=(xy3, 0), - s=[s3*s3*_ for _ in sizes], facecolor='red') - -plt.show() diff --git a/mpl_examples/api/skewt.hires.png b/mpl_examples/api/skewt.hires.png deleted file mode 100644 index 8957775c52d..00000000000 Binary files a/mpl_examples/api/skewt.hires.png and /dev/null differ diff --git a/mpl_examples/api/skewt.pdf b/mpl_examples/api/skewt.pdf deleted file mode 100644 index dffdef36a06..00000000000 Binary files a/mpl_examples/api/skewt.pdf and /dev/null differ diff --git a/mpl_examples/api/skewt.png b/mpl_examples/api/skewt.png deleted file mode 100644 index b7d73961ee2..00000000000 Binary files a/mpl_examples/api/skewt.png and /dev/null differ diff --git a/mpl_examples/api/skewt.py b/mpl_examples/api/skewt.py deleted file mode 100644 index 93891f5a212..00000000000 --- a/mpl_examples/api/skewt.py +++ /dev/null @@ -1,293 +0,0 @@ -""" -=========================================================== -SkewT-logP diagram: using transforms and custom projections -=========================================================== - -This serves as an intensive exercise of matplotlib's transforms and custom -projection API. This example produces a so-called SkewT-logP diagram, which is -a common plot in meteorology for displaying vertical profiles of temperature. -As far as matplotlib is concerned, the complexity comes from having X and Y -axes that are not orthogonal. This is handled by including a skew component to -the basic Axes transforms. Additional complexity comes in handling the fact -that the upper and lower X-axes have different data ranges, which necessitates -a bunch of custom classes for ticks,spines, and the axis to handle this. - -""" - -from matplotlib.axes import Axes -import matplotlib.transforms as transforms -import matplotlib.axis as maxis -import matplotlib.spines as mspines -from matplotlib.projections import register_projection - - -# The sole purpose of this class is to look at the upper, lower, or total -# interval as appropriate and see what parts of the tick to draw, if any. -class SkewXTick(maxis.XTick): - def update_position(self, loc): - # This ensures that the new value of the location is set before - # any other updates take place - self._loc = loc - super(SkewXTick, self).update_position(loc) - - def _has_default_loc(self): - return self.get_loc() is None - - def _need_lower(self): - return (self._has_default_loc() or - transforms.interval_contains(self.axes.lower_xlim, - self.get_loc())) - - def _need_upper(self): - return (self._has_default_loc() or - transforms.interval_contains(self.axes.upper_xlim, - self.get_loc())) - - @property - def gridOn(self): - return (self._gridOn and (self._has_default_loc() or - transforms.interval_contains(self.get_view_interval(), - self.get_loc()))) - - @gridOn.setter - def gridOn(self, value): - self._gridOn = value - - @property - def tick1On(self): - return self._tick1On and self._need_lower() - - @tick1On.setter - def tick1On(self, value): - self._tick1On = value - - @property - def label1On(self): - return self._label1On and self._need_lower() - - @label1On.setter - def label1On(self, value): - self._label1On = value - - @property - def tick2On(self): - return self._tick2On and self._need_upper() - - @tick2On.setter - def tick2On(self, value): - self._tick2On = value - - @property - def label2On(self): - return self._label2On and self._need_upper() - - @label2On.setter - def label2On(self, value): - self._label2On = value - - def get_view_interval(self): - return self.axes.xaxis.get_view_interval() - - -# This class exists to provide two separate sets of intervals to the tick, -# as well as create instances of the custom tick -class SkewXAxis(maxis.XAxis): - def _get_tick(self, major): - return SkewXTick(self.axes, None, '', major=major) - - def get_view_interval(self): - return self.axes.upper_xlim[0], self.axes.lower_xlim[1] - - -# This class exists to calculate the separate data range of the -# upper X-axis and draw the spine there. It also provides this range -# to the X-axis artist for ticking and gridlines -class SkewSpine(mspines.Spine): - def _adjust_location(self): - pts = self._path.vertices - if self.spine_type == 'top': - pts[:, 0] = self.axes.upper_xlim - else: - pts[:, 0] = self.axes.lower_xlim - - -# This class handles registration of the skew-xaxes as a projection as well -# as setting up the appropriate transformations. It also overrides standard -# spines and axes instances as appropriate. -class SkewXAxes(Axes): - # The projection must specify a name. This will be used be the - # user to select the projection, i.e. ``subplot(111, - # projection='skewx')``. - name = 'skewx' - - def _init_axis(self): - # Taken from Axes and modified to use our modified X-axis - self.xaxis = SkewXAxis(self) - self.spines['top'].register_axis(self.xaxis) - self.spines['bottom'].register_axis(self.xaxis) - self.yaxis = maxis.YAxis(self) - self.spines['left'].register_axis(self.yaxis) - self.spines['right'].register_axis(self.yaxis) - - def _gen_axes_spines(self): - spines = {'top': SkewSpine.linear_spine(self, 'top'), - 'bottom': mspines.Spine.linear_spine(self, 'bottom'), - 'left': mspines.Spine.linear_spine(self, 'left'), - 'right': mspines.Spine.linear_spine(self, 'right')} - return spines - - def _set_lim_and_transforms(self): - """ - This is called once when the plot is created to set up all the - transforms for the data, text and grids. - """ - rot = 30 - - # Get the standard transform setup from the Axes base class - Axes._set_lim_and_transforms(self) - - # Need to put the skew in the middle, after the scale and limits, - # but before the transAxes. This way, the skew is done in Axes - # coordinates thus performing the transform around the proper origin - # We keep the pre-transAxes transform around for other users, like the - # spines for finding bounds - self.transDataToAxes = self.transScale + \ - self.transLimits + transforms.Affine2D().skew_deg(rot, 0) - - # Create the full transform from Data to Pixels - self.transData = self.transDataToAxes + self.transAxes - - # Blended transforms like this need to have the skewing applied using - # both axes, in axes coords like before. - self._xaxis_transform = (transforms.blended_transform_factory( - self.transScale + self.transLimits, - transforms.IdentityTransform()) + - transforms.Affine2D().skew_deg(rot, 0)) + self.transAxes - - @property - def lower_xlim(self): - return self.axes.viewLim.intervalx - - @property - def upper_xlim(self): - pts = [[0., 1.], [1., 1.]] - return self.transDataToAxes.inverted().transform(pts)[:, 0] - - -# Now register the projection with matplotlib so the user can select -# it. -register_projection(SkewXAxes) - -if __name__ == '__main__': - # Now make a simple example using the custom projection. - from matplotlib.ticker import (MultipleLocator, NullFormatter, - ScalarFormatter) - import matplotlib.pyplot as plt - from six import StringIO - import numpy as np - - # Some examples data - data_txt = ''' - 978.0 345 7.8 0.8 61 4.16 325 14 282.7 294.6 283.4 - 971.0 404 7.2 0.2 61 4.01 327 17 282.7 294.2 283.4 - 946.7 610 5.2 -1.8 61 3.56 335 26 282.8 293.0 283.4 - 944.0 634 5.0 -2.0 61 3.51 336 27 282.8 292.9 283.4 - 925.0 798 3.4 -2.6 65 3.43 340 32 282.8 292.7 283.4 - 911.8 914 2.4 -2.7 69 3.46 345 37 282.9 292.9 283.5 - 906.0 966 2.0 -2.7 71 3.47 348 39 283.0 293.0 283.6 - 877.9 1219 0.4 -3.2 77 3.46 0 48 283.9 293.9 284.5 - 850.0 1478 -1.3 -3.7 84 3.44 0 47 284.8 294.8 285.4 - 841.0 1563 -1.9 -3.8 87 3.45 358 45 285.0 295.0 285.6 - 823.0 1736 1.4 -0.7 86 4.44 353 42 290.3 303.3 291.0 - 813.6 1829 4.5 1.2 80 5.17 350 40 294.5 309.8 295.4 - 809.0 1875 6.0 2.2 77 5.57 347 39 296.6 313.2 297.6 - 798.0 1988 7.4 -0.6 57 4.61 340 35 299.2 313.3 300.1 - 791.0 2061 7.6 -1.4 53 4.39 335 33 300.2 313.6 301.0 - 783.9 2134 7.0 -1.7 54 4.32 330 31 300.4 313.6 301.2 - 755.1 2438 4.8 -3.1 57 4.06 300 24 301.2 313.7 301.9 - 727.3 2743 2.5 -4.4 60 3.81 285 29 301.9 313.8 302.6 - 700.5 3048 0.2 -5.8 64 3.57 275 31 302.7 313.8 303.3 - 700.0 3054 0.2 -5.8 64 3.56 280 31 302.7 313.8 303.3 - 698.0 3077 0.0 -6.0 64 3.52 280 31 302.7 313.7 303.4 - 687.0 3204 -0.1 -7.1 59 3.28 281 31 304.0 314.3 304.6 - 648.9 3658 -3.2 -10.9 55 2.59 285 30 305.5 313.8 305.9 - 631.0 3881 -4.7 -12.7 54 2.29 289 33 306.2 313.6 306.6 - 600.7 4267 -6.4 -16.7 44 1.73 295 39 308.6 314.3 308.9 - 592.0 4381 -6.9 -17.9 41 1.59 297 41 309.3 314.6 309.6 - 577.6 4572 -8.1 -19.6 39 1.41 300 44 310.1 314.9 310.3 - 555.3 4877 -10.0 -22.3 36 1.16 295 39 311.3 315.3 311.5 - 536.0 5151 -11.7 -24.7 33 0.97 304 39 312.4 315.8 312.6 - 533.8 5182 -11.9 -25.0 33 0.95 305 39 312.5 315.8 312.7 - 500.0 5680 -15.9 -29.9 29 0.64 290 44 313.6 315.9 313.7 - 472.3 6096 -19.7 -33.4 28 0.49 285 46 314.1 315.8 314.1 - 453.0 6401 -22.4 -36.0 28 0.39 300 50 314.4 315.8 314.4 - 400.0 7310 -30.7 -43.7 27 0.20 285 44 315.0 315.8 315.0 - 399.7 7315 -30.8 -43.8 27 0.20 285 44 315.0 315.8 315.0 - 387.0 7543 -33.1 -46.1 26 0.16 281 47 314.9 315.5 314.9 - 382.7 7620 -33.8 -46.8 26 0.15 280 48 315.0 315.6 315.0 - 342.0 8398 -40.5 -53.5 23 0.08 293 52 316.1 316.4 316.1 - 320.4 8839 -43.7 -56.7 22 0.06 300 54 317.6 317.8 317.6 - 318.0 8890 -44.1 -57.1 22 0.05 301 55 317.8 318.0 317.8 - 310.0 9060 -44.7 -58.7 19 0.04 304 61 319.2 319.4 319.2 - 306.1 9144 -43.9 -57.9 20 0.05 305 63 321.5 321.7 321.5 - 305.0 9169 -43.7 -57.7 20 0.05 303 63 322.1 322.4 322.1 - 300.0 9280 -43.5 -57.5 20 0.05 295 64 323.9 324.2 323.9 - 292.0 9462 -43.7 -58.7 17 0.05 293 67 326.2 326.4 326.2 - 276.0 9838 -47.1 -62.1 16 0.03 290 74 326.6 326.7 326.6 - 264.0 10132 -47.5 -62.5 16 0.03 288 79 330.1 330.3 330.1 - 251.0 10464 -49.7 -64.7 16 0.03 285 85 331.7 331.8 331.7 - 250.0 10490 -49.7 -64.7 16 0.03 285 85 332.1 332.2 332.1 - 247.0 10569 -48.7 -63.7 16 0.03 283 88 334.7 334.8 334.7 - 244.0 10649 -48.9 -63.9 16 0.03 280 91 335.6 335.7 335.6 - 243.3 10668 -48.9 -63.9 16 0.03 280 91 335.8 335.9 335.8 - 220.0 11327 -50.3 -65.3 15 0.03 280 85 343.5 343.6 343.5 - 212.0 11569 -50.5 -65.5 15 0.03 280 83 346.8 346.9 346.8 - 210.0 11631 -49.7 -64.7 16 0.03 280 83 349.0 349.1 349.0 - 200.0 11950 -49.9 -64.9 15 0.03 280 80 353.6 353.7 353.6 - 194.0 12149 -49.9 -64.9 15 0.03 279 78 356.7 356.8 356.7 - 183.0 12529 -51.3 -66.3 15 0.03 278 75 360.4 360.5 360.4 - 164.0 13233 -55.3 -68.3 18 0.02 277 69 365.2 365.3 365.2 - 152.0 13716 -56.5 -69.5 18 0.02 275 65 371.1 371.2 371.1 - 150.0 13800 -57.1 -70.1 18 0.02 275 64 371.5 371.6 371.5 - 136.0 14414 -60.5 -72.5 19 0.02 268 54 376.0 376.1 376.0 - 132.0 14600 -60.1 -72.1 19 0.02 265 51 380.0 380.1 380.0 - 131.4 14630 -60.2 -72.2 19 0.02 265 51 380.3 380.4 380.3 - 128.0 14792 -60.9 -72.9 19 0.02 266 50 381.9 382.0 381.9 - 125.0 14939 -60.1 -72.1 19 0.02 268 49 385.9 386.0 385.9 - 119.0 15240 -62.2 -73.8 20 0.01 270 48 387.4 387.5 387.4 - 112.0 15616 -64.9 -75.9 21 0.01 265 53 389.3 389.3 389.3 - 108.0 15838 -64.1 -75.1 21 0.01 265 58 394.8 394.9 394.8 - 107.8 15850 -64.1 -75.1 21 0.01 265 58 395.0 395.1 395.0 - 105.0 16010 -64.7 -75.7 21 0.01 272 50 396.9 396.9 396.9 - 103.0 16128 -62.9 -73.9 21 0.02 277 45 402.5 402.6 402.5 - 100.0 16310 -62.5 -73.5 21 0.02 285 36 406.7 406.8 406.7 - ''' - - # Parse the data - sound_data = StringIO(data_txt) - p, h, T, Td = np.loadtxt(sound_data, usecols=range(0, 4), unpack=True) - - # Create a new figure. The dimensions here give a good aspect ratio - fig = plt.figure(figsize=(6.5875, 6.2125)) - ax = fig.add_subplot(111, projection='skewx') - - plt.grid(True) - - # Plot the data using normal plotting functions, in this case using - # log scaling in Y, as dictated by the typical meteorological plot - ax.semilogy(T, p, color='C3') - ax.semilogy(Td, p, color='C2') - - # An example of a slanted line at constant X - l = ax.axvline(0, color='C0') - - # Disables the log-formatting that comes with semilogy - ax.yaxis.set_major_formatter(ScalarFormatter()) - ax.yaxis.set_minor_formatter(NullFormatter()) - ax.set_yticks(np.linspace(100, 1000, 10)) - ax.set_ylim(1050, 100) - - ax.xaxis.set_major_locator(MultipleLocator(10)) - ax.set_xlim(-50, 50) - - plt.show() diff --git a/mpl_examples/api/span_regions.hires.png b/mpl_examples/api/span_regions.hires.png deleted file mode 100644 index 7f8bcd8b348..00000000000 Binary files a/mpl_examples/api/span_regions.hires.png and /dev/null differ diff --git a/mpl_examples/api/span_regions.pdf b/mpl_examples/api/span_regions.pdf deleted file mode 100644 index 4dcc2659967..00000000000 Binary files a/mpl_examples/api/span_regions.pdf and /dev/null differ diff --git a/mpl_examples/api/span_regions.png b/mpl_examples/api/span_regions.png deleted file mode 100644 index b976a23de5b..00000000000 Binary files a/mpl_examples/api/span_regions.png and /dev/null differ diff --git a/mpl_examples/api/span_regions.py b/mpl_examples/api/span_regions.py deleted file mode 100644 index 7627e96992d..00000000000 --- a/mpl_examples/api/span_regions.py +++ /dev/null @@ -1,35 +0,0 @@ -""" -================ -Using span_where -================ - -Illustrate some helper functions for shading regions where a logical -mask is True - -See :meth:`matplotlib.collections.BrokenBarHCollection.span_where` -""" -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.collections as collections - - -t = np.arange(0.0, 2, 0.01) -s1 = np.sin(2*np.pi*t) -s2 = 1.2*np.sin(4*np.pi*t) - - -fig, ax = plt.subplots() -ax.set_title('using span_where') -ax.plot(t, s1, color='black') -ax.axhline(0, color='black', lw=2) - -collection = collections.BrokenBarHCollection.span_where( - t, ymin=0, ymax=1, where=s1 > 0, facecolor='green', alpha=0.5) -ax.add_collection(collection) - -collection = collections.BrokenBarHCollection.span_where( - t, ymin=-1, ymax=0, where=s1 < 0, facecolor='red', alpha=0.5) -ax.add_collection(collection) - - -plt.show() diff --git a/mpl_examples/api/two_scales.hires.png b/mpl_examples/api/two_scales.hires.png deleted file mode 100644 index e8559b049d8..00000000000 Binary files a/mpl_examples/api/two_scales.hires.png and /dev/null differ diff --git a/mpl_examples/api/two_scales.pdf b/mpl_examples/api/two_scales.pdf deleted file mode 100644 index 72eccc7ed7f..00000000000 Binary files a/mpl_examples/api/two_scales.pdf and /dev/null differ diff --git a/mpl_examples/api/two_scales.png b/mpl_examples/api/two_scales.png deleted file mode 100644 index 3850fc3b8bb..00000000000 Binary files a/mpl_examples/api/two_scales.png and /dev/null differ diff --git a/mpl_examples/api/two_scales.py b/mpl_examples/api/two_scales.py deleted file mode 100644 index 45b5fea722a..00000000000 --- a/mpl_examples/api/two_scales.py +++ /dev/null @@ -1,40 +0,0 @@ -""" -=========================== -Plots with different scales -=========================== - -Demonstrate how to do two plots on the same axes with different left and -right scales. - -The trick is to use *two different axes* that share the same *x* axis. -You can use separate `matplotlib.ticker` formatters and locators as -desired since the two axes are independent. - -Such axes are generated by calling the `Axes.twinx` method. Likewise, -`Axes.twiny` is available to generate axes that share a *y* axis but -have different top and bottom scales. - -The twinx and twiny methods are also exposed as pyplot functions. - -""" - -import numpy as np -import matplotlib.pyplot as plt - -fig, ax1 = plt.subplots() -t = np.arange(0.01, 10.0, 0.01) -s1 = np.exp(t) -ax1.plot(t, s1, 'b-') -ax1.set_xlabel('time (s)') -# Make the y-axis label, ticks and tick labels match the line color. -ax1.set_ylabel('exp', color='b') -ax1.tick_params('y', colors='b') - -ax2 = ax1.twinx() -s2 = np.sin(2 * np.pi * t) -ax2.plot(t, s2, 'r.') -ax2.set_ylabel('sin', color='r') -ax2.tick_params('y', colors='r') - -fig.tight_layout() -plt.show() diff --git a/mpl_examples/api/unicode_minus.hires.png b/mpl_examples/api/unicode_minus.hires.png deleted file mode 100644 index 2dc4e8b05c7..00000000000 Binary files a/mpl_examples/api/unicode_minus.hires.png and /dev/null differ diff --git a/mpl_examples/api/unicode_minus.pdf b/mpl_examples/api/unicode_minus.pdf deleted file mode 100644 index be9e1bd3b17..00000000000 Binary files a/mpl_examples/api/unicode_minus.pdf and /dev/null differ diff --git a/mpl_examples/api/unicode_minus.png b/mpl_examples/api/unicode_minus.png deleted file mode 100644 index deb8dda00cf..00000000000 Binary files a/mpl_examples/api/unicode_minus.png and /dev/null differ diff --git a/mpl_examples/api/unicode_minus.py b/mpl_examples/api/unicode_minus.py deleted file mode 100644 index fcebab8e1f3..00000000000 --- a/mpl_examples/api/unicode_minus.py +++ /dev/null @@ -1,21 +0,0 @@ -""" -============= -Unicode minus -============= - -You can use the proper typesetting Unicode minus (see -https://en.wikipedia.org/wiki/Plus_sign#Plus_sign) or the ASCII hyphen -for minus, which some people prefer. The matplotlibrc param -axes.unicode_minus controls the default behavior. - -The default is to use the Unicode minus. -""" -import numpy as np -import matplotlib -import matplotlib.pyplot as plt - -matplotlib.rcParams['axes.unicode_minus'] = False -fig, ax = plt.subplots() -ax.plot(10*np.random.randn(100), 10*np.random.randn(100), 'o') -ax.set_title('Using hyphen instead of Unicode minus') -plt.show() diff --git a/mpl_examples/api/watermark_image.hires.png b/mpl_examples/api/watermark_image.hires.png deleted file mode 100644 index 6631ced6838..00000000000 Binary files a/mpl_examples/api/watermark_image.hires.png and /dev/null differ diff --git a/mpl_examples/api/watermark_image.pdf b/mpl_examples/api/watermark_image.pdf deleted file mode 100644 index aa2e1853f6e..00000000000 Binary files a/mpl_examples/api/watermark_image.pdf and /dev/null differ diff --git a/mpl_examples/api/watermark_image.png b/mpl_examples/api/watermark_image.png deleted file mode 100644 index 779d8119acf..00000000000 Binary files a/mpl_examples/api/watermark_image.png and /dev/null differ diff --git a/mpl_examples/api/watermark_image.py b/mpl_examples/api/watermark_image.py deleted file mode 100644 index 355043dad92..00000000000 --- a/mpl_examples/api/watermark_image.py +++ /dev/null @@ -1,25 +0,0 @@ -""" -=============== -Watermark image -=============== - -Use a PNG file as a watermark -""" -from __future__ import print_function -import numpy as np -import matplotlib.cbook as cbook -import matplotlib.image as image -import matplotlib.pyplot as plt - -datafile = cbook.get_sample_data('logo2.png', asfileobj=False) -print('loading %s' % datafile) -im = image.imread(datafile) -im[:, :, -1] = 0.5 # set the alpha channel - -fig, ax = plt.subplots() - -ax.plot(np.random.rand(20), '-o', ms=20, lw=2, alpha=0.7, mfc='orange') -ax.grid() -fig.figimage(im, 10, 10, zorder=3) - -plt.show() diff --git a/mpl_examples/api/watermark_text.hires.png b/mpl_examples/api/watermark_text.hires.png deleted file mode 100644 index 79026b25864..00000000000 Binary files a/mpl_examples/api/watermark_text.hires.png and /dev/null differ diff --git a/mpl_examples/api/watermark_text.pdf b/mpl_examples/api/watermark_text.pdf deleted file mode 100644 index 8dac707f8b5..00000000000 Binary files a/mpl_examples/api/watermark_text.pdf and /dev/null differ diff --git a/mpl_examples/api/watermark_text.png b/mpl_examples/api/watermark_text.png deleted file mode 100644 index 83d1357a78c..00000000000 Binary files a/mpl_examples/api/watermark_text.png and /dev/null differ diff --git a/mpl_examples/api/watermark_text.py b/mpl_examples/api/watermark_text.py deleted file mode 100644 index 11f8a745aac..00000000000 --- a/mpl_examples/api/watermark_text.py +++ /dev/null @@ -1,23 +0,0 @@ -""" -============== -Text watermark -============== - -Use a Text as a watermark -""" -import numpy as np -#import matplotlib -#matplotlib.use('Agg') - -import matplotlib.pyplot as plt - -fig, ax = plt.subplots() -ax.plot(np.random.rand(20), '-o', ms=20, lw=2, alpha=0.7, mfc='orange') -ax.grid() - -# position bottom right -fig.text(0.95, 0.05, 'Property of MPL', - fontsize=50, color='gray', - ha='right', va='bottom', alpha=0.5) - -plt.show() diff --git a/mpl_examples/axes_grid/demo_axes_divider.py b/mpl_examples/axes_grid/demo_axes_divider.py deleted file mode 100644 index d69b1d745dc..00000000000 --- a/mpl_examples/axes_grid/demo_axes_divider.py +++ /dev/null @@ -1,128 +0,0 @@ -import matplotlib.pyplot as plt - - -def get_demo_image(): - import numpy as np - from matplotlib.cbook import get_sample_data - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3, 4, -4, 3) - - -def demo_simple_image(ax): - Z, extent = get_demo_image() - - im = ax.imshow(Z, extent=extent, interpolation="nearest") - cb = plt.colorbar(im) - plt.setp(cb.ax.get_yticklabels(), visible=False) - - -def demo_locatable_axes_hard(fig1): - - from mpl_toolkits.axes_grid1 \ - import SubplotDivider, LocatableAxes, Size - - divider = SubplotDivider(fig1, 2, 2, 2, aspect=True) - - # axes for image - ax = LocatableAxes(fig1, divider.get_position()) - - # axes for colorbar - ax_cb = LocatableAxes(fig1, divider.get_position()) - - h = [Size.AxesX(ax), # main axes - Size.Fixed(0.05), # padding, 0.1 inch - Size.Fixed(0.2), # colorbar, 0.3 inch - ] - - v = [Size.AxesY(ax)] - - divider.set_horizontal(h) - divider.set_vertical(v) - - ax.set_axes_locator(divider.new_locator(nx=0, ny=0)) - ax_cb.set_axes_locator(divider.new_locator(nx=2, ny=0)) - - fig1.add_axes(ax) - fig1.add_axes(ax_cb) - - ax_cb.axis["left"].toggle(all=False) - ax_cb.axis["right"].toggle(ticks=True) - - Z, extent = get_demo_image() - - im = ax.imshow(Z, extent=extent, interpolation="nearest") - plt.colorbar(im, cax=ax_cb) - plt.setp(ax_cb.get_yticklabels(), visible=False) - - -def demo_locatable_axes_easy(ax): - from mpl_toolkits.axes_grid1 import make_axes_locatable - - divider = make_axes_locatable(ax) - - ax_cb = divider.new_horizontal(size="5%", pad=0.05) - fig1 = ax.get_figure() - fig1.add_axes(ax_cb) - - Z, extent = get_demo_image() - im = ax.imshow(Z, extent=extent, interpolation="nearest") - - plt.colorbar(im, cax=ax_cb) - ax_cb.yaxis.tick_right() - for tl in ax_cb.get_yticklabels(): - tl.set_visible(False) - ax_cb.yaxis.tick_right() - - -def demo_images_side_by_side(ax): - from mpl_toolkits.axes_grid1 import make_axes_locatable - - divider = make_axes_locatable(ax) - - Z, extent = get_demo_image() - ax2 = divider.new_horizontal(size="100%", pad=0.05) - fig1 = ax.get_figure() - fig1.add_axes(ax2) - - ax.imshow(Z, extent=extent, interpolation="nearest") - ax2.imshow(Z, extent=extent, interpolation="nearest") - for tl in ax2.get_yticklabels(): - tl.set_visible(False) - - -def demo(): - - fig1 = plt.figure(1, (6, 6)) - fig1.clf() - - # PLOT 1 - # simple image & colorbar - ax = fig1.add_subplot(2, 2, 1) - demo_simple_image(ax) - - # PLOT 2 - # image and colorbar whose location is adjusted in the drawing time. - # a hard way - - demo_locatable_axes_hard(fig1) - - # PLOT 3 - # image and colorbar whose location is adjusted in the drawing time. - # a easy way - - ax = fig1.add_subplot(2, 2, 3) - demo_locatable_axes_easy(ax) - - # PLOT 4 - # two images side by side with fixed padding. - - ax = fig1.add_subplot(2, 2, 4) - demo_images_side_by_side(ax) - - plt.draw() - plt.show() - - -demo() diff --git a/mpl_examples/axes_grid/demo_axes_divider_01_00.hires.png b/mpl_examples/axes_grid/demo_axes_divider_01_00.hires.png deleted file mode 100644 index d95e6d165b8..00000000000 Binary files a/mpl_examples/axes_grid/demo_axes_divider_01_00.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_axes_divider_01_00.pdf b/mpl_examples/axes_grid/demo_axes_divider_01_00.pdf deleted file mode 100644 index 3a9dcefbc9e..00000000000 Binary files a/mpl_examples/axes_grid/demo_axes_divider_01_00.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_axes_divider_01_00.png b/mpl_examples/axes_grid/demo_axes_divider_01_00.png deleted file mode 100644 index 37c318bf00d..00000000000 Binary files a/mpl_examples/axes_grid/demo_axes_divider_01_00.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_axes_grid.hires.png b/mpl_examples/axes_grid/demo_axes_grid.hires.png deleted file mode 100644 index d5c34bcf391..00000000000 Binary files a/mpl_examples/axes_grid/demo_axes_grid.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_axes_grid.pdf b/mpl_examples/axes_grid/demo_axes_grid.pdf deleted file mode 100644 index dc1b226297b..00000000000 Binary files a/mpl_examples/axes_grid/demo_axes_grid.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_axes_grid.png b/mpl_examples/axes_grid/demo_axes_grid.png deleted file mode 100644 index 9399197bd42..00000000000 Binary files a/mpl_examples/axes_grid/demo_axes_grid.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_axes_grid.py b/mpl_examples/axes_grid/demo_axes_grid.py deleted file mode 100644 index 7d74cc5072e..00000000000 --- a/mpl_examples/axes_grid/demo_axes_grid.py +++ /dev/null @@ -1,133 +0,0 @@ -import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid1 import AxesGrid - - -def get_demo_image(): - import numpy as np - from matplotlib.cbook import get_sample_data - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3, 4, -4, 3) - - -def demo_simple_grid(fig): - """ - A grid of 2x2 images with 0.05 inch pad between images and only - the lower-left axes is labeled. - """ - grid = AxesGrid(fig, 141, # similar to subplot(141) - nrows_ncols=(2, 2), - axes_pad=0.05, - label_mode="1", - ) - - Z, extent = get_demo_image() - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest") - - # This only affects axes in first column and second row as share_all = - # False. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - - -def demo_grid_with_single_cbar(fig): - """ - A grid of 2x2 images with a single colorbar - """ - grid = AxesGrid(fig, 142, # similar to subplot(142) - nrows_ncols=(2, 2), - axes_pad=0.0, - share_all=True, - label_mode="L", - cbar_location="top", - cbar_mode="single", - ) - - Z, extent = get_demo_image() - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest") - #plt.colorbar(im, cax = grid.cbar_axes[0]) - grid.cbar_axes[0].colorbar(im) - - for cax in grid.cbar_axes: - cax.toggle_label(False) - - # This affects all axes as share_all = True. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - - -def demo_grid_with_each_cbar(fig): - """ - A grid of 2x2 images. Each image has its own colorbar. - """ - - grid = AxesGrid(fig, 143, # similar to subplot(143) - nrows_ncols=(2, 2), - axes_pad=0.1, - label_mode="1", - share_all=True, - cbar_location="top", - cbar_mode="each", - cbar_size="7%", - cbar_pad="2%", - ) - Z, extent = get_demo_image() - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest") - grid.cbar_axes[i].colorbar(im) - - for cax in grid.cbar_axes: - cax.toggle_label(False) - - # This affects all axes because we set share_all = True. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - - -def demo_grid_with_each_cbar_labelled(fig): - """ - A grid of 2x2 images. Each image has its own colorbar. - """ - - grid = AxesGrid(fig, 144, # similar to subplot(144) - nrows_ncols=(2, 2), - axes_pad=(0.45, 0.15), - label_mode="1", - share_all=True, - cbar_location="right", - cbar_mode="each", - cbar_size="7%", - cbar_pad="2%", - ) - Z, extent = get_demo_image() - - # Use a different colorbar range every time - limits = ((0, 1), (-2, 2), (-1.7, 1.4), (-1.5, 1)) - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest", - vmin=limits[i][0], vmax=limits[i][1]) - grid.cbar_axes[i].colorbar(im) - - for i, cax in enumerate(grid.cbar_axes): - cax.set_yticks((limits[i][0], limits[i][1])) - - # This affects all axes because we set share_all = True. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - - -if 1: - F = plt.figure(1, (10.5, 2.5)) - - F.subplots_adjust(left=0.05, right=0.95) - - demo_simple_grid(F) - demo_grid_with_single_cbar(F) - demo_grid_with_each_cbar(F) - demo_grid_with_each_cbar_labelled(F) - - plt.draw() - plt.show() diff --git a/mpl_examples/axes_grid/demo_axes_grid2.hires.png b/mpl_examples/axes_grid/demo_axes_grid2.hires.png deleted file mode 100644 index b1f12b48a2f..00000000000 Binary files a/mpl_examples/axes_grid/demo_axes_grid2.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_axes_grid2.pdf b/mpl_examples/axes_grid/demo_axes_grid2.pdf deleted file mode 100644 index 859d3dadb76..00000000000 Binary files a/mpl_examples/axes_grid/demo_axes_grid2.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_axes_grid2.png b/mpl_examples/axes_grid/demo_axes_grid2.png deleted file mode 100644 index 88cd5d225a5..00000000000 Binary files a/mpl_examples/axes_grid/demo_axes_grid2.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_axes_grid2.py b/mpl_examples/axes_grid/demo_axes_grid2.py deleted file mode 100644 index 438991acd14..00000000000 --- a/mpl_examples/axes_grid/demo_axes_grid2.py +++ /dev/null @@ -1,113 +0,0 @@ -import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid1 import ImageGrid -import numpy as np - - -def get_demo_image(): - from matplotlib.cbook import get_sample_data - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3, 4, -4, 3) - - -def add_inner_title(ax, title, loc, size=None, **kwargs): - from matplotlib.offsetbox import AnchoredText - from matplotlib.patheffects import withStroke - if size is None: - size = dict(size=plt.rcParams['legend.fontsize']) - at = AnchoredText(title, loc=loc, prop=size, - pad=0., borderpad=0.5, - frameon=False, **kwargs) - ax.add_artist(at) - at.txt._text.set_path_effects([withStroke(foreground="w", linewidth=3)]) - return at - -if 1: - F = plt.figure(1, (6, 6)) - F.clf() - - # prepare images - Z, extent = get_demo_image() - ZS = [Z[i::3, :] for i in range(3)] - extent = extent[0], extent[1]/3., extent[2], extent[3] - - # demo 1 : colorbar at each axes - - grid = ImageGrid(F, 211, # similar to subplot(111) - nrows_ncols=(1, 3), - direction="row", - axes_pad=0.05, - add_all=True, - label_mode="1", - share_all=True, - cbar_location="top", - cbar_mode="each", - cbar_size="7%", - cbar_pad="1%", - ) - - for ax, z in zip(grid, ZS): - im = ax.imshow( - z, origin="lower", extent=extent, interpolation="nearest") - ax.cax.colorbar(im) - - for ax, im_title in zip(grid, ["Image 1", "Image 2", "Image 3"]): - t = add_inner_title(ax, im_title, loc=3) - t.patch.set_alpha(0.5) - - for ax, z in zip(grid, ZS): - ax.cax.toggle_label(True) - #axis = ax.cax.axis[ax.cax.orientation] - #axis.label.set_text("counts s$^{-1}$") - #axis.label.set_size(10) - #axis.major_ticklabels.set_size(6) - - # changing the colorbar ticks - grid[1].cax.set_xticks([-1, 0, 1]) - grid[2].cax.set_xticks([-1, 0, 1]) - - grid[0].set_xticks([-2, 0]) - grid[0].set_yticks([-2, 0, 2]) - - # demo 2 : shared colorbar - - grid2 = ImageGrid(F, 212, - nrows_ncols=(1, 3), - direction="row", - axes_pad=0.05, - add_all=True, - label_mode="1", - share_all=True, - cbar_location="right", - cbar_mode="single", - cbar_size="10%", - cbar_pad=0.05, - ) - - grid2[0].set_xlabel("X") - grid2[0].set_ylabel("Y") - - vmax, vmin = np.max(ZS), np.min(ZS) - import matplotlib.colors - norm = matplotlib.colors.Normalize(vmax=vmax, vmin=vmin) - - for ax, z in zip(grid2, ZS): - im = ax.imshow(z, norm=norm, - origin="lower", extent=extent, - interpolation="nearest") - - # With cbar_mode="single", cax attribute of all axes are identical. - ax.cax.colorbar(im) - ax.cax.toggle_label(True) - - for ax, im_title in zip(grid2, ["(a)", "(b)", "(c)"]): - t = add_inner_title(ax, im_title, loc=2) - t.patch.set_ec("none") - t.patch.set_alpha(0.5) - - grid2[0].set_xticks([-2, 0]) - grid2[0].set_yticks([-2, 0, 2]) - - plt.draw() - plt.show() diff --git a/mpl_examples/axes_grid/demo_axes_hbox_divider.hires.png b/mpl_examples/axes_grid/demo_axes_hbox_divider.hires.png deleted file mode 100644 index 2f03eade5a1..00000000000 Binary files a/mpl_examples/axes_grid/demo_axes_hbox_divider.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_axes_hbox_divider.pdf b/mpl_examples/axes_grid/demo_axes_hbox_divider.pdf deleted file mode 100644 index 5dc26f6bd55..00000000000 Binary files a/mpl_examples/axes_grid/demo_axes_hbox_divider.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_axes_hbox_divider.png b/mpl_examples/axes_grid/demo_axes_hbox_divider.png deleted file mode 100644 index 51108534a27..00000000000 Binary files a/mpl_examples/axes_grid/demo_axes_hbox_divider.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_axes_hbox_divider.py b/mpl_examples/axes_grid/demo_axes_hbox_divider.py deleted file mode 100644 index 692ca8454c3..00000000000 --- a/mpl_examples/axes_grid/demo_axes_hbox_divider.py +++ /dev/null @@ -1,49 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid1.axes_divider import HBoxDivider -import mpl_toolkits.axes_grid1.axes_size as Size - - -def make_heights_equal(fig, rect, ax1, ax2, pad): - # pad in inches - - h1, v1 = Size.AxesX(ax1), Size.AxesY(ax1) - h2, v2 = Size.AxesX(ax2), Size.AxesY(ax2) - - pad_v = Size.Scaled(1) - pad_h = Size.Fixed(pad) - - my_divider = HBoxDivider(fig, rect, - horizontal=[h1, pad_h, h2], - vertical=[v1, pad_v, v2]) - - ax1.set_axes_locator(my_divider.new_locator(0)) - ax2.set_axes_locator(my_divider.new_locator(2)) - - -if __name__ == "__main__": - - arr1 = np.arange(20).reshape((4, 5)) - arr2 = np.arange(20).reshape((5, 4)) - - fig, (ax1, ax2) = plt.subplots(1, 2) - ax1.imshow(arr1, interpolation="nearest") - ax2.imshow(arr2, interpolation="nearest") - - rect = 111 # subplot param for combined axes - make_heights_equal(fig, rect, ax1, ax2, pad=0.5) # pad in inches - - for ax in [ax1, ax2]: - ax.locator_params(nbins=4) - - # annotate - ax3 = plt.axes([0.5, 0.5, 0.001, 0.001], frameon=False) - ax3.xaxis.set_visible(False) - ax3.yaxis.set_visible(False) - ax3.annotate("Location of two axes are adjusted\n" - "so that they have equal heights\n" - "while maintaining their aspect ratios", (0.5, 0.5), - xycoords="axes fraction", va="center", ha="center", - bbox=dict(boxstyle="round, pad=1", fc="w")) - - plt.show() diff --git a/mpl_examples/axes_grid/demo_axes_rgb.py b/mpl_examples/axes_grid/demo_axes_rgb.py deleted file mode 100644 index c5569b52de9..00000000000 --- a/mpl_examples/axes_grid/demo_axes_rgb.py +++ /dev/null @@ -1,84 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -from mpl_toolkits.axes_grid1.axes_rgb import make_rgb_axes, RGBAxes - - -def get_demo_image(): - from matplotlib.cbook import get_sample_data - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3, 4, -4, 3) - - -def get_rgb(): - Z, extent = get_demo_image() - - Z[Z < 0] = 0. - Z = Z/Z.max() - - R = Z[:13, :13] - G = Z[2:, 2:] - B = Z[:13, 2:] - - return R, G, B - - -def make_cube(r, g, b): - ny, nx = r.shape - R = np.zeros([ny, nx, 3], dtype="d") - R[:, :, 0] = r - G = np.zeros_like(R) - G[:, :, 1] = g - B = np.zeros_like(R) - B[:, :, 2] = b - - RGB = R + G + B - - return R, G, B, RGB - - -def demo_rgb(): - fig, ax = plt.subplots() - ax_r, ax_g, ax_b = make_rgb_axes(ax, pad=0.02) - #fig.add_axes(ax_r) - #fig.add_axes(ax_g) - #fig.add_axes(ax_b) - - r, g, b = get_rgb() - im_r, im_g, im_b, im_rgb = make_cube(r, g, b) - kwargs = dict(origin="lower", interpolation="nearest") - ax.imshow(im_rgb, **kwargs) - ax_r.imshow(im_r, **kwargs) - ax_g.imshow(im_g, **kwargs) - ax_b.imshow(im_b, **kwargs) - - -def demo_rgb2(): - fig = plt.figure(2) - ax = RGBAxes(fig, [0.1, 0.1, 0.8, 0.8], pad=0.0) - #fig.add_axes(ax) - #ax.add_RGB_to_figure() - - r, g, b = get_rgb() - kwargs = dict(origin="lower", interpolation="nearest") - ax.imshow_rgb(r, g, b, **kwargs) - - ax.RGB.set_xlim(0., 9.5) - ax.RGB.set_ylim(0.9, 10.6) - - for ax1 in [ax.RGB, ax.R, ax.G, ax.B]: - for sp1 in ax1.spines.values(): - sp1.set_color("w") - for tick in ax1.xaxis.get_major_ticks() + ax1.yaxis.get_major_ticks(): - tick.tick1line.set_mec("w") - tick.tick2line.set_mec("w") - - return ax - - -demo_rgb() -ax = demo_rgb2() - -plt.show() diff --git a/mpl_examples/axes_grid/demo_axes_rgb_00.hires.png b/mpl_examples/axes_grid/demo_axes_rgb_00.hires.png deleted file mode 100644 index 77b4d2f8568..00000000000 Binary files a/mpl_examples/axes_grid/demo_axes_rgb_00.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_axes_rgb_00.pdf b/mpl_examples/axes_grid/demo_axes_rgb_00.pdf deleted file mode 100644 index d164a299cc0..00000000000 Binary files a/mpl_examples/axes_grid/demo_axes_rgb_00.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_axes_rgb_00.png b/mpl_examples/axes_grid/demo_axes_rgb_00.png deleted file mode 100644 index 83008a136ce..00000000000 Binary files a/mpl_examples/axes_grid/demo_axes_rgb_00.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_axes_rgb_01.hires.png b/mpl_examples/axes_grid/demo_axes_rgb_01.hires.png deleted file mode 100644 index bd58a201272..00000000000 Binary files a/mpl_examples/axes_grid/demo_axes_rgb_01.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_axes_rgb_01.pdf b/mpl_examples/axes_grid/demo_axes_rgb_01.pdf deleted file mode 100644 index f8b708a8e1f..00000000000 Binary files a/mpl_examples/axes_grid/demo_axes_rgb_01.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_axes_rgb_01.png b/mpl_examples/axes_grid/demo_axes_rgb_01.png deleted file mode 100644 index 07cf4642e94..00000000000 Binary files a/mpl_examples/axes_grid/demo_axes_rgb_01.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_axisline_style.hires.png b/mpl_examples/axes_grid/demo_axisline_style.hires.png deleted file mode 100644 index 25fa8ff8052..00000000000 Binary files a/mpl_examples/axes_grid/demo_axisline_style.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_axisline_style.pdf b/mpl_examples/axes_grid/demo_axisline_style.pdf deleted file mode 100644 index 84e04d20005..00000000000 Binary files a/mpl_examples/axes_grid/demo_axisline_style.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_axisline_style.png b/mpl_examples/axes_grid/demo_axisline_style.png deleted file mode 100644 index d704ca5b182..00000000000 Binary files a/mpl_examples/axes_grid/demo_axisline_style.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_axisline_style.py b/mpl_examples/axes_grid/demo_axisline_style.py deleted file mode 100644 index 3d0b0d6f5da..00000000000 --- a/mpl_examples/axes_grid/demo_axisline_style.py +++ /dev/null @@ -1,21 +0,0 @@ - -from mpl_toolkits.axes_grid.axislines import SubplotZero -import matplotlib.pyplot as plt -import numpy as np - -if 1: - fig = plt.figure(1) - ax = SubplotZero(fig, 111) - fig.add_subplot(ax) - - for direction in ["xzero", "yzero"]: - ax.axis[direction].set_axisline_style("-|>") - ax.axis[direction].set_visible(True) - - for direction in ["left", "right", "bottom", "top"]: - ax.axis[direction].set_visible(False) - - x = np.linspace(-0.5, 1., 100) - ax.plot(x, np.sin(x*np.pi)) - - plt.show() diff --git a/mpl_examples/axes_grid/demo_colorbar_with_inset_locator.hires.png b/mpl_examples/axes_grid/demo_colorbar_with_inset_locator.hires.png deleted file mode 100644 index c3dc1fa1904..00000000000 Binary files a/mpl_examples/axes_grid/demo_colorbar_with_inset_locator.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_colorbar_with_inset_locator.pdf b/mpl_examples/axes_grid/demo_colorbar_with_inset_locator.pdf deleted file mode 100644 index 736a745870a..00000000000 Binary files a/mpl_examples/axes_grid/demo_colorbar_with_inset_locator.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_colorbar_with_inset_locator.png b/mpl_examples/axes_grid/demo_colorbar_with_inset_locator.png deleted file mode 100644 index e8540767524..00000000000 Binary files a/mpl_examples/axes_grid/demo_colorbar_with_inset_locator.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_colorbar_with_inset_locator.py b/mpl_examples/axes_grid/demo_colorbar_with_inset_locator.py deleted file mode 100644 index 72a920b402c..00000000000 --- a/mpl_examples/axes_grid/demo_colorbar_with_inset_locator.py +++ /dev/null @@ -1,33 +0,0 @@ -import matplotlib.pyplot as plt - -from mpl_toolkits.axes_grid1.inset_locator import inset_axes - -fig, (ax1, ax2) = plt.subplots(1, 2, figsize=[6, 3]) - -axins1 = inset_axes(ax1, - width="50%", # width = 10% of parent_bbox width - height="5%", # height : 50% - loc=1) - -im1 = ax1.imshow([[1, 2], [2, 3]]) -plt.colorbar(im1, cax=axins1, orientation="horizontal", ticks=[1, 2, 3]) -axins1.xaxis.set_ticks_position("bottom") - -axins = inset_axes(ax2, - width="5%", # width = 10% of parent_bbox width - height="50%", # height : 50% - loc=3, - bbox_to_anchor=(1.05, 0., 1, 1), - bbox_transform=ax2.transAxes, - borderpad=0, - ) - -# Controlling the placement of the inset axes is basically same as that -# of the legend. you may want to play with the borderpad value and -# the bbox_to_anchor coordinate. - -im = ax2.imshow([[1, 2], [2, 3]]) -plt.colorbar(im, cax=axins, ticks=[1, 2, 3]) - -plt.draw() -plt.show() diff --git a/mpl_examples/axes_grid/demo_curvelinear_grid.hires.png b/mpl_examples/axes_grid/demo_curvelinear_grid.hires.png deleted file mode 100644 index 60c7c57a8e3..00000000000 Binary files a/mpl_examples/axes_grid/demo_curvelinear_grid.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_curvelinear_grid.pdf b/mpl_examples/axes_grid/demo_curvelinear_grid.pdf deleted file mode 100644 index 38b296b4e3c..00000000000 Binary files a/mpl_examples/axes_grid/demo_curvelinear_grid.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_curvelinear_grid.png b/mpl_examples/axes_grid/demo_curvelinear_grid.png deleted file mode 100644 index 16bafea95e7..00000000000 Binary files a/mpl_examples/axes_grid/demo_curvelinear_grid.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_curvelinear_grid.py b/mpl_examples/axes_grid/demo_curvelinear_grid.py deleted file mode 100644 index ad8d0f51e81..00000000000 --- a/mpl_examples/axes_grid/demo_curvelinear_grid.py +++ /dev/null @@ -1,137 +0,0 @@ -""" -Custom grid and ticklines. - -This example demonstrates how to use GridHelperCurveLinear to define -custom grids and ticklines by applying a transformation on the grid. -This can be used, as showcase on the second plot, to create polar -projections in a rectangular box. -""" - -import numpy as np - -import matplotlib.pyplot as plt -import matplotlib.cbook as cbook - -from mpl_toolkits.axisartist import Subplot -from mpl_toolkits.axisartist import SubplotHost, \ - ParasiteAxesAuxTrans -from mpl_toolkits.axisartist.grid_helper_curvelinear import \ - GridHelperCurveLinear - - -def curvelinear_test1(fig): - """ - grid for custom transform. - """ - - def tr(x, y): - x, y = np.asarray(x), np.asarray(y) - return x, y - x - - def inv_tr(x, y): - x, y = np.asarray(x), np.asarray(y) - return x, y + x - - grid_helper = GridHelperCurveLinear((tr, inv_tr)) - - ax1 = Subplot(fig, 1, 2, 1, grid_helper=grid_helper) - # ax1 will have a ticks and gridlines defined by the given - # transform (+ transData of the Axes). Note that the transform of - # the Axes itself (i.e., transData) is not affected by the given - # transform. - - fig.add_subplot(ax1) - - xx, yy = tr([3, 6], [5.0, 10.]) - ax1.plot(xx, yy, linewidth=2.0) - - ax1.set_aspect(1.) - ax1.set_xlim(0, 10.) - ax1.set_ylim(0, 10.) - - ax1.axis["t"] = ax1.new_floating_axis(0, 3.) - ax1.axis["t2"] = ax1.new_floating_axis(1, 7.) - ax1.grid(True, zorder=0) - - -import mpl_toolkits.axisartist.angle_helper as angle_helper - -from matplotlib.projections import PolarAxes -from matplotlib.transforms import Affine2D - - -def curvelinear_test2(fig): - """ - polar projection, but in a rectangular box. - """ - - # PolarAxes.PolarTransform takes radian. However, we want our coordinate - # system in degree - tr = Affine2D().scale(np.pi/180., 1.) + PolarAxes.PolarTransform() - - # polar projection, which involves cycle, and also has limits in - # its coordinates, needs a special method to find the extremes - # (min, max of the coordinate within the view). - - # 20, 20 : number of sampling points along x, y direction - extreme_finder = angle_helper.ExtremeFinderCycle(20, 20, - lon_cycle=360, - lat_cycle=None, - lon_minmax=None, - lat_minmax=(0, np.inf), - ) - - grid_locator1 = angle_helper.LocatorDMS(12) - # Find a grid values appropriate for the coordinate (degree, - # minute, second). - - tick_formatter1 = angle_helper.FormatterDMS() - # And also uses an appropriate formatter. Note that,the - # acceptable Locator and Formatter class is a bit different than - # that of mpl's, and you cannot directly use mpl's Locator and - # Formatter here (but may be possible in the future). - - grid_helper = GridHelperCurveLinear(tr, - extreme_finder=extreme_finder, - grid_locator1=grid_locator1, - tick_formatter1=tick_formatter1 - ) - - ax1 = SubplotHost(fig, 1, 2, 2, grid_helper=grid_helper) - - # make ticklabels of right and top axis visible. - ax1.axis["right"].major_ticklabels.set_visible(True) - ax1.axis["top"].major_ticklabels.set_visible(True) - - # let right axis shows ticklabels for 1st coordinate (angle) - ax1.axis["right"].get_helper().nth_coord_ticks = 0 - # let bottom axis shows ticklabels for 2nd coordinate (radius) - ax1.axis["bottom"].get_helper().nth_coord_ticks = 1 - - fig.add_subplot(ax1) - - # A parasite axes with given transform - ax2 = ParasiteAxesAuxTrans(ax1, tr, "equal") - # note that ax2.transData == tr + ax1.transData - # Anything you draw in ax2 will match the ticks and grids of ax1. - ax1.parasites.append(ax2) - intp = cbook.simple_linear_interpolation - ax2.plot(intp(np.array([0, 30]), 50), - intp(np.array([10., 10.]), 50), - linewidth=2.0) - - ax1.set_aspect(1.) - ax1.set_xlim(-5, 12) - ax1.set_ylim(-5, 10) - - ax1.grid(True, zorder=0) - -if 1: - fig = plt.figure(1, figsize=(7, 4)) - fig.clf() - - curvelinear_test1(fig) - curvelinear_test2(fig) - - plt.draw() - plt.show() diff --git a/mpl_examples/axes_grid/demo_curvelinear_grid2.hires.png b/mpl_examples/axes_grid/demo_curvelinear_grid2.hires.png deleted file mode 100644 index a0bc5ace09b..00000000000 Binary files a/mpl_examples/axes_grid/demo_curvelinear_grid2.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_curvelinear_grid2.pdf b/mpl_examples/axes_grid/demo_curvelinear_grid2.pdf deleted file mode 100644 index e0d5e7f451f..00000000000 Binary files a/mpl_examples/axes_grid/demo_curvelinear_grid2.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_curvelinear_grid2.png b/mpl_examples/axes_grid/demo_curvelinear_grid2.png deleted file mode 100644 index 0a9af0d4943..00000000000 Binary files a/mpl_examples/axes_grid/demo_curvelinear_grid2.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_curvelinear_grid2.py b/mpl_examples/axes_grid/demo_curvelinear_grid2.py deleted file mode 100644 index 63025df6a91..00000000000 --- a/mpl_examples/axes_grid/demo_curvelinear_grid2.py +++ /dev/null @@ -1,68 +0,0 @@ -""" -Custom grid and ticklines. - -This example demonstrates how to use GridHelperCurveLinear to define -custom grids and ticklines by applying a transformation on the grid. -As showcase on the plot, a 5x5 matrix is displayed on the axes. -""" - -import numpy as np -import matplotlib.pyplot as plt - -from mpl_toolkits.axes_grid.grid_helper_curvelinear import \ - GridHelperCurveLinear -from mpl_toolkits.axes_grid.axislines import Subplot - -import mpl_toolkits.axes_grid.angle_helper as angle_helper - - -def curvelinear_test1(fig): - """ - grid for custom transform. - """ - - def tr(x, y): - sgn = np.sign(x) - x, y = np.abs(np.asarray(x)), np.asarray(y) - return sgn*x**.5, y - - def inv_tr(x, y): - sgn = np.sign(x) - x, y = np.asarray(x), np.asarray(y) - return sgn*x**2, y - - extreme_finder = angle_helper.ExtremeFinderCycle(20, 20, - lon_cycle=None, - lat_cycle=None, - # (0, np.inf), - lon_minmax=None, - lat_minmax=None, - ) - - grid_helper = GridHelperCurveLinear((tr, inv_tr), - extreme_finder=extreme_finder) - - ax1 = Subplot(fig, 111, grid_helper=grid_helper) - # ax1 will have a ticks and gridlines defined by the given - # transform (+ transData of the Axes). Note that the transform of - # the Axes itself (i.e., transData) is not affected by the given - # transform. - - fig.add_subplot(ax1) - - ax1.imshow(np.arange(25).reshape(5, 5), - vmax=50, cmap=plt.cm.gray_r, - interpolation="nearest", - origin="lower") - - # tick density - grid_helper.grid_finder.grid_locator1._nbins = 6 - grid_helper.grid_finder.grid_locator2._nbins = 6 - - -if 1: - fig = plt.figure(1, figsize=(7, 4)) - fig.clf() - - curvelinear_test1(fig) - plt.show() diff --git a/mpl_examples/axes_grid/demo_edge_colorbar.hires.png b/mpl_examples/axes_grid/demo_edge_colorbar.hires.png deleted file mode 100644 index 42401d70950..00000000000 Binary files a/mpl_examples/axes_grid/demo_edge_colorbar.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_edge_colorbar.pdf b/mpl_examples/axes_grid/demo_edge_colorbar.pdf deleted file mode 100644 index da1bedb6188..00000000000 Binary files a/mpl_examples/axes_grid/demo_edge_colorbar.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_edge_colorbar.png b/mpl_examples/axes_grid/demo_edge_colorbar.png deleted file mode 100644 index 547a3e8db7b..00000000000 Binary files a/mpl_examples/axes_grid/demo_edge_colorbar.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_edge_colorbar.py b/mpl_examples/axes_grid/demo_edge_colorbar.py deleted file mode 100644 index 7c57bb2fe37..00000000000 --- a/mpl_examples/axes_grid/demo_edge_colorbar.py +++ /dev/null @@ -1,88 +0,0 @@ -import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid1 import AxesGrid - - -def get_demo_image(): - import numpy as np - from matplotlib.cbook import get_sample_data - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3, 4, -4, 3) - - -def demo_bottom_cbar(fig): - """ - A grid of 2x2 images with a colorbar for each column. - """ - grid = AxesGrid(fig, 121, # similar to subplot(132) - nrows_ncols=(2, 2), - axes_pad=0.10, - share_all=True, - label_mode="1", - cbar_location="bottom", - cbar_mode="edge", - cbar_pad=0.25, - cbar_size="15%", - direction="column" - ) - - Z, extent = get_demo_image() - cmaps = [plt.get_cmap("autumn"), plt.get_cmap("summer")] - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest", - cmap=cmaps[i//2]) - if i % 2: - cbar = grid.cbar_axes[i//2].colorbar(im) - - for cax in grid.cbar_axes: - cax.toggle_label(True) - cax.axis[cax.orientation].set_label("Bar") - - # This affects all axes as share_all = True. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - - -def demo_right_cbar(fig): - """ - A grid of 2x2 images. Each row has its own colorbar. - """ - - grid = AxesGrid(F, 122, # similar to subplot(122) - nrows_ncols=(2, 2), - axes_pad=0.10, - label_mode="1", - share_all=True, - cbar_location="right", - cbar_mode="edge", - cbar_size="7%", - cbar_pad="2%", - ) - Z, extent = get_demo_image() - cmaps = [plt.get_cmap("spring"), plt.get_cmap("winter")] - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest", - cmap=cmaps[i//2]) - if i % 2: - grid.cbar_axes[i//2].colorbar(im) - - for cax in grid.cbar_axes: - cax.toggle_label(True) - cax.axis[cax.orientation].set_label('Foo') - - # This affects all axes because we set share_all = True. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - - -if 1: - F = plt.figure(1, (5.5, 2.5)) - - F.subplots_adjust(left=0.05, right=0.93) - - demo_bottom_cbar(F) - demo_right_cbar(F) - - plt.draw() - plt.show() diff --git a/mpl_examples/axes_grid/demo_floating_axes.hires.png b/mpl_examples/axes_grid/demo_floating_axes.hires.png deleted file mode 100644 index 04474946130..00000000000 Binary files a/mpl_examples/axes_grid/demo_floating_axes.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_floating_axes.pdf b/mpl_examples/axes_grid/demo_floating_axes.pdf deleted file mode 100644 index 3b6b20082a2..00000000000 Binary files a/mpl_examples/axes_grid/demo_floating_axes.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_floating_axes.png b/mpl_examples/axes_grid/demo_floating_axes.png deleted file mode 100644 index 548f34fedbb..00000000000 Binary files a/mpl_examples/axes_grid/demo_floating_axes.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_floating_axes.py b/mpl_examples/axes_grid/demo_floating_axes.py deleted file mode 100644 index f2b35f478b4..00000000000 --- a/mpl_examples/axes_grid/demo_floating_axes.py +++ /dev/null @@ -1,154 +0,0 @@ -""" -Demo of the floating axes. - -This demo shows features of functions in floating_axes: - * Using scatter function and bar function with changing the - shape of the plot. - * Using GridHelperCurveLinear to rotate the plot and set the - boundary of the plot. - * Using FloatingSubplot to create a subplot using the return - value from GridHelperCurveLinear. - * Making sector plot by adding more features to GridHelperCurveLinear. -""" -from matplotlib.transforms import Affine2D -import mpl_toolkits.axisartist.floating_axes as floating_axes -import numpy as np -import mpl_toolkits.axisartist.angle_helper as angle_helper -from matplotlib.projections import PolarAxes -from mpl_toolkits.axisartist.grid_finder import (FixedLocator, MaxNLocator, - DictFormatter) -import matplotlib.pyplot as plt - - -def setup_axes1(fig, rect): - """ - A simple one. - """ - tr = Affine2D().scale(2, 1).rotate_deg(30) - - grid_helper = floating_axes.GridHelperCurveLinear( - tr, extremes=(-0.5, 3.5, 0, 4)) - - ax1 = floating_axes.FloatingSubplot(fig, rect, grid_helper=grid_helper) - fig.add_subplot(ax1) - - aux_ax = ax1.get_aux_axes(tr) - - grid_helper.grid_finder.grid_locator1._nbins = 4 - grid_helper.grid_finder.grid_locator2._nbins = 4 - - return ax1, aux_ax - - -def setup_axes2(fig, rect): - """ - With custom locator and formatter. - Note that the extreme values are swapped. - """ - tr = PolarAxes.PolarTransform() - - pi = np.pi - angle_ticks = [(0, r"$0$"), - (.25*pi, r"$\frac{1}{4}\pi$"), - (.5*pi, r"$\frac{1}{2}\pi$")] - grid_locator1 = FixedLocator([v for v, s in angle_ticks]) - tick_formatter1 = DictFormatter(dict(angle_ticks)) - - grid_locator2 = MaxNLocator(2) - - grid_helper = floating_axes.GridHelperCurveLinear( - tr, extremes=(.5*pi, 0, 2, 1), - grid_locator1=grid_locator1, - grid_locator2=grid_locator2, - tick_formatter1=tick_formatter1, - tick_formatter2=None) - - ax1 = floating_axes.FloatingSubplot(fig, rect, grid_helper=grid_helper) - fig.add_subplot(ax1) - - # create a parasite axes whose transData in RA, cz - aux_ax = ax1.get_aux_axes(tr) - - aux_ax.patch = ax1.patch # for aux_ax to have a clip path as in ax - ax1.patch.zorder = 0.9 # but this has a side effect that the patch is - # drawn twice, and possibly over some other - # artists. So, we decrease the zorder a bit to - # prevent this. - - return ax1, aux_ax - - -def setup_axes3(fig, rect): - """ - Sometimes, things like axis_direction need to be adjusted. - """ - - # rotate a bit for better orientation - tr_rotate = Affine2D().translate(-95, 0) - - # scale degree to radians - tr_scale = Affine2D().scale(np.pi/180., 1.) - - tr = tr_rotate + tr_scale + PolarAxes.PolarTransform() - - grid_locator1 = angle_helper.LocatorHMS(4) - tick_formatter1 = angle_helper.FormatterHMS() - - grid_locator2 = MaxNLocator(3) - - ra0, ra1 = 8.*15, 14.*15 - cz0, cz1 = 0, 14000 - grid_helper = floating_axes.GridHelperCurveLinear( - tr, extremes=(ra0, ra1, cz0, cz1), - grid_locator1=grid_locator1, - grid_locator2=grid_locator2, - tick_formatter1=tick_formatter1, - tick_formatter2=None) - - ax1 = floating_axes.FloatingSubplot(fig, rect, grid_helper=grid_helper) - fig.add_subplot(ax1) - - # adjust axis - ax1.axis["left"].set_axis_direction("bottom") - ax1.axis["right"].set_axis_direction("top") - - ax1.axis["bottom"].set_visible(False) - ax1.axis["top"].set_axis_direction("bottom") - ax1.axis["top"].toggle(ticklabels=True, label=True) - ax1.axis["top"].major_ticklabels.set_axis_direction("top") - ax1.axis["top"].label.set_axis_direction("top") - - ax1.axis["left"].label.set_text(r"cz [km$^{-1}$]") - ax1.axis["top"].label.set_text(r"$\alpha_{1950}$") - - # create a parasite axes whose transData in RA, cz - aux_ax = ax1.get_aux_axes(tr) - - aux_ax.patch = ax1.patch # for aux_ax to have a clip path as in ax - ax1.patch.zorder = 0.9 # but this has a side effect that the patch is - # drawn twice, and possibly over some other - # artists. So, we decrease the zorder a bit to - # prevent this. - - return ax1, aux_ax - - -########################################################## -fig = plt.figure(1, figsize=(8, 4)) -fig.subplots_adjust(wspace=0.3, left=0.05, right=0.95) - -ax1, aux_ax1 = setup_axes1(fig, 131) -aux_ax1.bar([0, 1, 2, 3], [3, 2, 1, 3]) - -ax2, aux_ax2 = setup_axes2(fig, 132) -theta = np.random.rand(10)*.5*np.pi -radius = np.random.rand(10) + 1. -aux_ax2.scatter(theta, radius) - -ax3, aux_ax3 = setup_axes3(fig, 133) - -theta = (8 + np.random.rand(10)*(14 - 8))*15. # in degrees -radius = np.random.rand(10)*14000. -aux_ax3.scatter(theta, radius) - -plt.show() diff --git a/mpl_examples/axes_grid/demo_floating_axis.hires.png b/mpl_examples/axes_grid/demo_floating_axis.hires.png deleted file mode 100644 index f3d7da625ae..00000000000 Binary files a/mpl_examples/axes_grid/demo_floating_axis.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_floating_axis.pdf b/mpl_examples/axes_grid/demo_floating_axis.pdf deleted file mode 100644 index ef12cc878fc..00000000000 Binary files a/mpl_examples/axes_grid/demo_floating_axis.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_floating_axis.png b/mpl_examples/axes_grid/demo_floating_axis.png deleted file mode 100644 index a7e2088c5c9..00000000000 Binary files a/mpl_examples/axes_grid/demo_floating_axis.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_floating_axis.py b/mpl_examples/axes_grid/demo_floating_axis.py deleted file mode 100644 index 44eca5ad877..00000000000 --- a/mpl_examples/axes_grid/demo_floating_axis.py +++ /dev/null @@ -1,70 +0,0 @@ -""" -Axis within rectangular frame - -The following code demonstrates how to put a floating polar curve within a -rectangular box. In order to get a better sense of polar curves, please look at -demo_curvelinear_grid.py. -""" -import numpy as np -import matplotlib.pyplot as plt -import mpl_toolkits.axisartist.angle_helper as angle_helper -from matplotlib.projections import PolarAxes -from matplotlib.transforms import Affine2D -from mpl_toolkits.axisartist import SubplotHost -from mpl_toolkits.axisartist import GridHelperCurveLinear - - -def curvelinear_test2(fig): - """ - polar projection, but in a rectangular box. - """ - global ax1 - # see demo_curvelinear_grid.py for details - tr = Affine2D().scale(np.pi / 180., 1.) + PolarAxes.PolarTransform() - - extreme_finder = angle_helper.ExtremeFinderCycle(20, - 20, - lon_cycle=360, - lat_cycle=None, - lon_minmax=None, - lat_minmax=(0, - np.inf), - ) - - grid_locator1 = angle_helper.LocatorDMS(12) - - tick_formatter1 = angle_helper.FormatterDMS() - - grid_helper = GridHelperCurveLinear(tr, - extreme_finder=extreme_finder, - grid_locator1=grid_locator1, - tick_formatter1=tick_formatter1 - ) - - ax1 = SubplotHost(fig, 1, 1, 1, grid_helper=grid_helper) - - fig.add_subplot(ax1) - - # Now creates floating axis - - # floating axis whose first coordinate (theta) is fixed at 60 - ax1.axis["lat"] = axis = ax1.new_floating_axis(0, 60) - axis.label.set_text(r"$\theta = 60^{\circ}$") - axis.label.set_visible(True) - - # floating axis whose second coordinate (r) is fixed at 6 - ax1.axis["lon"] = axis = ax1.new_floating_axis(1, 6) - axis.label.set_text(r"$r = 6$") - - ax1.set_aspect(1.) - ax1.set_xlim(-5, 12) - ax1.set_ylim(-5, 10) - - ax1.grid(True) - -fig = plt.figure(1, figsize=(5, 5)) -fig.clf() - -curvelinear_test2(fig) - -plt.show() diff --git a/mpl_examples/axes_grid/demo_imagegrid_aspect.hires.png b/mpl_examples/axes_grid/demo_imagegrid_aspect.hires.png deleted file mode 100644 index 64d3fb4f9c1..00000000000 Binary files a/mpl_examples/axes_grid/demo_imagegrid_aspect.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_imagegrid_aspect.pdf b/mpl_examples/axes_grid/demo_imagegrid_aspect.pdf deleted file mode 100644 index bc4727c5ccb..00000000000 Binary files a/mpl_examples/axes_grid/demo_imagegrid_aspect.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_imagegrid_aspect.png b/mpl_examples/axes_grid/demo_imagegrid_aspect.png deleted file mode 100644 index 4e23c61032b..00000000000 Binary files a/mpl_examples/axes_grid/demo_imagegrid_aspect.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_imagegrid_aspect.py b/mpl_examples/axes_grid/demo_imagegrid_aspect.py deleted file mode 100644 index 79f7655753e..00000000000 --- a/mpl_examples/axes_grid/demo_imagegrid_aspect.py +++ /dev/null @@ -1,20 +0,0 @@ -import matplotlib.pyplot as plt - -from mpl_toolkits.axes_grid1 import ImageGrid -fig = plt.figure(1) - -grid1 = ImageGrid(fig, 121, (2, 2), axes_pad=0.1, - aspect=True, share_all=True) - -for i in [0, 1]: - grid1[i].set_aspect(2) - - -grid2 = ImageGrid(fig, 122, (2, 2), axes_pad=0.1, - aspect=True, share_all=True) - - -for i in [1, 3]: - grid2[i].set_aspect(2) - -plt.show() diff --git a/mpl_examples/axes_grid/demo_parasite_axes2.pdf b/mpl_examples/axes_grid/demo_parasite_axes2.pdf deleted file mode 100644 index 92ef5347c30..00000000000 Binary files a/mpl_examples/axes_grid/demo_parasite_axes2.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_parasite_axes2.png b/mpl_examples/axes_grid/demo_parasite_axes2.png deleted file mode 100644 index bac1bdf5e67..00000000000 Binary files a/mpl_examples/axes_grid/demo_parasite_axes2.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_parasite_axes2.py b/mpl_examples/axes_grid/demo_parasite_axes2.py deleted file mode 100644 index e4053ef0a07..00000000000 --- a/mpl_examples/axes_grid/demo_parasite_axes2.py +++ /dev/null @@ -1,51 +0,0 @@ -""" -Parasite axis demo - -The following code is an example of a parasite axis. It aims to show a user how -to plot multiple different values onto one single plot. Notice how in this -example, par1 and par2 are both calling twinx meaning both are tied directly to -the x-axis. From there, each of those two axis can behave separately from the -each other, meaning they can take on separate values from themselves as well as -the x-axis. -""" -from mpl_toolkits.axes_grid1 import host_subplot -import mpl_toolkits.axisartist as AA -import matplotlib.pyplot as plt - -host = host_subplot(111, axes_class=AA.Axes) -plt.subplots_adjust(right=0.75) - -par1 = host.twinx() -par2 = host.twinx() - -offset = 60 -new_fixed_axis = par2.get_grid_helper().new_fixed_axis -par2.axis["right"] = new_fixed_axis(loc="right", - axes=par2, - offset=(offset, 0)) - -par2.axis["right"].toggle(all=True) - -host.set_xlim(0, 2) -host.set_ylim(0, 2) - -host.set_xlabel("Distance") -host.set_ylabel("Density") -par1.set_ylabel("Temperature") -par2.set_ylabel("Velocity") - -p1, = host.plot([0, 1, 2], [0, 1, 2], label="Density") -p2, = par1.plot([0, 1, 2], [0, 3, 2], label="Temperature") -p3, = par2.plot([0, 1, 2], [50, 30, 15], label="Velocity") - -par1.set_ylim(0, 4) -par2.set_ylim(1, 65) - -host.legend() - -host.axis["left"].label.set_color(p1.get_color()) -par1.axis["right"].label.set_color(p2.get_color()) -par2.axis["right"].label.set_color(p3.get_color()) - -plt.draw() -plt.show() diff --git a/mpl_examples/axes_grid/demo_parasite_axes2_00_00.hires.png b/mpl_examples/axes_grid/demo_parasite_axes2_00_00.hires.png deleted file mode 100644 index 54dcc739655..00000000000 Binary files a/mpl_examples/axes_grid/demo_parasite_axes2_00_00.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_parasite_axes2_00_00.pdf b/mpl_examples/axes_grid/demo_parasite_axes2_00_00.pdf deleted file mode 100644 index d3113e502ce..00000000000 Binary files a/mpl_examples/axes_grid/demo_parasite_axes2_00_00.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/demo_parasite_axes2_00_00.png b/mpl_examples/axes_grid/demo_parasite_axes2_00_00.png deleted file mode 100644 index 8e47e722b4a..00000000000 Binary files a/mpl_examples/axes_grid/demo_parasite_axes2_00_00.png and /dev/null differ diff --git a/mpl_examples/axes_grid/inset_locator_demo.hires.png b/mpl_examples/axes_grid/inset_locator_demo.hires.png deleted file mode 100644 index 82b840f7b61..00000000000 Binary files a/mpl_examples/axes_grid/inset_locator_demo.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/inset_locator_demo.pdf b/mpl_examples/axes_grid/inset_locator_demo.pdf deleted file mode 100644 index 24a54741f28..00000000000 Binary files a/mpl_examples/axes_grid/inset_locator_demo.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/inset_locator_demo.png b/mpl_examples/axes_grid/inset_locator_demo.png deleted file mode 100644 index 67fb211e808..00000000000 Binary files a/mpl_examples/axes_grid/inset_locator_demo.png and /dev/null differ diff --git a/mpl_examples/axes_grid/inset_locator_demo.py b/mpl_examples/axes_grid/inset_locator_demo.py deleted file mode 100644 index 6b7582b3f5b..00000000000 --- a/mpl_examples/axes_grid/inset_locator_demo.py +++ /dev/null @@ -1,46 +0,0 @@ -import matplotlib.pyplot as plt - -from mpl_toolkits.axes_grid1.inset_locator import inset_axes, zoomed_inset_axes -from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar - - -def add_sizebar(ax, size): - asb = AnchoredSizeBar(ax.transData, - size, - str(size), - loc=8, - pad=0.1, borderpad=0.5, sep=5, - frameon=False) - ax.add_artist(asb) - - -fig, (ax, ax2) = plt.subplots(1, 2, figsize=[5.5, 3]) - -# first subplot -ax.set_aspect(1.) - -axins = inset_axes(ax, - width="30%", # width = 30% of parent_bbox - height=1., # height : 1 inch - loc=3) - -plt.xticks(visible=False) -plt.yticks(visible=False) - - -# second subplot -ax2.set_aspect(1.) - -axins = zoomed_inset_axes(ax2, 0.5, loc=1) # zoom = 0.5 -# fix the number of ticks on the inset axes -axins.yaxis.get_major_locator().set_params(nbins=7) -axins.xaxis.get_major_locator().set_params(nbins=7) - -plt.xticks(visible=False) -plt.yticks(visible=False) - -add_sizebar(ax2, 0.5) -add_sizebar(axins, 0.5) - -plt.draw() -plt.show() diff --git a/mpl_examples/axes_grid/inset_locator_demo2.hires.png b/mpl_examples/axes_grid/inset_locator_demo2.hires.png deleted file mode 100644 index f712f598125..00000000000 Binary files a/mpl_examples/axes_grid/inset_locator_demo2.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/inset_locator_demo2.pdf b/mpl_examples/axes_grid/inset_locator_demo2.pdf deleted file mode 100644 index 3641a1c800a..00000000000 Binary files a/mpl_examples/axes_grid/inset_locator_demo2.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/inset_locator_demo2.png b/mpl_examples/axes_grid/inset_locator_demo2.png deleted file mode 100644 index 5b03524b8ec..00000000000 Binary files a/mpl_examples/axes_grid/inset_locator_demo2.png and /dev/null differ diff --git a/mpl_examples/axes_grid/inset_locator_demo2.py b/mpl_examples/axes_grid/inset_locator_demo2.py deleted file mode 100644 index 51374cbbc7c..00000000000 --- a/mpl_examples/axes_grid/inset_locator_demo2.py +++ /dev/null @@ -1,49 +0,0 @@ -import matplotlib.pyplot as plt - -from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes -from mpl_toolkits.axes_grid1.inset_locator import mark_inset - -import numpy as np - - -def get_demo_image(): - from matplotlib.cbook import get_sample_data - import numpy as np - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3, 4, -4, 3) - -fig, ax = plt.subplots(figsize=[5, 4]) - -# prepare the demo image -Z, extent = get_demo_image() -Z2 = np.zeros([150, 150], dtype="d") -ny, nx = Z.shape -Z2[30:30 + ny, 30:30 + nx] = Z - -# extent = [-3, 4, -4, 3] -ax.imshow(Z2, extent=extent, interpolation="nearest", - origin="lower") - -axins = zoomed_inset_axes(ax, 6, loc=1) # zoom = 6 -axins.imshow(Z2, extent=extent, interpolation="nearest", - origin="lower") - -# sub region of the original image -x1, x2, y1, y2 = -1.5, -0.9, -2.5, -1.9 -axins.set_xlim(x1, x2) -axins.set_ylim(y1, y2) -# fix the number of ticks on the inset axes -axins.yaxis.get_major_locator().set_params(nbins=7) -axins.xaxis.get_major_locator().set_params(nbins=7) - -plt.xticks(visible=False) -plt.yticks(visible=False) - -# draw a bbox of the region of the inset axes in the parent axes and -# connecting lines between the bbox and the inset axes area -mark_inset(ax, axins, loc1=2, loc2=4, fc="none", ec="0.5") - -plt.draw() -plt.show() diff --git a/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid.py b/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid.py deleted file mode 100644 index fb609105a9d..00000000000 --- a/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid.py +++ /dev/null @@ -1,61 +0,0 @@ -from mpl_toolkits.axes_grid1 import make_axes_locatable -from mpl_toolkits.axes_grid1.axes_divider import make_axes_area_auto_adjustable - - -if __name__ == "__main__": - - import matplotlib.pyplot as plt - - def ex1(): - plt.figure(1) - ax = plt.axes([0, 0, 1, 1]) - #ax = plt.subplot(111) - - ax.set_yticks([0.5]) - ax.set_yticklabels(["very long label"]) - - make_axes_area_auto_adjustable(ax) - - def ex2(): - - plt.figure(2) - ax1 = plt.axes([0, 0, 1, 0.5]) - ax2 = plt.axes([0, 0.5, 1, 0.5]) - - ax1.set_yticks([0.5]) - ax1.set_yticklabels(["very long label"]) - ax1.set_ylabel("Y label") - - ax2.set_title("Title") - - make_axes_area_auto_adjustable(ax1, pad=0.1, use_axes=[ax1, ax2]) - make_axes_area_auto_adjustable(ax2, pad=0.1, use_axes=[ax1, ax2]) - - def ex3(): - - fig = plt.figure(3) - ax1 = plt.axes([0, 0, 1, 1]) - divider = make_axes_locatable(ax1) - - ax2 = divider.new_horizontal("100%", pad=0.3, sharey=ax1) - ax2.tick_params(labelleft="off") - fig.add_axes(ax2) - - divider.add_auto_adjustable_area(use_axes=[ax1], pad=0.1, - adjust_dirs=["left"]) - divider.add_auto_adjustable_area(use_axes=[ax2], pad=0.1, - adjust_dirs=["right"]) - divider.add_auto_adjustable_area(use_axes=[ax1, ax2], pad=0.1, - adjust_dirs=["top", "bottom"]) - - ax1.set_yticks([0.5]) - ax1.set_yticklabels(["very long label"]) - - ax2.set_title("Title") - ax2.set_xlabel("X - Label") - - ex1() - ex2() - ex3() - - plt.show() diff --git a/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_00.hires.png b/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_00.hires.png deleted file mode 100644 index 0de9aa82f5e..00000000000 Binary files a/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_00.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_00.pdf b/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_00.pdf deleted file mode 100644 index eb28792e549..00000000000 Binary files a/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_00.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_00.png b/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_00.png deleted file mode 100644 index 2d3c1841fcb..00000000000 Binary files a/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_00.png and /dev/null differ diff --git a/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_01.hires.png b/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_01.hires.png deleted file mode 100644 index 826db832064..00000000000 Binary files a/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_01.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_01.pdf b/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_01.pdf deleted file mode 100644 index ab4b8d1cfba..00000000000 Binary files a/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_01.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_01.png b/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_01.png deleted file mode 100644 index 8bd27b5dd9e..00000000000 Binary files a/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_01.png and /dev/null differ diff --git a/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_02.hires.png b/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_02.hires.png deleted file mode 100644 index 56346c2e35e..00000000000 Binary files a/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_02.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_02.pdf b/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_02.pdf deleted file mode 100644 index 367d71fe226..00000000000 Binary files a/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_02.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_02.png b/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_02.png deleted file mode 100644 index 10fa702d081..00000000000 Binary files a/mpl_examples/axes_grid/make_room_for_ylabel_using_axesgrid_02.png and /dev/null differ diff --git a/mpl_examples/axes_grid/parasite_simple2.hires.png b/mpl_examples/axes_grid/parasite_simple2.hires.png deleted file mode 100644 index 6048f36cc97..00000000000 Binary files a/mpl_examples/axes_grid/parasite_simple2.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/parasite_simple2.pdf b/mpl_examples/axes_grid/parasite_simple2.pdf deleted file mode 100644 index 670b594ba95..00000000000 Binary files a/mpl_examples/axes_grid/parasite_simple2.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/parasite_simple2.png b/mpl_examples/axes_grid/parasite_simple2.png deleted file mode 100644 index 6c4a20ead69..00000000000 Binary files a/mpl_examples/axes_grid/parasite_simple2.png and /dev/null differ diff --git a/mpl_examples/axes_grid/parasite_simple2.py b/mpl_examples/axes_grid/parasite_simple2.py deleted file mode 100644 index 1ab516f0156..00000000000 --- a/mpl_examples/axes_grid/parasite_simple2.py +++ /dev/null @@ -1,42 +0,0 @@ -import matplotlib.transforms as mtransforms -import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid1.parasite_axes import SubplotHost - -obs = [["01_S1", 3.88, 0.14, 1970, 63], - ["01_S4", 5.6, 0.82, 1622, 150], - ["02_S1", 2.4, 0.54, 1570, 40], - ["03_S1", 4.1, 0.62, 2380, 170]] - - -fig = plt.figure() - -ax_kms = SubplotHost(fig, 1, 1, 1, aspect=1.) - -# angular proper motion("/yr) to linear velocity(km/s) at distance=2.3kpc -pm_to_kms = 1./206265.*2300*3.085e18/3.15e7/1.e5 - -aux_trans = mtransforms.Affine2D().scale(pm_to_kms, 1.) -ax_pm = ax_kms.twin(aux_trans) -ax_pm.set_viewlim_mode("transform") - -fig.add_subplot(ax_kms) - -for n, ds, dse, w, we in obs: - time = ((2007 + (10. + 4/30.)/12) - 1988.5) - v = ds / time * pm_to_kms - ve = dse / time * pm_to_kms - ax_kms.errorbar([v], [w], xerr=[ve], yerr=[we], color="k") - - -ax_kms.axis["bottom"].set_label("Linear velocity at 2.3 kpc [km/s]") -ax_kms.axis["left"].set_label("FWHM [km/s]") -ax_pm.axis["top"].set_label(r"Proper Motion [$''$/yr]") -ax_pm.axis["top"].label.set_visible(True) -ax_pm.axis["right"].major_ticklabels.set_visible(False) - -ax_kms.set_xlim(950, 3700) -ax_kms.set_ylim(950, 3100) -# xlim and ylim of ax_pms will be automatically adjusted. - -plt.draw() -plt.show() diff --git a/mpl_examples/axes_grid/scatter_hist.hires.png b/mpl_examples/axes_grid/scatter_hist.hires.png deleted file mode 100644 index 0d65f693f22..00000000000 Binary files a/mpl_examples/axes_grid/scatter_hist.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/scatter_hist.pdf b/mpl_examples/axes_grid/scatter_hist.pdf deleted file mode 100644 index 32b894b8fd2..00000000000 Binary files a/mpl_examples/axes_grid/scatter_hist.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/scatter_hist.png b/mpl_examples/axes_grid/scatter_hist.png deleted file mode 100644 index 9ab4fdfcab9..00000000000 Binary files a/mpl_examples/axes_grid/scatter_hist.png and /dev/null differ diff --git a/mpl_examples/axes_grid/scatter_hist.py b/mpl_examples/axes_grid/scatter_hist.py deleted file mode 100644 index ff6e1412c1f..00000000000 --- a/mpl_examples/axes_grid/scatter_hist.py +++ /dev/null @@ -1,51 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid1 import make_axes_locatable - -# the random data -x = np.random.randn(1000) -y = np.random.randn(1000) - - -fig, axScatter = plt.subplots(figsize=(5.5, 5.5)) - -# the scatter plot: -axScatter.scatter(x, y) -axScatter.set_aspect(1.) - -# create new axes on the right and on the top of the current axes -# The first argument of the new_vertical(new_horizontal) method is -# the height (width) of the axes to be created in inches. -divider = make_axes_locatable(axScatter) -axHistx = divider.append_axes("top", 1.2, pad=0.1, sharex=axScatter) -axHisty = divider.append_axes("right", 1.2, pad=0.1, sharey=axScatter) - -# make some labels invisible -plt.setp(axHistx.get_xticklabels() + axHisty.get_yticklabels(), - visible=False) - -# now determine nice limits by hand: -binwidth = 0.25 -xymax = np.max([np.max(np.fabs(x)), np.max(np.fabs(y))]) -lim = (int(xymax/binwidth) + 1)*binwidth - -bins = np.arange(-lim, lim + binwidth, binwidth) -axHistx.hist(x, bins=bins) -axHisty.hist(y, bins=bins, orientation='horizontal') - -# the xaxis of axHistx and yaxis of axHisty are shared with axScatter, -# thus there is no need to manually adjust the xlim and ylim of these -# axis. - -#axHistx.axis["bottom"].major_ticklabels.set_visible(False) -for tl in axHistx.get_xticklabels(): - tl.set_visible(False) -axHistx.set_yticks([0, 50, 100]) - -#axHisty.axis["left"].major_ticklabels.set_visible(False) -for tl in axHisty.get_yticklabels(): - tl.set_visible(False) -axHisty.set_xticks([0, 50, 100]) - -plt.draw() -plt.show() diff --git a/mpl_examples/axes_grid/simple_anchored_artists.hires.png b/mpl_examples/axes_grid/simple_anchored_artists.hires.png deleted file mode 100644 index c378fa5e4a8..00000000000 Binary files a/mpl_examples/axes_grid/simple_anchored_artists.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/simple_anchored_artists.pdf b/mpl_examples/axes_grid/simple_anchored_artists.pdf deleted file mode 100644 index 5da1343aa6a..00000000000 Binary files a/mpl_examples/axes_grid/simple_anchored_artists.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/simple_anchored_artists.png b/mpl_examples/axes_grid/simple_anchored_artists.png deleted file mode 100644 index 302c01065de..00000000000 Binary files a/mpl_examples/axes_grid/simple_anchored_artists.png and /dev/null differ diff --git a/mpl_examples/axes_grid/simple_anchored_artists.py b/mpl_examples/axes_grid/simple_anchored_artists.py deleted file mode 100644 index 26ef0f6a26a..00000000000 --- a/mpl_examples/axes_grid/simple_anchored_artists.py +++ /dev/null @@ -1,62 +0,0 @@ -import matplotlib.pyplot as plt - - -def draw_text(ax): - from matplotlib.offsetbox import AnchoredText - at = AnchoredText("Figure 1a", - loc=2, prop=dict(size=8), frameon=True, - ) - at.patch.set_boxstyle("round,pad=0.,rounding_size=0.2") - ax.add_artist(at) - - at2 = AnchoredText("Figure 1(b)", - loc=3, prop=dict(size=8), frameon=True, - bbox_to_anchor=(0., 1.), - bbox_transform=ax.transAxes - ) - at2.patch.set_boxstyle("round,pad=0.,rounding_size=0.2") - ax.add_artist(at2) - - -def draw_circle(ax): # circle in the canvas coordinate - from mpl_toolkits.axes_grid1.anchored_artists import AnchoredDrawingArea - from matplotlib.patches import Circle - ada = AnchoredDrawingArea(20, 20, 0, 0, - loc=1, pad=0., frameon=False) - p = Circle((10, 10), 10) - ada.da.add_artist(p) - ax.add_artist(ada) - - -def draw_ellipse(ax): - from mpl_toolkits.axes_grid1.anchored_artists import AnchoredEllipse - # draw an ellipse of width=0.1, height=0.15 in the data coordinate - ae = AnchoredEllipse(ax.transData, width=0.1, height=0.15, angle=0., - loc=3, pad=0.5, borderpad=0.4, frameon=True) - - ax.add_artist(ae) - - -def draw_sizebar(ax): - from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar - # draw a horizontal bar with length of 0.1 in Data coordinate - # (ax.transData) with a label underneath. - asb = AnchoredSizeBar(ax.transData, - 0.1, - r"1$^{\prime}$", - loc=8, - pad=0.1, borderpad=0.5, sep=5, - frameon=False) - ax.add_artist(asb) - - -if 1: - ax = plt.gca() - ax.set_aspect(1.) - - draw_text(ax) - draw_circle(ax) - draw_ellipse(ax) - draw_sizebar(ax) - - plt.show() diff --git a/mpl_examples/axes_grid/simple_axesgrid.hires.png b/mpl_examples/axes_grid/simple_axesgrid.hires.png deleted file mode 100644 index ef8168b2c23..00000000000 Binary files a/mpl_examples/axes_grid/simple_axesgrid.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/simple_axesgrid.pdf b/mpl_examples/axes_grid/simple_axesgrid.pdf deleted file mode 100644 index a40aefbf9a4..00000000000 Binary files a/mpl_examples/axes_grid/simple_axesgrid.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/simple_axesgrid.png b/mpl_examples/axes_grid/simple_axesgrid.png deleted file mode 100644 index 29f77476284..00000000000 Binary files a/mpl_examples/axes_grid/simple_axesgrid.png and /dev/null differ diff --git a/mpl_examples/axes_grid/simple_axesgrid.py b/mpl_examples/axes_grid/simple_axesgrid.py deleted file mode 100644 index b8c45f2aae6..00000000000 --- a/mpl_examples/axes_grid/simple_axesgrid.py +++ /dev/null @@ -1,17 +0,0 @@ -import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid1 import ImageGrid -import numpy as np - -im = np.arange(100) -im.shape = 10, 10 - -fig = plt.figure(1, (4., 4.)) -grid = ImageGrid(fig, 111, # similar to subplot(111) - nrows_ncols=(2, 2), # creates 2x2 grid of axes - axes_pad=0.1, # pad between axes in inch. - ) - -for i in range(4): - grid[i].imshow(im) # The AxesGrid object work as a list of axes. - -plt.show() diff --git a/mpl_examples/axes_grid/simple_axesgrid2.hires.png b/mpl_examples/axes_grid/simple_axesgrid2.hires.png deleted file mode 100644 index 5661a089ffa..00000000000 Binary files a/mpl_examples/axes_grid/simple_axesgrid2.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/simple_axesgrid2.pdf b/mpl_examples/axes_grid/simple_axesgrid2.pdf deleted file mode 100644 index 43a0115f01c..00000000000 Binary files a/mpl_examples/axes_grid/simple_axesgrid2.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/simple_axesgrid2.png b/mpl_examples/axes_grid/simple_axesgrid2.png deleted file mode 100644 index a1dbac3bed3..00000000000 Binary files a/mpl_examples/axes_grid/simple_axesgrid2.png and /dev/null differ diff --git a/mpl_examples/axes_grid/simple_axesgrid2.py b/mpl_examples/axes_grid/simple_axesgrid2.py deleted file mode 100644 index 0eac5461613..00000000000 --- a/mpl_examples/axes_grid/simple_axesgrid2.py +++ /dev/null @@ -1,33 +0,0 @@ -import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid1 import ImageGrid - - -def get_demo_image(): - import numpy as np - from matplotlib.cbook import get_sample_data - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3, 4, -4, 3) - -F = plt.figure(1, (5.5, 3.5)) -grid = ImageGrid(F, 111, # similar to subplot(111) - nrows_ncols=(1, 3), - axes_pad=0.1, - add_all=True, - label_mode="L", - ) - -Z, extent = get_demo_image() # demo image - -im1 = Z -im2 = Z[:, :10] -im3 = Z[:, 10:] -vmin, vmax = Z.min(), Z.max() -for i, im in enumerate([im1, im2, im3]): - ax = grid[i] - ax.imshow(im, origin="lower", vmin=vmin, - vmax=vmax, interpolation="nearest") - -plt.draw() -plt.show() diff --git a/mpl_examples/axes_grid/simple_axisline4.hires.png b/mpl_examples/axes_grid/simple_axisline4.hires.png deleted file mode 100644 index 38cf9dd4461..00000000000 Binary files a/mpl_examples/axes_grid/simple_axisline4.hires.png and /dev/null differ diff --git a/mpl_examples/axes_grid/simple_axisline4.pdf b/mpl_examples/axes_grid/simple_axisline4.pdf deleted file mode 100644 index 0af22f59acf..00000000000 Binary files a/mpl_examples/axes_grid/simple_axisline4.pdf and /dev/null differ diff --git a/mpl_examples/axes_grid/simple_axisline4.png b/mpl_examples/axes_grid/simple_axisline4.png deleted file mode 100644 index f7f0132c7c9..00000000000 Binary files a/mpl_examples/axes_grid/simple_axisline4.png and /dev/null differ diff --git a/mpl_examples/axes_grid/simple_axisline4.py b/mpl_examples/axes_grid/simple_axisline4.py deleted file mode 100644 index cac8fe0ccb9..00000000000 --- a/mpl_examples/axes_grid/simple_axisline4.py +++ /dev/null @@ -1,19 +0,0 @@ -import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid1 import host_subplot -import mpl_toolkits.axisartist as AA -import numpy as np - -ax = host_subplot(111, axes_class=AA.Axes) -xx = np.arange(0, 2*np.pi, 0.01) -ax.plot(xx, np.sin(xx)) - -ax2 = ax.twin() # ax2 is responsible for "top" axis and "right" axis -ax2.set_xticks([0., .5*np.pi, np.pi, 1.5*np.pi, 2*np.pi]) -ax2.set_xticklabels(["$0$", r"$\frac{1}{2}\pi$", - r"$\pi$", r"$\frac{3}{2}\pi$", r"$2\pi$"]) - -ax2.axis["right"].major_ticklabels.set_visible(False) -ax2.axis["top"].major_ticklabels.set_visible(True) - -plt.draw() -plt.show() diff --git a/mpl_examples/color/color_cycle_default.pdf b/mpl_examples/color/color_cycle_default.pdf deleted file mode 100644 index af5572b13bb..00000000000 Binary files a/mpl_examples/color/color_cycle_default.pdf and /dev/null differ diff --git a/mpl_examples/color/color_cycle_default.png b/mpl_examples/color/color_cycle_default.png deleted file mode 100644 index e9621044adf..00000000000 Binary files a/mpl_examples/color/color_cycle_default.png and /dev/null differ diff --git a/mpl_examples/color/color_cycle_default.py b/mpl_examples/color/color_cycle_default.py deleted file mode 100644 index 29afdef912d..00000000000 --- a/mpl_examples/color/color_cycle_default.py +++ /dev/null @@ -1,40 +0,0 @@ -""" -==================================== -Colors in the default property cycle -==================================== - -Display the colors from the default prop_cycle. -""" -import numpy as np -import matplotlib.pyplot as plt - - -prop_cycle = plt.rcParams['axes.prop_cycle'] -colors = prop_cycle.by_key()['color'] - -lwbase = plt.rcParams['lines.linewidth'] -thin = float('%.1f' % (lwbase / 2)) -thick = lwbase * 3 - -fig, axs = plt.subplots(nrows=2, ncols=2, sharex=True, sharey=True) -for icol in range(2): - if icol == 0: - lwx, lwy = thin, lwbase - else: - lwx, lwy = lwbase, thick - for irow in range(2): - for i, color in enumerate(colors): - axs[irow, icol].axhline(i, color=color, lw=lwx) - axs[irow, icol].axvline(i, color=color, lw=lwy) - - axs[1, icol].set_facecolor('k') - axs[1, icol].xaxis.set_ticks(np.arange(0, 10, 2)) - axs[0, icol].set_title('line widths (pts): %.1f, %.1f' % (lwx, lwy), - fontsize='medium') - -for irow in range(2): - axs[irow, 0].yaxis.set_ticks(np.arange(0, 10, 2)) - -fig.suptitle('Colors in the default prop_cycle', fontsize='large') - -plt.show() diff --git a/mpl_examples/color/color_cycle_demo.hires.png b/mpl_examples/color/color_cycle_demo.hires.png deleted file mode 100644 index 3cbda028c80..00000000000 Binary files a/mpl_examples/color/color_cycle_demo.hires.png and /dev/null differ diff --git a/mpl_examples/color/color_cycle_demo.pdf b/mpl_examples/color/color_cycle_demo.pdf deleted file mode 100644 index df557a0d71f..00000000000 Binary files a/mpl_examples/color/color_cycle_demo.pdf and /dev/null differ diff --git a/mpl_examples/color/color_cycle_demo.png b/mpl_examples/color/color_cycle_demo.png deleted file mode 100644 index d8030cea036..00000000000 Binary files a/mpl_examples/color/color_cycle_demo.png and /dev/null differ diff --git a/mpl_examples/color/color_cycle_demo.py b/mpl_examples/color/color_cycle_demo.py deleted file mode 100644 index cec1b278c88..00000000000 --- a/mpl_examples/color/color_cycle_demo.py +++ /dev/null @@ -1,41 +0,0 @@ -""" -=================== -Styling with cycler -=================== - -Demo of custom property-cycle settings to control colors and other style -properties for multi-line plots. - -This example demonstrates two different APIs: - - 1. Setting the default rc parameter specifying the property cycle. - This affects all subsequent axes (but not axes already created). - 2. Setting the property cycle for a single pair of axes. -""" -from cycler import cycler -import numpy as np -import matplotlib.pyplot as plt - - -x = np.linspace(0, 2 * np.pi) -offsets = np.linspace(0, 2*np.pi, 4, endpoint=False) -# Create array with shifted-sine curve along each column -yy = np.transpose([np.sin(x + phi) for phi in offsets]) - -# 1. Setting prop cycle on default rc parameter -plt.rc('lines', linewidth=4) -plt.rc('axes', prop_cycle=(cycler('color', ['r', 'g', 'b', 'y']) + - cycler('linestyle', ['-', '--', ':', '-.']))) -fig, (ax0, ax1) = plt.subplots(nrows=2) -ax0.plot(yy) -ax0.set_title('Set default color cycle to rgby') - -# 2. Define prop cycle for single set of axes -ax1.set_prop_cycle(cycler('color', ['c', 'm', 'y', 'k']) + - cycler('lw', [1, 2, 3, 4])) -ax1.plot(yy) -ax1.set_title('Set axes color cycle to cmyk') - -# Tweak spacing between subplots to prevent labels from overlapping -fig.subplots_adjust(hspace=0.3) -plt.show() diff --git a/mpl_examples/color/colormaps_reference.py b/mpl_examples/color/colormaps_reference.py deleted file mode 100644 index 7f1add877d3..00000000000 --- a/mpl_examples/color/colormaps_reference.py +++ /dev/null @@ -1,93 +0,0 @@ -""" -================== -Colormap reference -================== - -Reference for colormaps included with Matplotlib. - -This reference example shows all colormaps included with Matplotlib. Note that -any colormap listed here can be reversed by appending "_r" (e.g., "pink_r"). -These colormaps are divided into the following categories: - -Sequential: - These colormaps are approximately monochromatic colormaps varying smoothly - between two color tones---usually from low saturation (e.g. white) to high - saturation (e.g. a bright blue). Sequential colormaps are ideal for - representing most scientific data since they show a clear progression from - low-to-high values. - -Diverging: - These colormaps have a median value (usually light in color) and vary - smoothly to two different color tones at high and low values. Diverging - colormaps are ideal when your data has a median value that is significant - (e.g. 0, such that positive and negative values are represented by - different colors of the colormap). - -Qualitative: - These colormaps vary rapidly in color. Qualitative colormaps are useful for - choosing a set of discrete colors. For example:: - - color_list = plt.cm.Set3(np.linspace(0, 1, 12)) - - gives a list of RGB colors that are good for plotting a series of lines on - a dark background. - -Miscellaneous: - Colormaps that don't fit into the categories above. - -""" -import numpy as np -import matplotlib.pyplot as plt - - -# Have colormaps separated into categories: -# http://matplotlib.org/examples/color/colormaps_reference.html -cmaps = [('Perceptually Uniform Sequential', [ - 'viridis', 'plasma', 'inferno', 'magma']), - ('Sequential', [ - 'Greys', 'Purples', 'Blues', 'Greens', 'Oranges', 'Reds', - 'YlOrBr', 'YlOrRd', 'OrRd', 'PuRd', 'RdPu', 'BuPu', - 'GnBu', 'PuBu', 'YlGnBu', 'PuBuGn', 'BuGn', 'YlGn']), - ('Sequential (2)', [ - 'binary', 'gist_yarg', 'gist_gray', 'gray', 'bone', 'pink', - 'spring', 'summer', 'autumn', 'winter', 'cool', 'Wistia', - 'hot', 'afmhot', 'gist_heat', 'copper']), - ('Diverging', [ - 'PiYG', 'PRGn', 'BrBG', 'PuOr', 'RdGy', 'RdBu', - 'RdYlBu', 'RdYlGn', 'Spectral', 'coolwarm', 'bwr', 'seismic']), - ('Qualitative', [ - 'Pastel1', 'Pastel2', 'Paired', 'Accent', - 'Dark2', 'Set1', 'Set2', 'Set3', - 'tab10', 'tab20', 'tab20b', 'tab20c']), - ('Miscellaneous', [ - 'flag', 'prism', 'ocean', 'gist_earth', 'terrain', 'gist_stern', - 'gnuplot', 'gnuplot2', 'CMRmap', 'cubehelix', 'brg', 'hsv', - 'gist_rainbow', 'rainbow', 'jet', 'nipy_spectral', 'gist_ncar'])] - - -nrows = max(len(cmap_list) for cmap_category, cmap_list in cmaps) -gradient = np.linspace(0, 1, 256) -gradient = np.vstack((gradient, gradient)) - - -def plot_color_gradients(cmap_category, cmap_list, nrows): - fig, axes = plt.subplots(nrows=nrows) - fig.subplots_adjust(top=0.95, bottom=0.01, left=0.2, right=0.99) - axes[0].set_title(cmap_category + ' colormaps', fontsize=14) - - for ax, name in zip(axes, cmap_list): - ax.imshow(gradient, aspect='auto', cmap=plt.get_cmap(name)) - pos = list(ax.get_position().bounds) - x_text = pos[0] - 0.01 - y_text = pos[1] + pos[3]/2. - fig.text(x_text, y_text, name, va='center', ha='right', fontsize=10) - - # Turn off *all* ticks & spines, not just the ones with colormaps. - for ax in axes: - ax.set_axis_off() - - -for cmap_category, cmap_list in cmaps: - plot_color_gradients(cmap_category, cmap_list, nrows) - -plt.show() diff --git a/mpl_examples/color/colormaps_reference_00.hires.png b/mpl_examples/color/colormaps_reference_00.hires.png deleted file mode 100644 index e321513f0f8..00000000000 Binary files a/mpl_examples/color/colormaps_reference_00.hires.png and /dev/null differ diff --git a/mpl_examples/color/colormaps_reference_00.pdf b/mpl_examples/color/colormaps_reference_00.pdf deleted file mode 100644 index a58680855bd..00000000000 Binary files a/mpl_examples/color/colormaps_reference_00.pdf and /dev/null differ diff --git a/mpl_examples/color/colormaps_reference_00.png b/mpl_examples/color/colormaps_reference_00.png deleted file mode 100644 index ef698994560..00000000000 Binary files a/mpl_examples/color/colormaps_reference_00.png and /dev/null differ diff --git a/mpl_examples/color/colormaps_reference_01.hires.png b/mpl_examples/color/colormaps_reference_01.hires.png deleted file mode 100644 index 10376d4f26e..00000000000 Binary files a/mpl_examples/color/colormaps_reference_01.hires.png and /dev/null differ diff --git a/mpl_examples/color/colormaps_reference_01.pdf b/mpl_examples/color/colormaps_reference_01.pdf deleted file mode 100644 index 41af3bc795a..00000000000 Binary files a/mpl_examples/color/colormaps_reference_01.pdf and /dev/null differ diff --git a/mpl_examples/color/colormaps_reference_01.png b/mpl_examples/color/colormaps_reference_01.png deleted file mode 100644 index d5fb54a34da..00000000000 Binary files a/mpl_examples/color/colormaps_reference_01.png and /dev/null differ diff --git a/mpl_examples/color/colormaps_reference_02.hires.png b/mpl_examples/color/colormaps_reference_02.hires.png deleted file mode 100644 index c2e7d59cab3..00000000000 Binary files a/mpl_examples/color/colormaps_reference_02.hires.png and /dev/null differ diff --git a/mpl_examples/color/colormaps_reference_02.pdf b/mpl_examples/color/colormaps_reference_02.pdf deleted file mode 100644 index 031ca41f429..00000000000 Binary files a/mpl_examples/color/colormaps_reference_02.pdf and /dev/null differ diff --git a/mpl_examples/color/colormaps_reference_02.png b/mpl_examples/color/colormaps_reference_02.png deleted file mode 100644 index 54e76b9b48b..00000000000 Binary files a/mpl_examples/color/colormaps_reference_02.png and /dev/null differ diff --git a/mpl_examples/color/colormaps_reference_03.hires.png b/mpl_examples/color/colormaps_reference_03.hires.png deleted file mode 100644 index 12e12c6f348..00000000000 Binary files a/mpl_examples/color/colormaps_reference_03.hires.png and /dev/null differ diff --git a/mpl_examples/color/colormaps_reference_03.pdf b/mpl_examples/color/colormaps_reference_03.pdf deleted file mode 100644 index 50403da1949..00000000000 Binary files a/mpl_examples/color/colormaps_reference_03.pdf and /dev/null differ diff --git a/mpl_examples/color/colormaps_reference_03.png b/mpl_examples/color/colormaps_reference_03.png deleted file mode 100644 index a7c6d1fd819..00000000000 Binary files a/mpl_examples/color/colormaps_reference_03.png and /dev/null differ diff --git a/mpl_examples/color/colormaps_reference_04.hires.png b/mpl_examples/color/colormaps_reference_04.hires.png deleted file mode 100644 index 0364c2b849c..00000000000 Binary files a/mpl_examples/color/colormaps_reference_04.hires.png and /dev/null differ diff --git a/mpl_examples/color/colormaps_reference_04.pdf b/mpl_examples/color/colormaps_reference_04.pdf deleted file mode 100644 index c6dbb6da232..00000000000 Binary files a/mpl_examples/color/colormaps_reference_04.pdf and /dev/null differ diff --git a/mpl_examples/color/colormaps_reference_04.png b/mpl_examples/color/colormaps_reference_04.png deleted file mode 100644 index 1b1b4b84f1e..00000000000 Binary files a/mpl_examples/color/colormaps_reference_04.png and /dev/null differ diff --git a/mpl_examples/color/colormaps_reference_05.hires.png b/mpl_examples/color/colormaps_reference_05.hires.png deleted file mode 100644 index 9c6d77b8a10..00000000000 Binary files a/mpl_examples/color/colormaps_reference_05.hires.png and /dev/null differ diff --git a/mpl_examples/color/colormaps_reference_05.pdf b/mpl_examples/color/colormaps_reference_05.pdf deleted file mode 100644 index 5df80b0d9a1..00000000000 Binary files a/mpl_examples/color/colormaps_reference_05.pdf and /dev/null differ diff --git a/mpl_examples/color/colormaps_reference_05.png b/mpl_examples/color/colormaps_reference_05.png deleted file mode 100644 index 8ca7eaf1484..00000000000 Binary files a/mpl_examples/color/colormaps_reference_05.png and /dev/null differ diff --git a/mpl_examples/color/named_colors.hires.png b/mpl_examples/color/named_colors.hires.png deleted file mode 100644 index 23b2b14a686..00000000000 Binary files a/mpl_examples/color/named_colors.hires.png and /dev/null differ diff --git a/mpl_examples/color/named_colors.pdf b/mpl_examples/color/named_colors.pdf deleted file mode 100644 index 1e6436b2b40..00000000000 Binary files a/mpl_examples/color/named_colors.pdf and /dev/null differ diff --git a/mpl_examples/color/named_colors.png b/mpl_examples/color/named_colors.png deleted file mode 100644 index 9dfe14a46df..00000000000 Binary files a/mpl_examples/color/named_colors.png and /dev/null differ diff --git a/mpl_examples/color/named_colors.py b/mpl_examples/color/named_colors.py deleted file mode 100644 index 5fcf95974d1..00000000000 --- a/mpl_examples/color/named_colors.py +++ /dev/null @@ -1,55 +0,0 @@ -""" -======================== -Visualizing named colors -======================== - -Simple plot example with the named colors and its visual representation. -""" -from __future__ import division - -import matplotlib.pyplot as plt -from matplotlib import colors as mcolors - - -colors = dict(mcolors.BASE_COLORS, **mcolors.CSS4_COLORS) - -# Sort colors by hue, saturation, value and name. -by_hsv = sorted((tuple(mcolors.rgb_to_hsv(mcolors.to_rgba(color)[:3])), name) - for name, color in colors.items()) -sorted_names = [name for hsv, name in by_hsv] - -n = len(sorted_names) -ncols = 4 -nrows = n // ncols + 1 - -fig, ax = plt.subplots(figsize=(8, 5)) - -# Get height and width -X, Y = fig.get_dpi() * fig.get_size_inches() -h = Y / (nrows + 1) -w = X / ncols - -for i, name in enumerate(sorted_names): - col = i % ncols - row = i // ncols - y = Y - (row * h) - h - - xi_line = w * (col + 0.05) - xf_line = w * (col + 0.25) - xi_text = w * (col + 0.3) - - ax.text(xi_text, y, name, fontsize=(h * 0.8), - horizontalalignment='left', - verticalalignment='center') - - ax.hlines(y + h * 0.1, xi_line, xf_line, - color=colors[name], linewidth=(h * 0.6)) - -ax.set_xlim(0, X) -ax.set_ylim(0, Y) -ax.set_axis_off() - -fig.subplots_adjust(left=0, right=1, - top=1, bottom=0, - hspace=0, wspace=0) -plt.show() diff --git a/mpl_examples/images_contours_and_fields/contourf_log.hires.png b/mpl_examples/images_contours_and_fields/contourf_log.hires.png deleted file mode 100644 index 359f3c6cde5..00000000000 Binary files a/mpl_examples/images_contours_and_fields/contourf_log.hires.png and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/contourf_log.pdf b/mpl_examples/images_contours_and_fields/contourf_log.pdf deleted file mode 100644 index cbfdc51e159..00000000000 Binary files a/mpl_examples/images_contours_and_fields/contourf_log.pdf and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/contourf_log.png b/mpl_examples/images_contours_and_fields/contourf_log.png deleted file mode 100644 index c7476b2ce09..00000000000 Binary files a/mpl_examples/images_contours_and_fields/contourf_log.png and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/contourf_log.py b/mpl_examples/images_contours_and_fields/contourf_log.py deleted file mode 100644 index 1cf354fb2e3..00000000000 --- a/mpl_examples/images_contours_and_fields/contourf_log.py +++ /dev/null @@ -1,47 +0,0 @@ -''' -Demonstrate use of a log color scale in contourf -''' - -import matplotlib.pyplot as plt -import numpy as np -from numpy import ma -from matplotlib import colors, ticker, cm -from matplotlib.mlab import bivariate_normal - -N = 100 -x = np.linspace(-3.0, 3.0, N) -y = np.linspace(-2.0, 2.0, N) - -X, Y = np.meshgrid(x, y) - -# A low hump with a spike coming out of the top right. -# Needs to have z/colour axis on a log scale so we see both hump and spike. -# linear scale only shows the spike. -z = (bivariate_normal(X, Y, 0.1, 0.2, 1.0, 1.0) - + 0.1 * bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)) - -# Put in some negative values (lower left corner) to cause trouble with logs: -z[:5, :5] = -1 - -# The following is not strictly essential, but it will eliminate -# a warning. Comment it out to see the warning. -z = ma.masked_where(z <= 0, z) - - -# Automatic selection of levels works; setting the -# log locator tells contourf to use a log scale: -fig, ax = plt.subplots() -cs = ax.contourf(X, Y, z, locator=ticker.LogLocator(), cmap=cm.PuBu_r) - -# Alternatively, you can manually set the levels -# and the norm: -#lev_exp = np.arange(np.floor(np.log10(z.min())-1), -# np.ceil(np.log10(z.max())+1)) -#levs = np.power(10, lev_exp) -#cs = P.contourf(X, Y, z, levs, norm=colors.LogNorm()) - -# The 'extend' kwarg does not work yet with a log scale. - -cbar = fig.colorbar(cs) - -plt.show() diff --git a/mpl_examples/images_contours_and_fields/image_demo.hires.png b/mpl_examples/images_contours_and_fields/image_demo.hires.png deleted file mode 100644 index 5e9a609161e..00000000000 Binary files a/mpl_examples/images_contours_and_fields/image_demo.hires.png and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/image_demo.pdf b/mpl_examples/images_contours_and_fields/image_demo.pdf deleted file mode 100644 index 9dfef706dfd..00000000000 Binary files a/mpl_examples/images_contours_and_fields/image_demo.pdf and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/image_demo.png b/mpl_examples/images_contours_and_fields/image_demo.png deleted file mode 100644 index 6453ed018b3..00000000000 Binary files a/mpl_examples/images_contours_and_fields/image_demo.png and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/image_demo.py b/mpl_examples/images_contours_and_fields/image_demo.py deleted file mode 100644 index a4d709b2ebc..00000000000 --- a/mpl_examples/images_contours_and_fields/image_demo.py +++ /dev/null @@ -1,13 +0,0 @@ -""" -Simple demo of the imshow function. -""" -import matplotlib.pyplot as plt -import matplotlib.cbook as cbook - -image_file = cbook.get_sample_data('ada.png') -image = plt.imread(image_file) - -fig, ax = plt.subplots() -ax.imshow(image) -ax.axis('off') # clear x- and y-axes -plt.show() diff --git a/mpl_examples/images_contours_and_fields/image_demo_clip_path.hires.png b/mpl_examples/images_contours_and_fields/image_demo_clip_path.hires.png deleted file mode 100644 index 77e6b472d29..00000000000 Binary files a/mpl_examples/images_contours_and_fields/image_demo_clip_path.hires.png and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/image_demo_clip_path.pdf b/mpl_examples/images_contours_and_fields/image_demo_clip_path.pdf deleted file mode 100644 index d98706380a6..00000000000 Binary files a/mpl_examples/images_contours_and_fields/image_demo_clip_path.pdf and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/image_demo_clip_path.png b/mpl_examples/images_contours_and_fields/image_demo_clip_path.png deleted file mode 100644 index b0f2311f0f5..00000000000 Binary files a/mpl_examples/images_contours_and_fields/image_demo_clip_path.png and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/image_demo_clip_path.py b/mpl_examples/images_contours_and_fields/image_demo_clip_path.py deleted file mode 100644 index de1d9599c83..00000000000 --- a/mpl_examples/images_contours_and_fields/image_demo_clip_path.py +++ /dev/null @@ -1,18 +0,0 @@ -""" -Demo of image that's been clipped by a circular patch. -""" -import matplotlib.pyplot as plt -import matplotlib.patches as patches -import matplotlib.cbook as cbook - - -image_file = cbook.get_sample_data('grace_hopper.png') -image = plt.imread(image_file) - -fig, ax = plt.subplots() -im = ax.imshow(image) -patch = patches.Circle((260, 200), radius=200, transform=ax.transData) -im.set_clip_path(patch) - -ax.axis('off') -plt.show() diff --git a/mpl_examples/images_contours_and_fields/interpolation_methods.hires.png b/mpl_examples/images_contours_and_fields/interpolation_methods.hires.png deleted file mode 100644 index de21b19a50b..00000000000 Binary files a/mpl_examples/images_contours_and_fields/interpolation_methods.hires.png and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/interpolation_methods.pdf b/mpl_examples/images_contours_and_fields/interpolation_methods.pdf deleted file mode 100644 index 3f9d03e120a..00000000000 Binary files a/mpl_examples/images_contours_and_fields/interpolation_methods.pdf and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/interpolation_methods.png b/mpl_examples/images_contours_and_fields/interpolation_methods.png deleted file mode 100644 index 738eb298b26..00000000000 Binary files a/mpl_examples/images_contours_and_fields/interpolation_methods.png and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/interpolation_methods.py b/mpl_examples/images_contours_and_fields/interpolation_methods.py deleted file mode 100644 index 4977368b49a..00000000000 --- a/mpl_examples/images_contours_and_fields/interpolation_methods.py +++ /dev/null @@ -1,33 +0,0 @@ -''' -Show all different interpolation methods for imshow -''' - -import matplotlib.pyplot as plt -import numpy as np - -# from the docs: - -# If interpolation is None, default to rc image.interpolation. See also -# the filternorm and filterrad parameters. If interpolation is 'none', then -# no interpolation is performed on the Agg, ps and pdf backends. Other -# backends will fall back to 'nearest'. -# -# http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.imshow - -methods = [None, 'none', 'nearest', 'bilinear', 'bicubic', 'spline16', - 'spline36', 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric', - 'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc', 'lanczos'] - -np.random.seed(0) -grid = np.random.rand(4, 4) - -fig, axes = plt.subplots(3, 6, figsize=(12, 6), - subplot_kw={'xticks': [], 'yticks': []}) - -fig.subplots_adjust(hspace=0.3, wspace=0.05) - -for ax, interp_method in zip(axes.flat, methods): - ax.imshow(grid, interpolation=interp_method, cmap='viridis') - ax.set_title(interp_method) - -plt.show() diff --git a/mpl_examples/images_contours_and_fields/interpolation_none_vs_nearest.py b/mpl_examples/images_contours_and_fields/interpolation_none_vs_nearest.py deleted file mode 100644 index 487b4017471..00000000000 --- a/mpl_examples/images_contours_and_fields/interpolation_none_vs_nearest.py +++ /dev/null @@ -1,62 +0,0 @@ -""" -Displays the difference between interpolation = 'none' and -interpolation = 'nearest'. - -Interpolation = 'none' and interpolation = 'nearest' are equivalent when -converting a figure to an image file, such as a PNG. -Interpolation = 'none' and interpolation = 'nearest' behave quite -differently, however, when converting a figure to a vector graphics file, -such as a PDF. As shown, Interpolation = 'none' works well when a big -image is scaled down, while interpolation = 'nearest' works well when a -small image is blown up. -""" - -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.cbook as cbook - -# Load big image -big_im_path = cbook.get_sample_data('necked_tensile_specimen.png') -big_im = plt.imread(big_im_path) -# Define small image -small_im = np.array([[0.25, 0.75, 1.0, 0.75], [0.1, 0.65, 0.5, 0.4], - [0.6, 0.3, 0.0, 0.2], [0.7, 0.9, 0.4, 0.6]]) - -# Create a 2x2 table of plots -fig, axes = plt.subplots(figsize=[8.0, 7.5], ncols=2, nrows=2) - -axes[0, 0].imshow(big_im, interpolation='none') -axes[0, 1].imshow(big_im, interpolation='nearest') -axes[1, 0].imshow(small_im, interpolation='none') -axes[1, 1].imshow(small_im, interpolation='nearest') -fig.subplots_adjust(left=0.24, wspace=0.2, hspace=0.1, - bottom=0.05, top=0.86) - -# Label the rows and columns of the table -fig.text(0.03, 0.645, 'Big Image\nScaled Down', ha='left') -fig.text(0.03, 0.225, 'Small Image\nBlown Up', ha='left') -fig.text(0.383, 0.90, "Interpolation = 'none'", ha='center') -fig.text(0.75, 0.90, "Interpolation = 'nearest'", ha='center') - -# If you were going to run this example on your local machine, you -# would save the figure as a PNG, save the same figure as a PDF, and -# then compare them. The following code would suffice. -txt = fig.text(0.452, 0.95, 'Saved as a PNG', fontsize=18) -# plt.savefig('None_vs_nearest-png.png') -# txt.set_text('Saved as a PDF') -# plt.savefig('None_vs_nearest-pdf.pdf') - -# Here, however, we need to display the PDF on a webpage, which means -# the PDF must be converted into an image. For the purposes of this -# example, the 'Nearest_vs_none-pdf.pdf' has been pre-converted into -#'Nearest_vs_none-pdf.png' at 80 dpi. We simply need to load and -# display it. -# The conversion is done with: -# gs -dNOPAUSE -dBATCH -dDOINTERPOLATE -sDEVICE=pngalpha \ -# -sOutputFile=None_vs_nearest-pdf.png -r80 None_vs_nearest-pdf.pdf -pdf_im_path = cbook.get_sample_data('None_vs_nearest-pdf.png') -pdf_im = plt.imread(pdf_im_path) -fig2 = plt.figure(figsize=[8.0, 7.5]) -fig2.figimage(pdf_im) - -plt.show() diff --git a/mpl_examples/images_contours_and_fields/interpolation_none_vs_nearest_00.hires.png b/mpl_examples/images_contours_and_fields/interpolation_none_vs_nearest_00.hires.png deleted file mode 100644 index 0be2cb4c7de..00000000000 Binary files a/mpl_examples/images_contours_and_fields/interpolation_none_vs_nearest_00.hires.png and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/interpolation_none_vs_nearest_00.pdf b/mpl_examples/images_contours_and_fields/interpolation_none_vs_nearest_00.pdf deleted file mode 100644 index 91f8c09ceb3..00000000000 Binary files a/mpl_examples/images_contours_and_fields/interpolation_none_vs_nearest_00.pdf and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/interpolation_none_vs_nearest_00.png b/mpl_examples/images_contours_and_fields/interpolation_none_vs_nearest_00.png deleted file mode 100644 index 9650606763a..00000000000 Binary files a/mpl_examples/images_contours_and_fields/interpolation_none_vs_nearest_00.png and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/interpolation_none_vs_nearest_01.hires.png b/mpl_examples/images_contours_and_fields/interpolation_none_vs_nearest_01.hires.png deleted file mode 100644 index fcd96f79e7a..00000000000 Binary files a/mpl_examples/images_contours_and_fields/interpolation_none_vs_nearest_01.hires.png and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/interpolation_none_vs_nearest_01.pdf b/mpl_examples/images_contours_and_fields/interpolation_none_vs_nearest_01.pdf deleted file mode 100644 index 4d5983077ef..00000000000 Binary files a/mpl_examples/images_contours_and_fields/interpolation_none_vs_nearest_01.pdf and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/interpolation_none_vs_nearest_01.png b/mpl_examples/images_contours_and_fields/interpolation_none_vs_nearest_01.png deleted file mode 100644 index 63af28061d3..00000000000 Binary files a/mpl_examples/images_contours_and_fields/interpolation_none_vs_nearest_01.png and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/pcolormesh_levels.hires.png b/mpl_examples/images_contours_and_fields/pcolormesh_levels.hires.png deleted file mode 100644 index c7f7960678a..00000000000 Binary files a/mpl_examples/images_contours_and_fields/pcolormesh_levels.hires.png and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/pcolormesh_levels.pdf b/mpl_examples/images_contours_and_fields/pcolormesh_levels.pdf deleted file mode 100644 index 1b0411952d2..00000000000 Binary files a/mpl_examples/images_contours_and_fields/pcolormesh_levels.pdf and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/pcolormesh_levels.png b/mpl_examples/images_contours_and_fields/pcolormesh_levels.png deleted file mode 100644 index c93428e05f8..00000000000 Binary files a/mpl_examples/images_contours_and_fields/pcolormesh_levels.png and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/pcolormesh_levels.py b/mpl_examples/images_contours_and_fields/pcolormesh_levels.py deleted file mode 100644 index 8e501557639..00000000000 --- a/mpl_examples/images_contours_and_fields/pcolormesh_levels.py +++ /dev/null @@ -1,53 +0,0 @@ -""" -Shows how to combine Normalization and Colormap instances to draw -"levels" in pcolor, pcolormesh and imshow type plots in a similar -way to the levels keyword argument to contour/contourf. - -""" - -import matplotlib.pyplot as plt -from matplotlib.colors import BoundaryNorm -from matplotlib.ticker import MaxNLocator -import numpy as np - - -# make these smaller to increase the resolution -dx, dy = 0.05, 0.05 - -# generate 2 2d grids for the x & y bounds -y, x = np.mgrid[slice(1, 5 + dy, dy), - slice(1, 5 + dx, dx)] - -z = np.sin(x)**10 + np.cos(10 + y*x) * np.cos(x) - -# x and y are bounds, so z should be the value *inside* those bounds. -# Therefore, remove the last value from the z array. -z = z[:-1, :-1] -levels = MaxNLocator(nbins=15).tick_values(z.min(), z.max()) - - -# pick the desired colormap, sensible levels, and define a normalization -# instance which takes data values and translates those into levels. -cmap = plt.get_cmap('PiYG') -norm = BoundaryNorm(levels, ncolors=cmap.N, clip=True) - -fig, (ax0, ax1) = plt.subplots(nrows=2) - -im = ax0.pcolormesh(x, y, z, cmap=cmap, norm=norm) -fig.colorbar(im, ax=ax0) -ax0.set_title('pcolormesh with levels') - - -# contours are *point* based plots, so convert our bound into point -# centers -cf = ax1.contourf(x[:-1, :-1] + dx/2., - y[:-1, :-1] + dy/2., z, levels=levels, - cmap=cmap) -fig.colorbar(cf, ax=ax1) -ax1.set_title('contourf with levels') - -# adjust spacing between subplots so `ax1` title and `ax0` tick labels -# don't overlap -fig.tight_layout() - -plt.show() diff --git a/mpl_examples/images_contours_and_fields/streamplot_demo_features.py b/mpl_examples/images_contours_and_fields/streamplot_demo_features.py deleted file mode 100644 index 5c48527fa23..00000000000 --- a/mpl_examples/images_contours_and_fields/streamplot_demo_features.py +++ /dev/null @@ -1,29 +0,0 @@ -""" -Demo of the `streamplot` function. - -A streamplot, or streamline plot, is used to display 2D vector fields. This -example shows a few features of the stream plot function: - - * Varying the color along a streamline. - * Varying the density of streamlines. - * Varying the line width along a stream line. -""" -import numpy as np -import matplotlib.pyplot as plt - -Y, X = np.mgrid[-3:3:100j, -3:3:100j] -U = -1 - X**2 + Y -V = 1 + X - Y**2 -speed = np.sqrt(U*U + V*V) - -fig0, ax0 = plt.subplots() -strm = ax0.streamplot(X, Y, U, V, color=U, linewidth=2, cmap=plt.cm.autumn) -fig0.colorbar(strm.lines) - -fig1, (ax1, ax2) = plt.subplots(ncols=2) -ax1.streamplot(X, Y, U, V, density=[0.5, 1]) - -lw = 5*speed / speed.max() -ax2.streamplot(X, Y, U, V, density=0.6, color='k', linewidth=lw) - -plt.show() diff --git a/mpl_examples/images_contours_and_fields/streamplot_demo_features_00.hires.png b/mpl_examples/images_contours_and_fields/streamplot_demo_features_00.hires.png deleted file mode 100644 index 0c089a98bfa..00000000000 Binary files a/mpl_examples/images_contours_and_fields/streamplot_demo_features_00.hires.png and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/streamplot_demo_features_00.pdf b/mpl_examples/images_contours_and_fields/streamplot_demo_features_00.pdf deleted file mode 100644 index 7574a959abc..00000000000 Binary files a/mpl_examples/images_contours_and_fields/streamplot_demo_features_00.pdf and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/streamplot_demo_features_00.png b/mpl_examples/images_contours_and_fields/streamplot_demo_features_00.png deleted file mode 100644 index 8e6b5360e3d..00000000000 Binary files a/mpl_examples/images_contours_and_fields/streamplot_demo_features_00.png and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/streamplot_demo_features_01.hires.png b/mpl_examples/images_contours_and_fields/streamplot_demo_features_01.hires.png deleted file mode 100644 index 41c3c68eb3f..00000000000 Binary files a/mpl_examples/images_contours_and_fields/streamplot_demo_features_01.hires.png and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/streamplot_demo_features_01.pdf b/mpl_examples/images_contours_and_fields/streamplot_demo_features_01.pdf deleted file mode 100644 index a0448408e7e..00000000000 Binary files a/mpl_examples/images_contours_and_fields/streamplot_demo_features_01.pdf and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/streamplot_demo_features_01.png b/mpl_examples/images_contours_and_fields/streamplot_demo_features_01.png deleted file mode 100644 index d502def9640..00000000000 Binary files a/mpl_examples/images_contours_and_fields/streamplot_demo_features_01.png and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/streamplot_demo_masking.hires.png b/mpl_examples/images_contours_and_fields/streamplot_demo_masking.hires.png deleted file mode 100644 index 21cd33e3af6..00000000000 Binary files a/mpl_examples/images_contours_and_fields/streamplot_demo_masking.hires.png and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/streamplot_demo_masking.pdf b/mpl_examples/images_contours_and_fields/streamplot_demo_masking.pdf deleted file mode 100644 index ce61f6d5ac6..00000000000 Binary files a/mpl_examples/images_contours_and_fields/streamplot_demo_masking.pdf and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/streamplot_demo_masking.png b/mpl_examples/images_contours_and_fields/streamplot_demo_masking.png deleted file mode 100644 index 76d5f3e8ef8..00000000000 Binary files a/mpl_examples/images_contours_and_fields/streamplot_demo_masking.png and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/streamplot_demo_masking.py b/mpl_examples/images_contours_and_fields/streamplot_demo_masking.py deleted file mode 100644 index 4188622989d..00000000000 --- a/mpl_examples/images_contours_and_fields/streamplot_demo_masking.py +++ /dev/null @@ -1,27 +0,0 @@ -""" -Demo of the streamplot function with masking. - -This example shows how streamlines created by the streamplot function skips -masked regions and NaN values. -""" -import numpy as np -import matplotlib.pyplot as plt - -w = 3 -Y, X = np.mgrid[-w:w:100j, -w:w:100j] -U = -1 - X**2 + Y -V = 1 + X - Y**2 -speed = np.sqrt(U*U + V*V) - -mask = np.zeros(U.shape, dtype=bool) -mask[40:60, 40:60] = True -U[:20, :20] = np.nan -U = np.ma.array(U, mask=mask) - -fig, ax = plt.subplots() -ax.streamplot(X, Y, U, V, color='r') - -ax.imshow(~mask, extent=(-w, w, -w, w), alpha=0.5, - interpolation='nearest', cmap=plt.cm.gray) - -plt.show() diff --git a/mpl_examples/images_contours_and_fields/streamplot_demo_start_points.hires.png b/mpl_examples/images_contours_and_fields/streamplot_demo_start_points.hires.png deleted file mode 100644 index f2ecc5e7973..00000000000 Binary files a/mpl_examples/images_contours_and_fields/streamplot_demo_start_points.hires.png and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/streamplot_demo_start_points.pdf b/mpl_examples/images_contours_and_fields/streamplot_demo_start_points.pdf deleted file mode 100644 index 8153fcf144b..00000000000 Binary files a/mpl_examples/images_contours_and_fields/streamplot_demo_start_points.pdf and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/streamplot_demo_start_points.png b/mpl_examples/images_contours_and_fields/streamplot_demo_start_points.png deleted file mode 100644 index e413502a76e..00000000000 Binary files a/mpl_examples/images_contours_and_fields/streamplot_demo_start_points.png and /dev/null differ diff --git a/mpl_examples/images_contours_and_fields/streamplot_demo_start_points.py b/mpl_examples/images_contours_and_fields/streamplot_demo_start_points.py deleted file mode 100644 index b41def0eb83..00000000000 --- a/mpl_examples/images_contours_and_fields/streamplot_demo_start_points.py +++ /dev/null @@ -1,30 +0,0 @@ -""" -Demo of the `streamplot` function. - -A streamplot, or streamline plot, is used to display 2D vector fields. This -example shows a few features of the stream plot function: - - * Varying the color along a streamline. - * Varying the density of streamlines. - * Varying the line width along a stream line. -""" -import numpy as np -import matplotlib.pyplot as plt - -X, Y = (np.linspace(-3, 3, 100), - np.linspace(-3, 3, 100)) - -U, V = np.mgrid[-3:3:100j, 0:0:100j] - -seed_points = np.array([[-2, 0, 1], [-2, 0, 1]]) - -fig0, ax0 = plt.subplots() -strm = ax0.streamplot(X, Y, U, V, color=U, linewidth=2, - cmap=plt.cm.autumn, start_points=seed_points.T) -fig0.colorbar(strm.lines) - -ax0.plot(seed_points[0], seed_points[1], 'bo') - -ax0.axis((-3, 3, -3, 3)) - -plt.show() diff --git a/mpl_examples/lines_bars_and_markers/barh_demo.pdf b/mpl_examples/lines_bars_and_markers/barh_demo.pdf deleted file mode 100644 index 0f0c381f63f..00000000000 Binary files a/mpl_examples/lines_bars_and_markers/barh_demo.pdf and /dev/null differ diff --git a/mpl_examples/lines_bars_and_markers/barh_demo.png b/mpl_examples/lines_bars_and_markers/barh_demo.png deleted file mode 100644 index 9a1bfdee746..00000000000 Binary files a/mpl_examples/lines_bars_and_markers/barh_demo.png and /dev/null differ diff --git a/mpl_examples/lines_bars_and_markers/barh_demo.py b/mpl_examples/lines_bars_and_markers/barh_demo.py deleted file mode 100644 index 29fe376a563..00000000000 --- a/mpl_examples/lines_bars_and_markers/barh_demo.py +++ /dev/null @@ -1,31 +0,0 @@ -""" -==================== -Horizontal bar chart -==================== - -This example showcases a simple horizontal bar chart. -""" -import matplotlib.pyplot as plt -plt.rcdefaults() -import numpy as np -import matplotlib.pyplot as plt - - -plt.rcdefaults() -fig, ax = plt.subplots() - -# Example data -people = ('Tom', 'Dick', 'Harry', 'Slim', 'Jim') -y_pos = np.arange(len(people)) -performance = 3 + 10 * np.random.rand(len(people)) -error = np.random.rand(len(people)) - -ax.barh(y_pos, performance, xerr=error, align='center', - color='green', ecolor='black') -ax.set_yticks(y_pos) -ax.set_yticklabels(people) -ax.invert_yaxis() # labels read top-to-bottom -ax.set_xlabel('Performance') -ax.set_title('How fast do you want to go today?') - -plt.show() diff --git a/mpl_examples/lines_bars_and_markers/fill_demo.pdf b/mpl_examples/lines_bars_and_markers/fill_demo.pdf deleted file mode 100644 index da775563f3c..00000000000 Binary files a/mpl_examples/lines_bars_and_markers/fill_demo.pdf and /dev/null differ diff --git a/mpl_examples/lines_bars_and_markers/fill_demo.png b/mpl_examples/lines_bars_and_markers/fill_demo.png deleted file mode 100644 index b0a2e97f9c5..00000000000 Binary files a/mpl_examples/lines_bars_and_markers/fill_demo.png and /dev/null differ diff --git a/mpl_examples/lines_bars_and_markers/fill_demo.py b/mpl_examples/lines_bars_and_markers/fill_demo.py deleted file mode 100644 index daecb7923d4..00000000000 --- a/mpl_examples/lines_bars_and_markers/fill_demo.py +++ /dev/null @@ -1,18 +0,0 @@ -""" -================== -A simple Fill plot -================== - -This example showcases the most basic fill plot a user can do with matplotlib. -""" -import numpy as np -import matplotlib.pyplot as plt - -x = np.linspace(0, 1, 500) -y = np.sin(4 * np.pi * x) * np.exp(-5 * x) - -fig, ax = plt.subplots() - -ax.fill(x, y, zorder=10) -ax.grid(True, zorder=5) -plt.show() diff --git a/mpl_examples/lines_bars_and_markers/fill_demo_features.pdf b/mpl_examples/lines_bars_and_markers/fill_demo_features.pdf deleted file mode 100644 index aa93c49efa0..00000000000 Binary files a/mpl_examples/lines_bars_and_markers/fill_demo_features.pdf and /dev/null differ diff --git a/mpl_examples/lines_bars_and_markers/fill_demo_features.png b/mpl_examples/lines_bars_and_markers/fill_demo_features.png deleted file mode 100644 index d0f444e5b3f..00000000000 Binary files a/mpl_examples/lines_bars_and_markers/fill_demo_features.png and /dev/null differ diff --git a/mpl_examples/lines_bars_and_markers/fill_demo_features.py b/mpl_examples/lines_bars_and_markers/fill_demo_features.py deleted file mode 100644 index efff86d2b78..00000000000 --- a/mpl_examples/lines_bars_and_markers/fill_demo_features.py +++ /dev/null @@ -1,21 +0,0 @@ -""" -======================== -A more complex fill demo -======================== - -In addition to the basic fill plot, this demo shows a few optional features: - - * Multiple curves with a single command. - * Setting the fill color. - * Setting the opacity (alpha value). -""" -import numpy as np -import matplotlib.pyplot as plt - -x = np.linspace(0, 2 * np.pi, 500) -y1 = np.sin(x) -y2 = np.sin(3 * x) - -fig, ax = plt.subplots() -ax.fill(x, y1, 'b', x, y2, 'r', alpha=0.3) -plt.show() diff --git a/mpl_examples/lines_bars_and_markers/line_demo_dash_control.pdf b/mpl_examples/lines_bars_and_markers/line_demo_dash_control.pdf deleted file mode 100644 index 1ce380c58aa..00000000000 Binary files a/mpl_examples/lines_bars_and_markers/line_demo_dash_control.pdf and /dev/null differ diff --git a/mpl_examples/lines_bars_and_markers/line_demo_dash_control.png b/mpl_examples/lines_bars_and_markers/line_demo_dash_control.png deleted file mode 100644 index 7023ed6c667..00000000000 Binary files a/mpl_examples/lines_bars_and_markers/line_demo_dash_control.png and /dev/null differ diff --git a/mpl_examples/lines_bars_and_markers/line_demo_dash_control.py b/mpl_examples/lines_bars_and_markers/line_demo_dash_control.py deleted file mode 100644 index d359a0590f3..00000000000 --- a/mpl_examples/lines_bars_and_markers/line_demo_dash_control.py +++ /dev/null @@ -1,25 +0,0 @@ -""" -======================================= -A simple plot with a custom dashed line -======================================= - -A Line object's ``set_dashes`` method allows you to specify dashes with -a series of on/off lengths (in points). -""" -import numpy as np -import matplotlib.pyplot as plt - - -x = np.linspace(0, 10, 500) -dashes = [10, 5, 100, 5] # 10 points on, 5 off, 100 on, 5 off - -fig, ax = plt.subplots() -line1, = ax.plot(x, np.sin(x), '--', linewidth=2, - label='Dashes set retroactively') -line1.set_dashes(dashes) - -line2, = ax.plot(x, -1 * np.sin(x), dashes=[30, 5, 10, 5], - label='Dashes set proactively') - -ax.legend(loc='lower right') -plt.show() diff --git a/mpl_examples/lines_bars_and_markers/line_styles_reference.pdf b/mpl_examples/lines_bars_and_markers/line_styles_reference.pdf deleted file mode 100644 index 6913c8149a2..00000000000 Binary files a/mpl_examples/lines_bars_and_markers/line_styles_reference.pdf and /dev/null differ diff --git a/mpl_examples/lines_bars_and_markers/line_styles_reference.png b/mpl_examples/lines_bars_and_markers/line_styles_reference.png deleted file mode 100644 index e116eeb2f37..00000000000 Binary files a/mpl_examples/lines_bars_and_markers/line_styles_reference.png and /dev/null differ diff --git a/mpl_examples/lines_bars_and_markers/line_styles_reference.py b/mpl_examples/lines_bars_and_markers/line_styles_reference.py deleted file mode 100644 index dee94948947..00000000000 --- a/mpl_examples/lines_bars_and_markers/line_styles_reference.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -==================== -Line-style reference -==================== - -Reference for line-styles included with Matplotlib. -""" -import numpy as np -import matplotlib.pyplot as plt - - -color = 'cornflowerblue' -points = np.ones(5) # Draw 5 points for each line -text_style = dict(horizontalalignment='right', verticalalignment='center', - fontsize=12, fontdict={'family': 'monospace'}) - - -def format_axes(ax): - ax.margins(0.2) - ax.set_axis_off() - - -def nice_repr(text): - return repr(text).lstrip('u') - - -# Plot all line styles. -fig, ax = plt.subplots() - -linestyles = ['-', '--', '-.', ':'] -for y, linestyle in enumerate(linestyles): - ax.text(-0.1, y, nice_repr(linestyle), **text_style) - ax.plot(y * points, linestyle=linestyle, color=color, linewidth=3) - format_axes(ax) - ax.set_title('line styles') - -plt.show() diff --git a/mpl_examples/lines_bars_and_markers/linestyles.pdf b/mpl_examples/lines_bars_and_markers/linestyles.pdf deleted file mode 100644 index 3efa4315114..00000000000 Binary files a/mpl_examples/lines_bars_and_markers/linestyles.pdf and /dev/null differ diff --git a/mpl_examples/lines_bars_and_markers/linestyles.png b/mpl_examples/lines_bars_and_markers/linestyles.png deleted file mode 100644 index 6d041adf4a3..00000000000 Binary files a/mpl_examples/lines_bars_and_markers/linestyles.png and /dev/null differ diff --git a/mpl_examples/lines_bars_and_markers/linestyles.py b/mpl_examples/lines_bars_and_markers/linestyles.py deleted file mode 100644 index e62ceab6f7c..00000000000 --- a/mpl_examples/lines_bars_and_markers/linestyles.py +++ /dev/null @@ -1,52 +0,0 @@ -""" -========== -Linestyles -========== - -This examples showcases different linestyles copying those of Tikz/PGF. -""" -import numpy as np -import matplotlib.pyplot as plt -from collections import OrderedDict -from matplotlib.transforms import blended_transform_factory - -linestyles = OrderedDict( - [('solid', (0, ())), - ('loosely dotted', (0, (1, 10))), - ('dotted', (0, (1, 5))), - ('densely dotted', (0, (1, 1))), - - ('loosely dashed', (0, (5, 10))), - ('dashed', (0, (5, 5))), - ('densely dashed', (0, (5, 1))), - - ('loosely dashdotted', (0, (3, 10, 1, 10))), - ('dashdotted', (0, (3, 5, 1, 5))), - ('densely dashdotted', (0, (3, 1, 1, 1))), - - ('loosely dashdotdotted', (0, (3, 10, 1, 10, 1, 10))), - ('dashdotdotted', (0, (3, 5, 1, 5, 1, 5))), - ('densely dashdotdotted', (0, (3, 1, 1, 1, 1, 1)))]) - - -plt.figure(figsize=(10, 6)) -ax = plt.subplot(1, 1, 1) - -X, Y = np.linspace(0, 100, 10), np.zeros(10) -for i, (name, linestyle) in enumerate(linestyles.items()): - ax.plot(X, Y+i, linestyle=linestyle, linewidth=1.5, color='black') - -ax.set_ylim(-0.5, len(linestyles)-0.5) -plt.yticks(np.arange(len(linestyles)), linestyles.keys()) -plt.xticks([]) - -# For each line style, add a text annotation with a small offset from -# the reference point (0 in Axes coords, y tick value in Data coords). -reference_transform = blended_transform_factory(ax.transAxes, ax.transData) -for i, (name, linestyle) in enumerate(linestyles.items()): - ax.annotate(str(linestyle), xy=(0.0, i), xycoords=reference_transform, - xytext=(-6, -12), textcoords='offset points', color="blue", - fontsize=8, ha="right", family="monospace") - -plt.tight_layout() -plt.show() diff --git a/mpl_examples/lines_bars_and_markers/marker_fillstyle_reference.pdf b/mpl_examples/lines_bars_and_markers/marker_fillstyle_reference.pdf deleted file mode 100644 index e400829b1b0..00000000000 Binary files a/mpl_examples/lines_bars_and_markers/marker_fillstyle_reference.pdf and /dev/null differ diff --git a/mpl_examples/lines_bars_and_markers/marker_fillstyle_reference.png b/mpl_examples/lines_bars_and_markers/marker_fillstyle_reference.png deleted file mode 100644 index 9f6a0993f9f..00000000000 Binary files a/mpl_examples/lines_bars_and_markers/marker_fillstyle_reference.png and /dev/null differ diff --git a/mpl_examples/lines_bars_and_markers/marker_fillstyle_reference.py b/mpl_examples/lines_bars_and_markers/marker_fillstyle_reference.py deleted file mode 100644 index 4960b8cd912..00000000000 --- a/mpl_examples/lines_bars_and_markers/marker_fillstyle_reference.py +++ /dev/null @@ -1,38 +0,0 @@ -""" -===================== -Marker filling-styles -===================== - -Reference for marker fill-styles included with Matplotlib. -""" -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.lines import Line2D - - -points = np.ones(5) # Draw 3 points for each line -text_style = dict(horizontalalignment='right', verticalalignment='center', - fontsize=12, fontdict={'family': 'monospace'}) -marker_style = dict(color='cornflowerblue', linestyle=':', marker='o', - markersize=15, markerfacecoloralt='gray') - - -def format_axes(ax): - ax.margins(0.2) - ax.set_axis_off() - - -def nice_repr(text): - return repr(text).lstrip('u') - - -fig, ax = plt.subplots() - -# Plot all fill styles. -for y, fill_style in enumerate(Line2D.fillStyles): - ax.text(-0.5, y, nice_repr(fill_style), **text_style) - ax.plot(y * points, fillstyle=fill_style, **marker_style) - format_axes(ax) - ax.set_title('fill style') - -plt.show() diff --git a/mpl_examples/lines_bars_and_markers/marker_reference.py b/mpl_examples/lines_bars_and_markers/marker_reference.py deleted file mode 100644 index 7927bbe612a..00000000000 --- a/mpl_examples/lines_bars_and_markers/marker_reference.py +++ /dev/null @@ -1,67 +0,0 @@ -""" -================================ -Filled and unfilled-marker types -================================ - -Reference for filled- and unfilled-marker types included with Matplotlib. -""" -from six import iteritems -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.lines import Line2D - - -points = np.ones(3) # Draw 3 points for each line -text_style = dict(horizontalalignment='right', verticalalignment='center', - fontsize=12, fontdict={'family': 'monospace'}) -marker_style = dict(linestyle=':', color='cornflowerblue', markersize=10) - - -def format_axes(ax): - ax.margins(0.2) - ax.set_axis_off() - - -def nice_repr(text): - return repr(text).lstrip('u') - - -def split_list(a_list): - i_half = len(a_list) // 2 - return (a_list[:i_half], a_list[i_half:]) - - -# Plot all un-filled markers -# -------------------------- - -fig, axes = plt.subplots(ncols=2) - -# Filter out filled markers and marker settings that do nothing. -# We use iteritems from six to make sure that we get an iterator -# in both python 2 and 3 -unfilled_markers = [m for m, func in iteritems(Line2D.markers) - if func != 'nothing' and m not in Line2D.filled_markers] -# Reverse-sort for pretty. We use our own sort key which is essentially -# a python3 compatible reimplementation of python2 sort. -unfilled_markers = sorted(unfilled_markers, - key=lambda x: (str(type(x)), str(x)))[::-1] -for ax, markers in zip(axes, split_list(unfilled_markers)): - for y, marker in enumerate(markers): - ax.text(-0.5, y, nice_repr(marker), **text_style) - ax.plot(y * points, marker=marker, **marker_style) - format_axes(ax) -fig.suptitle('un-filled markers', fontsize=14) - - -# Plot all filled markers. -# ------------------------ - -fig, axes = plt.subplots(ncols=2) -for ax, markers in zip(axes, split_list(Line2D.filled_markers)): - for y, marker in enumerate(markers): - ax.text(-0.5, y, nice_repr(marker), **text_style) - ax.plot(y * points, marker=marker, **marker_style) - format_axes(ax) -fig.suptitle('filled markers', fontsize=14) - -plt.show() diff --git a/mpl_examples/lines_bars_and_markers/marker_reference_00.pdf b/mpl_examples/lines_bars_and_markers/marker_reference_00.pdf deleted file mode 100644 index 9255734b702..00000000000 Binary files a/mpl_examples/lines_bars_and_markers/marker_reference_00.pdf and /dev/null differ diff --git a/mpl_examples/lines_bars_and_markers/marker_reference_00.png b/mpl_examples/lines_bars_and_markers/marker_reference_00.png deleted file mode 100644 index b723029b48b..00000000000 Binary files a/mpl_examples/lines_bars_and_markers/marker_reference_00.png and /dev/null differ diff --git a/mpl_examples/lines_bars_and_markers/marker_reference_01.pdf b/mpl_examples/lines_bars_and_markers/marker_reference_01.pdf deleted file mode 100644 index 6c58a03a0ff..00000000000 Binary files a/mpl_examples/lines_bars_and_markers/marker_reference_01.pdf and /dev/null differ diff --git a/mpl_examples/lines_bars_and_markers/marker_reference_01.png b/mpl_examples/lines_bars_and_markers/marker_reference_01.png deleted file mode 100644 index 890221d06c8..00000000000 Binary files a/mpl_examples/lines_bars_and_markers/marker_reference_01.png and /dev/null differ diff --git a/mpl_examples/lines_bars_and_markers/scatter_with_legend.pdf b/mpl_examples/lines_bars_and_markers/scatter_with_legend.pdf deleted file mode 100644 index 9e045e7607f..00000000000 Binary files a/mpl_examples/lines_bars_and_markers/scatter_with_legend.pdf and /dev/null differ diff --git a/mpl_examples/lines_bars_and_markers/scatter_with_legend.png b/mpl_examples/lines_bars_and_markers/scatter_with_legend.png deleted file mode 100644 index e9431804e8c..00000000000 Binary files a/mpl_examples/lines_bars_and_markers/scatter_with_legend.png and /dev/null differ diff --git a/mpl_examples/lines_bars_and_markers/scatter_with_legend.py b/mpl_examples/lines_bars_and_markers/scatter_with_legend.py deleted file mode 100644 index f6f1ea5fe04..00000000000 --- a/mpl_examples/lines_bars_and_markers/scatter_with_legend.py +++ /dev/null @@ -1,16 +0,0 @@ -import matplotlib.pyplot as plt -from numpy.random import rand - - -fig, ax = plt.subplots() -for color in ['red', 'green', 'blue']: - n = 750 - x, y = rand(2, n) - scale = 200.0 * rand(n) - ax.scatter(x, y, c=color, s=scale, label=color, - alpha=0.3, edgecolors='none') - -ax.legend() -ax.grid(True) - -plt.show() diff --git a/mpl_examples/misc/contour_manual.py b/mpl_examples/misc/contour_manual.py deleted file mode 100644 index 37d06d0b17e..00000000000 --- a/mpl_examples/misc/contour_manual.py +++ /dev/null @@ -1,49 +0,0 @@ -""" -Example of displaying your own contour lines and polygons using ContourSet. -""" -import matplotlib.pyplot as plt -from matplotlib.contour import ContourSet -import matplotlib.cm as cm - -# Contour lines for each level are a list/tuple of polygons. -lines0 = [[[0, 0], [0, 4]]] -lines1 = [[[2, 0], [1, 2], [1, 3]]] -lines2 = [[[3, 0], [3, 2]], [[3, 3], [3, 4]]] # Note two lines. - -# Filled contours between two levels are also a list/tuple of polygons. -# Points can be ordered clockwise or anticlockwise. -filled01 = [[[0, 0], [0, 4], [1, 3], [1, 2], [2, 0]]] -filled12 = [[[2, 0], [3, 0], [3, 2], [1, 3], [1, 2]], # Note two polygons. - [[1, 4], [3, 4], [3, 3]]] - - -plt.figure() - -# Filled contours using filled=True. -cs = ContourSet(plt.gca(), [0, 1, 2], [filled01, filled12], filled=True, cmap=cm.bone) -cbar = plt.colorbar(cs) - -# Contour lines (non-filled). -lines = ContourSet(plt.gca(), [0, 1, 2], [lines0, lines1, lines2], cmap=cm.cool, - linewidths=3) -cbar.add_lines(lines) - -plt.axis([-0.5, 3.5, -0.5, 4.5]) -plt.title('User-specified contours') - - -# Multiple filled contour lines can be specified in a single list of polygon -# vertices along with a list of vertex kinds (code types) as described in the -# Path class. This is particularly useful for polygons with holes. -# Here a code type of 1 is a MOVETO, and 2 is a LINETO. - -plt.figure() -filled01 = [[[0, 0], [3, 0], [3, 3], [0, 3], [1, 1], [1, 2], [2, 2], [2, 1]]] -kinds01 = [[1, 2, 2, 2, 1, 2, 2, 2]] -cs = ContourSet(plt.gca(), [0, 1], [filled01], [kinds01], filled=True) -cbar = plt.colorbar(cs) - -plt.axis([-0.5, 3.5, -0.5, 3.5]) -plt.title('User specified filled contours with holes') - -plt.show() diff --git a/mpl_examples/misc/contour_manual_00.pdf b/mpl_examples/misc/contour_manual_00.pdf deleted file mode 100644 index 07daa61ebb6..00000000000 Binary files a/mpl_examples/misc/contour_manual_00.pdf and /dev/null differ diff --git a/mpl_examples/misc/contour_manual_00.png b/mpl_examples/misc/contour_manual_00.png deleted file mode 100644 index d30b3ad34d9..00000000000 Binary files a/mpl_examples/misc/contour_manual_00.png and /dev/null differ diff --git a/mpl_examples/misc/contour_manual_01.pdf b/mpl_examples/misc/contour_manual_01.pdf deleted file mode 100644 index ee2c6963d30..00000000000 Binary files a/mpl_examples/misc/contour_manual_01.pdf and /dev/null differ diff --git a/mpl_examples/misc/contour_manual_01.png b/mpl_examples/misc/contour_manual_01.png deleted file mode 100644 index 79bcf384302..00000000000 Binary files a/mpl_examples/misc/contour_manual_01.png and /dev/null differ diff --git a/mpl_examples/misc/font_indexing.py b/mpl_examples/misc/font_indexing.py deleted file mode 100644 index 164573f4527..00000000000 --- a/mpl_examples/misc/font_indexing.py +++ /dev/null @@ -1,40 +0,0 @@ -""" -A little example that shows how the various indexing into the font -tables relate to one another. Mainly for mpl developers.... - -""" -from __future__ import print_function -import matplotlib -from matplotlib.ft2font import FT2Font, KERNING_DEFAULT, KERNING_UNFITTED, KERNING_UNSCALED - - -#fname = '/usr/share/fonts/sfd/FreeSans.ttf' -fname = matplotlib.get_data_path() + '/fonts/ttf/DejaVuSans.ttf' -font = FT2Font(fname) -font.set_charmap(0) - -codes = font.get_charmap().items() -#dsu = [(ccode, glyphind) for ccode, glyphind in codes] -#dsu.sort() -#for ccode, glyphind in dsu: -# try: name = font.get_glyph_name(glyphind) -# except RuntimeError: pass -# else: print('% 4d % 4d %s %s' % (glyphind, ccode, hex(int(ccode)), name)) - - -# make a charname to charcode and glyphind dictionary -coded = {} -glyphd = {} -for ccode, glyphind in codes: - name = font.get_glyph_name(glyphind) - coded[name] = ccode - glyphd[name] = glyphind - -code = coded['A'] -glyph = font.load_char(code) -#print(glyph.bbox) -print(glyphd['A'], glyphd['V'], coded['A'], coded['V']) -print('AV', font.get_kerning(glyphd['A'], glyphd['V'], KERNING_DEFAULT)) -print('AV', font.get_kerning(glyphd['A'], glyphd['V'], KERNING_UNFITTED)) -print('AV', font.get_kerning(glyphd['A'], glyphd['V'], KERNING_UNSCALED)) -print('AV', font.get_kerning(glyphd['A'], glyphd['T'], KERNING_UNSCALED)) diff --git a/mpl_examples/misc/ftface_props.py b/mpl_examples/misc/ftface_props.py deleted file mode 100644 index c00f382763a..00000000000 --- a/mpl_examples/misc/ftface_props.py +++ /dev/null @@ -1,64 +0,0 @@ -from __future__ import print_function -""" -This is a demo script to show you how to use all the properties of an -FT2Font object. These describe global font properties. For -individual character metrics, use the Glyph object, as returned by -load_char -""" -import matplotlib -import matplotlib.ft2font as ft - - -#fname = '/usr/local/share/matplotlib/VeraIt.ttf' -fname = matplotlib.get_data_path() + '/fonts/ttf/DejaVuSans-Oblique.ttf' -#fname = '/usr/local/share/matplotlib/cmr10.ttf' - -font = ft.FT2Font(fname) - -print('Num faces :', font.num_faces) # number of faces in file -print('Num glyphs :', font.num_glyphs) # number of glyphs in the face -print('Family name :', font.family_name) # face family name -print('Style name :', font.style_name) # face style name -print('PS name :', font.postscript_name) # the postscript name -print('Num fixed :', font.num_fixed_sizes) # number of embedded bitmap in face - -# the following are only available if face.scalable -if font.scalable: - # the face global bounding box (xmin, ymin, xmax, ymax) - print('Bbox :', font.bbox) - # number of font units covered by the EM - print('EM :', font.units_per_EM) - # the ascender in 26.6 units - print('Ascender :', font.ascender) - # the descender in 26.6 units - print('Descender :', font.descender) - # the height in 26.6 units - print('Height :', font.height) - # maximum horizontal cursor advance - print('Max adv width :', font.max_advance_width) - # same for vertical layout - print('Max adv height :', font.max_advance_height) - # vertical position of the underline bar - print('Underline pos :', font.underline_position) - # vertical thickness of the underline - print('Underline thickness :', font.underline_thickness) - -for style in ('Italic', - 'Bold', - 'Scalable', - 'Fixed sizes', - 'Fixed width', - 'SFNT', - 'Horizontal', - 'Vertical', - 'Kerning', - 'Fast glyphs', - 'Multiple masters', - 'Glyph names', - 'External stream'): - bitpos = getattr(ft, style.replace(' ', '_').upper()) - 1 - print('%-17s:' % style, bool(font.style_flags & (1 << bitpos))) - -print(dir(font)) - -print(font.get_kerning) diff --git a/mpl_examples/misc/rasterization_demo.pdf b/mpl_examples/misc/rasterization_demo.pdf deleted file mode 100644 index 9e773848582..00000000000 Binary files a/mpl_examples/misc/rasterization_demo.pdf and /dev/null differ diff --git a/mpl_examples/misc/rasterization_demo.png b/mpl_examples/misc/rasterization_demo.png deleted file mode 100644 index 7e4dc1f146f..00000000000 Binary files a/mpl_examples/misc/rasterization_demo.png and /dev/null differ diff --git a/mpl_examples/misc/rasterization_demo.py b/mpl_examples/misc/rasterization_demo.py deleted file mode 100644 index 067099c56a2..00000000000 --- a/mpl_examples/misc/rasterization_demo.py +++ /dev/null @@ -1,50 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -d = np.arange(100).reshape(10, 10) -x, y = np.meshgrid(np.arange(11), np.arange(11)) - -theta = 0.25*np.pi -xx = x*np.cos(theta) - y*np.sin(theta) -yy = x*np.sin(theta) + y*np.cos(theta) - -fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2) -ax1.set_aspect(1) -ax1.pcolormesh(xx, yy, d) -ax1.set_title("No Rasterization") - -ax2.set_aspect(1) -ax2.set_title("Rasterization") - -m = ax2.pcolormesh(xx, yy, d) -m.set_rasterized(True) - -ax3.set_aspect(1) -ax3.pcolormesh(xx, yy, d) -ax3.text(0.5, 0.5, "Text", alpha=0.2, - va="center", ha="center", size=50, transform=ax3.transAxes) - -ax3.set_title("No Rasterization") - - -ax4.set_aspect(1) -m = ax4.pcolormesh(xx, yy, d) -m.set_zorder(-20) - -ax4.text(0.5, 0.5, "Text", alpha=0.2, - zorder=-15, - va="center", ha="center", size=50, transform=ax4.transAxes) - -ax4.set_rasterization_zorder(-10) - -ax4.set_title("Rasterization z$<-10$") - - -# ax2.title.set_rasterized(True) # should display a warning - -plt.savefig("test_rasterization.pdf", dpi=150) -plt.savefig("test_rasterization.eps", dpi=150) - -if not plt.rcParams["text.usetex"]: - plt.savefig("test_rasterization.svg", dpi=150) - # svg backend currently ignores the dpi diff --git a/mpl_examples/misc/rec_groupby_demo.py b/mpl_examples/misc/rec_groupby_demo.py deleted file mode 100644 index 06f2a1cca16..00000000000 --- a/mpl_examples/misc/rec_groupby_demo.py +++ /dev/null @@ -1,65 +0,0 @@ -from __future__ import print_function -import numpy as np -import matplotlib.mlab as mlab -import matplotlib.cbook as cbook - -datafile = cbook.get_sample_data('aapl.csv', asfileobj=False) -print('loading', datafile) -r = mlab.csv2rec(datafile) -r.sort() - - -def daily_return(prices): - 'an array of daily returns from price array' - g = np.zeros_like(prices) - g[1:] = (prices[1:] - prices[:-1])/prices[:-1] - return g - - -def volume_code(volume): - 'code the continuous volume data categorically' - ind = np.searchsorted([1e5, 1e6, 5e6, 10e6, 1e7], volume) - return ind - -# a list of (dtype_name, summary_function, output_dtype_name). -# rec_summarize will call on each function on the indicated recarray -# attribute, and the result assigned to output name in the return -# record array. -summaryfuncs = ( - ('date', lambda x: [thisdate.year for thisdate in x], 'years'), - ('date', lambda x: [thisdate.month for thisdate in x], 'months'), - ('date', lambda x: [thisdate.weekday() for thisdate in x], 'weekday'), - ('adj_close', daily_return, 'dreturn'), - ('volume', volume_code, 'volcode'), - ) - -rsum = mlab.rec_summarize(r, summaryfuncs) - -# stats is a list of (dtype_name, function, output_dtype_name). -# rec_groupby will summarize the attribute identified by the -# dtype_name over the groups in the groupby list, and assign the -# result to the output_dtype_name -stats = ( - ('dreturn', len, 'rcnt'), - ('dreturn', np.mean, 'rmean'), - ('dreturn', np.median, 'rmedian'), - ('dreturn', np.std, 'rsigma'), - ) - -# you can summarize over a single variable, like years or months -print('summary by years') -ry = mlab.rec_groupby(rsum, ('years',), stats) -print(mlab. rec2txt(ry)) - -print('summary by months') -rm = mlab.rec_groupby(rsum, ('months',), stats) -print(mlab.rec2txt(rm)) - -# or over multiple variables like years and months -print('summary by year and month') -rym = mlab.rec_groupby(rsum, ('years', 'months'), stats) -print(mlab.rec2txt(rym)) - -print('summary by volume') -rv = mlab.rec_groupby(rsum, ('volcode',), stats) -print(mlab.rec2txt(rv)) diff --git a/mpl_examples/misc/rec_join_demo.py b/mpl_examples/misc/rec_join_demo.py deleted file mode 100644 index 6d365042b35..00000000000 --- a/mpl_examples/misc/rec_join_demo.py +++ /dev/null @@ -1,31 +0,0 @@ -from __future__ import print_function -import numpy as np -import matplotlib.mlab as mlab -import matplotlib.cbook as cbook - -datafile = cbook.get_sample_data('aapl.csv', asfileobj=False) -print('loading', datafile) -r = mlab.csv2rec(datafile) - -r.sort() -r1 = r[-10:] - -# Create a new array -r2 = np.empty(12, dtype=[('date', '|O4'), ('high', np.float), - ('marker', np.float)]) -r2 = r2.view(np.recarray) -r2.date = r.date[-17:-5] -r2.high = r.high[-17:-5] -r2.marker = np.arange(12) - -print("r1:") -print(mlab.rec2txt(r1)) -print("r2:") -print(mlab.rec2txt(r2)) - -defaults = {'marker': -1, 'close': np.NaN, 'low': -4444.} - -for s in ('inner', 'outer', 'leftouter'): - rec = mlab.rec_join(['date', 'high'], r1, r2, - jointype=s, defaults=defaults) - print("\n%sjoin :\n%s" % (s, mlab.rec2txt(rec))) diff --git a/mpl_examples/misc/sample_data_demo.pdf b/mpl_examples/misc/sample_data_demo.pdf deleted file mode 100644 index 80ce605b919..00000000000 Binary files a/mpl_examples/misc/sample_data_demo.pdf and /dev/null differ diff --git a/mpl_examples/misc/sample_data_demo.png b/mpl_examples/misc/sample_data_demo.png deleted file mode 100644 index c13a4be6ac5..00000000000 Binary files a/mpl_examples/misc/sample_data_demo.png and /dev/null differ diff --git a/mpl_examples/misc/sample_data_demo.py b/mpl_examples/misc/sample_data_demo.py deleted file mode 100644 index 082fb63d605..00000000000 --- a/mpl_examples/misc/sample_data_demo.py +++ /dev/null @@ -1,13 +0,0 @@ -""" -Grab mpl data from the ~/.matplotlib/sample_data cache if it exists, else -fetch it from GitHub and cache it -""" -from __future__ import print_function -import matplotlib.cbook as cbook -import matplotlib.pyplot as plt -fname = cbook.get_sample_data('ada.png', asfileobj=False) - -print('fname', fname) -im = plt.imread(fname) -plt.imshow(im) -plt.show() diff --git a/mpl_examples/misc/svg_filter_line.pdf b/mpl_examples/misc/svg_filter_line.pdf deleted file mode 100644 index 93ef8ff3c18..00000000000 Binary files a/mpl_examples/misc/svg_filter_line.pdf and /dev/null differ diff --git a/mpl_examples/misc/svg_filter_line.png b/mpl_examples/misc/svg_filter_line.png deleted file mode 100644 index 499e5ce0fbc..00000000000 Binary files a/mpl_examples/misc/svg_filter_line.png and /dev/null differ diff --git a/mpl_examples/misc/svg_filter_line.py b/mpl_examples/misc/svg_filter_line.py deleted file mode 100644 index 198e673b78f..00000000000 --- a/mpl_examples/misc/svg_filter_line.py +++ /dev/null @@ -1,86 +0,0 @@ -""" -Demonstrate SVG filtering effects which might be used with mpl. - -Note that the filtering effects are only effective if your svg renderer -support it. -""" - -from __future__ import print_function -import matplotlib - -matplotlib.use("Svg") - -import matplotlib.pyplot as plt -import matplotlib.transforms as mtransforms - -fig1 = plt.figure() -ax = fig1.add_axes([0.1, 0.1, 0.8, 0.8]) - -# draw lines -l1, = ax.plot([0.1, 0.5, 0.9], [0.1, 0.9, 0.5], "bo-", - mec="b", lw=5, ms=10, label="Line 1") -l2, = ax.plot([0.1, 0.5, 0.9], [0.5, 0.2, 0.7], "rs-", - mec="r", lw=5, ms=10, color="r", label="Line 2") - - -for l in [l1, l2]: - - # draw shadows with same lines with slight offset and gray colors. - - xx = l.get_xdata() - yy = l.get_ydata() - shadow, = ax.plot(xx, yy) - shadow.update_from(l) - - # adjust color - shadow.set_color("0.2") - # adjust zorder of the shadow lines so that it is drawn below the - # original lines - shadow.set_zorder(l.get_zorder() - 0.5) - - # offset transform - ot = mtransforms.offset_copy(l.get_transform(), fig1, - x=4.0, y=-6.0, units='points') - - shadow.set_transform(ot) - - # set the id for a later use - shadow.set_gid(l.get_label() + "_shadow") - - -ax.set_xlim(0., 1.) -ax.set_ylim(0., 1.) - -# save the figure as a bytes string in the svg format. -from io import BytesIO -f = BytesIO() -plt.savefig(f, format="svg") - - -import xml.etree.cElementTree as ET - -# filter definition for a gaussian blur -filter_def = """ - - - - - -""" - - -# read in the saved svg -tree, xmlid = ET.XMLID(f.getvalue()) - -# insert the filter definition in the svg dom tree. -tree.insert(0, ET.XML(filter_def)) - -for l in [l1, l2]: - # pick up the svg element with given id - shadow = xmlid[l.get_label() + "_shadow"] - # apply shadow filter - shadow.set("filter", 'url(#dropshadow)') - -fn = "svg_filter_line.svg" -print("Saving '%s'" % fn) -ET.ElementTree(tree).write(fn) diff --git a/mpl_examples/misc/svg_filter_pie.pdf b/mpl_examples/misc/svg_filter_pie.pdf deleted file mode 100644 index 164dabddd0c..00000000000 Binary files a/mpl_examples/misc/svg_filter_pie.pdf and /dev/null differ diff --git a/mpl_examples/misc/svg_filter_pie.png b/mpl_examples/misc/svg_filter_pie.png deleted file mode 100644 index 94abd978a33..00000000000 Binary files a/mpl_examples/misc/svg_filter_pie.png and /dev/null differ diff --git a/mpl_examples/misc/svg_filter_pie.py b/mpl_examples/misc/svg_filter_pie.py deleted file mode 100644 index 85f7d4b55bd..00000000000 --- a/mpl_examples/misc/svg_filter_pie.py +++ /dev/null @@ -1,95 +0,0 @@ -""" -Demonstrate SVG filtering effects which might be used with mpl. -The pie chart drawing code is borrowed from pie_demo.py - -Note that the filtering effects are only effective if your svg renderer -support it. -""" - - -import matplotlib -matplotlib.use("Svg") - -import matplotlib.pyplot as plt -from matplotlib.patches import Shadow - -# make a square figure and axes -fig1 = plt.figure(1, figsize=(6, 6)) -ax = fig1.add_axes([0.1, 0.1, 0.8, 0.8]) - -labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' -fracs = [15, 30, 45, 10] - -explode = (0, 0.05, 0, 0) - -# We want to draw the shadow for each pie but we will not use "shadow" -# option as it does'n save the references to the shadow patches. -pies = ax.pie(fracs, explode=explode, labels=labels, autopct='%1.1f%%') - -for w in pies[0]: - # set the id with the label. - w.set_gid(w.get_label()) - - # we don't want to draw the edge of the pie - w.set_ec("none") - -for w in pies[0]: - # create shadow patch - s = Shadow(w, -0.01, -0.01) - s.set_gid(w.get_gid() + "_shadow") - s.set_zorder(w.get_zorder() - 0.1) - ax.add_patch(s) - - -# save -from io import BytesIO -f = BytesIO() -plt.savefig(f, format="svg") - -import xml.etree.cElementTree as ET - - -# filter definition for shadow using a gaussian blur -# and lightening effect. -# The lightening filter is copied from http://www.w3.org/TR/SVG/filters.html - -# I tested it with Inkscape and Firefox3. "Gaussian blur" is supported -# in both, but the lightening effect only in the Inkscape. Also note -# that, Inkscape's exporting also may not support it. - -filter_def = """ - - - - - - - - - - - - - - - -""" - - -tree, xmlid = ET.XMLID(f.getvalue()) - -# insert the filter definition in the svg dom tree. -tree.insert(0, ET.XML(filter_def)) - -for i, pie_name in enumerate(labels): - pie = xmlid[pie_name] - pie.set("filter", 'url(#MyFilter)') - - shadow = xmlid[pie_name + "_shadow"] - shadow.set("filter", 'url(#dropshadow)') - -fn = "svg_filter_pie.svg" -print("Saving '%s'" % fn) -ET.ElementTree(tree).write(fn) diff --git a/mpl_examples/misc/tight_bbox_test.pdf b/mpl_examples/misc/tight_bbox_test.pdf deleted file mode 100644 index 67eec1ac0c8..00000000000 Binary files a/mpl_examples/misc/tight_bbox_test.pdf and /dev/null differ diff --git a/mpl_examples/misc/tight_bbox_test.png b/mpl_examples/misc/tight_bbox_test.png deleted file mode 100644 index b1b2e5b4740..00000000000 Binary files a/mpl_examples/misc/tight_bbox_test.png and /dev/null differ diff --git a/mpl_examples/misc/tight_bbox_test.py b/mpl_examples/misc/tight_bbox_test.py deleted file mode 100644 index 2e966e28666..00000000000 --- a/mpl_examples/misc/tight_bbox_test.py +++ /dev/null @@ -1,15 +0,0 @@ -from __future__ import print_function -import matplotlib.pyplot as plt -import numpy as np - -ax = plt.axes([0.1, 0.3, 0.5, 0.5]) - -ax.pcolormesh(np.array([[1, 2], [3, 4]])) -plt.yticks([0.5, 1.5], ["long long tick label", - "tick label"]) -plt.ylabel("My y-label") -plt.title("Check saved figures for their bboxes") -for ext in ["png", "pdf", "svg", "svgz", "eps"]: - print("saving tight_bbox_test.%s" % (ext,)) - plt.savefig("tight_bbox_test.%s" % (ext,), bbox_inches="tight") -plt.show() diff --git a/mpl_examples/mplot3d/2dcollections3d_demo.hires.png b/mpl_examples/mplot3d/2dcollections3d_demo.hires.png deleted file mode 100644 index 7f1d0907d17..00000000000 Binary files a/mpl_examples/mplot3d/2dcollections3d_demo.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/2dcollections3d_demo.pdf b/mpl_examples/mplot3d/2dcollections3d_demo.pdf deleted file mode 100644 index 7b8877c0364..00000000000 Binary files a/mpl_examples/mplot3d/2dcollections3d_demo.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/2dcollections3d_demo.png b/mpl_examples/mplot3d/2dcollections3d_demo.png deleted file mode 100644 index 556b3289f4a..00000000000 Binary files a/mpl_examples/mplot3d/2dcollections3d_demo.png and /dev/null differ diff --git a/mpl_examples/mplot3d/2dcollections3d_demo.py b/mpl_examples/mplot3d/2dcollections3d_demo.py deleted file mode 100644 index 6def5503a5b..00000000000 --- a/mpl_examples/mplot3d/2dcollections3d_demo.py +++ /dev/null @@ -1,46 +0,0 @@ -""" -======================= -Plot 2D data on 3D plot -======================= - -Demonstrates using ax.plot's zdir keyword to plot 2D data on -selective axes of a 3D plot. -""" - -from mpl_toolkits.mplot3d import Axes3D -import numpy as np -import matplotlib.pyplot as plt - -fig = plt.figure() -ax = fig.gca(projection='3d') - -# Plot a sin curve using the x and y axes. -x = np.linspace(0, 1, 100) -y = np.sin(x * 2 * np.pi) / 2 + 0.5 -ax.plot(x, y, zs=0, zdir='z', label='curve in (x,y)') - -# Plot scatterplot data (20 2D points per colour) on the x and z axes. -colors = ('r', 'g', 'b', 'k') -x = np.random.sample(20*len(colors)) -y = np.random.sample(20*len(colors)) -c_list = [] -for c in colors: - c_list.append([c]*20) -# By using zdir='y', the y value of these points is fixed to the zs value 0 -# and the (x,y) points are plotted on the x and z axes. -ax.scatter(x, y, zs=0, zdir='y', c=c_list, label='points in (x,z)') - -# Make legend, set axes limits and labels -ax.legend() -ax.set_xlim(0, 1) -ax.set_ylim(0, 1) -ax.set_zlim(0, 1) -ax.set_xlabel('X') -ax.set_ylabel('Y') -ax.set_zlabel('Z') - -# Customize the view angle so it's easier to see that the scatter points lie -# on the plane y=0 -ax.view_init(elev=20., azim=-35) - -plt.show() diff --git a/mpl_examples/mplot3d/bars3d_demo.hires.png b/mpl_examples/mplot3d/bars3d_demo.hires.png deleted file mode 100644 index 3749291f786..00000000000 Binary files a/mpl_examples/mplot3d/bars3d_demo.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/bars3d_demo.pdf b/mpl_examples/mplot3d/bars3d_demo.pdf deleted file mode 100644 index 95ef31796f4..00000000000 Binary files a/mpl_examples/mplot3d/bars3d_demo.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/bars3d_demo.png b/mpl_examples/mplot3d/bars3d_demo.png deleted file mode 100644 index a3217a22299..00000000000 Binary files a/mpl_examples/mplot3d/bars3d_demo.png and /dev/null differ diff --git a/mpl_examples/mplot3d/bars3d_demo.py b/mpl_examples/mplot3d/bars3d_demo.py deleted file mode 100644 index e148c266a2e..00000000000 --- a/mpl_examples/mplot3d/bars3d_demo.py +++ /dev/null @@ -1,30 +0,0 @@ -""" -======================================== -Create 2D bar graphs in different planes -======================================== - -Demonstrates making a 3D plot which has 2D bar graphs projected onto -planes y=0, y=1, etc. -""" - -from mpl_toolkits.mplot3d import Axes3D -import matplotlib.pyplot as plt -import numpy as np - -fig = plt.figure() -ax = fig.add_subplot(111, projection='3d') -for c, z in zip(['r', 'g', 'b', 'y'], [30, 20, 10, 0]): - xs = np.arange(20) - ys = np.random.rand(20) - - # You can provide either a single color or an array. To demonstrate this, - # the first bar of each set will be colored cyan. - cs = [c] * len(xs) - cs[0] = 'c' - ax.bar(xs, ys, zs=z, zdir='y', color=cs, alpha=0.8) - -ax.set_xlabel('X') -ax.set_ylabel('Y') -ax.set_zlabel('Z') - -plt.show() diff --git a/mpl_examples/mplot3d/contour3d_demo.hires.png b/mpl_examples/mplot3d/contour3d_demo.hires.png deleted file mode 100644 index d6a9f2e2526..00000000000 Binary files a/mpl_examples/mplot3d/contour3d_demo.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/contour3d_demo.pdf b/mpl_examples/mplot3d/contour3d_demo.pdf deleted file mode 100644 index 74dd2ae351e..00000000000 Binary files a/mpl_examples/mplot3d/contour3d_demo.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/contour3d_demo.png b/mpl_examples/mplot3d/contour3d_demo.png deleted file mode 100644 index 269c68d9e95..00000000000 Binary files a/mpl_examples/mplot3d/contour3d_demo.png and /dev/null differ diff --git a/mpl_examples/mplot3d/contour3d_demo.py b/mpl_examples/mplot3d/contour3d_demo.py deleted file mode 100644 index 6c3fba8ce6b..00000000000 --- a/mpl_examples/mplot3d/contour3d_demo.py +++ /dev/null @@ -1,11 +0,0 @@ -from mpl_toolkits.mplot3d import axes3d -import matplotlib.pyplot as plt -from matplotlib import cm - -fig = plt.figure() -ax = fig.add_subplot(111, projection='3d') -X, Y, Z = axes3d.get_test_data(0.05) -cset = ax.contour(X, Y, Z, cmap=cm.coolwarm) -ax.clabel(cset, fontsize=9, inline=1) - -plt.show() diff --git a/mpl_examples/mplot3d/contour3d_demo2.hires.png b/mpl_examples/mplot3d/contour3d_demo2.hires.png deleted file mode 100644 index bee80945eec..00000000000 Binary files a/mpl_examples/mplot3d/contour3d_demo2.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/contour3d_demo2.pdf b/mpl_examples/mplot3d/contour3d_demo2.pdf deleted file mode 100644 index 7060d253275..00000000000 Binary files a/mpl_examples/mplot3d/contour3d_demo2.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/contour3d_demo2.png b/mpl_examples/mplot3d/contour3d_demo2.png deleted file mode 100644 index 867b4dee279..00000000000 Binary files a/mpl_examples/mplot3d/contour3d_demo2.png and /dev/null differ diff --git a/mpl_examples/mplot3d/contour3d_demo2.py b/mpl_examples/mplot3d/contour3d_demo2.py deleted file mode 100644 index 64e053cbb64..00000000000 --- a/mpl_examples/mplot3d/contour3d_demo2.py +++ /dev/null @@ -1,11 +0,0 @@ -from mpl_toolkits.mplot3d import axes3d -import matplotlib.pyplot as plt -from matplotlib import cm - -fig = plt.figure() -ax = fig.gca(projection='3d') -X, Y, Z = axes3d.get_test_data(0.05) -cset = ax.contour(X, Y, Z, extend3d=True, cmap=cm.coolwarm) -ax.clabel(cset, fontsize=9, inline=1) - -plt.show() diff --git a/mpl_examples/mplot3d/contour3d_demo3.hires.png b/mpl_examples/mplot3d/contour3d_demo3.hires.png deleted file mode 100644 index de0257a84ca..00000000000 Binary files a/mpl_examples/mplot3d/contour3d_demo3.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/contour3d_demo3.pdf b/mpl_examples/mplot3d/contour3d_demo3.pdf deleted file mode 100644 index 29a333da995..00000000000 Binary files a/mpl_examples/mplot3d/contour3d_demo3.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/contour3d_demo3.png b/mpl_examples/mplot3d/contour3d_demo3.png deleted file mode 100644 index 6650c6f592f..00000000000 Binary files a/mpl_examples/mplot3d/contour3d_demo3.png and /dev/null differ diff --git a/mpl_examples/mplot3d/contour3d_demo3.py b/mpl_examples/mplot3d/contour3d_demo3.py deleted file mode 100644 index f0b2fbf23f2..00000000000 --- a/mpl_examples/mplot3d/contour3d_demo3.py +++ /dev/null @@ -1,20 +0,0 @@ -from mpl_toolkits.mplot3d import axes3d -import matplotlib.pyplot as plt -from matplotlib import cm - -fig = plt.figure() -ax = fig.gca(projection='3d') -X, Y, Z = axes3d.get_test_data(0.05) -ax.plot_surface(X, Y, Z, rstride=8, cstride=8, alpha=0.3) -cset = ax.contour(X, Y, Z, zdir='z', offset=-100, cmap=cm.coolwarm) -cset = ax.contour(X, Y, Z, zdir='x', offset=-40, cmap=cm.coolwarm) -cset = ax.contour(X, Y, Z, zdir='y', offset=40, cmap=cm.coolwarm) - -ax.set_xlabel('X') -ax.set_xlim(-40, 40) -ax.set_ylabel('Y') -ax.set_ylim(-40, 40) -ax.set_zlabel('Z') -ax.set_zlim(-100, 100) - -plt.show() diff --git a/mpl_examples/mplot3d/contourf3d_demo.hires.png b/mpl_examples/mplot3d/contourf3d_demo.hires.png deleted file mode 100644 index 43ca4c827dd..00000000000 Binary files a/mpl_examples/mplot3d/contourf3d_demo.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/contourf3d_demo.pdf b/mpl_examples/mplot3d/contourf3d_demo.pdf deleted file mode 100644 index 94f3b4bda45..00000000000 Binary files a/mpl_examples/mplot3d/contourf3d_demo.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/contourf3d_demo.png b/mpl_examples/mplot3d/contourf3d_demo.png deleted file mode 100644 index dd91b3c374f..00000000000 Binary files a/mpl_examples/mplot3d/contourf3d_demo.png and /dev/null differ diff --git a/mpl_examples/mplot3d/contourf3d_demo.py b/mpl_examples/mplot3d/contourf3d_demo.py deleted file mode 100644 index 4811ecd7236..00000000000 --- a/mpl_examples/mplot3d/contourf3d_demo.py +++ /dev/null @@ -1,11 +0,0 @@ -from mpl_toolkits.mplot3d import axes3d -import matplotlib.pyplot as plt -from matplotlib import cm - -fig = plt.figure() -ax = fig.gca(projection='3d') -X, Y, Z = axes3d.get_test_data(0.05) -cset = ax.contourf(X, Y, Z, cmap=cm.coolwarm) -ax.clabel(cset, fontsize=9, inline=1) - -plt.show() diff --git a/mpl_examples/mplot3d/contourf3d_demo2.hires.png b/mpl_examples/mplot3d/contourf3d_demo2.hires.png deleted file mode 100644 index da0405ea7eb..00000000000 Binary files a/mpl_examples/mplot3d/contourf3d_demo2.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/contourf3d_demo2.pdf b/mpl_examples/mplot3d/contourf3d_demo2.pdf deleted file mode 100644 index 723a986bb92..00000000000 Binary files a/mpl_examples/mplot3d/contourf3d_demo2.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/contourf3d_demo2.png b/mpl_examples/mplot3d/contourf3d_demo2.png deleted file mode 100644 index b3f353d3d71..00000000000 Binary files a/mpl_examples/mplot3d/contourf3d_demo2.png and /dev/null differ diff --git a/mpl_examples/mplot3d/contourf3d_demo2.py b/mpl_examples/mplot3d/contourf3d_demo2.py deleted file mode 100644 index 21bae939dc1..00000000000 --- a/mpl_examples/mplot3d/contourf3d_demo2.py +++ /dev/null @@ -1,25 +0,0 @@ -""" -.. versionadded:: 1.1.0 - This demo depends on new features added to contourf3d. -""" - -from mpl_toolkits.mplot3d import axes3d -import matplotlib.pyplot as plt -from matplotlib import cm - -fig = plt.figure() -ax = fig.gca(projection='3d') -X, Y, Z = axes3d.get_test_data(0.05) -ax.plot_surface(X, Y, Z, rstride=8, cstride=8, alpha=0.3) -cset = ax.contourf(X, Y, Z, zdir='z', offset=-100, cmap=cm.coolwarm) -cset = ax.contourf(X, Y, Z, zdir='x', offset=-40, cmap=cm.coolwarm) -cset = ax.contourf(X, Y, Z, zdir='y', offset=40, cmap=cm.coolwarm) - -ax.set_xlabel('X') -ax.set_xlim(-40, 40) -ax.set_ylabel('Y') -ax.set_ylim(-40, 40) -ax.set_zlabel('Z') -ax.set_zlim(-100, 100) - -plt.show() diff --git a/mpl_examples/mplot3d/custom_shaded_3d_surface.hires.png b/mpl_examples/mplot3d/custom_shaded_3d_surface.hires.png deleted file mode 100644 index c47e49d7d5d..00000000000 Binary files a/mpl_examples/mplot3d/custom_shaded_3d_surface.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/custom_shaded_3d_surface.pdf b/mpl_examples/mplot3d/custom_shaded_3d_surface.pdf deleted file mode 100644 index f9981e8c84a..00000000000 Binary files a/mpl_examples/mplot3d/custom_shaded_3d_surface.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/custom_shaded_3d_surface.png b/mpl_examples/mplot3d/custom_shaded_3d_surface.png deleted file mode 100644 index 093546b02f5..00000000000 Binary files a/mpl_examples/mplot3d/custom_shaded_3d_surface.png and /dev/null differ diff --git a/mpl_examples/mplot3d/custom_shaded_3d_surface.py b/mpl_examples/mplot3d/custom_shaded_3d_surface.py deleted file mode 100644 index 4bfff3ca663..00000000000 --- a/mpl_examples/mplot3d/custom_shaded_3d_surface.py +++ /dev/null @@ -1,31 +0,0 @@ -""" -Demonstrates using custom hillshading in a 3D surface plot. -""" -from mpl_toolkits.mplot3d import Axes3D -from matplotlib import cbook -from matplotlib import cm -from matplotlib.colors import LightSource -import matplotlib.pyplot as plt -import numpy as np - -filename = cbook.get_sample_data('jacksboro_fault_dem.npz', asfileobj=False) -with np.load(filename) as dem: - z = dem['elevation'] - nrows, ncols = z.shape - x = np.linspace(dem['xmin'], dem['xmax'], ncols) - y = np.linspace(dem['ymin'], dem['ymax'], nrows) - x, y = np.meshgrid(x, y) - -region = np.s_[5:50, 5:50] -x, y, z = x[region], y[region], z[region] - -fig, ax = plt.subplots(subplot_kw=dict(projection='3d')) - -ls = LightSource(270, 45) -# To use a custom hillshading mode, override the built-in shading and pass -# in the rgb colors of the shaded surface calculated from "shade". -rgb = ls.shade(z, cmap=cm.gist_earth, vert_exag=0.1, blend_mode='soft') -surf = ax.plot_surface(x, y, z, rstride=1, cstride=1, facecolors=rgb, - linewidth=0, antialiased=False, shade=False) - -plt.show() diff --git a/mpl_examples/mplot3d/hist3d_demo.hires.png b/mpl_examples/mplot3d/hist3d_demo.hires.png deleted file mode 100644 index 15fbc318b6b..00000000000 Binary files a/mpl_examples/mplot3d/hist3d_demo.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/hist3d_demo.pdf b/mpl_examples/mplot3d/hist3d_demo.pdf deleted file mode 100644 index 469102fe0ee..00000000000 Binary files a/mpl_examples/mplot3d/hist3d_demo.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/hist3d_demo.png b/mpl_examples/mplot3d/hist3d_demo.png deleted file mode 100644 index 0efad6eb2c5..00000000000 Binary files a/mpl_examples/mplot3d/hist3d_demo.png and /dev/null differ diff --git a/mpl_examples/mplot3d/hist3d_demo.py b/mpl_examples/mplot3d/hist3d_demo.py deleted file mode 100644 index 53881bf55ca..00000000000 --- a/mpl_examples/mplot3d/hist3d_demo.py +++ /dev/null @@ -1,34 +0,0 @@ -""" -============================== -Create 3D histogram of 2D data -============================== - -Demo of a histogram for 2 dimensional data as a bar graph in 3D. -""" - -from mpl_toolkits.mplot3d import Axes3D -import matplotlib.pyplot as plt -import numpy as np - -fig = plt.figure() -ax = fig.add_subplot(111, projection='3d') -x, y = np.random.rand(2, 100) * 4 -hist, xedges, yedges = np.histogram2d(x, y, bins=4, range=[[0, 4], [0, 4]]) - -# Construct arrays for the anchor positions of the 16 bars. -# Note: np.meshgrid gives arrays in (ny, nx) so we use 'F' to flatten xpos, -# ypos in column-major order. For numpy >= 1.7, we could instead call meshgrid -# with indexing='ij'. -xpos, ypos = np.meshgrid(xedges[:-1] + 0.25, yedges[:-1] + 0.25) -xpos = xpos.flatten('F') -ypos = ypos.flatten('F') -zpos = np.zeros_like(xpos) - -# Construct arrays with the dimensions for the 16 bars. -dx = 0.5 * np.ones_like(zpos) -dy = dx.copy() -dz = hist.flatten() - -ax.bar3d(xpos, ypos, zpos, dx, dy, dz, color='b', zsort='average') - -plt.show() diff --git a/mpl_examples/mplot3d/lines3d_demo.hires.png b/mpl_examples/mplot3d/lines3d_demo.hires.png deleted file mode 100644 index b42496ca4c5..00000000000 Binary files a/mpl_examples/mplot3d/lines3d_demo.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/lines3d_demo.pdf b/mpl_examples/mplot3d/lines3d_demo.pdf deleted file mode 100644 index 13355ce5e8b..00000000000 Binary files a/mpl_examples/mplot3d/lines3d_demo.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/lines3d_demo.png b/mpl_examples/mplot3d/lines3d_demo.png deleted file mode 100644 index 39ad58c079b..00000000000 Binary files a/mpl_examples/mplot3d/lines3d_demo.png and /dev/null differ diff --git a/mpl_examples/mplot3d/lines3d_demo.py b/mpl_examples/mplot3d/lines3d_demo.py deleted file mode 100644 index cc349bda223..00000000000 --- a/mpl_examples/mplot3d/lines3d_demo.py +++ /dev/null @@ -1,18 +0,0 @@ -import matplotlib as mpl -from mpl_toolkits.mplot3d import Axes3D -import numpy as np -import matplotlib.pyplot as plt - -mpl.rcParams['legend.fontsize'] = 10 - -fig = plt.figure() -ax = fig.gca(projection='3d') -theta = np.linspace(-4 * np.pi, 4 * np.pi, 100) -z = np.linspace(-2, 2, 100) -r = z**2 + 1 -x = r * np.sin(theta) -y = r * np.cos(theta) -ax.plot(x, y, z, label='parametric curve') -ax.legend() - -plt.show() diff --git a/mpl_examples/mplot3d/lorenz_attractor.hires.png b/mpl_examples/mplot3d/lorenz_attractor.hires.png deleted file mode 100644 index 79e0ed209a3..00000000000 Binary files a/mpl_examples/mplot3d/lorenz_attractor.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/lorenz_attractor.pdf b/mpl_examples/mplot3d/lorenz_attractor.pdf deleted file mode 100644 index 5b39d4830d8..00000000000 Binary files a/mpl_examples/mplot3d/lorenz_attractor.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/lorenz_attractor.png b/mpl_examples/mplot3d/lorenz_attractor.png deleted file mode 100644 index 74ca8749a8a..00000000000 Binary files a/mpl_examples/mplot3d/lorenz_attractor.png and /dev/null differ diff --git a/mpl_examples/mplot3d/lorenz_attractor.py b/mpl_examples/mplot3d/lorenz_attractor.py deleted file mode 100644 index 976eee90268..00000000000 --- a/mpl_examples/mplot3d/lorenz_attractor.py +++ /dev/null @@ -1,49 +0,0 @@ -# Plot of the Lorenz Attractor based on Edward Lorenz's 1963 "Deterministic -# Nonperiodic Flow" publication. -# http://journals.ametsoc.org/doi/abs/10.1175/1520-0469%281963%29020%3C0130%3ADNF%3E2.0.CO%3B2 -# -# Note: Because this is a simple non-linear ODE, it would be more easily -# done using SciPy's ode solver, but this approach depends only -# upon NumPy. - -import numpy as np -import matplotlib.pyplot as plt -from mpl_toolkits.mplot3d import Axes3D - - -def lorenz(x, y, z, s=10, r=28, b=2.667): - x_dot = s*(y - x) - y_dot = r*x - y - x*z - z_dot = x*y - b*z - return x_dot, y_dot, z_dot - - -dt = 0.01 -stepCnt = 10000 - -# Need one more for the initial values -xs = np.empty((stepCnt + 1,)) -ys = np.empty((stepCnt + 1,)) -zs = np.empty((stepCnt + 1,)) - -# Setting initial values -xs[0], ys[0], zs[0] = (0., 1., 1.05) - -# Stepping through "time". -for i in range(stepCnt): - # Derivatives of the X, Y, Z state - x_dot, y_dot, z_dot = lorenz(xs[i], ys[i], zs[i]) - xs[i + 1] = xs[i] + (x_dot * dt) - ys[i + 1] = ys[i] + (y_dot * dt) - zs[i + 1] = zs[i] + (z_dot * dt) - -fig = plt.figure() -ax = fig.gca(projection='3d') - -ax.plot(xs, ys, zs, lw=0.5) -ax.set_xlabel("X Axis") -ax.set_ylabel("Y Axis") -ax.set_zlabel("Z Axis") -ax.set_title("Lorenz Attractor") - -plt.show() diff --git a/mpl_examples/mplot3d/mixed_subplots_demo.hires.png b/mpl_examples/mplot3d/mixed_subplots_demo.hires.png deleted file mode 100644 index be3ec21c8d5..00000000000 Binary files a/mpl_examples/mplot3d/mixed_subplots_demo.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/mixed_subplots_demo.pdf b/mpl_examples/mplot3d/mixed_subplots_demo.pdf deleted file mode 100644 index c778031b0ce..00000000000 Binary files a/mpl_examples/mplot3d/mixed_subplots_demo.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/mixed_subplots_demo.png b/mpl_examples/mplot3d/mixed_subplots_demo.png deleted file mode 100644 index b9f30dbbec8..00000000000 Binary files a/mpl_examples/mplot3d/mixed_subplots_demo.png and /dev/null differ diff --git a/mpl_examples/mplot3d/mixed_subplots_demo.py b/mpl_examples/mplot3d/mixed_subplots_demo.py deleted file mode 100644 index ffcb23c01c2..00000000000 --- a/mpl_examples/mplot3d/mixed_subplots_demo.py +++ /dev/null @@ -1,49 +0,0 @@ -""" -Demonstrate the mixing of 2d and 3d subplots -""" -from mpl_toolkits.mplot3d import Axes3D -import matplotlib.pyplot as plt -import numpy as np - - -def f(t): - s1 = np.cos(2*np.pi*t) - e1 = np.exp(-t) - return np.multiply(s1, e1) - - -################ -# First subplot -################ -t1 = np.arange(0.0, 5.0, 0.1) -t2 = np.arange(0.0, 5.0, 0.02) -t3 = np.arange(0.0, 2.0, 0.01) - -# Twice as tall as it is wide. -fig = plt.figure(figsize=plt.figaspect(2.)) -fig.suptitle('A tale of 2 subplots') -ax = fig.add_subplot(2, 1, 1) -l = ax.plot(t1, f(t1), 'bo', - t2, f(t2), 'k--', markerfacecolor='green') -ax.grid(True) -ax.set_ylabel('Damped oscillation') - - -################# -# Second subplot -################# -ax = fig.add_subplot(2, 1, 2, projection='3d') -X = np.arange(-5, 5, 0.25) -xlen = len(X) -Y = np.arange(-5, 5, 0.25) -ylen = len(Y) -X, Y = np.meshgrid(X, Y) -R = np.sqrt(X**2 + Y**2) -Z = np.sin(R) - -surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, - linewidth=0, antialiased=False) - -ax.set_zlim3d(-1, 1) - -plt.show() diff --git a/mpl_examples/mplot3d/offset_demo.hires.png b/mpl_examples/mplot3d/offset_demo.hires.png deleted file mode 100644 index 58ba5a9634b..00000000000 Binary files a/mpl_examples/mplot3d/offset_demo.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/offset_demo.pdf b/mpl_examples/mplot3d/offset_demo.pdf deleted file mode 100644 index 5af22068b95..00000000000 Binary files a/mpl_examples/mplot3d/offset_demo.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/offset_demo.png b/mpl_examples/mplot3d/offset_demo.png deleted file mode 100644 index 91d63ba6b67..00000000000 Binary files a/mpl_examples/mplot3d/offset_demo.png and /dev/null differ diff --git a/mpl_examples/mplot3d/offset_demo.py b/mpl_examples/mplot3d/offset_demo.py deleted file mode 100644 index 7b80ff2864a..00000000000 --- a/mpl_examples/mplot3d/offset_demo.py +++ /dev/null @@ -1,25 +0,0 @@ -from mpl_toolkits.mplot3d import Axes3D -import matplotlib.pyplot as plt -import numpy as np - -# This example demonstrates mplot3d's offset text display. -# As one rotates the 3D figure, the offsets should remain oriented -# same way as the axis label, and should also be located "away" -# from the center of the plot. -# -# This demo triggers the display of the offset text for the x and -# y axis by adding 1e5 to X and Y. Anything less would not -# automatically trigger it. - -fig = plt.figure() -ax = fig.gca(projection='3d') -X, Y = np.mgrid[0:6*np.pi:0.25, 0:4*np.pi:0.25] -Z = np.sqrt(np.abs(np.cos(X) + np.cos(Y))) - -surf = ax.plot_surface(X + 1e5, Y + 1e5, Z, cmap='autumn', cstride=2, rstride=2) -ax.set_xlabel("X-Label") -ax.set_ylabel("Y-Label") -ax.set_zlabel("Z-Label") -ax.set_zlim(0, 2) - -plt.show() diff --git a/mpl_examples/mplot3d/pathpatch3d_demo.hires.png b/mpl_examples/mplot3d/pathpatch3d_demo.hires.png deleted file mode 100644 index 63d9fb01ff6..00000000000 Binary files a/mpl_examples/mplot3d/pathpatch3d_demo.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/pathpatch3d_demo.pdf b/mpl_examples/mplot3d/pathpatch3d_demo.pdf deleted file mode 100644 index 73168da6af7..00000000000 Binary files a/mpl_examples/mplot3d/pathpatch3d_demo.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/pathpatch3d_demo.png b/mpl_examples/mplot3d/pathpatch3d_demo.png deleted file mode 100644 index 65ebd62d439..00000000000 Binary files a/mpl_examples/mplot3d/pathpatch3d_demo.png and /dev/null differ diff --git a/mpl_examples/mplot3d/pathpatch3d_demo.py b/mpl_examples/mplot3d/pathpatch3d_demo.py deleted file mode 100644 index 7b08b161373..00000000000 --- a/mpl_examples/mplot3d/pathpatch3d_demo.py +++ /dev/null @@ -1,61 +0,0 @@ -""" -============================ -Draw flat objects in 3D plot -============================ - -Demonstrate using pathpatch_2d_to_3d to 'draw' shapes and text on a 3D plot. -""" - -import matplotlib.pyplot as plt -from matplotlib.patches import Circle, PathPatch -# register Axes3D class with matplotlib by importing Axes3D -from mpl_toolkits.mplot3d import Axes3D -import mpl_toolkits.mplot3d.art3d as art3d -from matplotlib.text import TextPath -from matplotlib.transforms import Affine2D - - -def text3d(ax, xyz, s, zdir="z", size=None, angle=0, usetex=False, **kwargs): - - x, y, z = xyz - if zdir == "y": - xy1, z1 = (x, z), y - elif zdir == "y": - xy1, z1 = (y, z), x - else: - xy1, z1 = (x, y), z - - text_path = TextPath((0, 0), s, size=size, usetex=usetex) - trans = Affine2D().rotate(angle).translate(xy1[0], xy1[1]) - - p1 = PathPatch(trans.transform_path(text_path), **kwargs) - ax.add_patch(p1) - art3d.pathpatch_2d_to_3d(p1, z=z1, zdir=zdir) - - -fig = plt.figure() -ax = fig.add_subplot(111, projection='3d') - -p = Circle((5, 5), 3) -ax.add_patch(p) -art3d.pathpatch_2d_to_3d(p, z=0, zdir="x") - - -text3d(ax, (4, -2, 0), "X-axis", zdir="z", size=.5, usetex=False, - ec="none", fc="k") -text3d(ax, (12, 4, 0), "Y-axis", zdir="z", size=.5, usetex=False, - angle=.5*3.14159, ec="none", fc="k") -text3d(ax, (12, 10, 4), "Z-axis", zdir="y", size=.5, usetex=False, - angle=.5*3.14159, ec="none", fc="k") - -text3d(ax, (1, 5, 0), - r"$\displaystyle G_{\mu\nu} + \Lambda g_{\mu\nu} = " - r"\frac{8\pi G}{c^4} T_{\mu\nu} $", - zdir="z", size=1, usetex=True, - ec="none", fc="k") - -ax.set_xlim3d(0, 10) -ax.set_ylim3d(0, 10) -ax.set_zlim3d(0, 10) - -plt.show() diff --git a/mpl_examples/mplot3d/polys3d_demo.hires.png b/mpl_examples/mplot3d/polys3d_demo.hires.png deleted file mode 100644 index 4bace5c393f..00000000000 Binary files a/mpl_examples/mplot3d/polys3d_demo.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/polys3d_demo.pdf b/mpl_examples/mplot3d/polys3d_demo.pdf deleted file mode 100644 index af54f599238..00000000000 Binary files a/mpl_examples/mplot3d/polys3d_demo.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/polys3d_demo.png b/mpl_examples/mplot3d/polys3d_demo.png deleted file mode 100644 index 5a181c87231..00000000000 Binary files a/mpl_examples/mplot3d/polys3d_demo.png and /dev/null differ diff --git a/mpl_examples/mplot3d/polys3d_demo.py b/mpl_examples/mplot3d/polys3d_demo.py deleted file mode 100644 index 75f90593a95..00000000000 --- a/mpl_examples/mplot3d/polys3d_demo.py +++ /dev/null @@ -1,45 +0,0 @@ -""" -============================================= -Generate polygons to fill under 3D line graph -============================================= - -Demonstrate how to create polygons which fill the space under a line -graph. In this example polygons are semi-transparent, creating a sort -of 'jagged stained glass' effect. -""" - -from mpl_toolkits.mplot3d import Axes3D -from matplotlib.collections import PolyCollection -import matplotlib.pyplot as plt -from matplotlib import colors as mcolors -import numpy as np - - -fig = plt.figure() -ax = fig.gca(projection='3d') - - -def cc(arg): - return mcolors.to_rgba(arg, alpha=0.6) - -xs = np.arange(0, 10, 0.4) -verts = [] -zs = [0.0, 1.0, 2.0, 3.0] -for z in zs: - ys = np.random.rand(len(xs)) - ys[0], ys[-1] = 0, 0 - verts.append(list(zip(xs, ys))) - -poly = PolyCollection(verts, facecolors=[cc('r'), cc('g'), cc('b'), - cc('y')]) -poly.set_alpha(0.7) -ax.add_collection3d(poly, zs=zs, zdir='y') - -ax.set_xlabel('X') -ax.set_xlim3d(0, 10) -ax.set_ylabel('Y') -ax.set_ylim3d(-1, 4) -ax.set_zlabel('Z') -ax.set_zlim3d(0, 1) - -plt.show() diff --git a/mpl_examples/mplot3d/quiver3d_demo.hires.png b/mpl_examples/mplot3d/quiver3d_demo.hires.png deleted file mode 100644 index 511ae6575dd..00000000000 Binary files a/mpl_examples/mplot3d/quiver3d_demo.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/quiver3d_demo.pdf b/mpl_examples/mplot3d/quiver3d_demo.pdf deleted file mode 100644 index dbbc0e814a0..00000000000 Binary files a/mpl_examples/mplot3d/quiver3d_demo.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/quiver3d_demo.png b/mpl_examples/mplot3d/quiver3d_demo.png deleted file mode 100644 index f3a6e2a5383..00000000000 Binary files a/mpl_examples/mplot3d/quiver3d_demo.png and /dev/null differ diff --git a/mpl_examples/mplot3d/quiver3d_demo.py b/mpl_examples/mplot3d/quiver3d_demo.py deleted file mode 100644 index 16ba7eab019..00000000000 --- a/mpl_examples/mplot3d/quiver3d_demo.py +++ /dev/null @@ -1,29 +0,0 @@ -''' -============== -3D quiver plot -============== - -Demonstrates plotting directional arrows at points on a 3d meshgrid. -''' - -from mpl_toolkits.mplot3d import axes3d -import matplotlib.pyplot as plt -import numpy as np - -fig = plt.figure() -ax = fig.gca(projection='3d') - -# Make the grid -x, y, z = np.meshgrid(np.arange(-0.8, 1, 0.2), - np.arange(-0.8, 1, 0.2), - np.arange(-0.8, 1, 0.8)) - -# Make the direction data for the arrows -u = np.sin(np.pi * x) * np.cos(np.pi * y) * np.cos(np.pi * z) -v = -np.cos(np.pi * x) * np.sin(np.pi * y) * np.cos(np.pi * z) -w = (np.sqrt(2.0 / 3.0) * np.cos(np.pi * x) * np.cos(np.pi * y) * - np.sin(np.pi * z)) - -ax.quiver(x, y, z, u, v, w, length=0.1, normalize=True) - -plt.show() diff --git a/mpl_examples/mplot3d/rotate_axes3d_demo.hires.png b/mpl_examples/mplot3d/rotate_axes3d_demo.hires.png deleted file mode 100644 index 2f0a603ed3c..00000000000 Binary files a/mpl_examples/mplot3d/rotate_axes3d_demo.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/rotate_axes3d_demo.pdf b/mpl_examples/mplot3d/rotate_axes3d_demo.pdf deleted file mode 100644 index e3639e61ee9..00000000000 Binary files a/mpl_examples/mplot3d/rotate_axes3d_demo.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/rotate_axes3d_demo.png b/mpl_examples/mplot3d/rotate_axes3d_demo.png deleted file mode 100644 index eb6f793269f..00000000000 Binary files a/mpl_examples/mplot3d/rotate_axes3d_demo.png and /dev/null differ diff --git a/mpl_examples/mplot3d/rotate_axes3d_demo.py b/mpl_examples/mplot3d/rotate_axes3d_demo.py deleted file mode 100644 index aa12f3ce9a9..00000000000 --- a/mpl_examples/mplot3d/rotate_axes3d_demo.py +++ /dev/null @@ -1,25 +0,0 @@ -''' -================== -Rotating a 3D plot -================== - -A very simple animation of a rotating 3D plot. - -See wire3d_animation_demo for another simple example of animating a 3D plot. -''' - -from mpl_toolkits.mplot3d import axes3d -import matplotlib.pyplot as plt - -fig = plt.figure() -ax = fig.add_subplot(111, projection='3d') - -# load some test data for demonstration and plot a wireframe -X, Y, Z = axes3d.get_test_data(0.1) -ax.plot_wireframe(X, Y, Z, rstride=5, cstride=5) - -# rotate the axes and update -for angle in range(0, 360): - ax.view_init(30, angle) - plt.draw() - plt.pause(.001) diff --git a/mpl_examples/mplot3d/scatter3d_demo.hires.png b/mpl_examples/mplot3d/scatter3d_demo.hires.png deleted file mode 100644 index 160e3b29e97..00000000000 Binary files a/mpl_examples/mplot3d/scatter3d_demo.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/scatter3d_demo.pdf b/mpl_examples/mplot3d/scatter3d_demo.pdf deleted file mode 100644 index 135fe37cc9b..00000000000 Binary files a/mpl_examples/mplot3d/scatter3d_demo.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/scatter3d_demo.png b/mpl_examples/mplot3d/scatter3d_demo.png deleted file mode 100644 index af08326f1ca..00000000000 Binary files a/mpl_examples/mplot3d/scatter3d_demo.png and /dev/null differ diff --git a/mpl_examples/mplot3d/scatter3d_demo.py b/mpl_examples/mplot3d/scatter3d_demo.py deleted file mode 100644 index 21f4932b80a..00000000000 --- a/mpl_examples/mplot3d/scatter3d_demo.py +++ /dev/null @@ -1,38 +0,0 @@ -''' -============== -3D scatterplot -============== - -Demonstration of a basic scatterplot in 3D. -''' - -from mpl_toolkits.mplot3d import Axes3D -import matplotlib.pyplot as plt -import numpy as np - - -def randrange(n, vmin, vmax): - ''' - Helper function to make an array of random numbers having shape (n, ) - with each number distributed Uniform(vmin, vmax). - ''' - return (vmax - vmin)*np.random.rand(n) + vmin - -fig = plt.figure() -ax = fig.add_subplot(111, projection='3d') - -n = 100 - -# For each set of style and range settings, plot n random points in the box -# defined by x in [23, 32], y in [0, 100], z in [zlow, zhigh]. -for c, m, zlow, zhigh in [('r', 'o', -50, -25), ('b', '^', -30, -5)]: - xs = randrange(n, 23, 32) - ys = randrange(n, 0, 100) - zs = randrange(n, zlow, zhigh) - ax.scatter(xs, ys, zs, c=c, marker=m) - -ax.set_xlabel('X Label') -ax.set_ylabel('Y Label') -ax.set_zlabel('Z Label') - -plt.show() diff --git a/mpl_examples/mplot3d/subplot3d_demo.hires.png b/mpl_examples/mplot3d/subplot3d_demo.hires.png deleted file mode 100644 index c9743cf0803..00000000000 Binary files a/mpl_examples/mplot3d/subplot3d_demo.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/subplot3d_demo.pdf b/mpl_examples/mplot3d/subplot3d_demo.pdf deleted file mode 100644 index 00a3810800e..00000000000 Binary files a/mpl_examples/mplot3d/subplot3d_demo.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/subplot3d_demo.png b/mpl_examples/mplot3d/subplot3d_demo.png deleted file mode 100644 index b8430a49fda..00000000000 Binary files a/mpl_examples/mplot3d/subplot3d_demo.png and /dev/null differ diff --git a/mpl_examples/mplot3d/subplot3d_demo.py b/mpl_examples/mplot3d/subplot3d_demo.py deleted file mode 100644 index 9ece9f7ddc0..00000000000 --- a/mpl_examples/mplot3d/subplot3d_demo.py +++ /dev/null @@ -1,45 +0,0 @@ -''' -==================== -3D plots as subplots -==================== - -Demonstrate including 3D plots as subplots. -''' - -import matplotlib.pyplot as plt -from mpl_toolkits.mplot3d.axes3d import Axes3D, get_test_data -from matplotlib import cm -import numpy as np - - -# set up a figure twice as wide as it is tall -fig = plt.figure(figsize=plt.figaspect(0.5)) - -#=============== -# First subplot -#=============== -# set up the axes for the first plot -ax = fig.add_subplot(1, 2, 1, projection='3d') - -# plot a 3D surface like in the example mplot3d/surface3d_demo -X = np.arange(-5, 5, 0.25) -Y = np.arange(-5, 5, 0.25) -X, Y = np.meshgrid(X, Y) -R = np.sqrt(X**2 + Y**2) -Z = np.sin(R) -surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.coolwarm, - linewidth=0, antialiased=False) -ax.set_zlim(-1.01, 1.01) -fig.colorbar(surf, shrink=0.5, aspect=10) - -#=============== -# Second subplot -#=============== -# set up the axes for the second plot -ax = fig.add_subplot(1, 2, 2, projection='3d') - -# plot a 3D wireframe like in the example mplot3d/wire3d_demo -X, Y, Z = get_test_data(0.05) -ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10) - -plt.show() diff --git a/mpl_examples/mplot3d/surface3d_demo.hires.png b/mpl_examples/mplot3d/surface3d_demo.hires.png deleted file mode 100644 index 4a153c2bd76..00000000000 Binary files a/mpl_examples/mplot3d/surface3d_demo.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/surface3d_demo.pdf b/mpl_examples/mplot3d/surface3d_demo.pdf deleted file mode 100644 index 50561cf82d8..00000000000 Binary files a/mpl_examples/mplot3d/surface3d_demo.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/surface3d_demo.png b/mpl_examples/mplot3d/surface3d_demo.png deleted file mode 100644 index 086d98f337c..00000000000 Binary files a/mpl_examples/mplot3d/surface3d_demo.png and /dev/null differ diff --git a/mpl_examples/mplot3d/surface3d_demo.py b/mpl_examples/mplot3d/surface3d_demo.py deleted file mode 100644 index 44133c271c0..00000000000 --- a/mpl_examples/mplot3d/surface3d_demo.py +++ /dev/null @@ -1,42 +0,0 @@ -''' -====================== -3D surface (color map) -====================== - -Demonstrates plotting a 3D surface colored with the coolwarm color map. -The surface is made opaque by using antialiased=False. - -Also demonstrates using the LinearLocator and custom formatting for the -z axis tick labels. -''' - -from mpl_toolkits.mplot3d import Axes3D -import matplotlib.pyplot as plt -from matplotlib import cm -from matplotlib.ticker import LinearLocator, FormatStrFormatter -import numpy as np - - -fig = plt.figure() -ax = fig.gca(projection='3d') - -# Make data. -X = np.arange(-5, 5, 0.25) -Y = np.arange(-5, 5, 0.25) -X, Y = np.meshgrid(X, Y) -R = np.sqrt(X**2 + Y**2) -Z = np.sin(R) - -# Plot the surface. -surf = ax.plot_surface(X, Y, Z, cmap=cm.coolwarm, - linewidth=0, antialiased=False) - -# Customize the z axis. -ax.set_zlim(-1.01, 1.01) -ax.zaxis.set_major_locator(LinearLocator(10)) -ax.zaxis.set_major_formatter(FormatStrFormatter('%.02f')) - -# Add a color bar which maps values to colors. -fig.colorbar(surf, shrink=0.5, aspect=5) - -plt.show() diff --git a/mpl_examples/mplot3d/surface3d_demo2.hires.png b/mpl_examples/mplot3d/surface3d_demo2.hires.png deleted file mode 100644 index 5a90b393735..00000000000 Binary files a/mpl_examples/mplot3d/surface3d_demo2.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/surface3d_demo2.pdf b/mpl_examples/mplot3d/surface3d_demo2.pdf deleted file mode 100644 index 740ddafe202..00000000000 Binary files a/mpl_examples/mplot3d/surface3d_demo2.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/surface3d_demo2.png b/mpl_examples/mplot3d/surface3d_demo2.png deleted file mode 100644 index b2d9144da2d..00000000000 Binary files a/mpl_examples/mplot3d/surface3d_demo2.png and /dev/null differ diff --git a/mpl_examples/mplot3d/surface3d_demo2.py b/mpl_examples/mplot3d/surface3d_demo2.py deleted file mode 100644 index bfc60ae563a..00000000000 --- a/mpl_examples/mplot3d/surface3d_demo2.py +++ /dev/null @@ -1,27 +0,0 @@ -''' -======================== -3D surface (solid color) -======================== - -Demonstrates a very basic plot of a 3D surface using a solid color. -''' - -from mpl_toolkits.mplot3d import Axes3D -import matplotlib.pyplot as plt -import numpy as np - - -fig = plt.figure() -ax = fig.add_subplot(111, projection='3d') - -# Make data -u = np.linspace(0, 2 * np.pi, 100) -v = np.linspace(0, np.pi, 100) -x = 10 * np.outer(np.cos(u), np.sin(v)) -y = 10 * np.outer(np.sin(u), np.sin(v)) -z = 10 * np.outer(np.ones(np.size(u)), np.cos(v)) - -# Plot the surface -ax.plot_surface(x, y, z, color='b') - -plt.show() diff --git a/mpl_examples/mplot3d/surface3d_demo3.hires.png b/mpl_examples/mplot3d/surface3d_demo3.hires.png deleted file mode 100644 index 6729f078c34..00000000000 Binary files a/mpl_examples/mplot3d/surface3d_demo3.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/surface3d_demo3.pdf b/mpl_examples/mplot3d/surface3d_demo3.pdf deleted file mode 100644 index 6e33a005880..00000000000 Binary files a/mpl_examples/mplot3d/surface3d_demo3.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/surface3d_demo3.png b/mpl_examples/mplot3d/surface3d_demo3.png deleted file mode 100644 index 979243d14ab..00000000000 Binary files a/mpl_examples/mplot3d/surface3d_demo3.png and /dev/null differ diff --git a/mpl_examples/mplot3d/surface3d_demo3.py b/mpl_examples/mplot3d/surface3d_demo3.py deleted file mode 100644 index 06ab93ab0a2..00000000000 --- a/mpl_examples/mplot3d/surface3d_demo3.py +++ /dev/null @@ -1,43 +0,0 @@ -''' -========================= -3D surface (checkerboard) -========================= - -Demonstrates plotting a 3D surface colored in a checkerboard pattern. -''' - -from mpl_toolkits.mplot3d import Axes3D -import matplotlib.pyplot as plt -from matplotlib import cm -from matplotlib.ticker import LinearLocator -import numpy as np - - -fig = plt.figure() -ax = fig.gca(projection='3d') - -# Make data. -X = np.arange(-5, 5, 0.25) -xlen = len(X) -Y = np.arange(-5, 5, 0.25) -ylen = len(Y) -X, Y = np.meshgrid(X, Y) -R = np.sqrt(X**2 + Y**2) -Z = np.sin(R) - -# Create an empty array of strings with the same shape as the meshgrid, and -# populate it with two colors in a checkerboard pattern. -colortuple = ('y', 'b') -colors = np.empty(X.shape, dtype=str) -for y in range(ylen): - for x in range(xlen): - colors[x, y] = colortuple[(x + y) % len(colortuple)] - -# Plot the surface with face colors taken from the array we made. -surf = ax.plot_surface(X, Y, Z, facecolors=colors, linewidth=0) - -# Customize the z axis. -ax.set_zlim(-1, 1) -ax.w_zaxis.set_major_locator(LinearLocator(6)) - -plt.show() diff --git a/mpl_examples/mplot3d/surface3d_radial_demo.hires.png b/mpl_examples/mplot3d/surface3d_radial_demo.hires.png deleted file mode 100644 index 4c0b4875b66..00000000000 Binary files a/mpl_examples/mplot3d/surface3d_radial_demo.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/surface3d_radial_demo.pdf b/mpl_examples/mplot3d/surface3d_radial_demo.pdf deleted file mode 100644 index 716e9afe9ca..00000000000 Binary files a/mpl_examples/mplot3d/surface3d_radial_demo.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/surface3d_radial_demo.png b/mpl_examples/mplot3d/surface3d_radial_demo.png deleted file mode 100644 index 183ce8c95d5..00000000000 Binary files a/mpl_examples/mplot3d/surface3d_radial_demo.png and /dev/null differ diff --git a/mpl_examples/mplot3d/surface3d_radial_demo.py b/mpl_examples/mplot3d/surface3d_radial_demo.py deleted file mode 100644 index b5830c359b8..00000000000 --- a/mpl_examples/mplot3d/surface3d_radial_demo.py +++ /dev/null @@ -1,39 +0,0 @@ -''' -================================= -3D surface with polar coordinates -================================= - -Demonstrates plotting a surface defined in polar coordinates. -Uses the reversed version of the YlGnBu color map. -Also demonstrates writing axis labels with latex math mode. - -Example contributed by Armin Moser. -''' - -from mpl_toolkits.mplot3d import Axes3D -from matplotlib import pyplot as plt -import numpy as np - - -fig = plt.figure() -ax = fig.add_subplot(111, projection='3d') - -# Create the mesh in polar coordinates and compute corresponding Z. -r = np.linspace(0, 1.25, 50) -p = np.linspace(0, 2*np.pi, 50) -R, P = np.meshgrid(r, p) -Z = ((R**2 - 1)**2) - -# Express the mesh in the cartesian system. -X, Y = R*np.cos(P), R*np.sin(P) - -# Plot the surface. -ax.plot_surface(X, Y, Z, cmap=plt.cm.YlGnBu_r) - -# Tweak the limits and add latex math labels. -ax.set_zlim(0, 1) -ax.set_xlabel(r'$\phi_\mathrm{real}$') -ax.set_ylabel(r'$\phi_\mathrm{im}$') -ax.set_zlabel(r'$V(\phi)$') - -plt.show() diff --git a/mpl_examples/mplot3d/text3d_demo.hires.png b/mpl_examples/mplot3d/text3d_demo.hires.png deleted file mode 100644 index a9c8a1ae022..00000000000 Binary files a/mpl_examples/mplot3d/text3d_demo.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/text3d_demo.pdf b/mpl_examples/mplot3d/text3d_demo.pdf deleted file mode 100644 index 4b1bc09acec..00000000000 Binary files a/mpl_examples/mplot3d/text3d_demo.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/text3d_demo.png b/mpl_examples/mplot3d/text3d_demo.png deleted file mode 100644 index 003e1c09cfc..00000000000 Binary files a/mpl_examples/mplot3d/text3d_demo.png and /dev/null differ diff --git a/mpl_examples/mplot3d/text3d_demo.py b/mpl_examples/mplot3d/text3d_demo.py deleted file mode 100644 index 6b1963e2a43..00000000000 --- a/mpl_examples/mplot3d/text3d_demo.py +++ /dev/null @@ -1,47 +0,0 @@ -''' -====================== -Text annotations in 3D -====================== - -Demonstrates the placement of text annotations on a 3D plot. - -Functionality shown: -- Using the text function with three types of 'zdir' values: None, - an axis name (ex. 'x'), or a direction tuple (ex. (1, 1, 0)). -- Using the text function with the color keyword. -- Using the text2D function to place text on a fixed position on the ax object. -''' - -from mpl_toolkits.mplot3d import Axes3D -import matplotlib.pyplot as plt - - -fig = plt.figure() -ax = fig.gca(projection='3d') - -# Demo 1: zdir -zdirs = (None, 'x', 'y', 'z', (1, 1, 0), (1, 1, 1)) -xs = (1, 4, 4, 9, 4, 1) -ys = (2, 5, 8, 10, 1, 2) -zs = (10, 3, 8, 9, 1, 8) - -for zdir, x, y, z in zip(zdirs, xs, ys, zs): - label = '(%d, %d, %d), dir=%s' % (x, y, z, zdir) - ax.text(x, y, z, label, zdir) - -# Demo 2: color -ax.text(9, 0, 0, "red", color='red') - -# Demo 3: text2D -# Placement 0, 0 would be the bottom left, 1, 1 would be the top right. -ax.text2D(0.05, 0.95, "2D Text", transform=ax.transAxes) - -# Tweaking display region and labels -ax.set_xlim(0, 10) -ax.set_ylim(0, 10) -ax.set_zlim(0, 10) -ax.set_xlabel('X axis') -ax.set_ylabel('Y axis') -ax.set_zlabel('Z axis') - -plt.show() diff --git a/mpl_examples/mplot3d/tricontour3d_demo.hires.png b/mpl_examples/mplot3d/tricontour3d_demo.hires.png deleted file mode 100644 index a400d49e032..00000000000 Binary files a/mpl_examples/mplot3d/tricontour3d_demo.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/tricontour3d_demo.pdf b/mpl_examples/mplot3d/tricontour3d_demo.pdf deleted file mode 100644 index 7884a2fe062..00000000000 Binary files a/mpl_examples/mplot3d/tricontour3d_demo.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/tricontour3d_demo.png b/mpl_examples/mplot3d/tricontour3d_demo.png deleted file mode 100644 index 52f456ee0e2..00000000000 Binary files a/mpl_examples/mplot3d/tricontour3d_demo.png and /dev/null differ diff --git a/mpl_examples/mplot3d/tricontour3d_demo.py b/mpl_examples/mplot3d/tricontour3d_demo.py deleted file mode 100644 index f78ff63c853..00000000000 --- a/mpl_examples/mplot3d/tricontour3d_demo.py +++ /dev/null @@ -1,47 +0,0 @@ -""" -========================== -Triangular 3D contour plot -========================== - -Contour plots of unstructured triangular grids. - -The data used is the same as in the second plot of trisurf3d_demo2. -tricontourf3d_demo shows the filled version of this example. -""" - -import matplotlib.pyplot as plt -from mpl_toolkits.mplot3d import Axes3D -import matplotlib.tri as tri -import numpy as np - -n_angles = 48 -n_radii = 8 -min_radius = 0.25 - -# Create the mesh in polar coordinates and compute x, y, z. -radii = np.linspace(min_radius, 0.95, n_radii) -angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False) -angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) -angles[:, 1::2] += np.pi/n_angles - -x = (radii*np.cos(angles)).flatten() -y = (radii*np.sin(angles)).flatten() -z = (np.cos(radii)*np.cos(angles*3.0)).flatten() - -# Create a custom triangulation. -triang = tri.Triangulation(x, y) - -# Mask off unwanted triangles. -xmid = x[triang.triangles].mean(axis=1) -ymid = y[triang.triangles].mean(axis=1) -mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0) -triang.set_mask(mask) - -fig = plt.figure() -ax = fig.gca(projection='3d') -ax.tricontour(triang, z, cmap=plt.cm.CMRmap) - -# Customize the view angle so it's easier to understand the plot. -ax.view_init(elev=45.) - -plt.show() diff --git a/mpl_examples/mplot3d/tricontourf3d_demo.hires.png b/mpl_examples/mplot3d/tricontourf3d_demo.hires.png deleted file mode 100644 index ea5c5c30702..00000000000 Binary files a/mpl_examples/mplot3d/tricontourf3d_demo.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/tricontourf3d_demo.pdf b/mpl_examples/mplot3d/tricontourf3d_demo.pdf deleted file mode 100644 index 0dc6b89a2a3..00000000000 Binary files a/mpl_examples/mplot3d/tricontourf3d_demo.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/tricontourf3d_demo.png b/mpl_examples/mplot3d/tricontourf3d_demo.png deleted file mode 100644 index 0ce5378982d..00000000000 Binary files a/mpl_examples/mplot3d/tricontourf3d_demo.png and /dev/null differ diff --git a/mpl_examples/mplot3d/tricontourf3d_demo.py b/mpl_examples/mplot3d/tricontourf3d_demo.py deleted file mode 100644 index 27513f2bd5c..00000000000 --- a/mpl_examples/mplot3d/tricontourf3d_demo.py +++ /dev/null @@ -1,48 +0,0 @@ -""" -================================= -Triangular 3D filled contour plot -================================= - -Filled contour plots of unstructured triangular grids. - -The data used is the same as in the second plot of trisurf3d_demo2. -tricontour3d_demo shows the unfilled version of this example. -""" - -import matplotlib.pyplot as plt -from mpl_toolkits.mplot3d import Axes3D -import matplotlib.tri as tri -import numpy as np - -# First create the x, y, z coordinates of the points. -n_angles = 48 -n_radii = 8 -min_radius = 0.25 - -# Create the mesh in polar coordinates and compute x, y, z. -radii = np.linspace(min_radius, 0.95, n_radii) -angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False) -angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) -angles[:, 1::2] += np.pi/n_angles - -x = (radii*np.cos(angles)).flatten() -y = (radii*np.sin(angles)).flatten() -z = (np.cos(radii)*np.cos(angles*3.0)).flatten() - -# Create a custom triangulation. -triang = tri.Triangulation(x, y) - -# Mask off unwanted triangles. -xmid = x[triang.triangles].mean(axis=1) -ymid = y[triang.triangles].mean(axis=1) -mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0) -triang.set_mask(mask) - -fig = plt.figure() -ax = fig.gca(projection='3d') -ax.tricontourf(triang, z, cmap=plt.cm.CMRmap) - -# Customize the view angle so it's easier to understand the plot. -ax.view_init(elev=45.) - -plt.show() diff --git a/mpl_examples/mplot3d/trisurf3d_demo.hires.png b/mpl_examples/mplot3d/trisurf3d_demo.hires.png deleted file mode 100644 index 42bd05c0582..00000000000 Binary files a/mpl_examples/mplot3d/trisurf3d_demo.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/trisurf3d_demo.pdf b/mpl_examples/mplot3d/trisurf3d_demo.pdf deleted file mode 100644 index 1d397f6b2b4..00000000000 Binary files a/mpl_examples/mplot3d/trisurf3d_demo.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/trisurf3d_demo.png b/mpl_examples/mplot3d/trisurf3d_demo.png deleted file mode 100644 index de2902d8226..00000000000 Binary files a/mpl_examples/mplot3d/trisurf3d_demo.png and /dev/null differ diff --git a/mpl_examples/mplot3d/trisurf3d_demo.py b/mpl_examples/mplot3d/trisurf3d_demo.py deleted file mode 100644 index 192d4eb8aa0..00000000000 --- a/mpl_examples/mplot3d/trisurf3d_demo.py +++ /dev/null @@ -1,38 +0,0 @@ -''' -====================== -Triangular 3D surfaces -====================== - -Plot a 3D surface with a triangular mesh. -''' - -from mpl_toolkits.mplot3d import Axes3D -import matplotlib.pyplot as plt -import numpy as np - - -n_radii = 8 -n_angles = 36 - -# Make radii and angles spaces (radius r=0 omitted to eliminate duplication). -radii = np.linspace(0.125, 1.0, n_radii) -angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False) - -# Repeat all angles for each radius. -angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) - -# Convert polar (radii, angles) coords to cartesian (x, y) coords. -# (0, 0) is manually added at this stage, so there will be no duplicate -# points in the (x, y) plane. -x = np.append(0, (radii*np.cos(angles)).flatten()) -y = np.append(0, (radii*np.sin(angles)).flatten()) - -# Compute z to make the pringle surface. -z = np.sin(-x*y) - -fig = plt.figure() -ax = fig.gca(projection='3d') - -ax.plot_trisurf(x, y, z, linewidth=0.2, antialiased=True) - -plt.show() diff --git a/mpl_examples/mplot3d/trisurf3d_demo2.pdf b/mpl_examples/mplot3d/trisurf3d_demo2.pdf deleted file mode 100644 index 59f7e9bcc44..00000000000 Binary files a/mpl_examples/mplot3d/trisurf3d_demo2.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/trisurf3d_demo2.png b/mpl_examples/mplot3d/trisurf3d_demo2.png deleted file mode 100644 index 28a7dac87e8..00000000000 Binary files a/mpl_examples/mplot3d/trisurf3d_demo2.png and /dev/null differ diff --git a/mpl_examples/mplot3d/trisurf3d_demo2.py b/mpl_examples/mplot3d/trisurf3d_demo2.py deleted file mode 100644 index 3a6677c76c0..00000000000 --- a/mpl_examples/mplot3d/trisurf3d_demo2.py +++ /dev/null @@ -1,80 +0,0 @@ -''' -=========================== -More triangular 3D surfaces -=========================== - -Two additional examples of plotting surfaces with triangular mesh. - -The first demonstrates use of plot_trisurf's triangles argument, and the -second sets a Triangulation object's mask and passes the object directly -to plot_trisurf. -''' - -import numpy as np -import matplotlib.pyplot as plt -from mpl_toolkits.mplot3d import Axes3D -import matplotlib.tri as mtri - - -fig = plt.figure(figsize=plt.figaspect(0.5)) - -#============ -# First plot -#============ - -# Make a mesh in the space of parameterisation variables u and v -u = np.linspace(0, 2.0 * np.pi, endpoint=True, num=50) -v = np.linspace(-0.5, 0.5, endpoint=True, num=10) -u, v = np.meshgrid(u, v) -u, v = u.flatten(), v.flatten() - -# This is the Mobius mapping, taking a u, v pair and returning an x, y, z -# triple -x = (1 + 0.5 * v * np.cos(u / 2.0)) * np.cos(u) -y = (1 + 0.5 * v * np.cos(u / 2.0)) * np.sin(u) -z = 0.5 * v * np.sin(u / 2.0) - -# Triangulate parameter space to determine the triangles -tri = mtri.Triangulation(u, v) - -# Plot the surface. The triangles in parameter space determine which x, y, z -# points are connected by an edge. -ax = fig.add_subplot(1, 2, 1, projection='3d') -ax.plot_trisurf(x, y, z, triangles=tri.triangles, cmap=plt.cm.Spectral) -ax.set_zlim(-1, 1) - - -#============ -# Second plot -#============ - -# Make parameter spaces radii and angles. -n_angles = 36 -n_radii = 8 -min_radius = 0.25 -radii = np.linspace(min_radius, 0.95, n_radii) - -angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False) -angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) -angles[:, 1::2] += np.pi/n_angles - -# Map radius, angle pairs to x, y, z points. -x = (radii*np.cos(angles)).flatten() -y = (radii*np.sin(angles)).flatten() -z = (np.cos(radii)*np.cos(angles*3.0)).flatten() - -# Create the Triangulation; no triangles so Delaunay triangulation created. -triang = mtri.Triangulation(x, y) - -# Mask off unwanted triangles. -xmid = x[triang.triangles].mean(axis=1) -ymid = y[triang.triangles].mean(axis=1) -mask = np.where(xmid**2 + ymid**2 < min_radius**2, 1, 0) -triang.set_mask(mask) - -# Plot the surface. -ax = fig.add_subplot(1, 2, 2, projection='3d') -ax.plot_trisurf(triang, z, cmap=plt.cm.CMRmap) - - -plt.show() diff --git a/mpl_examples/mplot3d/trisurf3d_demo2_00.hires.png b/mpl_examples/mplot3d/trisurf3d_demo2_00.hires.png deleted file mode 100644 index dcdf67ee8ec..00000000000 Binary files a/mpl_examples/mplot3d/trisurf3d_demo2_00.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/trisurf3d_demo2_00.pdf b/mpl_examples/mplot3d/trisurf3d_demo2_00.pdf deleted file mode 100644 index d52562efd4d..00000000000 Binary files a/mpl_examples/mplot3d/trisurf3d_demo2_00.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/trisurf3d_demo2_00.png b/mpl_examples/mplot3d/trisurf3d_demo2_00.png deleted file mode 100644 index 304de6b1729..00000000000 Binary files a/mpl_examples/mplot3d/trisurf3d_demo2_00.png and /dev/null differ diff --git a/mpl_examples/mplot3d/trisurf3d_demo2_01.hires.png b/mpl_examples/mplot3d/trisurf3d_demo2_01.hires.png deleted file mode 100644 index aad71789036..00000000000 Binary files a/mpl_examples/mplot3d/trisurf3d_demo2_01.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/trisurf3d_demo2_01.pdf b/mpl_examples/mplot3d/trisurf3d_demo2_01.pdf deleted file mode 100644 index e2ed89ccfda..00000000000 Binary files a/mpl_examples/mplot3d/trisurf3d_demo2_01.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/trisurf3d_demo2_01.png b/mpl_examples/mplot3d/trisurf3d_demo2_01.png deleted file mode 100644 index 4acbf6b99b4..00000000000 Binary files a/mpl_examples/mplot3d/trisurf3d_demo2_01.png and /dev/null differ diff --git a/mpl_examples/mplot3d/wire3d_animation_demo.hires.png b/mpl_examples/mplot3d/wire3d_animation_demo.hires.png deleted file mode 100644 index d8f78b6154c..00000000000 Binary files a/mpl_examples/mplot3d/wire3d_animation_demo.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/wire3d_animation_demo.pdf b/mpl_examples/mplot3d/wire3d_animation_demo.pdf deleted file mode 100644 index 605d49159e7..00000000000 Binary files a/mpl_examples/mplot3d/wire3d_animation_demo.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/wire3d_animation_demo.png b/mpl_examples/mplot3d/wire3d_animation_demo.png deleted file mode 100644 index a449c813462..00000000000 Binary files a/mpl_examples/mplot3d/wire3d_animation_demo.png and /dev/null differ diff --git a/mpl_examples/mplot3d/wire3d_animation_demo.py b/mpl_examples/mplot3d/wire3d_animation_demo.py deleted file mode 100644 index 1083f006436..00000000000 --- a/mpl_examples/mplot3d/wire3d_animation_demo.py +++ /dev/null @@ -1,49 +0,0 @@ -""" -========================== -Rotating 3D wireframe plot -========================== - -A very simple 'animation' of a 3D plot. See also rotate_axes3d_demo. -""" - -from __future__ import print_function - -from mpl_toolkits.mplot3d import axes3d -import matplotlib.pyplot as plt -import numpy as np -import time - - -def generate(X, Y, phi): - ''' - Generates Z data for the points in the X, Y meshgrid and parameter phi. - ''' - R = 1 - np.sqrt(X**2 + Y**2) - return np.cos(2 * np.pi * X + phi) * R - - -fig = plt.figure() -ax = fig.add_subplot(111, projection='3d') - -# Make the X, Y meshgrid. -xs = np.linspace(-1, 1, 50) -ys = np.linspace(-1, 1, 50) -X, Y = np.meshgrid(xs, ys) - -# Set the z axis limits so they aren't recalculated each frame. -ax.set_zlim(-1, 1) - -# Begin plotting. -wframe = None -tstart = time.time() -for phi in np.linspace(0, 180. / np.pi, 100): - # If a line collection is already remove it before drawing. - if wframe: - ax.collections.remove(wframe) - - # Plot the new wireframe and pause briefly before continuing. - Z = generate(X, Y, phi) - wframe = ax.plot_wireframe(X, Y, Z, rstride=2, cstride=2) - plt.pause(.001) - -print('Average FPS: %f' % (100 / (time.time() - tstart))) diff --git a/mpl_examples/mplot3d/wire3d_demo.hires.png b/mpl_examples/mplot3d/wire3d_demo.hires.png deleted file mode 100644 index e3d8d412a7e..00000000000 Binary files a/mpl_examples/mplot3d/wire3d_demo.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/wire3d_demo.pdf b/mpl_examples/mplot3d/wire3d_demo.pdf deleted file mode 100644 index acea96291e5..00000000000 Binary files a/mpl_examples/mplot3d/wire3d_demo.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/wire3d_demo.png b/mpl_examples/mplot3d/wire3d_demo.png deleted file mode 100644 index 51ea9300a3f..00000000000 Binary files a/mpl_examples/mplot3d/wire3d_demo.png and /dev/null differ diff --git a/mpl_examples/mplot3d/wire3d_demo.py b/mpl_examples/mplot3d/wire3d_demo.py deleted file mode 100644 index cd91cc57ac2..00000000000 --- a/mpl_examples/mplot3d/wire3d_demo.py +++ /dev/null @@ -1,22 +0,0 @@ -''' -================= -3D wireframe plot -================= - -A very basic demonstration of a wireframe plot. -''' - -from mpl_toolkits.mplot3d import axes3d -import matplotlib.pyplot as plt - - -fig = plt.figure() -ax = fig.add_subplot(111, projection='3d') - -# Grab some test data. -X, Y, Z = axes3d.get_test_data(0.05) - -# Plot a basic wireframe. -ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10) - -plt.show() diff --git a/mpl_examples/mplot3d/wire3d_zero_stride.hires.png b/mpl_examples/mplot3d/wire3d_zero_stride.hires.png deleted file mode 100644 index 9d75b2dc0e0..00000000000 Binary files a/mpl_examples/mplot3d/wire3d_zero_stride.hires.png and /dev/null differ diff --git a/mpl_examples/mplot3d/wire3d_zero_stride.pdf b/mpl_examples/mplot3d/wire3d_zero_stride.pdf deleted file mode 100644 index 3ca2d643153..00000000000 Binary files a/mpl_examples/mplot3d/wire3d_zero_stride.pdf and /dev/null differ diff --git a/mpl_examples/mplot3d/wire3d_zero_stride.png b/mpl_examples/mplot3d/wire3d_zero_stride.png deleted file mode 100644 index 6afce47a0b4..00000000000 Binary files a/mpl_examples/mplot3d/wire3d_zero_stride.png and /dev/null differ diff --git a/mpl_examples/mplot3d/wire3d_zero_stride.py b/mpl_examples/mplot3d/wire3d_zero_stride.py deleted file mode 100644 index 0eac7b70385..00000000000 --- a/mpl_examples/mplot3d/wire3d_zero_stride.py +++ /dev/null @@ -1,28 +0,0 @@ -''' -=================================== -3D wireframe plots in one direction -=================================== - -Demonstrates that setting rstride or cstride to 0 causes wires to not be -generated in the corresponding direction. -''' - -from mpl_toolkits.mplot3d import axes3d -import matplotlib.pyplot as plt - - -fig, [ax1, ax2] = plt.subplots(2, 1, figsize=(8, 12), subplot_kw={'projection': '3d'}) - -# Get the test data -X, Y, Z = axes3d.get_test_data(0.05) - -# Give the first plot only wireframes of the type y = c -ax1.plot_wireframe(X, Y, Z, rstride=10, cstride=0) -ax1.set_title("Column (x) stride set to 0") - -# Give the second plot only wireframes of the type x = c -ax2.plot_wireframe(X, Y, Z, rstride=0, cstride=10) -ax2.set_title("Row (y) stride set to 0") - -plt.tight_layout() -plt.show() diff --git a/mpl_examples/pie_and_polar_charts/pie_demo_features.pdf b/mpl_examples/pie_and_polar_charts/pie_demo_features.pdf deleted file mode 100644 index 0d80750569c..00000000000 Binary files a/mpl_examples/pie_and_polar_charts/pie_demo_features.pdf and /dev/null differ diff --git a/mpl_examples/pie_and_polar_charts/pie_demo_features.png b/mpl_examples/pie_and_polar_charts/pie_demo_features.png deleted file mode 100644 index 7f2127476e6..00000000000 Binary files a/mpl_examples/pie_and_polar_charts/pie_demo_features.png and /dev/null differ diff --git a/mpl_examples/pie_and_polar_charts/pie_demo_features.py b/mpl_examples/pie_and_polar_charts/pie_demo_features.py deleted file mode 100644 index 65b85b02320..00000000000 --- a/mpl_examples/pie_and_polar_charts/pie_demo_features.py +++ /dev/null @@ -1,35 +0,0 @@ -""" -=============== -Basic pie chart -=============== - -Demo of a basic pie chart plus a few additional features. - -In addition to the basic pie chart, this demo shows a few optional features: - - * slice labels - * auto-labeling the percentage - * offsetting a slice with "explode" - * drop-shadow - * custom start angle - -Note about the custom start angle: - -The default ``startangle`` is 0, which would start the "Frogs" slice on the -positive x-axis. This example sets ``startangle = 90`` such that everything is -rotated counter-clockwise by 90 degrees, and the frog slice starts on the -positive y-axis. -""" -import matplotlib.pyplot as plt - -# Pie chart, where the slices will be ordered and plotted counter-clockwise: -labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' -sizes = [15, 30, 45, 10] -explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs') - -fig1, ax1 = plt.subplots() -ax1.pie(sizes, explode=explode, labels=labels, autopct='%1.1f%%', - shadow=True, startangle=90) -ax1.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle. - -plt.show() diff --git a/mpl_examples/pie_and_polar_charts/pie_demo_features_00.hires.png b/mpl_examples/pie_and_polar_charts/pie_demo_features_00.hires.png deleted file mode 100644 index 89ae6ee233c..00000000000 Binary files a/mpl_examples/pie_and_polar_charts/pie_demo_features_00.hires.png and /dev/null differ diff --git a/mpl_examples/pie_and_polar_charts/pie_demo_features_00.pdf b/mpl_examples/pie_and_polar_charts/pie_demo_features_00.pdf deleted file mode 100644 index 7f93b6eda5a..00000000000 Binary files a/mpl_examples/pie_and_polar_charts/pie_demo_features_00.pdf and /dev/null differ diff --git a/mpl_examples/pie_and_polar_charts/pie_demo_features_00.png b/mpl_examples/pie_and_polar_charts/pie_demo_features_00.png deleted file mode 100644 index 8708e0e318e..00000000000 Binary files a/mpl_examples/pie_and_polar_charts/pie_demo_features_00.png and /dev/null differ diff --git a/mpl_examples/pie_and_polar_charts/pie_demo_features_01.hires.png b/mpl_examples/pie_and_polar_charts/pie_demo_features_01.hires.png deleted file mode 100644 index d0583fb2d60..00000000000 Binary files a/mpl_examples/pie_and_polar_charts/pie_demo_features_01.hires.png and /dev/null differ diff --git a/mpl_examples/pie_and_polar_charts/pie_demo_features_01.pdf b/mpl_examples/pie_and_polar_charts/pie_demo_features_01.pdf deleted file mode 100644 index 69cf6385d5e..00000000000 Binary files a/mpl_examples/pie_and_polar_charts/pie_demo_features_01.pdf and /dev/null differ diff --git a/mpl_examples/pie_and_polar_charts/pie_demo_features_01.png b/mpl_examples/pie_and_polar_charts/pie_demo_features_01.png deleted file mode 100644 index 33294c0cf16..00000000000 Binary files a/mpl_examples/pie_and_polar_charts/pie_demo_features_01.png and /dev/null differ diff --git a/mpl_examples/pie_and_polar_charts/polar_bar_demo.hires.png b/mpl_examples/pie_and_polar_charts/polar_bar_demo.hires.png deleted file mode 100644 index 4ef30ec53ed..00000000000 Binary files a/mpl_examples/pie_and_polar_charts/polar_bar_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pie_and_polar_charts/polar_bar_demo.pdf b/mpl_examples/pie_and_polar_charts/polar_bar_demo.pdf deleted file mode 100644 index 9344937cec1..00000000000 Binary files a/mpl_examples/pie_and_polar_charts/polar_bar_demo.pdf and /dev/null differ diff --git a/mpl_examples/pie_and_polar_charts/polar_bar_demo.png b/mpl_examples/pie_and_polar_charts/polar_bar_demo.png deleted file mode 100644 index 0559ebdbe39..00000000000 Binary files a/mpl_examples/pie_and_polar_charts/polar_bar_demo.png and /dev/null differ diff --git a/mpl_examples/pie_and_polar_charts/polar_bar_demo.py b/mpl_examples/pie_and_polar_charts/polar_bar_demo.py deleted file mode 100644 index 179278e57f9..00000000000 --- a/mpl_examples/pie_and_polar_charts/polar_bar_demo.py +++ /dev/null @@ -1,26 +0,0 @@ -""" -======================= -Pie chart on polar axis -======================= - -Demo of bar plot on a polar axis. -""" -import numpy as np -import matplotlib.pyplot as plt - - -# Compute pie slices -N = 20 -theta = np.linspace(0.0, 2 * np.pi, N, endpoint=False) -radii = 10 * np.random.rand(N) -width = np.pi / 4 * np.random.rand(N) - -ax = plt.subplot(111, projection='polar') -bars = ax.bar(theta, radii, width=width, bottom=0.0) - -# Use custom colors and opacity -for r, bar in zip(radii, bars): - bar.set_facecolor(plt.cm.viridis(r / 10.)) - bar.set_alpha(0.5) - -plt.show() diff --git a/mpl_examples/pie_and_polar_charts/polar_scatter_demo.hires.png b/mpl_examples/pie_and_polar_charts/polar_scatter_demo.hires.png deleted file mode 100644 index c90ffdc9f3d..00000000000 Binary files a/mpl_examples/pie_and_polar_charts/polar_scatter_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pie_and_polar_charts/polar_scatter_demo.pdf b/mpl_examples/pie_and_polar_charts/polar_scatter_demo.pdf deleted file mode 100644 index 78f14f1b22a..00000000000 Binary files a/mpl_examples/pie_and_polar_charts/polar_scatter_demo.pdf and /dev/null differ diff --git a/mpl_examples/pie_and_polar_charts/polar_scatter_demo.png b/mpl_examples/pie_and_polar_charts/polar_scatter_demo.png deleted file mode 100644 index 56596c82690..00000000000 Binary files a/mpl_examples/pie_and_polar_charts/polar_scatter_demo.png and /dev/null differ diff --git a/mpl_examples/pie_and_polar_charts/polar_scatter_demo.py b/mpl_examples/pie_and_polar_charts/polar_scatter_demo.py deleted file mode 100644 index af45b130841..00000000000 --- a/mpl_examples/pie_and_polar_charts/polar_scatter_demo.py +++ /dev/null @@ -1,25 +0,0 @@ -""" -========================== -Scatter plot on polar axis -========================== - -Demo of scatter plot on a polar axis. - -Size increases radially in this example and color increases with angle -(just to verify the symbols are being scattered correctly). -""" -import numpy as np -import matplotlib.pyplot as plt - - -# Compute areas and colors -N = 150 -r = 2 * np.random.rand(N) -theta = 2 * np.pi * np.random.rand(N) -area = 200 * r**2 -colors = theta - -ax = plt.subplot(111, projection='polar') -c = ax.scatter(theta, r, c=colors, s=area, cmap='hsv', alpha=0.75) - -plt.show() diff --git a/mpl_examples/pylab_examples/accented_text.hires.png b/mpl_examples/pylab_examples/accented_text.hires.png deleted file mode 100644 index 3363f89a120..00000000000 Binary files a/mpl_examples/pylab_examples/accented_text.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/accented_text.pdf b/mpl_examples/pylab_examples/accented_text.pdf deleted file mode 100644 index e8bcb28c5cc..00000000000 Binary files a/mpl_examples/pylab_examples/accented_text.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/accented_text.png b/mpl_examples/pylab_examples/accented_text.png deleted file mode 100644 index 7e1cf1b65da..00000000000 Binary files a/mpl_examples/pylab_examples/accented_text.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/accented_text.py b/mpl_examples/pylab_examples/accented_text.py deleted file mode 100644 index 16733a8060a..00000000000 --- a/mpl_examples/pylab_examples/accented_text.py +++ /dev/null @@ -1,21 +0,0 @@ -r""" -matplotlib supports accented characters via TeX mathtext - -The following accents are provided: \hat, \breve, \grave, \bar, -\acute, \tilde, \vec, \dot, \ddot. All of them have the same syntax, -e.g., to make an overbar you do \bar{o} or to make an o umlaut you do -\ddot{o}. The shortcuts are also provided, e.g.,: \"o \'e \`e \~n \.x -\^y - -""" -import matplotlib.pyplot as plt - -plt.axes([0.1, 0.15, 0.8, 0.75]) -plt.plot(range(10)) - -plt.title(r'$\ddot{o}\acute{e}\grave{e}\hat{O}\breve{i}\bar{A}\tilde{n}\vec{q}$', fontsize=20) -# shorthand is also supported and curly's are optional -plt.xlabel(r"""$\"o\ddot o \'e\`e\~n\.x\^y$""", fontsize=20) - - -plt.show() diff --git a/mpl_examples/pylab_examples/agg_buffer.hires.png b/mpl_examples/pylab_examples/agg_buffer.hires.png deleted file mode 100644 index d8180471fb5..00000000000 Binary files a/mpl_examples/pylab_examples/agg_buffer.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/agg_buffer.pdf b/mpl_examples/pylab_examples/agg_buffer.pdf deleted file mode 100644 index 09c174cd7f1..00000000000 Binary files a/mpl_examples/pylab_examples/agg_buffer.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/agg_buffer.png b/mpl_examples/pylab_examples/agg_buffer.png deleted file mode 100644 index ed310997139..00000000000 Binary files a/mpl_examples/pylab_examples/agg_buffer.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/agg_buffer.py b/mpl_examples/pylab_examples/agg_buffer.py deleted file mode 100644 index cf7042793ba..00000000000 --- a/mpl_examples/pylab_examples/agg_buffer.py +++ /dev/null @@ -1,39 +0,0 @@ -""" -Use backend agg to access the figure canvas as an RGB string and then -convert it to an array and pass it to Pillow for rendering. -""" - -import numpy as np - -import matplotlib.pyplot as plt -from matplotlib.backends.backend_agg import FigureCanvasAgg - - -try: - from PIL import Image -except ImportError: - raise SystemExit("Pillow must be installed to run this example") - -plt.plot([1, 2, 3]) - -canvas = plt.get_current_fig_manager().canvas - -agg = canvas.switch_backends(FigureCanvasAgg) -agg.draw() -s = agg.tostring_rgb() - -# get the width and the height to resize the matrix -l, b, w, h = agg.figure.bbox.bounds -w, h = int(w), int(h) - -X = np.fromstring(s, np.uint8) -X.shape = h, w, 3 - -try: - im = Image.fromstring("RGB", (w, h), s) -except Exception: - im = Image.frombytes("RGB", (w, h), s) - -# Uncomment this line to display the image using ImageMagick's -# `display` tool. -# im.show() diff --git a/mpl_examples/pylab_examples/agg_buffer_to_array.py b/mpl_examples/pylab_examples/agg_buffer_to_array.py deleted file mode 100644 index 6c94da1e4ad..00000000000 --- a/mpl_examples/pylab_examples/agg_buffer_to_array.py +++ /dev/null @@ -1,17 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - -# make an agg figure -fig, ax = plt.subplots() -ax.plot([1, 2, 3]) -ax.set_title('a simple figure') -fig.canvas.draw() - -# grab the pixel buffer and dump it into a numpy array -X = np.array(fig.canvas.renderer._renderer) - -# now display the array X as an Axes in a new figure -fig2 = plt.figure() -ax2 = fig2.add_subplot(111, frameon=False) -ax2.imshow(X) -plt.show() diff --git a/mpl_examples/pylab_examples/agg_buffer_to_array_00.hires.png b/mpl_examples/pylab_examples/agg_buffer_to_array_00.hires.png deleted file mode 100644 index ce306abdcba..00000000000 Binary files a/mpl_examples/pylab_examples/agg_buffer_to_array_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/agg_buffer_to_array_00.pdf b/mpl_examples/pylab_examples/agg_buffer_to_array_00.pdf deleted file mode 100644 index 1b718b634e7..00000000000 Binary files a/mpl_examples/pylab_examples/agg_buffer_to_array_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/agg_buffer_to_array_00.png b/mpl_examples/pylab_examples/agg_buffer_to_array_00.png deleted file mode 100644 index 8b5bf2e0d1b..00000000000 Binary files a/mpl_examples/pylab_examples/agg_buffer_to_array_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/agg_buffer_to_array_01.hires.png b/mpl_examples/pylab_examples/agg_buffer_to_array_01.hires.png deleted file mode 100644 index bb486c2a2e3..00000000000 Binary files a/mpl_examples/pylab_examples/agg_buffer_to_array_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/agg_buffer_to_array_01.pdf b/mpl_examples/pylab_examples/agg_buffer_to_array_01.pdf deleted file mode 100644 index 124d781f3d0..00000000000 Binary files a/mpl_examples/pylab_examples/agg_buffer_to_array_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/agg_buffer_to_array_01.png b/mpl_examples/pylab_examples/agg_buffer_to_array_01.png deleted file mode 100644 index b3df5233d78..00000000000 Binary files a/mpl_examples/pylab_examples/agg_buffer_to_array_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/alignment_test.hires.png b/mpl_examples/pylab_examples/alignment_test.hires.png deleted file mode 100644 index 60b370682c8..00000000000 Binary files a/mpl_examples/pylab_examples/alignment_test.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/alignment_test.pdf b/mpl_examples/pylab_examples/alignment_test.pdf deleted file mode 100644 index c38c50e14db..00000000000 Binary files a/mpl_examples/pylab_examples/alignment_test.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/alignment_test.png b/mpl_examples/pylab_examples/alignment_test.png deleted file mode 100644 index 93e76a1ce8b..00000000000 Binary files a/mpl_examples/pylab_examples/alignment_test.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/alignment_test.py b/mpl_examples/pylab_examples/alignment_test.py deleted file mode 100644 index 5de0d6a33a4..00000000000 --- a/mpl_examples/pylab_examples/alignment_test.py +++ /dev/null @@ -1,81 +0,0 @@ -""" -You can precisely layout text in data or axes (0,1) coordinates. This -example shows you some of the alignment and rotation specifications to -layout text -""" - -import matplotlib.pyplot as plt -from matplotlib.lines import Line2D -from matplotlib.patches import Rectangle - -# build a rectangle in axes coords -left, width = .25, .5 -bottom, height = .25, .5 -right = left + width -top = bottom + height -ax = plt.gca() -p = plt.Rectangle((left, bottom), width, height, - fill=False, - ) -p.set_transform(ax.transAxes) -p.set_clip_on(False) -ax.add_patch(p) - - -ax.text(left, bottom, 'left top', - horizontalalignment='left', - verticalalignment='top', - transform=ax.transAxes) - -ax.text(left, bottom, 'left bottom', - horizontalalignment='left', - verticalalignment='bottom', - transform=ax.transAxes) - -ax.text(right, top, 'right bottom', - horizontalalignment='right', - verticalalignment='bottom', - transform=ax.transAxes) - -ax.text(right, top, 'right top', - horizontalalignment='right', - verticalalignment='top', - transform=ax.transAxes) - -ax.text(right, bottom, 'center top', - horizontalalignment='center', - verticalalignment='top', - transform=ax.transAxes) - -ax.text(left, 0.5*(bottom + top), 'right center', - horizontalalignment='right', - verticalalignment='center', - rotation='vertical', - transform=ax.transAxes) - -ax.text(left, 0.5*(bottom + top), 'left center', - horizontalalignment='left', - verticalalignment='center', - rotation='vertical', - transform=ax.transAxes) - -ax.text(0.5*(left + right), 0.5*(bottom + top), 'middle', - horizontalalignment='center', - verticalalignment='center', - transform=ax.transAxes) - -ax.text(right, 0.5*(bottom + top), 'centered', - horizontalalignment='center', - verticalalignment='center', - rotation='vertical', - transform=ax.transAxes) - -ax.text(left, top, 'rotated\nwith newlines', - horizontalalignment='center', - verticalalignment='center', - rotation=45, - transform=ax.transAxes) - -plt.axis('off') - -plt.show() diff --git a/mpl_examples/pylab_examples/anchored_artists.hires.png b/mpl_examples/pylab_examples/anchored_artists.hires.png deleted file mode 100644 index b7ea3721450..00000000000 Binary files a/mpl_examples/pylab_examples/anchored_artists.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/anchored_artists.pdf b/mpl_examples/pylab_examples/anchored_artists.pdf deleted file mode 100644 index a08a8829fc9..00000000000 Binary files a/mpl_examples/pylab_examples/anchored_artists.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/anchored_artists.png b/mpl_examples/pylab_examples/anchored_artists.png deleted file mode 100644 index 851c16ae8ca..00000000000 Binary files a/mpl_examples/pylab_examples/anchored_artists.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/anchored_artists.py b/mpl_examples/pylab_examples/anchored_artists.py deleted file mode 100644 index 08104ffc383..00000000000 --- a/mpl_examples/pylab_examples/anchored_artists.py +++ /dev/null @@ -1,110 +0,0 @@ -from matplotlib.patches import Rectangle, Ellipse - -from matplotlib.offsetbox import AnchoredOffsetbox, AuxTransformBox, VPacker,\ - TextArea, DrawingArea - - -class AnchoredText(AnchoredOffsetbox): - def __init__(self, s, loc, pad=0.4, borderpad=0.5, prop=None, frameon=True): - - self.txt = TextArea(s, - minimumdescent=False) - - super(AnchoredText, self).__init__(loc, pad=pad, borderpad=borderpad, - child=self.txt, - prop=prop, - frameon=frameon) - - -class AnchoredSizeBar(AnchoredOffsetbox): - def __init__(self, transform, size, label, loc, - pad=0.1, borderpad=0.1, sep=2, prop=None, frameon=True): - """ - Draw a horizontal bar with the size in data coordinate of the give axes. - A label will be drawn underneath (center-aligned). - - pad, borderpad in fraction of the legend font size (or prop) - sep in points. - """ - self.size_bar = AuxTransformBox(transform) - self.size_bar.add_artist(Rectangle((0, 0), size, 0, fc="none", lw=1.0)) - - self.txt_label = TextArea(label, minimumdescent=False) - - self._box = VPacker(children=[self.size_bar, self.txt_label], - align="center", - pad=0, sep=sep) - - AnchoredOffsetbox.__init__(self, loc, pad=pad, borderpad=borderpad, - child=self._box, - prop=prop, - frameon=frameon) - - -class AnchoredEllipse(AnchoredOffsetbox): - def __init__(self, transform, width, height, angle, loc, - pad=0.1, borderpad=0.1, prop=None, frameon=True): - """ - Draw an ellipse the size in data coordinate of the give axes. - - pad, borderpad in fraction of the legend font size (or prop) - """ - self._box = AuxTransformBox(transform) - self.ellipse = Ellipse((0, 0), width, height, angle) - self._box.add_artist(self.ellipse) - - AnchoredOffsetbox.__init__(self, loc, pad=pad, borderpad=borderpad, - child=self._box, - prop=prop, - frameon=frameon) - - -class AnchoredDrawingArea(AnchoredOffsetbox): - def __init__(self, width, height, xdescent, ydescent, - loc, pad=0.4, borderpad=0.5, prop=None, frameon=True): - - self.da = DrawingArea(width, height, xdescent, ydescent) - - super(AnchoredDrawingArea, self).__init__(loc, pad=pad, borderpad=borderpad, - child=self.da, - prop=None, - frameon=frameon) - - -if __name__ == "__main__": - - import matplotlib.pyplot as plt - - ax = plt.gca() - ax.set_aspect(1.) - - at = AnchoredText("Figure 1a", - loc=2, frameon=True) - at.patch.set_boxstyle("round,pad=0.,rounding_size=0.2") - ax.add_artist(at) - - from matplotlib.patches import Circle - ada = AnchoredDrawingArea(20, 20, 0, 0, - loc=1, pad=0., frameon=False) - p = Circle((10, 10), 10) - ada.da.add_artist(p) - ax.add_artist(ada) - - # draw an ellipse of width=0.1, height=0.15 in the data coordinate - ae = AnchoredEllipse(ax.transData, width=0.1, height=0.15, angle=0., - loc=3, pad=0.5, borderpad=0.4, frameon=True) - - ax.add_artist(ae) - - # draw a horizontal bar with length of 0.1 in Data coordinate - # (ax.transData) with a label underneath. - asb = AnchoredSizeBar(ax.transData, - 0.1, - r"1$^{\prime}$", - loc=8, - pad=0.1, borderpad=0.5, sep=5, - frameon=False) - ax.add_artist(asb) - - plt.draw() - plt.show() diff --git a/mpl_examples/pylab_examples/animation_demo.hires.png b/mpl_examples/pylab_examples/animation_demo.hires.png deleted file mode 100644 index fea501c09d2..00000000000 Binary files a/mpl_examples/pylab_examples/animation_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/animation_demo.pdf b/mpl_examples/pylab_examples/animation_demo.pdf deleted file mode 100644 index 9afa8959644..00000000000 Binary files a/mpl_examples/pylab_examples/animation_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/animation_demo.png b/mpl_examples/pylab_examples/animation_demo.png deleted file mode 100644 index b6a6bbdc8b5..00000000000 Binary files a/mpl_examples/pylab_examples/animation_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/animation_demo.py b/mpl_examples/pylab_examples/animation_demo.py deleted file mode 100644 index a8048d357b1..00000000000 --- a/mpl_examples/pylab_examples/animation_demo.py +++ /dev/null @@ -1,27 +0,0 @@ -""" -Pyplot animation example. - -The method shown here is only for very simple, low-performance -use. For more demanding applications, look at the animation -module and the examples that use it. -""" - -import matplotlib.pyplot as plt -import numpy as np - -x = np.arange(6) -y = np.arange(5) -z = x * y[:, np.newaxis] - -for i in range(5): - if i == 0: - p = plt.imshow(z) - fig = plt.gcf() - plt.clim() # clamp the color limits - plt.title("Boring slide show") - else: - z = z + 2 - p.set_data(z) - - print("step", i) - plt.pause(0.5) diff --git a/mpl_examples/pylab_examples/annotation_demo.py b/mpl_examples/pylab_examples/annotation_demo.py deleted file mode 100644 index af47b90df31..00000000000 --- a/mpl_examples/pylab_examples/annotation_demo.py +++ /dev/null @@ -1,132 +0,0 @@ -""" -Some examples of how to annotate points in figures. You specify an -annotation point xy=(x,y) and a text point xytext=(x,y) for the -annotated points and text location, respectively. Optionally, you can -specify the coordinate system of xy and xytext with one of the -following strings for xycoords and textcoords (default is 'data') - - - 'figure points' : points from the lower left corner of the figure - 'figure pixels' : pixels from the lower left corner of the figure - 'figure fraction' : 0,0 is lower left of figure and 1,1 is upper, right - 'axes points' : points from lower left corner of axes - 'axes pixels' : pixels from lower left corner of axes - 'axes fraction' : 0,0 is lower left of axes and 1,1 is upper right - 'offset points' : Specify an offset (in points) from the xy value - 'offset pixels' : Specify an offset (in pixels) from the xy value - 'data' : use the axes data coordinate system - -Optionally, you can specify arrow properties which draws and arrow -from the text to the annotated point by giving a dictionary of arrow -properties - -Valid keys are - - width : the width of the arrow in points - frac : the fraction of the arrow length occupied by the head - headwidth : the width of the base of the arrow head in points - shrink : move the tip and base some percent away from the - annotated point and text - any key for matplotlib.patches.polygon (e.g., facecolor) - -For physical coordinate systems (points or pixels) the origin is the -(bottom, left) of the figure or axes. -""" - - -import matplotlib.pyplot as plt -from matplotlib.patches import Ellipse -import numpy as np - - -# If only one location is given, the text and xypoint being -# annotated are assumed to be the same -fig = plt.figure() -ax = fig.add_subplot(111, autoscale_on=False, xlim=(-1, 5), ylim=(-3, 5)) - -t = np.arange(0.0, 5.0, 0.01) -s = np.cos(2*np.pi*t) -line, = ax.plot(t, s) - -ax.annotate('figure pixels', - xy=(10, 10), xycoords='figure pixels') - -ax.annotate('figure points', - xy=(80, 80), xycoords='figure points') - -ax.annotate('point offset from data', - xy=(2, 1), xycoords='data', - xytext=(-15, 25), textcoords='offset points', - arrowprops=dict(facecolor='black', shrink=0.05), - horizontalalignment='right', verticalalignment='bottom') - -ax.annotate('axes fraction', - xy=(3, 1), xycoords='data', - xytext=(0.8, 0.95), textcoords='axes fraction', - arrowprops=dict(facecolor='black', shrink=0.05), - horizontalalignment='right', verticalalignment='top') - -ax.annotate('figure fraction', - xy=(.025, .975), xycoords='figure fraction', - horizontalalignment='left', verticalalignment='top', - fontsize=20) - -# use negative points or pixels to specify from right, top -10, 10 -# is 10 points to the left of the right side of the axes and 10 -# points above the bottom -ax.annotate('pixel offset from axes fraction', - xy=(1, 0), xycoords='axes fraction', - xytext=(-20, 20), textcoords='offset pixels', - horizontalalignment='right', - verticalalignment='bottom') - - -# You can specify the xypoint and the xytext in different positions and -# coordinate systems, and optionally turn on a connecting line and mark -# the point with a marker. Annotations work on polar axes too. -# In the example below, the xy point is in native coordinates (xycoords -# defaults to 'data'). For a polar axes, this is in (theta, radius) space. -# The text in the example is placed in the fractional figure coordinate system. -# Text keyword args like horizontal and vertical alignment are respected. -fig = plt.figure() -ax = fig.add_subplot(111, projection='polar') -r = np.arange(0, 1, 0.001) -theta = 2*2*np.pi*r -line, = ax.plot(theta, r) - -ind = 800 -thisr, thistheta = r[ind], theta[ind] -ax.plot([thistheta], [thisr], 'o') -ax.annotate('a polar annotation', - xy=(thistheta, thisr), # theta, radius - xytext=(0.05, 0.05), # fraction, fraction - textcoords='figure fraction', - arrowprops=dict(facecolor='black', shrink=0.05), - horizontalalignment='left', - verticalalignment='bottom') - - -# You can also use polar notation on a cartesian axes. Here the native -# coordinate system ('data') is cartesian, so you need to specify the -# xycoords and textcoords as 'polar' if you want to use (theta, radius). - -el = Ellipse((0, 0), 10, 20, facecolor='r', alpha=0.5) - -fig = plt.figure() -ax = fig.add_subplot(111, aspect='equal') -ax.add_artist(el) -el.set_clip_box(ax.bbox) -ax.annotate('the top', - xy=(np.pi/2., 10.), # theta, radius - xytext=(np.pi/3, 20.), # theta, radius - xycoords='polar', - textcoords='polar', - arrowprops=dict(facecolor='black', shrink=0.05), - horizontalalignment='left', - verticalalignment='bottom', - clip_on=True) # clip to the axes bounding box - -ax.set_xlim([-20, 20]) -ax.set_ylim([-20, 20]) - -plt.show() diff --git a/mpl_examples/pylab_examples/annotation_demo2.py b/mpl_examples/pylab_examples/annotation_demo2.py deleted file mode 100644 index cc63750631a..00000000000 --- a/mpl_examples/pylab_examples/annotation_demo2.py +++ /dev/null @@ -1,150 +0,0 @@ -import matplotlib.pyplot as plt -from matplotlib.patches import Ellipse -import numpy as np - - -fig = plt.figure(1, figsize=(8, 5)) -ax = fig.add_subplot(111, autoscale_on=False, xlim=(-1, 5), ylim=(-4, 3)) - -t = np.arange(0.0, 5.0, 0.01) -s = np.cos(2*np.pi*t) -line, = ax.plot(t, s, lw=3) - -ax.annotate('straight', - xy=(0, 1), xycoords='data', - xytext=(-50, 30), textcoords='offset points', - arrowprops=dict(arrowstyle="->")) - -ax.annotate('arc3,\nrad 0.2', - xy=(0.5, -1), xycoords='data', - xytext=(-80, -60), textcoords='offset points', - arrowprops=dict(arrowstyle="->", - connectionstyle="arc3,rad=.2")) - -ax.annotate('arc,\nangle 50', - xy=(1., 1), xycoords='data', - xytext=(-90, 50), textcoords='offset points', - arrowprops=dict(arrowstyle="->", - connectionstyle="arc,angleA=0,armA=50,rad=10")) - -ax.annotate('arc,\narms', - xy=(1.5, -1), xycoords='data', - xytext=(-80, -60), textcoords='offset points', - arrowprops=dict(arrowstyle="->", - connectionstyle="arc,angleA=0,armA=40,angleB=-90,armB=30,rad=7")) - -ax.annotate('angle,\nangle 90', - xy=(2., 1), xycoords='data', - xytext=(-70, 30), textcoords='offset points', - arrowprops=dict(arrowstyle="->", - connectionstyle="angle,angleA=0,angleB=90,rad=10")) - -ax.annotate('angle3,\nangle -90', - xy=(2.5, -1), xycoords='data', - xytext=(-80, -60), textcoords='offset points', - arrowprops=dict(arrowstyle="->", - connectionstyle="angle3,angleA=0,angleB=-90")) - -ax.annotate('angle,\nround', - xy=(3., 1), xycoords='data', - xytext=(-60, 30), textcoords='offset points', - bbox=dict(boxstyle="round", fc="0.8"), - arrowprops=dict(arrowstyle="->", - connectionstyle="angle,angleA=0,angleB=90,rad=10")) - -ax.annotate('angle,\nround4', - xy=(3.5, -1), xycoords='data', - xytext=(-70, -80), textcoords='offset points', - size=20, - bbox=dict(boxstyle="round4,pad=.5", fc="0.8"), - arrowprops=dict(arrowstyle="->", - connectionstyle="angle,angleA=0,angleB=-90,rad=10")) - -ax.annotate('angle,\nshrink', - xy=(4., 1), xycoords='data', - xytext=(-60, 30), textcoords='offset points', - bbox=dict(boxstyle="round", fc="0.8"), - arrowprops=dict(arrowstyle="->", - shrinkA=0, shrinkB=10, - connectionstyle="angle,angleA=0,angleB=90,rad=10")) - -# You can pass an empty string to get only annotation arrows rendered -ann = ax.annotate('', xy=(4., 1.), xycoords='data', - xytext=(4.5, -1), textcoords='data', - arrowprops=dict(arrowstyle="<->", - connectionstyle="bar", - ec="k", - shrinkA=5, shrinkB=5)) - - -fig = plt.figure(2) -fig.clf() -ax = fig.add_subplot(111, autoscale_on=False, xlim=(-1, 5), ylim=(-5, 3)) - -el = Ellipse((2, -1), 0.5, 0.5) -ax.add_patch(el) - -ax.annotate('$->$', - xy=(2., -1), xycoords='data', - xytext=(-150, -140), textcoords='offset points', - bbox=dict(boxstyle="round", fc="0.8"), - arrowprops=dict(arrowstyle="->", - patchB=el, - connectionstyle="angle,angleA=90,angleB=0,rad=10")) - -ax.annotate('arrow\nfancy', - xy=(2., -1), xycoords='data', - xytext=(-100, 60), textcoords='offset points', - size=20, - # bbox=dict(boxstyle="round", fc="0.8"), - arrowprops=dict(arrowstyle="fancy", - fc="0.6", ec="none", - patchB=el, - connectionstyle="angle3,angleA=0,angleB=-90")) - -ax.annotate('arrow\nsimple', - xy=(2., -1), xycoords='data', - xytext=(100, 60), textcoords='offset points', - size=20, - # bbox=dict(boxstyle="round", fc="0.8"), - arrowprops=dict(arrowstyle="simple", - fc="0.6", ec="none", - patchB=el, - connectionstyle="arc3,rad=0.3")) - -ax.annotate('wedge', - xy=(2., -1), xycoords='data', - xytext=(-100, -100), textcoords='offset points', - size=20, - # bbox=dict(boxstyle="round", fc="0.8"), - arrowprops=dict(arrowstyle="wedge,tail_width=0.7", - fc="0.6", ec="none", - patchB=el, - connectionstyle="arc3,rad=-0.3")) - -ann = ax.annotate('bubble,\ncontours', - xy=(2., -1), xycoords='data', - xytext=(0, -70), textcoords='offset points', - size=20, - bbox=dict(boxstyle="round", - fc=(1.0, 0.7, 0.7), - ec=(1., .5, .5)), - arrowprops=dict(arrowstyle="wedge,tail_width=1.", - fc=(1.0, 0.7, 0.7), ec=(1., .5, .5), - patchA=None, - patchB=el, - relpos=(0.2, 0.8), - connectionstyle="arc3,rad=-0.1")) - -ann = ax.annotate('bubble', - xy=(2., -1), xycoords='data', - xytext=(55, 0), textcoords='offset points', - size=20, va="center", - bbox=dict(boxstyle="round", fc=(1.0, 0.7, 0.7), ec="none"), - arrowprops=dict(arrowstyle="wedge,tail_width=1.", - fc=(1.0, 0.7, 0.7), ec="none", - patchA=None, - patchB=el, - relpos=(0.2, 0.5))) - -plt.show() diff --git a/mpl_examples/pylab_examples/annotation_demo2_00.hires.png b/mpl_examples/pylab_examples/annotation_demo2_00.hires.png deleted file mode 100644 index 9a5e5a9a16d..00000000000 Binary files a/mpl_examples/pylab_examples/annotation_demo2_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/annotation_demo2_00.pdf b/mpl_examples/pylab_examples/annotation_demo2_00.pdf deleted file mode 100644 index 9fdccf75eb4..00000000000 Binary files a/mpl_examples/pylab_examples/annotation_demo2_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/annotation_demo2_00.png b/mpl_examples/pylab_examples/annotation_demo2_00.png deleted file mode 100644 index c4bb5a01784..00000000000 Binary files a/mpl_examples/pylab_examples/annotation_demo2_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/annotation_demo2_01.hires.png b/mpl_examples/pylab_examples/annotation_demo2_01.hires.png deleted file mode 100644 index d0f71b408d8..00000000000 Binary files a/mpl_examples/pylab_examples/annotation_demo2_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/annotation_demo2_01.pdf b/mpl_examples/pylab_examples/annotation_demo2_01.pdf deleted file mode 100644 index 03f55e344a4..00000000000 Binary files a/mpl_examples/pylab_examples/annotation_demo2_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/annotation_demo2_01.png b/mpl_examples/pylab_examples/annotation_demo2_01.png deleted file mode 100644 index 0f7bcd31cb7..00000000000 Binary files a/mpl_examples/pylab_examples/annotation_demo2_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/annotation_demo3.hires.png b/mpl_examples/pylab_examples/annotation_demo3.hires.png deleted file mode 100644 index 79b879b9814..00000000000 Binary files a/mpl_examples/pylab_examples/annotation_demo3.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/annotation_demo3.pdf b/mpl_examples/pylab_examples/annotation_demo3.pdf deleted file mode 100644 index ccd5b94509d..00000000000 Binary files a/mpl_examples/pylab_examples/annotation_demo3.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/annotation_demo3.png b/mpl_examples/pylab_examples/annotation_demo3.png deleted file mode 100644 index 64a588fb366..00000000000 Binary files a/mpl_examples/pylab_examples/annotation_demo3.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/annotation_demo3.py b/mpl_examples/pylab_examples/annotation_demo3.py deleted file mode 100644 index be57755122d..00000000000 --- a/mpl_examples/pylab_examples/annotation_demo3.py +++ /dev/null @@ -1,88 +0,0 @@ -import matplotlib.pyplot as plt -from matplotlib.text import OffsetFrom - - -fig, (ax1, ax2) = plt.subplots(1, 2) - -bbox_args = dict(boxstyle="round", fc="0.8") -arrow_args = dict(arrowstyle="->") - -ax1.annotate('figure fraction : 0, 0', xy=(0, 0), xycoords='figure fraction', - xytext=(20, 20), textcoords='offset points', - ha="left", va="bottom", - bbox=bbox_args, - arrowprops=arrow_args) - -ax1.annotate('figure fraction : 1, 1', xy=(1, 1), xycoords='figure fraction', - xytext=(-20, -20), textcoords='offset points', - ha="right", va="top", - bbox=bbox_args, - arrowprops=arrow_args) - -ax1.annotate('axes fraction : 0, 0', xy=(0, 0), xycoords='axes fraction', - xytext=(20, 20), textcoords='offset points', - ha="left", va="bottom", - bbox=bbox_args, - arrowprops=arrow_args) - -ax1.annotate('axes fraction : 1, 1', xy=(1, 1), xycoords='axes fraction', - xytext=(-20, -20), textcoords='offset points', - ha="right", va="top", - bbox=bbox_args, - arrowprops=arrow_args) - - -an1 = ax1.annotate('Drag me 1', xy=(.5, .7), xycoords='data', - #xytext=(.5, .7), textcoords='data', - ha="center", va="center", - bbox=bbox_args, - #arrowprops=arrow_args - ) - -an2 = ax1.annotate('Drag me 2', xy=(.5, .5), xycoords=an1, - xytext=(.5, .3), textcoords='axes fraction', - ha="center", va="center", - bbox=bbox_args, - arrowprops=dict(patchB=an1.get_bbox_patch(), - connectionstyle="arc3,rad=0.2", - **arrow_args)) - -an3 = ax1.annotate('', xy=(.5, .5), xycoords=an2, - xytext=(.5, .5), textcoords=an1, - ha="center", va="center", - bbox=bbox_args, - arrowprops=dict(patchA=an1.get_bbox_patch(), - patchB=an2.get_bbox_patch(), - connectionstyle="arc3,rad=0.2", - **arrow_args)) - - -t = ax2.annotate('xy=(0, 1)\nxycoords=("data", "axes fraction")', - xy=(0, 1), xycoords=("data", 'axes fraction'), - xytext=(0, -20), textcoords='offset points', - ha="center", va="top", - bbox=bbox_args, - arrowprops=arrow_args) - -ax2.annotate('xy=(0.5, 0)\nxycoords=artist', - xy=(0.5, 0.), xycoords=t, - xytext=(0, -20), textcoords='offset points', - ha="center", va="top", - bbox=bbox_args, - arrowprops=arrow_args) - -ax2.annotate('xy=(0.8, 0.5)\nxycoords=ax1.transData', - xy=(0.8, 0.5), xycoords=ax1.transData, - xytext=(10, 10), - textcoords=OffsetFrom(ax2.bbox, (0, 0), "points"), - ha="left", va="bottom", - bbox=bbox_args, - arrowprops=arrow_args) - -ax2.set_xlim([-2, 2]) -ax2.set_ylim([-2, 2]) - -an1.draggable() -an2.draggable() - -plt.show() diff --git a/mpl_examples/pylab_examples/annotation_demo_00.hires.png b/mpl_examples/pylab_examples/annotation_demo_00.hires.png deleted file mode 100644 index 9da6666b495..00000000000 Binary files a/mpl_examples/pylab_examples/annotation_demo_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/annotation_demo_00.pdf b/mpl_examples/pylab_examples/annotation_demo_00.pdf deleted file mode 100644 index 2b42abaa1bd..00000000000 Binary files a/mpl_examples/pylab_examples/annotation_demo_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/annotation_demo_00.png b/mpl_examples/pylab_examples/annotation_demo_00.png deleted file mode 100644 index 7d7d905f932..00000000000 Binary files a/mpl_examples/pylab_examples/annotation_demo_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/annotation_demo_01.hires.png b/mpl_examples/pylab_examples/annotation_demo_01.hires.png deleted file mode 100644 index 8c94411bdd4..00000000000 Binary files a/mpl_examples/pylab_examples/annotation_demo_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/annotation_demo_01.pdf b/mpl_examples/pylab_examples/annotation_demo_01.pdf deleted file mode 100644 index e07726b2e36..00000000000 Binary files a/mpl_examples/pylab_examples/annotation_demo_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/annotation_demo_01.png b/mpl_examples/pylab_examples/annotation_demo_01.png deleted file mode 100644 index afe2eeb7e1d..00000000000 Binary files a/mpl_examples/pylab_examples/annotation_demo_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/annotation_demo_02.hires.png b/mpl_examples/pylab_examples/annotation_demo_02.hires.png deleted file mode 100644 index 8b65ab18a52..00000000000 Binary files a/mpl_examples/pylab_examples/annotation_demo_02.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/annotation_demo_02.pdf b/mpl_examples/pylab_examples/annotation_demo_02.pdf deleted file mode 100644 index c396bd99e29..00000000000 Binary files a/mpl_examples/pylab_examples/annotation_demo_02.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/annotation_demo_02.png b/mpl_examples/pylab_examples/annotation_demo_02.png deleted file mode 100644 index 3b6e5bd8244..00000000000 Binary files a/mpl_examples/pylab_examples/annotation_demo_02.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/anscombe.hires.png b/mpl_examples/pylab_examples/anscombe.hires.png deleted file mode 100644 index fde82fea012..00000000000 Binary files a/mpl_examples/pylab_examples/anscombe.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/anscombe.pdf b/mpl_examples/pylab_examples/anscombe.pdf deleted file mode 100644 index 7cf26af32d2..00000000000 Binary files a/mpl_examples/pylab_examples/anscombe.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/anscombe.png b/mpl_examples/pylab_examples/anscombe.png deleted file mode 100644 index 69e0c88ab64..00000000000 Binary files a/mpl_examples/pylab_examples/anscombe.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/anscombe.py b/mpl_examples/pylab_examples/anscombe.py deleted file mode 100644 index 0c043af34ce..00000000000 --- a/mpl_examples/pylab_examples/anscombe.py +++ /dev/null @@ -1,58 +0,0 @@ -from __future__ import print_function -""" -Edward Tufte uses this example from Anscombe to show 4 datasets of x -and y that have the same mean, standard deviation, and regression -line, but which are qualitatively different. - -matplotlib fun for a rainy day -""" - -import matplotlib.pyplot as plt -import numpy as np - -x = np.array([10, 8, 13, 9, 11, 14, 6, 4, 12, 7, 5]) -y1 = np.array([8.04, 6.95, 7.58, 8.81, 8.33, 9.96, 7.24, 4.26, 10.84, 4.82, 5.68]) -y2 = np.array([9.14, 8.14, 8.74, 8.77, 9.26, 8.10, 6.13, 3.10, 9.13, 7.26, 4.74]) -y3 = np.array([7.46, 6.77, 12.74, 7.11, 7.81, 8.84, 6.08, 5.39, 8.15, 6.42, 5.73]) -x4 = np.array([8, 8, 8, 8, 8, 8, 8, 19, 8, 8, 8]) -y4 = np.array([6.58, 5.76, 7.71, 8.84, 8.47, 7.04, 5.25, 12.50, 5.56, 7.91, 6.89]) - - -def fit(x): - return 3 + 0.5*x - - -xfit = np.array([np.amin(x), np.amax(x)]) - -plt.subplot(221) -plt.plot(x, y1, 'ks', xfit, fit(xfit), 'r-', lw=2) -plt.axis([2, 20, 2, 14]) -plt.setp(plt.gca(), xticklabels=[], yticks=(4, 8, 12), xticks=(0, 10, 20)) -plt.text(3, 12, 'I', fontsize=20) - -plt.subplot(222) -plt.plot(x, y2, 'ks', xfit, fit(xfit), 'r-', lw=2) -plt.axis([2, 20, 2, 14]) -plt.setp(plt.gca(), xticklabels=[], yticks=(4, 8, 12), yticklabels=[], xticks=(0, 10, 20)) -plt.text(3, 12, 'II', fontsize=20) - -plt.subplot(223) -plt.plot(x, y3, 'ks', xfit, fit(xfit), 'r-', lw=2) -plt.axis([2, 20, 2, 14]) -plt.text(3, 12, 'III', fontsize=20) -plt.setp(plt.gca(), yticks=(4, 8, 12), xticks=(0, 10, 20)) - -plt.subplot(224) - -xfit = np.array([np.amin(x4), np.amax(x4)]) -plt.plot(x4, y4, 'ks', xfit, fit(xfit), 'r-', lw=2) -plt.axis([2, 20, 2, 14]) -plt.setp(plt.gca(), yticklabels=[], yticks=(4, 8, 12), xticks=(0, 10, 20)) -plt.text(3, 12, 'IV', fontsize=20) - -# verify the stats -pairs = (x, y1), (x, y2), (x, y3), (x4, y4) -for x, y in pairs: - print('mean=%1.2f, std=%1.2f, r=%1.2f' % (np.mean(y), np.std(y), np.corrcoef(x, y)[0][1])) - -plt.show() diff --git a/mpl_examples/pylab_examples/arctest.hires.png b/mpl_examples/pylab_examples/arctest.hires.png deleted file mode 100644 index 061626b3c63..00000000000 Binary files a/mpl_examples/pylab_examples/arctest.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/arctest.pdf b/mpl_examples/pylab_examples/arctest.pdf deleted file mode 100644 index 462515655a2..00000000000 Binary files a/mpl_examples/pylab_examples/arctest.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/arctest.png b/mpl_examples/pylab_examples/arctest.png deleted file mode 100644 index 9e1cb035a2f..00000000000 Binary files a/mpl_examples/pylab_examples/arctest.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/arctest.py b/mpl_examples/pylab_examples/arctest.py deleted file mode 100644 index 35c12bee407..00000000000 --- a/mpl_examples/pylab_examples/arctest.py +++ /dev/null @@ -1,18 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - - -def f(t): - 'a damped exponential' - s1 = np.cos(2 * np.pi * t) - e1 = np.exp(-t) - return s1 * e1 - -t1 = np.arange(0.0, 5.0, .2) - - -l = plt.plot(t1, f(t1), 'ro') -plt.setp(l, 'markersize', 30) -plt.setp(l, 'markerfacecolor', 'b') - -plt.show() diff --git a/mpl_examples/pylab_examples/arrow_demo.hires.png b/mpl_examples/pylab_examples/arrow_demo.hires.png deleted file mode 100644 index 7ce46c7252b..00000000000 Binary files a/mpl_examples/pylab_examples/arrow_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/arrow_demo.pdf b/mpl_examples/pylab_examples/arrow_demo.pdf deleted file mode 100644 index bcbdbeff4c2..00000000000 Binary files a/mpl_examples/pylab_examples/arrow_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/arrow_demo.png b/mpl_examples/pylab_examples/arrow_demo.png deleted file mode 100644 index c124b7799c6..00000000000 Binary files a/mpl_examples/pylab_examples/arrow_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/arrow_demo.py b/mpl_examples/pylab_examples/arrow_demo.py deleted file mode 100644 index 73781f5f1e6..00000000000 --- a/mpl_examples/pylab_examples/arrow_demo.py +++ /dev/null @@ -1,313 +0,0 @@ -"""Arrow drawing example for the new fancy_arrow facilities. - -Code contributed by: Rob Knight - -usage: - - python arrow_demo.py realistic|full|sample|extreme - - -""" -import matplotlib.pyplot as plt -import numpy as np - -rates_to_bases = {'r1': 'AT', 'r2': 'TA', 'r3': 'GA', 'r4': 'AG', 'r5': 'CA', - 'r6': 'AC', 'r7': 'GT', 'r8': 'TG', 'r9': 'CT', 'r10': 'TC', - 'r11': 'GC', 'r12': 'CG'} -numbered_bases_to_rates = dict([(v, k) for k, v in rates_to_bases.items()]) -lettered_bases_to_rates = dict([(v, 'r' + v) for k, v in rates_to_bases.items()]) - - -def add_dicts(d1, d2): - """Adds two dicts and returns the result.""" - result = d1.copy() - result.update(d2) - return result - - -def make_arrow_plot(data, size=4, display='length', shape='right', - max_arrow_width=0.03, arrow_sep=0.02, alpha=0.5, - normalize_data=False, ec=None, labelcolor=None, - head_starts_at_zero=True, rate_labels=lettered_bases_to_rates, - **kwargs): - """Makes an arrow plot. - - Parameters: - - data: dict with probabilities for the bases and pair transitions. - size: size of the graph in inches. - display: 'length', 'width', or 'alpha' for arrow property to change. - shape: 'full', 'left', or 'right' for full or half arrows. - max_arrow_width: maximum width of an arrow, data coordinates. - arrow_sep: separation between arrows in a pair, data coordinates. - alpha: maximum opacity of arrows, default 0.8. - - **kwargs can be anything allowed by a Arrow object, e.g. - linewidth and edgecolor. - """ - - plt.xlim(-0.5, 1.5) - plt.ylim(-0.5, 1.5) - plt.gcf().set_size_inches(size, size) - plt.xticks([]) - plt.yticks([]) - max_text_size = size*12 - min_text_size = size - label_text_size = size*2.5 - text_params = {'ha': 'center', 'va': 'center', 'family': 'sans-serif', - 'fontweight': 'bold'} - r2 = np.sqrt(2) - - deltas = { - 'AT': (1, 0), - 'TA': (-1, 0), - 'GA': (0, 1), - 'AG': (0, -1), - 'CA': (-1/r2, 1/r2), - 'AC': (1/r2, -1/r2), - 'GT': (1/r2, 1/r2), - 'TG': (-1/r2, -1/r2), - 'CT': (0, 1), - 'TC': (0, -1), - 'GC': (1, 0), - 'CG': (-1, 0) - } - - colors = { - 'AT': 'r', - 'TA': 'k', - 'GA': 'g', - 'AG': 'r', - 'CA': 'b', - 'AC': 'r', - 'GT': 'g', - 'TG': 'k', - 'CT': 'b', - 'TC': 'k', - 'GC': 'g', - 'CG': 'b' - } - - label_positions = { - 'AT': 'center', - 'TA': 'center', - 'GA': 'center', - 'AG': 'center', - 'CA': 'left', - 'AC': 'left', - 'GT': 'left', - 'TG': 'left', - 'CT': 'center', - 'TC': 'center', - 'GC': 'center', - 'CG': 'center' - } - - def do_fontsize(k): - return float(np.clip(max_text_size*np.sqrt(data[k]), - min_text_size, max_text_size)) - - A = plt.text(0, 1, '$A_3$', color='r', size=do_fontsize('A'), **text_params) - T = plt.text(1, 1, '$T_3$', color='k', size=do_fontsize('T'), **text_params) - G = plt.text(0, 0, '$G_3$', color='g', size=do_fontsize('G'), **text_params) - C = plt.text(1, 0, '$C_3$', color='b', size=do_fontsize('C'), **text_params) - - arrow_h_offset = 0.25 # data coordinates, empirically determined - max_arrow_length = 1 - 2*arrow_h_offset - - max_arrow_width = max_arrow_width - max_head_width = 2.5*max_arrow_width - max_head_length = 2*max_arrow_width - arrow_params = {'length_includes_head': True, 'shape': shape, - 'head_starts_at_zero': head_starts_at_zero} - ax = plt.gca() - sf = 0.6 # max arrow size represents this in data coords - - d = (r2/2 + arrow_h_offset - 0.5)/r2 # distance for diags - r2v = arrow_sep/r2 # offset for diags - - # tuple of x, y for start position - positions = { - 'AT': (arrow_h_offset, 1 + arrow_sep), - 'TA': (1 - arrow_h_offset, 1 - arrow_sep), - 'GA': (-arrow_sep, arrow_h_offset), - 'AG': (arrow_sep, 1 - arrow_h_offset), - 'CA': (1 - d - r2v, d - r2v), - 'AC': (d + r2v, 1 - d + r2v), - 'GT': (d - r2v, d + r2v), - 'TG': (1 - d + r2v, 1 - d - r2v), - 'CT': (1 - arrow_sep, arrow_h_offset), - 'TC': (1 + arrow_sep, 1 - arrow_h_offset), - 'GC': (arrow_h_offset, arrow_sep), - 'CG': (1 - arrow_h_offset, -arrow_sep), - } - - if normalize_data: - # find maximum value for rates, i.e. where keys are 2 chars long - max_val = 0 - for k, v in data.items(): - if len(k) == 2: - max_val = max(max_val, v) - # divide rates by max val, multiply by arrow scale factor - for k, v in data.items(): - data[k] = v/max_val*sf - - def draw_arrow(pair, alpha=alpha, ec=ec, labelcolor=labelcolor): - # set the length of the arrow - if display == 'length': - length = max_head_length + data[pair]/sf*(max_arrow_length - - max_head_length) - else: - length = max_arrow_length - # set the transparency of the arrow - if display == 'alph': - alpha = min(data[pair]/sf, alpha) - else: - alpha = alpha - # set the width of the arrow - if display == 'width': - scale = data[pair]/sf - width = max_arrow_width*scale - head_width = max_head_width*scale - head_length = max_head_length*scale - else: - width = max_arrow_width - head_width = max_head_width - head_length = max_head_length - - fc = colors[pair] - ec = ec or fc - - x_scale, y_scale = deltas[pair] - x_pos, y_pos = positions[pair] - plt.arrow(x_pos, y_pos, x_scale*length, y_scale*length, - fc=fc, ec=ec, alpha=alpha, width=width, head_width=head_width, - head_length=head_length, **arrow_params) - - # figure out coordinates for text - # if drawing relative to base: x and y are same as for arrow - # dx and dy are one arrow width left and up - # need to rotate based on direction of arrow, use x_scale and y_scale - # as sin x and cos x? - sx, cx = y_scale, x_scale - - where = label_positions[pair] - if where == 'left': - orig_position = 3*np.array([[max_arrow_width, max_arrow_width]]) - elif where == 'absolute': - orig_position = np.array([[max_arrow_length/2.0, 3*max_arrow_width]]) - elif where == 'right': - orig_position = np.array([[length - 3*max_arrow_width, - 3*max_arrow_width]]) - elif where == 'center': - orig_position = np.array([[length/2.0, 3*max_arrow_width]]) - else: - raise ValueError("Got unknown position parameter %s" % where) - - M = np.array([[cx, sx], [-sx, cx]]) - coords = np.dot(orig_position, M) + [[x_pos, y_pos]] - x, y = np.ravel(coords) - orig_label = rate_labels[pair] - label = '$%s_{_{\mathrm{%s}}}$' % (orig_label[0], orig_label[1:]) - - plt.text(x, y, label, size=label_text_size, ha='center', va='center', - color=labelcolor or fc) - - for p in sorted(positions): - draw_arrow(p) - -# test data -all_on_max = dict([(i, 1) for i in 'TCAG'] + - [(i + j, 0.6) for i in 'TCAG' for j in 'TCAG']) - -realistic_data = { - 'A': 0.4, - 'T': 0.3, - 'G': 0.5, - 'C': 0.2, - 'AT': 0.4, - 'AC': 0.3, - 'AG': 0.2, - 'TA': 0.2, - 'TC': 0.3, - 'TG': 0.4, - 'CT': 0.2, - 'CG': 0.3, - 'CA': 0.2, - 'GA': 0.1, - 'GT': 0.4, - 'GC': 0.1, - } - -extreme_data = { - 'A': 0.75, - 'T': 0.10, - 'G': 0.10, - 'C': 0.05, - 'AT': 0.6, - 'AC': 0.3, - 'AG': 0.1, - 'TA': 0.02, - 'TC': 0.3, - 'TG': 0.01, - 'CT': 0.2, - 'CG': 0.5, - 'CA': 0.2, - 'GA': 0.1, - 'GT': 0.4, - 'GC': 0.2, - } - -sample_data = { - 'A': 0.2137, - 'T': 0.3541, - 'G': 0.1946, - 'C': 0.2376, - 'AT': 0.0228, - 'AC': 0.0684, - 'AG': 0.2056, - 'TA': 0.0315, - 'TC': 0.0629, - 'TG': 0.0315, - 'CT': 0.1355, - 'CG': 0.0401, - 'CA': 0.0703, - 'GA': 0.1824, - 'GT': 0.0387, - 'GC': 0.1106, - } - - -if __name__ == '__main__': - from sys import argv - d = None - if len(argv) > 1: - if argv[1] == 'full': - d = all_on_max - scaled = False - elif argv[1] == 'extreme': - d = extreme_data - scaled = False - elif argv[1] == 'realistic': - d = realistic_data - scaled = False - elif argv[1] == 'sample': - d = sample_data - scaled = True - if d is None: - d = all_on_max - scaled = False - if len(argv) > 2: - display = argv[2] - else: - display = 'length' - - size = 4 - plt.figure(figsize=(size, size)) - - make_arrow_plot(d, display=display, linewidth=0.001, edgecolor=None, - normalize_data=scaled, head_starts_at_zero=True, size=size) - - plt.draw() - - plt.show() diff --git a/mpl_examples/pylab_examples/arrow_simple_demo.hires.png b/mpl_examples/pylab_examples/arrow_simple_demo.hires.png deleted file mode 100644 index d1b2b18078c..00000000000 Binary files a/mpl_examples/pylab_examples/arrow_simple_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/arrow_simple_demo.pdf b/mpl_examples/pylab_examples/arrow_simple_demo.pdf deleted file mode 100644 index 38f66e34232..00000000000 Binary files a/mpl_examples/pylab_examples/arrow_simple_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/arrow_simple_demo.png b/mpl_examples/pylab_examples/arrow_simple_demo.png deleted file mode 100644 index 3abe4f341f7..00000000000 Binary files a/mpl_examples/pylab_examples/arrow_simple_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/arrow_simple_demo.py b/mpl_examples/pylab_examples/arrow_simple_demo.py deleted file mode 100644 index 65fb5a9eabc..00000000000 --- a/mpl_examples/pylab_examples/arrow_simple_demo.py +++ /dev/null @@ -1,5 +0,0 @@ -import matplotlib.pyplot as plt - -ax = plt.axes() -ax.arrow(0, 0, 0.5, 0.5, head_width=0.05, head_length=0.1, fc='k', ec='k') -plt.show() diff --git a/mpl_examples/pylab_examples/aspect_loglog.hires.png b/mpl_examples/pylab_examples/aspect_loglog.hires.png deleted file mode 100644 index e91ecdf315f..00000000000 Binary files a/mpl_examples/pylab_examples/aspect_loglog.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/aspect_loglog.pdf b/mpl_examples/pylab_examples/aspect_loglog.pdf deleted file mode 100644 index a905118ef3c..00000000000 Binary files a/mpl_examples/pylab_examples/aspect_loglog.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/aspect_loglog.png b/mpl_examples/pylab_examples/aspect_loglog.png deleted file mode 100644 index 6e8041bdba0..00000000000 Binary files a/mpl_examples/pylab_examples/aspect_loglog.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/aspect_loglog.py b/mpl_examples/pylab_examples/aspect_loglog.py deleted file mode 100644 index 8d02b072470..00000000000 --- a/mpl_examples/pylab_examples/aspect_loglog.py +++ /dev/null @@ -1,21 +0,0 @@ -import matplotlib.pyplot as plt - -fig, (ax1, ax2) = plt.subplots(1, 2) -ax1.set_xscale("log") -ax1.set_yscale("log") -ax1.set_xlim(1e1, 1e3) -ax1.set_ylim(1e2, 1e3) -ax1.set_aspect(1) -ax1.set_title("adjustable = box") - -ax2.set_xscale("log") -ax2.set_yscale("log") -ax2.set_adjustable("datalim") -ax2.plot([1, 3, 10], [1, 9, 100], "o-") -ax2.set_xlim(1e-1, 1e2) -ax2.set_ylim(1e-1, 1e3) -ax2.set_aspect(1) -ax2.set_title("adjustable = datalim") - -plt.draw() -plt.show() diff --git a/mpl_examples/pylab_examples/axes_demo.hires.png b/mpl_examples/pylab_examples/axes_demo.hires.png deleted file mode 100644 index 2f055ccd5f3..00000000000 Binary files a/mpl_examples/pylab_examples/axes_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/axes_demo.pdf b/mpl_examples/pylab_examples/axes_demo.pdf deleted file mode 100644 index 1340862ca97..00000000000 Binary files a/mpl_examples/pylab_examples/axes_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/axes_demo.png b/mpl_examples/pylab_examples/axes_demo.png deleted file mode 100644 index 1bf7252195e..00000000000 Binary files a/mpl_examples/pylab_examples/axes_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/axes_demo.py b/mpl_examples/pylab_examples/axes_demo.py deleted file mode 100644 index 7e425c932ad..00000000000 --- a/mpl_examples/pylab_examples/axes_demo.py +++ /dev/null @@ -1,33 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - -# create some data to use for the plot -dt = 0.001 -t = np.arange(0.0, 10.0, dt) -r = np.exp(-t[:1000]/0.05) # impulse response -x = np.random.randn(len(t)) -s = np.convolve(x, r)[:len(x)]*dt # colored noise - -# the main axes is subplot(111) by default -plt.plot(t, s) -plt.axis([0, 1, 1.1*np.amin(s), 2*np.amax(s)]) -plt.xlabel('time (s)') -plt.ylabel('current (nA)') -plt.title('Gaussian colored noise') - -# this is an inset axes over the main axes -a = plt.axes([.65, .6, .2, .2], facecolor='y') -n, bins, patches = plt.hist(s, 400, normed=1) -plt.title('Probability') -plt.xticks([]) -plt.yticks([]) - -# this is another inset axes over the main axes -a = plt.axes([0.2, 0.6, .2, .2], facecolor='y') -plt.plot(t[:len(r)], r) -plt.title('Impulse response') -plt.xlim(0, 0.2) -plt.xticks([]) -plt.yticks([]) - -plt.show() diff --git a/mpl_examples/pylab_examples/axes_props.hires.png b/mpl_examples/pylab_examples/axes_props.hires.png deleted file mode 100644 index e4bc2b44068..00000000000 Binary files a/mpl_examples/pylab_examples/axes_props.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/axes_props.pdf b/mpl_examples/pylab_examples/axes_props.pdf deleted file mode 100644 index 8869eadaa28..00000000000 Binary files a/mpl_examples/pylab_examples/axes_props.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/axes_props.png b/mpl_examples/pylab_examples/axes_props.png deleted file mode 100644 index cb396147b70..00000000000 Binary files a/mpl_examples/pylab_examples/axes_props.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/axes_props.py b/mpl_examples/pylab_examples/axes_props.py deleted file mode 100644 index bc6de460a50..00000000000 --- a/mpl_examples/pylab_examples/axes_props.py +++ /dev/null @@ -1,28 +0,0 @@ -""" -You can control the axis tick and grid properties -""" - -import matplotlib.pyplot as plt -import numpy as np - -t = np.arange(0.0, 2.0, 0.01) -s = np.sin(2 * np.pi * t) -fig, ax = plt.subplots() -ax.plot(t, s) -ax.grid(True) - -ticklines = ax.get_xticklines() + ax.get_yticklines() -gridlines = ax.get_xgridlines() + ax.get_ygridlines() -ticklabels = ax.get_xticklabels() + ax.get_yticklabels() - -for line in ticklines: - line.set_linewidth(3) - -for line in gridlines: - line.set_linestyle('-.') - -for label in ticklabels: - label.set_color('r') - label.set_fontsize('medium') - -plt.show() diff --git a/mpl_examples/pylab_examples/axes_zoom_effect.hires.png b/mpl_examples/pylab_examples/axes_zoom_effect.hires.png deleted file mode 100644 index c804e3b2625..00000000000 Binary files a/mpl_examples/pylab_examples/axes_zoom_effect.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/axes_zoom_effect.pdf b/mpl_examples/pylab_examples/axes_zoom_effect.pdf deleted file mode 100644 index dd25168b1ab..00000000000 Binary files a/mpl_examples/pylab_examples/axes_zoom_effect.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/axes_zoom_effect.png b/mpl_examples/pylab_examples/axes_zoom_effect.png deleted file mode 100644 index dcc7443268e..00000000000 Binary files a/mpl_examples/pylab_examples/axes_zoom_effect.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/axes_zoom_effect.py b/mpl_examples/pylab_examples/axes_zoom_effect.py deleted file mode 100644 index e34a3cebc2a..00000000000 --- a/mpl_examples/pylab_examples/axes_zoom_effect.py +++ /dev/null @@ -1,118 +0,0 @@ -from matplotlib.transforms import Bbox, TransformedBbox, \ - blended_transform_factory - -from mpl_toolkits.axes_grid1.inset_locator import BboxPatch, BboxConnector,\ - BboxConnectorPatch - - -def connect_bbox(bbox1, bbox2, - loc1a, loc2a, loc1b, loc2b, - prop_lines, prop_patches=None): - if prop_patches is None: - prop_patches = prop_lines.copy() - prop_patches["alpha"] = prop_patches.get("alpha", 1)*0.2 - - c1 = BboxConnector(bbox1, bbox2, loc1=loc1a, loc2=loc2a, **prop_lines) - c1.set_clip_on(False) - c2 = BboxConnector(bbox1, bbox2, loc1=loc1b, loc2=loc2b, **prop_lines) - c2.set_clip_on(False) - - bbox_patch1 = BboxPatch(bbox1, **prop_patches) - bbox_patch2 = BboxPatch(bbox2, **prop_patches) - - p = BboxConnectorPatch(bbox1, bbox2, - # loc1a=3, loc2a=2, loc1b=4, loc2b=1, - loc1a=loc1a, loc2a=loc2a, loc1b=loc1b, loc2b=loc2b, - **prop_patches) - p.set_clip_on(False) - - return c1, c2, bbox_patch1, bbox_patch2, p - - -def zoom_effect01(ax1, ax2, xmin, xmax, **kwargs): - """ - ax1 : the main axes - ax1 : the zoomed axes - (xmin,xmax) : the limits of the colored area in both plot axes. - - connect ax1 & ax2. The x-range of (xmin, xmax) in both axes will - be marked. The keywords parameters will be used ti create - patches. - - """ - - trans1 = blended_transform_factory(ax1.transData, ax1.transAxes) - trans2 = blended_transform_factory(ax2.transData, ax2.transAxes) - - bbox = Bbox.from_extents(xmin, 0, xmax, 1) - - mybbox1 = TransformedBbox(bbox, trans1) - mybbox2 = TransformedBbox(bbox, trans2) - - prop_patches = kwargs.copy() - prop_patches["ec"] = "none" - prop_patches["alpha"] = 0.2 - - c1, c2, bbox_patch1, bbox_patch2, p = \ - connect_bbox(mybbox1, mybbox2, - loc1a=3, loc2a=2, loc1b=4, loc2b=1, - prop_lines=kwargs, prop_patches=prop_patches) - - ax1.add_patch(bbox_patch1) - ax2.add_patch(bbox_patch2) - ax2.add_patch(c1) - ax2.add_patch(c2) - ax2.add_patch(p) - - return c1, c2, bbox_patch1, bbox_patch2, p - - -def zoom_effect02(ax1, ax2, **kwargs): - """ - ax1 : the main axes - ax1 : the zoomed axes - - Similar to zoom_effect01. The xmin & xmax will be taken from the - ax1.viewLim. - """ - - tt = ax1.transScale + (ax1.transLimits + ax2.transAxes) - trans = blended_transform_factory(ax2.transData, tt) - - mybbox1 = ax1.bbox - mybbox2 = TransformedBbox(ax1.viewLim, trans) - - prop_patches = kwargs.copy() - prop_patches["ec"] = "none" - prop_patches["alpha"] = 0.2 - - c1, c2, bbox_patch1, bbox_patch2, p = \ - connect_bbox(mybbox1, mybbox2, - loc1a=3, loc2a=2, loc1b=4, loc2b=1, - prop_lines=kwargs, prop_patches=prop_patches) - - ax1.add_patch(bbox_patch1) - ax2.add_patch(bbox_patch2) - ax2.add_patch(c1) - ax2.add_patch(c2) - ax2.add_patch(p) - - return c1, c2, bbox_patch1, bbox_patch2, p - - -import matplotlib.pyplot as plt - -plt.figure(1, figsize=(5, 5)) -ax1 = plt.subplot(221) -ax2 = plt.subplot(212) -ax2.set_xlim(0, 1) -ax2.set_xlim(0, 5) -zoom_effect01(ax1, ax2, 0.2, 0.8) - - -ax1 = plt.subplot(222) -ax1.set_xlim(2, 3) -ax2.set_xlim(0, 5) -zoom_effect02(ax1, ax2) - -plt.show() diff --git a/mpl_examples/pylab_examples/axhspan_demo.hires.png b/mpl_examples/pylab_examples/axhspan_demo.hires.png deleted file mode 100644 index c5dd50a8cc8..00000000000 Binary files a/mpl_examples/pylab_examples/axhspan_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/axhspan_demo.pdf b/mpl_examples/pylab_examples/axhspan_demo.pdf deleted file mode 100644 index 9f4bc3b7659..00000000000 Binary files a/mpl_examples/pylab_examples/axhspan_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/axhspan_demo.png b/mpl_examples/pylab_examples/axhspan_demo.png deleted file mode 100644 index 972c3222fba..00000000000 Binary files a/mpl_examples/pylab_examples/axhspan_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/axhspan_demo.py b/mpl_examples/pylab_examples/axhspan_demo.py deleted file mode 100644 index 13a91188166..00000000000 --- a/mpl_examples/pylab_examples/axhspan_demo.py +++ /dev/null @@ -1,32 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -t = np.arange(-1, 2, .01) -s = np.sin(2*np.pi*t) - -plt.plot(t, s) -# draw a thick red hline at y=0 that spans the xrange -l = plt.axhline(linewidth=8, color='#d62728') - -# draw a default hline at y=1 that spans the xrange -l = plt.axhline(y=1) - -# draw a default vline at x=1 that spans the yrange -l = plt.axvline(x=1) - -# draw a thick blue vline at x=0 that spans the upper quadrant of -# the yrange -l = plt.axvline(x=0, ymin=0.75, linewidth=8, color='#1f77b4') - -# draw a default hline at y=.5 that spans the middle half of -# the axes -l = plt.axhline(y=.5, xmin=0.25, xmax=0.75) - -p = plt.axhspan(0.25, 0.75, facecolor='0.5', alpha=0.5) - -p = plt.axvspan(1.25, 1.55, facecolor='#2ca02c', alpha=0.5) - -plt.axis([-1, 2, -1, 2]) - - -plt.show() diff --git a/mpl_examples/pylab_examples/axis_equal_demo.hires.png b/mpl_examples/pylab_examples/axis_equal_demo.hires.png deleted file mode 100644 index 3e0ae697175..00000000000 Binary files a/mpl_examples/pylab_examples/axis_equal_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/axis_equal_demo.pdf b/mpl_examples/pylab_examples/axis_equal_demo.pdf deleted file mode 100644 index 6807e87720f..00000000000 Binary files a/mpl_examples/pylab_examples/axis_equal_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/axis_equal_demo.png b/mpl_examples/pylab_examples/axis_equal_demo.png deleted file mode 100644 index 236cfc81dd5..00000000000 Binary files a/mpl_examples/pylab_examples/axis_equal_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/axis_equal_demo.py b/mpl_examples/pylab_examples/axis_equal_demo.py deleted file mode 100644 index 998720dac1d..00000000000 --- a/mpl_examples/pylab_examples/axis_equal_demo.py +++ /dev/null @@ -1,32 +0,0 @@ -'''This example is only interesting when ran in interactive mode''' - -import matplotlib.pyplot as plt -import numpy as np - -# Plot circle or radius 3 - -an = np.linspace(0, 2*np.pi, 100) - -plt.subplot(221) -plt.plot(3*np.cos(an), 3*np.sin(an)) -plt.title('not equal, looks like ellipse', fontsize=10) - -plt.subplot(222) -plt.plot(3*np.cos(an), 3*np.sin(an)) -plt.axis('equal') -plt.title('equal, looks like circle', fontsize=10) - -plt.subplot(223) -plt.plot(3*np.cos(an), 3*np.sin(an)) -plt.axis('equal') -plt.axis([-3, 3, -3, 3]) -plt.title('looks like circle, even after changing limits', fontsize=10) - -plt.subplot(224) -plt.plot(3*np.cos(an), 3*np.sin(an)) -plt.axis('equal') -plt.axis([-3, 3, -3, 3]) -plt.plot([0, 4], [0, 4]) -plt.title('still equal after adding line', fontsize=10) - -plt.show() diff --git a/mpl_examples/pylab_examples/bar_stacked.hires.png b/mpl_examples/pylab_examples/bar_stacked.hires.png deleted file mode 100644 index d1296ee5159..00000000000 Binary files a/mpl_examples/pylab_examples/bar_stacked.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/bar_stacked.pdf b/mpl_examples/pylab_examples/bar_stacked.pdf deleted file mode 100644 index 2ba4e34745b..00000000000 Binary files a/mpl_examples/pylab_examples/bar_stacked.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/bar_stacked.png b/mpl_examples/pylab_examples/bar_stacked.png deleted file mode 100644 index f441b434871..00000000000 Binary files a/mpl_examples/pylab_examples/bar_stacked.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/bar_stacked.py b/mpl_examples/pylab_examples/bar_stacked.py deleted file mode 100644 index 67ef657a8ee..00000000000 --- a/mpl_examples/pylab_examples/bar_stacked.py +++ /dev/null @@ -1,24 +0,0 @@ -# a stacked bar plot with errorbars -import numpy as np -import matplotlib.pyplot as plt - - -N = 5 -menMeans = (20, 35, 30, 35, 27) -womenMeans = (25, 32, 34, 20, 25) -menStd = (2, 3, 4, 1, 2) -womenStd = (3, 5, 2, 3, 3) -ind = np.arange(N) # the x locations for the groups -width = 0.35 # the width of the bars: can also be len(x) sequence - -p1 = plt.bar(ind, menMeans, width, color='#d62728', yerr=menStd) -p2 = plt.bar(ind, womenMeans, width, - bottom=menMeans, yerr=womenStd) - -plt.ylabel('Scores') -plt.title('Scores by group and gender') -plt.xticks(ind, ('G1', 'G2', 'G3', 'G4', 'G5')) -plt.yticks(np.arange(0, 81, 10)) -plt.legend((p1[0], p2[0]), ('Men', 'Women')) - -plt.show() diff --git a/mpl_examples/pylab_examples/barb_demo.py b/mpl_examples/pylab_examples/barb_demo.py deleted file mode 100644 index 5681dacf4c8..00000000000 --- a/mpl_examples/pylab_examples/barb_demo.py +++ /dev/null @@ -1,53 +0,0 @@ -''' -Demonstration of wind barb plots -''' -import matplotlib.pyplot as plt -import numpy as np - -x = np.linspace(-5, 5, 5) -X, Y = np.meshgrid(x, x) -U, V = 12*X, 12*Y - -data = [(-1.5, .5, -6, -6), - (1, -1, -46, 46), - (-3, -1, 11, -11), - (1, 1.5, 80, 80), - (0.5, 0.25, 25, 15), - (-1.5, -0.5, -5, 40)] - -data = np.array(data, dtype=[('x', np.float32), ('y', np.float32), - ('u', np.float32), ('v', np.float32)]) - -# Default parameters, uniform grid -ax = plt.subplot(2, 2, 1) -ax.barbs(X, Y, U, V) - -# Arbitrary set of vectors, make them longer and change the pivot point -#(point around which they're rotated) to be the middle -ax = plt.subplot(2, 2, 2) -ax.barbs(data['x'], data['y'], data['u'], data['v'], length=8, pivot='middle') - -# Showing colormapping with uniform grid. Fill the circle for an empty barb, -# don't round the values, and change some of the size parameters -ax = plt.subplot(2, 2, 3) -ax.barbs(X, Y, U, V, np.sqrt(U*U + V*V), fill_empty=True, rounding=False, - sizes=dict(emptybarb=0.25, spacing=0.2, height=0.3)) - -# Change colors as well as the increments for parts of the barbs -ax = plt.subplot(2, 2, 4) -ax.barbs(data['x'], data['y'], data['u'], data['v'], flagcolor='r', - barbcolor=['b', 'g'], barb_increments=dict(half=10, full=20, flag=100), - flip_barb=True) - -# Masked arrays are also supported -masked_u = np.ma.masked_array(data['u']) -masked_u[4] = 1000 # Bad value that should not be plotted when masked -masked_u[4] = np.ma.masked - -# Identical plot to panel 2 in the first figure, but with the point at -#(0.5, 0.25) missing (masked) -fig2 = plt.figure() -ax = fig2.add_subplot(1, 1, 1) -ax.barbs(data['x'], data['y'], masked_u, data['v'], length=8, pivot='middle') - -plt.show() diff --git a/mpl_examples/pylab_examples/barb_demo_00.hires.png b/mpl_examples/pylab_examples/barb_demo_00.hires.png deleted file mode 100644 index f6ac0794d7f..00000000000 Binary files a/mpl_examples/pylab_examples/barb_demo_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/barb_demo_00.pdf b/mpl_examples/pylab_examples/barb_demo_00.pdf deleted file mode 100644 index e607c51410c..00000000000 Binary files a/mpl_examples/pylab_examples/barb_demo_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/barb_demo_00.png b/mpl_examples/pylab_examples/barb_demo_00.png deleted file mode 100644 index 1fc7fc7767f..00000000000 Binary files a/mpl_examples/pylab_examples/barb_demo_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/barb_demo_01.hires.png b/mpl_examples/pylab_examples/barb_demo_01.hires.png deleted file mode 100644 index 5c2b580673d..00000000000 Binary files a/mpl_examples/pylab_examples/barb_demo_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/barb_demo_01.pdf b/mpl_examples/pylab_examples/barb_demo_01.pdf deleted file mode 100644 index ac54ba15642..00000000000 Binary files a/mpl_examples/pylab_examples/barb_demo_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/barb_demo_01.png b/mpl_examples/pylab_examples/barb_demo_01.png deleted file mode 100644 index 499d9aed4ba..00000000000 Binary files a/mpl_examples/pylab_examples/barb_demo_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/barchart_demo.hires.png b/mpl_examples/pylab_examples/barchart_demo.hires.png deleted file mode 100644 index 0533a6b2cc6..00000000000 Binary files a/mpl_examples/pylab_examples/barchart_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/barchart_demo.pdf b/mpl_examples/pylab_examples/barchart_demo.pdf deleted file mode 100644 index 668ea6a0e14..00000000000 Binary files a/mpl_examples/pylab_examples/barchart_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/barchart_demo.png b/mpl_examples/pylab_examples/barchart_demo.png deleted file mode 100644 index ec1bb95d6eb..00000000000 Binary files a/mpl_examples/pylab_examples/barchart_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/barchart_demo.py b/mpl_examples/pylab_examples/barchart_demo.py deleted file mode 100644 index 071d6b788f3..00000000000 --- a/mpl_examples/pylab_examples/barchart_demo.py +++ /dev/null @@ -1,45 +0,0 @@ -""" -Bar chart demo with pairs of bars grouped for easy comparison. -""" -import numpy as np -import matplotlib.pyplot as plt - - -n_groups = 5 - -means_men = (20, 35, 30, 35, 27) -std_men = (2, 3, 4, 1, 2) - -means_women = (25, 32, 34, 20, 25) -std_women = (3, 5, 2, 3, 3) - -fig, ax = plt.subplots() - -index = np.arange(n_groups) -bar_width = 0.35 - -opacity = 0.4 -error_config = {'ecolor': '0.3'} - -rects1 = plt.bar(index, means_men, bar_width, - alpha=opacity, - color='b', - yerr=std_men, - error_kw=error_config, - label='Men') - -rects2 = plt.bar(index + bar_width, means_women, bar_width, - alpha=opacity, - color='r', - yerr=std_women, - error_kw=error_config, - label='Women') - -plt.xlabel('Group') -plt.ylabel('Scores') -plt.title('Scores by group and gender') -plt.xticks(index + bar_width / 2, ('A', 'B', 'C', 'D', 'E')) -plt.legend() - -plt.tight_layout() -plt.show() diff --git a/mpl_examples/pylab_examples/barchart_demo2.hires.png b/mpl_examples/pylab_examples/barchart_demo2.hires.png deleted file mode 100644 index 9709a4ea6b1..00000000000 Binary files a/mpl_examples/pylab_examples/barchart_demo2.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/barchart_demo2.pdf b/mpl_examples/pylab_examples/barchart_demo2.pdf deleted file mode 100644 index f1349f1dbc2..00000000000 Binary files a/mpl_examples/pylab_examples/barchart_demo2.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/barchart_demo2.png b/mpl_examples/pylab_examples/barchart_demo2.png deleted file mode 100644 index c44e573df28..00000000000 Binary files a/mpl_examples/pylab_examples/barchart_demo2.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/barchart_demo2.py b/mpl_examples/pylab_examples/barchart_demo2.py deleted file mode 100644 index 93986923519..00000000000 --- a/mpl_examples/pylab_examples/barchart_demo2.py +++ /dev/null @@ -1,163 +0,0 @@ -""" -Thanks Josh Hemann for the example - -This examples comes from an application in which grade school gym -teachers wanted to be able to show parents how their child did across -a handful of fitness tests, and importantly, relative to how other -children did. To extract the plotting code for demo purposes, we'll -just make up some data for little Johnny Doe... - -""" -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.ticker import MaxNLocator -from collections import namedtuple - -Student = namedtuple('Student', ['name', 'grade', 'gender']) -Score = namedtuple('Score', ['score', 'percentile']) - -# GLOBAL CONSTANTS -testNames = ['Pacer Test', 'Flexed Arm\n Hang', 'Mile Run', 'Agility', - 'Push Ups'] -testMeta = dict(zip(testNames, ['laps', 'sec', 'min:sec', 'sec', ''])) - - -def attach_ordinal(num): - """helper function to add ordinal string to integers - - 1 -> 1st - 56 -> 56th - """ - suffixes = dict((str(i), v) for i, v in - enumerate(['th', 'st', 'nd', 'rd', 'th', - 'th', 'th', 'th', 'th', 'th'])) - - v = str(num) - # special case early teens - if v in {'11', '12', '13'}: - return v + 'th' - return v + suffixes[v[-1]] - - -def format_score(scr, test): - """ - Build up the score labels for the right Y-axis by first - appending a carriage return to each string and then tacking on - the appropriate meta information (i.e., 'laps' vs 'seconds'). We - want the labels centered on the ticks, so if there is no meta - info (like for pushups) then don't add the carriage return to - the string - """ - md = testMeta[test] - if md: - return '{0}\n{1}'.format(scr, md) - else: - return scr - - -def format_ycursor(y): - y = int(y) - if y < 0 or y >= len(testNames): - return '' - else: - return testNames[y] - - -def plot_student_results(student, scores, cohort_size): - # create the figure - fig, ax1 = plt.subplots(figsize=(9, 7)) - fig.subplots_adjust(left=0.115, right=0.88) - fig.canvas.set_window_title('Eldorado K-8 Fitness Chart') - - pos = np.arange(len(testNames)) - - rects = ax1.barh(pos, [scores[k].percentile for k in testNames], - align='center', - height=0.5, color='m', - tick_label=testNames) - - ax1.set_title(student.name) - - ax1.set_xlim([0, 100]) - ax1.xaxis.set_major_locator(MaxNLocator(11)) - ax1.xaxis.grid(True, linestyle='--', which='major', - color='grey', alpha=.25) - - # Plot a solid vertical gridline to highlight the median position - ax1.axvline(50, color='grey', alpha=0.25) - # set X-axis tick marks at the deciles - cohort_label = ax1.text(.5, -.07, 'Cohort Size: {0}'.format(cohort_size), - horizontalalignment='center', size='small', - transform=ax1.transAxes) - - # Set the right-hand Y-axis ticks and labels - ax2 = ax1.twinx() - - scoreLabels = [format_score(scores[k].score, k) for k in testNames] - - # set the tick locations - ax2.set_yticks(pos) - # make sure that the limits are set equally on both yaxis so the - # ticks line up - ax2.set_ylim(ax1.get_ylim()) - - # set the tick labels - ax2.set_yticklabels(scoreLabels) - - ax2.set_ylabel('Test Scores') - - ax2.set_xlabel(('Percentile Ranking Across ' - '{grade} Grade {gender}s').format( - grade=attach_ordinal(student.grade), - gender=student.gender.title())) - - rect_labels = [] - # Lastly, write in the ranking inside each bar to aid in interpretation - for rect in rects: - # Rectangle widths are already integer-valued but are floating - # type, so it helps to remove the trailing decimal point and 0 by - # converting width to int type - width = int(rect.get_width()) - - rankStr = attach_ordinal(width) - # The bars aren't wide enough to print the ranking inside - if (width < 5): - # Shift the text to the right side of the right edge - xloc = width + 1 - # Black against white background - clr = 'black' - align = 'left' - else: - # Shift the text to the left side of the right edge - xloc = 0.98*width - # White on magenta - clr = 'white' - align = 'right' - - # Center the text vertically in the bar - yloc = rect.get_y() + rect.get_height()/2.0 - label = ax1.text(xloc, yloc, rankStr, horizontalalignment=align, - verticalalignment='center', color=clr, weight='bold', - clip_on=True) - rect_labels.append(label) - - # make the interactive mouse over give the bar title - ax2.fmt_ydata = format_ycursor - # return all of the artists created - return {'fig': fig, - 'ax': ax1, - 'ax_right': ax2, - 'bars': rects, - 'perc_labels': rect_labels, - 'cohort_label': cohort_label} - -student = Student('Johnny Doe', 2, 'boy') -scores = dict(zip(testNames, - (Score(v, p) for v, p in - zip(['7', '48', '12:52', '17', '14'], - np.round(np.random.uniform(0, 1, - len(testNames))*100, 0))))) -cohort_size = 62 # The number of other 2nd grade boys - -arts = plot_student_results(student, scores, cohort_size) -plt.show() diff --git a/mpl_examples/pylab_examples/barcode_demo.hires.png b/mpl_examples/pylab_examples/barcode_demo.hires.png deleted file mode 100644 index 92c270da85a..00000000000 Binary files a/mpl_examples/pylab_examples/barcode_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/barcode_demo.pdf b/mpl_examples/pylab_examples/barcode_demo.pdf deleted file mode 100644 index e4f10f0a9c8..00000000000 Binary files a/mpl_examples/pylab_examples/barcode_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/barcode_demo.png b/mpl_examples/pylab_examples/barcode_demo.png deleted file mode 100644 index b61ca7c3072..00000000000 Binary files a/mpl_examples/pylab_examples/barcode_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/barcode_demo.py b/mpl_examples/pylab_examples/barcode_demo.py deleted file mode 100644 index 2e5b480145b..00000000000 --- a/mpl_examples/pylab_examples/barcode_demo.py +++ /dev/null @@ -1,24 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - -# the bar -x = np.where(np.random.rand(500) > 0.7, 1.0, 0.0) - -axprops = dict(xticks=[], yticks=[]) -barprops = dict(aspect='auto', cmap=plt.cm.binary, interpolation='nearest') - -fig = plt.figure() - -# a vertical barcode -- this is broken at present -x.shape = len(x), 1 -ax = fig.add_axes([0.1, 0.3, 0.1, 0.6], **axprops) -ax.imshow(x, **barprops) - -x = x.copy() -# a horizontal barcode -x.shape = 1, len(x) -ax = fig.add_axes([0.3, 0.1, 0.6, 0.1], **axprops) -ax.imshow(x, **barprops) - - -plt.show() diff --git a/mpl_examples/pylab_examples/boxplot_demo.py b/mpl_examples/pylab_examples/boxplot_demo.py deleted file mode 100644 index 288332180e7..00000000000 --- a/mpl_examples/pylab_examples/boxplot_demo.py +++ /dev/null @@ -1,52 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - -# fake up some data -spread = np.random.rand(50) * 100 -center = np.ones(25) * 50 -flier_high = np.random.rand(10) * 100 + 100 -flier_low = np.random.rand(10) * -100 -data = np.concatenate((spread, center, flier_high, flier_low), 0) - -# basic plot -plt.boxplot(data) - -# notched plot -plt.figure() -plt.boxplot(data, 1) - -# change outlier point symbols -plt.figure() -plt.boxplot(data, 0, 'gD') - -# don't show outlier points -plt.figure() -plt.boxplot(data, 0, '') - -# horizontal boxes -plt.figure() -plt.boxplot(data, 0, 'rs', 0) - -# change whisker length -plt.figure() -plt.boxplot(data, 0, 'rs', 0, 0.75) - -# fake up some more data -spread = np.random.rand(50) * 100 -center = np.ones(25) * 40 -flier_high = np.random.rand(10) * 100 + 100 -flier_low = np.random.rand(10) * -100 -d2 = np.concatenate((spread, center, flier_high, flier_low), 0) -data.shape = (-1, 1) -d2.shape = (-1, 1) -# data = concatenate( (data, d2), 1 ) -# Making a 2-D array only works if all the columns are the -# same length. If they are not, then use a list instead. -# This is actually more efficient because boxplot converts -# a 2-D array into a list of vectors internally anyway. -data = [data, d2, d2[::2, 0]] -# multiple box plots on one figure -plt.figure() -plt.boxplot(data) - -plt.show() diff --git a/mpl_examples/pylab_examples/boxplot_demo2.hires.png b/mpl_examples/pylab_examples/boxplot_demo2.hires.png deleted file mode 100644 index 6c44b623577..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo2.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo2.pdf b/mpl_examples/pylab_examples/boxplot_demo2.pdf deleted file mode 100644 index 3a200136e5a..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo2.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo2.png b/mpl_examples/pylab_examples/boxplot_demo2.png deleted file mode 100644 index cd7f31cc400..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo2.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo2.py b/mpl_examples/pylab_examples/boxplot_demo2.py deleted file mode 100644 index 06d192b355a..00000000000 --- a/mpl_examples/pylab_examples/boxplot_demo2.py +++ /dev/null @@ -1,121 +0,0 @@ -""" -Thanks Josh Hemann for the example -""" - -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.patches import Polygon - - -# Generate some data from five different probability distributions, -# each with different characteristics. We want to play with how an IID -# bootstrap resample of the data preserves the distributional -# properties of the original sample, and a boxplot is one visual tool -# to make this assessment -numDists = 5 -randomDists = ['Normal(1,1)', ' Lognormal(1,1)', 'Exp(1)', 'Gumbel(6,4)', - 'Triangular(2,9,11)'] -N = 500 -np.random.seed(0) -norm = np.random.normal(1, 1, N) -logn = np.random.lognormal(1, 1, N) -expo = np.random.exponential(1, N) -gumb = np.random.gumbel(6, 4, N) -tria = np.random.triangular(2, 9, 11, N) - -# Generate some random indices that we'll use to resample the original data -# arrays. For code brevity, just use the same random indices for each array -bootstrapIndices = np.random.random_integers(0, N - 1, N) -normBoot = norm[bootstrapIndices] -expoBoot = expo[bootstrapIndices] -gumbBoot = gumb[bootstrapIndices] -lognBoot = logn[bootstrapIndices] -triaBoot = tria[bootstrapIndices] - -data = [norm, normBoot, logn, lognBoot, expo, expoBoot, gumb, gumbBoot, - tria, triaBoot] - -fig, ax1 = plt.subplots(figsize=(10, 6)) -fig.canvas.set_window_title('A Boxplot Example') -plt.subplots_adjust(left=0.075, right=0.95, top=0.9, bottom=0.25) - -bp = plt.boxplot(data, notch=0, sym='+', vert=1, whis=1.5) -plt.setp(bp['boxes'], color='black') -plt.setp(bp['whiskers'], color='black') -plt.setp(bp['fliers'], color='red', marker='+') - -# Add a horizontal grid to the plot, but make it very light in color -# so we can use it for reading data values but not be distracting -ax1.yaxis.grid(True, linestyle='-', which='major', color='lightgrey', - alpha=0.5) - -# Hide these grid behind plot objects -ax1.set_axisbelow(True) -ax1.set_title('Comparison of IID Bootstrap Resampling Across Five Distributions') -ax1.set_xlabel('Distribution') -ax1.set_ylabel('Value') - -# Now fill the boxes with desired colors -boxColors = ['darkkhaki', 'royalblue'] -numBoxes = numDists*2 -medians = list(range(numBoxes)) -for i in range(numBoxes): - box = bp['boxes'][i] - boxX = [] - boxY = [] - for j in range(5): - boxX.append(box.get_xdata()[j]) - boxY.append(box.get_ydata()[j]) - boxCoords = list(zip(boxX, boxY)) - # Alternate between Dark Khaki and Royal Blue - k = i % 2 - boxPolygon = Polygon(boxCoords, facecolor=boxColors[k]) - ax1.add_patch(boxPolygon) - # Now draw the median lines back over what we just filled in - med = bp['medians'][i] - medianX = [] - medianY = [] - for j in range(2): - medianX.append(med.get_xdata()[j]) - medianY.append(med.get_ydata()[j]) - plt.plot(medianX, medianY, 'k') - medians[i] = medianY[0] - # Finally, overplot the sample averages, with horizontal alignment - # in the center of each box - plt.plot([np.average(med.get_xdata())], [np.average(data[i])], - color='w', marker='*', markeredgecolor='k') - -# Set the axes ranges and axes labels -ax1.set_xlim(0.5, numBoxes + 0.5) -top = 40 -bottom = -5 -ax1.set_ylim(bottom, top) -xtickNames = plt.setp(ax1, xticklabels=np.repeat(randomDists, 2)) -plt.setp(xtickNames, rotation=45, fontsize=8) - -# Due to the Y-axis scale being different across samples, it can be -# hard to compare differences in medians across the samples. Add upper -# X-axis tick labels with the sample medians to aid in comparison -# (just use two decimal places of precision) -pos = np.arange(numBoxes) + 1 -upperLabels = [str(np.round(s, 2)) for s in medians] -weights = ['bold', 'semibold'] -for tick, label in zip(range(numBoxes), ax1.get_xticklabels()): - k = tick % 2 - ax1.text(pos[tick], top - (top*0.05), upperLabels[tick], - horizontalalignment='center', size='x-small', weight=weights[k], - color=boxColors[k]) - -# Finally, add a basic legend -plt.figtext(0.80, 0.08, str(N) + ' Random Numbers', - backgroundcolor=boxColors[0], color='black', weight='roman', - size='x-small') -plt.figtext(0.80, 0.045, 'IID Bootstrap Resample', - backgroundcolor=boxColors[1], - color='white', weight='roman', size='x-small') -plt.figtext(0.80, 0.015, '*', color='white', backgroundcolor='silver', - weight='roman', size='medium') -plt.figtext(0.815, 0.013, ' Average Value', color='black', weight='roman', - size='x-small') - -plt.show() diff --git a/mpl_examples/pylab_examples/boxplot_demo3.hires.png b/mpl_examples/pylab_examples/boxplot_demo3.hires.png deleted file mode 100644 index 6b426c0a66a..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo3.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo3.pdf b/mpl_examples/pylab_examples/boxplot_demo3.pdf deleted file mode 100644 index e1aa95f46ce..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo3.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo3.png b/mpl_examples/pylab_examples/boxplot_demo3.png deleted file mode 100644 index c08534722cc..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo3.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo3.py b/mpl_examples/pylab_examples/boxplot_demo3.py deleted file mode 100644 index ef03bde7256..00000000000 --- a/mpl_examples/pylab_examples/boxplot_demo3.py +++ /dev/null @@ -1,47 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - - -def fakeBootStrapper(n): - ''' - This is just a placeholder for the user's method of - bootstrapping the median and its confidence intervals. - - Returns an arbitrary median and confidence intervals - packed into a tuple - ''' - if n == 1: - med = 0.1 - CI = (-0.25, 0.25) - else: - med = 0.2 - CI = (-0.35, 0.50) - - return med, CI - - -np.random.seed(2) -inc = 0.1 -e1 = np.random.normal(0, 1, size=(500,)) -e2 = np.random.normal(0, 1, size=(500,)) -e3 = np.random.normal(0, 1 + inc, size=(500,)) -e4 = np.random.normal(0, 1 + 2*inc, size=(500,)) - -treatments = [e1, e2, e3, e4] -med1, CI1 = fakeBootStrapper(1) -med2, CI2 = fakeBootStrapper(2) -medians = [None, None, med1, med2] -conf_intervals = [None, None, CI1, CI2] - -fig, ax = plt.subplots() -pos = np.array(range(len(treatments))) + 1 -bp = ax.boxplot(treatments, sym='k+', positions=pos, - notch=1, bootstrap=5000, - usermedians=medians, - conf_intervals=conf_intervals) - -ax.set_xlabel('treatment') -ax.set_ylabel('response') -plt.setp(bp['whiskers'], color='k', linestyle='-') -plt.setp(bp['fliers'], markersize=3.0) -plt.show() diff --git a/mpl_examples/pylab_examples/boxplot_demo_00.hires.png b/mpl_examples/pylab_examples/boxplot_demo_00.hires.png deleted file mode 100644 index 3ee6872d602..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo_00.pdf b/mpl_examples/pylab_examples/boxplot_demo_00.pdf deleted file mode 100644 index 26177ca46b6..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo_00.png b/mpl_examples/pylab_examples/boxplot_demo_00.png deleted file mode 100644 index a1b649e4f50..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo_01.hires.png b/mpl_examples/pylab_examples/boxplot_demo_01.hires.png deleted file mode 100644 index 68c37a8cae1..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo_01.pdf b/mpl_examples/pylab_examples/boxplot_demo_01.pdf deleted file mode 100644 index b895f502208..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo_01.png b/mpl_examples/pylab_examples/boxplot_demo_01.png deleted file mode 100644 index da6f5a8031a..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo_02.hires.png b/mpl_examples/pylab_examples/boxplot_demo_02.hires.png deleted file mode 100644 index 5ca207361b8..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo_02.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo_02.pdf b/mpl_examples/pylab_examples/boxplot_demo_02.pdf deleted file mode 100644 index 15d55055719..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo_02.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo_02.png b/mpl_examples/pylab_examples/boxplot_demo_02.png deleted file mode 100644 index e56e4f5bed9..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo_02.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo_03.hires.png b/mpl_examples/pylab_examples/boxplot_demo_03.hires.png deleted file mode 100644 index ede3f0e12b2..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo_03.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo_03.pdf b/mpl_examples/pylab_examples/boxplot_demo_03.pdf deleted file mode 100644 index e5da07caf00..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo_03.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo_03.png b/mpl_examples/pylab_examples/boxplot_demo_03.png deleted file mode 100644 index 0be74035047..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo_03.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo_04.hires.png b/mpl_examples/pylab_examples/boxplot_demo_04.hires.png deleted file mode 100644 index b1ffd586c24..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo_04.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo_04.pdf b/mpl_examples/pylab_examples/boxplot_demo_04.pdf deleted file mode 100644 index 0e887dcb3e2..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo_04.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo_04.png b/mpl_examples/pylab_examples/boxplot_demo_04.png deleted file mode 100644 index 55220b7334d..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo_04.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo_05.hires.png b/mpl_examples/pylab_examples/boxplot_demo_05.hires.png deleted file mode 100644 index 652d8dd11e4..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo_05.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo_05.pdf b/mpl_examples/pylab_examples/boxplot_demo_05.pdf deleted file mode 100644 index 9fffa68f563..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo_05.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo_05.png b/mpl_examples/pylab_examples/boxplot_demo_05.png deleted file mode 100644 index 56660dada52..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo_05.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo_06.hires.png b/mpl_examples/pylab_examples/boxplot_demo_06.hires.png deleted file mode 100644 index 52250296982..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo_06.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo_06.pdf b/mpl_examples/pylab_examples/boxplot_demo_06.pdf deleted file mode 100644 index 310283bb6c2..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo_06.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/boxplot_demo_06.png b/mpl_examples/pylab_examples/boxplot_demo_06.png deleted file mode 100644 index 58c57564321..00000000000 Binary files a/mpl_examples/pylab_examples/boxplot_demo_06.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/break.hires.png b/mpl_examples/pylab_examples/break.hires.png deleted file mode 100644 index 2cfd91dc6bf..00000000000 Binary files a/mpl_examples/pylab_examples/break.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/break.pdf b/mpl_examples/pylab_examples/break.pdf deleted file mode 100644 index f355ebbacb5..00000000000 Binary files a/mpl_examples/pylab_examples/break.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/break.png b/mpl_examples/pylab_examples/break.png deleted file mode 100644 index 524bf5a1364..00000000000 Binary files a/mpl_examples/pylab_examples/break.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/break.py b/mpl_examples/pylab_examples/break.py deleted file mode 100644 index 37e13aa8c86..00000000000 --- a/mpl_examples/pylab_examples/break.py +++ /dev/null @@ -1,6 +0,0 @@ -import matplotlib.pyplot as plt - -plt.gcf().text(0.5, 0.95, 'Distance Histograms by Category is \ - a really long title') - -plt.show() diff --git a/mpl_examples/pylab_examples/broken_axis.hires.png b/mpl_examples/pylab_examples/broken_axis.hires.png deleted file mode 100644 index ec798380720..00000000000 Binary files a/mpl_examples/pylab_examples/broken_axis.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/broken_axis.pdf b/mpl_examples/pylab_examples/broken_axis.pdf deleted file mode 100644 index 3e7f17f6b29..00000000000 Binary files a/mpl_examples/pylab_examples/broken_axis.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/broken_axis.png b/mpl_examples/pylab_examples/broken_axis.png deleted file mode 100644 index 06baf095834..00000000000 Binary files a/mpl_examples/pylab_examples/broken_axis.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/broken_axis.py b/mpl_examples/pylab_examples/broken_axis.py deleted file mode 100644 index c62a7fa4f69..00000000000 --- a/mpl_examples/pylab_examples/broken_axis.py +++ /dev/null @@ -1,61 +0,0 @@ -""" -Broken axis example, where the y-axis will have a portion cut out. -""" -import matplotlib.pyplot as plt -import numpy as np - - -# 30 points between [0, 0.2) originally made using np.random.rand(30)*.2 -pts = np.array([ - 0.015, 0.166, 0.133, 0.159, 0.041, 0.024, 0.195, 0.039, 0.161, 0.018, - 0.143, 0.056, 0.125, 0.096, 0.094, 0.051, 0.043, 0.021, 0.138, 0.075, - 0.109, 0.195, 0.050, 0.074, 0.079, 0.155, 0.020, 0.010, 0.061, 0.008]) - -# Now let's make two outlier points which are far away from everything. -pts[[3, 14]] += .8 - -# If we were to simply plot pts, we'd lose most of the interesting -# details due to the outliers. So let's 'break' or 'cut-out' the y-axis -# into two portions - use the top (ax) for the outliers, and the bottom -# (ax2) for the details of the majority of our data -f, (ax, ax2) = plt.subplots(2, 1, sharex=True) - -# plot the same data on both axes -ax.plot(pts) -ax2.plot(pts) - -# zoom-in / limit the view to different portions of the data -ax.set_ylim(.78, 1.) # outliers only -ax2.set_ylim(0, .22) # most of the data - -# hide the spines between ax and ax2 -ax.spines['bottom'].set_visible(False) -ax2.spines['top'].set_visible(False) -ax.xaxis.tick_top() -ax.tick_params(labeltop='off') # don't put tick labels at the top -ax2.xaxis.tick_bottom() - -# This looks pretty good, and was fairly painless, but you can get that -# cut-out diagonal lines look with just a bit more work. The important -# thing to know here is that in axes coordinates, which are always -# between 0-1, spine endpoints are at these locations (0,0), (0,1), -# (1,0), and (1,1). Thus, we just need to put the diagonals in the -# appropriate corners of each of our axes, and so long as we use the -# right transform and disable clipping. - -d = .015 # how big to make the diagonal lines in axes coordinates -# arguments to pass to plot, just so we don't keep repeating them -kwargs = dict(transform=ax.transAxes, color='k', clip_on=False) -ax.plot((-d, +d), (-d, +d), **kwargs) # top-left diagonal -ax.plot((1 - d, 1 + d), (-d, +d), **kwargs) # top-right diagonal - -kwargs.update(transform=ax2.transAxes) # switch to the bottom axes -ax2.plot((-d, +d), (1 - d, 1 + d), **kwargs) # bottom-left diagonal -ax2.plot((1 - d, 1 + d), (1 - d, 1 + d), **kwargs) # bottom-right diagonal - -# What's cool about this is that now if we vary the distance between -# ax and ax2 via f.subplots_adjust(hspace=...) or plt.subplot_tool(), -# the diagonal lines will move accordingly, and stay right at the tips -# of the spines they are 'breaking' - -plt.show() diff --git a/mpl_examples/pylab_examples/broken_barh.hires.png b/mpl_examples/pylab_examples/broken_barh.hires.png deleted file mode 100644 index 1d869c66adf..00000000000 Binary files a/mpl_examples/pylab_examples/broken_barh.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/broken_barh.pdf b/mpl_examples/pylab_examples/broken_barh.pdf deleted file mode 100644 index fe0dac02f4a..00000000000 Binary files a/mpl_examples/pylab_examples/broken_barh.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/broken_barh.png b/mpl_examples/pylab_examples/broken_barh.png deleted file mode 100644 index 62170ee03a2..00000000000 Binary files a/mpl_examples/pylab_examples/broken_barh.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/broken_barh.py b/mpl_examples/pylab_examples/broken_barh.py deleted file mode 100644 index 0c21f234b4f..00000000000 --- a/mpl_examples/pylab_examples/broken_barh.py +++ /dev/null @@ -1,22 +0,0 @@ -""" -Make a "broken" horizontal bar plot, i.e., one with gaps -""" -import matplotlib.pyplot as plt - -fig, ax = plt.subplots() -ax.broken_barh([(110, 30), (150, 10)], (10, 9), facecolors='blue') -ax.broken_barh([(10, 50), (100, 20), (130, 10)], (20, 9), - facecolors=('red', 'yellow', 'green')) -ax.set_ylim(5, 35) -ax.set_xlim(0, 200) -ax.set_xlabel('seconds since start') -ax.set_yticks([15, 25]) -ax.set_yticklabels(['Bill', 'Jim']) -ax.grid(True) -ax.annotate('race interrupted', (61, 25), - xytext=(0.8, 0.9), textcoords='axes fraction', - arrowprops=dict(facecolor='black', shrink=0.05), - fontsize=16, - horizontalalignment='right', verticalalignment='top') - -plt.show() diff --git a/mpl_examples/pylab_examples/centered_ticklabels.hires.png b/mpl_examples/pylab_examples/centered_ticklabels.hires.png deleted file mode 100644 index 907e3671ba2..00000000000 Binary files a/mpl_examples/pylab_examples/centered_ticklabels.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/centered_ticklabels.pdf b/mpl_examples/pylab_examples/centered_ticklabels.pdf deleted file mode 100644 index c6ed4caa1b0..00000000000 Binary files a/mpl_examples/pylab_examples/centered_ticklabels.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/centered_ticklabels.png b/mpl_examples/pylab_examples/centered_ticklabels.png deleted file mode 100644 index 6938d8c6ca8..00000000000 Binary files a/mpl_examples/pylab_examples/centered_ticklabels.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/centered_ticklabels.py b/mpl_examples/pylab_examples/centered_ticklabels.py deleted file mode 100644 index fbd7b1fd3fe..00000000000 --- a/mpl_examples/pylab_examples/centered_ticklabels.py +++ /dev/null @@ -1,50 +0,0 @@ -# sometimes it is nice to have ticklabels centered. mpl currently -# associates a label with a tick, and the label can be aligned -# 'center', 'left', or 'right' using the horizontal alignment property: -# -# -# for label in ax.xaxis.get_xticklabels(): -# label.set_horizontalalignment('right') -# -# -# but this doesn't help center the label between ticks. One solution -# is to "face it". Use the minor ticks to place a tick centered -# between the major ticks. Here is an example that labels the months, -# centered between the ticks - -import numpy as np -import matplotlib.cbook as cbook -import matplotlib.dates as dates -import matplotlib.ticker as ticker -import matplotlib.pyplot as plt - -# load some financial data; apple's stock price -fh = cbook.get_sample_data('aapl.npy.gz') -try: - # Python3 cannot load python2 .npy files with datetime(object) arrays - # unless the encoding is set to bytes. However this option was - # not added until numpy 1.10 so this example will only work with - # python 2 or with numpy 1.10 and later. - r = np.load(fh, encoding='bytes') -except TypeError: - r = np.load(fh) -fh.close() -r = r[-250:] # get the last 250 days - -fig, ax = plt.subplots() -ax.plot(r.date, r.adj_close) - -ax.xaxis.set_major_locator(dates.MonthLocator()) -ax.xaxis.set_minor_locator(dates.MonthLocator(bymonthday=15)) - -ax.xaxis.set_major_formatter(ticker.NullFormatter()) -ax.xaxis.set_minor_formatter(dates.DateFormatter('%b')) - -for tick in ax.xaxis.get_minor_ticks(): - tick.tick1line.set_markersize(0) - tick.tick2line.set_markersize(0) - tick.label1.set_horizontalalignment('center') - -imid = len(r)//2 -ax.set_xlabel(str(r.date[imid].year)) -plt.show() diff --git a/mpl_examples/pylab_examples/cohere_demo.hires.png b/mpl_examples/pylab_examples/cohere_demo.hires.png deleted file mode 100644 index c9823a7ff85..00000000000 Binary files a/mpl_examples/pylab_examples/cohere_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/cohere_demo.pdf b/mpl_examples/pylab_examples/cohere_demo.pdf deleted file mode 100644 index df93ae73ad2..00000000000 Binary files a/mpl_examples/pylab_examples/cohere_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/cohere_demo.png b/mpl_examples/pylab_examples/cohere_demo.png deleted file mode 100644 index fc5f15cdbb9..00000000000 Binary files a/mpl_examples/pylab_examples/cohere_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/cohere_demo.py b/mpl_examples/pylab_examples/cohere_demo.py deleted file mode 100644 index 854aeb46877..00000000000 --- a/mpl_examples/pylab_examples/cohere_demo.py +++ /dev/null @@ -1,33 +0,0 @@ -""" -Compute the coherence of two signals -""" -import numpy as np -import matplotlib.pyplot as plt - -# make a little extra space between the subplots -plt.subplots_adjust(wspace=0.5) - -dt = 0.01 -t = np.arange(0, 30, dt) -nse1 = np.random.randn(len(t)) # white noise 1 -nse2 = np.random.randn(len(t)) # white noise 2 -r = np.exp(-t/0.05) - -cnse1 = np.convolve(nse1, r, mode='same')*dt # colored noise 1 -cnse2 = np.convolve(nse2, r, mode='same')*dt # colored noise 2 - -# two signals with a coherent part and a random part -s1 = 0.01*np.sin(2*np.pi*10*t) + cnse1 -s2 = 0.01*np.sin(2*np.pi*10*t) + cnse2 - -plt.subplot(211) -plt.plot(t, s1, t, s2) -plt.xlim(0, 5) -plt.xlabel('time') -plt.ylabel('s1 and s2') -plt.grid(True) - -plt.subplot(212) -cxy, f = plt.cohere(s1, s2, 256, 1./dt) -plt.ylabel('coherence') -plt.show() diff --git a/mpl_examples/pylab_examples/color_by_yvalue.hires.png b/mpl_examples/pylab_examples/color_by_yvalue.hires.png deleted file mode 100644 index 25018c560bc..00000000000 Binary files a/mpl_examples/pylab_examples/color_by_yvalue.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/color_by_yvalue.pdf b/mpl_examples/pylab_examples/color_by_yvalue.pdf deleted file mode 100644 index cc2b4fad683..00000000000 Binary files a/mpl_examples/pylab_examples/color_by_yvalue.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/color_by_yvalue.png b/mpl_examples/pylab_examples/color_by_yvalue.png deleted file mode 100644 index 9f570070d5c..00000000000 Binary files a/mpl_examples/pylab_examples/color_by_yvalue.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/color_by_yvalue.py b/mpl_examples/pylab_examples/color_by_yvalue.py deleted file mode 100644 index 59825a1a9a3..00000000000 --- a/mpl_examples/pylab_examples/color_by_yvalue.py +++ /dev/null @@ -1,17 +0,0 @@ -# use masked arrays to plot a line with different colors by y-value -import numpy as np -import matplotlib.pyplot as plt - -t = np.arange(0.0, 2.0, 0.01) -s = np.sin(2*np.pi*t) - -upper = 0.77 -lower = -0.77 - - -supper = np.ma.masked_where(s < upper, s) -slower = np.ma.masked_where(s > lower, s) -smiddle = np.ma.masked_where(np.logical_or(s < lower, s > upper), s) - -plt.plot(t, smiddle, t, slower, t, supper) -plt.show() diff --git a/mpl_examples/pylab_examples/color_demo.hires.png b/mpl_examples/pylab_examples/color_demo.hires.png deleted file mode 100644 index 960d8e8a2a7..00000000000 Binary files a/mpl_examples/pylab_examples/color_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/color_demo.pdf b/mpl_examples/pylab_examples/color_demo.pdf deleted file mode 100644 index 761eda73e44..00000000000 Binary files a/mpl_examples/pylab_examples/color_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/color_demo.png b/mpl_examples/pylab_examples/color_demo.png deleted file mode 100644 index 8d66794f59a..00000000000 Binary files a/mpl_examples/pylab_examples/color_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/color_demo.py b/mpl_examples/pylab_examples/color_demo.py deleted file mode 100644 index 0da064f6cdd..00000000000 --- a/mpl_examples/pylab_examples/color_demo.py +++ /dev/null @@ -1,29 +0,0 @@ -""" -matplotlib gives you 5 ways to specify colors, - - 1) as a single letter string, ala MATLAB - - 2) as an html style hex string or html color name - - 3) as an R,G,B tuple, where R,G,B, range from 0-1 - - 4) as a string representing a floating point number - from 0 to 1, corresponding to shades of gray. - - 5) as a special color "Cn", where n is a number 0-9 specifying the - nth color in the currently active color cycle. - -See help(colors) for more info. -""" -import matplotlib.pyplot as plt -import numpy as np - -plt.subplot(111, facecolor='darkslategray') -#subplot(111, facecolor='#ababab') -t = np.arange(0.0, 2.0, 0.01) -s = np.sin(2*np.pi*t) -plt.plot(t, s, 'C1') -plt.xlabel('time (s)', color='C1') -plt.ylabel('voltage (mV)', color='0.5') # grayscale color -plt.title('About as silly as it gets, folks', color='#afeeee') -plt.show() diff --git a/mpl_examples/pylab_examples/colorbar_tick_labelling_demo.py b/mpl_examples/pylab_examples/colorbar_tick_labelling_demo.py deleted file mode 100644 index ff4d9c90665..00000000000 --- a/mpl_examples/pylab_examples/colorbar_tick_labelling_demo.py +++ /dev/null @@ -1,34 +0,0 @@ -"""Produce custom labelling for a colorbar. - -Contributed by Scott Sinclair -""" - -import matplotlib.pyplot as plt -import numpy as np -from matplotlib import cm -from numpy.random import randn - -# Make plot with vertical (default) colorbar -fig, ax = plt.subplots() - -data = np.clip(randn(250, 250), -1, 1) - -cax = ax.imshow(data, interpolation='nearest', cmap=cm.coolwarm) -ax.set_title('Gaussian noise with vertical colorbar') - -# Add colorbar, make sure to specify tick locations to match desired ticklabels -cbar = fig.colorbar(cax, ticks=[-1, 0, 1]) -cbar.ax.set_yticklabels(['< -1', '0', '> 1']) # vertically oriented colorbar - -# Make plot with horizontal colorbar -fig, ax = plt.subplots() - -data = np.clip(randn(250, 250), -1, 1) - -cax = ax.imshow(data, interpolation='nearest', cmap=cm.afmhot) -ax.set_title('Gaussian noise with horizontal colorbar') - -cbar = fig.colorbar(cax, ticks=[-1, 0, 1], orientation='horizontal') -cbar.ax.set_xticklabels(['Low', 'Medium', 'High']) # horizontal colorbar - -plt.show() diff --git a/mpl_examples/pylab_examples/colorbar_tick_labelling_demo_00.hires.png b/mpl_examples/pylab_examples/colorbar_tick_labelling_demo_00.hires.png deleted file mode 100644 index b7ed0db38b7..00000000000 Binary files a/mpl_examples/pylab_examples/colorbar_tick_labelling_demo_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/colorbar_tick_labelling_demo_00.pdf b/mpl_examples/pylab_examples/colorbar_tick_labelling_demo_00.pdf deleted file mode 100644 index 85dbd227cc5..00000000000 Binary files a/mpl_examples/pylab_examples/colorbar_tick_labelling_demo_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/colorbar_tick_labelling_demo_00.png b/mpl_examples/pylab_examples/colorbar_tick_labelling_demo_00.png deleted file mode 100644 index 9e0e5ca7892..00000000000 Binary files a/mpl_examples/pylab_examples/colorbar_tick_labelling_demo_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/colorbar_tick_labelling_demo_01.hires.png b/mpl_examples/pylab_examples/colorbar_tick_labelling_demo_01.hires.png deleted file mode 100644 index 4e76de83364..00000000000 Binary files a/mpl_examples/pylab_examples/colorbar_tick_labelling_demo_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/colorbar_tick_labelling_demo_01.pdf b/mpl_examples/pylab_examples/colorbar_tick_labelling_demo_01.pdf deleted file mode 100644 index acfa9d50d6f..00000000000 Binary files a/mpl_examples/pylab_examples/colorbar_tick_labelling_demo_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/colorbar_tick_labelling_demo_01.png b/mpl_examples/pylab_examples/colorbar_tick_labelling_demo_01.png deleted file mode 100644 index e5490675901..00000000000 Binary files a/mpl_examples/pylab_examples/colorbar_tick_labelling_demo_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_corner_mask.hires.png b/mpl_examples/pylab_examples/contour_corner_mask.hires.png deleted file mode 100644 index beca459782d..00000000000 Binary files a/mpl_examples/pylab_examples/contour_corner_mask.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_corner_mask.pdf b/mpl_examples/pylab_examples/contour_corner_mask.pdf deleted file mode 100644 index 1014ef8b698..00000000000 Binary files a/mpl_examples/pylab_examples/contour_corner_mask.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_corner_mask.png b/mpl_examples/pylab_examples/contour_corner_mask.png deleted file mode 100644 index b0e3f741cdd..00000000000 Binary files a/mpl_examples/pylab_examples/contour_corner_mask.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_corner_mask.py b/mpl_examples/pylab_examples/contour_corner_mask.py deleted file mode 100644 index 7be99f7182e..00000000000 --- a/mpl_examples/pylab_examples/contour_corner_mask.py +++ /dev/null @@ -1,34 +0,0 @@ -""" -Illustrate the difference between corner_mask=False and corner_mask=True -for masked contour plots. -""" -import matplotlib.pyplot as plt -import numpy as np - -# Data to plot. -x, y = np.meshgrid(np.arange(7), np.arange(10)) -z = np.sin(0.5*x)*np.cos(0.52*y) - -# Mask various z values. -mask = np.zeros_like(z, dtype=np.bool) -mask[2, 3:5] = True -mask[3:5, 4] = True -mask[7, 2] = True -mask[5, 0] = True -mask[0, 6] = True -z = np.ma.array(z, mask=mask) - -corner_masks = [False, True] -for i, corner_mask in enumerate(corner_masks): - plt.subplot(1, 2, i+1) - cs = plt.contourf(x, y, z, corner_mask=corner_mask) - plt.contour(cs, colors='k') - plt.title('corner_mask = {0}'.format(corner_mask)) - - # Plot grid. - plt.grid(c='k', ls='-', alpha=0.3) - - # Indicate masked points with red circles. - plt.plot(np.ma.array(x, mask=~mask), y, 'ro') - -plt.show() diff --git a/mpl_examples/pylab_examples/contour_demo.py b/mpl_examples/pylab_examples/contour_demo.py deleted file mode 100644 index b3555b1de1e..00000000000 --- a/mpl_examples/pylab_examples/contour_demo.py +++ /dev/null @@ -1,112 +0,0 @@ -""" -Illustrate simple contour plotting, contours on an image with -a colorbar for the contours, and labelled contours. - -See also contour_image.py. -""" -import matplotlib -import numpy as np -import matplotlib.cm as cm -import matplotlib.mlab as mlab -import matplotlib.pyplot as plt - -matplotlib.rcParams['xtick.direction'] = 'out' -matplotlib.rcParams['ytick.direction'] = 'out' - -delta = 0.025 -x = np.arange(-3.0, 3.0, delta) -y = np.arange(-2.0, 2.0, delta) -X, Y = np.meshgrid(x, y) -Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) -Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) -# difference of Gaussians -Z = 10.0 * (Z2 - Z1) - - -# Create a simple contour plot with labels using default colors. The -# inline argument to clabel will control whether the labels are draw -# over the line segments of the contour, removing the lines beneath -# the label -plt.figure() -CS = plt.contour(X, Y, Z) -plt.clabel(CS, inline=1, fontsize=10) -plt.title('Simplest default with labels') - - -# contour labels can be placed manually by providing list of positions -# (in data coordinate). See ginput_manual_clabel.py for interactive -# placement. -plt.figure() -CS = plt.contour(X, Y, Z) -manual_locations = [(-1, -1.4), (-0.62, -0.7), (-2, 0.5), (1.7, 1.2), (2.0, 1.4), (2.4, 1.7)] -plt.clabel(CS, inline=1, fontsize=10, manual=manual_locations) -plt.title('labels at selected locations') - - -# You can force all the contours to be the same color. -plt.figure() -CS = plt.contour(X, Y, Z, 6, - colors='k', # negative contours will be dashed by default - ) -plt.clabel(CS, fontsize=9, inline=1) -plt.title('Single color - negative contours dashed') - -# You can set negative contours to be solid instead of dashed: -matplotlib.rcParams['contour.negative_linestyle'] = 'solid' -plt.figure() -CS = plt.contour(X, Y, Z, 6, - colors='k', # negative contours will be dashed by default - ) -plt.clabel(CS, fontsize=9, inline=1) -plt.title('Single color - negative contours solid') - - -# And you can manually specify the colors of the contour -plt.figure() -CS = plt.contour(X, Y, Z, 6, - linewidths=np.arange(.5, 4, .5), - colors=('r', 'green', 'blue', (1, 1, 0), '#afeeee', '0.5') - ) -plt.clabel(CS, fontsize=9, inline=1) -plt.title('Crazy lines') - - -# Or you can use a colormap to specify the colors; the default -# colormap will be used for the contour lines -plt.figure() -im = plt.imshow(Z, interpolation='bilinear', origin='lower', - cmap=cm.gray, extent=(-3, 3, -2, 2)) -levels = np.arange(-1.2, 1.6, 0.2) -CS = plt.contour(Z, levels, - origin='lower', - linewidths=2, - extent=(-3, 3, -2, 2)) - -# Thicken the zero contour. -zc = CS.collections[6] -plt.setp(zc, linewidth=4) - -plt.clabel(CS, levels[1::2], # label every second level - inline=1, - fmt='%1.1f', - fontsize=14) - -# make a colorbar for the contour lines -CB = plt.colorbar(CS, shrink=0.8, extend='both') - -plt.title('Lines with colorbar') -#plt.hot() # Now change the colormap for the contour lines and colorbar -plt.flag() - -# We can still add a colorbar for the image, too. -CBI = plt.colorbar(im, orientation='horizontal', shrink=0.8) - -# This makes the original colorbar look a bit out of place, -# so let's improve its position. - -l, b, w, h = plt.gca().get_position().bounds -ll, bb, ww, hh = CB.ax.get_position().bounds -CB.ax.set_position([ll, b + 0.1*h, ww, h*0.8]) - - -plt.show() diff --git a/mpl_examples/pylab_examples/contour_demo_00.hires.png b/mpl_examples/pylab_examples/contour_demo_00.hires.png deleted file mode 100644 index 1586d7c031b..00000000000 Binary files a/mpl_examples/pylab_examples/contour_demo_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_demo_00.pdf b/mpl_examples/pylab_examples/contour_demo_00.pdf deleted file mode 100644 index 5975672cd12..00000000000 Binary files a/mpl_examples/pylab_examples/contour_demo_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_demo_00.png b/mpl_examples/pylab_examples/contour_demo_00.png deleted file mode 100644 index b2fe02f6530..00000000000 Binary files a/mpl_examples/pylab_examples/contour_demo_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_demo_01.hires.png b/mpl_examples/pylab_examples/contour_demo_01.hires.png deleted file mode 100644 index 92dbd202425..00000000000 Binary files a/mpl_examples/pylab_examples/contour_demo_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_demo_01.pdf b/mpl_examples/pylab_examples/contour_demo_01.pdf deleted file mode 100644 index 9d2becc114b..00000000000 Binary files a/mpl_examples/pylab_examples/contour_demo_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_demo_01.png b/mpl_examples/pylab_examples/contour_demo_01.png deleted file mode 100644 index 515048e6798..00000000000 Binary files a/mpl_examples/pylab_examples/contour_demo_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_demo_02.hires.png b/mpl_examples/pylab_examples/contour_demo_02.hires.png deleted file mode 100644 index 2af0a2b55b2..00000000000 Binary files a/mpl_examples/pylab_examples/contour_demo_02.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_demo_02.pdf b/mpl_examples/pylab_examples/contour_demo_02.pdf deleted file mode 100644 index b33abdf0907..00000000000 Binary files a/mpl_examples/pylab_examples/contour_demo_02.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_demo_02.png b/mpl_examples/pylab_examples/contour_demo_02.png deleted file mode 100644 index c8927e86083..00000000000 Binary files a/mpl_examples/pylab_examples/contour_demo_02.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_demo_03.hires.png b/mpl_examples/pylab_examples/contour_demo_03.hires.png deleted file mode 100644 index 1ed29eb46a4..00000000000 Binary files a/mpl_examples/pylab_examples/contour_demo_03.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_demo_03.pdf b/mpl_examples/pylab_examples/contour_demo_03.pdf deleted file mode 100644 index cde00b125f9..00000000000 Binary files a/mpl_examples/pylab_examples/contour_demo_03.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_demo_03.png b/mpl_examples/pylab_examples/contour_demo_03.png deleted file mode 100644 index d2baf253b55..00000000000 Binary files a/mpl_examples/pylab_examples/contour_demo_03.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_demo_04.hires.png b/mpl_examples/pylab_examples/contour_demo_04.hires.png deleted file mode 100644 index 372baba36cf..00000000000 Binary files a/mpl_examples/pylab_examples/contour_demo_04.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_demo_04.pdf b/mpl_examples/pylab_examples/contour_demo_04.pdf deleted file mode 100644 index 55f9ecfa5ae..00000000000 Binary files a/mpl_examples/pylab_examples/contour_demo_04.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_demo_04.png b/mpl_examples/pylab_examples/contour_demo_04.png deleted file mode 100644 index 3081c247b18..00000000000 Binary files a/mpl_examples/pylab_examples/contour_demo_04.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_demo_05.hires.png b/mpl_examples/pylab_examples/contour_demo_05.hires.png deleted file mode 100644 index 5c643b076aa..00000000000 Binary files a/mpl_examples/pylab_examples/contour_demo_05.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_demo_05.pdf b/mpl_examples/pylab_examples/contour_demo_05.pdf deleted file mode 100644 index 38b0d00735b..00000000000 Binary files a/mpl_examples/pylab_examples/contour_demo_05.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_demo_05.png b/mpl_examples/pylab_examples/contour_demo_05.png deleted file mode 100644 index 34714321b81..00000000000 Binary files a/mpl_examples/pylab_examples/contour_demo_05.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_image.hires.png b/mpl_examples/pylab_examples/contour_image.hires.png deleted file mode 100644 index c1e89c6d8e5..00000000000 Binary files a/mpl_examples/pylab_examples/contour_image.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_image.pdf b/mpl_examples/pylab_examples/contour_image.pdf deleted file mode 100644 index 9ab7516a855..00000000000 Binary files a/mpl_examples/pylab_examples/contour_image.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_image.png b/mpl_examples/pylab_examples/contour_image.png deleted file mode 100644 index 82d34d1298e..00000000000 Binary files a/mpl_examples/pylab_examples/contour_image.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_image.py b/mpl_examples/pylab_examples/contour_image.py deleted file mode 100644 index e38119afe99..00000000000 --- a/mpl_examples/pylab_examples/contour_image.py +++ /dev/null @@ -1,102 +0,0 @@ -''' -Test combinations of contouring, filled contouring, and image plotting. -For contour labelling, see contour_demo.py. - -The emphasis in this demo is on showing how to make contours register -correctly on images, and on how to get both of them oriented as -desired. In particular, note the usage of the "origin" and "extent" -keyword arguments to imshow and contour. -''' -import matplotlib.pyplot as plt -import numpy as np -from matplotlib import mlab, cm - -# Default delta is large because that makes it fast, and it illustrates -# the correct registration between image and contours. -delta = 0.5 - -extent = (-3, 4, -4, 3) - -x = np.arange(-3.0, 4.001, delta) -y = np.arange(-4.0, 3.001, delta) -X, Y = np.meshgrid(x, y) -Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) -Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) -Z = (Z1 - Z2) * 10 - -levels = np.arange(-2.0, 1.601, 0.4) # Boost the upper limit to avoid truncation errors. - -norm = cm.colors.Normalize(vmax=abs(Z).max(), vmin=-abs(Z).max()) -cmap = cm.PRGn - -fig = plt.figure() -fig.subplots_adjust(hspace=0.3) - - -plt.subplot(2, 2, 1) - -cset1 = plt.contourf(X, Y, Z, levels, - cmap=cm.get_cmap(cmap, len(levels) - 1), - norm=norm, - ) -# It is not necessary, but for the colormap, we need only the -# number of levels minus 1. To avoid discretization error, use -# either this number or a large number such as the default (256). - -# If we want lines as well as filled regions, we need to call -# contour separately; don't try to change the edgecolor or edgewidth -# of the polygons in the collections returned by contourf. -# Use levels output from previous call to guarantee they are the same. - -cset2 = plt.contour(X, Y, Z, cset1.levels, colors='k') - -# We don't really need dashed contour lines to indicate negative -# regions, so let's turn them off. - -for c in cset2.collections: - c.set_linestyle('solid') - -# It is easier here to make a separate call to contour than -# to set up an array of colors and linewidths. -# We are making a thick green line as a zero contour. -# Specify the zero level as a tuple with only 0 in it. - -cset3 = plt.contour(X, Y, Z, (0,), colors='g', linewidths=2) -plt.title('Filled contours') -plt.colorbar(cset1) - - -plt.subplot(2, 2, 2) - -plt.imshow(Z, extent=extent, cmap=cmap, norm=norm) -v = plt.axis() -plt.contour(Z, levels, colors='k', origin='upper', extent=extent) -plt.axis(v) -plt.title("Image, origin 'upper'") - -plt.subplot(2, 2, 3) - -plt.imshow(Z, origin='lower', extent=extent, cmap=cmap, norm=norm) -v = plt.axis() -plt.contour(Z, levels, colors='k', origin='lower', extent=extent) -plt.axis(v) -plt.title("Image, origin 'lower'") - -plt.subplot(2, 2, 4) - -# We will use the interpolation "nearest" here to show the actual -# image pixels. -# Note that the contour lines don't extend to the edge of the box. -# This is intentional. The Z values are defined at the center of each -# image pixel (each color block on the following subplot), so the -# domain that is contoured does not extend beyond these pixel centers. -im = plt.imshow(Z, interpolation='nearest', extent=extent, cmap=cmap, norm=norm) -v = plt.axis() -plt.contour(Z, levels, colors='k', origin='image', extent=extent) -plt.axis(v) -ylim = plt.get(plt.gca(), 'ylim') -plt.setp(plt.gca(), ylim=ylim[::-1]) -plt.title("Origin from rc, reversed y-axis") -plt.colorbar(im) - -plt.show() diff --git a/mpl_examples/pylab_examples/contour_label_demo.py b/mpl_examples/pylab_examples/contour_label_demo.py deleted file mode 100644 index fe0cf87cb56..00000000000 --- a/mpl_examples/pylab_examples/contour_label_demo.py +++ /dev/null @@ -1,86 +0,0 @@ -""" -Illustrate some of the more advanced things that one can do with -contour labels. - -See also contour_demo.py. -""" -import matplotlib -import numpy as np -import matplotlib.cm as cm -import matplotlib.mlab as mlab -import matplotlib.ticker as ticker -import matplotlib.pyplot as plt - -matplotlib.rcParams['xtick.direction'] = 'out' -matplotlib.rcParams['ytick.direction'] = 'out' - -################################################## -# Define our surface -################################################## -delta = 0.025 -x = np.arange(-3.0, 3.0, delta) -y = np.arange(-2.0, 2.0, delta) -X, Y = np.meshgrid(x, y) -Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) -Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) -# difference of Gaussians -Z = 10.0 * (Z2 - Z1) - -################################################## -# Make contour labels using creative float classes -# Follows suggestion of Manuel Metz -################################################## -plt.figure() - -# Basic contour plot -CS = plt.contour(X, Y, Z) - - -# Define a class that forces representation of float to look a certain way -# This remove trailing zero so '1.0' becomes '1' -class nf(float): - def __repr__(self): - str = '%.1f' % (self.__float__(),) - if str[-1] == '0': - return '%.0f' % self.__float__() - else: - return '%.1f' % self.__float__() - -# Recast levels to new class -CS.levels = [nf(val) for val in CS.levels] - -# Label levels with specially formatted floats -if plt.rcParams["text.usetex"]: - fmt = r'%r \%%' -else: - fmt = '%r %%' -plt.clabel(CS, CS.levels, inline=True, fmt=fmt, fontsize=10) - -################################################## -# Label contours with arbitrary strings using a -# dictionary -################################################## -plt.figure() - -# Basic contour plot -CS = plt.contour(X, Y, Z) - -fmt = {} -strs = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh'] -for l, s in zip(CS.levels, strs): - fmt[l] = s - -# Label every other level using strings -plt.clabel(CS, CS.levels[::2], inline=True, fmt=fmt, fontsize=10) - -# Use a Formatter - -plt.figure() - -CS = plt.contour(X, Y, 100**Z, locator=plt.LogLocator()) -fmt = ticker.LogFormatterMathtext() -fmt.create_dummy_axis() -plt.clabel(CS, CS.levels, fmt=fmt) -plt.title("$100^Z$") - -plt.show() diff --git a/mpl_examples/pylab_examples/contour_label_demo_00.hires.png b/mpl_examples/pylab_examples/contour_label_demo_00.hires.png deleted file mode 100644 index 7b4218671d5..00000000000 Binary files a/mpl_examples/pylab_examples/contour_label_demo_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_label_demo_00.pdf b/mpl_examples/pylab_examples/contour_label_demo_00.pdf deleted file mode 100644 index 5c2f8e7c562..00000000000 Binary files a/mpl_examples/pylab_examples/contour_label_demo_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_label_demo_00.png b/mpl_examples/pylab_examples/contour_label_demo_00.png deleted file mode 100644 index 537605f1780..00000000000 Binary files a/mpl_examples/pylab_examples/contour_label_demo_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_label_demo_01.hires.png b/mpl_examples/pylab_examples/contour_label_demo_01.hires.png deleted file mode 100644 index 11cfb76296b..00000000000 Binary files a/mpl_examples/pylab_examples/contour_label_demo_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_label_demo_01.pdf b/mpl_examples/pylab_examples/contour_label_demo_01.pdf deleted file mode 100644 index 2b54eb57ceb..00000000000 Binary files a/mpl_examples/pylab_examples/contour_label_demo_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_label_demo_01.png b/mpl_examples/pylab_examples/contour_label_demo_01.png deleted file mode 100644 index e7f124ef520..00000000000 Binary files a/mpl_examples/pylab_examples/contour_label_demo_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_label_demo_02.hires.png b/mpl_examples/pylab_examples/contour_label_demo_02.hires.png deleted file mode 100644 index 68f14101850..00000000000 Binary files a/mpl_examples/pylab_examples/contour_label_demo_02.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_label_demo_02.pdf b/mpl_examples/pylab_examples/contour_label_demo_02.pdf deleted file mode 100644 index bbdf4326b88..00000000000 Binary files a/mpl_examples/pylab_examples/contour_label_demo_02.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/contour_label_demo_02.png b/mpl_examples/pylab_examples/contour_label_demo_02.png deleted file mode 100644 index 9fdadd6988a..00000000000 Binary files a/mpl_examples/pylab_examples/contour_label_demo_02.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contourf_demo.py b/mpl_examples/pylab_examples/contourf_demo.py deleted file mode 100644 index 20a17c85191..00000000000 --- a/mpl_examples/pylab_examples/contourf_demo.py +++ /dev/null @@ -1,106 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -origin = 'lower' -#origin = 'upper' - -delta = 0.025 - -x = y = np.arange(-3.0, 3.01, delta) -X, Y = np.meshgrid(x, y) -Z1 = plt.mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) -Z2 = plt.mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) -Z = 10 * (Z1 - Z2) - -nr, nc = Z.shape - -# put NaNs in one corner: -Z[-nr//6:, -nc//6:] = np.nan -# contourf will convert these to masked - - -Z = np.ma.array(Z) -# mask another corner: -Z[:nr//6, :nc//6] = np.ma.masked - -# mask a circle in the middle: -interior = np.sqrt((X**2) + (Y**2)) < 0.5 -Z[interior] = np.ma.masked - -# We are using automatic selection of contour levels; -# this is usually not such a good idea, because they don't -# occur on nice boundaries, but we do it here for purposes -# of illustration. -CS = plt.contourf(X, Y, Z, 10, - #[-1, -0.1, 0, 0.1], - #alpha=0.5, - cmap=plt.cm.bone, - origin=origin) - -# Note that in the following, we explicitly pass in a subset of -# the contour levels used for the filled contours. Alternatively, -# We could pass in additional levels to provide extra resolution, -# or leave out the levels kwarg to use all of the original levels. - -CS2 = plt.contour(CS, levels=CS.levels[::2], - colors='r', - origin=origin) - -plt.title('Nonsense (3 masked regions)') -plt.xlabel('word length anomaly') -plt.ylabel('sentence length anomaly') - -# Make a colorbar for the ContourSet returned by the contourf call. -cbar = plt.colorbar(CS) -cbar.ax.set_ylabel('verbosity coefficient') -# Add the contour line levels to the colorbar -cbar.add_lines(CS2) - -plt.figure() - -# Now make a contour plot with the levels specified, -# and with the colormap generated automatically from a list -# of colors. -levels = [-1.5, -1, -0.5, 0, 0.5, 1] -CS3 = plt.contourf(X, Y, Z, levels, - colors=('r', 'g', 'b'), - origin=origin, - extend='both') -# Our data range extends outside the range of levels; make -# data below the lowest contour level yellow, and above the -# highest level cyan: -CS3.cmap.set_under('yellow') -CS3.cmap.set_over('cyan') - -CS4 = plt.contour(X, Y, Z, levels, - colors=('k',), - linewidths=(3,), - origin=origin) -plt.title('Listed colors (3 masked regions)') -plt.clabel(CS4, fmt='%2.1f', colors='w', fontsize=14) - -# Notice that the colorbar command gets all the information it -# needs from the ContourSet object, CS3. -plt.colorbar(CS3) - -# Illustrate all 4 possible "extend" settings: -extends = ["neither", "both", "min", "max"] -cmap = plt.cm.get_cmap("winter") -cmap.set_under("magenta") -cmap.set_over("yellow") -# Note: contouring simply excludes masked or nan regions, so -# instead of using the "bad" colormap value for them, it draws -# nothing at all in them. Therefore the following would have -# no effect: -# cmap.set_bad("red") - -fig, axs = plt.subplots(2, 2) -fig.subplots_adjust(hspace=0.3) - -for ax, extend in zip(axs.ravel(), extends): - cs = ax.contourf(X, Y, Z, levels, cmap=cmap, extend=extend, origin=origin) - fig.colorbar(cs, ax=ax, shrink=0.9) - ax.set_title("extend = %s" % extend) - ax.locator_params(nbins=4) - -plt.show() diff --git a/mpl_examples/pylab_examples/contourf_demo_00.hires.png b/mpl_examples/pylab_examples/contourf_demo_00.hires.png deleted file mode 100644 index 55d95474306..00000000000 Binary files a/mpl_examples/pylab_examples/contourf_demo_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contourf_demo_00.pdf b/mpl_examples/pylab_examples/contourf_demo_00.pdf deleted file mode 100644 index 03d63bba0a9..00000000000 Binary files a/mpl_examples/pylab_examples/contourf_demo_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/contourf_demo_00.png b/mpl_examples/pylab_examples/contourf_demo_00.png deleted file mode 100644 index 56078bc8bf2..00000000000 Binary files a/mpl_examples/pylab_examples/contourf_demo_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contourf_demo_01.hires.png b/mpl_examples/pylab_examples/contourf_demo_01.hires.png deleted file mode 100644 index e16780912e0..00000000000 Binary files a/mpl_examples/pylab_examples/contourf_demo_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contourf_demo_01.pdf b/mpl_examples/pylab_examples/contourf_demo_01.pdf deleted file mode 100644 index c01c13efad9..00000000000 Binary files a/mpl_examples/pylab_examples/contourf_demo_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/contourf_demo_01.png b/mpl_examples/pylab_examples/contourf_demo_01.png deleted file mode 100644 index f2c0d6b21e8..00000000000 Binary files a/mpl_examples/pylab_examples/contourf_demo_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contourf_demo_02.hires.png b/mpl_examples/pylab_examples/contourf_demo_02.hires.png deleted file mode 100644 index b3fe7e63a4f..00000000000 Binary files a/mpl_examples/pylab_examples/contourf_demo_02.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contourf_demo_02.pdf b/mpl_examples/pylab_examples/contourf_demo_02.pdf deleted file mode 100644 index 98de077fac0..00000000000 Binary files a/mpl_examples/pylab_examples/contourf_demo_02.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/contourf_demo_02.png b/mpl_examples/pylab_examples/contourf_demo_02.png deleted file mode 100644 index b4d9cdb3ff9..00000000000 Binary files a/mpl_examples/pylab_examples/contourf_demo_02.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contourf_hatching.py b/mpl_examples/pylab_examples/contourf_hatching.py deleted file mode 100644 index b1395ec5f3b..00000000000 --- a/mpl_examples/pylab_examples/contourf_hatching.py +++ /dev/null @@ -1,44 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - - -# invent some numbers, turning the x and y arrays into simple -# 2d arrays, which make combining them together easier. -x = np.linspace(-3, 5, 150).reshape(1, -1) -y = np.linspace(-3, 5, 120).reshape(-1, 1) -z = np.cos(x) + np.sin(y) - -# we no longer need x and y to be 2 dimensional, so flatten them. -x, y = x.flatten(), y.flatten() - - -# --------------------------------------------- -# | Plot #1 | -# --------------------------------------------- -# the simplest hatched plot with a colorbar -fig = plt.figure() -cs = plt.contourf(x, y, z, hatches=['-', '/', '\\', '//'], - cmap=plt.get_cmap('gray'), - extend='both', alpha=0.5 - ) -plt.colorbar() - - -# --------------------------------------------- -# | Plot #2 | -# --------------------------------------------- -# a plot of hatches without color with a legend -plt.figure() -n_levels = 6 -plt.contour(x, y, z, n_levels, colors='black', linestyles='-') -cs = plt.contourf(x, y, z, n_levels, colors='none', - hatches=['.', '/', '\\', None, '\\\\', '*'], - extend='lower' - ) - -# create a legend for the contour set -artists, labels = cs.legend_elements() -plt.legend(artists, labels, handleheight=2) - - -plt.show() diff --git a/mpl_examples/pylab_examples/contourf_hatching_00.hires.png b/mpl_examples/pylab_examples/contourf_hatching_00.hires.png deleted file mode 100644 index 306899a9da5..00000000000 Binary files a/mpl_examples/pylab_examples/contourf_hatching_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contourf_hatching_00.pdf b/mpl_examples/pylab_examples/contourf_hatching_00.pdf deleted file mode 100644 index 1e9547d5270..00000000000 Binary files a/mpl_examples/pylab_examples/contourf_hatching_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/contourf_hatching_00.png b/mpl_examples/pylab_examples/contourf_hatching_00.png deleted file mode 100644 index 180eb4b99f0..00000000000 Binary files a/mpl_examples/pylab_examples/contourf_hatching_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contourf_hatching_01.hires.png b/mpl_examples/pylab_examples/contourf_hatching_01.hires.png deleted file mode 100644 index cb85149646a..00000000000 Binary files a/mpl_examples/pylab_examples/contourf_hatching_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/contourf_hatching_01.pdf b/mpl_examples/pylab_examples/contourf_hatching_01.pdf deleted file mode 100644 index 5099f32ba8a..00000000000 Binary files a/mpl_examples/pylab_examples/contourf_hatching_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/contourf_hatching_01.png b/mpl_examples/pylab_examples/contourf_hatching_01.png deleted file mode 100644 index 51e327c62b7..00000000000 Binary files a/mpl_examples/pylab_examples/contourf_hatching_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/coords_demo.hires.png b/mpl_examples/pylab_examples/coords_demo.hires.png deleted file mode 100644 index 8c8fdbbdb7c..00000000000 Binary files a/mpl_examples/pylab_examples/coords_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/coords_demo.pdf b/mpl_examples/pylab_examples/coords_demo.pdf deleted file mode 100644 index 1bff58d2986..00000000000 Binary files a/mpl_examples/pylab_examples/coords_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/coords_demo.png b/mpl_examples/pylab_examples/coords_demo.png deleted file mode 100644 index d482dfca8c1..00000000000 Binary files a/mpl_examples/pylab_examples/coords_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/coords_demo.py b/mpl_examples/pylab_examples/coords_demo.py deleted file mode 100644 index 7945e87b21c..00000000000 --- a/mpl_examples/pylab_examples/coords_demo.py +++ /dev/null @@ -1,39 +0,0 @@ -""" -An example of how to interact with the plotting canvas by connecting -to move and click events -""" -from __future__ import print_function -import sys -import matplotlib.pyplot as plt -import numpy as np - -t = np.arange(0.0, 1.0, 0.01) -s = np.sin(2*np.pi*t) -fig, ax = plt.subplots() -ax.plot(t, s) - - -def on_move(event): - # get the x and y pixel coords - x, y = event.x, event.y - - if event.inaxes: - ax = event.inaxes # the axes instance - print('data coords %f %f' % (event.xdata, event.ydata)) - - -def on_click(event): - # get the x and y coords, flip y from top to bottom - x, y = event.x, event.y - if event.button == 1: - if event.inaxes is not None: - print('data coords %f %f' % (event.xdata, event.ydata)) - -binding_id = plt.connect('motion_notify_event', on_move) -plt.connect('button_press_event', on_click) - -if "test_disconnect" in sys.argv: - print("disconnecting console coordinate printout...") - plt.disconnect(binding_id) - -plt.show() diff --git a/mpl_examples/pylab_examples/coords_report.hires.png b/mpl_examples/pylab_examples/coords_report.hires.png deleted file mode 100644 index 8b6c7ee5f87..00000000000 Binary files a/mpl_examples/pylab_examples/coords_report.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/coords_report.pdf b/mpl_examples/pylab_examples/coords_report.pdf deleted file mode 100644 index 88bf78ef1b0..00000000000 Binary files a/mpl_examples/pylab_examples/coords_report.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/coords_report.png b/mpl_examples/pylab_examples/coords_report.png deleted file mode 100644 index f2cf305fa8f..00000000000 Binary files a/mpl_examples/pylab_examples/coords_report.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/coords_report.py b/mpl_examples/pylab_examples/coords_report.py deleted file mode 100644 index cdc0d445a43..00000000000 --- a/mpl_examples/pylab_examples/coords_report.py +++ /dev/null @@ -1,17 +0,0 @@ -# override the default reporting of coords - -import matplotlib.pyplot as plt -import numpy as np - - -def millions(x): - return '$%1.1fM' % (x*1e-6) - -x = np.random.rand(20) -y = 1e7*np.random.rand(20) - -fig, ax = plt.subplots() -ax.fmt_ydata = millions -plt.plot(x, y, 'o') - -plt.show() diff --git a/mpl_examples/pylab_examples/csd_demo.hires.png b/mpl_examples/pylab_examples/csd_demo.hires.png deleted file mode 100644 index 80beafc58a1..00000000000 Binary files a/mpl_examples/pylab_examples/csd_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/csd_demo.pdf b/mpl_examples/pylab_examples/csd_demo.pdf deleted file mode 100644 index 0787b9f6794..00000000000 Binary files a/mpl_examples/pylab_examples/csd_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/csd_demo.png b/mpl_examples/pylab_examples/csd_demo.png deleted file mode 100644 index fbe7b6d0222..00000000000 Binary files a/mpl_examples/pylab_examples/csd_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/csd_demo.py b/mpl_examples/pylab_examples/csd_demo.py deleted file mode 100644 index 3e2fe072eec..00000000000 --- a/mpl_examples/pylab_examples/csd_demo.py +++ /dev/null @@ -1,33 +0,0 @@ -""" -Compute the cross spectral density of two signals -""" -import numpy as np -import matplotlib.pyplot as plt - - -fig, (ax1, ax2) = plt.subplots(2, 1) -# make a little extra space between the subplots -fig.subplots_adjust(hspace=0.5) - -dt = 0.01 -t = np.arange(0, 30, dt) -nse1 = np.random.randn(len(t)) # white noise 1 -nse2 = np.random.randn(len(t)) # white noise 2 -r = np.exp(-t/0.05) - -cnse1 = np.convolve(nse1, r, mode='same')*dt # colored noise 1 -cnse2 = np.convolve(nse2, r, mode='same')*dt # colored noise 2 - -# two signals with a coherent part and a random part -s1 = 0.01*np.sin(2*np.pi*10*t) + cnse1 -s2 = 0.01*np.sin(2*np.pi*10*t) + cnse2 - -ax1.plot(t, s1, t, s2) -ax1.set_xlim(0, 5) -ax1.set_xlabel('time') -ax1.set_ylabel('s1 and s2') -ax1.grid(True) - -cxy, f = ax2.csd(s1, s2, 256, 1./dt) -ax2.set_ylabel('CSD (db)') -plt.show() diff --git a/mpl_examples/pylab_examples/custom_cmap.hires.png b/mpl_examples/pylab_examples/custom_cmap.hires.png deleted file mode 100644 index 31c535e1aea..00000000000 Binary files a/mpl_examples/pylab_examples/custom_cmap.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/custom_cmap.pdf b/mpl_examples/pylab_examples/custom_cmap.pdf deleted file mode 100644 index bebda56e7ee..00000000000 Binary files a/mpl_examples/pylab_examples/custom_cmap.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/custom_cmap.png b/mpl_examples/pylab_examples/custom_cmap.png deleted file mode 100644 index 9c38c5d49ae..00000000000 Binary files a/mpl_examples/pylab_examples/custom_cmap.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/custom_cmap.py b/mpl_examples/pylab_examples/custom_cmap.py deleted file mode 100644 index b3e44843be7..00000000000 --- a/mpl_examples/pylab_examples/custom_cmap.py +++ /dev/null @@ -1,215 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.colors import LinearSegmentedColormap - -""" -Creating a colormap from a list of colors ------------------------------------------ -Creating a colormap from a list of colors can be done with the `from_list` -method of `LinearSegmentedColormap`. You must pass a list of RGB tuples that -define the mixture of colors from 0 to 1. - - -Creating custom colormaps -------------------------- -It is also possible to create a custom mapping for a colormap. This is -accomplished by creating dictionary that specifies how the RGB channels -change from one end of the cmap to the other. - -Example: suppose you want red to increase from 0 to 1 over the bottom -half, green to do the same over the middle half, and blue over the top -half. Then you would use: - -cdict = {'red': ((0.0, 0.0, 0.0), - (0.5, 1.0, 1.0), - (1.0, 1.0, 1.0)), - - 'green': ((0.0, 0.0, 0.0), - (0.25, 0.0, 0.0), - (0.75, 1.0, 1.0), - (1.0, 1.0, 1.0)), - - 'blue': ((0.0, 0.0, 0.0), - (0.5, 0.0, 0.0), - (1.0, 1.0, 1.0))} - -If, as in this example, there are no discontinuities in the r, g, and b -components, then it is quite simple: the second and third element of -each tuple, above, is the same--call it "y". The first element ("x") -defines interpolation intervals over the full range of 0 to 1, and it -must span that whole range. In other words, the values of x divide the -0-to-1 range into a set of segments, and y gives the end-point color -values for each segment. - -Now consider the green. cdict['green'] is saying that for -0 <= x <= 0.25, y is zero; no green. -0.25 < x <= 0.75, y varies linearly from 0 to 1. -x > 0.75, y remains at 1, full green. - -If there are discontinuities, then it is a little more complicated. -Label the 3 elements in each row in the cdict entry for a given color as -(x, y0, y1). Then for values of x between x[i] and x[i+1] the color -value is interpolated between y1[i] and y0[i+1]. - -Going back to the cookbook example, look at cdict['red']; because y0 != -y1, it is saying that for x from 0 to 0.5, red increases from 0 to 1, -but then it jumps down, so that for x from 0.5 to 1, red increases from -0.7 to 1. Green ramps from 0 to 1 as x goes from 0 to 0.5, then jumps -back to 0, and ramps back to 1 as x goes from 0.5 to 1. - -row i: x y0 y1 - / - / -row i+1: x y0 y1 - -Above is an attempt to show that for x in the range x[i] to x[i+1], the -interpolation is between y1[i] and y0[i+1]. So, y0[0] and y1[-1] are -never used. - -""" -# Make some illustrative fake data: - -x = np.arange(0, np.pi, 0.1) -y = np.arange(0, 2*np.pi, 0.1) -X, Y = np.meshgrid(x, y) -Z = np.cos(X) * np.sin(Y) * 10 - - -# --- Colormaps from a list --- - -colors = [(1, 0, 0), (0, 1, 0), (0, 0, 1)] # R -> G -> B -n_bins = [3, 6, 10, 100] # Discretizes the interpolation into bins -cmap_name = 'my_list' -fig, axs = plt.subplots(2, 2, figsize=(6, 9)) -fig.subplots_adjust(left=0.02, bottom=0.06, right=0.95, top=0.94, wspace=0.05) -for n_bin, ax in zip(n_bins, axs.ravel()): - # Create the colormap - cm = LinearSegmentedColormap.from_list( - cmap_name, colors, N=n_bin) - # Fewer bins will result in "coarser" colomap interpolation - im = ax.imshow(Z, interpolation='nearest', origin='lower', cmap=cm) - ax.set_title("N bins: %s" % n_bin) - fig.colorbar(im, ax=ax) - - -# --- Custom colormaps --- - -cdict1 = {'red': ((0.0, 0.0, 0.0), - (0.5, 0.0, 0.1), - (1.0, 1.0, 1.0)), - - 'green': ((0.0, 0.0, 0.0), - (1.0, 0.0, 0.0)), - - 'blue': ((0.0, 0.0, 1.0), - (0.5, 0.1, 0.0), - (1.0, 0.0, 0.0)) - } - -cdict2 = {'red': ((0.0, 0.0, 0.0), - (0.5, 0.0, 1.0), - (1.0, 0.1, 1.0)), - - 'green': ((0.0, 0.0, 0.0), - (1.0, 0.0, 0.0)), - - 'blue': ((0.0, 0.0, 0.1), - (0.5, 1.0, 0.0), - (1.0, 0.0, 0.0)) - } - -cdict3 = {'red': ((0.0, 0.0, 0.0), - (0.25, 0.0, 0.0), - (0.5, 0.8, 1.0), - (0.75, 1.0, 1.0), - (1.0, 0.4, 1.0)), - - 'green': ((0.0, 0.0, 0.0), - (0.25, 0.0, 0.0), - (0.5, 0.9, 0.9), - (0.75, 0.0, 0.0), - (1.0, 0.0, 0.0)), - - 'blue': ((0.0, 0.0, 0.4), - (0.25, 1.0, 1.0), - (0.5, 1.0, 0.8), - (0.75, 0.0, 0.0), - (1.0, 0.0, 0.0)) - } - -# Make a modified version of cdict3 with some transparency -# in the middle of the range. -cdict4 = cdict3.copy() -cdict4['alpha'] = ((0.0, 1.0, 1.0), - # (0.25,1.0, 1.0), - (0.5, 0.3, 0.3), - # (0.75,1.0, 1.0), - (1.0, 1.0, 1.0)) - - -# Now we will use this example to illustrate 3 ways of -# handling custom colormaps. -# First, the most direct and explicit: - -blue_red1 = LinearSegmentedColormap('BlueRed1', cdict1) - -# Second, create the map explicitly and register it. -# Like the first method, this method works with any kind -# of Colormap, not just -# a LinearSegmentedColormap: - -blue_red2 = LinearSegmentedColormap('BlueRed2', cdict2) -plt.register_cmap(cmap=blue_red2) - -# Third, for LinearSegmentedColormap only, -# leave everything to register_cmap: - -plt.register_cmap(name='BlueRed3', data=cdict3) # optional lut kwarg -plt.register_cmap(name='BlueRedAlpha', data=cdict4) - -# Make the figure: - -fig, axs = plt.subplots(2, 2, figsize=(6, 9)) -fig.subplots_adjust(left=0.02, bottom=0.06, right=0.95, top=0.94, wspace=0.05) - -# Make 4 subplots: - -im1 = axs[0, 0].imshow(Z, interpolation='nearest', cmap=blue_red1) -fig.colorbar(im1, ax=axs[0, 0]) - -cmap = plt.get_cmap('BlueRed2') -im2 = axs[1, 0].imshow(Z, interpolation='nearest', cmap=cmap) -fig.colorbar(im2, ax=axs[1, 0]) - -# Now we will set the third cmap as the default. One would -# not normally do this in the middle of a script like this; -# it is done here just to illustrate the method. - -plt.rcParams['image.cmap'] = 'BlueRed3' - -im3 = axs[0, 1].imshow(Z, interpolation='nearest') -fig.colorbar(im3, ax=axs[0, 1]) -axs[0, 1].set_title("Alpha = 1") - -# Or as yet another variation, we can replace the rcParams -# specification *before* the imshow with the following *after* -# imshow. -# This sets the new default *and* sets the colormap of the last -# image-like item plotted via pyplot, if any. -# - -# Draw a line with low zorder so it will be behind the image. -axs[1, 1].plot([0, 10*np.pi], [0, 20*np.pi], color='c', lw=20, zorder=-1) - -im4 = axs[1, 1].imshow(Z, interpolation='nearest') -fig.colorbar(im4, ax=axs[1, 1]) - -# Here it is: changing the colormap for the current image and its -# colorbar after they have been plotted. -im4.set_cmap('BlueRedAlpha') -axs[1, 1].set_title("Varying alpha") -# - -fig.suptitle('Custom Blue-Red colormaps', fontsize=16) - -plt.show() diff --git a/mpl_examples/pylab_examples/custom_cmap_00.hires.png b/mpl_examples/pylab_examples/custom_cmap_00.hires.png deleted file mode 100644 index 6efe9d19ef8..00000000000 Binary files a/mpl_examples/pylab_examples/custom_cmap_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/custom_cmap_00.pdf b/mpl_examples/pylab_examples/custom_cmap_00.pdf deleted file mode 100644 index bd91d06b2e0..00000000000 Binary files a/mpl_examples/pylab_examples/custom_cmap_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/custom_cmap_00.png b/mpl_examples/pylab_examples/custom_cmap_00.png deleted file mode 100644 index e36cfc822fe..00000000000 Binary files a/mpl_examples/pylab_examples/custom_cmap_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/custom_cmap_01.hires.png b/mpl_examples/pylab_examples/custom_cmap_01.hires.png deleted file mode 100644 index 2f9eb96d154..00000000000 Binary files a/mpl_examples/pylab_examples/custom_cmap_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/custom_cmap_01.pdf b/mpl_examples/pylab_examples/custom_cmap_01.pdf deleted file mode 100644 index b0b2ad231c1..00000000000 Binary files a/mpl_examples/pylab_examples/custom_cmap_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/custom_cmap_01.png b/mpl_examples/pylab_examples/custom_cmap_01.png deleted file mode 100644 index 1d5565d067b..00000000000 Binary files a/mpl_examples/pylab_examples/custom_cmap_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/custom_figure_class.hires.png b/mpl_examples/pylab_examples/custom_figure_class.hires.png deleted file mode 100644 index e470fd7bbe9..00000000000 Binary files a/mpl_examples/pylab_examples/custom_figure_class.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/custom_figure_class.pdf b/mpl_examples/pylab_examples/custom_figure_class.pdf deleted file mode 100644 index 4980339544a..00000000000 Binary files a/mpl_examples/pylab_examples/custom_figure_class.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/custom_figure_class.png b/mpl_examples/pylab_examples/custom_figure_class.png deleted file mode 100644 index 5efa114b0fe..00000000000 Binary files a/mpl_examples/pylab_examples/custom_figure_class.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/custom_figure_class.py b/mpl_examples/pylab_examples/custom_figure_class.py deleted file mode 100644 index 56c4de49923..00000000000 --- a/mpl_examples/pylab_examples/custom_figure_class.py +++ /dev/null @@ -1,21 +0,0 @@ -""" -You can pass a custom Figure constructor to figure if you want to derive from the default Figure. This simple example creates a figure with a figure title -""" -from matplotlib.pyplot import figure, show -from matplotlib.figure import Figure - - -class MyFigure(Figure): - def __init__(self, *args, **kwargs): - """ - custom kwarg figtitle is a figure title - """ - figtitle = kwargs.pop('figtitle', 'hi mom') - Figure.__init__(self, *args, **kwargs) - self.text(0.5, 0.95, figtitle, ha='center') - -fig = figure(FigureClass=MyFigure, figtitle='my title') -ax = fig.add_subplot(111) -ax.plot([1, 2, 3]) - -show() diff --git a/mpl_examples/pylab_examples/custom_ticker1.hires.png b/mpl_examples/pylab_examples/custom_ticker1.hires.png deleted file mode 100644 index ced22bd66da..00000000000 Binary files a/mpl_examples/pylab_examples/custom_ticker1.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/custom_ticker1.pdf b/mpl_examples/pylab_examples/custom_ticker1.pdf deleted file mode 100644 index 679535c78f6..00000000000 Binary files a/mpl_examples/pylab_examples/custom_ticker1.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/custom_ticker1.png b/mpl_examples/pylab_examples/custom_ticker1.png deleted file mode 100644 index 409b024d089..00000000000 Binary files a/mpl_examples/pylab_examples/custom_ticker1.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/custom_ticker1.py b/mpl_examples/pylab_examples/custom_ticker1.py deleted file mode 100644 index 070d69e912c..00000000000 --- a/mpl_examples/pylab_examples/custom_ticker1.py +++ /dev/null @@ -1,29 +0,0 @@ -""" -The new ticker code was designed to explicitly support user customized -ticking. The documentation -http://matplotlib.org/matplotlib.ticker.html details this -process. That code defines a lot of preset tickers but was primarily -designed to be user extensible. - -In this example a user defined function is used to format the ticks in -millions of dollars on the y axis -""" -from matplotlib.ticker import FuncFormatter -import matplotlib.pyplot as plt -import numpy as np - -x = np.arange(4) -money = [1.5e5, 2.5e6, 5.5e6, 2.0e7] - - -def millions(x, pos): - 'The two args are the value and tick position' - return '$%1.1fM' % (x*1e-6) - -formatter = FuncFormatter(millions) - -fig, ax = plt.subplots() -ax.yaxis.set_major_formatter(formatter) -plt.bar(x, money) -plt.xticks(x, ('Bill', 'Fred', 'Mary', 'Sue')) -plt.show() diff --git a/mpl_examples/pylab_examples/customize_rc.hires.png b/mpl_examples/pylab_examples/customize_rc.hires.png deleted file mode 100644 index 075d6957f8d..00000000000 Binary files a/mpl_examples/pylab_examples/customize_rc.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/customize_rc.pdf b/mpl_examples/pylab_examples/customize_rc.pdf deleted file mode 100644 index 094a86bb0a0..00000000000 Binary files a/mpl_examples/pylab_examples/customize_rc.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/customize_rc.png b/mpl_examples/pylab_examples/customize_rc.png deleted file mode 100644 index 354f1415c50..00000000000 Binary files a/mpl_examples/pylab_examples/customize_rc.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/customize_rc.py b/mpl_examples/pylab_examples/customize_rc.py deleted file mode 100644 index 8a4531e6dfa..00000000000 --- a/mpl_examples/pylab_examples/customize_rc.py +++ /dev/null @@ -1,50 +0,0 @@ -""" -I'm not trying to make a good looking figure here, but just to show -some examples of customizing rc params on the fly - -If you like to work interactively, and need to create different sets -of defaults for figures (e.g., one set of defaults for publication, one -set for interactive exploration), you may want to define some -functions in a custom module that set the defaults, e.g., - -def set_pub(): - rc('font', weight='bold') # bold fonts are easier to see - 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 - - - -Then as you are working interactively, you just need to do - ->>> set_pub() ->>> subplot(111) ->>> plot([1,2,3]) ->>> savefig('myfig') ->>> rcdefaults() # restore the defaults - -""" -import matplotlib.pyplot as plt - -plt.subplot(311) -plt.plot([1, 2, 3]) - -# the axes attributes need to be set before the call to subplot -plt.rc('font', weight='bold') -plt.rc('xtick.major', size=5, pad=7) -plt.rc('xtick', labelsize=15) - -# using aliases for color, linestyle and linewidth; gray, solid, thick -plt.rc('grid', c='0.5', ls='-', lw=5) -plt.rc('lines', lw=2, color='g') -plt.subplot(312) - -plt.plot([1, 2, 3]) -plt.grid(True) - -plt.rcdefaults() -plt.subplot(313) -plt.plot([1, 2, 3]) -plt.grid(True) -plt.show() diff --git a/mpl_examples/pylab_examples/dashpointlabel.hires.png b/mpl_examples/pylab_examples/dashpointlabel.hires.png deleted file mode 100644 index c2dbfe61080..00000000000 Binary files a/mpl_examples/pylab_examples/dashpointlabel.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/dashpointlabel.pdf b/mpl_examples/pylab_examples/dashpointlabel.pdf deleted file mode 100644 index 950f2e07909..00000000000 Binary files a/mpl_examples/pylab_examples/dashpointlabel.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/dashpointlabel.png b/mpl_examples/pylab_examples/dashpointlabel.png deleted file mode 100644 index affdaea397d..00000000000 Binary files a/mpl_examples/pylab_examples/dashpointlabel.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/dashpointlabel.py b/mpl_examples/pylab_examples/dashpointlabel.py deleted file mode 100644 index 9e8e03bedbb..00000000000 --- a/mpl_examples/pylab_examples/dashpointlabel.py +++ /dev/null @@ -1,37 +0,0 @@ -import matplotlib.pyplot as plt - -DATA = ((1, 3), - (2, 4), - (3, 1), - (4, 2)) -# dash_style = -# direction, length, (text)rotation, dashrotation, push -# (The parameters are varied to show their effects, -# not for visual appeal). -dash_style = ( - (0, 20, -15, 30, 10), - (1, 30, 0, 15, 10), - (0, 40, 15, 15, 10), - (1, 20, 30, 60, 10), - ) - -fig, ax = plt.subplots() - -(x, y) = zip(*DATA) -ax.plot(x, y, marker='o') -for i in range(len(DATA)): - (x, y) = DATA[i] - (dd, dl, r, dr, dp) = dash_style[i] - #print('dashlen call %d' % dl) - t = ax.text(x, y, str((x, y)), withdash=True, - dashdirection=dd, - dashlength=dl, - rotation=r, - dashrotation=dr, - dashpush=dp, - ) - -ax.set_xlim((0.0, 5.0)) -ax.set_ylim((0.0, 5.0)) - -plt.show() diff --git a/mpl_examples/pylab_examples/data_helper.py b/mpl_examples/pylab_examples/data_helper.py deleted file mode 100644 index 27a9cef06dd..00000000000 --- a/mpl_examples/pylab_examples/data_helper.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python -# Some functions to load a return data for the plot demos - -from numpy import fromstring, argsort, take, array, resize -import matplotlib.cbook as cbook - - -def get_two_stock_data(): - """ - load stock time and price data for two stocks The return values - (d1,p1,d2,p2) are the trade time (in days) and prices for stocks 1 - and 2 (intc and aapl) - """ - ticker1, ticker2 = 'INTC', 'AAPL' - - file1 = cbook.get_sample_data('INTC.dat.gz') - file2 = cbook.get_sample_data('AAPL.dat.gz') - M1 = fromstring(file1.read(), '= len(self.dates) or ind < 0: - return '' - - return self.dates[ind].strftime(self.fmt) - -formatter = MyFormatter(r.date) - -fig, ax = plt.subplots() -ax.xaxis.set_major_formatter(formatter) -ax.plot(np.arange(len(r)), r.close, 'o-') -fig.autofmt_xdate() -plt.show() diff --git a/mpl_examples/pylab_examples/demo_agg_filter.hires.png b/mpl_examples/pylab_examples/demo_agg_filter.hires.png deleted file mode 100644 index 958961ffb08..00000000000 Binary files a/mpl_examples/pylab_examples/demo_agg_filter.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_agg_filter.pdf b/mpl_examples/pylab_examples/demo_agg_filter.pdf deleted file mode 100644 index 0f6da77e48f..00000000000 Binary files a/mpl_examples/pylab_examples/demo_agg_filter.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_agg_filter.png b/mpl_examples/pylab_examples/demo_agg_filter.png deleted file mode 100644 index 04540dc331d..00000000000 Binary files a/mpl_examples/pylab_examples/demo_agg_filter.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_agg_filter.py b/mpl_examples/pylab_examples/demo_agg_filter.py deleted file mode 100644 index e4dbeb5c4b4..00000000000 --- a/mpl_examples/pylab_examples/demo_agg_filter.py +++ /dev/null @@ -1,330 +0,0 @@ -import matplotlib.pyplot as plt - -import numpy as np -import matplotlib.cm as cm -import matplotlib.mlab as mlab - - -def smooth1d(x, window_len): - # copied from http://www.scipy.org/Cookbook/SignalSmooth - - s = np.r_[2*x[0] - x[window_len:1:-1], x, 2*x[-1] - x[-1:-window_len:-1]] - w = np.hanning(window_len) - y = np.convolve(w/w.sum(), s, mode='same') - return y[window_len-1:-window_len+1] - - -def smooth2d(A, sigma=3): - - window_len = max(int(sigma), 3)*2 + 1 - A1 = np.array([smooth1d(x, window_len) for x in np.asarray(A)]) - A2 = np.transpose(A1) - A3 = np.array([smooth1d(x, window_len) for x in A2]) - A4 = np.transpose(A3) - - return A4 - - -class BaseFilter(object): - def prepare_image(self, src_image, dpi, pad): - ny, nx, depth = src_image.shape - #tgt_image = np.zeros([pad*2+ny, pad*2+nx, depth], dtype="d") - padded_src = np.zeros([pad*2 + ny, pad*2 + nx, depth], dtype="d") - padded_src[pad:-pad, pad:-pad, :] = src_image[:, :, :] - - return padded_src # , tgt_image - - def get_pad(self, dpi): - return 0 - - def __call__(self, im, dpi): - pad = self.get_pad(dpi) - padded_src = self.prepare_image(im, dpi, pad) - tgt_image = self.process_image(padded_src, dpi) - return tgt_image, -pad, -pad - - -class OffsetFilter(BaseFilter): - def __init__(self, offsets=None): - if offsets is None: - self.offsets = (0, 0) - else: - self.offsets = offsets - - def get_pad(self, dpi): - return int(max(*self.offsets)/72.*dpi) - - def process_image(self, padded_src, dpi): - ox, oy = self.offsets - a1 = np.roll(padded_src, int(ox/72.*dpi), axis=1) - a2 = np.roll(a1, -int(oy/72.*dpi), axis=0) - return a2 - - -class GaussianFilter(BaseFilter): - "simple gauss filter" - - def __init__(self, sigma, alpha=0.5, color=None): - self.sigma = sigma - self.alpha = alpha - if color is None: - self.color = (0, 0, 0) - else: - self.color = color - - def get_pad(self, dpi): - return int(self.sigma*3/72.*dpi) - - def process_image(self, padded_src, dpi): - #offsetx, offsety = int(self.offsets[0]), int(self.offsets[1]) - tgt_image = np.zeros_like(padded_src) - aa = smooth2d(padded_src[:, :, -1]*self.alpha, - self.sigma/72.*dpi) - tgt_image[:, :, -1] = aa - tgt_image[:, :, :-1] = self.color - return tgt_image - - -class DropShadowFilter(BaseFilter): - def __init__(self, sigma, alpha=0.3, color=None, offsets=None): - self.gauss_filter = GaussianFilter(sigma, alpha, color) - self.offset_filter = OffsetFilter(offsets) - - def get_pad(self, dpi): - return max(self.gauss_filter.get_pad(dpi), - self.offset_filter.get_pad(dpi)) - - def process_image(self, padded_src, dpi): - t1 = self.gauss_filter.process_image(padded_src, dpi) - t2 = self.offset_filter.process_image(t1, dpi) - return t2 - - -from matplotlib.colors import LightSource - - -class LightFilter(BaseFilter): - "simple gauss filter" - - def __init__(self, sigma, fraction=0.5): - self.gauss_filter = GaussianFilter(sigma, alpha=1) - self.light_source = LightSource() - self.fraction = fraction - - def get_pad(self, dpi): - return self.gauss_filter.get_pad(dpi) - - def process_image(self, padded_src, dpi): - t1 = self.gauss_filter.process_image(padded_src, dpi) - elevation = t1[:, :, 3] - rgb = padded_src[:, :, :3] - - rgb2 = self.light_source.shade_rgb(rgb, elevation, - fraction=self.fraction) - - tgt = np.empty_like(padded_src) - tgt[:, :, :3] = rgb2 - tgt[:, :, 3] = padded_src[:, :, 3] - - return tgt - - -class GrowFilter(BaseFilter): - "enlarge the area" - - def __init__(self, pixels, color=None): - self.pixels = pixels - if color is None: - self.color = (1, 1, 1) - else: - self.color = color - - def __call__(self, im, dpi): - pad = self.pixels - ny, nx, depth = im.shape - new_im = np.empty([pad*2 + ny, pad*2 + nx, depth], dtype="d") - alpha = new_im[:, :, 3] - alpha.fill(0) - alpha[pad:-pad, pad:-pad] = im[:, :, -1] - alpha2 = np.clip(smooth2d(alpha, self.pixels/72.*dpi) * 5, 0, 1) - new_im[:, :, -1] = alpha2 - new_im[:, :, :-1] = self.color - offsetx, offsety = -pad, -pad - - return new_im, offsetx, offsety - - -from matplotlib.artist import Artist - - -class FilteredArtistList(Artist): - """ - A simple container to draw filtered artist. - """ - - def __init__(self, artist_list, filter): - self._artist_list = artist_list - self._filter = filter - Artist.__init__(self) - - def draw(self, renderer): - renderer.start_rasterizing() - renderer.start_filter() - for a in self._artist_list: - a.draw(renderer) - renderer.stop_filter(self._filter) - renderer.stop_rasterizing() - - -import matplotlib.transforms as mtransforms - - -def filtered_text(ax): - # mostly copied from contour_demo.py - - # prepare image - delta = 0.025 - x = np.arange(-3.0, 3.0, delta) - y = np.arange(-2.0, 2.0, delta) - X, Y = np.meshgrid(x, y) - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - # difference of Gaussians - Z = 10.0 * (Z2 - Z1) - - # draw - im = ax.imshow(Z, interpolation='bilinear', origin='lower', - cmap=cm.gray, extent=(-3, 3, -2, 2)) - levels = np.arange(-1.2, 1.6, 0.2) - CS = ax.contour(Z, levels, - origin='lower', - linewidths=2, - extent=(-3, 3, -2, 2)) - - ax.set_aspect("auto") - - # contour label - cl = ax.clabel(CS, levels[1::2], # label every second level - inline=1, - fmt='%1.1f', - fontsize=11) - - # change clable color to black - from matplotlib.patheffects import Normal - for t in cl: - t.set_color("k") - # to force TextPath (i.e., same font in all backends) - t.set_path_effects([Normal()]) - - # Add white glows to improve visibility of labels. - white_glows = FilteredArtistList(cl, GrowFilter(3)) - ax.add_artist(white_glows) - white_glows.set_zorder(cl[0].get_zorder() - 0.1) - - ax.xaxis.set_visible(False) - ax.yaxis.set_visible(False) - - -def drop_shadow_line(ax): - # copied from examples/misc/svg_filter_line.py - - # draw lines - l1, = ax.plot([0.1, 0.5, 0.9], [0.1, 0.9, 0.5], "bo-", - mec="b", mfc="w", lw=5, mew=3, ms=10, label="Line 1") - l2, = ax.plot([0.1, 0.5, 0.9], [0.5, 0.2, 0.7], "ro-", - mec="r", mfc="w", lw=5, mew=3, ms=10, label="Line 1") - - gauss = DropShadowFilter(4) - - for l in [l1, l2]: - - # draw shadows with same lines with slight offset. - - xx = l.get_xdata() - yy = l.get_ydata() - shadow, = ax.plot(xx, yy) - shadow.update_from(l) - - # offset transform - ot = mtransforms.offset_copy(l.get_transform(), ax.figure, - x=4.0, y=-6.0, units='points') - - shadow.set_transform(ot) - - # adjust zorder of the shadow lines so that it is drawn below the - # original lines - shadow.set_zorder(l.get_zorder() - 0.5) - shadow.set_agg_filter(gauss) - shadow.set_rasterized(True) # to support mixed-mode renderers - - ax.set_xlim(0., 1.) - ax.set_ylim(0., 1.) - - ax.xaxis.set_visible(False) - ax.yaxis.set_visible(False) - - -def drop_shadow_patches(ax): - # Copied from barchart_demo.py - N = 5 - menMeans = (20, 35, 30, 35, 27) - - ind = np.arange(N) # the x locations for the groups - width = 0.35 # the width of the bars - - rects1 = ax.bar(ind, menMeans, width, color='r', ec="w", lw=2) - - womenMeans = (25, 32, 34, 20, 25) - rects2 = ax.bar(ind + width + 0.1, womenMeans, width, color='y', ec="w", lw=2) - - #gauss = GaussianFilter(1.5, offsets=(1,1), ) - gauss = DropShadowFilter(5, offsets=(1, 1), ) - shadow = FilteredArtistList(rects1 + rects2, gauss) - ax.add_artist(shadow) - shadow.set_zorder(rects1[0].get_zorder() - 0.1) - - ax.set_ylim(0, 40) - - ax.xaxis.set_visible(False) - ax.yaxis.set_visible(False) - - -def light_filter_pie(ax): - fracs = [15, 30, 45, 10] - explode = (0, 0.05, 0, 0) - pies = ax.pie(fracs, explode=explode) - ax.patch.set_visible(True) - - light_filter = LightFilter(9) - for p in pies[0]: - p.set_agg_filter(light_filter) - p.set_rasterized(True) # to support mixed-mode renderers - p.set(ec="none", - lw=2) - - gauss = DropShadowFilter(9, offsets=(3, 4), alpha=0.7) - shadow = FilteredArtistList(pies[0], gauss) - ax.add_artist(shadow) - shadow.set_zorder(pies[0][0].get_zorder() - 0.1) - - -if 1: - - plt.figure(1, figsize=(6, 6)) - plt.subplots_adjust(left=0.05, right=0.95) - - ax = plt.subplot(221) - filtered_text(ax) - - ax = plt.subplot(222) - drop_shadow_line(ax) - - ax = plt.subplot(223) - drop_shadow_patches(ax) - - ax = plt.subplot(224) - ax.set_aspect(1) - light_filter_pie(ax) - ax.set_frame_on(True) - - plt.show() diff --git a/mpl_examples/pylab_examples/demo_annotation_box.hires.png b/mpl_examples/pylab_examples/demo_annotation_box.hires.png deleted file mode 100644 index b3cb882fe19..00000000000 Binary files a/mpl_examples/pylab_examples/demo_annotation_box.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_annotation_box.pdf b/mpl_examples/pylab_examples/demo_annotation_box.pdf deleted file mode 100644 index 26b72cce981..00000000000 Binary files a/mpl_examples/pylab_examples/demo_annotation_box.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_annotation_box.png b/mpl_examples/pylab_examples/demo_annotation_box.png deleted file mode 100644 index f19040591fb..00000000000 Binary files a/mpl_examples/pylab_examples/demo_annotation_box.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_annotation_box.py b/mpl_examples/pylab_examples/demo_annotation_box.py deleted file mode 100644 index 860195f4b93..00000000000 --- a/mpl_examples/pylab_examples/demo_annotation_box.py +++ /dev/null @@ -1,92 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - -from matplotlib.patches import Circle -from matplotlib.offsetbox import (TextArea, DrawingArea, OffsetImage, - AnnotationBbox) -from matplotlib.cbook import get_sample_data - - -if 1: - fig, ax = plt.subplots() - - # Define a 1st position to annotate (display it with a marker) - xy = (0.5, 0.7) - ax.plot(xy[0], xy[1], ".r") - - # Annotate the 1st position with a text box ('Test 1') - offsetbox = TextArea("Test 1", minimumdescent=False) - - ab = AnnotationBbox(offsetbox, xy, - xybox=(-20, 40), - xycoords='data', - boxcoords="offset points", - arrowprops=dict(arrowstyle="->")) - ax.add_artist(ab) - - # Annotate the 1st position with another text box ('Test') - offsetbox = TextArea("Test", minimumdescent=False) - - ab = AnnotationBbox(offsetbox, xy, - xybox=(1.02, xy[1]), - xycoords='data', - boxcoords=("axes fraction", "data"), - box_alignment=(0., 0.5), - arrowprops=dict(arrowstyle="->")) - ax.add_artist(ab) - - # Define a 2nd position to annotate (don't display with a marker this time) - xy = [0.3, 0.55] - - # Annotate the 2nd position with a circle patch - da = DrawingArea(20, 20, 0, 0) - p = Circle((10, 10), 10) - da.add_artist(p) - - ab = AnnotationBbox(da, xy, - xybox=(1.02, xy[1]), - xycoords='data', - boxcoords=("axes fraction", "data"), - box_alignment=(0., 0.5), - arrowprops=dict(arrowstyle="->")) - - ax.add_artist(ab) - - # Annotate the 2nd position with an image (a generated array of pixels) - arr = np.arange(100).reshape((10, 10)) - im = OffsetImage(arr, zoom=2) - im.image.axes = ax - - ab = AnnotationBbox(im, xy, - xybox=(-50., 50.), - xycoords='data', - boxcoords="offset points", - pad=0.3, - arrowprops=dict(arrowstyle="->")) - - ax.add_artist(ab) - - # Annotate the 2nd position with another image (a Grace Hopper portrait) - fn = get_sample_data("grace_hopper.png", asfileobj=False) - arr_img = plt.imread(fn, format='png') - - imagebox = OffsetImage(arr_img, zoom=0.2) - imagebox.image.axes = ax - - ab = AnnotationBbox(imagebox, xy, - xybox=(120., -80.), - xycoords='data', - boxcoords="offset points", - pad=0.5, - arrowprops=dict( - arrowstyle="->", - connectionstyle="angle,angleA=0,angleB=90,rad=3") - ) - - ax.add_artist(ab) - - # Fix the display limits to see everything - ax.set_xlim(0, 1) - ax.set_ylim(0, 1) - - plt.show() diff --git a/mpl_examples/pylab_examples/demo_bboximage.hires.png b/mpl_examples/pylab_examples/demo_bboximage.hires.png deleted file mode 100644 index edf387b6041..00000000000 Binary files a/mpl_examples/pylab_examples/demo_bboximage.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_bboximage.pdf b/mpl_examples/pylab_examples/demo_bboximage.pdf deleted file mode 100644 index 40f09869cb4..00000000000 Binary files a/mpl_examples/pylab_examples/demo_bboximage.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_bboximage.png b/mpl_examples/pylab_examples/demo_bboximage.png deleted file mode 100644 index decb9f1e0b4..00000000000 Binary files a/mpl_examples/pylab_examples/demo_bboximage.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_bboximage.py b/mpl_examples/pylab_examples/demo_bboximage.py deleted file mode 100644 index 4ea47b6a464..00000000000 --- a/mpl_examples/pylab_examples/demo_bboximage.py +++ /dev/null @@ -1,64 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np -from matplotlib.image import BboxImage -from matplotlib.transforms import Bbox, TransformedBbox - -if __name__ == "__main__": - - fig = plt.figure(1) - ax = plt.subplot(121) - - txt = ax.text(0.5, 0.5, "test", size=30, ha="center", color="w") - kwargs = dict() - - bbox_image = BboxImage(txt.get_window_extent, - norm=None, - origin=None, - clip_on=False, - **kwargs - ) - a = np.arange(256).reshape(1, 256)/256. - bbox_image.set_data(a) - ax.add_artist(bbox_image) - - ax = plt.subplot(122) - a = np.linspace(0, 1, 256).reshape(1, -1) - a = np.vstack((a, a)) - - maps = sorted( - m for m in plt.cm.cmap_d - if not m.endswith("_r") and # Skip reversed colormaps. - not m.startswith(('spectral', 'Vega')) # Skip deprecated colormaps. - ) - - #fig.subplots_adjust(top=0.99, bottom=0.01, left=0.2, right=0.99) - - ncol = 2 - nrow = len(maps)//ncol + 1 - - xpad_fraction = 0.3 - dx = 1./(ncol + xpad_fraction*(ncol - 1)) - - ypad_fraction = 0.3 - dy = 1./(nrow + ypad_fraction*(nrow - 1)) - - for i, m in enumerate(maps): - ix, iy = divmod(i, nrow) - #plt.figimage(a, 10, i*10, cmap=plt.get_cmap(m), origin='lower') - bbox0 = Bbox.from_bounds(ix*dx*(1 + xpad_fraction), - 1. - iy*dy*(1 + ypad_fraction) - dy, - dx, dy) - bbox = TransformedBbox(bbox0, ax.transAxes) - - bbox_image = BboxImage(bbox, - cmap=plt.get_cmap(m), - norm=None, - origin=None, - **kwargs - ) - - bbox_image.set_data(a) - ax.add_artist(bbox_image) - - plt.draw() - plt.show() diff --git a/mpl_examples/pylab_examples/demo_ribbon_box.hires.png b/mpl_examples/pylab_examples/demo_ribbon_box.hires.png deleted file mode 100644 index 6c56e13652a..00000000000 Binary files a/mpl_examples/pylab_examples/demo_ribbon_box.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_ribbon_box.pdf b/mpl_examples/pylab_examples/demo_ribbon_box.pdf deleted file mode 100644 index bf7a935aa11..00000000000 Binary files a/mpl_examples/pylab_examples/demo_ribbon_box.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_ribbon_box.png b/mpl_examples/pylab_examples/demo_ribbon_box.png deleted file mode 100644 index 676551e6b31..00000000000 Binary files a/mpl_examples/pylab_examples/demo_ribbon_box.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_ribbon_box.py b/mpl_examples/pylab_examples/demo_ribbon_box.py deleted file mode 100644 index 59eeddaa9f4..00000000000 --- a/mpl_examples/pylab_examples/demo_ribbon_box.py +++ /dev/null @@ -1,134 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np -from matplotlib.image import BboxImage - -from matplotlib._png import read_png -import matplotlib.colors -from matplotlib.cbook import get_sample_data - - -class RibbonBox(object): - - original_image = read_png(get_sample_data("Minduka_Present_Blue_Pack.png", - asfileobj=False)) - cut_location = 70 - b_and_h = original_image[:, :, 2] - color = original_image[:, :, 2] - original_image[:, :, 0] - alpha = original_image[:, :, 3] - nx = original_image.shape[1] - - def __init__(self, color): - rgb = matplotlib.colors.to_rgba(color)[:3] - - im = np.empty(self.original_image.shape, - self.original_image.dtype) - - im[:, :, :3] = self.b_and_h[:, :, np.newaxis] - im[:, :, :3] -= self.color[:, :, np.newaxis]*(1. - np.array(rgb)) - im[:, :, 3] = self.alpha - - self.im = im - - def get_stretched_image(self, stretch_factor): - stretch_factor = max(stretch_factor, 1) - ny, nx, nch = self.im.shape - ny2 = int(ny*stretch_factor) - - stretched_image = np.empty((ny2, nx, nch), - self.im.dtype) - cut = self.im[self.cut_location, :, :] - stretched_image[:, :, :] = cut - stretched_image[:self.cut_location, :, :] = \ - self.im[:self.cut_location, :, :] - stretched_image[-(ny - self.cut_location):, :, :] = \ - self.im[-(ny - self.cut_location):, :, :] - - self._cached_im = stretched_image - return stretched_image - - -class RibbonBoxImage(BboxImage): - zorder = 1 - - def __init__(self, bbox, color, - cmap=None, - norm=None, - interpolation=None, - origin=None, - filternorm=1, - filterrad=4.0, - resample=False, - **kwargs - ): - - BboxImage.__init__(self, bbox, - cmap=cmap, - norm=norm, - interpolation=interpolation, - origin=origin, - filternorm=filternorm, - filterrad=filterrad, - resample=resample, - **kwargs - ) - - self._ribbonbox = RibbonBox(color) - self._cached_ny = None - - def draw(self, renderer, *args, **kwargs): - - bbox = self.get_window_extent(renderer) - stretch_factor = bbox.height / bbox.width - - ny = int(stretch_factor*self._ribbonbox.nx) - if self._cached_ny != ny: - arr = self._ribbonbox.get_stretched_image(stretch_factor) - self.set_array(arr) - self._cached_ny = ny - - BboxImage.draw(self, renderer, *args, **kwargs) - - -if 1: - from matplotlib.transforms import Bbox, TransformedBbox - from matplotlib.ticker import ScalarFormatter - - fig, ax = plt.subplots() - - years = np.arange(2004, 2009) - box_colors = [(0.8, 0.2, 0.2), - (0.2, 0.8, 0.2), - (0.2, 0.2, 0.8), - (0.7, 0.5, 0.8), - (0.3, 0.8, 0.7), - ] - heights = np.random.random(years.shape) * 7000 + 3000 - - fmt = ScalarFormatter(useOffset=False) - ax.xaxis.set_major_formatter(fmt) - - for year, h, bc in zip(years, heights, box_colors): - bbox0 = Bbox.from_extents(year - 0.4, 0., year + 0.4, h) - bbox = TransformedBbox(bbox0, ax.transData) - rb_patch = RibbonBoxImage(bbox, bc, interpolation="bicubic") - - ax.add_artist(rb_patch) - - ax.annotate(r"%d" % (int(h/100.)*100), - (year, h), va="bottom", ha="center") - - patch_gradient = BboxImage(ax.bbox, - interpolation="bicubic", - zorder=0.1, - ) - gradient = np.zeros((2, 2, 4), dtype=np.float) - gradient[:, :, :3] = [1, 1, 0.] - gradient[:, :, 3] = [[0.1, 0.3], [0.3, 0.5]] # alpha channel - patch_gradient.set_array(gradient) - ax.add_artist(patch_gradient) - - ax.set_xlim(years[0] - 0.5, years[-1] + 0.5) - ax.set_ylim(0, 10000) - - fig.savefig('ribbon_box.png') - plt.show() diff --git a/mpl_examples/pylab_examples/demo_text_path.hires.png b/mpl_examples/pylab_examples/demo_text_path.hires.png deleted file mode 100644 index a09c7511f71..00000000000 Binary files a/mpl_examples/pylab_examples/demo_text_path.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_text_path.pdf b/mpl_examples/pylab_examples/demo_text_path.pdf deleted file mode 100644 index f7ec65d7489..00000000000 Binary files a/mpl_examples/pylab_examples/demo_text_path.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_text_path.png b/mpl_examples/pylab_examples/demo_text_path.png deleted file mode 100644 index 9b5140d0c60..00000000000 Binary files a/mpl_examples/pylab_examples/demo_text_path.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_text_path.py b/mpl_examples/pylab_examples/demo_text_path.py deleted file mode 100644 index f155fd5dc6f..00000000000 --- a/mpl_examples/pylab_examples/demo_text_path.py +++ /dev/null @@ -1,151 +0,0 @@ - -# -*- coding: utf-8 -*- - -import matplotlib.pyplot as plt -from matplotlib.image import BboxImage -import numpy as np -from matplotlib.transforms import IdentityTransform - -import matplotlib.patches as mpatches - -from matplotlib.offsetbox import AnnotationBbox,\ - AnchoredOffsetbox, AuxTransformBox - -from matplotlib.cbook import get_sample_data - -from matplotlib.text import TextPath - - -class PathClippedImagePatch(mpatches.PathPatch): - """ - The given image is used to draw the face of the patch. Internally, - it uses BboxImage whose clippath set to the path of the patch. - - FIXME : The result is currently dpi dependent. - """ - - def __init__(self, path, bbox_image, **kwargs): - mpatches.PathPatch.__init__(self, path, **kwargs) - self._init_bbox_image(bbox_image) - - def set_facecolor(self, color): - """simply ignore facecolor""" - mpatches.PathPatch.set_facecolor(self, "none") - - def _init_bbox_image(self, im): - - bbox_image = BboxImage(self.get_window_extent, - norm=None, - origin=None, - ) - bbox_image.set_transform(IdentityTransform()) - - bbox_image.set_data(im) - self.bbox_image = bbox_image - - def draw(self, renderer=None): - - # the clip path must be updated every draw. any solution? -JJ - self.bbox_image.set_clip_path(self._path, self.get_transform()) - self.bbox_image.draw(renderer) - - mpatches.PathPatch.draw(self, renderer) - - -if 1: - - usetex = plt.rcParams["text.usetex"] - - fig = plt.figure(1) - - # EXAMPLE 1 - - ax = plt.subplot(211) - - from matplotlib._png import read_png - fn = get_sample_data("grace_hopper.png", asfileobj=False) - arr = read_png(fn) - - text_path = TextPath((0, 0), "!?", size=150) - p = PathClippedImagePatch(text_path, arr, ec="k", - transform=IdentityTransform()) - - #p.set_clip_on(False) - - # make offset box - offsetbox = AuxTransformBox(IdentityTransform()) - offsetbox.add_artist(p) - - # make anchored offset box - ao = AnchoredOffsetbox(loc=2, child=offsetbox, frameon=True, borderpad=0.2) - ax.add_artist(ao) - - # another text - from matplotlib.patches import PathPatch - if usetex: - r = r"\mbox{textpath supports mathtext \& \TeX}" - else: - r = r"textpath supports mathtext & TeX" - - text_path = TextPath((0, 0), r, - size=20, usetex=usetex) - - p1 = PathPatch(text_path, ec="w", lw=3, fc="w", alpha=0.9, - transform=IdentityTransform()) - p2 = PathPatch(text_path, ec="none", fc="k", - transform=IdentityTransform()) - - offsetbox2 = AuxTransformBox(IdentityTransform()) - offsetbox2.add_artist(p1) - offsetbox2.add_artist(p2) - - ab = AnnotationBbox(offsetbox2, (0.95, 0.05), - xycoords='axes fraction', - boxcoords="offset points", - box_alignment=(1., 0.), - frameon=False - ) - ax.add_artist(ab) - - ax.imshow([[0, 1, 2], [1, 2, 3]], cmap=plt.cm.gist_gray_r, - interpolation="bilinear", - aspect="auto") - - # EXAMPLE 2 - - ax = plt.subplot(212) - - arr = np.arange(256).reshape(1, 256)/256. - - if usetex: - s = r"$\displaystyle\left[\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}\right]$!" - else: - s = r"$\left[\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}\right]$!" - text_path = TextPath((0, 0), s, size=40, usetex=usetex) - text_patch = PathClippedImagePatch(text_path, arr, ec="none", - transform=IdentityTransform()) - - shadow1 = mpatches.Shadow(text_patch, 1, -1, props=dict(fc="none", ec="0.6", lw=3)) - shadow2 = mpatches.Shadow(text_patch, 1, -1, props=dict(fc="0.3", ec="none")) - - # make offset box - offsetbox = AuxTransformBox(IdentityTransform()) - offsetbox.add_artist(shadow1) - offsetbox.add_artist(shadow2) - offsetbox.add_artist(text_patch) - - # place the anchored offset box using AnnotationBbox - ab = AnnotationBbox(offsetbox, (0.5, 0.5), - xycoords='data', - boxcoords="offset points", - box_alignment=(0.5, 0.5), - ) - #text_path.set_size(10) - - ax.add_artist(ab) - - ax.set_xlim(0, 1) - ax.set_ylim(0, 1) - - plt.draw() - plt.show() diff --git a/mpl_examples/pylab_examples/demo_text_rotation_mode.hires.png b/mpl_examples/pylab_examples/demo_text_rotation_mode.hires.png deleted file mode 100644 index 4c291d89ba9..00000000000 Binary files a/mpl_examples/pylab_examples/demo_text_rotation_mode.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_text_rotation_mode.pdf b/mpl_examples/pylab_examples/demo_text_rotation_mode.pdf deleted file mode 100644 index 53d843745bb..00000000000 Binary files a/mpl_examples/pylab_examples/demo_text_rotation_mode.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_text_rotation_mode.png b/mpl_examples/pylab_examples/demo_text_rotation_mode.png deleted file mode 100644 index 8215b09fd4c..00000000000 Binary files a/mpl_examples/pylab_examples/demo_text_rotation_mode.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_text_rotation_mode.py b/mpl_examples/pylab_examples/demo_text_rotation_mode.py deleted file mode 100644 index 264aa49e927..00000000000 --- a/mpl_examples/pylab_examples/demo_text_rotation_mode.py +++ /dev/null @@ -1,45 +0,0 @@ -from mpl_toolkits.axes_grid1.axes_grid import ImageGrid - - -def test_rotation_mode(fig, mode, subplot_location): - ha_list = "left center right".split() - va_list = "top center baseline bottom".split() - grid = ImageGrid(fig, subplot_location, - nrows_ncols=(len(va_list), len(ha_list)), - share_all=True, aspect=True, - #label_mode='1', - cbar_mode=None) - - for ha, ax in zip(ha_list, grid.axes_row[-1]): - ax.axis["bottom"].label.set_text(ha) - - grid.axes_row[0][1].set_title(mode, size="large") - - for va, ax in zip(va_list, grid.axes_column[0]): - ax.axis["left"].label.set_text(va) - - i = 0 - for va in va_list: - for ha in ha_list: - ax = grid[i] - for axis in ax.axis.values(): - axis.toggle(ticks=False, ticklabels=False) - - ax.text(0.5, 0.5, "Tpg", - size="large", rotation=40, - bbox=dict(boxstyle="square,pad=0.", - ec="none", fc="0.5", alpha=0.5), - ha=ha, va=va, - rotation_mode=mode) - ax.axvline(0.5) - ax.axhline(0.5) - i += 1 - -if 1: - import matplotlib.pyplot as plt - fig = plt.figure(1, figsize=(5.5, 4)) - fig.clf() - - test_rotation_mode(fig, "default", 121) - test_rotation_mode(fig, "anchor", 122) - plt.show() diff --git a/mpl_examples/pylab_examples/demo_tight_layout.py b/mpl_examples/pylab_examples/demo_tight_layout.py deleted file mode 100644 index 544fb25db66..00000000000 --- a/mpl_examples/pylab_examples/demo_tight_layout.py +++ /dev/null @@ -1,116 +0,0 @@ - -import matplotlib.pyplot as plt -import itertools -import warnings - - -fontsizes = itertools.cycle([8, 16, 24, 32]) - - -def example_plot(ax): - ax.plot([1, 2]) - ax.set_xlabel('x-label', fontsize=next(fontsizes)) - ax.set_ylabel('y-label', fontsize=next(fontsizes)) - ax.set_title('Title', fontsize=next(fontsizes)) - - -fig, ax = plt.subplots() -example_plot(ax) -plt.tight_layout() - -fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(nrows=2, ncols=2) -example_plot(ax1) -example_plot(ax2) -example_plot(ax3) -example_plot(ax4) -plt.tight_layout() - -fig, (ax1, ax2) = plt.subplots(nrows=2, ncols=1) -example_plot(ax1) -example_plot(ax2) -plt.tight_layout() - -fig, (ax1, ax2) = plt.subplots(nrows=1, ncols=2) -example_plot(ax1) -example_plot(ax2) -plt.tight_layout() - -fig, axes = plt.subplots(nrows=3, ncols=3) -for row in axes: - for ax in row: - example_plot(ax) -plt.tight_layout() - - -fig = plt.figure() - -ax1 = plt.subplot(221) -ax2 = plt.subplot(223) -ax3 = plt.subplot(122) - -example_plot(ax1) -example_plot(ax2) -example_plot(ax3) - -plt.tight_layout() - - -fig = plt.figure() - -ax1 = plt.subplot2grid((3, 3), (0, 0)) -ax2 = plt.subplot2grid((3, 3), (0, 1), colspan=2) -ax3 = plt.subplot2grid((3, 3), (1, 0), colspan=2, rowspan=2) -ax4 = plt.subplot2grid((3, 3), (1, 2), rowspan=2) - -example_plot(ax1) -example_plot(ax2) -example_plot(ax3) -example_plot(ax4) - -plt.tight_layout() - -plt.show() - - -fig = plt.figure() - -import matplotlib.gridspec as gridspec - -gs1 = gridspec.GridSpec(3, 1) -ax1 = fig.add_subplot(gs1[0]) -ax2 = fig.add_subplot(gs1[1]) -ax3 = fig.add_subplot(gs1[2]) - -example_plot(ax1) -example_plot(ax2) -example_plot(ax3) - -with warnings.catch_warnings(): - warnings.simplefilter("ignore", UserWarning) - # This raises warnings since tight layout cannot - # handle gridspec automatically. We are going to - # do that manually so we can filter the warning. - gs1.tight_layout(fig, rect=[None, None, 0.45, None]) - -gs2 = gridspec.GridSpec(2, 1) -ax4 = fig.add_subplot(gs2[0]) -ax5 = fig.add_subplot(gs2[1]) - -example_plot(ax4) -example_plot(ax5) - -with warnings.catch_warnings(): - # This raises warnings since tight layout cannot - # handle gridspec automatically. We are going to - # do that manually so we can filter the warning. - warnings.simplefilter("ignore", UserWarning) - gs2.tight_layout(fig, rect=[0.45, None, None, None]) - -# now match the top and bottom of two gridspecs. -top = min(gs1.top, gs2.top) -bottom = max(gs1.bottom, gs2.bottom) - -gs1.update(top=top, bottom=bottom) -gs2.update(top=top, bottom=bottom) - -plt.show() diff --git a/mpl_examples/pylab_examples/demo_tight_layout_00_00.hires.png b/mpl_examples/pylab_examples/demo_tight_layout_00_00.hires.png deleted file mode 100644 index 64f531a0ffb..00000000000 Binary files a/mpl_examples/pylab_examples/demo_tight_layout_00_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_tight_layout_00_00.pdf b/mpl_examples/pylab_examples/demo_tight_layout_00_00.pdf deleted file mode 100644 index 53816fa6d23..00000000000 Binary files a/mpl_examples/pylab_examples/demo_tight_layout_00_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_tight_layout_00_00.png b/mpl_examples/pylab_examples/demo_tight_layout_00_00.png deleted file mode 100644 index 7fa0ec15d22..00000000000 Binary files a/mpl_examples/pylab_examples/demo_tight_layout_00_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_tight_layout_00_01.hires.png b/mpl_examples/pylab_examples/demo_tight_layout_00_01.hires.png deleted file mode 100644 index 84f91b1ba86..00000000000 Binary files a/mpl_examples/pylab_examples/demo_tight_layout_00_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_tight_layout_00_01.pdf b/mpl_examples/pylab_examples/demo_tight_layout_00_01.pdf deleted file mode 100644 index 4fe28235529..00000000000 Binary files a/mpl_examples/pylab_examples/demo_tight_layout_00_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_tight_layout_00_01.png b/mpl_examples/pylab_examples/demo_tight_layout_00_01.png deleted file mode 100644 index ea8fcfa48c7..00000000000 Binary files a/mpl_examples/pylab_examples/demo_tight_layout_00_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_tight_layout_00_02.hires.png b/mpl_examples/pylab_examples/demo_tight_layout_00_02.hires.png deleted file mode 100644 index 82970654d7b..00000000000 Binary files a/mpl_examples/pylab_examples/demo_tight_layout_00_02.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_tight_layout_00_02.pdf b/mpl_examples/pylab_examples/demo_tight_layout_00_02.pdf deleted file mode 100644 index 88312011770..00000000000 Binary files a/mpl_examples/pylab_examples/demo_tight_layout_00_02.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_tight_layout_00_02.png b/mpl_examples/pylab_examples/demo_tight_layout_00_02.png deleted file mode 100644 index 505daac1747..00000000000 Binary files a/mpl_examples/pylab_examples/demo_tight_layout_00_02.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_tight_layout_00_03.hires.png b/mpl_examples/pylab_examples/demo_tight_layout_00_03.hires.png deleted file mode 100644 index d59de5319e5..00000000000 Binary files a/mpl_examples/pylab_examples/demo_tight_layout_00_03.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_tight_layout_00_03.pdf b/mpl_examples/pylab_examples/demo_tight_layout_00_03.pdf deleted file mode 100644 index d309a99c840..00000000000 Binary files a/mpl_examples/pylab_examples/demo_tight_layout_00_03.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_tight_layout_00_03.png b/mpl_examples/pylab_examples/demo_tight_layout_00_03.png deleted file mode 100644 index 3f6225bce95..00000000000 Binary files a/mpl_examples/pylab_examples/demo_tight_layout_00_03.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_tight_layout_00_04.hires.png b/mpl_examples/pylab_examples/demo_tight_layout_00_04.hires.png deleted file mode 100644 index 6f5c6b5d64b..00000000000 Binary files a/mpl_examples/pylab_examples/demo_tight_layout_00_04.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_tight_layout_00_04.pdf b/mpl_examples/pylab_examples/demo_tight_layout_00_04.pdf deleted file mode 100644 index 42304ca01ac..00000000000 Binary files a/mpl_examples/pylab_examples/demo_tight_layout_00_04.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_tight_layout_00_04.png b/mpl_examples/pylab_examples/demo_tight_layout_00_04.png deleted file mode 100644 index fc611f71731..00000000000 Binary files a/mpl_examples/pylab_examples/demo_tight_layout_00_04.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_tight_layout_00_05.hires.png b/mpl_examples/pylab_examples/demo_tight_layout_00_05.hires.png deleted file mode 100644 index 00f03ac1310..00000000000 Binary files a/mpl_examples/pylab_examples/demo_tight_layout_00_05.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_tight_layout_00_05.pdf b/mpl_examples/pylab_examples/demo_tight_layout_00_05.pdf deleted file mode 100644 index 8804f1cd605..00000000000 Binary files a/mpl_examples/pylab_examples/demo_tight_layout_00_05.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_tight_layout_00_05.png b/mpl_examples/pylab_examples/demo_tight_layout_00_05.png deleted file mode 100644 index 1a1655589b1..00000000000 Binary files a/mpl_examples/pylab_examples/demo_tight_layout_00_05.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_tight_layout_00_06.hires.png b/mpl_examples/pylab_examples/demo_tight_layout_00_06.hires.png deleted file mode 100644 index 6cc4f161ed5..00000000000 Binary files a/mpl_examples/pylab_examples/demo_tight_layout_00_06.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_tight_layout_00_06.pdf b/mpl_examples/pylab_examples/demo_tight_layout_00_06.pdf deleted file mode 100644 index d8aca4d65a9..00000000000 Binary files a/mpl_examples/pylab_examples/demo_tight_layout_00_06.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_tight_layout_00_06.png b/mpl_examples/pylab_examples/demo_tight_layout_00_06.png deleted file mode 100644 index 3522593b50a..00000000000 Binary files a/mpl_examples/pylab_examples/demo_tight_layout_00_06.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_tight_layout_01_00.hires.png b/mpl_examples/pylab_examples/demo_tight_layout_01_00.hires.png deleted file mode 100644 index af4de9baf03..00000000000 Binary files a/mpl_examples/pylab_examples/demo_tight_layout_01_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_tight_layout_01_00.pdf b/mpl_examples/pylab_examples/demo_tight_layout_01_00.pdf deleted file mode 100644 index a073620a94c..00000000000 Binary files a/mpl_examples/pylab_examples/demo_tight_layout_01_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/demo_tight_layout_01_00.png b/mpl_examples/pylab_examples/demo_tight_layout_01_00.png deleted file mode 100644 index f77ef21c7ef..00000000000 Binary files a/mpl_examples/pylab_examples/demo_tight_layout_01_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/dolphin.hires.png b/mpl_examples/pylab_examples/dolphin.hires.png deleted file mode 100644 index b392f3e8fa7..00000000000 Binary files a/mpl_examples/pylab_examples/dolphin.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/dolphin.pdf b/mpl_examples/pylab_examples/dolphin.pdf deleted file mode 100644 index 1651d921af6..00000000000 Binary files a/mpl_examples/pylab_examples/dolphin.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/dolphin.png b/mpl_examples/pylab_examples/dolphin.png deleted file mode 100644 index 5d466841232..00000000000 Binary files a/mpl_examples/pylab_examples/dolphin.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/dolphin.py b/mpl_examples/pylab_examples/dolphin.py deleted file mode 100644 index 90f5764914f..00000000000 --- a/mpl_examples/pylab_examples/dolphin.py +++ /dev/null @@ -1,91 +0,0 @@ -import matplotlib.cm as cm -import matplotlib.pyplot as plt -from matplotlib.patches import Circle, PathPatch -from matplotlib.path import Path -from matplotlib.transforms import Affine2D -import numpy as np - - -r = np.random.rand(50) -t = np.random.rand(50) * np.pi * 2.0 -x = r * np.cos(t) -y = r * np.sin(t) - -fig, ax = plt.subplots(figsize=(6, 6)) -circle = Circle((0, 0), 1, facecolor='none', - edgecolor=(0, 0.8, 0.8), linewidth=3, alpha=0.5) -ax.add_patch(circle) - -im = plt.imshow(np.random.random((100, 100)), - origin='lower', cmap=cm.winter, - interpolation='spline36', - extent=([-1, 1, -1, 1])) -im.set_clip_path(circle) - -plt.plot(x, y, 'o', color=(0.9, 0.9, 1.0), alpha=0.8) - -# Dolphin from OpenClipart library by Andy Fitzsimon -# -# -# -# -# - -dolphin = """ -M -0.59739425,160.18173 C -0.62740401,160.18885 -0.57867129,160.11183 --0.57867129,160.11183 C -0.57867129,160.11183 -0.5438361,159.89315 --0.39514638,159.81496 C -0.24645668,159.73678 -0.18316813,159.71981 --0.18316813,159.71981 C -0.18316813,159.71981 -0.10322971,159.58124 --0.057804323,159.58725 C -0.029723983,159.58913 -0.061841603,159.60356 --0.071265813,159.62815 C -0.080250183,159.65325 -0.082918513,159.70554 --0.061841203,159.71248 C -0.040763903,159.7194 -0.0066711426,159.71091 -0.077336307,159.73612 C 0.16879567,159.76377 0.28380306,159.86448 -0.31516668,159.91533 C 0.3465303,159.96618 0.5011127,160.1771 -0.5011127,160.1771 C 0.63668998,160.19238 0.67763022,160.31259 -0.66556395,160.32668 C 0.65339985,160.34212 0.66350443,160.33642 -0.64907098,160.33088 C 0.63463742,160.32533 0.61309688,160.297 -0.5789627,160.29339 C 0.54348657,160.28968 0.52329693,160.27674 -0.50728856,160.27737 C 0.49060916,160.27795 0.48965803,160.31565 -0.46114204,160.33673 C 0.43329696,160.35786 0.4570711,160.39871 -0.43309565,160.40685 C 0.4105108,160.41442 0.39416631,160.33027 -0.3954995,160.2935 C 0.39683269,160.25672 0.43807996,160.21522 -0.44567915,160.19734 C 0.45327833,160.17946 0.27946869,159.9424 --0.061852613,159.99845 C -0.083965233,160.0427 -0.26176109,160.06683 --0.26176109,160.06683 C -0.30127962,160.07028 -0.21167141,160.09731 --0.24649368,160.1011 C -0.32642366,160.11569 -0.34521187,160.06895 --0.40622293,160.0819 C -0.467234,160.09485 -0.56738444,160.17461 --0.59739425,160.18173 -""" - -vertices = [] -codes = [] -parts = dolphin.split() -i = 0 -code_map = { - 'M': (Path.MOVETO, 1), - 'C': (Path.CURVE4, 3), - 'L': (Path.LINETO, 1) - } - -while i < len(parts): - code = parts[i] - path_code, npoints = code_map[code] - codes.extend([path_code] * npoints) - vertices.extend([[float(x) for x in y.split(',')] for y in - parts[i + 1:i + npoints + 1]]) - i += npoints + 1 -vertices = np.array(vertices, np.float) -vertices[:, 1] -= 160 - -dolphin_path = Path(vertices, codes) -dolphin_patch = PathPatch(dolphin_path, facecolor=(0.6, 0.6, 0.6), - edgecolor=(0.0, 0.0, 0.0)) -ax.add_patch(dolphin_patch) - -vertices = Affine2D().rotate_deg(60).transform(vertices) -dolphin_path2 = Path(vertices, codes) -dolphin_patch2 = PathPatch(dolphin_path2, facecolor=(0.5, 0.5, 0.5), - edgecolor=(0.0, 0.0, 0.0)) -ax.add_patch(dolphin_patch2) - -plt.show() diff --git a/mpl_examples/pylab_examples/ellipse_collection.hires.png b/mpl_examples/pylab_examples/ellipse_collection.hires.png deleted file mode 100644 index a94a61a532c..00000000000 Binary files a/mpl_examples/pylab_examples/ellipse_collection.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/ellipse_collection.pdf b/mpl_examples/pylab_examples/ellipse_collection.pdf deleted file mode 100644 index 6bdf8bb2b98..00000000000 Binary files a/mpl_examples/pylab_examples/ellipse_collection.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/ellipse_collection.png b/mpl_examples/pylab_examples/ellipse_collection.png deleted file mode 100644 index 1e19085b83a..00000000000 Binary files a/mpl_examples/pylab_examples/ellipse_collection.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/ellipse_collection.py b/mpl_examples/pylab_examples/ellipse_collection.py deleted file mode 100644 index 3d98c0c1246..00000000000 --- a/mpl_examples/pylab_examples/ellipse_collection.py +++ /dev/null @@ -1,27 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np -from matplotlib.collections import EllipseCollection - -x = np.arange(10) -y = np.arange(15) -X, Y = np.meshgrid(x, y) - -XY = np.hstack((X.ravel()[:, np.newaxis], Y.ravel()[:, np.newaxis])) - -ww = X/10.0 -hh = Y/15.0 -aa = X*9 - - -fig, ax = plt.subplots() - -ec = EllipseCollection(ww, hh, aa, units='x', offsets=XY, - transOffset=ax.transData) -ec.set_array((X + Y).ravel()) -ax.add_collection(ec) -ax.autoscale_view() -ax.set_xlabel('X') -ax.set_ylabel('y') -cbar = plt.colorbar(ec) -cbar.set_label('X+Y') -plt.show() diff --git a/mpl_examples/pylab_examples/ellipse_demo.hires.png b/mpl_examples/pylab_examples/ellipse_demo.hires.png deleted file mode 100644 index 318b8f6959a..00000000000 Binary files a/mpl_examples/pylab_examples/ellipse_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/ellipse_demo.pdf b/mpl_examples/pylab_examples/ellipse_demo.pdf deleted file mode 100644 index 73181e6ef58..00000000000 Binary files a/mpl_examples/pylab_examples/ellipse_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/ellipse_demo.png b/mpl_examples/pylab_examples/ellipse_demo.png deleted file mode 100644 index 5a76a86c26c..00000000000 Binary files a/mpl_examples/pylab_examples/ellipse_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/ellipse_demo.py b/mpl_examples/pylab_examples/ellipse_demo.py deleted file mode 100644 index d77e06fa867..00000000000 --- a/mpl_examples/pylab_examples/ellipse_demo.py +++ /dev/null @@ -1,21 +0,0 @@ -import matplotlib.pyplot as plt -import numpy.random as rnd -from matplotlib.patches import Ellipse - -NUM = 250 - -ells = [Ellipse(xy=rnd.rand(2)*10, width=rnd.rand(), height=rnd.rand(), angle=rnd.rand()*360) - for i in range(NUM)] - -fig = plt.figure(0) -ax = fig.add_subplot(111, aspect='equal') -for e in ells: - ax.add_artist(e) - e.set_clip_box(ax.bbox) - e.set_alpha(rnd.rand()) - e.set_facecolor(rnd.rand(3)) - -ax.set_xlim(0, 10) -ax.set_ylim(0, 10) - -plt.show() diff --git a/mpl_examples/pylab_examples/ellipse_rotated.hires.png b/mpl_examples/pylab_examples/ellipse_rotated.hires.png deleted file mode 100644 index 79762c81eac..00000000000 Binary files a/mpl_examples/pylab_examples/ellipse_rotated.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/ellipse_rotated.pdf b/mpl_examples/pylab_examples/ellipse_rotated.pdf deleted file mode 100644 index ae6c721fe2f..00000000000 Binary files a/mpl_examples/pylab_examples/ellipse_rotated.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/ellipse_rotated.png b/mpl_examples/pylab_examples/ellipse_rotated.png deleted file mode 100644 index c849fc88b45..00000000000 Binary files a/mpl_examples/pylab_examples/ellipse_rotated.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/ellipse_rotated.py b/mpl_examples/pylab_examples/ellipse_rotated.py deleted file mode 100644 index f90f8690a03..00000000000 --- a/mpl_examples/pylab_examples/ellipse_rotated.py +++ /dev/null @@ -1,20 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np -from matplotlib.patches import Ellipse - -delta = 45.0 # degrees - -angles = np.arange(0, 360 + delta, delta) -ells = [Ellipse((1, 1), 4, 2, a) for a in angles] - -a = plt.subplot(111, aspect='equal') - -for e in ells: - e.set_clip_box(a.bbox) - e.set_alpha(0.1) - a.add_artist(e) - -plt.xlim(-2, 4) -plt.ylim(-1, 3) - -plt.show() diff --git a/mpl_examples/pylab_examples/equal_aspect_ratio.hires.png b/mpl_examples/pylab_examples/equal_aspect_ratio.hires.png deleted file mode 100644 index afee7e7847f..00000000000 Binary files a/mpl_examples/pylab_examples/equal_aspect_ratio.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/equal_aspect_ratio.pdf b/mpl_examples/pylab_examples/equal_aspect_ratio.pdf deleted file mode 100644 index 5fdd15878b6..00000000000 Binary files a/mpl_examples/pylab_examples/equal_aspect_ratio.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/equal_aspect_ratio.png b/mpl_examples/pylab_examples/equal_aspect_ratio.png deleted file mode 100644 index 8c63140264f..00000000000 Binary files a/mpl_examples/pylab_examples/equal_aspect_ratio.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/equal_aspect_ratio.py b/mpl_examples/pylab_examples/equal_aspect_ratio.py deleted file mode 100644 index 9ed478095e6..00000000000 --- a/mpl_examples/pylab_examples/equal_aspect_ratio.py +++ /dev/null @@ -1,20 +0,0 @@ -""" -Example: simple line plot. -Show how to make a plot that has equal aspect ratio -""" -import matplotlib.pyplot as plt -import numpy as np - -t = np.arange(0.0, 1.0 + 0.01, 0.01) -s = np.cos(2*2*np.pi*t) -plt.plot(t, s, '-', lw=2) - -plt.xlabel('time (s)') -plt.ylabel('voltage (mV)') -plt.title('About as simple as it gets, folks') -plt.grid(True) - -plt.axes().set_aspect('equal', 'datalim') - - -plt.show() diff --git a/mpl_examples/pylab_examples/errorbar_limits.py b/mpl_examples/pylab_examples/errorbar_limits.py deleted file mode 100644 index 7f62dfecdab..00000000000 --- a/mpl_examples/pylab_examples/errorbar_limits.py +++ /dev/null @@ -1,39 +0,0 @@ -""" -Illustration of upper and lower limit symbols on errorbars -""" - -import numpy as np -import matplotlib.pyplot as plt - -fig = plt.figure(0) -x = np.arange(10.0) -y = np.sin(np.arange(10.0)/20.0*np.pi) - -plt.errorbar(x, y, yerr=0.1) - -y = np.sin(np.arange(10.0)/20.0*np.pi) + 1 -plt.errorbar(x, y, yerr=0.1, uplims=True) - -y = np.sin(np.arange(10.0)/20.0*np.pi) + 2 -upperlimits = np.array([1, 0]*5) -lowerlimits = np.array([0, 1]*5) -plt.errorbar(x, y, yerr=0.1, uplims=upperlimits, lolims=lowerlimits) - -plt.xlim(-1, 10) - -fig = plt.figure(1) -x = np.arange(10.0)/10.0 -y = (x + 0.1)**2 - -plt.errorbar(x, y, xerr=0.1, xlolims=True) -y = (x + 0.1)**3 - -plt.errorbar(x + 0.6, y, xerr=0.1, xuplims=upperlimits, xlolims=lowerlimits) - -y = (x + 0.1)**4 -plt.errorbar(x + 1.2, y, xerr=0.1, xuplims=True) - -plt.xlim(-0.2, 2.4) -plt.ylim(-0.1, 1.3) - -plt.show() diff --git a/mpl_examples/pylab_examples/errorbar_limits_00.hires.png b/mpl_examples/pylab_examples/errorbar_limits_00.hires.png deleted file mode 100644 index 8c1399bd69d..00000000000 Binary files a/mpl_examples/pylab_examples/errorbar_limits_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/errorbar_limits_00.pdf b/mpl_examples/pylab_examples/errorbar_limits_00.pdf deleted file mode 100644 index a86dc2b1f47..00000000000 Binary files a/mpl_examples/pylab_examples/errorbar_limits_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/errorbar_limits_00.png b/mpl_examples/pylab_examples/errorbar_limits_00.png deleted file mode 100644 index 64c85a19918..00000000000 Binary files a/mpl_examples/pylab_examples/errorbar_limits_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/errorbar_limits_01.hires.png b/mpl_examples/pylab_examples/errorbar_limits_01.hires.png deleted file mode 100644 index 7c15f218771..00000000000 Binary files a/mpl_examples/pylab_examples/errorbar_limits_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/errorbar_limits_01.pdf b/mpl_examples/pylab_examples/errorbar_limits_01.pdf deleted file mode 100644 index d5250c48b9b..00000000000 Binary files a/mpl_examples/pylab_examples/errorbar_limits_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/errorbar_limits_01.png b/mpl_examples/pylab_examples/errorbar_limits_01.png deleted file mode 100644 index 032c81bd291..00000000000 Binary files a/mpl_examples/pylab_examples/errorbar_limits_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/errorbar_subsample.hires.png b/mpl_examples/pylab_examples/errorbar_subsample.hires.png deleted file mode 100644 index 10b5f85cc08..00000000000 Binary files a/mpl_examples/pylab_examples/errorbar_subsample.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/errorbar_subsample.pdf b/mpl_examples/pylab_examples/errorbar_subsample.pdf deleted file mode 100644 index a61e8096cc6..00000000000 Binary files a/mpl_examples/pylab_examples/errorbar_subsample.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/errorbar_subsample.png b/mpl_examples/pylab_examples/errorbar_subsample.png deleted file mode 100644 index affdd35bb77..00000000000 Binary files a/mpl_examples/pylab_examples/errorbar_subsample.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/errorbar_subsample.py b/mpl_examples/pylab_examples/errorbar_subsample.py deleted file mode 100644 index 58ac3b1d347..00000000000 --- a/mpl_examples/pylab_examples/errorbar_subsample.py +++ /dev/null @@ -1,30 +0,0 @@ -''' -Demo for the errorevery keyword to show data full accuracy data plots with -few errorbars. -''' - -import numpy as np -import matplotlib.pyplot as plt - -# example data -x = np.arange(0.1, 4, 0.1) -y = np.exp(-x) - -# example variable error bar values -yerr = 0.1 + 0.1*np.sqrt(x) - - -# Now switch to a more OO interface to exercise more features. -fig, axs = plt.subplots(nrows=1, ncols=2, sharex=True) -ax = axs[0] -ax.errorbar(x, y, yerr=yerr) -ax.set_title('all errorbars') - -ax = axs[1] -ax.errorbar(x, y, yerr=yerr, errorevery=5) -ax.set_title('only every 5th errorbar') - - -fig.suptitle('Errorbar subsampling for better appearance') - -plt.show() diff --git a/mpl_examples/pylab_examples/eventcollection_demo.hires.png b/mpl_examples/pylab_examples/eventcollection_demo.hires.png deleted file mode 100644 index 0715ec66f03..00000000000 Binary files a/mpl_examples/pylab_examples/eventcollection_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/eventcollection_demo.pdf b/mpl_examples/pylab_examples/eventcollection_demo.pdf deleted file mode 100644 index c8e71cc6e1b..00000000000 Binary files a/mpl_examples/pylab_examples/eventcollection_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/eventcollection_demo.png b/mpl_examples/pylab_examples/eventcollection_demo.png deleted file mode 100644 index 378c2c5d60d..00000000000 Binary files a/mpl_examples/pylab_examples/eventcollection_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/eventcollection_demo.py b/mpl_examples/pylab_examples/eventcollection_demo.py deleted file mode 100644 index 96d389baff0..00000000000 --- a/mpl_examples/pylab_examples/eventcollection_demo.py +++ /dev/null @@ -1,54 +0,0 @@ -''' -Plot two curves, then use EventCollections to mark the locations of the x -and y data points on the respective axes for each curve -''' - -import matplotlib.pyplot as plt -from matplotlib.collections import EventCollection -import numpy as np - -# create random data -np.random.seed(50) -xdata = np.random.random([2, 10]) - -# split the data into two parts -xdata1 = xdata[0, :] -xdata2 = xdata[1, :] - -# sort the data so it makes clean curves -xdata1.sort() -xdata2.sort() - -# create some y data points -ydata1 = xdata1 ** 2 -ydata2 = 1 - xdata2 ** 3 - -# plot the data -fig = plt.figure() -ax = fig.add_subplot(1, 1, 1) -ax.plot(xdata1, ydata1, 'r', xdata2, ydata2, 'b') - -# create the events marking the x data points -xevents1 = EventCollection(xdata1, color=[1, 0, 0], linelength=0.05) -xevents2 = EventCollection(xdata2, color=[0, 0, 1], linelength=0.05) - -# create the events marking the y data points -yevents1 = EventCollection(ydata1, color=[1, 0, 0], linelength=0.05, - orientation='vertical') -yevents2 = EventCollection(ydata2, color=[0, 0, 1], linelength=0.05, - orientation='vertical') - -# add the events to the axis -ax.add_collection(xevents1) -ax.add_collection(xevents2) -ax.add_collection(yevents1) -ax.add_collection(yevents2) - -# set the limits -ax.set_xlim([0, 1]) -ax.set_ylim([0, 1]) - -ax.set_title('line plot with data points') - -# display the plot -plt.show() diff --git a/mpl_examples/pylab_examples/eventplot_demo.hires.png b/mpl_examples/pylab_examples/eventplot_demo.hires.png deleted file mode 100644 index ac193551fd3..00000000000 Binary files a/mpl_examples/pylab_examples/eventplot_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/eventplot_demo.pdf b/mpl_examples/pylab_examples/eventplot_demo.pdf deleted file mode 100644 index 5f2664c8c28..00000000000 Binary files a/mpl_examples/pylab_examples/eventplot_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/eventplot_demo.png b/mpl_examples/pylab_examples/eventplot_demo.png deleted file mode 100644 index dd89f0e7aef..00000000000 Binary files a/mpl_examples/pylab_examples/eventplot_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/eventplot_demo.py b/mpl_examples/pylab_examples/eventplot_demo.py deleted file mode 100644 index dd6d8fa1c48..00000000000 --- a/mpl_examples/pylab_examples/eventplot_demo.py +++ /dev/null @@ -1,65 +0,0 @@ -''' -An eventplot showing sequences of events with various line properties. -The plot is shown in both horizontal and vertical orientations. -''' - -import matplotlib.pyplot as plt -import numpy as np -import matplotlib -matplotlib.rcParams['font.size'] = 8.0 - -# set the random seed -np.random.seed(0) - -# create random data -data1 = np.random.random([6, 50]) - -# set different colors for each set of positions -colors1 = np.array([[1, 0, 0], - [0, 1, 0], - [0, 0, 1], - [1, 1, 0], - [1, 0, 1], - [0, 1, 1]]) - -# set different line properties for each set of positions -# note that some overlap -lineoffsets1 = np.array([-15, -3, 1, 1.5, 6, 10]) -linelengths1 = [5, 2, 1, 1, 3, 1.5] - -fig = plt.figure() - -# create a horizontal plot -ax1 = fig.add_subplot(221) -ax1.eventplot(data1, colors=colors1, lineoffsets=lineoffsets1, - linelengths=linelengths1) - - -# create a vertical plot -ax2 = fig.add_subplot(223) -ax2.eventplot(data1, colors=colors1, lineoffsets=lineoffsets1, - linelengths=linelengths1, orientation='vertical') - -# create another set of random data. -# the gamma distribution is only used fo aesthetic purposes -data2 = np.random.gamma(4, size=[60, 50]) - -# use individual values for the parameters this time -# these values will be used for all data sets (except lineoffsets2, which -# sets the increment between each data set in this usage) -colors2 = [[0, 0, 0]] -lineoffsets2 = 1 -linelengths2 = 1 - -# create a horizontal plot -ax1 = fig.add_subplot(222) -ax1.eventplot(data2, colors=colors2, lineoffsets=lineoffsets2, - linelengths=linelengths2) - - -# create a vertical plot -ax2 = fig.add_subplot(224) -ax2.eventplot(data2, colors=colors2, lineoffsets=lineoffsets2, - linelengths=linelengths2, orientation='vertical') - -plt.show() diff --git a/mpl_examples/pylab_examples/fancyarrow_demo.hires.png b/mpl_examples/pylab_examples/fancyarrow_demo.hires.png deleted file mode 100644 index 0b4b06d39f8..00000000000 Binary files a/mpl_examples/pylab_examples/fancyarrow_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/fancyarrow_demo.pdf b/mpl_examples/pylab_examples/fancyarrow_demo.pdf deleted file mode 100644 index b4f330ef48e..00000000000 Binary files a/mpl_examples/pylab_examples/fancyarrow_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/fancyarrow_demo.png b/mpl_examples/pylab_examples/fancyarrow_demo.png deleted file mode 100644 index ff2a6c86837..00000000000 Binary files a/mpl_examples/pylab_examples/fancyarrow_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/fancyarrow_demo.py b/mpl_examples/pylab_examples/fancyarrow_demo.py deleted file mode 100644 index 227e53bb36e..00000000000 --- a/mpl_examples/pylab_examples/fancyarrow_demo.py +++ /dev/null @@ -1,50 +0,0 @@ -import matplotlib.patches as mpatches -import matplotlib.pyplot as plt - -styles = mpatches.ArrowStyle.get_styles() - -ncol = 2 -nrow = (len(styles) + 1) // ncol -figheight = (nrow + 0.5) -fig1 = plt.figure(1, (4.*ncol/1.5, figheight/1.5)) -fontsize = 0.2 * 70 - - -ax = fig1.add_axes([0, 0, 1, 1], frameon=False, aspect=1.) - -ax.set_xlim(0, 4*ncol) -ax.set_ylim(0, figheight) - - -def to_texstring(s): - s = s.replace("<", r"$<$") - s = s.replace(">", r"$>$") - s = s.replace("|", r"$|$") - return s - -for i, (stylename, styleclass) in enumerate(sorted(styles.items())): - x = 3.2 + (i//nrow)*4 - y = (figheight - 0.7 - i % nrow) # /figheight - p = mpatches.Circle((x, y), 0.2) - ax.add_patch(p) - - ax.annotate(to_texstring(stylename), (x, y), - (x - 1.2, y), - #xycoords="figure fraction", textcoords="figure fraction", - ha="right", va="center", - size=fontsize, - arrowprops=dict(arrowstyle=stylename, - patchB=p, - shrinkA=5, - shrinkB=5, - fc="k", ec="k", - connectionstyle="arc3,rad=-0.05", - ), - bbox=dict(boxstyle="square", fc="w")) - -ax.xaxis.set_visible(False) -ax.yaxis.set_visible(False) - - -plt.draw() -plt.show() diff --git a/mpl_examples/pylab_examples/fancybox_demo.py b/mpl_examples/pylab_examples/fancybox_demo.py deleted file mode 100644 index 410fbf8890e..00000000000 --- a/mpl_examples/pylab_examples/fancybox_demo.py +++ /dev/null @@ -1,163 +0,0 @@ -import matplotlib.pyplot as plt -import matplotlib.transforms as mtransforms -from matplotlib.patches import FancyBboxPatch - - -# Bbox object around which the fancy box will be drawn. -bb = mtransforms.Bbox([[0.3, 0.4], [0.7, 0.6]]) - - -def draw_bbox(ax, bb): - # boxstyle=square with pad=0, i.e. bbox itself. - p_bbox = FancyBboxPatch((bb.xmin, bb.ymin), - abs(bb.width), abs(bb.height), - boxstyle="square,pad=0.", - ec="k", fc="none", zorder=10., - ) - ax.add_patch(p_bbox) - - -def test1(ax): - - # a fancy box with round corners. pad=0.1 - p_fancy = FancyBboxPatch((bb.xmin, bb.ymin), - abs(bb.width), abs(bb.height), - boxstyle="round,pad=0.1", - fc=(1., .8, 1.), - ec=(1., 0.5, 1.)) - - ax.add_patch(p_fancy) - - ax.text(0.1, 0.8, - r' boxstyle="round,pad=0.1"', - size=10, transform=ax.transAxes) - - # draws control points for the fancy box. - #l = p_fancy.get_path().vertices - #ax.plot(l[:,0], l[:,1], ".") - - # draw the original bbox in black - draw_bbox(ax, bb) - - -def test2(ax): - - # bbox=round has two optional argument. pad and rounding_size. - # They can be set during the initialization. - p_fancy = FancyBboxPatch((bb.xmin, bb.ymin), - abs(bb.width), abs(bb.height), - boxstyle="round,pad=0.1", - fc=(1., .8, 1.), - ec=(1., 0.5, 1.)) - - ax.add_patch(p_fancy) - - # boxstyle and its argument can be later modified with - # set_boxstyle method. Note that the old attributes are simply - # forgotten even if the boxstyle name is same. - - p_fancy.set_boxstyle("round,pad=0.1, rounding_size=0.2") - # or - #p_fancy.set_boxstyle("round", pad=0.1, rounding_size=0.2) - - ax.text(0.1, 0.8, - ' boxstyle="round,pad=0.1\n rounding\\_size=0.2"', - size=10, transform=ax.transAxes) - - # draws control points for the fancy box. - #l = p_fancy.get_path().vertices - #ax.plot(l[:,0], l[:,1], ".") - - draw_bbox(ax, bb) - - -def test3(ax): - - # mutation_scale determine overall scale of the mutation, - # i.e. both pad and rounding_size is scaled according to this - # value. - p_fancy = FancyBboxPatch((bb.xmin, bb.ymin), - abs(bb.width), abs(bb.height), - boxstyle="round,pad=0.1", - mutation_scale=2., - fc=(1., .8, 1.), - ec=(1., 0.5, 1.)) - - ax.add_patch(p_fancy) - - ax.text(0.1, 0.8, - ' boxstyle="round,pad=0.1"\n mutation\\_scale=2', - size=10, transform=ax.transAxes) - - # draws control points for the fancy box. - #l = p_fancy.get_path().vertices - #ax.plot(l[:,0], l[:,1], ".") - - draw_bbox(ax, bb) - - -def test4(ax): - - # When the aspect ratio of the axes is not 1, the fancy box may - # not be what you expected (green) - - p_fancy = FancyBboxPatch((bb.xmin, bb.ymin), - abs(bb.width), abs(bb.height), - boxstyle="round,pad=0.2", - fc="none", - ec=(0., .5, 0.), zorder=4) - - ax.add_patch(p_fancy) - - # You can compensate this by setting the mutation_aspect (pink). - p_fancy = FancyBboxPatch((bb.xmin, bb.ymin), - abs(bb.width), abs(bb.height), - boxstyle="round,pad=0.3", - mutation_aspect=.5, - fc=(1., 0.8, 1.), - ec=(1., 0.5, 1.)) - - ax.add_patch(p_fancy) - - ax.text(0.1, 0.8, - ' boxstyle="round,pad=0.3"\n mutation\\_aspect=.5', - size=10, transform=ax.transAxes) - - draw_bbox(ax, bb) - - -def test_all(): - plt.clf() - - ax = plt.subplot(2, 2, 1) - test1(ax) - ax.set_xlim(0., 1.) - ax.set_ylim(0., 1.) - ax.set_title("test1") - ax.set_aspect(1.) - - ax = plt.subplot(2, 2, 2) - ax.set_title("test2") - test2(ax) - ax.set_xlim(0., 1.) - ax.set_ylim(0., 1.) - ax.set_aspect(1.) - - ax = plt.subplot(2, 2, 3) - ax.set_title("test3") - test3(ax) - ax.set_xlim(0., 1.) - ax.set_ylim(0., 1.) - ax.set_aspect(1) - - ax = plt.subplot(2, 2, 4) - ax.set_title("test4") - test4(ax) - ax.set_xlim(-0.5, 1.5) - ax.set_ylim(0., 1.) - ax.set_aspect(2.) - - plt.draw() - plt.show() - -test_all() diff --git a/mpl_examples/pylab_examples/fancybox_demo2.hires.png b/mpl_examples/pylab_examples/fancybox_demo2.hires.png deleted file mode 100644 index d8e0373c70e..00000000000 Binary files a/mpl_examples/pylab_examples/fancybox_demo2.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/fancybox_demo2.pdf b/mpl_examples/pylab_examples/fancybox_demo2.pdf deleted file mode 100644 index ecb1cd8cae1..00000000000 Binary files a/mpl_examples/pylab_examples/fancybox_demo2.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/fancybox_demo2.png b/mpl_examples/pylab_examples/fancybox_demo2.png deleted file mode 100644 index acdf541378b..00000000000 Binary files a/mpl_examples/pylab_examples/fancybox_demo2.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/fancybox_demo2.py b/mpl_examples/pylab_examples/fancybox_demo2.py deleted file mode 100644 index dc953d4866d..00000000000 --- a/mpl_examples/pylab_examples/fancybox_demo2.py +++ /dev/null @@ -1,18 +0,0 @@ -import matplotlib.patches as mpatch -import matplotlib.pyplot as plt - -styles = mpatch.BoxStyle.get_styles() -spacing = 1.2 - -figheight = (spacing * len(styles) + .5) -fig1 = plt.figure(1, (4/1.5, figheight/1.5)) -fontsize = 0.3 * 72 - -for i, stylename in enumerate(sorted(styles.keys())): - fig1.text(0.5, (spacing * (float(len(styles)) - i) - 0.5)/figheight, stylename, - ha="center", - size=fontsize, - transform=fig1.transFigure, - bbox=dict(boxstyle=stylename, fc="w", ec="k")) -plt.draw() -plt.show() diff --git a/mpl_examples/pylab_examples/fancybox_demo_01_00.hires.png b/mpl_examples/pylab_examples/fancybox_demo_01_00.hires.png deleted file mode 100644 index 99bc27b0e82..00000000000 Binary files a/mpl_examples/pylab_examples/fancybox_demo_01_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/fancybox_demo_01_00.pdf b/mpl_examples/pylab_examples/fancybox_demo_01_00.pdf deleted file mode 100644 index 60e924c0330..00000000000 Binary files a/mpl_examples/pylab_examples/fancybox_demo_01_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/fancybox_demo_01_00.png b/mpl_examples/pylab_examples/fancybox_demo_01_00.png deleted file mode 100644 index be3619e6f68..00000000000 Binary files a/mpl_examples/pylab_examples/fancybox_demo_01_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/fancytextbox_demo.hires.png b/mpl_examples/pylab_examples/fancytextbox_demo.hires.png deleted file mode 100644 index 7455c184e01..00000000000 Binary files a/mpl_examples/pylab_examples/fancytextbox_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/fancytextbox_demo.pdf b/mpl_examples/pylab_examples/fancytextbox_demo.pdf deleted file mode 100644 index e72277333fb..00000000000 Binary files a/mpl_examples/pylab_examples/fancytextbox_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/fancytextbox_demo.png b/mpl_examples/pylab_examples/fancytextbox_demo.png deleted file mode 100644 index 50f307dc89f..00000000000 Binary files a/mpl_examples/pylab_examples/fancytextbox_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/fancytextbox_demo.py b/mpl_examples/pylab_examples/fancytextbox_demo.py deleted file mode 100644 index cd339f02ecd..00000000000 --- a/mpl_examples/pylab_examples/fancytextbox_demo.py +++ /dev/null @@ -1,21 +0,0 @@ -import matplotlib.pyplot as plt - -plt.text(0.6, 0.5, "test", size=50, rotation=30., - ha="center", va="center", - bbox=dict(boxstyle="round", - ec=(1., 0.5, 0.5), - fc=(1., 0.8, 0.8), - ) - ) - -plt.text(0.5, 0.4, "test", size=50, rotation=-30., - ha="right", va="top", - bbox=dict(boxstyle="square", - ec=(1., 0.5, 0.5), - fc=(1., 0.8, 0.8), - ) - ) - - -plt.draw() -plt.show() diff --git a/mpl_examples/pylab_examples/figimage_demo.hires.png b/mpl_examples/pylab_examples/figimage_demo.hires.png deleted file mode 100644 index 486bd89317d..00000000000 Binary files a/mpl_examples/pylab_examples/figimage_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/figimage_demo.pdf b/mpl_examples/pylab_examples/figimage_demo.pdf deleted file mode 100644 index 2563fcde6bf..00000000000 Binary files a/mpl_examples/pylab_examples/figimage_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/figimage_demo.png b/mpl_examples/pylab_examples/figimage_demo.png deleted file mode 100644 index 806dadd8225..00000000000 Binary files a/mpl_examples/pylab_examples/figimage_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/figimage_demo.py b/mpl_examples/pylab_examples/figimage_demo.py deleted file mode 100644 index 56c78d3bdbf..00000000000 --- a/mpl_examples/pylab_examples/figimage_demo.py +++ /dev/null @@ -1,19 +0,0 @@ -""" -This illustrates placing images directly in the figure, with no axes. - -""" -import numpy as np -import matplotlib -import matplotlib.cm as cm -import matplotlib.pyplot as plt - - -fig = plt.figure() -Z = np.arange(10000.0) -Z.shape = 100, 100 -Z[:, 50:] = 1. - -im1 = plt.figimage(Z, xo=50, yo=0, origin='lower') -im2 = plt.figimage(Z, xo=100, yo=100, alpha=.8, origin='lower') - -plt.show() diff --git a/mpl_examples/pylab_examples/figlegend_demo.hires.png b/mpl_examples/pylab_examples/figlegend_demo.hires.png deleted file mode 100644 index 3572a07fc03..00000000000 Binary files a/mpl_examples/pylab_examples/figlegend_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/figlegend_demo.pdf b/mpl_examples/pylab_examples/figlegend_demo.pdf deleted file mode 100644 index 57cfcb28b98..00000000000 Binary files a/mpl_examples/pylab_examples/figlegend_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/figlegend_demo.png b/mpl_examples/pylab_examples/figlegend_demo.png deleted file mode 100644 index ca9ebf8584b..00000000000 Binary files a/mpl_examples/pylab_examples/figlegend_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/figlegend_demo.py b/mpl_examples/pylab_examples/figlegend_demo.py deleted file mode 100644 index 8cda7bedd46..00000000000 --- a/mpl_examples/pylab_examples/figlegend_demo.py +++ /dev/null @@ -1,19 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -fig = plt.figure() -ax1 = fig.add_axes([0.1, 0.1, 0.4, 0.7]) -ax2 = fig.add_axes([0.55, 0.1, 0.4, 0.7]) - -x = np.arange(0.0, 2.0, 0.02) -y1 = np.sin(2*np.pi*x) -y2 = np.exp(-x) -l1, l2 = ax1.plot(x, y1, 'rs-', x, y2, 'go') - -y3 = np.sin(4*np.pi*x) -y4 = np.exp(-2*x) -l3, l4 = ax2.plot(x, y3, 'yd-', x, y4, 'k^') - -fig.legend((l1, l2), ('Line 1', 'Line 2'), 'upper left') -fig.legend((l3, l4), ('Line 3', 'Line 4'), 'upper right') -plt.show() diff --git a/mpl_examples/pylab_examples/figure_title.hires.png b/mpl_examples/pylab_examples/figure_title.hires.png deleted file mode 100644 index 8dfe3fbbc76..00000000000 Binary files a/mpl_examples/pylab_examples/figure_title.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/figure_title.pdf b/mpl_examples/pylab_examples/figure_title.pdf deleted file mode 100644 index 673a5958e07..00000000000 Binary files a/mpl_examples/pylab_examples/figure_title.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/figure_title.png b/mpl_examples/pylab_examples/figure_title.png deleted file mode 100644 index 1c22ff36749..00000000000 Binary files a/mpl_examples/pylab_examples/figure_title.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/figure_title.py b/mpl_examples/pylab_examples/figure_title.py deleted file mode 100644 index c01ff4986cf..00000000000 --- a/mpl_examples/pylab_examples/figure_title.py +++ /dev/null @@ -1,31 +0,0 @@ -from matplotlib.font_manager import FontProperties -import matplotlib.pyplot as plt -import numpy as np - - -def f(t): - s1 = np.cos(2*np.pi*t) - e1 = np.exp(-t) - return s1 * e1 - -t1 = np.arange(0.0, 5.0, 0.1) -t2 = np.arange(0.0, 5.0, 0.02) -t3 = np.arange(0.0, 2.0, 0.01) - - -plt.subplot(121) -plt.plot(t1, f(t1), 'o', t2, f(t2), '-') -plt.title('subplot 1') -plt.ylabel('Damped oscillation') -plt.suptitle('This is a somewhat long figure title', fontsize=16) - - -plt.subplot(122) -plt.plot(t3, np.cos(2*np.pi*t3), '--') -plt.xlabel('time (s)') -plt.title('subplot 2') -plt.ylabel('Undamped') - -plt.subplots_adjust(left=0.2, wspace=0.8, top=0.8) - -plt.show() diff --git a/mpl_examples/pylab_examples/fill_between_demo.py b/mpl_examples/pylab_examples/fill_between_demo.py deleted file mode 100644 index b3653e456ce..00000000000 --- a/mpl_examples/pylab_examples/fill_between_demo.py +++ /dev/null @@ -1,57 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - -x = np.arange(0.0, 2, 0.01) -y1 = np.sin(2*np.pi*x) -y2 = 1.2*np.sin(4*np.pi*x) - -fig, (ax1, ax2, ax3) = plt.subplots(3, 1, sharex=True) - -ax1.fill_between(x, 0, y1) -ax1.set_ylabel('between y1 and 0') - -ax2.fill_between(x, y1, 1) -ax2.set_ylabel('between y1 and 1') - -ax3.fill_between(x, y1, y2) -ax3.set_ylabel('between y1 and y2') -ax3.set_xlabel('x') - -# now fill between y1 and y2 where a logical condition is met. Note -# this is different than calling -# fill_between(x[where], y1[where],y2[where] -# because of edge effects over multiple contiguous regions. -fig, (ax, ax1) = plt.subplots(2, 1, sharex=True) -ax.plot(x, y1, x, y2, color='black') -ax.fill_between(x, y1, y2, where=y2 >= y1, facecolor='green', interpolate=True) -ax.fill_between(x, y1, y2, where=y2 <= y1, facecolor='red', interpolate=True) -ax.set_title('fill between where') - -# Test support for masked arrays. -y2 = np.ma.masked_greater(y2, 1.0) -ax1.plot(x, y1, x, y2, color='black') -ax1.fill_between(x, y1, y2, where=y2 >= y1, facecolor='green', interpolate=True) -ax1.fill_between(x, y1, y2, where=y2 <= y1, facecolor='red', interpolate=True) -ax1.set_title('Now regions with y2>1 are masked') - -# This example illustrates a problem; because of the data -# gridding, there are undesired unfilled triangles at the crossover -# points. A brute-force solution would be to interpolate all -# arrays to a very fine grid before plotting. - -# show how to use transforms to create axes spans where a certain condition is satisfied -fig, ax = plt.subplots() -y = np.sin(4*np.pi*x) -ax.plot(x, y, color='black') - -# use the data coordinates for the x-axis and the axes coordinates for the y-axis -import matplotlib.transforms as mtransforms -trans = mtransforms.blended_transform_factory(ax.transData, ax.transAxes) -theta = 0.9 -ax.axhline(theta, color='green', lw=2, alpha=0.5) -ax.axhline(-theta, color='red', lw=2, alpha=0.5) -ax.fill_between(x, 0, 1, where=y > theta, facecolor='green', alpha=0.5, transform=trans) -ax.fill_between(x, 0, 1, where=y < -theta, facecolor='red', alpha=0.5, transform=trans) - - -plt.show() diff --git a/mpl_examples/pylab_examples/fill_between_demo_00.hires.png b/mpl_examples/pylab_examples/fill_between_demo_00.hires.png deleted file mode 100644 index 19f82cefa48..00000000000 Binary files a/mpl_examples/pylab_examples/fill_between_demo_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/fill_between_demo_00.pdf b/mpl_examples/pylab_examples/fill_between_demo_00.pdf deleted file mode 100644 index 3509c43cdc9..00000000000 Binary files a/mpl_examples/pylab_examples/fill_between_demo_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/fill_between_demo_00.png b/mpl_examples/pylab_examples/fill_between_demo_00.png deleted file mode 100644 index 4033b51f171..00000000000 Binary files a/mpl_examples/pylab_examples/fill_between_demo_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/fill_between_demo_01.hires.png b/mpl_examples/pylab_examples/fill_between_demo_01.hires.png deleted file mode 100644 index 21b91237ed8..00000000000 Binary files a/mpl_examples/pylab_examples/fill_between_demo_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/fill_between_demo_01.pdf b/mpl_examples/pylab_examples/fill_between_demo_01.pdf deleted file mode 100644 index 1718342f629..00000000000 Binary files a/mpl_examples/pylab_examples/fill_between_demo_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/fill_between_demo_01.png b/mpl_examples/pylab_examples/fill_between_demo_01.png deleted file mode 100644 index 2878b65f9c1..00000000000 Binary files a/mpl_examples/pylab_examples/fill_between_demo_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/fill_between_demo_02.hires.png b/mpl_examples/pylab_examples/fill_between_demo_02.hires.png deleted file mode 100644 index 02ba5ad7fad..00000000000 Binary files a/mpl_examples/pylab_examples/fill_between_demo_02.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/fill_between_demo_02.pdf b/mpl_examples/pylab_examples/fill_between_demo_02.pdf deleted file mode 100644 index e02aef36388..00000000000 Binary files a/mpl_examples/pylab_examples/fill_between_demo_02.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/fill_between_demo_02.png b/mpl_examples/pylab_examples/fill_between_demo_02.png deleted file mode 100644 index 139ccabace0..00000000000 Binary files a/mpl_examples/pylab_examples/fill_between_demo_02.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/fill_betweenx_demo.py b/mpl_examples/pylab_examples/fill_betweenx_demo.py deleted file mode 100644 index 098c0688523..00000000000 --- a/mpl_examples/pylab_examples/fill_betweenx_demo.py +++ /dev/null @@ -1,52 +0,0 @@ -""" -Copy of fill_between.py but using fill_betweenx() instead. -""" -import matplotlib.mlab as mlab -from matplotlib.pyplot import figure, show -import numpy as np - - -x = np.arange(0.0, 2, 0.01) -y1 = np.sin(2*np.pi*x) -y2 = 1.2*np.sin(4*np.pi*x) - -fig = figure() -ax1 = fig.add_subplot(311) -ax2 = fig.add_subplot(312, sharex=ax1) -ax3 = fig.add_subplot(313, sharex=ax1) - -ax1.fill_betweenx(x, 0, y1) -ax1.set_ylabel('(y1, 0)') - -ax2.fill_betweenx(x, y1, 1) -ax2.set_ylabel('(y1, 1)') - -ax3.fill_betweenx(x, y1, y2) -ax3.set_ylabel('(y1, y2)') -ax3.set_xlabel('x') - -# now fill between y1 and y2 where a logical condition is met. Note -# this is different than calling -# fill_between(x[where], y1[where],y2[where] -# because of edge effects over multiple contiguous regions. -fig = figure() -ax = fig.add_subplot(211) -ax.plot(y1, x, y2, x, color='black') -ax.fill_betweenx(x, y1, y2, where=y2 >= y1, facecolor='green') -ax.fill_betweenx(x, y1, y2, where=y2 <= y1, facecolor='red') -ax.set_title('fill between where') - -# Test support for masked arrays. -y2 = np.ma.masked_greater(y2, 1.0) -ax1 = fig.add_subplot(212, sharex=ax) -ax1.plot(y1, x, y2, x, color='black') -ax1.fill_betweenx(x, y1, y2, where=y2 >= y1, facecolor='green') -ax1.fill_betweenx(x, y1, y2, where=y2 <= y1, facecolor='red') -ax1.set_title('Now regions with y2 > 1 are masked') - -# This example illustrates a problem; because of the data -# gridding, there are undesired unfilled triangles at the crossover -# points. A brute-force solution would be to interpolate all -# arrays to a very fine grid before plotting. - -show() diff --git a/mpl_examples/pylab_examples/fill_betweenx_demo_00.hires.png b/mpl_examples/pylab_examples/fill_betweenx_demo_00.hires.png deleted file mode 100644 index cef3cb2bd08..00000000000 Binary files a/mpl_examples/pylab_examples/fill_betweenx_demo_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/fill_betweenx_demo_00.pdf b/mpl_examples/pylab_examples/fill_betweenx_demo_00.pdf deleted file mode 100644 index b27bb128812..00000000000 Binary files a/mpl_examples/pylab_examples/fill_betweenx_demo_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/fill_betweenx_demo_00.png b/mpl_examples/pylab_examples/fill_betweenx_demo_00.png deleted file mode 100644 index 4e520c19614..00000000000 Binary files a/mpl_examples/pylab_examples/fill_betweenx_demo_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/fill_betweenx_demo_01.hires.png b/mpl_examples/pylab_examples/fill_betweenx_demo_01.hires.png deleted file mode 100644 index 0618ca00751..00000000000 Binary files a/mpl_examples/pylab_examples/fill_betweenx_demo_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/fill_betweenx_demo_01.pdf b/mpl_examples/pylab_examples/fill_betweenx_demo_01.pdf deleted file mode 100644 index fed40351613..00000000000 Binary files a/mpl_examples/pylab_examples/fill_betweenx_demo_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/fill_betweenx_demo_01.png b/mpl_examples/pylab_examples/fill_betweenx_demo_01.png deleted file mode 100644 index 44e3ac163f0..00000000000 Binary files a/mpl_examples/pylab_examples/fill_betweenx_demo_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/fill_spiral.hires.png b/mpl_examples/pylab_examples/fill_spiral.hires.png deleted file mode 100644 index 24e5280fc31..00000000000 Binary files a/mpl_examples/pylab_examples/fill_spiral.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/fill_spiral.pdf b/mpl_examples/pylab_examples/fill_spiral.pdf deleted file mode 100644 index 14b2c025f48..00000000000 Binary files a/mpl_examples/pylab_examples/fill_spiral.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/fill_spiral.png b/mpl_examples/pylab_examples/fill_spiral.png deleted file mode 100644 index 1b6025297cb..00000000000 Binary files a/mpl_examples/pylab_examples/fill_spiral.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/fill_spiral.py b/mpl_examples/pylab_examples/fill_spiral.py deleted file mode 100644 index 9dd2e4c07f8..00000000000 --- a/mpl_examples/pylab_examples/fill_spiral.py +++ /dev/null @@ -1,23 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - -theta = np.arange(0, 8*np.pi, 0.1) -a = 1 -b = .2 - -for dt in np.arange(0, 2*np.pi, np.pi/2.0): - - x = a*np.cos(theta + dt)*np.exp(b*theta) - y = a*np.sin(theta + dt)*np.exp(b*theta) - - dt = dt + np.pi/4.0 - - x2 = a*np.cos(theta + dt)*np.exp(b*theta) - y2 = a*np.sin(theta + dt)*np.exp(b*theta) - - xf = np.concatenate((x, x2[::-1])) - yf = np.concatenate((y, y2[::-1])) - - p1 = plt.fill(xf, yf) - -plt.show() diff --git a/mpl_examples/pylab_examples/finance_demo.hires.png b/mpl_examples/pylab_examples/finance_demo.hires.png deleted file mode 100644 index bb3bf12ad39..00000000000 Binary files a/mpl_examples/pylab_examples/finance_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/finance_demo.pdf b/mpl_examples/pylab_examples/finance_demo.pdf deleted file mode 100644 index 8c4f95fbba5..00000000000 Binary files a/mpl_examples/pylab_examples/finance_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/finance_demo.png b/mpl_examples/pylab_examples/finance_demo.png deleted file mode 100644 index 8446aa7cbab..00000000000 Binary files a/mpl_examples/pylab_examples/finance_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/finance_demo.py b/mpl_examples/pylab_examples/finance_demo.py deleted file mode 100644 index c1cc76870fb..00000000000 --- a/mpl_examples/pylab_examples/finance_demo.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env python -import matplotlib.pyplot as plt -from matplotlib.dates import DateFormatter, WeekdayLocator,\ - DayLocator, MONDAY -from matplotlib.finance import quotes_historical_yahoo_ohlc, candlestick_ohlc - - -# (Year, month, day) tuples suffice as args for quotes_historical_yahoo -date1 = (2004, 2, 1) -date2 = (2004, 4, 12) - - -mondays = WeekdayLocator(MONDAY) # major ticks on the mondays -alldays = DayLocator() # minor ticks on the days -weekFormatter = DateFormatter('%b %d') # e.g., Jan 12 -dayFormatter = DateFormatter('%d') # e.g., 12 - -quotes = quotes_historical_yahoo_ohlc('INTC', date1, date2) -if len(quotes) == 0: - raise SystemExit - -fig, ax = plt.subplots() -fig.subplots_adjust(bottom=0.2) -ax.xaxis.set_major_locator(mondays) -ax.xaxis.set_minor_locator(alldays) -ax.xaxis.set_major_formatter(weekFormatter) -#ax.xaxis.set_minor_formatter(dayFormatter) - -#plot_day_summary(ax, quotes, ticksize=3) -candlestick_ohlc(ax, quotes, width=0.6) - -ax.xaxis_date() -ax.autoscale_view() -plt.setp(plt.gca().get_xticklabels(), rotation=45, horizontalalignment='right') - -plt.show() diff --git a/mpl_examples/pylab_examples/finance_work2.hires.png b/mpl_examples/pylab_examples/finance_work2.hires.png deleted file mode 100644 index 3097f20f4cc..00000000000 Binary files a/mpl_examples/pylab_examples/finance_work2.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/finance_work2.pdf b/mpl_examples/pylab_examples/finance_work2.pdf deleted file mode 100644 index 015b173f706..00000000000 Binary files a/mpl_examples/pylab_examples/finance_work2.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/finance_work2.png b/mpl_examples/pylab_examples/finance_work2.png deleted file mode 100644 index e62d419e1a7..00000000000 Binary files a/mpl_examples/pylab_examples/finance_work2.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/finance_work2.py b/mpl_examples/pylab_examples/finance_work2.py deleted file mode 100644 index 1ed78c5651c..00000000000 --- a/mpl_examples/pylab_examples/finance_work2.py +++ /dev/null @@ -1,207 +0,0 @@ -import datetime -import numpy as np -import matplotlib.colors as colors -import matplotlib.finance as finance -import matplotlib.dates as mdates -import matplotlib.ticker as mticker -import matplotlib.mlab as mlab -import matplotlib.pyplot as plt -import matplotlib.font_manager as font_manager - - -startdate = datetime.date(2006, 1, 1) -today = enddate = datetime.date.today() -ticker = 'SPY' - - -fh = finance.fetch_historical_yahoo(ticker, startdate, enddate) -# a numpy record array with fields: date, open, high, low, close, volume, adj_close) - -r = mlab.csv2rec(fh) -fh.close() -r.sort() - - -def moving_average(x, n, type='simple'): - """ - compute an n period moving average. - - type is 'simple' | 'exponential' - - """ - x = np.asarray(x) - if type == 'simple': - weights = np.ones(n) - else: - weights = np.exp(np.linspace(-1., 0., n)) - - weights /= weights.sum() - - a = np.convolve(x, weights, mode='full')[:len(x)] - a[:n] = a[n] - return a - - -def relative_strength(prices, n=14): - """ - compute the n period relative strength indicator - http://stockcharts.com/school/doku.php?id=chart_school:glossary_r#relativestrengthindex - http://www.investopedia.com/terms/r/rsi.asp - """ - - deltas = np.diff(prices) - seed = deltas[:n+1] - up = seed[seed >= 0].sum()/n - down = -seed[seed < 0].sum()/n - rs = up/down - rsi = np.zeros_like(prices) - rsi[:n] = 100. - 100./(1. + rs) - - for i in range(n, len(prices)): - delta = deltas[i - 1] # cause the diff is 1 shorter - - if delta > 0: - upval = delta - downval = 0. - else: - upval = 0. - downval = -delta - - up = (up*(n - 1) + upval)/n - down = (down*(n - 1) + downval)/n - - rs = up/down - rsi[i] = 100. - 100./(1. + rs) - - return rsi - - -def moving_average_convergence(x, nslow=26, nfast=12): - """ - compute the MACD (Moving Average Convergence/Divergence) using a fast and slow exponential moving avg' - return value is emaslow, emafast, macd which are len(x) arrays - """ - emaslow = moving_average(x, nslow, type='exponential') - emafast = moving_average(x, nfast, type='exponential') - return emaslow, emafast, emafast - emaslow - - -plt.rc('axes', grid=True) -plt.rc('grid', color='0.75', linestyle='-', linewidth=0.5) - -textsize = 9 -left, width = 0.1, 0.8 -rect1 = [left, 0.7, width, 0.2] -rect2 = [left, 0.3, width, 0.4] -rect3 = [left, 0.1, width, 0.2] - - -fig = plt.figure(facecolor='white') -axescolor = '#f6f6f6' # the axes background color - -ax1 = fig.add_axes(rect1, axisbg=axescolor) # left, bottom, width, height -ax2 = fig.add_axes(rect2, axisbg=axescolor, sharex=ax1) -ax2t = ax2.twinx() -ax3 = fig.add_axes(rect3, axisbg=axescolor, sharex=ax1) - - -# plot the relative strength indicator -prices = r.adj_close -rsi = relative_strength(prices) -fillcolor = 'darkgoldenrod' - -ax1.plot(r.date, rsi, color=fillcolor) -ax1.axhline(70, color=fillcolor) -ax1.axhline(30, color=fillcolor) -ax1.fill_between(r.date, rsi, 70, where=(rsi >= 70), facecolor=fillcolor, edgecolor=fillcolor) -ax1.fill_between(r.date, rsi, 30, where=(rsi <= 30), facecolor=fillcolor, edgecolor=fillcolor) -ax1.text(0.6, 0.9, '>70 = overbought', va='top', transform=ax1.transAxes, fontsize=textsize) -ax1.text(0.6, 0.1, '<30 = oversold', transform=ax1.transAxes, fontsize=textsize) -ax1.set_ylim(0, 100) -ax1.set_yticks([30, 70]) -ax1.text(0.025, 0.95, 'RSI (14)', va='top', transform=ax1.transAxes, fontsize=textsize) -ax1.set_title('%s daily' % ticker) - -# plot the price and volume data -dx = r.adj_close - r.close -low = r.low + dx -high = r.high + dx - -deltas = np.zeros_like(prices) -deltas[1:] = np.diff(prices) -up = deltas > 0 -ax2.vlines(r.date[up], low[up], high[up], color='black', label='_nolegend_') -ax2.vlines(r.date[~up], low[~up], high[~up], color='black', label='_nolegend_') -ma20 = moving_average(prices, 20, type='simple') -ma200 = moving_average(prices, 200, type='simple') - -linema20, = ax2.plot(r.date, ma20, color='blue', lw=2, label='MA (20)') -linema200, = ax2.plot(r.date, ma200, color='red', lw=2, label='MA (200)') - - -last = r[-1] -s = '%s O:%1.2f H:%1.2f L:%1.2f C:%1.2f, V:%1.1fM Chg:%+1.2f' % ( - today.strftime('%d-%b-%Y'), - last.open, last.high, - last.low, last.close, - last.volume*1e-6, - last.close - last.open) -t4 = ax2.text(0.3, 0.9, s, transform=ax2.transAxes, fontsize=textsize) - -props = font_manager.FontProperties(size=10) -leg = ax2.legend(loc='center left', shadow=True, fancybox=True, prop=props) -leg.get_frame().set_alpha(0.5) - - -volume = (r.close*r.volume)/1e6 # dollar volume in millions -vmax = volume.max() -poly = ax2t.fill_between(r.date, volume, 0, label='Volume', facecolor=fillcolor, edgecolor=fillcolor) -ax2t.set_ylim(0, 5*vmax) -ax2t.set_yticks([]) - - -# compute the MACD indicator -fillcolor = 'darkslategrey' -nslow = 26 -nfast = 12 -nema = 9 -emaslow, emafast, macd = moving_average_convergence(prices, nslow=nslow, nfast=nfast) -ema9 = moving_average(macd, nema, type='exponential') -ax3.plot(r.date, macd, color='black', lw=2) -ax3.plot(r.date, ema9, color='blue', lw=1) -ax3.fill_between(r.date, macd - ema9, 0, alpha=0.5, facecolor=fillcolor, edgecolor=fillcolor) - - -ax3.text(0.025, 0.95, 'MACD (%d, %d, %d)' % (nfast, nslow, nema), va='top', - transform=ax3.transAxes, fontsize=textsize) - -#ax3.set_yticks([]) -# turn off upper axis tick labels, rotate the lower ones, etc -for ax in ax1, ax2, ax2t, ax3: - if ax != ax3: - for label in ax.get_xticklabels(): - label.set_visible(False) - else: - for label in ax.get_xticklabels(): - label.set_rotation(30) - label.set_horizontalalignment('right') - - ax.fmt_xdata = mdates.DateFormatter('%Y-%m-%d') - - -class MyLocator(mticker.MaxNLocator): - def __init__(self, *args, **kwargs): - mticker.MaxNLocator.__init__(self, *args, **kwargs) - - def __call__(self, *args, **kwargs): - return mticker.MaxNLocator.__call__(self, *args, **kwargs) - -# at most 5 ticks, pruning the upper and lower so they don't overlap -# with other ticks -#ax2.yaxis.set_major_locator(mticker.MaxNLocator(5, prune='both')) -#ax3.yaxis.set_major_locator(mticker.MaxNLocator(5, prune='both')) - -ax2.yaxis.set_major_locator(MyLocator(5, prune='both')) -ax3.yaxis.set_major_locator(MyLocator(5, prune='both')) - -plt.show() diff --git a/mpl_examples/pylab_examples/findobj_demo.hires.png b/mpl_examples/pylab_examples/findobj_demo.hires.png deleted file mode 100644 index b787dfc417b..00000000000 Binary files a/mpl_examples/pylab_examples/findobj_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/findobj_demo.pdf b/mpl_examples/pylab_examples/findobj_demo.pdf deleted file mode 100644 index 14e6a952519..00000000000 Binary files a/mpl_examples/pylab_examples/findobj_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/findobj_demo.png b/mpl_examples/pylab_examples/findobj_demo.png deleted file mode 100644 index cf57e80e311..00000000000 Binary files a/mpl_examples/pylab_examples/findobj_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/findobj_demo.py b/mpl_examples/pylab_examples/findobj_demo.py deleted file mode 100644 index 17bd6dd83b7..00000000000 --- a/mpl_examples/pylab_examples/findobj_demo.py +++ /dev/null @@ -1,36 +0,0 @@ -""" -Recursively find all objects that match some criteria -""" -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.text as text - -a = np.arange(0, 3, .02) -b = np.arange(0, 3, .02) -c = np.exp(a) -d = c[::-1] - -fig, ax = plt.subplots() -plt.plot(a, c, 'k--', a, d, 'k:', a, c + d, 'k') -plt.legend(('Model length', 'Data length', 'Total message length'), - loc='upper center', shadow=True) -plt.ylim([-1, 20]) -plt.grid(False) -plt.xlabel('Model complexity --->') -plt.ylabel('Message length --->') -plt.title('Minimum Message Length') - - -# match on arbitrary function -def myfunc(x): - return hasattr(x, 'set_color') and not hasattr(x, 'set_facecolor') - -for o in fig.findobj(myfunc): - o.set_color('blue') - -# match on class instances -for o in fig.findobj(text.Text): - o.set_fontstyle('italic') - - -plt.show() diff --git a/mpl_examples/pylab_examples/fonts_demo.hires.png b/mpl_examples/pylab_examples/fonts_demo.hires.png deleted file mode 100644 index d528fa1734e..00000000000 Binary files a/mpl_examples/pylab_examples/fonts_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/fonts_demo.pdf b/mpl_examples/pylab_examples/fonts_demo.pdf deleted file mode 100644 index dd2dcc9c1e5..00000000000 Binary files a/mpl_examples/pylab_examples/fonts_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/fonts_demo.png b/mpl_examples/pylab_examples/fonts_demo.png deleted file mode 100644 index 9eadd3dd455..00000000000 Binary files a/mpl_examples/pylab_examples/fonts_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/fonts_demo.py b/mpl_examples/pylab_examples/fonts_demo.py deleted file mode 100644 index 5fbd40e8644..00000000000 --- a/mpl_examples/pylab_examples/fonts_demo.py +++ /dev/null @@ -1,112 +0,0 @@ -""" -Show how to set custom font properties. - -For interactive users, you can also use kwargs to the text command, -which requires less typing. See examples/fonts_demo_kw.py -""" -from matplotlib.font_manager import FontProperties -import matplotlib.pyplot as plt - -plt.subplot(111, facecolor='w') - -font0 = FontProperties() -alignment = {'horizontalalignment': 'center', 'verticalalignment': 'baseline'} -# Show family options - -families = ['serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'] - -font1 = font0.copy() -font1.set_size('large') - -t = plt.text(-0.8, 0.9, 'family', fontproperties=font1, - **alignment) - -yp = [0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2] - -for k, family in enumerate(families): - font = font0.copy() - font.set_family(family) - t = plt.text(-0.8, yp[k], family, fontproperties=font, - **alignment) - -# Show style options - -styles = ['normal', 'italic', 'oblique'] - -t = plt.text(-0.4, 0.9, 'style', fontproperties=font1, - **alignment) - -for k, style in enumerate(styles): - font = font0.copy() - font.set_family('sans-serif') - font.set_style(style) - t = plt.text(-0.4, yp[k], style, fontproperties=font, - **alignment) - -# Show variant options - -variants = ['normal', 'small-caps'] - -t = plt.text(0.0, 0.9, 'variant', fontproperties=font1, - **alignment) - -for k, variant in enumerate(variants): - font = font0.copy() - font.set_family('serif') - font.set_variant(variant) - t = plt.text(0.0, yp[k], variant, fontproperties=font, - **alignment) - -# Show weight options - -weights = ['light', 'normal', 'medium', 'semibold', 'bold', 'heavy', 'black'] - -t = plt.text(0.4, 0.9, 'weight', fontproperties=font1, - **alignment) - -for k, weight in enumerate(weights): - font = font0.copy() - font.set_weight(weight) - t = plt.text(0.4, yp[k], weight, fontproperties=font, - **alignment) - -# Show size options - -sizes = ['xx-small', 'x-small', 'small', 'medium', 'large', - 'x-large', 'xx-large'] - -t = plt.text(0.8, 0.9, 'size', fontproperties=font1, - **alignment) - -for k, size in enumerate(sizes): - font = font0.copy() - font.set_size(size) - t = plt.text(0.8, yp[k], size, fontproperties=font, - **alignment) - -# Show bold italic - -font = font0.copy() -font.set_style('italic') -font.set_weight('bold') -font.set_size('x-small') -t = plt.text(-0.4, 0.1, 'bold italic', fontproperties=font, - **alignment) - -font = font0.copy() -font.set_style('italic') -font.set_weight('bold') -font.set_size('medium') -t = plt.text(-0.4, 0.2, 'bold italic', fontproperties=font, - **alignment) - -font = font0.copy() -font.set_style('italic') -font.set_weight('bold') -font.set_size('x-large') -t = plt.text(-0.4, 0.3, 'bold italic', fontproperties=font, - **alignment) - -plt.axis([-1, 1, 0, 1]) - -plt.show() diff --git a/mpl_examples/pylab_examples/fonts_demo_kw.hires.png b/mpl_examples/pylab_examples/fonts_demo_kw.hires.png deleted file mode 100644 index 0c98feab50e..00000000000 Binary files a/mpl_examples/pylab_examples/fonts_demo_kw.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/fonts_demo_kw.pdf b/mpl_examples/pylab_examples/fonts_demo_kw.pdf deleted file mode 100644 index e8e2157e7a5..00000000000 Binary files a/mpl_examples/pylab_examples/fonts_demo_kw.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/fonts_demo_kw.png b/mpl_examples/pylab_examples/fonts_demo_kw.png deleted file mode 100644 index 45129e1aad0..00000000000 Binary files a/mpl_examples/pylab_examples/fonts_demo_kw.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/fonts_demo_kw.py b/mpl_examples/pylab_examples/fonts_demo_kw.py deleted file mode 100644 index 0beefd74a55..00000000000 --- a/mpl_examples/pylab_examples/fonts_demo_kw.py +++ /dev/null @@ -1,81 +0,0 @@ -""" -Same as fonts_demo using kwargs. If you prefer a more pythonic, OO -style of coding, see examples/fonts_demo.py. - -""" -from matplotlib.font_manager import FontProperties -import matplotlib.pyplot as plt -import numpy as np - -plt.subplot(111, facecolor='w') -alignment = {'horizontalalignment': 'center', 'verticalalignment': 'baseline'} - -# Show family options - -families = ['serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'] - -t = plt.text(-0.8, 0.9, 'family', size='large', **alignment) - -yp = [0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2] - -for k, family in enumerate(families): - t = plt.text(-0.8, yp[k], family, family=family, **alignment) - -# Show style options - -styles = ['normal', 'italic', 'oblique'] - -t = plt.text(-0.4, 0.9, 'style', **alignment) - -for k, style in enumerate(styles): - t = plt.text(-0.4, yp[k], style, family='sans-serif', style=style, - **alignment) - -# Show variant options - -variants = ['normal', 'small-caps'] - -t = plt.text(0.0, 0.9, 'variant', **alignment) - -for k, variant in enumerate(variants): - t = plt.text(0.0, yp[k], variant, family='serif', variant=variant, - **alignment) - -# Show weight options - -weights = ['light', 'normal', 'medium', 'semibold', 'bold', 'heavy', 'black'] - -t = plt.text(0.4, 0.9, 'weight', **alignment) - -for k, weight in enumerate(weights): - t = plt.text(0.4, yp[k], weight, weight=weight, - **alignment) - -# Show size options - -sizes = ['xx-small', 'x-small', 'small', 'medium', 'large', - 'x-large', 'xx-large'] - -t = plt.text(0.8, 0.9, 'size', **alignment) - -for k, size in enumerate(sizes): - t = plt.text(0.8, yp[k], size, size=size, - **alignment) - -x = -0.4 -# Show bold italic -t = plt.text(x, 0.1, 'bold italic', style='italic', - weight='bold', size='x-small', - **alignment) - -t = plt.text(x, 0.2, 'bold italic', - style='italic', weight='bold', size='medium', - **alignment) - -t = plt.text(x, 0.3, 'bold italic', - style='italic', weight='bold', size='x-large', - **alignment) - -plt.axis([-1, 1, 0, 1]) - -plt.show() diff --git a/mpl_examples/pylab_examples/ganged_plots.hires.png b/mpl_examples/pylab_examples/ganged_plots.hires.png deleted file mode 100644 index be5d689ff2d..00000000000 Binary files a/mpl_examples/pylab_examples/ganged_plots.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/ganged_plots.pdf b/mpl_examples/pylab_examples/ganged_plots.pdf deleted file mode 100644 index 7eb7c6da756..00000000000 Binary files a/mpl_examples/pylab_examples/ganged_plots.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/ganged_plots.png b/mpl_examples/pylab_examples/ganged_plots.png deleted file mode 100644 index 1d62e6eca78..00000000000 Binary files a/mpl_examples/pylab_examples/ganged_plots.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/ganged_plots.py b/mpl_examples/pylab_examples/ganged_plots.py deleted file mode 100644 index 9d14a522c54..00000000000 --- a/mpl_examples/pylab_examples/ganged_plots.py +++ /dev/null @@ -1,45 +0,0 @@ -""" -To create plots that share a common axes (visually) you can set the -hspace between the subplots close to zero (do not use zero itself). -Normally you'll want to turn off the tick labels on all but one of the -axes. - -In this example the plots share a common xaxis but you can follow the -same logic to supply a common y axis. -""" -import matplotlib.pyplot as plt -import numpy as np - -t = np.arange(0.0, 2.0, 0.01) - -s1 = np.sin(2*np.pi*t) -s2 = np.exp(-t) -s3 = s1*s2 - -# axes rect in relative 0,1 coords left, bottom, width, height. Turn -# off xtick labels on all but the lower plot - - -f = plt.figure() -plt.subplots_adjust(hspace=0.001) - - -ax1 = plt.subplot(311) -ax1.plot(t, s1) -plt.yticks(np.arange(-0.9, 1.0, 0.4)) -plt.ylim(-1, 1) - -ax2 = plt.subplot(312, sharex=ax1) -ax2.plot(t, s2) -plt.yticks(np.arange(0.1, 1.0, 0.2)) -plt.ylim(0, 1) - -ax3 = plt.subplot(313, sharex=ax1) -ax3.plot(t, s3) -plt.yticks(np.arange(-0.9, 1.0, 0.4)) -plt.ylim(-1, 1) - -xticklabels = ax1.get_xticklabels() + ax2.get_xticklabels() -plt.setp(xticklabels, visible=False) - -plt.show() diff --git a/mpl_examples/pylab_examples/geo_demo.hires.png b/mpl_examples/pylab_examples/geo_demo.hires.png deleted file mode 100644 index 2862b30e85c..00000000000 Binary files a/mpl_examples/pylab_examples/geo_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/geo_demo.pdf b/mpl_examples/pylab_examples/geo_demo.pdf deleted file mode 100644 index ded62ab013f..00000000000 Binary files a/mpl_examples/pylab_examples/geo_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/geo_demo.png b/mpl_examples/pylab_examples/geo_demo.png deleted file mode 100644 index 35d7a274d03..00000000000 Binary files a/mpl_examples/pylab_examples/geo_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/geo_demo.py b/mpl_examples/pylab_examples/geo_demo.py deleted file mode 100644 index 9ef96b2b564..00000000000 --- a/mpl_examples/pylab_examples/geo_demo.py +++ /dev/null @@ -1,23 +0,0 @@ -import matplotlib.pyplot as plt - -plt.figure() -plt.subplot(111, projection="aitoff") -plt.title("Aitoff") -plt.grid(True) - -plt.figure() -plt.subplot(111, projection="hammer") -plt.title("Hammer") -plt.grid(True) - -plt.figure() -plt.subplot(111, projection="lambert") -plt.title("Lambert") -plt.grid(True) - -plt.figure() -plt.subplot(111, projection="mollweide") -plt.title("Mollweide") -plt.grid(True) - -plt.show() diff --git a/mpl_examples/pylab_examples/geo_demo_00.pdf b/mpl_examples/pylab_examples/geo_demo_00.pdf deleted file mode 100644 index 391a989bffe..00000000000 Binary files a/mpl_examples/pylab_examples/geo_demo_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/geo_demo_00.png b/mpl_examples/pylab_examples/geo_demo_00.png deleted file mode 100644 index 6eb2d293d4d..00000000000 Binary files a/mpl_examples/pylab_examples/geo_demo_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/geo_demo_01.pdf b/mpl_examples/pylab_examples/geo_demo_01.pdf deleted file mode 100644 index d302c6b73bb..00000000000 Binary files a/mpl_examples/pylab_examples/geo_demo_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/geo_demo_01.png b/mpl_examples/pylab_examples/geo_demo_01.png deleted file mode 100644 index 71a5d626484..00000000000 Binary files a/mpl_examples/pylab_examples/geo_demo_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/geo_demo_02.pdf b/mpl_examples/pylab_examples/geo_demo_02.pdf deleted file mode 100644 index 0fa299de6f7..00000000000 Binary files a/mpl_examples/pylab_examples/geo_demo_02.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/geo_demo_02.png b/mpl_examples/pylab_examples/geo_demo_02.png deleted file mode 100644 index 1d0e6520769..00000000000 Binary files a/mpl_examples/pylab_examples/geo_demo_02.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/geo_demo_03.pdf b/mpl_examples/pylab_examples/geo_demo_03.pdf deleted file mode 100644 index 77f8d0830be..00000000000 Binary files a/mpl_examples/pylab_examples/geo_demo_03.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/geo_demo_03.png b/mpl_examples/pylab_examples/geo_demo_03.png deleted file mode 100644 index 74e198df1c9..00000000000 Binary files a/mpl_examples/pylab_examples/geo_demo_03.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/gradient_bar.hires.png b/mpl_examples/pylab_examples/gradient_bar.hires.png deleted file mode 100644 index 422820084b5..00000000000 Binary files a/mpl_examples/pylab_examples/gradient_bar.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/gradient_bar.pdf b/mpl_examples/pylab_examples/gradient_bar.pdf deleted file mode 100644 index d9111a4d661..00000000000 Binary files a/mpl_examples/pylab_examples/gradient_bar.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/gradient_bar.png b/mpl_examples/pylab_examples/gradient_bar.png deleted file mode 100644 index 5d3af52e53e..00000000000 Binary files a/mpl_examples/pylab_examples/gradient_bar.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/gradient_bar.py b/mpl_examples/pylab_examples/gradient_bar.py deleted file mode 100644 index 714f45f5ac9..00000000000 --- a/mpl_examples/pylab_examples/gradient_bar.py +++ /dev/null @@ -1,29 +0,0 @@ -from matplotlib.pyplot import figure, show, cm -from numpy import arange -from numpy.random import rand - - -def gbar(ax, x, y, width=0.5, bottom=0): - X = [[.6, .6], [.7, .7]] - for left, top in zip(x, y): - right = left + width - ax.imshow(X, interpolation='bicubic', cmap=cm.Blues, - extent=(left, right, bottom, top), alpha=1) - -fig = figure() - -xmin, xmax = xlim = 0, 10 -ymin, ymax = ylim = 0, 1 -ax = fig.add_subplot(111, xlim=xlim, ylim=ylim, - autoscale_on=False) -X = [[.6, .6], [.7, .7]] - -ax.imshow(X, interpolation='bicubic', cmap=cm.copper, - extent=(xmin, xmax, ymin, ymax), alpha=1) - -N = 10 -x = arange(N) + 0.25 -y = rand(N) -gbar(ax, x, y, width=0.7) -ax.set_aspect('auto') -show() diff --git a/mpl_examples/pylab_examples/griddata_demo.hires.png b/mpl_examples/pylab_examples/griddata_demo.hires.png deleted file mode 100644 index d2da085d2cf..00000000000 Binary files a/mpl_examples/pylab_examples/griddata_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/griddata_demo.pdf b/mpl_examples/pylab_examples/griddata_demo.pdf deleted file mode 100644 index c85c1b1b568..00000000000 Binary files a/mpl_examples/pylab_examples/griddata_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/griddata_demo.png b/mpl_examples/pylab_examples/griddata_demo.png deleted file mode 100644 index 3c9213addf3..00000000000 Binary files a/mpl_examples/pylab_examples/griddata_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/griddata_demo.py b/mpl_examples/pylab_examples/griddata_demo.py deleted file mode 100644 index 74af8424fb8..00000000000 --- a/mpl_examples/pylab_examples/griddata_demo.py +++ /dev/null @@ -1,27 +0,0 @@ -from numpy.random import uniform, seed -from matplotlib.mlab import griddata -import matplotlib.pyplot as plt -import numpy as np -# make up data. -#npts = int(raw_input('enter # of random points to plot:')) -seed(0) -npts = 200 -x = uniform(-2, 2, npts) -y = uniform(-2, 2, npts) -z = x*np.exp(-x**2 - y**2) -# define grid. -xi = np.linspace(-2.1, 2.1, 100) -yi = np.linspace(-2.1, 2.1, 200) -# grid the data. -zi = griddata(x, y, z, xi, yi, interp='linear') -# contour the gridded data, plotting dots at the nonuniform data points. -CS = plt.contour(xi, yi, zi, 15, linewidths=0.5, colors='k') -CS = plt.contourf(xi, yi, zi, 15, - vmax=abs(zi).max(), vmin=-abs(zi).max()) -plt.colorbar() # draw colorbar -# plot data points. -plt.scatter(x, y, marker='o', s=5, zorder=10) -plt.xlim(-2, 2) -plt.ylim(-2, 2) -plt.title('griddata test (%d points)' % npts) -plt.show() diff --git a/mpl_examples/pylab_examples/hatch_demo.hires.png b/mpl_examples/pylab_examples/hatch_demo.hires.png deleted file mode 100644 index 9223e594fb7..00000000000 Binary files a/mpl_examples/pylab_examples/hatch_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/hatch_demo.pdf b/mpl_examples/pylab_examples/hatch_demo.pdf deleted file mode 100644 index 659b08d00f7..00000000000 Binary files a/mpl_examples/pylab_examples/hatch_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/hatch_demo.png b/mpl_examples/pylab_examples/hatch_demo.png deleted file mode 100644 index 7afcc6cf194..00000000000 Binary files a/mpl_examples/pylab_examples/hatch_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/hatch_demo.py b/mpl_examples/pylab_examples/hatch_demo.py deleted file mode 100644 index 0488e3fb200..00000000000 --- a/mpl_examples/pylab_examples/hatch_demo.py +++ /dev/null @@ -1,31 +0,0 @@ -""" -Hatching (pattern filled polygons) is supported currently in the PS, -PDF, SVG and Agg backends only. -""" -import matplotlib.pyplot as plt -from matplotlib.patches import Ellipse, Polygon - -fig = plt.figure() -ax1 = fig.add_subplot(131) -ax1.bar(range(1, 5), range(1, 5), color='red', edgecolor='black', hatch="/") -ax1.bar(range(1, 5), [6] * 4, bottom=range(1, 5), color='blue', edgecolor='black', hatch='//') -ax1.set_xticks([1.5, 2.5, 3.5, 4.5]) - -ax2 = fig.add_subplot(132) -bars = ax2.bar(range(1, 5), range(1, 5), color='yellow', ecolor='black') + \ - ax2.bar(range(1, 5), [6] * 4, bottom=range(1, 5), color='green', ecolor='black') -ax2.set_xticks([1.5, 2.5, 3.5, 4.5]) - -patterns = ('-', '+', 'x', '\\', '*', 'o', 'O', '.') -for bar, pattern in zip(bars, patterns): - bar.set_hatch(pattern) - -ax3 = fig.add_subplot(133) -ax3.fill([1, 3, 3, 1], [1, 1, 2, 2], fill=False, hatch='\\') -ax3.add_patch(Ellipse((4, 1.5), 4, 0.5, fill=False, hatch='*')) -ax3.add_patch(Polygon([[0, 0], [4, 1.1], [6, 2.5], [2, 1.4]], closed=True, - fill=False, hatch='/')) -ax3.set_xlim((0, 6)) -ax3.set_ylim((0, 2.5)) - -plt.show() diff --git a/mpl_examples/pylab_examples/hexbin_demo.hires.png b/mpl_examples/pylab_examples/hexbin_demo.hires.png deleted file mode 100644 index fb1ba3c98fd..00000000000 Binary files a/mpl_examples/pylab_examples/hexbin_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/hexbin_demo.pdf b/mpl_examples/pylab_examples/hexbin_demo.pdf deleted file mode 100644 index ca0440ca7b8..00000000000 Binary files a/mpl_examples/pylab_examples/hexbin_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/hexbin_demo.png b/mpl_examples/pylab_examples/hexbin_demo.png deleted file mode 100644 index 955a92826c7..00000000000 Binary files a/mpl_examples/pylab_examples/hexbin_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/hexbin_demo.py b/mpl_examples/pylab_examples/hexbin_demo.py deleted file mode 100644 index 0d8bc7a3130..00000000000 --- a/mpl_examples/pylab_examples/hexbin_demo.py +++ /dev/null @@ -1,36 +0,0 @@ -""" -hexbin is an axes method or pyplot function that is essentially -a pcolor of a 2-D histogram with hexagonal cells. It can be -much more informative than a scatter plot; in the first subplot -below, try substituting 'scatter' for 'hexbin'. -""" - -import numpy as np -import matplotlib.pyplot as plt - -np.random.seed(0) -n = 100000 -x = np.random.standard_normal(n) -y = 2.0 + 3.0 * x + 4.0 * np.random.standard_normal(n) -xmin = x.min() -xmax = x.max() -ymin = y.min() -ymax = y.max() - -fig, axs = plt.subplots(ncols=2, sharey=True, figsize=(7, 4)) -fig.subplots_adjust(hspace=0.5, left=0.07, right=0.93) -ax = axs[0] -hb = ax.hexbin(x, y, gridsize=50, cmap='inferno') -ax.axis([xmin, xmax, ymin, ymax]) -ax.set_title("Hexagon binning") -cb = fig.colorbar(hb, ax=ax) -cb.set_label('counts') - -ax = axs[1] -hb = ax.hexbin(x, y, gridsize=50, bins='log', cmap='inferno') -ax.axis([xmin, xmax, ymin, ymax]) -ax.set_title("With a log color scale") -cb = fig.colorbar(hb, ax=ax) -cb.set_label('log10(N)') - -plt.show() diff --git a/mpl_examples/pylab_examples/hexbin_demo2.hires.png b/mpl_examples/pylab_examples/hexbin_demo2.hires.png deleted file mode 100644 index c2ca46aabda..00000000000 Binary files a/mpl_examples/pylab_examples/hexbin_demo2.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/hexbin_demo2.pdf b/mpl_examples/pylab_examples/hexbin_demo2.pdf deleted file mode 100644 index a88a3f7b581..00000000000 Binary files a/mpl_examples/pylab_examples/hexbin_demo2.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/hexbin_demo2.png b/mpl_examples/pylab_examples/hexbin_demo2.png deleted file mode 100644 index a7d6dd91c19..00000000000 Binary files a/mpl_examples/pylab_examples/hexbin_demo2.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/hexbin_demo2.py b/mpl_examples/pylab_examples/hexbin_demo2.py deleted file mode 100644 index 7bcdf97549e..00000000000 --- a/mpl_examples/pylab_examples/hexbin_demo2.py +++ /dev/null @@ -1,55 +0,0 @@ -""" -hexbin is an axes method or pyplot function that is essentially a -pcolor of a 2-D histogram with hexagonal cells. -""" - -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.mlab as mlab - -delta = 0.025 -x = y = np.arange(-3.0, 3.0, delta) -X, Y = np.meshgrid(x, y) -Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) -Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) -Z = Z2 - Z1 # difference of Gaussians - -x = X.ravel() -y = Y.ravel() -z = Z.ravel() - -if 1: - # make some points 20 times more common than others, but same mean - xcond = (-1 < x) & (x < 1) - ycond = (-2 < y) & (y < 0) - cond = xcond & ycond - xnew = x[cond] - ynew = y[cond] - znew = z[cond] - for i in range(20): - x = np.hstack((x, xnew)) - y = np.hstack((y, ynew)) - z = np.hstack((z, znew)) - -xmin = x.min() -xmax = x.max() -ymin = y.min() -ymax = y.max() - -gridsize = 30 - -plt.subplot(211) -plt.hexbin(x, y, C=z, gridsize=gridsize, marginals=True, cmap=plt.cm.RdBu, - vmax=abs(z).max(), vmin=-abs(z).max()) -plt.axis([xmin, xmax, ymin, ymax]) -cb = plt.colorbar() -cb.set_label('mean value') - - -plt.subplot(212) -plt.hexbin(x, y, gridsize=gridsize, cmap=plt.cm.Blues_r) -plt.axis([xmin, xmax, ymin, ymax]) -cb = plt.colorbar() -cb.set_label('N observations') - -plt.show() diff --git a/mpl_examples/pylab_examples/hist2d_demo.hires.png b/mpl_examples/pylab_examples/hist2d_demo.hires.png deleted file mode 100644 index df524e16f0e..00000000000 Binary files a/mpl_examples/pylab_examples/hist2d_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/hist2d_demo.pdf b/mpl_examples/pylab_examples/hist2d_demo.pdf deleted file mode 100644 index 169ba18d447..00000000000 Binary files a/mpl_examples/pylab_examples/hist2d_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/hist2d_demo.png b/mpl_examples/pylab_examples/hist2d_demo.png deleted file mode 100644 index 16e9ee3aa7f..00000000000 Binary files a/mpl_examples/pylab_examples/hist2d_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/hist2d_demo.py b/mpl_examples/pylab_examples/hist2d_demo.py deleted file mode 100644 index f8f0e61cbe9..00000000000 --- a/mpl_examples/pylab_examples/hist2d_demo.py +++ /dev/null @@ -1,8 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np -x = np.random.randn(1000) -y = np.random.randn(1000) + 5 - -# normal distribution center at x=0 and y=5 -plt.hist2d(x, y, bins=40) -plt.show() diff --git a/mpl_examples/pylab_examples/hist2d_log_demo.hires.png b/mpl_examples/pylab_examples/hist2d_log_demo.hires.png deleted file mode 100644 index d9f2791d55d..00000000000 Binary files a/mpl_examples/pylab_examples/hist2d_log_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/hist2d_log_demo.pdf b/mpl_examples/pylab_examples/hist2d_log_demo.pdf deleted file mode 100644 index b9fb6d40fd8..00000000000 Binary files a/mpl_examples/pylab_examples/hist2d_log_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/hist2d_log_demo.png b/mpl_examples/pylab_examples/hist2d_log_demo.png deleted file mode 100644 index 952e3a54ff3..00000000000 Binary files a/mpl_examples/pylab_examples/hist2d_log_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/hist2d_log_demo.py b/mpl_examples/pylab_examples/hist2d_log_demo.py deleted file mode 100644 index 48936b8bdb0..00000000000 --- a/mpl_examples/pylab_examples/hist2d_log_demo.py +++ /dev/null @@ -1,11 +0,0 @@ -from matplotlib.colors import LogNorm -import matplotlib.pyplot as plt -import numpy as np - -# normal distribution center at x=0 and y=5 -x = np.random.randn(100000) -y = np.random.randn(100000) + 5 - -plt.hist2d(x, y, bins=40, norm=LogNorm()) -plt.colorbar() -plt.show() diff --git a/mpl_examples/pylab_examples/hist_colormapped.hires.png b/mpl_examples/pylab_examples/hist_colormapped.hires.png deleted file mode 100644 index 62a091b2dd0..00000000000 Binary files a/mpl_examples/pylab_examples/hist_colormapped.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/hist_colormapped.pdf b/mpl_examples/pylab_examples/hist_colormapped.pdf deleted file mode 100644 index 6c27bc25b33..00000000000 Binary files a/mpl_examples/pylab_examples/hist_colormapped.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/hist_colormapped.png b/mpl_examples/pylab_examples/hist_colormapped.png deleted file mode 100644 index 6913562d53a..00000000000 Binary files a/mpl_examples/pylab_examples/hist_colormapped.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/hist_colormapped.py b/mpl_examples/pylab_examples/hist_colormapped.py deleted file mode 100644 index 3af198e2d09..00000000000 --- a/mpl_examples/pylab_examples/hist_colormapped.py +++ /dev/null @@ -1,23 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.cm as cm -import matplotlib.colors as colors - -fig, ax = plt.subplots() -Ntotal = 1000 -N, bins, patches = ax.hist(np.random.rand(Ntotal), 20) - -# I'll color code by height, but you could use any scalar - - -# we need to normalize the data to 0..1 for the full -# range of the colormap -fracs = N.astype(float)/N.max() -norm = colors.Normalize(fracs.min(), fracs.max()) - -for thisfrac, thispatch in zip(fracs, patches): - color = cm.viridis(norm(thisfrac)) - thispatch.set_facecolor(color) - - -plt.show() diff --git a/mpl_examples/pylab_examples/histogram_percent_demo.hires.png b/mpl_examples/pylab_examples/histogram_percent_demo.hires.png deleted file mode 100644 index ffa0c980d94..00000000000 Binary files a/mpl_examples/pylab_examples/histogram_percent_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/histogram_percent_demo.pdf b/mpl_examples/pylab_examples/histogram_percent_demo.pdf deleted file mode 100644 index bcaef8520ab..00000000000 Binary files a/mpl_examples/pylab_examples/histogram_percent_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/histogram_percent_demo.png b/mpl_examples/pylab_examples/histogram_percent_demo.png deleted file mode 100644 index 52924b35125..00000000000 Binary files a/mpl_examples/pylab_examples/histogram_percent_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/histogram_percent_demo.py b/mpl_examples/pylab_examples/histogram_percent_demo.py deleted file mode 100644 index 9d7b5d34423..00000000000 --- a/mpl_examples/pylab_examples/histogram_percent_demo.py +++ /dev/null @@ -1,30 +0,0 @@ -import matplotlib -from numpy.random import randn -import matplotlib.pyplot as plt -from matplotlib.ticker import FuncFormatter - - -def to_percent(y, position): - # Ignore the passed in position. This has the effect of scaling the default - # tick locations. - s = str(100 * y) - - # The percent symbol needs escaping in latex - if matplotlib.rcParams['text.usetex'] is True: - return s + r'$\%$' - else: - return s + '%' - -x = randn(5000) - -# Make a normed histogram. It'll be multiplied by 100 later. -plt.hist(x, bins=50, normed=True) - -# Create the formatter using the function to_percent. This multiplies all the -# default labels by 100, making them all percentages -formatter = FuncFormatter(to_percent) - -# Set the formatter -plt.gca().yaxis.set_major_formatter(formatter) - -plt.show() diff --git a/mpl_examples/pylab_examples/image_clip_path.hires.png b/mpl_examples/pylab_examples/image_clip_path.hires.png deleted file mode 100644 index 79d31cd4689..00000000000 Binary files a/mpl_examples/pylab_examples/image_clip_path.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_clip_path.pdf b/mpl_examples/pylab_examples/image_clip_path.pdf deleted file mode 100644 index c687020855f..00000000000 Binary files a/mpl_examples/pylab_examples/image_clip_path.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_clip_path.png b/mpl_examples/pylab_examples/image_clip_path.png deleted file mode 100644 index 5f1b586cd45..00000000000 Binary files a/mpl_examples/pylab_examples/image_clip_path.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_clip_path.py b/mpl_examples/pylab_examples/image_clip_path.py deleted file mode 100644 index fbcb0870d75..00000000000 --- a/mpl_examples/pylab_examples/image_clip_path.py +++ /dev/null @@ -1,24 +0,0 @@ -import numpy as np -import matplotlib.cm as cm -import matplotlib.mlab as mlab -import matplotlib.pyplot as plt -from matplotlib.path import Path -from matplotlib.patches import PathPatch - -delta = 0.025 -x = y = np.arange(-3.0, 3.0, delta) -X, Y = np.meshgrid(x, y) -Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) -Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) -Z = Z2 - Z1 # difference of Gaussians - -path = Path([[0, 1], [1, 0], [0, -1], [-1, 0], [0, 1]]) -patch = PathPatch(path, facecolor='none') -plt.gca().add_patch(patch) - -im = plt.imshow(Z, interpolation='bilinear', cmap=cm.gray, - origin='lower', extent=[-3, 3, -3, 3], - clip_path=patch, clip_on=True) -im.set_clip_path(patch) - -plt.show() diff --git a/mpl_examples/pylab_examples/image_demo.hires.png b/mpl_examples/pylab_examples/image_demo.hires.png deleted file mode 100644 index 4e9c43ca79e..00000000000 Binary files a/mpl_examples/pylab_examples/image_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_demo.pdf b/mpl_examples/pylab_examples/image_demo.pdf deleted file mode 100644 index 02bc4c7dbb7..00000000000 Binary files a/mpl_examples/pylab_examples/image_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_demo.png b/mpl_examples/pylab_examples/image_demo.png deleted file mode 100644 index d88bc4abedd..00000000000 Binary files a/mpl_examples/pylab_examples/image_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_demo.py b/mpl_examples/pylab_examples/image_demo.py deleted file mode 100644 index a189ef2ce3e..00000000000 --- a/mpl_examples/pylab_examples/image_demo.py +++ /dev/null @@ -1,17 +0,0 @@ -import numpy as np -import matplotlib.cm as cm -import matplotlib.mlab as mlab -import matplotlib.pyplot as plt - -delta = 0.025 -x = y = np.arange(-3.0, 3.0, delta) -X, Y = np.meshgrid(x, y) -Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) -Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) -Z = Z2 - Z1 # difference of Gaussians - -im = plt.imshow(Z, interpolation='bilinear', cmap=cm.RdYlGn, - origin='lower', extent=[-3, 3, -3, 3], - vmax=abs(Z).max(), vmin=-abs(Z).max()) - -plt.show() diff --git a/mpl_examples/pylab_examples/image_demo2.hires.png b/mpl_examples/pylab_examples/image_demo2.hires.png deleted file mode 100644 index 7e1d87d95c0..00000000000 Binary files a/mpl_examples/pylab_examples/image_demo2.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_demo2.pdf b/mpl_examples/pylab_examples/image_demo2.pdf deleted file mode 100644 index fbfb9429cb6..00000000000 Binary files a/mpl_examples/pylab_examples/image_demo2.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_demo2.png b/mpl_examples/pylab_examples/image_demo2.png deleted file mode 100644 index afcbf028387..00000000000 Binary files a/mpl_examples/pylab_examples/image_demo2.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_demo2.py b/mpl_examples/pylab_examples/image_demo2.py deleted file mode 100644 index 998e383d218..00000000000 --- a/mpl_examples/pylab_examples/image_demo2.py +++ /dev/null @@ -1,23 +0,0 @@ -from __future__ import print_function -import matplotlib.pyplot as plt -import numpy as np -import matplotlib.cbook as cbook - -w, h = 512, 512 - -datafile = cbook.get_sample_data('ct.raw.gz', asfileobj=True) -s = datafile.read() -A = np.fromstring(s, np.uint16).astype(float) -A *= 1.0 / max(A) -A.shape = w, h - -extent = (0, 25, 0, 25) -im = plt.imshow(A, cmap=plt.cm.hot, origin='upper', extent=extent) - -markers = [(15.9, 14.5), (16.8, 15)] -x, y = zip(*markers) -plt.plot(x, y, 'o') - -plt.title('CT density') - -plt.show() diff --git a/mpl_examples/pylab_examples/image_interp.py b/mpl_examples/pylab_examples/image_interp.py deleted file mode 100644 index 3ad6a5f37d6..00000000000 --- a/mpl_examples/pylab_examples/image_interp.py +++ /dev/null @@ -1,64 +0,0 @@ -""" -The same (small) array, interpolated with three different -interpolation methods. - -The center of the pixel at A[i,j] is plotted at i+0.5, i+0.5. If you -are using interpolation='nearest', the region bounded by (i,j) and -(i+1,j+1) will have the same color. If you are using interpolation, -the pixel center will have the same color as it does with nearest, but -other pixels will be interpolated between the neighboring pixels. - -Earlier versions of matplotlib (<0.63) tried to hide the edge effects -from you by setting the view limits so that they would not be visible. -A recent bugfix in antigrain, and a new implementation in the -matplotlib._image module which takes advantage of this fix, no longer -makes this necessary. To prevent edge effects, when doing -interpolation, the matplotlib._image module now pads the input array -with identical pixels around the edge. e.g., if you have a 5x5 array -with colors a-y as below - - - a b c d e - f g h i j - k l m n o - p q r s t - u v w x y - -the _image module creates the padded array, - - a a b c d e e - a a b c d e e - f f g h i j j - k k l m n o o - p p q r s t t - o u v w x y y - o u v w x y y - -does the interpolation/resizing, and then extracts the central region. -This allows you to plot the full range of your array w/o edge effects, -and for example to layer multiple images of different sizes over one -another with different interpolation methods - see -examples/layer_images.py. It also implies a performance hit, as this -new temporary, padded array must be created. Sophisticated -interpolation also implies a performance hit, so if you need maximal -performance or have very large images, interpolation='nearest' is -suggested. - -""" -import matplotlib.pyplot as plt -import numpy as np - -A = np.random.rand(5, 5) -plt.figure(1) -plt.imshow(A, interpolation='nearest') -plt.grid(True) - -plt.figure(2) -plt.imshow(A, interpolation='bilinear') -plt.grid(True) - -plt.figure(3) -plt.imshow(A, interpolation='bicubic') -plt.grid(True) - -plt.show() diff --git a/mpl_examples/pylab_examples/image_interp_00.hires.png b/mpl_examples/pylab_examples/image_interp_00.hires.png deleted file mode 100644 index aee98bda396..00000000000 Binary files a/mpl_examples/pylab_examples/image_interp_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_interp_00.pdf b/mpl_examples/pylab_examples/image_interp_00.pdf deleted file mode 100644 index 13dabcd3b0a..00000000000 Binary files a/mpl_examples/pylab_examples/image_interp_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_interp_00.png b/mpl_examples/pylab_examples/image_interp_00.png deleted file mode 100644 index d560d804c03..00000000000 Binary files a/mpl_examples/pylab_examples/image_interp_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_interp_01.hires.png b/mpl_examples/pylab_examples/image_interp_01.hires.png deleted file mode 100644 index 8358424988d..00000000000 Binary files a/mpl_examples/pylab_examples/image_interp_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_interp_01.pdf b/mpl_examples/pylab_examples/image_interp_01.pdf deleted file mode 100644 index 16b57b83e84..00000000000 Binary files a/mpl_examples/pylab_examples/image_interp_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_interp_01.png b/mpl_examples/pylab_examples/image_interp_01.png deleted file mode 100644 index 1059fd58e8c..00000000000 Binary files a/mpl_examples/pylab_examples/image_interp_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_interp_02.hires.png b/mpl_examples/pylab_examples/image_interp_02.hires.png deleted file mode 100644 index bdae43345ec..00000000000 Binary files a/mpl_examples/pylab_examples/image_interp_02.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_interp_02.pdf b/mpl_examples/pylab_examples/image_interp_02.pdf deleted file mode 100644 index c729eef6998..00000000000 Binary files a/mpl_examples/pylab_examples/image_interp_02.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_interp_02.png b/mpl_examples/pylab_examples/image_interp_02.png deleted file mode 100644 index 4fe44c90465..00000000000 Binary files a/mpl_examples/pylab_examples/image_interp_02.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_masked.hires.png b/mpl_examples/pylab_examples/image_masked.hires.png deleted file mode 100644 index 5ccb5f93c26..00000000000 Binary files a/mpl_examples/pylab_examples/image_masked.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_masked.pdf b/mpl_examples/pylab_examples/image_masked.pdf deleted file mode 100644 index 461306e889d..00000000000 Binary files a/mpl_examples/pylab_examples/image_masked.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_masked.png b/mpl_examples/pylab_examples/image_masked.png deleted file mode 100644 index ae9c1439b05..00000000000 Binary files a/mpl_examples/pylab_examples/image_masked.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_masked.py b/mpl_examples/pylab_examples/image_masked.py deleted file mode 100644 index 6ab417df069..00000000000 --- a/mpl_examples/pylab_examples/image_masked.py +++ /dev/null @@ -1,72 +0,0 @@ -""" -imshow with masked array input and out-of-range colors. - -The second subplot illustrates the use of BoundaryNorm to -get a filled contour effect. -""" -from copy import copy - -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.colors as colors -import matplotlib.mlab as mlab - -# compute some interesting data -x0, x1 = -5, 5 -y0, y1 = -3, 3 -x = np.linspace(x0, x1, 500) -y = np.linspace(y0, y1, 500) -X, Y = np.meshgrid(x, y) -Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) -Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) -Z = 10*(Z2 - Z1) # difference of Gaussians - -# Set up a colormap: -# use copy so that we do not mutate the global colormap instance -palette = copy(plt.cm.gray) -palette.set_over('r', 1.0) -palette.set_under('g', 1.0) -palette.set_bad('b', 1.0) -# Alternatively, we could use -# palette.set_bad(alpha = 0.0) -# to make the bad region transparent. This is the default. -# If you comment out all the palette.set* lines, you will see -# all the defaults; under and over will be colored with the -# first and last colors in the palette, respectively. -Zm = np.ma.masked_where(Z > 1.2, Z) - -# By setting vmin and vmax in the norm, we establish the -# range to which the regular palette color scale is applied. -# Anything above that range is colored based on palette.set_over, etc. - -# set up the axes -fig, (ax1, ax2) = plt.subplots(nrows=2, figsize=(6, 5.4)) - -# plot using 'continuous' color map -im = ax1.imshow(Zm, interpolation='bilinear', - cmap=palette, - norm=colors.Normalize(vmin=-1.0, vmax=1.0), - aspect='auto', - origin='lower', - extent=[x0, x1, y0, y1]) -ax1.set_title('Green=low, Red=high, Blue=masked') -cbar = fig.colorbar(im, extend='both', shrink=0.9, ax=ax1) -cbar.set_label('uniform') -for ticklabel in ax1.xaxis.get_ticklabels(): - ticklabel.set_visible(False) - -# Plot using a small number of colors, with unevenly spaced boundaries. -im = ax2.imshow(Zm, interpolation='nearest', - cmap=palette, - norm=colors.BoundaryNorm([-1, -0.5, -0.2, 0, 0.2, 0.5, 1], - ncolors=palette.N), - aspect='auto', - origin='lower', - extent=[x0, x1, y0, y1]) -ax2.set_title('With BoundaryNorm') -cbar = fig.colorbar(im, extend='both', spacing='proportional', - shrink=0.9, ax=ax2) -cbar.set_label('proportional') - -fig.suptitle('imshow, with out-of-range and masked data') -plt.show() diff --git a/mpl_examples/pylab_examples/image_nonuniform.hires.png b/mpl_examples/pylab_examples/image_nonuniform.hires.png deleted file mode 100644 index 678566ffa05..00000000000 Binary files a/mpl_examples/pylab_examples/image_nonuniform.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_nonuniform.pdf b/mpl_examples/pylab_examples/image_nonuniform.pdf deleted file mode 100644 index 938a4ae46b2..00000000000 Binary files a/mpl_examples/pylab_examples/image_nonuniform.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_nonuniform.png b/mpl_examples/pylab_examples/image_nonuniform.png deleted file mode 100644 index 1589066f0f9..00000000000 Binary files a/mpl_examples/pylab_examples/image_nonuniform.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_nonuniform.py b/mpl_examples/pylab_examples/image_nonuniform.py deleted file mode 100644 index 7a222dc800b..00000000000 --- a/mpl_examples/pylab_examples/image_nonuniform.py +++ /dev/null @@ -1,65 +0,0 @@ -''' -This illustrates the NonUniformImage class. It is not -available via an Axes method but it is easily added to an -Axes instance as shown here. -''' - -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.image import NonUniformImage -from matplotlib import cm - -interp = 'nearest' - -# Linear x array for cell centers: -x = np.linspace(-4, 4, 9) - -# Highly nonlinear x array: -x2 = x**3 - -y = np.linspace(-4, 4, 9) - -z = np.sqrt(x[np.newaxis, :]**2 + y[:, np.newaxis]**2) - -fig, axs = plt.subplots(nrows=2, ncols=2) -fig.subplots_adjust(bottom=0.07, hspace=0.3) -fig.suptitle('NonUniformImage class', fontsize='large') -ax = axs[0, 0] -im = NonUniformImage(ax, interpolation=interp, extent=(-4, 4, -4, 4), - cmap=cm.Purples) -im.set_data(x, y, z) -ax.images.append(im) -ax.set_xlim(-4, 4) -ax.set_ylim(-4, 4) -ax.set_title(interp) - -ax = axs[0, 1] -im = NonUniformImage(ax, interpolation=interp, extent=(-64, 64, -4, 4), - cmap=cm.Purples) -im.set_data(x2, y, z) -ax.images.append(im) -ax.set_xlim(-64, 64) -ax.set_ylim(-4, 4) -ax.set_title(interp) - -interp = 'bilinear' - -ax = axs[1, 0] -im = NonUniformImage(ax, interpolation=interp, extent=(-4, 4, -4, 4), - cmap=cm.Purples) -im.set_data(x, y, z) -ax.images.append(im) -ax.set_xlim(-4, 4) -ax.set_ylim(-4, 4) -ax.set_title(interp) - -ax = axs[1, 1] -im = NonUniformImage(ax, interpolation=interp, extent=(-64, 64, -4, 4), - cmap=cm.Purples) -im.set_data(x2, y, z) -ax.images.append(im) -ax.set_xlim(-64, 64) -ax.set_ylim(-4, 4) -ax.set_title(interp) - -plt.show() diff --git a/mpl_examples/pylab_examples/image_origin.hires.png b/mpl_examples/pylab_examples/image_origin.hires.png deleted file mode 100644 index f3b58abe996..00000000000 Binary files a/mpl_examples/pylab_examples/image_origin.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_origin.pdf b/mpl_examples/pylab_examples/image_origin.pdf deleted file mode 100644 index 9de6a83dc93..00000000000 Binary files a/mpl_examples/pylab_examples/image_origin.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_origin.png b/mpl_examples/pylab_examples/image_origin.png deleted file mode 100644 index bf71d39a6cc..00000000000 Binary files a/mpl_examples/pylab_examples/image_origin.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_origin.py b/mpl_examples/pylab_examples/image_origin.py deleted file mode 100644 index 0e282dd7fb6..00000000000 --- a/mpl_examples/pylab_examples/image_origin.py +++ /dev/null @@ -1,20 +0,0 @@ -""" -You can specify whether images should be plotted with the array origin -x[0,0] in the upper left or upper right by using the origin parameter. -You can also control the default be setting image.origin in your -matplotlibrc file; see http://matplotlib.org/matplotlibrc -""" -import matplotlib.pyplot as plt -import numpy as np - -x = np.arange(120) -x.shape = (10, 12) - -interp = 'bilinear' -fig, axs = plt.subplots(nrows=2, sharex=True, figsize=(3, 5)) -axs[0].set_title('blue should be up') -axs[0].imshow(x, origin='upper', interpolation=interp) - -axs[1].set_title('blue should be down') -axs[1].imshow(x, origin='lower', interpolation=interp) -plt.show() diff --git a/mpl_examples/pylab_examples/image_slices_viewer.hires.png b/mpl_examples/pylab_examples/image_slices_viewer.hires.png deleted file mode 100644 index 726f24cf335..00000000000 Binary files a/mpl_examples/pylab_examples/image_slices_viewer.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_slices_viewer.pdf b/mpl_examples/pylab_examples/image_slices_viewer.pdf deleted file mode 100644 index 2b863b3ab2b..00000000000 Binary files a/mpl_examples/pylab_examples/image_slices_viewer.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_slices_viewer.png b/mpl_examples/pylab_examples/image_slices_viewer.png deleted file mode 100644 index 029bea5bc7d..00000000000 Binary files a/mpl_examples/pylab_examples/image_slices_viewer.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/image_slices_viewer.py b/mpl_examples/pylab_examples/image_slices_viewer.py deleted file mode 100644 index 24affd3deee..00000000000 --- a/mpl_examples/pylab_examples/image_slices_viewer.py +++ /dev/null @@ -1,40 +0,0 @@ -from __future__ import print_function -import numpy -import matplotlib.pyplot as plt - - -class IndexTracker(object): - def __init__(self, ax, X): - self.ax = ax - ax.set_title('use scroll wheel to navigate images') - - self.X = X - rows, cols, self.slices = X.shape - self.ind = self.slices//2 - - self.im = ax.imshow(self.X[:, :, self.ind]) - self.update() - - def onscroll(self, event): - print("%s %s" % (event.button, event.step)) - if event.button == 'up': - self.ind = numpy.clip(self.ind + 1, 0, self.slices - 1) - else: - self.ind = numpy.clip(self.ind - 1, 0, self.slices - 1) - self.update() - - def update(self): - self.im.set_data(self.X[:, :, self.ind]) - ax.set_ylabel('slice %s' % self.ind) - self.im.axes.figure.canvas.draw() - - -fig, ax = plt.subplots(1, 1) - -X = numpy.random.rand(20, 20, 40) - -tracker = IndexTracker(ax, X) - - -fig.canvas.mpl_connect('scroll_event', tracker.onscroll) -plt.show() diff --git a/mpl_examples/pylab_examples/interp_demo.hires.png b/mpl_examples/pylab_examples/interp_demo.hires.png deleted file mode 100644 index 2e41db5bba6..00000000000 Binary files a/mpl_examples/pylab_examples/interp_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/interp_demo.pdf b/mpl_examples/pylab_examples/interp_demo.pdf deleted file mode 100644 index 53f1177c794..00000000000 Binary files a/mpl_examples/pylab_examples/interp_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/interp_demo.png b/mpl_examples/pylab_examples/interp_demo.png deleted file mode 100644 index 6d4f39136ff..00000000000 Binary files a/mpl_examples/pylab_examples/interp_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/interp_demo.py b/mpl_examples/pylab_examples/interp_demo.py deleted file mode 100644 index 9b7c4639eee..00000000000 --- a/mpl_examples/pylab_examples/interp_demo.py +++ /dev/null @@ -1,13 +0,0 @@ -import matplotlib.pyplot as plt -from numpy import pi, sin, linspace -from matplotlib.mlab import stineman_interp - -x = linspace(0, 2*pi, 20) -y = sin(x) -yp = None -xi = linspace(x[0], x[-1], 100) -yi = stineman_interp(xi, x, y, yp) - -fig, ax = plt.subplots() -ax.plot(x, y, 'o', xi, yi, '.') -plt.show() diff --git a/mpl_examples/pylab_examples/invert_axes.hires.png b/mpl_examples/pylab_examples/invert_axes.hires.png deleted file mode 100644 index 4f2bc6e89c1..00000000000 Binary files a/mpl_examples/pylab_examples/invert_axes.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/invert_axes.pdf b/mpl_examples/pylab_examples/invert_axes.pdf deleted file mode 100644 index 9c5210c5428..00000000000 Binary files a/mpl_examples/pylab_examples/invert_axes.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/invert_axes.png b/mpl_examples/pylab_examples/invert_axes.png deleted file mode 100644 index c78d87ab634..00000000000 Binary files a/mpl_examples/pylab_examples/invert_axes.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/invert_axes.py b/mpl_examples/pylab_examples/invert_axes.py deleted file mode 100644 index 66dc6b41971..00000000000 --- a/mpl_examples/pylab_examples/invert_axes.py +++ /dev/null @@ -1,20 +0,0 @@ -""" -You can use decreasing axes by flipping the normal order of the axis -limits -""" - -import matplotlib.pyplot as plt -import numpy as np - -t = np.arange(0.01, 5.0, 0.01) -s = np.exp(-t) -plt.plot(t, s) - -plt.xlim(5, 0) # decreasing time - -plt.xlabel('decreasing time (s)') -plt.ylabel('voltage (mV)') -plt.title('Should be growing...') -plt.grid(True) - -plt.show() diff --git a/mpl_examples/pylab_examples/layer_images.hires.png b/mpl_examples/pylab_examples/layer_images.hires.png deleted file mode 100644 index 53dcf851688..00000000000 Binary files a/mpl_examples/pylab_examples/layer_images.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/layer_images.pdf b/mpl_examples/pylab_examples/layer_images.pdf deleted file mode 100644 index ceee1ebc4ee..00000000000 Binary files a/mpl_examples/pylab_examples/layer_images.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/layer_images.png b/mpl_examples/pylab_examples/layer_images.png deleted file mode 100644 index 56c2fb56934..00000000000 Binary files a/mpl_examples/pylab_examples/layer_images.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/layer_images.py b/mpl_examples/pylab_examples/layer_images.py deleted file mode 100644 index 1a8675c2bb0..00000000000 --- a/mpl_examples/pylab_examples/layer_images.py +++ /dev/null @@ -1,41 +0,0 @@ -""" -Layer images above one another using alpha blending -""" -from __future__ import division -import matplotlib.pyplot as plt -import numpy as np - - -def func3(x, y): - return (1 - x/2 + x**5 + y**3)*np.exp(-(x**2 + y**2)) - -# make these smaller to increase the resolution -dx, dy = 0.05, 0.05 - -x = np.arange(-3.0, 3.0, dx) -y = np.arange(-3.0, 3.0, dy) -X, Y = np.meshgrid(x, y) - -# when layering multiple images, the images need to have the same -# extent. This does not mean they need to have the same shape, but -# they both need to render to the same coordinate system determined by -# xmin, xmax, ymin, ymax. Note if you use different interpolations -# for the images their apparent extent could be different due to -# interpolation edge effects - - -xmin, xmax, ymin, ymax = np.amin(x), np.amax(x), np.amin(y), np.amax(y) -extent = xmin, xmax, ymin, ymax -fig = plt.figure(frameon=False) - -Z1 = np.array(([0, 1]*4 + [1, 0]*4)*4) -Z1.shape = (8, 8) # chessboard -im1 = plt.imshow(Z1, cmap=plt.cm.gray, interpolation='nearest', - extent=extent) - -Z2 = func3(X, Y) - -im2 = plt.imshow(Z2, cmap=plt.cm.viridis, alpha=.9, interpolation='bilinear', - extent=extent) - -plt.show() diff --git a/mpl_examples/pylab_examples/leftventricle_bulleye.hires.png b/mpl_examples/pylab_examples/leftventricle_bulleye.hires.png deleted file mode 100644 index 0528f71bf5a..00000000000 Binary files a/mpl_examples/pylab_examples/leftventricle_bulleye.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/leftventricle_bulleye.pdf b/mpl_examples/pylab_examples/leftventricle_bulleye.pdf deleted file mode 100644 index 5f0531b10e9..00000000000 Binary files a/mpl_examples/pylab_examples/leftventricle_bulleye.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/leftventricle_bulleye.png b/mpl_examples/pylab_examples/leftventricle_bulleye.png deleted file mode 100644 index f68b966dccd..00000000000 Binary files a/mpl_examples/pylab_examples/leftventricle_bulleye.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/leftventricle_bulleye.py b/mpl_examples/pylab_examples/leftventricle_bulleye.py deleted file mode 100644 index 8a2442e3b0c..00000000000 --- a/mpl_examples/pylab_examples/leftventricle_bulleye.py +++ /dev/null @@ -1,206 +0,0 @@ -""" -This example demonstrates how to create the 17 segment model for the left -ventricle recommended by the American Heart Association (AHA). -""" - -import numpy as np -import matplotlib as mpl -import matplotlib.pyplot as plt - - -def bullseye_plot(ax, data, segBold=None, cmap=None, norm=None): - """ - Bullseye representation for the left ventricle. - - Parameters - ---------- - ax : axes - data : list of int and float - The intensity values for each of the 17 segments - segBold: list of int, optional - A list with the segments to highlight - cmap : ColorMap or None, optional - Optional argument to set the desired colormap - norm : Normalize or None, optional - Optional argument to normalize data into the [0.0, 1.0] range - - - Notes - ----- - This function create the 17 segment model for the left ventricle according - to the American Heart Association (AHA) [1]_ - - References - ---------- - .. [1] M. D. Cerqueira, N. J. Weissman, V. Dilsizian, A. K. Jacobs, - S. Kaul, W. K. Laskey, D. J. Pennell, J. A. Rumberger, T. Ryan, - and M. S. Verani, "Standardized myocardial segmentation and - nomenclature for tomographic imaging of the heart", - Circulation, vol. 105, no. 4, pp. 539-542, 2002. - """ - if segBold is None: - segBold = [] - - linewidth = 2 - data = np.array(data).ravel() - - if cmap is None: - cmap = plt.cm.viridis - - if norm is None: - norm = mpl.colors.Normalize(vmin=data.min(), vmax=data.max()) - - theta = np.linspace(0, 2*np.pi, 768) - r = np.linspace(0.2, 1, 4) - - # Create the bound for the segment 17 - for i in range(r.shape[0]): - ax.plot(theta, np.repeat(r[i], theta.shape), '-k', lw=linewidth) - - # Create the bounds for the segments 1-12 - for i in range(6): - theta_i = i*60*np.pi/180 - ax.plot([theta_i, theta_i], [r[1], 1], '-k', lw=linewidth) - - # Create the bounds for the segments 13-16 - for i in range(4): - theta_i = i*90*np.pi/180 - 45*np.pi/180 - ax.plot([theta_i, theta_i], [r[0], r[1]], '-k', lw=linewidth) - - # Fill the segments 1-6 - r0 = r[2:4] - r0 = np.repeat(r0[:, np.newaxis], 128, axis=1).T - for i in range(6): - # First segment start at 60 degrees - theta0 = theta[i*128:i*128+128] + 60*np.pi/180 - theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1) - z = np.ones((128, 2))*data[i] - ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm) - if i+1 in segBold: - ax.plot(theta0, r0, '-k', lw=linewidth+2) - ax.plot(theta0[0], [r[2], r[3]], '-k', lw=linewidth+1) - ax.plot(theta0[-1], [r[2], r[3]], '-k', lw=linewidth+1) - - # Fill the segments 7-12 - r0 = r[1:3] - r0 = np.repeat(r0[:, np.newaxis], 128, axis=1).T - for i in range(6): - # First segment start at 60 degrees - theta0 = theta[i*128:i*128+128] + 60*np.pi/180 - theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1) - z = np.ones((128, 2))*data[i+6] - ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm) - if i+7 in segBold: - ax.plot(theta0, r0, '-k', lw=linewidth+2) - ax.plot(theta0[0], [r[1], r[2]], '-k', lw=linewidth+1) - ax.plot(theta0[-1], [r[1], r[2]], '-k', lw=linewidth+1) - - # Fill the segments 13-16 - r0 = r[0:2] - r0 = np.repeat(r0[:, np.newaxis], 192, axis=1).T - for i in range(4): - # First segment start at 45 degrees - theta0 = theta[i*192:i*192+192] + 45*np.pi/180 - theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1) - z = np.ones((192, 2))*data[i+12] - ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm) - if i+13 in segBold: - ax.plot(theta0, r0, '-k', lw=linewidth+2) - ax.plot(theta0[0], [r[0], r[1]], '-k', lw=linewidth+1) - ax.plot(theta0[-1], [r[0], r[1]], '-k', lw=linewidth+1) - - # Fill the segments 17 - if data.size == 17: - r0 = np.array([0, r[0]]) - r0 = np.repeat(r0[:, np.newaxis], theta.size, axis=1).T - theta0 = np.repeat(theta[:, np.newaxis], 2, axis=1) - z = np.ones((theta.size, 2))*data[16] - ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm) - if 17 in segBold: - ax.plot(theta0, r0, '-k', lw=linewidth+2) - - ax.set_ylim([0, 1]) - ax.set_yticklabels([]) - ax.set_xticklabels([]) - - -# Create the fake data -data = np.array(range(17)) + 1 - - -# Make a figure and axes with dimensions as desired. -fig, ax = plt.subplots(figsize=(12, 8), nrows=1, ncols=3, - subplot_kw=dict(projection='polar')) -fig.canvas.set_window_title('Left Ventricle Bulls Eyes (AHA)') - -# Create the axis for the colorbars -axl = fig.add_axes([0.14, 0.15, 0.2, 0.05]) -axl2 = fig.add_axes([0.41, 0.15, 0.2, 0.05]) -axl3 = fig.add_axes([0.69, 0.15, 0.2, 0.05]) - - -# Set the colormap and norm to correspond to the data for which -# the colorbar will be used. -cmap = mpl.cm.viridis -norm = mpl.colors.Normalize(vmin=1, vmax=17) - -# ColorbarBase derives from ScalarMappable and puts a colorbar -# in a specified axes, so it has everything needed for a -# standalone colorbar. There are many more kwargs, but the -# following gives a basic continuous colorbar with ticks -# and labels. -cb1 = mpl.colorbar.ColorbarBase(axl, cmap=cmap, norm=norm, - orientation='horizontal') -cb1.set_label('Some Units') - - -# Set the colormap and norm to correspond to the data for which -# the colorbar will be used. -cmap2 = mpl.cm.cool -norm2 = mpl.colors.Normalize(vmin=1, vmax=17) - -# ColorbarBase derives from ScalarMappable and puts a colorbar -# in a specified axes, so it has everything needed for a -# standalone colorbar. There are many more kwargs, but the -# following gives a basic continuous colorbar with ticks -# and labels. -cb2 = mpl.colorbar.ColorbarBase(axl2, cmap=cmap2, norm=norm2, - orientation='horizontal') -cb2.set_label('Some other units') - - -# The second example illustrates the use of a ListedColormap, a -# BoundaryNorm, and extended ends to show the "over" and "under" -# value colors. -cmap3 = mpl.colors.ListedColormap(['r', 'g', 'b', 'c']) -cmap3.set_over('0.35') -cmap3.set_under('0.75') - -# If a ListedColormap is used, the length of the bounds array must be -# one greater than the length of the color list. The bounds must be -# monotonically increasing. -bounds = [2, 3, 7, 9, 15] -norm3 = mpl.colors.BoundaryNorm(bounds, cmap3.N) -cb3 = mpl.colorbar.ColorbarBase(axl3, cmap=cmap3, norm=norm3, - # to use 'extend', you must - # specify two extra boundaries: - boundaries=[0]+bounds+[18], - extend='both', - ticks=bounds, # optional - spacing='proportional', - orientation='horizontal') -cb3.set_label('Discrete intervals, some other units') - - -# Create the 17 segment model -bullseye_plot(ax[0], data, cmap=cmap, norm=norm) -ax[0].set_title('Bulls Eye (AHA)') - -bullseye_plot(ax[1], data, cmap=cmap2, norm=norm2) -ax[1].set_title('Bulls Eye (AHA)') - -bullseye_plot(ax[2], data, segBold=[3, 5, 6, 11, 12, 16], - cmap=cmap3, norm=norm3) -ax[2].set_title('Segments [3,5,6,11,12,16] in bold') - -plt.show() diff --git a/mpl_examples/pylab_examples/legend_demo2.hires.png b/mpl_examples/pylab_examples/legend_demo2.hires.png deleted file mode 100644 index 03c3e793b7d..00000000000 Binary files a/mpl_examples/pylab_examples/legend_demo2.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/legend_demo2.pdf b/mpl_examples/pylab_examples/legend_demo2.pdf deleted file mode 100644 index 6bb1305be7d..00000000000 Binary files a/mpl_examples/pylab_examples/legend_demo2.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/legend_demo2.png b/mpl_examples/pylab_examples/legend_demo2.png deleted file mode 100644 index ddabf7f2a17..00000000000 Binary files a/mpl_examples/pylab_examples/legend_demo2.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/legend_demo2.py b/mpl_examples/pylab_examples/legend_demo2.py deleted file mode 100644 index 01619f3fd89..00000000000 --- a/mpl_examples/pylab_examples/legend_demo2.py +++ /dev/null @@ -1,20 +0,0 @@ -# Make a legend for specific lines. -import matplotlib.pyplot as plt -import numpy as np - - -t1 = np.arange(0.0, 2.0, 0.1) -t2 = np.arange(0.0, 2.0, 0.01) - -# note that plot returns a list of lines. The "l1, = plot" usage -# extracts the first element of the list into l1 using tuple -# unpacking. So l1 is a Line2D instance, not a sequence of lines -l1, = plt.plot(t2, np.exp(-t2)) -l2, l3 = plt.plot(t2, np.sin(2 * np.pi * t2), '--o', t1, np.log(1 + t1), '.') -l4, = plt.plot(t2, np.exp(-t2) * np.sin(2 * np.pi * t2), 's-.') - -plt.legend((l2, l4), ('oscillatory', 'damped'), loc='upper right', shadow=True) -plt.xlabel('time') -plt.ylabel('volts') -plt.title('Damped oscillation') -plt.show() diff --git a/mpl_examples/pylab_examples/legend_demo3.hires.png b/mpl_examples/pylab_examples/legend_demo3.hires.png deleted file mode 100644 index 3b29a311d5a..00000000000 Binary files a/mpl_examples/pylab_examples/legend_demo3.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/legend_demo3.pdf b/mpl_examples/pylab_examples/legend_demo3.pdf deleted file mode 100644 index 2fa10757653..00000000000 Binary files a/mpl_examples/pylab_examples/legend_demo3.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/legend_demo3.png b/mpl_examples/pylab_examples/legend_demo3.png deleted file mode 100644 index e5ddea28ba4..00000000000 Binary files a/mpl_examples/pylab_examples/legend_demo3.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/legend_demo3.py b/mpl_examples/pylab_examples/legend_demo3.py deleted file mode 100644 index 083c6e86a0c..00000000000 --- a/mpl_examples/pylab_examples/legend_demo3.py +++ /dev/null @@ -1,22 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - -x = np.linspace(0, 1) - -# Plot the lines y=x**n for n=1..4. -ax = plt.subplot(2, 1, 1) -for n in range(1, 5): - plt.plot(x, x**n, label="n={0}".format(n)) -plt.legend(loc="upper left", bbox_to_anchor=[0, 1], - ncol=2, shadow=True, title="Legend", fancybox=True) -ax.get_legend().get_title().set_color("red") - -# Demonstrate some more complex labels. -ax = plt.subplot(2, 1, 2) -plt.plot(x, x**2, label="multi\nline") -half_pi = np.linspace(0, np.pi / 2) -plt.plot(np.sin(half_pi), np.cos(half_pi), label=r"$\frac{1}{2}\pi$") -plt.plot(x, 2**(x**2), label="$2^{x^2}$") -plt.legend(shadow=True, fancybox=True) - -plt.show() diff --git a/mpl_examples/pylab_examples/legend_demo4.hires.png b/mpl_examples/pylab_examples/legend_demo4.hires.png deleted file mode 100644 index 927eaa35319..00000000000 Binary files a/mpl_examples/pylab_examples/legend_demo4.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/legend_demo4.pdf b/mpl_examples/pylab_examples/legend_demo4.pdf deleted file mode 100644 index 029ad0f3569..00000000000 Binary files a/mpl_examples/pylab_examples/legend_demo4.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/legend_demo4.png b/mpl_examples/pylab_examples/legend_demo4.png deleted file mode 100644 index 103fe6a2f04..00000000000 Binary files a/mpl_examples/pylab_examples/legend_demo4.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/legend_demo4.py b/mpl_examples/pylab_examples/legend_demo4.py deleted file mode 100644 index 2fd076a9740..00000000000 --- a/mpl_examples/pylab_examples/legend_demo4.py +++ /dev/null @@ -1,22 +0,0 @@ -import matplotlib.pyplot as plt - -fig, axes = plt.subplots(3, 1) -top_ax, middle_ax, bottom_ax = axes - -top_ax.bar([0, 1, 2], [0.2, 0.3, 0.1], width=0.4, label="Bar 1", - align="center") -top_ax.bar([0.5, 1.5, 2.5], [0.3, 0.2, 0.2], color="red", width=0.4, - label="Bar 2", align="center") -top_ax.legend() - -middle_ax.errorbar([0, 1, 2], [2, 3, 1], xerr=0.4, fmt="s", label="test 1") -middle_ax.errorbar([0, 1, 2], [3, 2, 4], yerr=0.3, fmt="o", label="test 2") -middle_ax.errorbar([0, 1, 2], [1, 1, 3], xerr=0.4, yerr=0.3, fmt="^", - label="test 3") -middle_ax.legend() - -bottom_ax.stem([0.3, 1.5, 2.7], [1, 3.6, 2.7], label="stem test") -bottom_ax.legend() - -plt.subplots_adjust(hspace=0.7) -plt.show() diff --git a/mpl_examples/pylab_examples/legend_demo5.hires.png b/mpl_examples/pylab_examples/legend_demo5.hires.png deleted file mode 100644 index 1796a9dbc98..00000000000 Binary files a/mpl_examples/pylab_examples/legend_demo5.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/legend_demo5.pdf b/mpl_examples/pylab_examples/legend_demo5.pdf deleted file mode 100644 index 1802544fe83..00000000000 Binary files a/mpl_examples/pylab_examples/legend_demo5.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/legend_demo5.png b/mpl_examples/pylab_examples/legend_demo5.png deleted file mode 100644 index 36ec6970a77..00000000000 Binary files a/mpl_examples/pylab_examples/legend_demo5.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/legend_demo5.py b/mpl_examples/pylab_examples/legend_demo5.py deleted file mode 100644 index 1294cfce4b7..00000000000 --- a/mpl_examples/pylab_examples/legend_demo5.py +++ /dev/null @@ -1,71 +0,0 @@ -from __future__ import (absolute_import, division, - print_function, unicode_literals) -import six -from matplotlib import pyplot as plt -import numpy as np -from matplotlib.legend_handler import HandlerLineCollection -import matplotlib.collections as mcol -from matplotlib.lines import Line2D - - -class HandlerDashedLines(HandlerLineCollection): - """ - Custom Handler for LineCollection instances. - """ - def create_artists(self, legend, orig_handle, - xdescent, ydescent, width, height, fontsize, trans): - # figure out how many lines there are - numlines = len(orig_handle.get_segments()) - xdata, xdata_marker = self.get_xdata(legend, xdescent, ydescent, - width, height, fontsize) - leglines = [] - # divide the vertical space where the lines will go - # into equal parts based on the number of lines - ydata = ((height) / (numlines + 1)) * np.ones(xdata.shape, float) - # for each line, create the line at the proper location - # and set the dash pattern - for i in range(numlines): - legline = Line2D(xdata, ydata * (numlines - i) - ydescent) - self.update_prop(legline, orig_handle, legend) - # set color, dash pattern, and linewidth to that - # of the lines in linecollection - try: - color = orig_handle.get_colors()[i] - except IndexError: - color = orig_handle.get_colors()[0] - try: - dashes = orig_handle.get_dashes()[i] - except IndexError: - dashes = orig_handle.get_dashes()[0] - try: - lw = orig_handle.get_linewidths()[i] - except IndexError: - lw = orig_handle.get_linewidths()[0] - if dashes[0] is not None: - legline.set_dashes(dashes[1]) - legline.set_color(color) - legline.set_transform(trans) - legline.set_linewidth(lw) - leglines.append(legline) - return leglines - -x = np.linspace(0, 5, 100) - -plt.figure() -colors = plt.rcParams['axes.prop_cycle'].by_key()['color'][:5] -styles = ['solid', 'dashed', 'dashed', 'dashed', 'solid'] -lines = [] -for i, color, style in zip(range(5), colors, styles): - plt.plot(x, np.sin(x) - .1 * i, c=color, ls=style) - - -# make proxy artists -# make list of one line -- doesn't matter what the coordinates are -line = [[(0, 0)]] -# set up the proxy artist -lc = mcol.LineCollection(5 * line, linestyles=styles, colors=colors) -# create the legend -plt.legend([lc], ['multi-line'], handler_map={type(lc): HandlerDashedLines()}, - handlelength=2.5, handleheight=3) - -plt.show() diff --git a/mpl_examples/pylab_examples/line_collection.hires.png b/mpl_examples/pylab_examples/line_collection.hires.png deleted file mode 100644 index 643e499b8f7..00000000000 Binary files a/mpl_examples/pylab_examples/line_collection.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/line_collection.pdf b/mpl_examples/pylab_examples/line_collection.pdf deleted file mode 100644 index 3e9c0a5dba4..00000000000 Binary files a/mpl_examples/pylab_examples/line_collection.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/line_collection.png b/mpl_examples/pylab_examples/line_collection.png deleted file mode 100644 index 27d3a886869..00000000000 Binary files a/mpl_examples/pylab_examples/line_collection.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/line_collection.py b/mpl_examples/pylab_examples/line_collection.py deleted file mode 100644 index 22ccbc37c0b..00000000000 --- a/mpl_examples/pylab_examples/line_collection.py +++ /dev/null @@ -1,40 +0,0 @@ -import matplotlib.pyplot as plt -from matplotlib.collections import LineCollection -from matplotlib import colors as mcolors - -import numpy as np - -# In order to efficiently plot many lines in a single set of axes, -# Matplotlib has the ability to add the lines all at once. Here is a -# simple example showing how it is done. - -x = np.arange(100) -# Here are many sets of y to plot vs x -ys = x[:50, np.newaxis] + x[np.newaxis, :] - -segs = np.zeros((50, 100, 2), float) -segs[:, :, 1] = ys -segs[:, :, 0] = x - -# Mask some values to test masked array support: -segs = np.ma.masked_where((segs > 50) & (segs < 60), segs) - -# We need to set the plot limits. -ax = plt.axes() -ax.set_xlim(x.min(), x.max()) -ax.set_ylim(ys.min(), ys.max()) - -# colors is sequence of rgba tuples -# linestyle is a string or dash tuple. Legal string values are -# solid|dashed|dashdot|dotted. The dash tuple is (offset, onoffseq) -# where onoffseq is an even length tuple of on and off ink in points. -# If linestyle is omitted, 'solid' is used -# See matplotlib.collections.LineCollection for more information -colors = [mcolors.to_rgba(c) - for c in plt.rcParams['axes.prop_cycle'].by_key()['color']] - -line_segments = LineCollection(segs, linewidths=(0.5, 1, 1.5, 2), - colors=colors, linestyle='solid') -ax.add_collection(line_segments) -ax.set_title('Line collection with masked arrays') -plt.show() diff --git a/mpl_examples/pylab_examples/line_collection2.hires.png b/mpl_examples/pylab_examples/line_collection2.hires.png deleted file mode 100644 index d83cb39071f..00000000000 Binary files a/mpl_examples/pylab_examples/line_collection2.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/line_collection2.pdf b/mpl_examples/pylab_examples/line_collection2.pdf deleted file mode 100644 index 1a3ec553f5a..00000000000 Binary files a/mpl_examples/pylab_examples/line_collection2.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/line_collection2.png b/mpl_examples/pylab_examples/line_collection2.png deleted file mode 100644 index 485ab123cec..00000000000 Binary files a/mpl_examples/pylab_examples/line_collection2.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/line_collection2.py b/mpl_examples/pylab_examples/line_collection2.py deleted file mode 100644 index 8165ca87eab..00000000000 --- a/mpl_examples/pylab_examples/line_collection2.py +++ /dev/null @@ -1,37 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np -from matplotlib.collections import LineCollection - -# In order to efficiently plot many lines in a single set of axes, -# Matplotlib has the ability to add the lines all at once. Here is a -# simple example showing how it is done. - -N = 50 -x = np.arange(N) -# Here are many sets of y to plot vs x -ys = [x + i for i in x] - -# We need to set the plot limits, they will not autoscale -ax = plt.axes() -ax.set_xlim((np.amin(x), np.amax(x))) -ax.set_ylim((np.amin(np.amin(ys)), np.amax(np.amax(ys)))) - -# colors is sequence of rgba tuples -# linestyle is a string or dash tuple. Legal string values are -# solid|dashed|dashdot|dotted. The dash tuple is (offset, onoffseq) -# where onoffseq is an even length tuple of on and off ink in points. -# If linestyle is omitted, 'solid' is used -# See matplotlib.collections.LineCollection for more information - -# Make a sequence of x,y pairs -line_segments = LineCollection([list(zip(x, y)) for y in ys], - linewidths=(0.5, 1, 1.5, 2), - linestyles='solid') -line_segments.set_array(x) -ax.add_collection(line_segments) -fig = plt.gcf() -axcb = fig.colorbar(line_segments) -axcb.set_label('Line Number') -ax.set_title('Line Collection with mapped colors') -plt.sci(line_segments) # This allows interactive changing of the colormap. -plt.show() diff --git a/mpl_examples/pylab_examples/load_converter.hires.png b/mpl_examples/pylab_examples/load_converter.hires.png deleted file mode 100644 index 16e15ba3a9e..00000000000 Binary files a/mpl_examples/pylab_examples/load_converter.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/load_converter.pdf b/mpl_examples/pylab_examples/load_converter.pdf deleted file mode 100644 index c1ab75eeb65..00000000000 Binary files a/mpl_examples/pylab_examples/load_converter.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/load_converter.png b/mpl_examples/pylab_examples/load_converter.png deleted file mode 100644 index 34e180f9c2c..00000000000 Binary files a/mpl_examples/pylab_examples/load_converter.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/load_converter.py b/mpl_examples/pylab_examples/load_converter.py deleted file mode 100644 index faf8f4d785e..00000000000 --- a/mpl_examples/pylab_examples/load_converter.py +++ /dev/null @@ -1,19 +0,0 @@ -from __future__ import print_function -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.cbook as cbook -import matplotlib.dates as mdates -from matplotlib.dates import bytespdate2num - -datafile = cbook.get_sample_data('msft.csv', asfileobj=False) -print('loading', datafile) - -dates, closes = np.loadtxt(datafile, delimiter=',', - converters={0: bytespdate2num('%d-%b-%y')}, - skiprows=1, usecols=(0, 2), unpack=True) - -fig = plt.figure() -ax = fig.add_subplot(111) -ax.plot_date(dates, closes, '-') -fig.autofmt_xdate() -plt.show() diff --git a/mpl_examples/pylab_examples/loadrec.hires.png b/mpl_examples/pylab_examples/loadrec.hires.png deleted file mode 100644 index 1eef870d941..00000000000 Binary files a/mpl_examples/pylab_examples/loadrec.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/loadrec.pdf b/mpl_examples/pylab_examples/loadrec.pdf deleted file mode 100644 index 3479c7c1590..00000000000 Binary files a/mpl_examples/pylab_examples/loadrec.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/loadrec.png b/mpl_examples/pylab_examples/loadrec.png deleted file mode 100644 index 86e9ff15bd9..00000000000 Binary files a/mpl_examples/pylab_examples/loadrec.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/loadrec.py b/mpl_examples/pylab_examples/loadrec.py deleted file mode 100644 index 2174cc7841b..00000000000 --- a/mpl_examples/pylab_examples/loadrec.py +++ /dev/null @@ -1,23 +0,0 @@ -from __future__ import print_function -from matplotlib import mlab -import matplotlib.pyplot as plt -import matplotlib.cbook as cbook - -datafile = cbook.get_sample_data('msft.csv', asfileobj=False) -print('loading', datafile) -a = mlab.csv2rec(datafile) -a.sort() -print(a.dtype) - -fig = plt.figure() -ax = fig.add_subplot(111) -ax.plot(a.date, a.adj_close, '-') -fig.autofmt_xdate() - -# if you have xlwt installed, you can output excel -try: - import mpl_toolkits.exceltools as exceltools - exceltools.rec2excel(a, 'test.xls') -except ImportError: - pass -plt.show() diff --git a/mpl_examples/pylab_examples/log_bar.hires.png b/mpl_examples/pylab_examples/log_bar.hires.png deleted file mode 100644 index 1be669e2006..00000000000 Binary files a/mpl_examples/pylab_examples/log_bar.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/log_bar.pdf b/mpl_examples/pylab_examples/log_bar.pdf deleted file mode 100644 index 59a22f780c5..00000000000 Binary files a/mpl_examples/pylab_examples/log_bar.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/log_bar.png b/mpl_examples/pylab_examples/log_bar.png deleted file mode 100644 index e0502a3a968..00000000000 Binary files a/mpl_examples/pylab_examples/log_bar.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/log_bar.py b/mpl_examples/pylab_examples/log_bar.py deleted file mode 100644 index 40c11c49d70..00000000000 --- a/mpl_examples/pylab_examples/log_bar.py +++ /dev/null @@ -1,22 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - -data = ((3, 1000), (10, 3), (100, 30), (500, 800), (50, 1)) - -plt.xlabel("FOO") -plt.ylabel("FOO") -plt.title("Testing") -plt.yscale('log') - -dim = len(data[0]) -w = 0.75 -dimw = w / dim - -x = np.arange(len(data)) -for i in range(len(data[0])): - y = [d[i] for d in data] - b = plt.bar(x + i * dimw, y, dimw, bottom=0.001) - -plt.xticks(x + dimw / 2, map(str, x)) - -plt.show() diff --git a/mpl_examples/pylab_examples/log_demo.hires.png b/mpl_examples/pylab_examples/log_demo.hires.png deleted file mode 100644 index f86069b165b..00000000000 Binary files a/mpl_examples/pylab_examples/log_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/log_demo.pdf b/mpl_examples/pylab_examples/log_demo.pdf deleted file mode 100644 index 6f28479c550..00000000000 Binary files a/mpl_examples/pylab_examples/log_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/log_demo.png b/mpl_examples/pylab_examples/log_demo.png deleted file mode 100644 index c7c22d0d312..00000000000 Binary files a/mpl_examples/pylab_examples/log_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/log_demo.py b/mpl_examples/pylab_examples/log_demo.py deleted file mode 100644 index eeb30f36583..00000000000 --- a/mpl_examples/pylab_examples/log_demo.py +++ /dev/null @@ -1,38 +0,0 @@ - -import numpy as np -import matplotlib.pyplot as plt - -plt.subplots_adjust(hspace=0.4) -t = np.arange(0.01, 20.0, 0.01) - -# log y axis -plt.subplot(221) -plt.semilogy(t, np.exp(-t/5.0)) -plt.title('semilogy') -plt.grid(True) - -# log x axis -plt.subplot(222) -plt.semilogx(t, np.sin(2*np.pi*t)) -plt.title('semilogx') -plt.grid(True) - -# log x and y axis -plt.subplot(223) -plt.loglog(t, 20*np.exp(-t/10.0), basex=2) -plt.grid(True) -plt.title('loglog base 2 on x') - -# with errorbars: clip non-positive values -ax = plt.subplot(224) -ax.set_xscale("log", nonposx='clip') -ax.set_yscale("log", nonposy='clip') - -x = 10.0**np.linspace(0.0, 2.0, 20) -y = x**2.0 -plt.errorbar(x, y, xerr=0.1*x, yerr=5.0 + 0.75*y) -ax.set_ylim(ymin=0.1) -ax.set_title('Errorbars go negative') - - -plt.show() diff --git a/mpl_examples/pylab_examples/log_test.hires.png b/mpl_examples/pylab_examples/log_test.hires.png deleted file mode 100644 index 200d106d559..00000000000 Binary files a/mpl_examples/pylab_examples/log_test.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/log_test.pdf b/mpl_examples/pylab_examples/log_test.pdf deleted file mode 100644 index a31c721f60d..00000000000 Binary files a/mpl_examples/pylab_examples/log_test.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/log_test.png b/mpl_examples/pylab_examples/log_test.png deleted file mode 100644 index 04f14d804fc..00000000000 Binary files a/mpl_examples/pylab_examples/log_test.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/log_test.py b/mpl_examples/pylab_examples/log_test.py deleted file mode 100644 index 0aa2a410ee8..00000000000 --- a/mpl_examples/pylab_examples/log_test.py +++ /dev/null @@ -1,10 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - -dt = 0.01 -t = np.arange(dt, 20.0, dt) - -plt.semilogx(t, np.exp(-t/5.0)) -plt.grid(True) - -plt.show() diff --git a/mpl_examples/pylab_examples/logo.hires.png b/mpl_examples/pylab_examples/logo.hires.png deleted file mode 100644 index 2566d2544c0..00000000000 Binary files a/mpl_examples/pylab_examples/logo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/logo.pdf b/mpl_examples/pylab_examples/logo.pdf deleted file mode 100644 index a5351364c80..00000000000 Binary files a/mpl_examples/pylab_examples/logo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/logo.png b/mpl_examples/pylab_examples/logo.png deleted file mode 100644 index 12032fdfb29..00000000000 Binary files a/mpl_examples/pylab_examples/logo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/logo.py b/mpl_examples/pylab_examples/logo.py deleted file mode 100644 index 2c65e55581c..00000000000 --- a/mpl_examples/pylab_examples/logo.py +++ /dev/null @@ -1,30 +0,0 @@ -# This file generates an old version of the matplotlib logo - -from __future__ import print_function -# Above import not necessary for Python 3 onwards. Recommend taking this -# out in examples in the future, since we should all move to Python 3. -import matplotlib.pyplot as plt -import numpy as np -import matplotlib.cbook as cbook - -# convert data to mV -datafile = cbook.get_sample_data('membrane.dat', asfileobj=False) -print('loading', datafile) - -x = 1000 * 0.1 * np.fromstring(open(datafile, 'rb').read(), np.float32) -# 0.0005 is the sample interval -t = 0.0005 * np.arange(len(x)) -plt.figure(1, figsize=(7, 1), dpi=100) -ax = plt.subplot(111, facecolor='y') -plt.plot(t, x) -plt.text(0.5, 0.5, 'matplotlib', color='r', - fontsize=40, fontname=['Courier', 'DejaVu Sans Mono'], - horizontalalignment='center', - verticalalignment='center', - transform=ax.transAxes, - ) -plt.axis([1, 1.72, -60, 10]) -plt.gca().set_xticklabels([]) -plt.gca().set_yticklabels([]) - -plt.show() diff --git a/mpl_examples/pylab_examples/major_minor_demo1.hires.png b/mpl_examples/pylab_examples/major_minor_demo1.hires.png deleted file mode 100644 index 047dbf54cfc..00000000000 Binary files a/mpl_examples/pylab_examples/major_minor_demo1.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/major_minor_demo1.pdf b/mpl_examples/pylab_examples/major_minor_demo1.pdf deleted file mode 100644 index 253f719141a..00000000000 Binary files a/mpl_examples/pylab_examples/major_minor_demo1.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/major_minor_demo1.png b/mpl_examples/pylab_examples/major_minor_demo1.png deleted file mode 100644 index 8ae969208f3..00000000000 Binary files a/mpl_examples/pylab_examples/major_minor_demo1.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/major_minor_demo1.py b/mpl_examples/pylab_examples/major_minor_demo1.py deleted file mode 100644 index df5e887ffd4..00000000000 --- a/mpl_examples/pylab_examples/major_minor_demo1.py +++ /dev/null @@ -1,53 +0,0 @@ -""" -Demonstrate how to use major and minor tickers. - -The two relevant userland classes are Locators and Formatters. -Locators determine where the ticks are and formatters control the -formatting of ticks. - -Minor ticks are off by default (NullLocator and NullFormatter). You -can turn minor ticks on w/o labels by setting the minor locator. You -can also turn labeling on for the minor ticker by setting the minor -formatter - -Make a plot with major ticks that are multiples of 20 and minor ticks -that are multiples of 5. Label major ticks with %d formatting but -don't label minor ticks - -The MultipleLocator ticker class is used to place ticks on multiples of -some base. The FormatStrFormatter uses a string format string (e.g., -'%d' or '%1.2f' or '%1.1f cm' ) to format the tick - -The pyplot interface grid command changes the grid settings of the -major ticks of the y and y axis together. If you want to control the -grid of the minor ticks for a given axis, use for example - - ax.xaxis.grid(True, which='minor') - -Note, you should not use the same locator between different Axis -because the locator stores references to the Axis data and view limits - -""" - -import matplotlib.pyplot as plt -import numpy as np -from matplotlib.ticker import MultipleLocator, FormatStrFormatter - -majorLocator = MultipleLocator(20) -majorFormatter = FormatStrFormatter('%d') -minorLocator = MultipleLocator(5) - - -t = np.arange(0.0, 100.0, 0.1) -s = np.sin(0.1*np.pi*t)*np.exp(-t*0.01) - -fig, ax = plt.subplots() -plt.plot(t, s) - -ax.xaxis.set_major_locator(majorLocator) -ax.xaxis.set_major_formatter(majorFormatter) - -# for the minor ticks, use no labels; default NullFormatter -ax.xaxis.set_minor_locator(minorLocator) - -plt.show() diff --git a/mpl_examples/pylab_examples/major_minor_demo2.hires.png b/mpl_examples/pylab_examples/major_minor_demo2.hires.png deleted file mode 100644 index 74a5618be0a..00000000000 Binary files a/mpl_examples/pylab_examples/major_minor_demo2.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/major_minor_demo2.pdf b/mpl_examples/pylab_examples/major_minor_demo2.pdf deleted file mode 100644 index 30e4452e875..00000000000 Binary files a/mpl_examples/pylab_examples/major_minor_demo2.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/major_minor_demo2.png b/mpl_examples/pylab_examples/major_minor_demo2.png deleted file mode 100644 index 088bf3628f8..00000000000 Binary files a/mpl_examples/pylab_examples/major_minor_demo2.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/major_minor_demo2.py b/mpl_examples/pylab_examples/major_minor_demo2.py deleted file mode 100644 index 1bdfefabdb9..00000000000 --- a/mpl_examples/pylab_examples/major_minor_demo2.py +++ /dev/null @@ -1,33 +0,0 @@ -""" -Automatic tick selection for major and minor ticks. - -Use interactive pan and zoom to see how the tick intervals -change. There will be either 4 or 5 minor tick intervals -per major interval, depending on the major interval. -""" - -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.ticker import AutoMinorLocator - -# One can supply an argument to AutoMinorLocator to -# specify a fixed number of minor intervals per major interval, e.g.: -# minorLocator = AutoMinorLocator(2) -# would lead to a single minor tick between major ticks. - -minorLocator = AutoMinorLocator() - - -t = np.arange(0.0, 100.0, 0.01) -s = np.sin(2*np.pi*t)*np.exp(-t*0.01) - -fig, ax = plt.subplots() -plt.plot(t, s) - -ax.xaxis.set_minor_locator(minorLocator) - -plt.tick_params(which='both', width=2) -plt.tick_params(which='major', length=7) -plt.tick_params(which='minor', length=4, color='r') - -plt.show() diff --git a/mpl_examples/pylab_examples/manual_axis.hires.png b/mpl_examples/pylab_examples/manual_axis.hires.png deleted file mode 100644 index 0c3e7d58954..00000000000 Binary files a/mpl_examples/pylab_examples/manual_axis.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/manual_axis.pdf b/mpl_examples/pylab_examples/manual_axis.pdf deleted file mode 100644 index a6d21d7a33b..00000000000 Binary files a/mpl_examples/pylab_examples/manual_axis.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/manual_axis.png b/mpl_examples/pylab_examples/manual_axis.png deleted file mode 100644 index 11501e5ed4c..00000000000 Binary files a/mpl_examples/pylab_examples/manual_axis.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/manual_axis.py b/mpl_examples/pylab_examples/manual_axis.py deleted file mode 100644 index f1f8b2aedc5..00000000000 --- a/mpl_examples/pylab_examples/manual_axis.py +++ /dev/null @@ -1,58 +0,0 @@ -""" -The techniques here are no longer required with the new support for -spines in matplotlib -- see -http://matplotlib.org/examples/pylab_examples/spine_placement_demo.html. - -This example should be considered deprecated and is left just for demo -purposes for folks wanting to make a pseudo-axis -""" - -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.lines as lines - - -def make_xaxis(ax, yloc, offset=0.05, **props): - xmin, xmax = ax.get_xlim() - locs = [loc for loc in ax.xaxis.get_majorticklocs() - if loc >= xmin and loc <= xmax] - tickline, = ax.plot(locs, [yloc]*len(locs), linestyle='', - marker=lines.TICKDOWN, **props) - axline, = ax.plot([xmin, xmax], [yloc, yloc], **props) - tickline.set_clip_on(False) - axline.set_clip_on(False) - for loc in locs: - ax.text(loc, yloc - offset, '%1.1f' % loc, - horizontalalignment='center', - verticalalignment='top') - - -def make_yaxis(ax, xloc=0, offset=0.05, **props): - ymin, ymax = ax.get_ylim() - locs = [loc for loc in ax.yaxis.get_majorticklocs() - if loc >= ymin and loc <= ymax] - tickline, = ax.plot([xloc]*len(locs), locs, linestyle='', - marker=lines.TICKLEFT, **props) - axline, = ax.plot([xloc, xloc], [ymin, ymax], **props) - tickline.set_clip_on(False) - axline.set_clip_on(False) - - for loc in locs: - ax.text(xloc - offset, loc, '%1.1f' % loc, - verticalalignment='center', - horizontalalignment='right') - - -props = dict(color='black', linewidth=2, markeredgewidth=2) -x = np.arange(200.) -y = np.sin(2*np.pi*x/200.) + np.random.rand(200) - 0.5 -fig = plt.figure(facecolor='white') -ax = fig.add_subplot(111, frame_on=False) -ax.axison = False -ax.plot(x, y, 'd', markersize=8, markerfacecolor='blue') -ax.set_xlim(0, 200) -ax.set_ylim(-1.5, 1.5) -make_xaxis(ax, 0, offset=0.1, **props) -make_yaxis(ax, 0, offset=5, **props) - -plt.show() diff --git a/mpl_examples/pylab_examples/marker_path.hires.png b/mpl_examples/pylab_examples/marker_path.hires.png deleted file mode 100644 index 8aed146b86b..00000000000 Binary files a/mpl_examples/pylab_examples/marker_path.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/marker_path.pdf b/mpl_examples/pylab_examples/marker_path.pdf deleted file mode 100644 index b6e57574a1c..00000000000 Binary files a/mpl_examples/pylab_examples/marker_path.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/marker_path.png b/mpl_examples/pylab_examples/marker_path.png deleted file mode 100644 index 01d7a215aa6..00000000000 Binary files a/mpl_examples/pylab_examples/marker_path.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/marker_path.py b/mpl_examples/pylab_examples/marker_path.py deleted file mode 100644 index ac18d133513..00000000000 --- a/mpl_examples/pylab_examples/marker_path.py +++ /dev/null @@ -1,16 +0,0 @@ -import matplotlib.pyplot as plt -import matplotlib.path as mpath -import numpy as np - - -star = mpath.Path.unit_regular_star(6) -circle = mpath.Path.unit_circle() -# concatenate the circle with an internal cutout of the star -verts = np.concatenate([circle.vertices, star.vertices[::-1, ...]]) -codes = np.concatenate([circle.codes, star.codes]) -cut_star = mpath.Path(verts, codes) - - -plt.plot(np.arange(10)**2, '--r', marker=cut_star, markersize=15) - -plt.show() diff --git a/mpl_examples/pylab_examples/markevery_demo.py b/mpl_examples/pylab_examples/markevery_demo.py deleted file mode 100644 index 7136472dba0..00000000000 --- a/mpl_examples/pylab_examples/markevery_demo.py +++ /dev/null @@ -1,98 +0,0 @@ -""" -This example demonstrates the various options for showing a marker at a -subset of data points using the `markevery` property of a Line2D object. - -Integer arguments are fairly intuitive. e.g. `markevery`=5 will plot every -5th marker starting from the first data point. - -Float arguments allow markers to be spaced at approximately equal distances -along the line. The theoretical distance along the line between markers is -determined by multiplying the display-coordinate distance of the axes -bounding-box diagonal by the value of `markevery`. The data points closest -to the theoretical distances will be shown. - -A slice or list/array can also be used with `markevery` to specify the markers -to show. - -""" - -from __future__ import division -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.gridspec as gridspec - -# define a list of markevery cases to plot -cases = [None, - 8, - (30, 8), - [16, 24, 30], [0, -1], - slice(100, 200, 3), - 0.1, 0.3, 1.5, - (0.0, 0.1), (0.45, 0.1)] - -# define the figure size and grid layout properties -figsize = (10, 8) -cols = 3 -gs = gridspec.GridSpec(len(cases) // cols + 1, cols) - -# define the data for cartesian plots -delta = 0.11 -x = np.linspace(0, 10 - 2 * delta, 200) + delta -y = np.sin(x) + 1.0 + delta - -# plot each markevery case for linear x and y scales -fig1 = plt.figure(num=1, figsize=figsize) -ax = [] -for i, case in enumerate(cases): - row = (i // cols) - col = i % cols - ax.append(fig1.add_subplot(gs[row, col])) - ax[-1].set_title('markevery=%s' % str(case)) - ax[-1].plot(x, y, 'o', ls='-', ms=4, markevery=case) -#fig1.tight_layout() - -# plot each markevery case for log x and y scales -fig2 = plt.figure(num=2, figsize=figsize) -axlog = [] -for i, case in enumerate(cases): - row = (i // cols) - col = i % cols - axlog.append(fig2.add_subplot(gs[row, col])) - axlog[-1].set_title('markevery=%s' % str(case)) - axlog[-1].set_xscale('log') - axlog[-1].set_yscale('log') - axlog[-1].plot(x, y, 'o', ls='-', ms=4, markevery=case) -fig2.tight_layout() - -# plot each markevery case for linear x and y scales but zoomed in -# note the behaviour when zoomed in. When a start marker offset is specified -# it is always interpreted with respect to the first data point which might be -# different to the first visible data point. -fig3 = plt.figure(num=3, figsize=figsize) -axzoom = [] -for i, case in enumerate(cases): - row = (i // cols) - col = i % cols - axzoom.append(fig3.add_subplot(gs[row, col])) - axzoom[-1].set_title('markevery=%s' % str(case)) - axzoom[-1].plot(x, y, 'o', ls='-', ms=4, markevery=case) - axzoom[-1].set_xlim((6, 6.7)) - axzoom[-1].set_ylim((1.1, 1.7)) -fig3.tight_layout() - -# define data for polar plots -r = np.linspace(0, 3.0, 200) -theta = 2 * np.pi * r - -# plot each markevery case for polar plots -fig4 = plt.figure(num=4, figsize=figsize) -axpolar = [] -for i, case in enumerate(cases): - row = (i // cols) - col = i % cols - axpolar.append(fig4.add_subplot(gs[row, col], projection='polar')) - axpolar[-1].set_title('markevery=%s' % str(case)) - axpolar[-1].plot(theta, r, 'o', ls='-', ms=4, markevery=case) -fig4.tight_layout() - -plt.show() diff --git a/mpl_examples/pylab_examples/markevery_demo_00.hires.png b/mpl_examples/pylab_examples/markevery_demo_00.hires.png deleted file mode 100644 index 0ff9849b922..00000000000 Binary files a/mpl_examples/pylab_examples/markevery_demo_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/markevery_demo_00.pdf b/mpl_examples/pylab_examples/markevery_demo_00.pdf deleted file mode 100644 index 0b87a921290..00000000000 Binary files a/mpl_examples/pylab_examples/markevery_demo_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/markevery_demo_00.png b/mpl_examples/pylab_examples/markevery_demo_00.png deleted file mode 100644 index 356ff6e905b..00000000000 Binary files a/mpl_examples/pylab_examples/markevery_demo_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/markevery_demo_01.hires.png b/mpl_examples/pylab_examples/markevery_demo_01.hires.png deleted file mode 100644 index 2144f638642..00000000000 Binary files a/mpl_examples/pylab_examples/markevery_demo_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/markevery_demo_01.pdf b/mpl_examples/pylab_examples/markevery_demo_01.pdf deleted file mode 100644 index f40f9e9b509..00000000000 Binary files a/mpl_examples/pylab_examples/markevery_demo_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/markevery_demo_01.png b/mpl_examples/pylab_examples/markevery_demo_01.png deleted file mode 100644 index 4adefefb50a..00000000000 Binary files a/mpl_examples/pylab_examples/markevery_demo_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/markevery_demo_02.hires.png b/mpl_examples/pylab_examples/markevery_demo_02.hires.png deleted file mode 100644 index 333ea74a3c2..00000000000 Binary files a/mpl_examples/pylab_examples/markevery_demo_02.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/markevery_demo_02.pdf b/mpl_examples/pylab_examples/markevery_demo_02.pdf deleted file mode 100644 index 40c32aaa360..00000000000 Binary files a/mpl_examples/pylab_examples/markevery_demo_02.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/markevery_demo_02.png b/mpl_examples/pylab_examples/markevery_demo_02.png deleted file mode 100644 index 352d50a89c3..00000000000 Binary files a/mpl_examples/pylab_examples/markevery_demo_02.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/markevery_demo_03.hires.png b/mpl_examples/pylab_examples/markevery_demo_03.hires.png deleted file mode 100644 index ae3cfb4dd52..00000000000 Binary files a/mpl_examples/pylab_examples/markevery_demo_03.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/markevery_demo_03.pdf b/mpl_examples/pylab_examples/markevery_demo_03.pdf deleted file mode 100644 index f50f8f12af5..00000000000 Binary files a/mpl_examples/pylab_examples/markevery_demo_03.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/markevery_demo_03.png b/mpl_examples/pylab_examples/markevery_demo_03.png deleted file mode 100644 index 44fa02de85a..00000000000 Binary files a/mpl_examples/pylab_examples/markevery_demo_03.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/masked_demo.hires.png b/mpl_examples/pylab_examples/masked_demo.hires.png deleted file mode 100644 index 7ec8b16557f..00000000000 Binary files a/mpl_examples/pylab_examples/masked_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/masked_demo.pdf b/mpl_examples/pylab_examples/masked_demo.pdf deleted file mode 100644 index a4ffdb32164..00000000000 Binary files a/mpl_examples/pylab_examples/masked_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/masked_demo.png b/mpl_examples/pylab_examples/masked_demo.png deleted file mode 100644 index 9bed299e36d..00000000000 Binary files a/mpl_examples/pylab_examples/masked_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/masked_demo.py b/mpl_examples/pylab_examples/masked_demo.py deleted file mode 100644 index f349aadb5ab..00000000000 --- a/mpl_examples/pylab_examples/masked_demo.py +++ /dev/null @@ -1,26 +0,0 @@ -''' -Plot lines with points masked out. - -This would typically be used with gappy data, to -break the line at the data gaps. -''' - -import matplotlib.pyplot as plt -import numpy as np - -x = np.arange(0, 2*np.pi, 0.02) -y = np.sin(x) -y1 = np.sin(2*x) -y2 = np.sin(3*x) -ym1 = np.ma.masked_where(y1 > 0.5, y1) -ym2 = np.ma.masked_where(y2 < -0.5, y2) - -lines = plt.plot(x, y, x, ym1, x, ym2, 'o') -plt.setp(lines[0], linewidth=4) -plt.setp(lines[1], linewidth=2) -plt.setp(lines[2], markersize=10) - -plt.legend(('No mask', 'Masked if > 0.5', 'Masked if < -0.5'), - loc='upper right') -plt.title('Masked line demo') -plt.show() diff --git a/mpl_examples/pylab_examples/mathtext_demo.hires.png b/mpl_examples/pylab_examples/mathtext_demo.hires.png deleted file mode 100644 index 6dbcf6d13d0..00000000000 Binary files a/mpl_examples/pylab_examples/mathtext_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/mathtext_demo.pdf b/mpl_examples/pylab_examples/mathtext_demo.pdf deleted file mode 100644 index 7f087d47e26..00000000000 Binary files a/mpl_examples/pylab_examples/mathtext_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/mathtext_demo.png b/mpl_examples/pylab_examples/mathtext_demo.png deleted file mode 100644 index f303d3d518b..00000000000 Binary files a/mpl_examples/pylab_examples/mathtext_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/mathtext_demo.py b/mpl_examples/pylab_examples/mathtext_demo.py deleted file mode 100644 index 085d557cddd..00000000000 --- a/mpl_examples/pylab_examples/mathtext_demo.py +++ /dev/null @@ -1,26 +0,0 @@ -""" -Use matplotlib's internal LaTeX parser and layout engine. For true -latex rendering, see the text.usetex option -""" -import numpy as np -from matplotlib.pyplot import figure, show - -fig = figure() -fig.subplots_adjust(bottom=0.2) - -ax = fig.add_subplot(111) -ax.plot([1, 2, 3], 'r') -x = np.arange(0.0, 3.0, 0.1) - -ax.grid(True) -ax.set_xlabel(r'$\Delta_i^j$', fontsize=20) -ax.set_ylabel(r'$\Delta_{i+1}^j$', fontsize=20) -tex = r'$\mathcal{R}\prod_{i=\alpha_{i+1}}^\infty a_i\sin(2 \pi f x_i)$' - -ax.text(1, 1.6, tex, fontsize=20, va='bottom') - -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) - -show() diff --git a/mpl_examples/pylab_examples/mathtext_examples.py b/mpl_examples/pylab_examples/mathtext_examples.py deleted file mode 100644 index bee528de214..00000000000 --- a/mpl_examples/pylab_examples/mathtext_examples.py +++ /dev/null @@ -1,125 +0,0 @@ -""" -Selected features of Matplotlib's math rendering engine. -""" -from __future__ import print_function -import matplotlib.pyplot as plt -import os -import sys -import re -import gc - -# Selection of features following "Writing mathematical expressions" tutorial -mathtext_titles = { - 0: "Header demo", - 1: "Subscripts and superscripts", - 2: "Fractions, binomials and stacked numbers", - 3: "Radicals", - 4: "Fonts", - 5: "Accents", - 6: "Greek, Hebrew", - 7: "Delimiters, functions and Symbols"} -n_lines = len(mathtext_titles) - -# Randomly picked examples -mathext_demos = { - 0: r"$W^{3\beta}_{\delta_1 \rho_1 \sigma_2} = " - r"U^{3\beta}_{\delta_1 \rho_1} + \frac{1}{8 \pi 2} " - r"\int^{\alpha_2}_{\alpha_2} d \alpha^\prime_2 \left[\frac{ " - r"U^{2\beta}_{\delta_1 \rho_1} - \alpha^\prime_2U^{1\beta}_" - r"{\rho_1 \sigma_2} }{U^{0\beta}_{\rho_1 \sigma_2}}\right]$", - - 1: r"$\alpha_i > \beta_i,\ " - r"\alpha_{i+1}^j = {\rm sin}(2\pi f_j t_i) e^{-5 t_i/\tau},\ " - r"\ldots$", - - 2: r"$\frac{3}{4},\ \binom{3}{4},\ \stackrel{3}{4},\ " - r"\left(\frac{5 - \frac{1}{x}}{4}\right),\ \ldots$", - - 3: r"$\sqrt{2},\ \sqrt[3]{x},\ \ldots$", - - 4: r"$\mathrm{Roman}\ , \ \mathit{Italic}\ , \ \mathtt{Typewriter} \ " - r"\mathrm{or}\ \mathcal{CALLIGRAPHY}$", - - 5: r"$\acute a,\ \bar a,\ \breve a,\ \dot a,\ \ddot a, \ \grave a, \ " - r"\hat a,\ \tilde a,\ \vec a,\ \widehat{xyz},\ \widetilde{xyz},\ " - r"\ldots$", - - 6: r"$\alpha,\ \beta,\ \chi,\ \delta,\ \lambda,\ \mu,\ " - r"\Delta,\ \Gamma,\ \Omega,\ \Phi,\ \Pi,\ \Upsilon,\ \nabla,\ " - r"\aleph,\ \beth,\ \daleth,\ \gimel,\ \ldots$", - - 7: r"$\coprod,\ \int,\ \oint,\ \prod,\ \sum,\ " - r"\log,\ \sin,\ \approx,\ \oplus,\ \star,\ \varpropto,\ " - r"\infty,\ \partial,\ \Re,\ \leftrightsquigarrow, \ \ldots$"} - - -def doall(): - # Colors used in mpl online documentation. - mpl_blue_rvb = (191./255., 209./256., 212./255.) - mpl_orange_rvb = (202/255., 121/256., 0./255.) - mpl_grey_rvb = (51./255., 51./255., 51./255.) - - # Creating figure and axis. - plt.figure(figsize=(6, 7)) - plt.axes([0.01, 0.01, 0.98, 0.90], facecolor="white", frameon=True) - plt.gca().set_xlim(0., 1.) - plt.gca().set_ylim(0., 1.) - plt.gca().set_title("Matplotlib's math rendering engine", - color=mpl_grey_rvb, fontsize=14, weight='bold') - plt.gca().set_xticklabels("", visible=False) - plt.gca().set_yticklabels("", visible=False) - - # Gap between lines in axes coords - line_axesfrac = (1. / (n_lines)) - - # Plotting header demonstration formula - full_demo = mathext_demos[0] - plt.annotate(full_demo, - xy=(0.5, 1. - 0.59*line_axesfrac), - xycoords='data', color=mpl_orange_rvb, ha='center', - fontsize=20) - - # Plotting features demonstration formulae - for i_line in range(1, n_lines): - baseline = 1. - (i_line)*line_axesfrac - baseline_next = baseline - line_axesfrac*1. - title = mathtext_titles[i_line] + ":" - fill_color = ['white', mpl_blue_rvb][i_line % 2] - plt.fill_between([0., 1.], [baseline, baseline], - [baseline_next, baseline_next], - color=fill_color, alpha=0.5) - plt.annotate(title, - xy=(0.07, baseline - 0.3*line_axesfrac), - xycoords='data', color=mpl_grey_rvb, weight='bold') - demo = mathext_demos[i_line] - plt.annotate(demo, - xy=(0.05, baseline - 0.75*line_axesfrac), - xycoords='data', color=mpl_grey_rvb, - fontsize=16) - - for i in range(n_lines): - s = mathext_demos[i] - print(i, s) - plt.show() - -if '--latex' in sys.argv: - # Run: python mathtext_examples.py --latex - # Need amsmath and amssymb packages. - fd = open("mathtext_examples.ltx", "w") - fd.write("\\documentclass{article}\n") - fd.write("\\usepackage{amsmath, amssymb}\n") - fd.write("\\begin{document}\n") - fd.write("\\begin{enumerate}\n") - - for i in range(n_lines): - s = mathext_demos[i] - s = re.sub(r"(? 0: - a.set_xticklabels([]) - # Make some fake data with a range that varies - # somewhat from one plot to the next. - data = ((1 + i + j)/10.0)*rand(10, 20)*1e-6 - dd = ravel(data) - # Manually find the min and max of all colors for - # use in setting the color scale. - vmin = min(vmin, amin(dd)) - vmax = max(vmax, amax(dd)) - images.append(a.imshow(data, cmap=cmap)) - - ax.append(a) - -# Set the first image as the master, with all the others -# observing it for changes in cmap or norm. - - -class ImageFollower(object): - 'update image in response to changes in clim or cmap on another image' - - def __init__(self, follower): - self.follower = follower - - def __call__(self, leader): - self.follower.set_cmap(leader.get_cmap()) - self.follower.set_clim(leader.get_clim()) - -norm = colors.Normalize(vmin=vmin, vmax=vmax) -for i, im in enumerate(images): - im.set_norm(norm) - if i > 0: - images[0].callbacksSM.connect('changed', ImageFollower(im)) - -# The colorbar is also based on this master image. -fig.colorbar(images[0], cax, orientation='horizontal') - -# We need the following only if we want to run this interactively and -# modify the colormap: - -axes(ax[0]) # Return the current axes to the first one, -sci(images[0]) # because the current image must be in current axes. - -show() diff --git a/mpl_examples/pylab_examples/multicolored_line.py b/mpl_examples/pylab_examples/multicolored_line.py deleted file mode 100644 index 386cea0a438..00000000000 --- a/mpl_examples/pylab_examples/multicolored_line.py +++ /dev/null @@ -1,53 +0,0 @@ -''' -Color parts of a line based on its properties, e.g., slope. -''' - -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.collections import LineCollection -from matplotlib.colors import ListedColormap, BoundaryNorm - -x = np.linspace(0, 3 * np.pi, 500) -y = np.sin(x) -z = np.cos(0.5 * (x[:-1] + x[1:])) # first derivative - -# Create a colormap for red, green and blue and a norm to color -# f' < -0.5 red, f' > 0.5 blue, and the rest green -cmap = ListedColormap(['r', 'g', 'b']) -norm = BoundaryNorm([-1, -0.5, 0.5, 1], cmap.N) - -# Create a set of line segments so that we can color them individually -# This creates the points as a N x 1 x 2 array so that we can stack points -# together easily to get the segments. The segments array for line collection -# needs to be numlines x points per line x 2 (x and y) -points = np.array([x, y]).T.reshape(-1, 1, 2) -segments = np.concatenate([points[:-1], points[1:]], axis=1) - -# Create the line collection object, setting the colormapping parameters. -# Have to set the actual values used for colormapping separately. -lc = LineCollection(segments, cmap=cmap, norm=norm) -lc.set_array(z) -lc.set_linewidth(3) - -fig1 = plt.figure() -plt.gca().add_collection(lc) -plt.xlim(x.min(), x.max()) -plt.ylim(-1.1, 1.1) - -# Now do a second plot coloring the curve using a continuous colormap -t = np.linspace(0, 10, 200) -x = np.cos(np.pi * t) -y = np.sin(t) -points = np.array([x, y]).T.reshape(-1, 1, 2) -segments = np.concatenate([points[:-1], points[1:]], axis=1) - -lc = LineCollection(segments, cmap=plt.get_cmap('copper'), - norm=plt.Normalize(0, 10)) -lc.set_array(t) -lc.set_linewidth(3) - -fig2 = plt.figure() -plt.gca().add_collection(lc) -plt.xlim(-1, 1) -plt.ylim(-1, 1) -plt.show() diff --git a/mpl_examples/pylab_examples/multicolored_line_00.hires.png b/mpl_examples/pylab_examples/multicolored_line_00.hires.png deleted file mode 100644 index e10914c78e1..00000000000 Binary files a/mpl_examples/pylab_examples/multicolored_line_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/multicolored_line_00.pdf b/mpl_examples/pylab_examples/multicolored_line_00.pdf deleted file mode 100644 index b61aae64bb5..00000000000 Binary files a/mpl_examples/pylab_examples/multicolored_line_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/multicolored_line_00.png b/mpl_examples/pylab_examples/multicolored_line_00.png deleted file mode 100644 index 9b23844e1cb..00000000000 Binary files a/mpl_examples/pylab_examples/multicolored_line_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/multicolored_line_01.hires.png b/mpl_examples/pylab_examples/multicolored_line_01.hires.png deleted file mode 100644 index 6e3b5212054..00000000000 Binary files a/mpl_examples/pylab_examples/multicolored_line_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/multicolored_line_01.pdf b/mpl_examples/pylab_examples/multicolored_line_01.pdf deleted file mode 100644 index a5f043574b4..00000000000 Binary files a/mpl_examples/pylab_examples/multicolored_line_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/multicolored_line_01.png b/mpl_examples/pylab_examples/multicolored_line_01.png deleted file mode 100644 index 2b9a549bce3..00000000000 Binary files a/mpl_examples/pylab_examples/multicolored_line_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/multiline.hires.png b/mpl_examples/pylab_examples/multiline.hires.png deleted file mode 100644 index 5118f16c34e..00000000000 Binary files a/mpl_examples/pylab_examples/multiline.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/multiline.pdf b/mpl_examples/pylab_examples/multiline.pdf deleted file mode 100644 index 319dcaa05d2..00000000000 Binary files a/mpl_examples/pylab_examples/multiline.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/multiline.png b/mpl_examples/pylab_examples/multiline.png deleted file mode 100644 index 0ab3d1faf39..00000000000 Binary files a/mpl_examples/pylab_examples/multiline.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/multiline.py b/mpl_examples/pylab_examples/multiline.py deleted file mode 100644 index 5d0d19a588a..00000000000 --- a/mpl_examples/pylab_examples/multiline.py +++ /dev/null @@ -1,40 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - -plt.figure(figsize=(7, 4)) -ax = plt.subplot(121) -ax.set_aspect(1) -plt.plot(np.arange(10)) -plt.xlabel('this is a xlabel\n(with newlines!)') -plt.ylabel('this is vertical\ntest', multialignment='center') -plt.text(2, 7, 'this is\nyet another test', - rotation=45, - horizontalalignment='center', - verticalalignment='top', - multialignment='center') - -plt.grid(True) - -plt.subplot(122) - -plt.text(0.29, 0.4, "Mat\nTTp\n123", size=18, - va="baseline", ha="right", multialignment="left", - bbox=dict(fc="none")) - -plt.text(0.34, 0.4, "Mag\nTTT\n123", size=18, - va="baseline", ha="left", multialignment="left", - bbox=dict(fc="none")) - -plt.text(0.95, 0.4, "Mag\nTTT$^{A^A}$\n123", size=18, - va="baseline", ha="right", multialignment="left", - bbox=dict(fc="none")) - -plt.xticks([0.2, 0.4, 0.6, 0.8, 1.], - ["Jan\n2009", "Feb\n2009", "Mar\n2009", "Apr\n2009", "May\n2009"]) - -plt.axhline(0.4) -plt.title("test line spacing for multiline text") - -plt.subplots_adjust(bottom=0.25, top=0.75) -plt.draw() -plt.show() diff --git a/mpl_examples/pylab_examples/multipage_pdf.py b/mpl_examples/pylab_examples/multipage_pdf.py deleted file mode 100644 index c32b73bee3e..00000000000 --- a/mpl_examples/pylab_examples/multipage_pdf.py +++ /dev/null @@ -1,45 +0,0 @@ -""" -This is a demo of creating a pdf file with several pages, -as well as adding metadata and annotations to pdf files. -""" - -import datetime -import numpy as np -from matplotlib.backends.backend_pdf import PdfPages -import matplotlib.pyplot as plt - -# Create the PdfPages object to which we will save the pages: -# The with statement makes sure that the PdfPages object is closed properly at -# the end of the block, even if an Exception occurs. -with PdfPages('multipage_pdf.pdf') as pdf: - plt.figure(figsize=(3, 3)) - plt.plot(range(7), [3, 1, 4, 1, 5, 9, 2], 'r-o') - plt.title('Page One') - pdf.savefig() # saves the current figure into a pdf page - plt.close() - - plt.rc('text', usetex=True) - plt.figure(figsize=(8, 6)) - x = np.arange(0, 5, 0.1) - plt.plot(x, np.sin(x), 'b-') - plt.title('Page Two') - pdf.attach_note("plot of sin(x)") # you can add a pdf note to - # attach metadata to a page - pdf.savefig() - plt.close() - - plt.rc('text', usetex=False) - fig = plt.figure(figsize=(4, 5)) - plt.plot(x, x*x, 'ko') - plt.title('Page Three') - pdf.savefig(fig) # or you can pass a Figure object to pdf.savefig - plt.close() - - # We can also set the file's metadata via the PdfPages object: - d = pdf.infodict() - d['Title'] = 'Multipage PDF Example' - d['Author'] = u'Jouni K. Sepp\xe4nen' - d['Subject'] = 'How to create a multipage pdf file and set its metadata' - d['Keywords'] = 'PdfPages multipage keywords author title subject' - d['CreationDate'] = datetime.datetime(2009, 11, 13) - d['ModDate'] = datetime.datetime.today() diff --git a/mpl_examples/pylab_examples/multiple_figs_demo.py b/mpl_examples/pylab_examples/multiple_figs_demo.py deleted file mode 100644 index 9097c51e4e6..00000000000 --- a/mpl_examples/pylab_examples/multiple_figs_demo.py +++ /dev/null @@ -1,25 +0,0 @@ -# Working with multiple figure windows and subplots -import matplotlib.pyplot as plt -import numpy as np - -t = np.arange(0.0, 2.0, 0.01) -s1 = np.sin(2*np.pi*t) -s2 = np.sin(4*np.pi*t) - -plt.figure(1) -plt.subplot(211) -plt.plot(t, s1) -plt.subplot(212) -plt.plot(t, 2*s1) - -plt.figure(2) -plt.plot(t, s2) - -# now switch back to figure 1 and make some changes -plt.figure(1) -plt.subplot(211) -plt.plot(t, s2, 's') -ax = plt.gca() -ax.set_xticklabels([]) - -plt.show() diff --git a/mpl_examples/pylab_examples/multiple_figs_demo_00.hires.png b/mpl_examples/pylab_examples/multiple_figs_demo_00.hires.png deleted file mode 100644 index 077741bda25..00000000000 Binary files a/mpl_examples/pylab_examples/multiple_figs_demo_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/multiple_figs_demo_00.pdf b/mpl_examples/pylab_examples/multiple_figs_demo_00.pdf deleted file mode 100644 index 9ddb11a53cd..00000000000 Binary files a/mpl_examples/pylab_examples/multiple_figs_demo_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/multiple_figs_demo_00.png b/mpl_examples/pylab_examples/multiple_figs_demo_00.png deleted file mode 100644 index ff2c58cc938..00000000000 Binary files a/mpl_examples/pylab_examples/multiple_figs_demo_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/multiple_figs_demo_01.hires.png b/mpl_examples/pylab_examples/multiple_figs_demo_01.hires.png deleted file mode 100644 index 65513a149a4..00000000000 Binary files a/mpl_examples/pylab_examples/multiple_figs_demo_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/multiple_figs_demo_01.pdf b/mpl_examples/pylab_examples/multiple_figs_demo_01.pdf deleted file mode 100644 index 72a14e48b48..00000000000 Binary files a/mpl_examples/pylab_examples/multiple_figs_demo_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/multiple_figs_demo_01.png b/mpl_examples/pylab_examples/multiple_figs_demo_01.png deleted file mode 100644 index aae4b2641e9..00000000000 Binary files a/mpl_examples/pylab_examples/multiple_figs_demo_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/multiple_yaxis_with_spines.hires.png b/mpl_examples/pylab_examples/multiple_yaxis_with_spines.hires.png deleted file mode 100644 index a12be03feef..00000000000 Binary files a/mpl_examples/pylab_examples/multiple_yaxis_with_spines.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/multiple_yaxis_with_spines.pdf b/mpl_examples/pylab_examples/multiple_yaxis_with_spines.pdf deleted file mode 100644 index c54e388f4fc..00000000000 Binary files a/mpl_examples/pylab_examples/multiple_yaxis_with_spines.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/multiple_yaxis_with_spines.png b/mpl_examples/pylab_examples/multiple_yaxis_with_spines.png deleted file mode 100644 index 78852a5554f..00000000000 Binary files a/mpl_examples/pylab_examples/multiple_yaxis_with_spines.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/multiple_yaxis_with_spines.py b/mpl_examples/pylab_examples/multiple_yaxis_with_spines.py deleted file mode 100644 index fde330ec552..00000000000 --- a/mpl_examples/pylab_examples/multiple_yaxis_with_spines.py +++ /dev/null @@ -1,54 +0,0 @@ -import matplotlib.pyplot as plt - - -def make_patch_spines_invisible(ax): - ax.set_frame_on(True) - ax.patch.set_visible(False) - for sp in ax.spines.values(): - sp.set_visible(False) - -fig, host = plt.subplots() -fig.subplots_adjust(right=0.75) - -par1 = host.twinx() -par2 = host.twinx() - -# Offset the right spine of par2. The ticks and label have already been -# placed on the right by twinx above. -par2.spines["right"].set_position(("axes", 1.2)) -# Having been created by twinx, par2 has its frame off, so the line of its -# detached spine is invisible. First, activate the frame but make the patch -# and spines invisible. -make_patch_spines_invisible(par2) -# Second, show the right spine. -par2.spines["right"].set_visible(True) - -p1, = host.plot([0, 1, 2], [0, 1, 2], "b-", label="Density") -p2, = par1.plot([0, 1, 2], [0, 3, 2], "r-", label="Temperature") -p3, = par2.plot([0, 1, 2], [50, 30, 15], "g-", label="Velocity") - -host.set_xlim(0, 2) -host.set_ylim(0, 2) -par1.set_ylim(0, 4) -par2.set_ylim(1, 65) - -host.set_xlabel("Distance") -host.set_ylabel("Density") -par1.set_ylabel("Temperature") -par2.set_ylabel("Velocity") - -host.yaxis.label.set_color(p1.get_color()) -par1.yaxis.label.set_color(p2.get_color()) -par2.yaxis.label.set_color(p3.get_color()) - -tkw = dict(size=4, width=1.5) -host.tick_params(axis='y', colors=p1.get_color(), **tkw) -par1.tick_params(axis='y', colors=p2.get_color(), **tkw) -par2.tick_params(axis='y', colors=p3.get_color(), **tkw) -host.tick_params(axis='x', **tkw) - -lines = [p1, p2, p3] - -host.legend(lines, [l.get_label() for l in lines]) - -plt.show() diff --git a/mpl_examples/pylab_examples/nan_test.hires.png b/mpl_examples/pylab_examples/nan_test.hires.png deleted file mode 100644 index 67665145110..00000000000 Binary files a/mpl_examples/pylab_examples/nan_test.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/nan_test.pdf b/mpl_examples/pylab_examples/nan_test.pdf deleted file mode 100644 index 9a9a7262e56..00000000000 Binary files a/mpl_examples/pylab_examples/nan_test.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/nan_test.png b/mpl_examples/pylab_examples/nan_test.png deleted file mode 100644 index 2f4d0a314c7..00000000000 Binary files a/mpl_examples/pylab_examples/nan_test.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/nan_test.py b/mpl_examples/pylab_examples/nan_test.py deleted file mode 100644 index 5a54c928b6b..00000000000 --- a/mpl_examples/pylab_examples/nan_test.py +++ /dev/null @@ -1,29 +0,0 @@ -""" -Example: simple line plots with NaNs inserted. -""" -import numpy as np -import matplotlib.pyplot as plt - -t = np.arange(0.0, 1.0 + 0.01, 0.01) -s = np.cos(2 * 2 * np.pi * t) -t[41:60] = np.nan - -plt.subplot(2, 1, 1) -plt.plot(t, s, '-', lw=2) - -plt.xlabel('time (s)') -plt.ylabel('voltage (mV)') -plt.title('A sine wave with a gap of NaNs between 0.4 and 0.6') -plt.grid(True) - -plt.subplot(2, 1, 2) -t[0] = np.nan -t[-1] = np.nan -plt.plot(t, s, '-', lw=2) -plt.title('Also with NaN in first and last point') - -plt.xlabel('time (s)') -plt.ylabel('more nans') -plt.grid(True) - -plt.show() diff --git a/mpl_examples/pylab_examples/newscalarformatter_demo.py b/mpl_examples/pylab_examples/newscalarformatter_demo.py deleted file mode 100644 index 381ced7f3b4..00000000000 --- a/mpl_examples/pylab_examples/newscalarformatter_demo.py +++ /dev/null @@ -1,103 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np -from matplotlib.ticker import OldScalarFormatter, ScalarFormatter - -# Example 1 -x = np.arange(0, 1, .01) -fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6)) -fig.text(0.5, 0.975, 'The old formatter', - horizontalalignment='center', verticalalignment='top') -ax1.plot(x * 1e5 + 1e10, x * 1e-10 + 1e-5) -ax1.xaxis.set_major_formatter(OldScalarFormatter()) -ax1.yaxis.set_major_formatter(OldScalarFormatter()) - -ax2.plot(x * 1e5, x * 1e-4) -ax2.xaxis.set_major_formatter(OldScalarFormatter()) -ax2.yaxis.set_major_formatter(OldScalarFormatter()) - -ax3.plot(-x * 1e5 - 1e10, -x * 1e-5 - 1e-10) -ax3.xaxis.set_major_formatter(OldScalarFormatter()) -ax3.yaxis.set_major_formatter(OldScalarFormatter()) - -ax4.plot(-x * 1e5, -x * 1e-4) -ax4.xaxis.set_major_formatter(OldScalarFormatter()) -ax4.yaxis.set_major_formatter(OldScalarFormatter()) - -fig.subplots_adjust(wspace=0.7, hspace=0.6) - -# Example 2 -x = np.arange(0, 1, .01) -fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6)) -fig.text(0.5, 0.975, 'The new formatter, default settings', - horizontalalignment='center', - verticalalignment='top') - -ax1.plot(x * 1e5 + 1e10, x * 1e-10 + 1e-5) -ax1.xaxis.set_major_formatter(ScalarFormatter()) -ax1.yaxis.set_major_formatter(ScalarFormatter()) - -ax2.plot(x * 1e5, x * 1e-4) -ax2.xaxis.set_major_formatter(ScalarFormatter()) -ax2.yaxis.set_major_formatter(ScalarFormatter()) - -ax3.plot(-x * 1e5 - 1e10, -x * 1e-5 - 1e-10) -ax3.xaxis.set_major_formatter(ScalarFormatter()) -ax3.yaxis.set_major_formatter(ScalarFormatter()) - -ax4.plot(-x * 1e5, -x * 1e-4) -ax4.xaxis.set_major_formatter(ScalarFormatter()) -ax4.yaxis.set_major_formatter(ScalarFormatter()) - -fig.subplots_adjust(wspace=0.7, hspace=0.6) - -# Example 3 -x = np.arange(0, 1, .01) -fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6)) -fig.text(0.5, 0.975, 'The new formatter, no numerical offset', - horizontalalignment='center', - verticalalignment='top') - -ax1.plot(x * 1e5 + 1e10, x * 1e-10 + 1e-5) -ax1.xaxis.set_major_formatter(ScalarFormatter(useOffset=False)) -ax1.yaxis.set_major_formatter(ScalarFormatter(useOffset=False)) - -ax2.plot(x * 1e5, x * 1e-4) -ax2.xaxis.set_major_formatter(ScalarFormatter(useOffset=False)) -ax2.yaxis.set_major_formatter(ScalarFormatter(useOffset=False)) - -ax3.plot(-x * 1e5 - 1e10, -x * 1e-5 - 1e-10) -ax3.xaxis.set_major_formatter(ScalarFormatter(useOffset=False)) -ax3.yaxis.set_major_formatter(ScalarFormatter(useOffset=False)) - -ax4.plot(-x * 1e5, -x * 1e-4) -ax4.xaxis.set_major_formatter(ScalarFormatter(useOffset=False)) -ax4.yaxis.set_major_formatter(ScalarFormatter(useOffset=False)) - -fig.subplots_adjust(wspace=0.7, hspace=0.6) - -# Example 4 -x = np.arange(0, 1, .01) -fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6)) -fig.text(0.5, 0.975, 'The new formatter, with mathtext', - horizontalalignment='center', - verticalalignment='top') - -ax1.plot(x * 1e5 + 1e10, x * 1e-10 + 1e-5) -ax1.xaxis.set_major_formatter(ScalarFormatter(useMathText=True)) -ax1.yaxis.set_major_formatter(ScalarFormatter(useMathText=True)) - -ax2.plot(x * 1e5, x * 1e-4) -ax2.xaxis.set_major_formatter(ScalarFormatter(useMathText=True)) -ax2.yaxis.set_major_formatter(ScalarFormatter(useMathText=True)) - -ax3.plot(-x * 1e5 - 1e10, -x * 1e-5 - 1e-10) -ax3.xaxis.set_major_formatter(ScalarFormatter(useMathText=True)) -ax3.yaxis.set_major_formatter(ScalarFormatter(useMathText=True)) - -ax4.plot(-x * 1e5, -x * 1e-4) -ax4.xaxis.set_major_formatter(ScalarFormatter(useMathText=True)) -ax4.yaxis.set_major_formatter(ScalarFormatter(useMathText=True)) - -fig.subplots_adjust(wspace=0.7, hspace=0.6) - -plt.show() diff --git a/mpl_examples/pylab_examples/newscalarformatter_demo_00.hires.png b/mpl_examples/pylab_examples/newscalarformatter_demo_00.hires.png deleted file mode 100644 index f6282544058..00000000000 Binary files a/mpl_examples/pylab_examples/newscalarformatter_demo_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/newscalarformatter_demo_00.pdf b/mpl_examples/pylab_examples/newscalarformatter_demo_00.pdf deleted file mode 100644 index 7d6da9c4622..00000000000 Binary files a/mpl_examples/pylab_examples/newscalarformatter_demo_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/newscalarformatter_demo_00.png b/mpl_examples/pylab_examples/newscalarformatter_demo_00.png deleted file mode 100644 index cdf26d3511e..00000000000 Binary files a/mpl_examples/pylab_examples/newscalarformatter_demo_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/newscalarformatter_demo_01.hires.png b/mpl_examples/pylab_examples/newscalarformatter_demo_01.hires.png deleted file mode 100644 index 337aa8c47e6..00000000000 Binary files a/mpl_examples/pylab_examples/newscalarformatter_demo_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/newscalarformatter_demo_01.pdf b/mpl_examples/pylab_examples/newscalarformatter_demo_01.pdf deleted file mode 100644 index 09e5c2fadae..00000000000 Binary files a/mpl_examples/pylab_examples/newscalarformatter_demo_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/newscalarformatter_demo_01.png b/mpl_examples/pylab_examples/newscalarformatter_demo_01.png deleted file mode 100644 index 0a697c59e87..00000000000 Binary files a/mpl_examples/pylab_examples/newscalarformatter_demo_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/newscalarformatter_demo_02.hires.png b/mpl_examples/pylab_examples/newscalarformatter_demo_02.hires.png deleted file mode 100644 index dce6b3eb581..00000000000 Binary files a/mpl_examples/pylab_examples/newscalarformatter_demo_02.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/newscalarformatter_demo_02.pdf b/mpl_examples/pylab_examples/newscalarformatter_demo_02.pdf deleted file mode 100644 index 9326e479107..00000000000 Binary files a/mpl_examples/pylab_examples/newscalarformatter_demo_02.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/newscalarformatter_demo_02.png b/mpl_examples/pylab_examples/newscalarformatter_demo_02.png deleted file mode 100644 index 171966c5eb7..00000000000 Binary files a/mpl_examples/pylab_examples/newscalarformatter_demo_02.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/newscalarformatter_demo_03.hires.png b/mpl_examples/pylab_examples/newscalarformatter_demo_03.hires.png deleted file mode 100644 index 53b6d77f668..00000000000 Binary files a/mpl_examples/pylab_examples/newscalarformatter_demo_03.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/newscalarformatter_demo_03.pdf b/mpl_examples/pylab_examples/newscalarformatter_demo_03.pdf deleted file mode 100644 index 969db005113..00000000000 Binary files a/mpl_examples/pylab_examples/newscalarformatter_demo_03.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/newscalarformatter_demo_03.png b/mpl_examples/pylab_examples/newscalarformatter_demo_03.png deleted file mode 100644 index 9c593de55ed..00000000000 Binary files a/mpl_examples/pylab_examples/newscalarformatter_demo_03.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/patheffect_demo.hires.png b/mpl_examples/pylab_examples/patheffect_demo.hires.png deleted file mode 100644 index d43d4a498a4..00000000000 Binary files a/mpl_examples/pylab_examples/patheffect_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/patheffect_demo.pdf b/mpl_examples/pylab_examples/patheffect_demo.pdf deleted file mode 100644 index fcb8a3fcf8c..00000000000 Binary files a/mpl_examples/pylab_examples/patheffect_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/patheffect_demo.png b/mpl_examples/pylab_examples/patheffect_demo.png deleted file mode 100644 index 6237dc7f521..00000000000 Binary files a/mpl_examples/pylab_examples/patheffect_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/patheffect_demo.py b/mpl_examples/pylab_examples/patheffect_demo.py deleted file mode 100644 index 0adac291198..00000000000 --- a/mpl_examples/pylab_examples/patheffect_demo.py +++ /dev/null @@ -1,43 +0,0 @@ -import matplotlib.pyplot as plt -import matplotlib.patheffects as PathEffects -import numpy as np - -if 1: - plt.figure(1, figsize=(8, 3)) - ax1 = plt.subplot(131) - ax1.imshow([[1, 2], [2, 3]]) - txt = ax1.annotate("test", (1., 1.), (0., 0), - arrowprops=dict(arrowstyle="->", - connectionstyle="angle3", lw=2), - size=20, ha="center", path_effects=[PathEffects.withStroke(linewidth=3, - foreground="w")]) - txt.arrow_patch.set_path_effects([ - PathEffects.Stroke(linewidth=5, foreground="w"), - PathEffects.Normal()]) - - ax1.grid(True, linestyle="-") - - pe = [PathEffects.withStroke(linewidth=3, - foreground="w")] - for l in ax1.get_xgridlines() + ax1.get_ygridlines(): - l.set_path_effects(pe) - - ax2 = plt.subplot(132) - arr = np.arange(25).reshape((5, 5)) - ax2.imshow(arr) - cntr = ax2.contour(arr, colors="k") - - plt.setp(cntr.collections, path_effects=[ - PathEffects.withStroke(linewidth=3, foreground="w")]) - - clbls = ax2.clabel(cntr, fmt="%2.0f", use_clabeltext=True) - plt.setp(clbls, path_effects=[ - PathEffects.withStroke(linewidth=3, foreground="w")]) - - # shadow as a path effect - ax3 = plt.subplot(133) - p1, = ax3.plot([0, 1], [0, 1]) - leg = ax3.legend([p1], ["Line 1"], fancybox=True, loc=2) - leg.legendPatch.set_path_effects([PathEffects.withSimplePatchShadow()]) - - plt.show() diff --git a/mpl_examples/pylab_examples/pcolor_demo.hires.png b/mpl_examples/pylab_examples/pcolor_demo.hires.png deleted file mode 100644 index cafcf32be6b..00000000000 Binary files a/mpl_examples/pylab_examples/pcolor_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/pcolor_demo.pdf b/mpl_examples/pylab_examples/pcolor_demo.pdf deleted file mode 100644 index 2f9e8f88672..00000000000 Binary files a/mpl_examples/pylab_examples/pcolor_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/pcolor_demo.png b/mpl_examples/pylab_examples/pcolor_demo.png deleted file mode 100644 index b074cb383a0..00000000000 Binary files a/mpl_examples/pylab_examples/pcolor_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/pcolor_demo.py b/mpl_examples/pylab_examples/pcolor_demo.py deleted file mode 100644 index 2529a57b2d6..00000000000 --- a/mpl_examples/pylab_examples/pcolor_demo.py +++ /dev/null @@ -1,53 +0,0 @@ -""" -Demonstrates similarities between pcolor, pcolormesh, imshow and pcolorfast -for drawing quadrilateral grids. - -""" -import matplotlib.pyplot as plt -import numpy as np - -# make these smaller to increase the resolution -dx, dy = 0.15, 0.05 - -# generate 2 2d grids for the x & y bounds -y, x = np.mgrid[slice(-3, 3 + dy, dy), - slice(-3, 3 + dx, dx)] -z = (1 - x / 2. + x ** 5 + y ** 3) * np.exp(-x ** 2 - y ** 2) -# x and y are bounds, so z should be the value *inside* those bounds. -# Therefore, remove the last value from the z array. -z = z[:-1, :-1] -z_min, z_max = -np.abs(z).max(), np.abs(z).max() - - -plt.subplot(2, 2, 1) -plt.pcolor(x, y, z, cmap='RdBu', vmin=z_min, vmax=z_max) -plt.title('pcolor') -# set the limits of the plot to the limits of the data -plt.axis([x.min(), x.max(), y.min(), y.max()]) -plt.colorbar() - - -plt.subplot(2, 2, 2) -plt.pcolormesh(x, y, z, cmap='RdBu', vmin=z_min, vmax=z_max) -plt.title('pcolormesh') -# set the limits of the plot to the limits of the data -plt.axis([x.min(), x.max(), y.min(), y.max()]) -plt.colorbar() - - -plt.subplot(2, 2, 3) -plt.imshow(z, cmap='RdBu', vmin=z_min, vmax=z_max, - extent=[x.min(), x.max(), y.min(), y.max()], - interpolation='nearest', origin='lower') -plt.title('image (nearest)') -plt.colorbar() - - -ax = plt.subplot(2, 2, 4) -ax.pcolorfast(x, y, z, cmap='RdBu', vmin=z_min, vmax=z_max) -plt.title('pcolorfast') -plt.colorbar() - -plt.subplots_adjust(wspace=0.5, hspace=0.5) - -plt.show() diff --git a/mpl_examples/pylab_examples/pcolor_log.hires.png b/mpl_examples/pylab_examples/pcolor_log.hires.png deleted file mode 100644 index 41f97ee5fcf..00000000000 Binary files a/mpl_examples/pylab_examples/pcolor_log.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/pcolor_log.pdf b/mpl_examples/pylab_examples/pcolor_log.pdf deleted file mode 100644 index 623dfe59539..00000000000 Binary files a/mpl_examples/pylab_examples/pcolor_log.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/pcolor_log.png b/mpl_examples/pylab_examples/pcolor_log.png deleted file mode 100644 index 1b2e3917d63..00000000000 Binary files a/mpl_examples/pylab_examples/pcolor_log.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/pcolor_log.py b/mpl_examples/pylab_examples/pcolor_log.py deleted file mode 100644 index 8a51d84ecd0..00000000000 --- a/mpl_examples/pylab_examples/pcolor_log.py +++ /dev/null @@ -1,24 +0,0 @@ -import matplotlib.pyplot as plt -from matplotlib.colors import LogNorm -import numpy as np -from matplotlib.mlab import bivariate_normal - - -N = 100 -X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)] - -# A low hump with a spike coming out of the top right. -# Needs to have z/colour axis on a log scale so we see both hump and spike. -# linear scale only shows the spike. -Z1 = bivariate_normal(X, Y, 0.1, 0.2, 1.0, 1.0) + 0.1 * bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - -plt.subplot(2, 1, 1) -plt.pcolor(X, Y, Z1, norm=LogNorm(vmin=Z1.min(), vmax=Z1.max()), cmap='PuBu_r') -plt.colorbar() - -plt.subplot(2, 1, 2) -plt.pcolor(X, Y, Z1, cmap='PuBu_r') -plt.colorbar() - - -plt.show() diff --git a/mpl_examples/pylab_examples/pcolor_small.hires.png b/mpl_examples/pylab_examples/pcolor_small.hires.png deleted file mode 100644 index c9506259527..00000000000 Binary files a/mpl_examples/pylab_examples/pcolor_small.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/pcolor_small.pdf b/mpl_examples/pylab_examples/pcolor_small.pdf deleted file mode 100644 index cd9c27e1dc5..00000000000 Binary files a/mpl_examples/pylab_examples/pcolor_small.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/pcolor_small.png b/mpl_examples/pylab_examples/pcolor_small.png deleted file mode 100644 index 5999cf016d8..00000000000 Binary files a/mpl_examples/pylab_examples/pcolor_small.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/pcolor_small.py b/mpl_examples/pylab_examples/pcolor_small.py deleted file mode 100644 index 8034103ef4d..00000000000 --- a/mpl_examples/pylab_examples/pcolor_small.py +++ /dev/null @@ -1,14 +0,0 @@ -import matplotlib.pyplot as plt -from numpy.random import rand - -Z = rand(6, 10) - -plt.subplot(2, 1, 1) -c = plt.pcolor(Z) -plt.title('default: no edges') - -plt.subplot(2, 1, 2) -c = plt.pcolor(Z, edgecolors='k', linewidths=4) -plt.title('thick edges') - -plt.show() diff --git a/mpl_examples/pylab_examples/pie_demo2.hires.png b/mpl_examples/pylab_examples/pie_demo2.hires.png deleted file mode 100644 index ebbaa0085f9..00000000000 Binary files a/mpl_examples/pylab_examples/pie_demo2.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/pie_demo2.pdf b/mpl_examples/pylab_examples/pie_demo2.pdf deleted file mode 100644 index b0da3183f42..00000000000 Binary files a/mpl_examples/pylab_examples/pie_demo2.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/pie_demo2.png b/mpl_examples/pylab_examples/pie_demo2.png deleted file mode 100644 index 64b194edfd5..00000000000 Binary files a/mpl_examples/pylab_examples/pie_demo2.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/pie_demo2.py b/mpl_examples/pylab_examples/pie_demo2.py deleted file mode 100644 index c96d5a83ccd..00000000000 --- a/mpl_examples/pylab_examples/pie_demo2.py +++ /dev/null @@ -1,57 +0,0 @@ -""" -Make a pie charts of varying size - see -http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.pie for the docstring. - -This example shows a basic pie charts with labels optional features, -like autolabeling the percentage, offsetting a slice with "explode" -and adding a shadow, in different sizes. - -""" -import matplotlib.pyplot as plt -from matplotlib.gridspec import GridSpec - -# Some data - -labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' -fracs = [15, 30, 45, 10] - -explode = (0, 0.05, 0, 0) - -# Make square figures and axes - -the_grid = GridSpec(2, 2) - -plt.subplot(the_grid[0, 0], aspect=1) - -plt.pie(fracs, labels=labels, autopct='%1.1f%%', shadow=True) - -plt.subplot(the_grid[0, 1], aspect=1) - -plt.pie(fracs, explode=explode, labels=labels, autopct='%.0f%%', shadow=True) - -plt.subplot(the_grid[1, 0], aspect=1) - -patches, texts, autotexts = plt.pie(fracs, labels=labels, - autopct='%.0f%%', - shadow=True, radius=0.5) - -# Make the labels on the small plot easier to read. -for t in texts: - t.set_size('smaller') -for t in autotexts: - t.set_size('x-small') -autotexts[0].set_color('y') - -plt.subplot(the_grid[1, 1], aspect=1) - -# Turn off shadow for tiny plot with exploded slice. -patches, texts, autotexts = plt.pie(fracs, explode=explode, - labels=labels, autopct='%.0f%%', - shadow=False, radius=0.5) -for t in texts: - t.set_size('smaller') -for t in autotexts: - t.set_size('x-small') -autotexts[0].set_color('y') - -plt.show() diff --git a/mpl_examples/pylab_examples/plotfile_demo.py b/mpl_examples/pylab_examples/plotfile_demo.py deleted file mode 100644 index c9ef123c899..00000000000 --- a/mpl_examples/pylab_examples/plotfile_demo.py +++ /dev/null @@ -1,39 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - -import matplotlib.cbook as cbook - -fname = cbook.get_sample_data('msft.csv', asfileobj=False) -fname2 = cbook.get_sample_data('data_x_x2_x3.csv', asfileobj=False) - -# test 1; use ints -plt.plotfile(fname, (0, 5, 6)) - -# test 2; use names -plt.plotfile(fname, ('date', 'volume', 'adj_close')) - -# test 3; use semilogy for volume -plt.plotfile(fname, ('date', 'volume', 'adj_close'), - plotfuncs={'volume': 'semilogy'}) - -# test 4; use semilogy for volume -plt.plotfile(fname, (0, 5, 6), plotfuncs={5: 'semilogy'}) - -# test 5; single subplot -plt.plotfile(fname, ('date', 'open', 'high', 'low', 'close'), subplots=False) - -# test 6; labeling, if no names in csv-file -plt.plotfile(fname2, cols=(0, 1, 2), delimiter=' ', - names=['$x$', '$f(x)=x^2$', '$f(x)=x^3$']) - -# test 7; more than one file per figure--illustrated here with a single file -plt.plotfile(fname2, cols=(0, 1), delimiter=' ') -plt.plotfile(fname2, cols=(0, 2), newfig=False, - delimiter=' ') # use current figure -plt.xlabel(r'$x$') -plt.ylabel(r'$f(x) = x^2, x^3$') - -# test 8; use bar for volume -plt.plotfile(fname, (0, 5, 6), plotfuncs={5: 'bar'}) - -plt.show() diff --git a/mpl_examples/pylab_examples/plotfile_demo_00.hires.png b/mpl_examples/pylab_examples/plotfile_demo_00.hires.png deleted file mode 100644 index 0ecea7e70c0..00000000000 Binary files a/mpl_examples/pylab_examples/plotfile_demo_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/plotfile_demo_00.pdf b/mpl_examples/pylab_examples/plotfile_demo_00.pdf deleted file mode 100644 index aa33ed7e2cb..00000000000 Binary files a/mpl_examples/pylab_examples/plotfile_demo_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/plotfile_demo_00.png b/mpl_examples/pylab_examples/plotfile_demo_00.png deleted file mode 100644 index bd7a59045f2..00000000000 Binary files a/mpl_examples/pylab_examples/plotfile_demo_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/plotfile_demo_01.hires.png b/mpl_examples/pylab_examples/plotfile_demo_01.hires.png deleted file mode 100644 index 0ecea7e70c0..00000000000 Binary files a/mpl_examples/pylab_examples/plotfile_demo_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/plotfile_demo_01.pdf b/mpl_examples/pylab_examples/plotfile_demo_01.pdf deleted file mode 100644 index cc568c8621a..00000000000 Binary files a/mpl_examples/pylab_examples/plotfile_demo_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/plotfile_demo_01.png b/mpl_examples/pylab_examples/plotfile_demo_01.png deleted file mode 100644 index bd7a59045f2..00000000000 Binary files a/mpl_examples/pylab_examples/plotfile_demo_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/plotfile_demo_02.hires.png b/mpl_examples/pylab_examples/plotfile_demo_02.hires.png deleted file mode 100644 index c87a2daf83e..00000000000 Binary files a/mpl_examples/pylab_examples/plotfile_demo_02.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/plotfile_demo_02.pdf b/mpl_examples/pylab_examples/plotfile_demo_02.pdf deleted file mode 100644 index 0da97562a9c..00000000000 Binary files a/mpl_examples/pylab_examples/plotfile_demo_02.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/plotfile_demo_02.png b/mpl_examples/pylab_examples/plotfile_demo_02.png deleted file mode 100644 index 7f5ce34d854..00000000000 Binary files a/mpl_examples/pylab_examples/plotfile_demo_02.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/plotfile_demo_03.hires.png b/mpl_examples/pylab_examples/plotfile_demo_03.hires.png deleted file mode 100644 index c87a2daf83e..00000000000 Binary files a/mpl_examples/pylab_examples/plotfile_demo_03.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/plotfile_demo_03.pdf b/mpl_examples/pylab_examples/plotfile_demo_03.pdf deleted file mode 100644 index 012c0882532..00000000000 Binary files a/mpl_examples/pylab_examples/plotfile_demo_03.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/plotfile_demo_03.png b/mpl_examples/pylab_examples/plotfile_demo_03.png deleted file mode 100644 index 7f5ce34d854..00000000000 Binary files a/mpl_examples/pylab_examples/plotfile_demo_03.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/plotfile_demo_04.hires.png b/mpl_examples/pylab_examples/plotfile_demo_04.hires.png deleted file mode 100644 index 18fa9bfa06c..00000000000 Binary files a/mpl_examples/pylab_examples/plotfile_demo_04.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/plotfile_demo_04.pdf b/mpl_examples/pylab_examples/plotfile_demo_04.pdf deleted file mode 100644 index 736454ef9eb..00000000000 Binary files a/mpl_examples/pylab_examples/plotfile_demo_04.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/plotfile_demo_04.png b/mpl_examples/pylab_examples/plotfile_demo_04.png deleted file mode 100644 index daa778669af..00000000000 Binary files a/mpl_examples/pylab_examples/plotfile_demo_04.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/plotfile_demo_05.hires.png b/mpl_examples/pylab_examples/plotfile_demo_05.hires.png deleted file mode 100644 index d379a46d2f4..00000000000 Binary files a/mpl_examples/pylab_examples/plotfile_demo_05.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/plotfile_demo_05.pdf b/mpl_examples/pylab_examples/plotfile_demo_05.pdf deleted file mode 100644 index 99a686f1e55..00000000000 Binary files a/mpl_examples/pylab_examples/plotfile_demo_05.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/plotfile_demo_05.png b/mpl_examples/pylab_examples/plotfile_demo_05.png deleted file mode 100644 index 3a47357216b..00000000000 Binary files a/mpl_examples/pylab_examples/plotfile_demo_05.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/plotfile_demo_06.hires.png b/mpl_examples/pylab_examples/plotfile_demo_06.hires.png deleted file mode 100644 index 6b8cb0ee645..00000000000 Binary files a/mpl_examples/pylab_examples/plotfile_demo_06.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/plotfile_demo_06.pdf b/mpl_examples/pylab_examples/plotfile_demo_06.pdf deleted file mode 100644 index de23dcd6a00..00000000000 Binary files a/mpl_examples/pylab_examples/plotfile_demo_06.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/plotfile_demo_06.png b/mpl_examples/pylab_examples/plotfile_demo_06.png deleted file mode 100644 index 743d26a2814..00000000000 Binary files a/mpl_examples/pylab_examples/plotfile_demo_06.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/plotfile_demo_07.hires.png b/mpl_examples/pylab_examples/plotfile_demo_07.hires.png deleted file mode 100644 index 039c3294050..00000000000 Binary files a/mpl_examples/pylab_examples/plotfile_demo_07.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/plotfile_demo_07.pdf b/mpl_examples/pylab_examples/plotfile_demo_07.pdf deleted file mode 100644 index 03b5df378a5..00000000000 Binary files a/mpl_examples/pylab_examples/plotfile_demo_07.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/plotfile_demo_07.png b/mpl_examples/pylab_examples/plotfile_demo_07.png deleted file mode 100644 index 26add26857f..00000000000 Binary files a/mpl_examples/pylab_examples/plotfile_demo_07.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/polar_demo.hires.png b/mpl_examples/pylab_examples/polar_demo.hires.png deleted file mode 100644 index 1fb0d331e57..00000000000 Binary files a/mpl_examples/pylab_examples/polar_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/polar_demo.pdf b/mpl_examples/pylab_examples/polar_demo.pdf deleted file mode 100644 index e61d98b1892..00000000000 Binary files a/mpl_examples/pylab_examples/polar_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/polar_demo.png b/mpl_examples/pylab_examples/polar_demo.png deleted file mode 100644 index 3870db5ba60..00000000000 Binary files a/mpl_examples/pylab_examples/polar_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/polar_demo.py b/mpl_examples/pylab_examples/polar_demo.py deleted file mode 100644 index b2b5843e8fa..00000000000 --- a/mpl_examples/pylab_examples/polar_demo.py +++ /dev/null @@ -1,19 +0,0 @@ -""" -Demo of a line plot on a polar axis. -""" -import numpy as np -import matplotlib.pyplot as plt - - -r = np.arange(0, 2, 0.01) -theta = 2 * np.pi * r - -ax = plt.subplot(111, projection='polar') -ax.plot(theta, r) -ax.set_rmax(2) -ax.set_rticks([0.5, 1, 1.5, 2]) # less radial ticks -ax.set_rlabel_position(-22.5) # get radial labels away from plotted line -ax.grid(True) - -ax.set_title("A line plot on a polar axis", va='bottom') -plt.show() diff --git a/mpl_examples/pylab_examples/polar_legend.hires.png b/mpl_examples/pylab_examples/polar_legend.hires.png deleted file mode 100644 index 90ef06398c0..00000000000 Binary files a/mpl_examples/pylab_examples/polar_legend.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/polar_legend.pdf b/mpl_examples/pylab_examples/polar_legend.pdf deleted file mode 100644 index d20324493fb..00000000000 Binary files a/mpl_examples/pylab_examples/polar_legend.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/polar_legend.png b/mpl_examples/pylab_examples/polar_legend.png deleted file mode 100644 index ab1b69d053a..00000000000 Binary files a/mpl_examples/pylab_examples/polar_legend.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/polar_legend.py b/mpl_examples/pylab_examples/polar_legend.py deleted file mode 100644 index a249755c32b..00000000000 --- a/mpl_examples/pylab_examples/polar_legend.py +++ /dev/null @@ -1,20 +0,0 @@ -import numpy as np -from matplotlib.pyplot import figure, show, rc - -# radar green, solid grid lines -rc('grid', color='#316931', linewidth=1, linestyle='-') -rc('xtick', labelsize=15) -rc('ytick', labelsize=15) - -# force square figure and square axes looks better for polar, IMO -fig = figure(figsize=(8, 8)) -ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], - projection='polar', facecolor='#d5de9c') - -r = np.arange(0, 3.0, 0.01) -theta = 2*np.pi*r -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() - -show() diff --git a/mpl_examples/pylab_examples/psd_demo.py b/mpl_examples/pylab_examples/psd_demo.py deleted file mode 100644 index 61dd7e1c12c..00000000000 --- a/mpl_examples/pylab_examples/psd_demo.py +++ /dev/null @@ -1,35 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - -dt = 0.01 -t = np.arange(0, 10, dt) -nse = np.random.randn(len(t)) -r = np.exp(-t/0.05) - -cnse = np.convolve(nse, r)*dt -cnse = cnse[:len(t)] -s = 0.1*np.sin(2*np.pi*t) + cnse - -plt.subplot(211) -plt.plot(t, s) -plt.subplot(212) -plt.psd(s, 512, 1/dt) - -plt.show() - -""" -% compare with MATLAB -dt = 0.01; -t = [0:dt:10]; -nse = randn(size(t)); -r = exp(-t/0.05); -cnse = conv(nse, r)*dt; -cnse = cnse(1:length(t)); -s = 0.1*sin(2*pi*t) + cnse; - -subplot(211) -plot(t,s) -subplot(212) -psd(s, 512, 1/dt) - -""" diff --git a/mpl_examples/pylab_examples/psd_demo2.hires.png b/mpl_examples/pylab_examples/psd_demo2.hires.png deleted file mode 100644 index a1964fcb8d9..00000000000 Binary files a/mpl_examples/pylab_examples/psd_demo2.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/psd_demo2.pdf b/mpl_examples/pylab_examples/psd_demo2.pdf deleted file mode 100644 index dce0165fd74..00000000000 Binary files a/mpl_examples/pylab_examples/psd_demo2.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/psd_demo2.png b/mpl_examples/pylab_examples/psd_demo2.png deleted file mode 100644 index 91182663ccb..00000000000 Binary files a/mpl_examples/pylab_examples/psd_demo2.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/psd_demo2.py b/mpl_examples/pylab_examples/psd_demo2.py deleted file mode 100644 index 0402c022e9f..00000000000 --- a/mpl_examples/pylab_examples/psd_demo2.py +++ /dev/null @@ -1,42 +0,0 @@ -# This example shows the effects of some of the different PSD parameters -import numpy as np -import matplotlib.pyplot as plt - -dt = np.pi / 100. -fs = 1. / dt -t = np.arange(0, 8, dt) -y = 10. * np.sin(2 * np.pi * 4 * t) + 5. * np.sin(2 * np.pi * 4.25 * t) -y = y + np.random.randn(*t.shape) - -# Plot the raw time series -fig = plt.figure() -fig.subplots_adjust(hspace=0.45, wspace=0.3) -ax = fig.add_subplot(2, 1, 1) -ax.plot(t, y) - -# Plot the PSD with different amounts of zero padding. This uses the entire -# time series at once -ax2 = fig.add_subplot(2, 3, 4) -ax2.psd(y, NFFT=len(t), pad_to=len(t), Fs=fs) -ax2.psd(y, NFFT=len(t), pad_to=len(t)*2, Fs=fs) -ax2.psd(y, NFFT=len(t), pad_to=len(t)*4, Fs=fs) -plt.title('zero padding') - -# Plot the PSD with different block sizes, Zero pad to the length of the -# original data sequence. -ax3 = fig.add_subplot(2, 3, 5, sharex=ax2, sharey=ax2) -ax3.psd(y, NFFT=len(t), pad_to=len(t), Fs=fs) -ax3.psd(y, NFFT=len(t)//2, pad_to=len(t), Fs=fs) -ax3.psd(y, NFFT=len(t)//4, pad_to=len(t), Fs=fs) -ax3.set_ylabel('') -plt.title('block size') - -# Plot the PSD with different amounts of overlap between blocks -ax4 = fig.add_subplot(2, 3, 6, sharex=ax2, sharey=ax2) -ax4.psd(y, NFFT=len(t)//2, pad_to=len(t), noverlap=0, Fs=fs) -ax4.psd(y, NFFT=len(t)//2, pad_to=len(t), noverlap=int(0.05*len(t)/2.), Fs=fs) -ax4.psd(y, NFFT=len(t)//2, pad_to=len(t), noverlap=int(0.2*len(t)/2.), Fs=fs) -ax4.set_ylabel('') -plt.title('overlap') - -plt.show() diff --git a/mpl_examples/pylab_examples/psd_demo3.hires.png b/mpl_examples/pylab_examples/psd_demo3.hires.png deleted file mode 100644 index 9f50e3bd283..00000000000 Binary files a/mpl_examples/pylab_examples/psd_demo3.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/psd_demo3.pdf b/mpl_examples/pylab_examples/psd_demo3.pdf deleted file mode 100644 index 82c85f02da7..00000000000 Binary files a/mpl_examples/pylab_examples/psd_demo3.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/psd_demo3.png b/mpl_examples/pylab_examples/psd_demo3.png deleted file mode 100644 index 18e11b52357..00000000000 Binary files a/mpl_examples/pylab_examples/psd_demo3.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/psd_demo3.py b/mpl_examples/pylab_examples/psd_demo3.py deleted file mode 100644 index 7c12026b664..00000000000 --- a/mpl_examples/pylab_examples/psd_demo3.py +++ /dev/null @@ -1,43 +0,0 @@ -"""This is a ported version of a MATLAB example from the signal -processing toolbox that showed some difference at one time between -Matplotlib's and MATLAB's scaling of the PSD. - -""" - -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.mlab as mlab - -prng = np.random.RandomState(123456) # to ensure reproducibility - -fs = 1000 -t = np.linspace(0, 0.3, 301) -A = np.array([2, 8]).reshape(-1, 1) -f = np.array([150, 140]).reshape(-1, 1) -xn = (A * np.sin(2 * np.pi * f * t)).sum(axis=0) + 5 * prng.randn(*t.shape) - -fig, (ax0, ax1) = plt.subplots(ncols=2) - -fig.subplots_adjust(hspace=0.45, wspace=0.3) -yticks = np.arange(-50, 30, 10) -yrange = (yticks[0], yticks[-1]) -xticks = np.arange(0, 550, 100) - -ax0.psd(xn, NFFT=301, Fs=fs, window=mlab.window_none, pad_to=1024, - scale_by_freq=True) -ax0.set_title('Periodogram') -ax0.set_yticks(yticks) -ax0.set_xticks(xticks) -ax0.grid(True) -ax0.set_ylim(yrange) - -ax1.psd(xn, NFFT=150, Fs=fs, window=mlab.window_none, pad_to=512, noverlap=75, - scale_by_freq=True) -ax1.set_title('Welch') -ax1.set_xticks(xticks) -ax1.set_yticks(yticks) -ax1.set_ylabel('') # overwrite the y-label added by `psd` -ax1.grid(True) -ax1.set_ylim(yrange) - -plt.show() diff --git a/mpl_examples/pylab_examples/psd_demo_00_00.hires.png b/mpl_examples/pylab_examples/psd_demo_00_00.hires.png deleted file mode 100644 index b362410bc17..00000000000 Binary files a/mpl_examples/pylab_examples/psd_demo_00_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/psd_demo_00_00.pdf b/mpl_examples/pylab_examples/psd_demo_00_00.pdf deleted file mode 100644 index db049ee8f68..00000000000 Binary files a/mpl_examples/pylab_examples/psd_demo_00_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/psd_demo_00_00.png b/mpl_examples/pylab_examples/psd_demo_00_00.png deleted file mode 100644 index 6db14e94b85..00000000000 Binary files a/mpl_examples/pylab_examples/psd_demo_00_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/psd_demo_complex.hires.png b/mpl_examples/pylab_examples/psd_demo_complex.hires.png deleted file mode 100644 index d114e0c8d5d..00000000000 Binary files a/mpl_examples/pylab_examples/psd_demo_complex.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/psd_demo_complex.pdf b/mpl_examples/pylab_examples/psd_demo_complex.pdf deleted file mode 100644 index 0c203c5651b..00000000000 Binary files a/mpl_examples/pylab_examples/psd_demo_complex.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/psd_demo_complex.png b/mpl_examples/pylab_examples/psd_demo_complex.png deleted file mode 100644 index 4c1ef8d069d..00000000000 Binary files a/mpl_examples/pylab_examples/psd_demo_complex.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/psd_demo_complex.py b/mpl_examples/pylab_examples/psd_demo_complex.py deleted file mode 100644 index 334651837c3..00000000000 --- a/mpl_examples/pylab_examples/psd_demo_complex.py +++ /dev/null @@ -1,46 +0,0 @@ -"""This is a ported version of a MATLAB example from the signal -processing toolbox that showed some difference at one time between -Matplotlib's and MATLAB's scaling of the PSD. - -This differs from psd_demo3.py in that this uses a complex signal, -so we can see that complex PSD's work properly - -""" - -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.mlab as mlab - -prng = np.random.RandomState(123456) # to ensure reproducibility - -fs = 1000 -t = np.linspace(0, 0.3, 301) -A = np.array([2, 8]).reshape(-1, 1) -f = np.array([150, 140]).reshape(-1, 1) -xn = (A * np.exp(2j * np.pi * f * t)).sum(axis=0) + 5 * prng.randn(*t.shape) - -fig, (ax0, ax1) = plt.subplots(ncols=2) - -fig.subplots_adjust(hspace=0.45, wspace=0.3) -yticks = np.arange(-50, 30, 10) -yrange = (yticks[0], yticks[-1]) -xticks = np.arange(-500, 550, 200) - -ax0.psd(xn, NFFT=301, Fs=fs, window=mlab.window_none, pad_to=1024, - scale_by_freq=True) -ax0.set_title('Periodogram') -ax0.set_yticks(yticks) -ax0.set_xticks(xticks) -ax0.grid(True) -ax0.set_ylim(yrange) - -ax1.psd(xn, NFFT=150, Fs=fs, window=mlab.window_none, pad_to=512, noverlap=75, - scale_by_freq=True) -ax1.set_title('Welch') -ax1.set_xticks(xticks) -ax1.set_yticks(yticks) -ax1.set_ylabel('') # overwrite the y-label added by `psd` -ax1.grid(True) -ax1.set_ylim(yrange) - -plt.show() diff --git a/mpl_examples/pylab_examples/pythonic_matplotlib.hires.png b/mpl_examples/pylab_examples/pythonic_matplotlib.hires.png deleted file mode 100644 index dd529a462c2..00000000000 Binary files a/mpl_examples/pylab_examples/pythonic_matplotlib.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/pythonic_matplotlib.pdf b/mpl_examples/pylab_examples/pythonic_matplotlib.pdf deleted file mode 100644 index a2687365713..00000000000 Binary files a/mpl_examples/pylab_examples/pythonic_matplotlib.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/pythonic_matplotlib.png b/mpl_examples/pylab_examples/pythonic_matplotlib.png deleted file mode 100644 index 10404aa1b93..00000000000 Binary files a/mpl_examples/pylab_examples/pythonic_matplotlib.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/pythonic_matplotlib.py b/mpl_examples/pylab_examples/pythonic_matplotlib.py deleted file mode 100644 index b868488f3ea..00000000000 --- a/mpl_examples/pylab_examples/pythonic_matplotlib.py +++ /dev/null @@ -1,81 +0,0 @@ -""" -Some people prefer to write more pythonic, object-oriented code -rather than use the pyplot interface to matplotlib. This example shows -you how. - -Unless you are an application developer, I recommend using part of the -pyplot interface, particularly the figure, close, subplot, axes, and -show commands. These hide a lot of complexity from you that you don't -need to see in normal figure creation, like instantiating DPI -instances, managing the bounding boxes of the figure elements, -creating and realizing GUI windows and embedding figures in them. - - -If you are an application developer and want to embed matplotlib in -your application, follow the lead of examples/embedding_in_wx.py, -examples/embedding_in_gtk.py or examples/embedding_in_tk.py. In this -case you will want to control the creation of all your figures, -embedding them in application windows, etc. - -If you are a web application developer, you may want to use the -example in webapp_demo.py, which shows how to use the backend agg -figure canvas directly, with none of the globals (current figure, -current axes) that are present in the pyplot interface. Note that -there is no reason why the pyplot interface won't work for web -application developers, however. - -If you see an example in the examples dir written in pyplot interface, -and you want to emulate that using the true python method calls, there -is an easy mapping. Many of those examples use 'set' to control -figure properties. Here's how to map those commands onto instance -methods - -The syntax of set is - - plt.setp(object or sequence, somestring, attribute) - -if called with an object, set calls - - object.set_somestring(attribute) - -if called with a sequence, set does - - for object in sequence: - object.set_somestring(attribute) - -So for your example, if a is your axes object, you can do - - a.set_xticklabels([]) - a.set_yticklabels([]) - a.set_xticks([]) - a.set_yticks([]) -""" - - -from matplotlib.pyplot import figure, show -from numpy import arange, sin, pi - -t = arange(0.0, 1.0, 0.01) - -fig = figure(1) - -ax1 = fig.add_subplot(211) -ax1.plot(t, sin(2*pi*t)) -ax1.grid(True) -ax1.set_ylim((-2, 2)) -ax1.set_ylabel('1 Hz') -ax1.set_title('A sine wave or two') - -for label in ax1.get_xticklabels(): - label.set_color('r') - - -ax2 = fig.add_subplot(212) -ax2.plot(t, sin(2*2*pi*t)) -ax2.grid(True) -ax2.set_ylim((-2, 2)) -l = ax2.set_xlabel('Hi mom') -l.set_color('g') -l.set_fontsize('large') - -show() diff --git a/mpl_examples/pylab_examples/quadmesh_demo.hires.png b/mpl_examples/pylab_examples/quadmesh_demo.hires.png deleted file mode 100644 index 1cc31c5b815..00000000000 Binary files a/mpl_examples/pylab_examples/quadmesh_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/quadmesh_demo.pdf b/mpl_examples/pylab_examples/quadmesh_demo.pdf deleted file mode 100644 index 22399c9dc12..00000000000 Binary files a/mpl_examples/pylab_examples/quadmesh_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/quadmesh_demo.png b/mpl_examples/pylab_examples/quadmesh_demo.png deleted file mode 100644 index 38864c910a8..00000000000 Binary files a/mpl_examples/pylab_examples/quadmesh_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/quadmesh_demo.py b/mpl_examples/pylab_examples/quadmesh_demo.py deleted file mode 100644 index 8f6ab8ae189..00000000000 --- a/mpl_examples/pylab_examples/quadmesh_demo.py +++ /dev/null @@ -1,42 +0,0 @@ -""" -pcolormesh uses a QuadMesh, a faster generalization of pcolor, but -with some restrictions. - -This demo illustrates a bug in quadmesh with masked data. -""" - -import numpy as np -from matplotlib.pyplot import figure, show, savefig -from matplotlib import cm, colors -from numpy import ma - -n = 12 -x = np.linspace(-1.5, 1.5, n) -y = np.linspace(-1.5, 1.5, n*2) -X, Y = np.meshgrid(x, y) -Qx = np.cos(Y) - np.cos(X) -Qz = np.sin(Y) + np.sin(X) -Qx = (Qx + 1.1) -Z = np.sqrt(X**2 + Y**2)/5 -Z = (Z - Z.min()) / (Z.max() - Z.min()) - -# The color array can include masked values: -Zm = ma.masked_where(np.fabs(Qz) < 0.5*np.amax(Qz), Z) - - -fig = figure() -ax = fig.add_subplot(121) -ax.pcolormesh(Qx, Qz, Z, shading='gouraud') -ax.set_title('Without masked values') - -ax = fig.add_subplot(122) -# You can control the color of the masked region: -# cmap = cm.RdBu -# cmap.set_bad('y', 1.0) -# ax.pcolormesh(Qx, Qz, Zm, cmap=cmap) -# Or use the default, which is transparent: -col = ax.pcolormesh(Qx, Qz, Zm, shading='gouraud') -ax.set_title('With masked values') - - -show() diff --git a/mpl_examples/pylab_examples/quiver_demo.py b/mpl_examples/pylab_examples/quiver_demo.py deleted file mode 100644 index 067d6029e82..00000000000 --- a/mpl_examples/pylab_examples/quiver_demo.py +++ /dev/null @@ -1,42 +0,0 @@ -''' -======================================================== -Demonstration of advanced quiver and quiverkey functions -======================================================== - -Known problem: the plot autoscaling does not take into account -the arrows, so those on the boundaries are often out of the picture. -This is *not* an easy problem to solve in a perfectly general way. -The workaround is to manually expand the axes. -''' -import matplotlib.pyplot as plt -import numpy as np -from numpy import ma - -X, Y = np.meshgrid(np.arange(0, 2 * np.pi, .2), np.arange(0, 2 * np.pi, .2)) -U = np.cos(X) -V = np.sin(Y) - -plt.figure() -plt.title('Arrows scale with plot width, not view') -Q = plt.quiver(X, Y, U, V, units='width') -qk = plt.quiverkey(Q, 0.9, 0.9, 2, r'$2 \frac{m}{s}$', labelpos='E', - coordinates='figure') - -plt.figure() -plt.title("pivot='mid'; every third arrow; units='inches'") -Q = plt.quiver(X[::3, ::3], Y[::3, ::3], U[::3, ::3], V[::3, ::3], - pivot='mid', units='inches') -qk = plt.quiverkey(Q, 0.9, 0.9, 1, r'$1 \frac{m}{s}$', labelpos='E', - coordinates='figure') -plt.scatter(X[::3, ::3], Y[::3, ::3], color='r', s=5) - -plt.figure() -plt.title("pivot='tip'; scales with x view") -M = np.hypot(U, V) -Q = plt.quiver(X, Y, U, V, M, units='x', pivot='tip', width=0.022, - scale=1 / 0.15) -qk = plt.quiverkey(Q, 0.9, 0.9, 1, r'$1 \frac{m}{s}$', labelpos='E', - coordinates='figure') -plt.scatter(X, Y, color='k', s=5) - -plt.show() diff --git a/mpl_examples/pylab_examples/quiver_demo_00.hires.png b/mpl_examples/pylab_examples/quiver_demo_00.hires.png deleted file mode 100644 index 6f39407f946..00000000000 Binary files a/mpl_examples/pylab_examples/quiver_demo_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/quiver_demo_00.pdf b/mpl_examples/pylab_examples/quiver_demo_00.pdf deleted file mode 100644 index 060de19aa9b..00000000000 Binary files a/mpl_examples/pylab_examples/quiver_demo_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/quiver_demo_00.png b/mpl_examples/pylab_examples/quiver_demo_00.png deleted file mode 100644 index a46fe68bb4b..00000000000 Binary files a/mpl_examples/pylab_examples/quiver_demo_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/quiver_demo_01.hires.png b/mpl_examples/pylab_examples/quiver_demo_01.hires.png deleted file mode 100644 index 1b015d9dee8..00000000000 Binary files a/mpl_examples/pylab_examples/quiver_demo_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/quiver_demo_01.pdf b/mpl_examples/pylab_examples/quiver_demo_01.pdf deleted file mode 100644 index 7bc4b1fd034..00000000000 Binary files a/mpl_examples/pylab_examples/quiver_demo_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/quiver_demo_01.png b/mpl_examples/pylab_examples/quiver_demo_01.png deleted file mode 100644 index 5bb95b4b339..00000000000 Binary files a/mpl_examples/pylab_examples/quiver_demo_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/quiver_demo_02.hires.png b/mpl_examples/pylab_examples/quiver_demo_02.hires.png deleted file mode 100644 index 714b2e2f94b..00000000000 Binary files a/mpl_examples/pylab_examples/quiver_demo_02.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/quiver_demo_02.pdf b/mpl_examples/pylab_examples/quiver_demo_02.pdf deleted file mode 100644 index a270b1f3bd4..00000000000 Binary files a/mpl_examples/pylab_examples/quiver_demo_02.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/quiver_demo_02.png b/mpl_examples/pylab_examples/quiver_demo_02.png deleted file mode 100644 index 198ae8b015a..00000000000 Binary files a/mpl_examples/pylab_examples/quiver_demo_02.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/quiver_demo_03.hires.png b/mpl_examples/pylab_examples/quiver_demo_03.hires.png deleted file mode 100644 index a0fc2a46ed7..00000000000 Binary files a/mpl_examples/pylab_examples/quiver_demo_03.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/quiver_demo_03.pdf b/mpl_examples/pylab_examples/quiver_demo_03.pdf deleted file mode 100644 index 17268661fa5..00000000000 Binary files a/mpl_examples/pylab_examples/quiver_demo_03.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/quiver_demo_03.png b/mpl_examples/pylab_examples/quiver_demo_03.png deleted file mode 100644 index e769f866746..00000000000 Binary files a/mpl_examples/pylab_examples/quiver_demo_03.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/quiver_demo_04.hires.png b/mpl_examples/pylab_examples/quiver_demo_04.hires.png deleted file mode 100644 index ef5863f588a..00000000000 Binary files a/mpl_examples/pylab_examples/quiver_demo_04.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/quiver_demo_04.pdf b/mpl_examples/pylab_examples/quiver_demo_04.pdf deleted file mode 100644 index 79fc5cbf624..00000000000 Binary files a/mpl_examples/pylab_examples/quiver_demo_04.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/quiver_demo_04.png b/mpl_examples/pylab_examples/quiver_demo_04.png deleted file mode 100644 index 31a828ae869..00000000000 Binary files a/mpl_examples/pylab_examples/quiver_demo_04.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/quiver_demo_05.hires.png b/mpl_examples/pylab_examples/quiver_demo_05.hires.png deleted file mode 100644 index 87330bb340f..00000000000 Binary files a/mpl_examples/pylab_examples/quiver_demo_05.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/quiver_demo_05.pdf b/mpl_examples/pylab_examples/quiver_demo_05.pdf deleted file mode 100644 index e866295e64e..00000000000 Binary files a/mpl_examples/pylab_examples/quiver_demo_05.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/quiver_demo_05.png b/mpl_examples/pylab_examples/quiver_demo_05.png deleted file mode 100644 index 9b62d5323ba..00000000000 Binary files a/mpl_examples/pylab_examples/quiver_demo_05.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/quiver_simple_demo.pdf b/mpl_examples/pylab_examples/quiver_simple_demo.pdf deleted file mode 100644 index 0decab2224c..00000000000 Binary files a/mpl_examples/pylab_examples/quiver_simple_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/quiver_simple_demo.png b/mpl_examples/pylab_examples/quiver_simple_demo.png deleted file mode 100644 index 665b0624521..00000000000 Binary files a/mpl_examples/pylab_examples/quiver_simple_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/quiver_simple_demo.py b/mpl_examples/pylab_examples/quiver_simple_demo.py deleted file mode 100644 index 417b9c2b03a..00000000000 --- a/mpl_examples/pylab_examples/quiver_simple_demo.py +++ /dev/null @@ -1,18 +0,0 @@ -''' -================================================== -A simple example of a quiver plot with a quiverkey -================================================== -''' -import matplotlib.pyplot as plt -import numpy as np - -X = np.arange(-10, 10, 1) -Y = np.arange(-10, 10, 1) -U, V = np.meshgrid(X, Y) - -fig, ax = plt.subplots() -q = ax.quiver(X, Y, U, V) -ax.quiverkey(q, X=0.3, Y=1.1, U=10, - label='Quiver key, length = 10', labelpos='E') - -plt.show() diff --git a/mpl_examples/pylab_examples/scatter_custom_symbol.hires.png b/mpl_examples/pylab_examples/scatter_custom_symbol.hires.png deleted file mode 100644 index 26b49df862d..00000000000 Binary files a/mpl_examples/pylab_examples/scatter_custom_symbol.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/scatter_custom_symbol.pdf b/mpl_examples/pylab_examples/scatter_custom_symbol.pdf deleted file mode 100644 index de81ae94a6a..00000000000 Binary files a/mpl_examples/pylab_examples/scatter_custom_symbol.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/scatter_custom_symbol.png b/mpl_examples/pylab_examples/scatter_custom_symbol.png deleted file mode 100644 index fd0df0894d6..00000000000 Binary files a/mpl_examples/pylab_examples/scatter_custom_symbol.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/scatter_custom_symbol.py b/mpl_examples/pylab_examples/scatter_custom_symbol.py deleted file mode 100644 index abd2ebc4381..00000000000 --- a/mpl_examples/pylab_examples/scatter_custom_symbol.py +++ /dev/null @@ -1,17 +0,0 @@ -import matplotlib.pyplot as plt -from numpy import arange, pi, cos, sin -from numpy.random import rand - -# unit area ellipse -rx, ry = 3., 1. -area = rx * ry * pi -theta = arange(0, 2*pi + 0.01, 0.1) -verts = list(zip(rx/area*cos(theta), ry/area*sin(theta))) - -x, y, s, c = rand(4, 30) -s *= 10**2. - -fig, ax = plt.subplots() -ax.scatter(x, y, s, c, marker=None, verts=verts) - -plt.show() diff --git a/mpl_examples/pylab_examples/scatter_demo2.hires.png b/mpl_examples/pylab_examples/scatter_demo2.hires.png deleted file mode 100644 index f3e1f03e457..00000000000 Binary files a/mpl_examples/pylab_examples/scatter_demo2.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/scatter_demo2.pdf b/mpl_examples/pylab_examples/scatter_demo2.pdf deleted file mode 100644 index 46943d6161e..00000000000 Binary files a/mpl_examples/pylab_examples/scatter_demo2.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/scatter_demo2.png b/mpl_examples/pylab_examples/scatter_demo2.png deleted file mode 100644 index 5dadc81a6e8..00000000000 Binary files a/mpl_examples/pylab_examples/scatter_demo2.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/scatter_demo2.py b/mpl_examples/pylab_examples/scatter_demo2.py deleted file mode 100644 index f15f3c58829..00000000000 --- a/mpl_examples/pylab_examples/scatter_demo2.py +++ /dev/null @@ -1,39 +0,0 @@ -""" -Demo of scatter plot with varying marker colors and sizes. -""" -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.cbook as cbook - -# Load a numpy record array from yahoo csv data with fields date, -# open, close, volume, adj_close from the mpl-data/example directory. -# The record array stores python datetime.date as an object array in -# the date column -datafile = cbook.get_sample_data('goog.npy') -try: - # Python3 cannot load python2 .npy files with datetime(object) arrays - # unless the encoding is set to bytes. However this option was - # not added until numpy 1.10 so this example will only work with - # python 2 or with numpy 1.10 and later - price_data = np.load(datafile, encoding='bytes').view(np.recarray) -except TypeError: - price_data = np.load(datafile).view(np.recarray) -price_data = price_data[-250:] # get the most recent 250 trading days - -delta1 = np.diff(price_data.adj_close)/price_data.adj_close[:-1] - -# Marker size in units of points^2 -volume = (15 * price_data.volume[:-2] / price_data.volume[0])**2 -close = 0.003 * price_data.close[:-2] / 0.003 * price_data.open[:-2] - -fig, ax = plt.subplots() -ax.scatter(delta1[:-1], delta1[1:], c=close, s=volume, alpha=0.5) - -ax.set_xlabel(r'$\Delta_i$', fontsize=15) -ax.set_ylabel(r'$\Delta_{i+1}$', fontsize=15) -ax.set_title('Volume and percent change') - -ax.grid(True) -fig.tight_layout() - -plt.show() diff --git a/mpl_examples/pylab_examples/scatter_hist.hires.png b/mpl_examples/pylab_examples/scatter_hist.hires.png deleted file mode 100644 index 869dbebb23b..00000000000 Binary files a/mpl_examples/pylab_examples/scatter_hist.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/scatter_hist.pdf b/mpl_examples/pylab_examples/scatter_hist.pdf deleted file mode 100644 index baa3a0e633a..00000000000 Binary files a/mpl_examples/pylab_examples/scatter_hist.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/scatter_hist.png b/mpl_examples/pylab_examples/scatter_hist.png deleted file mode 100644 index d3e09863f0c..00000000000 Binary files a/mpl_examples/pylab_examples/scatter_hist.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/scatter_hist.py b/mpl_examples/pylab_examples/scatter_hist.py deleted file mode 100644 index a271cf729e6..00000000000 --- a/mpl_examples/pylab_examples/scatter_hist.py +++ /dev/null @@ -1,49 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.ticker import NullFormatter - -# the random data -x = np.random.randn(1000) -y = np.random.randn(1000) - -nullfmt = NullFormatter() # no labels - -# definitions for the axes -left, width = 0.1, 0.65 -bottom, height = 0.1, 0.65 -bottom_h = left_h = left + width + 0.02 - -rect_scatter = [left, bottom, width, height] -rect_histx = [left, bottom_h, width, 0.2] -rect_histy = [left_h, bottom, 0.2, height] - -# start with a rectangular Figure -plt.figure(1, figsize=(8, 8)) - -axScatter = plt.axes(rect_scatter) -axHistx = plt.axes(rect_histx) -axHisty = plt.axes(rect_histy) - -# no labels -axHistx.xaxis.set_major_formatter(nullfmt) -axHisty.yaxis.set_major_formatter(nullfmt) - -# the scatter plot: -axScatter.scatter(x, y) - -# now determine nice limits by hand: -binwidth = 0.25 -xymax = np.max([np.max(np.fabs(x)), np.max(np.fabs(y))]) -lim = (int(xymax/binwidth) + 1) * binwidth - -axScatter.set_xlim((-lim, lim)) -axScatter.set_ylim((-lim, lim)) - -bins = np.arange(-lim, lim + binwidth, binwidth) -axHistx.hist(x, bins=bins) -axHisty.hist(y, bins=bins, orientation='horizontal') - -axHistx.set_xlim(axScatter.get_xlim()) -axHisty.set_ylim(axScatter.get_ylim()) - -plt.show() diff --git a/mpl_examples/pylab_examples/scatter_masked.hires.png b/mpl_examples/pylab_examples/scatter_masked.hires.png deleted file mode 100644 index 7d62aa70026..00000000000 Binary files a/mpl_examples/pylab_examples/scatter_masked.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/scatter_masked.pdf b/mpl_examples/pylab_examples/scatter_masked.pdf deleted file mode 100644 index 99aa84eb2b1..00000000000 Binary files a/mpl_examples/pylab_examples/scatter_masked.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/scatter_masked.png b/mpl_examples/pylab_examples/scatter_masked.png deleted file mode 100644 index e59faa37015..00000000000 Binary files a/mpl_examples/pylab_examples/scatter_masked.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/scatter_masked.py b/mpl_examples/pylab_examples/scatter_masked.py deleted file mode 100644 index 0bb9581a438..00000000000 --- a/mpl_examples/pylab_examples/scatter_masked.py +++ /dev/null @@ -1,19 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - -N = 100 -r0 = 0.6 -x = 0.9*np.random.rand(N) -y = 0.9*np.random.rand(N) -area = np.pi*(10 * np.random.rand(N))**2 # 0 to 10 point radii -c = np.sqrt(area) -r = np.sqrt(x*x + y*y) -area1 = np.ma.masked_where(r < r0, area) -area2 = np.ma.masked_where(r >= r0, area) -plt.scatter(x, y, s=area1, marker='^', c=c) -plt.scatter(x, y, s=area2, marker='o', c=c) -# Show the boundary between the regions: -theta = np.arange(0, np.pi/2, 0.01) -plt.plot(r0*np.cos(theta), r0*np.sin(theta)) - -plt.show() diff --git a/mpl_examples/pylab_examples/scatter_profile.hires.png b/mpl_examples/pylab_examples/scatter_profile.hires.png deleted file mode 100644 index 64650c2663e..00000000000 Binary files a/mpl_examples/pylab_examples/scatter_profile.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/scatter_profile.pdf b/mpl_examples/pylab_examples/scatter_profile.pdf deleted file mode 100644 index 6f6b87e8bab..00000000000 Binary files a/mpl_examples/pylab_examples/scatter_profile.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/scatter_profile.png b/mpl_examples/pylab_examples/scatter_profile.png deleted file mode 100644 index 8a17e7fdfa0..00000000000 Binary files a/mpl_examples/pylab_examples/scatter_profile.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/scatter_profile.py b/mpl_examples/pylab_examples/scatter_profile.py deleted file mode 100644 index 8092f3bc171..00000000000 --- a/mpl_examples/pylab_examples/scatter_profile.py +++ /dev/null @@ -1,21 +0,0 @@ -""" -N Classic Base renderer Ext renderer -20 0.22 0.14 0.14 -100 0.16 0.14 0.13 -1000 0.45 0.26 0.17 -10000 3.30 1.31 0.53 -50000 19.30 6.53 1.98 -""" -from __future__ import print_function # only needed for python 2.x -import matplotlib.pyplot as plt -import numpy as np - -import time - -for N in (20, 100, 1000, 10000, 50000): - tstart = time.time() - x = 0.9*np.random.rand(N) - y = 0.9*np.random.rand(N) - s = 20*np.random.rand(N) - plt.scatter(x, y, s) - print('%d symbols in %1.2f s' % (N, time.time() - tstart)) diff --git a/mpl_examples/pylab_examples/scatter_star_poly.hires.png b/mpl_examples/pylab_examples/scatter_star_poly.hires.png deleted file mode 100644 index 23cd21df8a4..00000000000 Binary files a/mpl_examples/pylab_examples/scatter_star_poly.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/scatter_star_poly.pdf b/mpl_examples/pylab_examples/scatter_star_poly.pdf deleted file mode 100644 index c1e2bb9ead8..00000000000 Binary files a/mpl_examples/pylab_examples/scatter_star_poly.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/scatter_star_poly.png b/mpl_examples/pylab_examples/scatter_star_poly.png deleted file mode 100644 index 2f6c377b4ad..00000000000 Binary files a/mpl_examples/pylab_examples/scatter_star_poly.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/scatter_star_poly.py b/mpl_examples/pylab_examples/scatter_star_poly.py deleted file mode 100644 index 68eb33b32b8..00000000000 --- a/mpl_examples/pylab_examples/scatter_star_poly.py +++ /dev/null @@ -1,30 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - - -x = np.random.rand(10) -y = np.random.rand(10) -z = np.sqrt(x**2 + y**2) - -plt.subplot(321) -plt.scatter(x, y, s=80, c=z, marker=">") - -plt.subplot(322) -plt.scatter(x, y, s=80, c=z, marker=(5, 0)) - -verts = list(zip([-1., 1., 1., -1.], [-1., -1., 1., -1.])) -plt.subplot(323) -plt.scatter(x, y, s=80, c=z, marker=(verts, 0)) -# equivalent: -#plt.scatter(x,y,s=80, c=z, marker=None, verts=verts) - -plt.subplot(324) -plt.scatter(x, y, s=80, c=z, marker=(5, 1)) - -plt.subplot(325) -plt.scatter(x, y, s=80, c=z, marker='+') - -plt.subplot(326) -plt.scatter(x, y, s=80, c=z, marker=(5, 2)) - -plt.show() diff --git a/mpl_examples/pylab_examples/scatter_symbol.hires.png b/mpl_examples/pylab_examples/scatter_symbol.hires.png deleted file mode 100644 index 80268adf866..00000000000 Binary files a/mpl_examples/pylab_examples/scatter_symbol.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/scatter_symbol.pdf b/mpl_examples/pylab_examples/scatter_symbol.pdf deleted file mode 100644 index 7af69f79f49..00000000000 Binary files a/mpl_examples/pylab_examples/scatter_symbol.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/scatter_symbol.png b/mpl_examples/pylab_examples/scatter_symbol.png deleted file mode 100644 index bad859a2e52..00000000000 Binary files a/mpl_examples/pylab_examples/scatter_symbol.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/scatter_symbol.py b/mpl_examples/pylab_examples/scatter_symbol.py deleted file mode 100644 index bc805afbed0..00000000000 --- a/mpl_examples/pylab_examples/scatter_symbol.py +++ /dev/null @@ -1,14 +0,0 @@ -from matplotlib import pyplot as plt -import numpy as np -import matplotlib - -x = np.arange(0.0, 50.0, 2.0) -y = x ** 1.3 + np.random.rand(*x.shape) * 30.0 -s = np.random.rand(*x.shape) * 800 + 500 - -plt.scatter(x, y, s, c="g", alpha=0.5, marker=r'$\clubsuit$', - label="Luck") -plt.xlabel("Leprechauns") -plt.ylabel("Gold") -plt.legend(loc=2) -plt.show() diff --git a/mpl_examples/pylab_examples/set_and_get.hires.png b/mpl_examples/pylab_examples/set_and_get.hires.png deleted file mode 100644 index b43e85ee9a1..00000000000 Binary files a/mpl_examples/pylab_examples/set_and_get.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/set_and_get.pdf b/mpl_examples/pylab_examples/set_and_get.pdf deleted file mode 100644 index ed2404d7f04..00000000000 Binary files a/mpl_examples/pylab_examples/set_and_get.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/set_and_get.png b/mpl_examples/pylab_examples/set_and_get.png deleted file mode 100644 index d8750891ee8..00000000000 Binary files a/mpl_examples/pylab_examples/set_and_get.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/set_and_get.py b/mpl_examples/pylab_examples/set_and_get.py deleted file mode 100644 index c0e3743a805..00000000000 --- a/mpl_examples/pylab_examples/set_and_get.py +++ /dev/null @@ -1,99 +0,0 @@ -""" - -The pyplot interface allows you to use setp and getp to set and get -object properties, as well as to do introspection on the object - -set: - To set the linestyle of a line to be dashed, you can do - - >>> line, = plt.plot([1,2,3]) - >>> plt.setp(line, linestyle='--') - - If you want to know the valid types of arguments, you can provide the - name of the property you want to set without a value - - >>> plt.setp(line, 'linestyle') - linestyle: [ '-' | '--' | '-.' | ':' | 'steps' | 'None' ] - - If you want to see all the properties that can be set, and their - possible values, you can do - - >>> plt.setp(line) - - set operates on a single instance or a list of instances. If you are - in query mode introspecting the possible values, only the first - instance in the sequence is used. When actually setting values, all - the instances will be set. e.g., suppose you have a list of two lines, - the following will make both lines thicker and red - - >>> x = np.arange(0,1.0,0.01) - >>> y1 = np.sin(2*np.pi*x) - >>> y2 = np.sin(4*np.pi*x) - >>> lines = plt.plot(x, y1, x, y2) - >>> plt.setp(lines, linewidth=2, color='r') - - -get: - - get returns the value of a given attribute. You can use get to query - the value of a single attribute - - >>> plt.getp(line, 'linewidth') - 0.5 - - or all the attribute/value pairs - - >>> plt.getp(line) - aa = True - alpha = 1.0 - antialiased = True - c = b - clip_on = True - color = b - ... long listing skipped ... - -Aliases: - - To reduce keystrokes in interactive mode, a number of properties - have short aliases, e.g., 'lw' for 'linewidth' and 'mec' for - 'markeredgecolor'. When calling set or get in introspection mode, - these properties will be listed as 'fullname or aliasname', as in - - - - -""" - -from __future__ import print_function - -import matplotlib.pyplot as plt -import numpy as np - - -x = np.arange(0, 1.0, 0.01) -y1 = np.sin(2*np.pi*x) -y2 = np.sin(4*np.pi*x) -lines = plt.plot(x, y1, x, y2) -l1, l2 = lines -plt.setp(lines, linestyle='--') # set both to dashed -plt.setp(l1, linewidth=2, color='r') # line1 is thick and red -plt.setp(l2, linewidth=1, color='g') # line2 is thinner and green - - -print('Line setters') -plt.setp(l1) -print('Line getters') -plt.getp(l1) - -print('Rectangle setters') -plt.setp(plt.gca().patch) -print('Rectangle getters') -plt.getp(plt.gca().patch) - -t = plt.title('Hi mom') -print('Text setters') -plt.setp(t) -print('Text getters') -plt.getp(t) - -plt.show() diff --git a/mpl_examples/pylab_examples/shading_example.py b/mpl_examples/pylab_examples/shading_example.py deleted file mode 100644 index 12ce6b37969..00000000000 --- a/mpl_examples/pylab_examples/shading_example.py +++ /dev/null @@ -1,57 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.colors import LightSource -from matplotlib.cbook import get_sample_data - -# Example showing how to make shaded relief plots -# like Mathematica -# (http://reference.wolfram.com/mathematica/ref/ReliefPlot.html) -# or Generic Mapping Tools -# (http://gmt.soest.hawaii.edu/gmt/doc/gmt/html/GMT_Docs/node145.html) - - -def main(): - # Test data - x, y = np.mgrid[-5:5:0.05, -5:5:0.05] - z = 5 * (np.sqrt(x**2 + y**2) + np.sin(x**2 + y**2)) - - filename = get_sample_data('jacksboro_fault_dem.npz', asfileobj=False) - with np.load(filename) as dem: - elev = dem['elevation'] - - fig = compare(z, plt.cm.copper) - fig.suptitle('HSV Blending Looks Best with Smooth Surfaces', y=0.95) - - fig = compare(elev, plt.cm.gist_earth, ve=0.05) - fig.suptitle('Overlay Blending Looks Best with Rough Surfaces', y=0.95) - - plt.show() - - -def compare(z, cmap, ve=1): - # Create subplots and hide ticks - fig, axes = plt.subplots(ncols=2, nrows=2) - for ax in axes.flat: - ax.set(xticks=[], yticks=[]) - - # Illuminate the scene from the northwest - ls = LightSource(azdeg=315, altdeg=45) - - axes[0, 0].imshow(z, cmap=cmap) - axes[0, 0].set(xlabel='Colormapped Data') - - axes[0, 1].imshow(ls.hillshade(z, vert_exag=ve), cmap='gray') - axes[0, 1].set(xlabel='Illumination Intensity') - - rgb = ls.shade(z, cmap=cmap, vert_exag=ve, blend_mode='hsv') - axes[1, 0].imshow(rgb) - axes[1, 0].set(xlabel='Blend Mode: "hsv" (default)') - - rgb = ls.shade(z, cmap=cmap, vert_exag=ve, blend_mode='overlay') - axes[1, 1].imshow(rgb) - axes[1, 1].set(xlabel='Blend Mode: "overlay"') - - return fig - -if __name__ == '__main__': - main() diff --git a/mpl_examples/pylab_examples/shading_example_01_00.hires.png b/mpl_examples/pylab_examples/shading_example_01_00.hires.png deleted file mode 100644 index ef888789a04..00000000000 Binary files a/mpl_examples/pylab_examples/shading_example_01_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/shading_example_01_00.pdf b/mpl_examples/pylab_examples/shading_example_01_00.pdf deleted file mode 100644 index 92702abbb62..00000000000 Binary files a/mpl_examples/pylab_examples/shading_example_01_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/shading_example_01_00.png b/mpl_examples/pylab_examples/shading_example_01_00.png deleted file mode 100644 index 58d6f69606d..00000000000 Binary files a/mpl_examples/pylab_examples/shading_example_01_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/shading_example_01_01.hires.png b/mpl_examples/pylab_examples/shading_example_01_01.hires.png deleted file mode 100644 index 4ace37952e3..00000000000 Binary files a/mpl_examples/pylab_examples/shading_example_01_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/shading_example_01_01.pdf b/mpl_examples/pylab_examples/shading_example_01_01.pdf deleted file mode 100644 index 74e9891b57e..00000000000 Binary files a/mpl_examples/pylab_examples/shading_example_01_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/shading_example_01_01.png b/mpl_examples/pylab_examples/shading_example_01_01.png deleted file mode 100644 index 5085875083a..00000000000 Binary files a/mpl_examples/pylab_examples/shading_example_01_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/shared_axis_across_figures.py b/mpl_examples/pylab_examples/shared_axis_across_figures.py deleted file mode 100644 index 8cbfb9df680..00000000000 --- a/mpl_examples/pylab_examples/shared_axis_across_figures.py +++ /dev/null @@ -1,27 +0,0 @@ -""" -connect the data limits on the axes in one figure with the axes in -another. This is not the right way to do this for two axes in the -same figure -- use the sharex and sharey property in that case -""" -import numpy as np -import matplotlib.pyplot as plt - -fig1 = plt.figure() -fig2 = plt.figure() - -ax1 = fig1.add_subplot(111) -ax2 = fig2.add_subplot(111, sharex=ax1, sharey=ax1) - -ax1.plot(np.random.rand(100), 'o') -ax2.plot(np.random.rand(100), 'o') - -# In the latest release, it is no longer necessary to do anything -# special to share axes across figures: - -# ax1.sharex_foreign(ax2) -# ax2.sharex_foreign(ax1) - -# ax1.sharey_foreign(ax2) -# ax2.sharey_foreign(ax1) - -plt.show() diff --git a/mpl_examples/pylab_examples/shared_axis_across_figures_00.hires.png b/mpl_examples/pylab_examples/shared_axis_across_figures_00.hires.png deleted file mode 100644 index 2835252274a..00000000000 Binary files a/mpl_examples/pylab_examples/shared_axis_across_figures_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/shared_axis_across_figures_00.pdf b/mpl_examples/pylab_examples/shared_axis_across_figures_00.pdf deleted file mode 100644 index 0e03adfe06d..00000000000 Binary files a/mpl_examples/pylab_examples/shared_axis_across_figures_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/shared_axis_across_figures_00.png b/mpl_examples/pylab_examples/shared_axis_across_figures_00.png deleted file mode 100644 index 2728bb4df36..00000000000 Binary files a/mpl_examples/pylab_examples/shared_axis_across_figures_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/shared_axis_across_figures_01.hires.png b/mpl_examples/pylab_examples/shared_axis_across_figures_01.hires.png deleted file mode 100644 index 91da59a65da..00000000000 Binary files a/mpl_examples/pylab_examples/shared_axis_across_figures_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/shared_axis_across_figures_01.pdf b/mpl_examples/pylab_examples/shared_axis_across_figures_01.pdf deleted file mode 100644 index a67bf8deaf1..00000000000 Binary files a/mpl_examples/pylab_examples/shared_axis_across_figures_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/shared_axis_across_figures_01.png b/mpl_examples/pylab_examples/shared_axis_across_figures_01.png deleted file mode 100644 index fae7acf0431..00000000000 Binary files a/mpl_examples/pylab_examples/shared_axis_across_figures_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/shared_axis_demo.hires.png b/mpl_examples/pylab_examples/shared_axis_demo.hires.png deleted file mode 100644 index 839d9d35efd..00000000000 Binary files a/mpl_examples/pylab_examples/shared_axis_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/shared_axis_demo.pdf b/mpl_examples/pylab_examples/shared_axis_demo.pdf deleted file mode 100644 index da7d6c931c9..00000000000 Binary files a/mpl_examples/pylab_examples/shared_axis_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/shared_axis_demo.png b/mpl_examples/pylab_examples/shared_axis_demo.png deleted file mode 100644 index 69566adf526..00000000000 Binary files a/mpl_examples/pylab_examples/shared_axis_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/shared_axis_demo.py b/mpl_examples/pylab_examples/shared_axis_demo.py deleted file mode 100644 index e92b323e031..00000000000 --- a/mpl_examples/pylab_examples/shared_axis_demo.py +++ /dev/null @@ -1,53 +0,0 @@ -""" -You can share the x or y axis limits for one axis with another by -passing an axes instance as a sharex or sharey kwarg. - -Changing the axis limits on one axes will be reflected automatically -in the other, and vice-versa, so when you navigate with the toolbar -the axes will follow each other on their shared axes. Ditto for -changes in the axis scaling (e.g., log vs linear). However, it is -possible to have differences in tick labeling, e.g., you can selectively -turn off the tick labels on one axes. - -The example below shows how to customize the tick labels on the -various axes. Shared axes share the tick locator, tick formatter, -view limits, and transformation (e.g., log, linear). But the ticklabels -themselves do not share properties. This is a feature and not a bug, -because you may want to make the tick labels smaller on the upper -axes, e.g., in the example below. - -If you want to turn off the ticklabels for a given axes (e.g., on -subplot(211) or subplot(212), you cannot do the standard trick - - setp(ax2, xticklabels=[]) - -because this changes the tick Formatter, which is shared among all -axes. But you can alter the visibility of the labels, which is a -property - - setp( ax2.get_xticklabels(), visible=False) - -""" -import matplotlib.pyplot as plt -import numpy as np - -t = np.arange(0.01, 5.0, 0.01) -s1 = np.sin(2*np.pi*t) -s2 = np.exp(-t) -s3 = np.sin(4*np.pi*t) - -ax1 = plt.subplot(311) -plt.plot(t, s1) -plt.setp(ax1.get_xticklabels(), fontsize=6) - -# share x only -ax2 = plt.subplot(312, sharex=ax1) -plt.plot(t, s2) -# make these tick labels invisible -plt.setp(ax2.get_xticklabels(), visible=False) - -# share x and y -ax3 = plt.subplot(313, sharex=ax1, sharey=ax1) -plt.plot(t, s3) -plt.xlim(0.01, 5.0) -plt.show() diff --git a/mpl_examples/pylab_examples/simple_plot.hires.png b/mpl_examples/pylab_examples/simple_plot.hires.png deleted file mode 100644 index 43ad504fef3..00000000000 Binary files a/mpl_examples/pylab_examples/simple_plot.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/simple_plot.pdf b/mpl_examples/pylab_examples/simple_plot.pdf deleted file mode 100644 index 6c0643d7e2c..00000000000 Binary files a/mpl_examples/pylab_examples/simple_plot.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/simple_plot.png b/mpl_examples/pylab_examples/simple_plot.png deleted file mode 100644 index 47fcde7096c..00000000000 Binary files a/mpl_examples/pylab_examples/simple_plot.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/simple_plot.py b/mpl_examples/pylab_examples/simple_plot.py deleted file mode 100644 index 758f42bca2f..00000000000 --- a/mpl_examples/pylab_examples/simple_plot.py +++ /dev/null @@ -1,13 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - -t = np.arange(0.0, 2.0, 0.01) -s = 1 + np.sin(2*np.pi*t) -plt.plot(t, s) - -plt.xlabel('time (s)') -plt.ylabel('voltage (mV)') -plt.title('About as simple as it gets, folks') -plt.grid(True) -plt.savefig("test.png") -plt.show() diff --git a/mpl_examples/pylab_examples/simple_plot_fps.hires.png b/mpl_examples/pylab_examples/simple_plot_fps.hires.png deleted file mode 100644 index 1bbab27acbb..00000000000 Binary files a/mpl_examples/pylab_examples/simple_plot_fps.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/simple_plot_fps.pdf b/mpl_examples/pylab_examples/simple_plot_fps.pdf deleted file mode 100644 index f2ab95e978b..00000000000 Binary files a/mpl_examples/pylab_examples/simple_plot_fps.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/simple_plot_fps.png b/mpl_examples/pylab_examples/simple_plot_fps.png deleted file mode 100644 index 79dc647674e..00000000000 Binary files a/mpl_examples/pylab_examples/simple_plot_fps.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/simple_plot_fps.py b/mpl_examples/pylab_examples/simple_plot_fps.py deleted file mode 100644 index 23970470d31..00000000000 --- a/mpl_examples/pylab_examples/simple_plot_fps.py +++ /dev/null @@ -1,32 +0,0 @@ -""" -Example: simple line plot. -Show how to make and save a simple line plot with labels, title and grid -""" -from __future__ import print_function # not necessary in Python 3.x -import matplotlib.pyplot as plt -import numpy as np -import time - - -plt.ion() - -t = np.arange(0.0, 1.0 + 0.001, 0.001) -s = np.cos(2*2*np.pi*t) -plt.plot(t, s, '-', lw=2) - -plt.xlabel('time (s)') -plt.ylabel('voltage (mV)') -plt.title('About as simple as it gets, folks') -plt.grid(True) - -frames = 100.0 -t = time.time() -c = time.clock() -for i in range(int(frames)): - part = i / frames - plt.axis([0.0, 1.0 - part, -1.0 + part, 1.0 - part]) -wallclock = time.time() - t -user = time.clock() - c -print("wallclock:", wallclock) -print("user:", user) -print("fps:", frames / wallclock) diff --git a/mpl_examples/pylab_examples/specgram_demo.hires.png b/mpl_examples/pylab_examples/specgram_demo.hires.png deleted file mode 100644 index 6725c526f1d..00000000000 Binary files a/mpl_examples/pylab_examples/specgram_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/specgram_demo.pdf b/mpl_examples/pylab_examples/specgram_demo.pdf deleted file mode 100644 index e9179b683d3..00000000000 Binary files a/mpl_examples/pylab_examples/specgram_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/specgram_demo.png b/mpl_examples/pylab_examples/specgram_demo.png deleted file mode 100644 index 27fc09a5c63..00000000000 Binary files a/mpl_examples/pylab_examples/specgram_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/specgram_demo.py b/mpl_examples/pylab_examples/specgram_demo.py deleted file mode 100644 index 63c48ea27fd..00000000000 --- a/mpl_examples/pylab_examples/specgram_demo.py +++ /dev/null @@ -1,29 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - -dt = 0.0005 -t = np.arange(0.0, 20.0, dt) -s1 = np.sin(2*np.pi*100*t) -s2 = 2*np.sin(2*np.pi*400*t) - -# create a transient "chirp" -mask = np.where(np.logical_and(t > 10, t < 12), 1.0, 0.0) -s2 = s2 * mask - -# add some noise into the mix -nse = 0.01*np.random.random(size=len(t)) - -x = s1 + s2 + nse # the signal -NFFT = 1024 # the length of the windowing segments -Fs = int(1.0/dt) # the sampling frequency - -# Pxx is the segments x freqs array of instantaneous power, freqs is -# the frequency vector, bins are the centers of the time bins in which -# the power is computed, and im is the matplotlib.image.AxesImage -# instance - -ax1 = plt.subplot(211) -plt.plot(t, x) -plt.subplot(212, sharex=ax1) -Pxx, freqs, bins, im = plt.specgram(x, NFFT=NFFT, Fs=Fs, noverlap=900) -plt.show() diff --git a/mpl_examples/pylab_examples/spectrum_demo.hires.png b/mpl_examples/pylab_examples/spectrum_demo.hires.png deleted file mode 100644 index 7d7e0e039c2..00000000000 Binary files a/mpl_examples/pylab_examples/spectrum_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/spectrum_demo.pdf b/mpl_examples/pylab_examples/spectrum_demo.pdf deleted file mode 100644 index 9d2588899bb..00000000000 Binary files a/mpl_examples/pylab_examples/spectrum_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/spectrum_demo.png b/mpl_examples/pylab_examples/spectrum_demo.png deleted file mode 100644 index 75a8b7b9f93..00000000000 Binary files a/mpl_examples/pylab_examples/spectrum_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/spectrum_demo.py b/mpl_examples/pylab_examples/spectrum_demo.py deleted file mode 100644 index 3ad242d2c7a..00000000000 --- a/mpl_examples/pylab_examples/spectrum_demo.py +++ /dev/null @@ -1,32 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - - -np.random.seed(0) - -dt = 0.01 -Fs = 1/dt -t = np.arange(0, 10, dt) -nse = np.random.randn(len(t)) -r = np.exp(-t/0.05) - -cnse = np.convolve(nse, r)*dt -cnse = cnse[:len(t)] -s = 0.1*np.sin(2*np.pi*t) + cnse - -plt.subplot(3, 2, 1) -plt.plot(t, s) - -plt.subplot(3, 2, 3) -plt.magnitude_spectrum(s, Fs=Fs) - -plt.subplot(3, 2, 4) -plt.magnitude_spectrum(s, Fs=Fs, scale='dB') - -plt.subplot(3, 2, 5) -plt.angle_spectrum(s, Fs=Fs) - -plt.subplot(3, 2, 6) -plt.phase_spectrum(s, Fs=Fs) - -plt.show() diff --git a/mpl_examples/pylab_examples/spine_placement_demo.py b/mpl_examples/pylab_examples/spine_placement_demo.py deleted file mode 100644 index 6f955a80aa1..00000000000 --- a/mpl_examples/pylab_examples/spine_placement_demo.py +++ /dev/null @@ -1,101 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - - -fig = plt.figure() -x = np.linspace(-np.pi, np.pi, 100) -y = 2*np.sin(x) - -ax = fig.add_subplot(2, 2, 1) -ax.set_title('centered spines') -ax.plot(x, y) -ax.spines['left'].set_position('center') -ax.spines['right'].set_color('none') -ax.spines['bottom'].set_position('center') -ax.spines['top'].set_color('none') -ax.spines['left'].set_smart_bounds(True) -ax.spines['bottom'].set_smart_bounds(True) -ax.xaxis.set_ticks_position('bottom') -ax.yaxis.set_ticks_position('left') - -ax = fig.add_subplot(2, 2, 2) -ax.set_title('zeroed spines') -ax.plot(x, y) -ax.spines['left'].set_position('zero') -ax.spines['right'].set_color('none') -ax.spines['bottom'].set_position('zero') -ax.spines['top'].set_color('none') -ax.spines['left'].set_smart_bounds(True) -ax.spines['bottom'].set_smart_bounds(True) -ax.xaxis.set_ticks_position('bottom') -ax.yaxis.set_ticks_position('left') - -ax = fig.add_subplot(2, 2, 3) -ax.set_title('spines at axes (0.6, 0.1)') -ax.plot(x, y) -ax.spines['left'].set_position(('axes', 0.6)) -ax.spines['right'].set_color('none') -ax.spines['bottom'].set_position(('axes', 0.1)) -ax.spines['top'].set_color('none') -ax.spines['left'].set_smart_bounds(True) -ax.spines['bottom'].set_smart_bounds(True) -ax.xaxis.set_ticks_position('bottom') -ax.yaxis.set_ticks_position('left') - -ax = fig.add_subplot(2, 2, 4) -ax.set_title('spines at data (1, 2)') -ax.plot(x, y) -ax.spines['left'].set_position(('data', 1)) -ax.spines['right'].set_color('none') -ax.spines['bottom'].set_position(('data', 2)) -ax.spines['top'].set_color('none') -ax.spines['left'].set_smart_bounds(True) -ax.spines['bottom'].set_smart_bounds(True) -ax.xaxis.set_ticks_position('bottom') -ax.yaxis.set_ticks_position('left') -# ---------------------------------------------------- - - -def adjust_spines(ax, spines): - for loc, spine in ax.spines.items(): - if loc in spines: - spine.set_position(('outward', 10)) # outward by 10 points - spine.set_smart_bounds(True) - else: - spine.set_color('none') # don't draw spine - - # turn off ticks where there is no spine - if 'left' in spines: - ax.yaxis.set_ticks_position('left') - else: - # no yaxis ticks - ax.yaxis.set_ticks([]) - - if 'bottom' in spines: - ax.xaxis.set_ticks_position('bottom') - else: - # no xaxis ticks - ax.xaxis.set_ticks([]) - -fig = plt.figure() - -x = np.linspace(0, 2*np.pi, 100) -y = 2*np.sin(x) - -ax = fig.add_subplot(2, 2, 1) -ax.plot(x, y, clip_on=False) -adjust_spines(ax, ['left']) - -ax = fig.add_subplot(2, 2, 2) -ax.plot(x, y, clip_on=False) -adjust_spines(ax, []) - -ax = fig.add_subplot(2, 2, 3) -ax.plot(x, y, clip_on=False) -adjust_spines(ax, ['left', 'bottom']) - -ax = fig.add_subplot(2, 2, 4) -ax.plot(x, y, clip_on=False) -adjust_spines(ax, ['bottom']) - -plt.show() diff --git a/mpl_examples/pylab_examples/spine_placement_demo_00.hires.png b/mpl_examples/pylab_examples/spine_placement_demo_00.hires.png deleted file mode 100644 index ab745f781d7..00000000000 Binary files a/mpl_examples/pylab_examples/spine_placement_demo_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/spine_placement_demo_00.pdf b/mpl_examples/pylab_examples/spine_placement_demo_00.pdf deleted file mode 100644 index a00b5312ce2..00000000000 Binary files a/mpl_examples/pylab_examples/spine_placement_demo_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/spine_placement_demo_00.png b/mpl_examples/pylab_examples/spine_placement_demo_00.png deleted file mode 100644 index d166178b498..00000000000 Binary files a/mpl_examples/pylab_examples/spine_placement_demo_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/spine_placement_demo_01.hires.png b/mpl_examples/pylab_examples/spine_placement_demo_01.hires.png deleted file mode 100644 index fc8d3c564c8..00000000000 Binary files a/mpl_examples/pylab_examples/spine_placement_demo_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/spine_placement_demo_01.pdf b/mpl_examples/pylab_examples/spine_placement_demo_01.pdf deleted file mode 100644 index 85ec18d314f..00000000000 Binary files a/mpl_examples/pylab_examples/spine_placement_demo_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/spine_placement_demo_01.png b/mpl_examples/pylab_examples/spine_placement_demo_01.png deleted file mode 100644 index 76a97bd3c6e..00000000000 Binary files a/mpl_examples/pylab_examples/spine_placement_demo_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/spy_demos.hires.png b/mpl_examples/pylab_examples/spy_demos.hires.png deleted file mode 100644 index cb3bbed6130..00000000000 Binary files a/mpl_examples/pylab_examples/spy_demos.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/spy_demos.pdf b/mpl_examples/pylab_examples/spy_demos.pdf deleted file mode 100644 index bf8164a4267..00000000000 Binary files a/mpl_examples/pylab_examples/spy_demos.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/spy_demos.png b/mpl_examples/pylab_examples/spy_demos.png deleted file mode 100644 index 631a809602d..00000000000 Binary files a/mpl_examples/pylab_examples/spy_demos.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/spy_demos.py b/mpl_examples/pylab_examples/spy_demos.py deleted file mode 100644 index 2b80b352606..00000000000 --- a/mpl_examples/pylab_examples/spy_demos.py +++ /dev/null @@ -1,24 +0,0 @@ -""" -Plot the sparsity pattern of arrays -""" - -from matplotlib.pyplot import figure, show -import numpy - -fig = figure() -ax1 = fig.add_subplot(221) -ax2 = fig.add_subplot(222) -ax3 = fig.add_subplot(223) -ax4 = fig.add_subplot(224) - -x = numpy.random.randn(20, 20) -x[5] = 0. -x[:, 12] = 0. - -ax1.spy(x, markersize=5) -ax2.spy(x, precision=0.1, markersize=5) - -ax3.spy(x) -ax4.spy(x, precision=0.1) - -show() diff --git a/mpl_examples/pylab_examples/stackplot_demo.py b/mpl_examples/pylab_examples/stackplot_demo.py deleted file mode 100644 index 40b16b19468..00000000000 --- a/mpl_examples/pylab_examples/stackplot_demo.py +++ /dev/null @@ -1,19 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - - -def fnx(): - return np.random.randint(5, 50, 10) - -y = np.row_stack((fnx(), fnx(), fnx())) -x = np.arange(10) - -y1, y2, y3 = fnx(), fnx(), fnx() - -fig, ax = plt.subplots() -ax.stackplot(x, y) -plt.show() - -fig, ax = plt.subplots() -ax.stackplot(x, y1, y2, y3) -plt.show() diff --git a/mpl_examples/pylab_examples/stackplot_demo2.hires.png b/mpl_examples/pylab_examples/stackplot_demo2.hires.png deleted file mode 100644 index 9c1b04a1e7b..00000000000 Binary files a/mpl_examples/pylab_examples/stackplot_demo2.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/stackplot_demo2.pdf b/mpl_examples/pylab_examples/stackplot_demo2.pdf deleted file mode 100644 index 6f2a634924d..00000000000 Binary files a/mpl_examples/pylab_examples/stackplot_demo2.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/stackplot_demo2.png b/mpl_examples/pylab_examples/stackplot_demo2.png deleted file mode 100644 index b40f67cf0d6..00000000000 Binary files a/mpl_examples/pylab_examples/stackplot_demo2.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/stackplot_demo2.py b/mpl_examples/pylab_examples/stackplot_demo2.py deleted file mode 100644 index 844a9b11f80..00000000000 --- a/mpl_examples/pylab_examples/stackplot_demo2.py +++ /dev/null @@ -1,28 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -np.random.seed(0) - - -def layers(n, m): - """ - Return *n* random Gaussian mixtures, each of length *m*. - """ - def bump(a): - x = 1 / (.1 + np.random.random()) - y = 2 * np.random.random() - .5 - z = 10 / (.1 + np.random.random()) - for i in range(m): - w = (i / float(m) - y) * z - a[i] += x * np.exp(-w * w) - a = np.zeros((m, n)) - for i in range(n): - for j in range(5): - bump(a[:, i]) - return a - -d = layers(3, 100) - -plt.subplots() -plt.stackplot(range(100), d.T, baseline='wiggle') -plt.show() diff --git a/mpl_examples/pylab_examples/stackplot_demo_00_00.hires.png b/mpl_examples/pylab_examples/stackplot_demo_00_00.hires.png deleted file mode 100644 index 99802c74a38..00000000000 Binary files a/mpl_examples/pylab_examples/stackplot_demo_00_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/stackplot_demo_00_00.pdf b/mpl_examples/pylab_examples/stackplot_demo_00_00.pdf deleted file mode 100644 index 927af14e542..00000000000 Binary files a/mpl_examples/pylab_examples/stackplot_demo_00_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/stackplot_demo_00_00.png b/mpl_examples/pylab_examples/stackplot_demo_00_00.png deleted file mode 100644 index ea8bf13e15e..00000000000 Binary files a/mpl_examples/pylab_examples/stackplot_demo_00_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/stackplot_demo_01_00.hires.png b/mpl_examples/pylab_examples/stackplot_demo_01_00.hires.png deleted file mode 100644 index 7de8462e651..00000000000 Binary files a/mpl_examples/pylab_examples/stackplot_demo_01_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/stackplot_demo_01_00.pdf b/mpl_examples/pylab_examples/stackplot_demo_01_00.pdf deleted file mode 100644 index 28447a1f1ae..00000000000 Binary files a/mpl_examples/pylab_examples/stackplot_demo_01_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/stackplot_demo_01_00.png b/mpl_examples/pylab_examples/stackplot_demo_01_00.png deleted file mode 100644 index 383af71ca59..00000000000 Binary files a/mpl_examples/pylab_examples/stackplot_demo_01_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/stem_plot.hires.png b/mpl_examples/pylab_examples/stem_plot.hires.png deleted file mode 100644 index fed815f92b4..00000000000 Binary files a/mpl_examples/pylab_examples/stem_plot.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/stem_plot.pdf b/mpl_examples/pylab_examples/stem_plot.pdf deleted file mode 100644 index ddf15eb2679..00000000000 Binary files a/mpl_examples/pylab_examples/stem_plot.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/stem_plot.png b/mpl_examples/pylab_examples/stem_plot.png deleted file mode 100644 index 96e9be721b6..00000000000 Binary files a/mpl_examples/pylab_examples/stem_plot.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/stem_plot.py b/mpl_examples/pylab_examples/stem_plot.py deleted file mode 100644 index 6f10003a8e3..00000000000 --- a/mpl_examples/pylab_examples/stem_plot.py +++ /dev/null @@ -1,8 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - -x = np.linspace(0.1, 2*np.pi, 10) -markerline, stemlines, baseline = plt.stem(x, np.cos(x), '-.') -plt.setp(baseline, 'color', 'r', 'linewidth', 2) - -plt.show() diff --git a/mpl_examples/pylab_examples/step_demo.hires.png b/mpl_examples/pylab_examples/step_demo.hires.png deleted file mode 100644 index 9f896bf1134..00000000000 Binary files a/mpl_examples/pylab_examples/step_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/step_demo.pdf b/mpl_examples/pylab_examples/step_demo.pdf deleted file mode 100644 index 2caa8b3e47b..00000000000 Binary files a/mpl_examples/pylab_examples/step_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/step_demo.png b/mpl_examples/pylab_examples/step_demo.png deleted file mode 100644 index 8e7481d117d..00000000000 Binary files a/mpl_examples/pylab_examples/step_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/step_demo.py b/mpl_examples/pylab_examples/step_demo.py deleted file mode 100644 index a0101be6d4a..00000000000 --- a/mpl_examples/pylab_examples/step_demo.py +++ /dev/null @@ -1,25 +0,0 @@ -import numpy as np -from numpy import ma -import matplotlib.pyplot as plt - -x = np.arange(1, 7, 0.4) -y0 = np.sin(x) -y = y0.copy() + 2.5 - -plt.step(x, y, label='pre (default)') - -y -= 0.5 -plt.step(x, y, where='mid', label='mid') - -y -= 0.5 -plt.step(x, y, where='post', label='post') - -y = ma.masked_where((y0 > -0.15) & (y0 < 0.15), y - 0.5) -plt.step(x, y, label='masked (pre)') - -plt.legend() - -plt.xlim(0, 7) -plt.ylim(-0.5, 4) - -plt.show() diff --git a/mpl_examples/pylab_examples/stix_fonts_demo.py b/mpl_examples/pylab_examples/stix_fonts_demo.py deleted file mode 100644 index 81bd73575cd..00000000000 --- a/mpl_examples/pylab_examples/stix_fonts_demo.py +++ /dev/null @@ -1,58 +0,0 @@ -from __future__ import unicode_literals - -import os -import sys -import re -import gc -import matplotlib.pyplot as plt -import numpy as np - -stests = [ - r'$\mathcircled{123} \mathrm{\mathcircled{123}}' - r' \mathbf{\mathcircled{123}}$', - r'$\mathsf{Sans \Omega} \mathrm{\mathsf{Sans \Omega}}' - r' \mathbf{\mathsf{Sans \Omega}}$', - r'$\mathtt{Monospace}$', - r'$\mathcal{CALLIGRAPHIC}$', - r'$\mathbb{Blackboard \pi}$', - r'$\mathrm{\mathbb{Blackboard \pi}}$', - r'$\mathbf{\mathbb{Blackboard \pi}}$', - r'$\mathfrak{Fraktur} \mathbf{\mathfrak{Fraktur}}$', - r'$\mathscr{Script}$'] - -if sys.maxunicode > 0xffff: - s = r'Direct Unicode: $\u23ce \mathrm{\ue0f2 \U0001D538}$' - - -def doall(): - tests = stests - - plt.figure(figsize=(8, (len(tests) * 1) + 2)) - plt.plot([0, 0], 'r') - plt.grid(False) - plt.axis([0, 3, -len(tests), 0]) - plt.yticks(np.arange(len(tests)) * -1) - for i, s in enumerate(tests): - plt.text(0.1, -i, s, fontsize=32) - - plt.savefig('stix_fonts_example') - plt.show() - - -if '--latex' in sys.argv: - fd = open("stix_fonts_examples.ltx", "w") - fd.write("\\documentclass{article}\n") - fd.write("\\begin{document}\n") - fd.write("\\begin{enumerate}\n") - - for i, s in enumerate(stests): - s = re.sub(r"(?3 might result in a very high number of triangles - # for the refine mesh: new triangles numbering = (4**subdiv)*ntri - -init_mask_frac = 0.0 # Float > 0. adjusting the proportion of - # (invalid) initial triangles which will be masked - # out. Enter 0 for no mask. - -min_circle_ratio = .01 # Minimum circle ratio - border triangles with circle - # ratio below this will be masked if they touch a - # border. Suggested value 0.01 ; Use -1 to keep - # all triangles. - -# Random points -random_gen = np.random.mtrand.RandomState(seed=127260) -x_test = random_gen.uniform(-1., 1., size=n_test) -y_test = random_gen.uniform(-1., 1., size=n_test) -z_test = experiment_res(x_test, y_test) - -# meshing with Delaunay triangulation -tri = Triangulation(x_test, y_test) -ntri = tri.triangles.shape[0] - -# Some invalid data are masked out -mask_init = np.zeros(ntri, dtype=np.bool) -masked_tri = random_gen.randint(0, ntri, int(ntri*init_mask_frac)) -mask_init[masked_tri] = True -tri.set_mask(mask_init) - - -#----------------------------------------------------------------------------- -# Improving the triangulation before high-res plots: removing flat triangles -#----------------------------------------------------------------------------- -# masking badly shaped triangles at the border of the triangular mesh. -mask = TriAnalyzer(tri).get_flat_tri_mask(min_circle_ratio) -tri.set_mask(mask) - -# refining the data -refiner = UniformTriRefiner(tri) -tri_refi, z_test_refi = refiner.refine_field(z_test, subdiv=subdiv) - -# analytical 'results' for comparison -z_expected = experiment_res(tri_refi.x, tri_refi.y) - -# for the demo: loading the 'flat' triangles for plot -flat_tri = Triangulation(x_test, y_test) -flat_tri.set_mask(~mask) - - -#----------------------------------------------------------------------------- -# Now the plots -#----------------------------------------------------------------------------- -# User options for plots -plot_tri = True # plot of base triangulation -plot_masked_tri = True # plot of excessively flat excluded triangles -plot_refi_tri = False # plot of refined triangulation -plot_expected = False # plot of analytical function values for comparison - - -# Graphical options for tricontouring -levels = np.arange(0., 1., 0.025) -cmap = cm.get_cmap(name='Blues', lut=None) - -plt.figure() -plt.gca().set_aspect('equal') -plt.title("Filtering a Delaunay mesh\n" + - "(application to high-resolution tricontouring)") - -# 1) plot of the refined (computed) data contours: -plt.tricontour(tri_refi, z_test_refi, levels=levels, cmap=cmap, - linewidths=[2.0, 0.5, 1.0, 0.5]) -# 2) plot of the expected (analytical) data contours (dashed): -if plot_expected: - plt.tricontour(tri_refi, z_expected, levels=levels, cmap=cmap, - linestyles='--') -# 3) plot of the fine mesh on which interpolation was done: -if plot_refi_tri: - plt.triplot(tri_refi, color='0.97') -# 4) plot of the initial 'coarse' mesh: -if plot_tri: - plt.triplot(tri, color='0.7') -# 4) plot of the unvalidated triangles from naive Delaunay Triangulation: -if plot_masked_tri: - plt.triplot(flat_tri, color='red') - -plt.show() diff --git a/mpl_examples/pylab_examples/tricontour_smooth_user.hires.png b/mpl_examples/pylab_examples/tricontour_smooth_user.hires.png deleted file mode 100644 index 15aeecbff87..00000000000 Binary files a/mpl_examples/pylab_examples/tricontour_smooth_user.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/tricontour_smooth_user.pdf b/mpl_examples/pylab_examples/tricontour_smooth_user.pdf deleted file mode 100644 index 03930f20eef..00000000000 Binary files a/mpl_examples/pylab_examples/tricontour_smooth_user.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/tricontour_smooth_user.png b/mpl_examples/pylab_examples/tricontour_smooth_user.png deleted file mode 100644 index 108936cce80..00000000000 Binary files a/mpl_examples/pylab_examples/tricontour_smooth_user.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/tricontour_smooth_user.py b/mpl_examples/pylab_examples/tricontour_smooth_user.py deleted file mode 100644 index 3c06d553110..00000000000 --- a/mpl_examples/pylab_examples/tricontour_smooth_user.py +++ /dev/null @@ -1,76 +0,0 @@ -""" -Demonstrates high-resolution tricontouring on user-defined triangular grids -with matplotlib.tri.UniformTriRefiner -""" -import matplotlib.tri as tri -import matplotlib.pyplot as plt -import matplotlib.cm as cm -import numpy as np -import math - - -#----------------------------------------------------------------------------- -# Analytical test function -#----------------------------------------------------------------------------- -def function_z(x, y): - """ A function of 2 variables """ - r1 = np.sqrt((0.5 - x)**2 + (0.5 - y)**2) - theta1 = np.arctan2(0.5 - x, 0.5 - y) - r2 = np.sqrt((-x - 0.2)**2 + (-y - 0.2)**2) - theta2 = np.arctan2(-x - 0.2, -y - 0.2) - z = -(2*(np.exp((r1/10)**2) - 1)*30. * np.cos(7.*theta1) + - (np.exp((r2/10)**2) - 1)*30. * np.cos(11.*theta2) + - 0.7*(x**2 + y**2)) - return (np.max(z) - z)/(np.max(z) - np.min(z)) - -#----------------------------------------------------------------------------- -# Creating a Triangulation -#----------------------------------------------------------------------------- -# First create the x and y coordinates of the points. -n_angles = 20 -n_radii = 10 -min_radius = 0.15 -radii = np.linspace(min_radius, 0.95, n_radii) - -angles = np.linspace(0, 2*math.pi, n_angles, endpoint=False) -angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) -angles[:, 1::2] += math.pi/n_angles - -x = (radii*np.cos(angles)).flatten() -y = (radii*np.sin(angles)).flatten() -z = function_z(x, y) - -# Now create the Triangulation. -# (Creating a Triangulation without specifying the triangles results in the -# Delaunay triangulation of the points.) -triang = tri.Triangulation(x, y) - -# Mask off unwanted triangles. -xmid = x[triang.triangles].mean(axis=1) -ymid = y[triang.triangles].mean(axis=1) -mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0) -triang.set_mask(mask) - -#----------------------------------------------------------------------------- -# Refine data -#----------------------------------------------------------------------------- -refiner = tri.UniformTriRefiner(triang) -tri_refi, z_test_refi = refiner.refine_field(z, subdiv=3) - -#----------------------------------------------------------------------------- -# Plot the triangulation and the high-res iso-contours -#----------------------------------------------------------------------------- -plt.figure() -plt.gca().set_aspect('equal') -plt.triplot(triang, lw=0.5, color='white') - -levels = np.arange(0., 1., 0.025) -cmap = cm.get_cmap(name='terrain', lut=None) -plt.tricontourf(tri_refi, z_test_refi, levels=levels, cmap=cmap) -plt.tricontour(tri_refi, z_test_refi, levels=levels, - colors=['0.25', '0.5', '0.5', '0.5', '0.5'], - linewidths=[1.0, 0.5, 0.5, 0.5, 0.5]) - -plt.title("High-resolution tricontouring") - -plt.show() diff --git a/mpl_examples/pylab_examples/tricontour_vs_griddata.hires.png b/mpl_examples/pylab_examples/tricontour_vs_griddata.hires.png deleted file mode 100644 index 807b6260c1e..00000000000 Binary files a/mpl_examples/pylab_examples/tricontour_vs_griddata.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/tricontour_vs_griddata.pdf b/mpl_examples/pylab_examples/tricontour_vs_griddata.pdf deleted file mode 100644 index 03c8d009dde..00000000000 Binary files a/mpl_examples/pylab_examples/tricontour_vs_griddata.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/tricontour_vs_griddata.png b/mpl_examples/pylab_examples/tricontour_vs_griddata.png deleted file mode 100644 index a4ad36a69eb..00000000000 Binary files a/mpl_examples/pylab_examples/tricontour_vs_griddata.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/tricontour_vs_griddata.py b/mpl_examples/pylab_examples/tricontour_vs_griddata.py deleted file mode 100644 index 7307d37b76c..00000000000 --- a/mpl_examples/pylab_examples/tricontour_vs_griddata.py +++ /dev/null @@ -1,53 +0,0 @@ -""" -Comparison of griddata and tricontour for an unstructured triangular grid. -""" -from __future__ import print_function -import matplotlib.pyplot as plt -import matplotlib.tri as tri -import numpy as np -import numpy.random as rnd -import matplotlib.mlab as mlab -import time - -rnd.seed(0) -npts = 200 -ngridx = 100 -ngridy = 200 -x = rnd.uniform(-2, 2, npts) -y = rnd.uniform(-2, 2, npts) -z = x*np.exp(-x**2 - y**2) - -# griddata and contour. -start = time.clock() -plt.subplot(211) -xi = np.linspace(-2.1, 2.1, ngridx) -yi = np.linspace(-2.1, 2.1, ngridy) -zi = mlab.griddata(x, y, z, xi, yi, interp='linear') -plt.contour(xi, yi, zi, 15, linewidths=0.5, colors='k') -plt.contourf(xi, yi, zi, 15, - norm=plt.Normalize(vmax=abs(zi).max(), vmin=-abs(zi).max())) -plt.colorbar() # draw colorbar -plt.plot(x, y, 'ko', ms=3) -plt.xlim(-2, 2) -plt.ylim(-2, 2) -plt.title('griddata and contour (%d points, %d grid points)' % - (npts, ngridx*ngridy)) -print('griddata and contour seconds: %f' % (time.clock() - start)) - -# tricontour. -start = time.clock() -plt.subplot(212) -triang = tri.Triangulation(x, y) -plt.tricontour(x, y, z, 15, linewidths=0.5, colors='k') -plt.tricontourf(x, y, z, 15, - norm=plt.Normalize(vmax=abs(zi).max(), vmin=-abs(zi).max())) -plt.colorbar() -plt.plot(x, y, 'ko', ms=3) -plt.xlim(-2, 2) -plt.ylim(-2, 2) -plt.title('tricontour (%d points)' % npts) -print('tricontour seconds: %f' % (time.clock() - start)) - -plt.subplots_adjust(hspace=0.5) - -plt.show() diff --git a/mpl_examples/pylab_examples/trigradient_demo.hires.png b/mpl_examples/pylab_examples/trigradient_demo.hires.png deleted file mode 100644 index b6cb0c7b3ea..00000000000 Binary files a/mpl_examples/pylab_examples/trigradient_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/trigradient_demo.pdf b/mpl_examples/pylab_examples/trigradient_demo.pdf deleted file mode 100644 index b6ad645d7b5..00000000000 Binary files a/mpl_examples/pylab_examples/trigradient_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/trigradient_demo.png b/mpl_examples/pylab_examples/trigradient_demo.png deleted file mode 100644 index 95ac973bdde..00000000000 Binary files a/mpl_examples/pylab_examples/trigradient_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/trigradient_demo.py b/mpl_examples/pylab_examples/trigradient_demo.py deleted file mode 100644 index dbc48c3f4c2..00000000000 --- a/mpl_examples/pylab_examples/trigradient_demo.py +++ /dev/null @@ -1,85 +0,0 @@ -""" -Demonstrates computation of gradient with matplotlib.tri.CubicTriInterpolator. -""" -from matplotlib.tri import Triangulation, UniformTriRefiner,\ - CubicTriInterpolator -import matplotlib.pyplot as plt -import matplotlib.cm as cm -import numpy as np -import math - - -#----------------------------------------------------------------------------- -# Electrical potential of a dipole -#----------------------------------------------------------------------------- -def dipole_potential(x, y): - """ The electric dipole potential V """ - r_sq = x**2 + y**2 - theta = np.arctan2(y, x) - z = np.cos(theta)/r_sq - return (np.max(z) - z) / (np.max(z) - np.min(z)) - - -#----------------------------------------------------------------------------- -# Creating a Triangulation -#----------------------------------------------------------------------------- -# First create the x and y coordinates of the points. -n_angles = 30 -n_radii = 10 -min_radius = 0.2 -radii = np.linspace(min_radius, 0.95, n_radii) - -angles = np.linspace(0, 2*math.pi, n_angles, endpoint=False) -angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) -angles[:, 1::2] += math.pi/n_angles - -x = (radii*np.cos(angles)).flatten() -y = (radii*np.sin(angles)).flatten() -V = dipole_potential(x, y) - -# Create the Triangulation; no triangles specified so Delaunay triangulation -# created. -triang = Triangulation(x, y) - -# Mask off unwanted triangles. -xmid = x[triang.triangles].mean(axis=1) -ymid = y[triang.triangles].mean(axis=1) -mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0) -triang.set_mask(mask) - -#----------------------------------------------------------------------------- -# Refine data - interpolates the electrical potential V -#----------------------------------------------------------------------------- -refiner = UniformTriRefiner(triang) -tri_refi, z_test_refi = refiner.refine_field(V, subdiv=3) - -#----------------------------------------------------------------------------- -# Computes the electrical field (Ex, Ey) as gradient of electrical potential -#----------------------------------------------------------------------------- -tci = CubicTriInterpolator(triang, -V) -# Gradient requested here at the mesh nodes but could be anywhere else: -(Ex, Ey) = tci.gradient(triang.x, triang.y) -E_norm = np.sqrt(Ex**2 + Ey**2) - -#----------------------------------------------------------------------------- -# Plot the triangulation, the potential iso-contours and the vector field -#----------------------------------------------------------------------------- -fig, ax = plt.subplots() -ax.set_aspect('equal') -# Enforce the margins, and enlarge them to give room for the vectors. -ax.use_sticky_edges = False -ax.margins(0.07) - -ax.triplot(triang, color='0.8') - -levels = np.arange(0., 1., 0.01) -cmap = cm.get_cmap(name='hot', lut=None) -ax.tricontour(tri_refi, z_test_refi, levels=levels, cmap=cmap, - linewidths=[2.0, 1.0, 1.0, 1.0]) -# Plots direction of the electrical vector field -ax.quiver(triang.x, triang.y, Ex/E_norm, Ey/E_norm, - units='xy', scale=10., zorder=3, color='blue', - width=0.007, headwidth=3., headlength=4.) - -ax.set_title('Gradient plot: an electrical dipole') -plt.show() diff --git a/mpl_examples/pylab_examples/triinterp_demo.hires.png b/mpl_examples/pylab_examples/triinterp_demo.hires.png deleted file mode 100644 index be65e63c824..00000000000 Binary files a/mpl_examples/pylab_examples/triinterp_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/triinterp_demo.pdf b/mpl_examples/pylab_examples/triinterp_demo.pdf deleted file mode 100644 index d798bdbffbf..00000000000 Binary files a/mpl_examples/pylab_examples/triinterp_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/triinterp_demo.png b/mpl_examples/pylab_examples/triinterp_demo.png deleted file mode 100644 index 6337412fe13..00000000000 Binary files a/mpl_examples/pylab_examples/triinterp_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/triinterp_demo.py b/mpl_examples/pylab_examples/triinterp_demo.py deleted file mode 100644 index f955727064d..00000000000 --- a/mpl_examples/pylab_examples/triinterp_demo.py +++ /dev/null @@ -1,57 +0,0 @@ -""" -Interpolation from triangular grid to quad grid. -""" -import matplotlib.pyplot as plt -import matplotlib.tri as mtri -import numpy as np - -# Create triangulation. -x = np.asarray([0, 1, 2, 3, 0.5, 1.5, 2.5, 1, 2, 1.5]) -y = np.asarray([0, 0, 0, 0, 1.0, 1.0, 1.0, 2, 2, 3.0]) -triangles = [[0, 1, 4], [1, 2, 5], [2, 3, 6], [1, 5, 4], [2, 6, 5], [4, 5, 7], - [5, 6, 8], [5, 8, 7], [7, 8, 9]] -triang = mtri.Triangulation(x, y, triangles) - -# Interpolate to regularly-spaced quad grid. -z = np.cos(1.5*x)*np.cos(1.5*y) -xi, yi = np.meshgrid(np.linspace(0, 3, 20), np.linspace(0, 3, 20)) - -interp_lin = mtri.LinearTriInterpolator(triang, z) -zi_lin = interp_lin(xi, yi) - -interp_cubic_geom = mtri.CubicTriInterpolator(triang, z, kind='geom') -zi_cubic_geom = interp_cubic_geom(xi, yi) - -interp_cubic_min_E = mtri.CubicTriInterpolator(triang, z, kind='min_E') -zi_cubic_min_E = interp_cubic_min_E(xi, yi) - - -# Plot the triangulation. -plt.subplot(221) -plt.tricontourf(triang, z) -plt.triplot(triang, 'ko-') -plt.title('Triangular grid') - -# Plot linear interpolation to quad grid. -plt.subplot(222) -plt.contourf(xi, yi, zi_lin) -plt.plot(xi, yi, 'k-', lw=0.5, alpha=0.5) -plt.plot(xi.T, yi.T, 'k-', lw=0.5, alpha=0.5) -plt.title("Linear interpolation") - -# Plot cubic interpolation to quad grid, kind=geom -plt.subplot(223) -plt.contourf(xi, yi, zi_cubic_geom) -plt.plot(xi, yi, 'k-', lw=0.5, alpha=0.5) -plt.plot(xi.T, yi.T, 'k-', lw=0.5, alpha=0.5) -plt.title("Cubic interpolation,\nkind='geom'") - -# Plot cubic interpolation to quad grid, kind=min_E -plt.subplot(224) -plt.contourf(xi, yi, zi_cubic_min_E) -plt.plot(xi, yi, 'k-', lw=0.5, alpha=0.5) -plt.plot(xi.T, yi.T, 'k-', lw=0.5, alpha=0.5) -plt.title("Cubic interpolation,\nkind='min_E'") - -plt.tight_layout() -plt.show() diff --git a/mpl_examples/pylab_examples/tripcolor_demo.py b/mpl_examples/pylab_examples/tripcolor_demo.py deleted file mode 100644 index bb7bb4ed022..00000000000 --- a/mpl_examples/pylab_examples/tripcolor_demo.py +++ /dev/null @@ -1,116 +0,0 @@ -""" -Pseudocolor plots of unstructured triangular grids. -""" -import matplotlib.pyplot as plt -import matplotlib.tri as tri -import numpy as np -import math - -# Creating a Triangulation without specifying the triangles results in the -# Delaunay triangulation of the points. - -# First create the x and y coordinates of the points. -n_angles = 36 -n_radii = 8 -min_radius = 0.25 -radii = np.linspace(min_radius, 0.95, n_radii) - -angles = np.linspace(0, 2*math.pi, n_angles, endpoint=False) -angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) -angles[:, 1::2] += math.pi/n_angles - -x = (radii*np.cos(angles)).flatten() -y = (radii*np.sin(angles)).flatten() -z = (np.cos(radii)*np.cos(angles*3.0)).flatten() - -# Create the Triangulation; no triangles so Delaunay triangulation created. -triang = tri.Triangulation(x, y) - -# Mask off unwanted triangles. -xmid = x[triang.triangles].mean(axis=1) -ymid = y[triang.triangles].mean(axis=1) -mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0) -triang.set_mask(mask) - -# tripcolor plot. -plt.figure() -plt.gca().set_aspect('equal') -plt.tripcolor(triang, z, shading='flat') -plt.colorbar() -plt.title('tripcolor of Delaunay triangulation, flat shading') - -# Illustrate Gouraud shading. -plt.figure() -plt.gca().set_aspect('equal') -plt.tripcolor(triang, z, shading='gouraud') -plt.colorbar() -plt.title('tripcolor of Delaunay triangulation, gouraud shading') - - -# You can specify your own triangulation rather than perform a Delaunay -# triangulation of the points, where each triangle is given by the indices of -# the three points that make up the triangle, ordered in either a clockwise or -# anticlockwise manner. - -xy = np.asarray([ - [-0.101, 0.872], [-0.080, 0.883], [-0.069, 0.888], [-0.054, 0.890], - [-0.045, 0.897], [-0.057, 0.895], [-0.073, 0.900], [-0.087, 0.898], - [-0.090, 0.904], [-0.069, 0.907], [-0.069, 0.921], [-0.080, 0.919], - [-0.073, 0.928], [-0.052, 0.930], [-0.048, 0.942], [-0.062, 0.949], - [-0.054, 0.958], [-0.069, 0.954], [-0.087, 0.952], [-0.087, 0.959], - [-0.080, 0.966], [-0.085, 0.973], [-0.087, 0.965], [-0.097, 0.965], - [-0.097, 0.975], [-0.092, 0.984], [-0.101, 0.980], [-0.108, 0.980], - [-0.104, 0.987], [-0.102, 0.993], [-0.115, 1.001], [-0.099, 0.996], - [-0.101, 1.007], [-0.090, 1.010], [-0.087, 1.021], [-0.069, 1.021], - [-0.052, 1.022], [-0.052, 1.017], [-0.069, 1.010], [-0.064, 1.005], - [-0.048, 1.005], [-0.031, 1.005], [-0.031, 0.996], [-0.040, 0.987], - [-0.045, 0.980], [-0.052, 0.975], [-0.040, 0.973], [-0.026, 0.968], - [-0.020, 0.954], [-0.006, 0.947], [ 0.003, 0.935], [ 0.006, 0.926], - [ 0.005, 0.921], [ 0.022, 0.923], [ 0.033, 0.912], [ 0.029, 0.905], - [ 0.017, 0.900], [ 0.012, 0.895], [ 0.027, 0.893], [ 0.019, 0.886], - [ 0.001, 0.883], [-0.012, 0.884], [-0.029, 0.883], [-0.038, 0.879], - [-0.057, 0.881], [-0.062, 0.876], [-0.078, 0.876], [-0.087, 0.872], - [-0.030, 0.907], [-0.007, 0.905], [-0.057, 0.916], [-0.025, 0.933], - [-0.077, 0.990], [-0.059, 0.993]]) -x = xy[:, 0]*180/3.14159 -y = xy[:, 1]*180/3.14159 - -triangles = np.asarray([ - [67, 66, 1], [65, 2, 66], [ 1, 66, 2], [64, 2, 65], [63, 3, 64], - [60, 59, 57], [ 2, 64, 3], [ 3, 63, 4], [ 0, 67, 1], [62, 4, 63], - [57, 59, 56], [59, 58, 56], [61, 60, 69], [57, 69, 60], [ 4, 62, 68], - [ 6, 5, 9], [61, 68, 62], [69, 68, 61], [ 9, 5, 70], [ 6, 8, 7], - [ 4, 70, 5], [ 8, 6, 9], [56, 69, 57], [69, 56, 52], [70, 10, 9], - [54, 53, 55], [56, 55, 53], [68, 70, 4], [52, 56, 53], [11, 10, 12], - [69, 71, 68], [68, 13, 70], [10, 70, 13], [51, 50, 52], [13, 68, 71], - [52, 71, 69], [12, 10, 13], [71, 52, 50], [71, 14, 13], [50, 49, 71], - [49, 48, 71], [14, 16, 15], [14, 71, 48], [17, 19, 18], [17, 20, 19], - [48, 16, 14], [48, 47, 16], [47, 46, 16], [16, 46, 45], [23, 22, 24], - [21, 24, 22], [17, 16, 45], [20, 17, 45], [21, 25, 24], [27, 26, 28], - [20, 72, 21], [25, 21, 72], [45, 72, 20], [25, 28, 26], [44, 73, 45], - [72, 45, 73], [28, 25, 29], [29, 25, 31], [43, 73, 44], [73, 43, 40], - [72, 73, 39], [72, 31, 25], [42, 40, 43], [31, 30, 29], [39, 73, 40], - [42, 41, 40], [72, 33, 31], [32, 31, 33], [39, 38, 72], [33, 72, 38], - [33, 38, 34], [37, 35, 38], [34, 38, 35], [35, 37, 36]]) - -xmid = x[triangles].mean(axis=1) -ymid = y[triangles].mean(axis=1) -x0 = -5 -y0 = 52 -zfaces = np.exp(-0.01*((xmid - x0)*(xmid - x0) + (ymid - y0)*(ymid - y0))) - -# Rather than create a Triangulation object, can simply pass x, y and triangles -# arrays to tripcolor directly. It would be better to use a Triangulation -# object if the same triangulation was to be used more than once to save -# duplicated calculations. -# Can specify one color value per face rather than one per point by using the -# facecolors kwarg. -plt.figure() -plt.gca().set_aspect('equal') -plt.tripcolor(x, y, triangles, facecolors=zfaces, edgecolors='k') -plt.colorbar() -plt.title('tripcolor of user-specified triangulation') -plt.xlabel('Longitude (degrees)') -plt.ylabel('Latitude (degrees)') - -plt.show() diff --git a/mpl_examples/pylab_examples/tripcolor_demo_00.hires.png b/mpl_examples/pylab_examples/tripcolor_demo_00.hires.png deleted file mode 100644 index 80105e67136..00000000000 Binary files a/mpl_examples/pylab_examples/tripcolor_demo_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/tripcolor_demo_00.pdf b/mpl_examples/pylab_examples/tripcolor_demo_00.pdf deleted file mode 100644 index 2172dba36b8..00000000000 Binary files a/mpl_examples/pylab_examples/tripcolor_demo_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/tripcolor_demo_00.png b/mpl_examples/pylab_examples/tripcolor_demo_00.png deleted file mode 100644 index 6d065220058..00000000000 Binary files a/mpl_examples/pylab_examples/tripcolor_demo_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/tripcolor_demo_01.hires.png b/mpl_examples/pylab_examples/tripcolor_demo_01.hires.png deleted file mode 100644 index 7d69a9ea339..00000000000 Binary files a/mpl_examples/pylab_examples/tripcolor_demo_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/tripcolor_demo_01.pdf b/mpl_examples/pylab_examples/tripcolor_demo_01.pdf deleted file mode 100644 index b518e4e9792..00000000000 Binary files a/mpl_examples/pylab_examples/tripcolor_demo_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/tripcolor_demo_01.png b/mpl_examples/pylab_examples/tripcolor_demo_01.png deleted file mode 100644 index b9ea23f9441..00000000000 Binary files a/mpl_examples/pylab_examples/tripcolor_demo_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/tripcolor_demo_02.hires.png b/mpl_examples/pylab_examples/tripcolor_demo_02.hires.png deleted file mode 100644 index 9ac17af76c7..00000000000 Binary files a/mpl_examples/pylab_examples/tripcolor_demo_02.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/tripcolor_demo_02.pdf b/mpl_examples/pylab_examples/tripcolor_demo_02.pdf deleted file mode 100644 index eb4eef5065a..00000000000 Binary files a/mpl_examples/pylab_examples/tripcolor_demo_02.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/tripcolor_demo_02.png b/mpl_examples/pylab_examples/tripcolor_demo_02.png deleted file mode 100644 index 13e5e5d8d9d..00000000000 Binary files a/mpl_examples/pylab_examples/tripcolor_demo_02.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/triplot_demo.py b/mpl_examples/pylab_examples/triplot_demo.py deleted file mode 100644 index 7b3cee6cdd1..00000000000 --- a/mpl_examples/pylab_examples/triplot_demo.py +++ /dev/null @@ -1,98 +0,0 @@ -""" -Creating and plotting unstructured triangular grids. -""" -import matplotlib.pyplot as plt -import matplotlib.tri as tri -import numpy as np -import math - -# Creating a Triangulation without specifying the triangles results in the -# Delaunay triangulation of the points. - -# First create the x and y coordinates of the points. -n_angles = 36 -n_radii = 8 -min_radius = 0.25 -radii = np.linspace(min_radius, 0.95, n_radii) - -angles = np.linspace(0, 2*math.pi, n_angles, endpoint=False) -angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) -angles[:, 1::2] += math.pi/n_angles - -x = (radii*np.cos(angles)).flatten() -y = (radii*np.sin(angles)).flatten() - -# Create the Triangulation; no triangles so Delaunay triangulation created. -triang = tri.Triangulation(x, y) - -# Mask off unwanted triangles. -xmid = x[triang.triangles].mean(axis=1) -ymid = y[triang.triangles].mean(axis=1) -mask = np.where(xmid*xmid + ymid*ymid < min_radius*min_radius, 1, 0) -triang.set_mask(mask) - -# Plot the triangulation. -plt.figure() -plt.gca().set_aspect('equal') -plt.triplot(triang, 'bo-', lw=1) -plt.title('triplot of Delaunay triangulation') - - -# You can specify your own triangulation rather than perform a Delaunay -# triangulation of the points, where each triangle is given by the indices of -# the three points that make up the triangle, ordered in either a clockwise or -# anticlockwise manner. - -xy = np.asarray([ - [-0.101, 0.872], [-0.080, 0.883], [-0.069, 0.888], [-0.054, 0.890], - [-0.045, 0.897], [-0.057, 0.895], [-0.073, 0.900], [-0.087, 0.898], - [-0.090, 0.904], [-0.069, 0.907], [-0.069, 0.921], [-0.080, 0.919], - [-0.073, 0.928], [-0.052, 0.930], [-0.048, 0.942], [-0.062, 0.949], - [-0.054, 0.958], [-0.069, 0.954], [-0.087, 0.952], [-0.087, 0.959], - [-0.080, 0.966], [-0.085, 0.973], [-0.087, 0.965], [-0.097, 0.965], - [-0.097, 0.975], [-0.092, 0.984], [-0.101, 0.980], [-0.108, 0.980], - [-0.104, 0.987], [-0.102, 0.993], [-0.115, 1.001], [-0.099, 0.996], - [-0.101, 1.007], [-0.090, 1.010], [-0.087, 1.021], [-0.069, 1.021], - [-0.052, 1.022], [-0.052, 1.017], [-0.069, 1.010], [-0.064, 1.005], - [-0.048, 1.005], [-0.031, 1.005], [-0.031, 0.996], [-0.040, 0.987], - [-0.045, 0.980], [-0.052, 0.975], [-0.040, 0.973], [-0.026, 0.968], - [-0.020, 0.954], [-0.006, 0.947], [ 0.003, 0.935], [ 0.006, 0.926], - [ 0.005, 0.921], [ 0.022, 0.923], [ 0.033, 0.912], [ 0.029, 0.905], - [ 0.017, 0.900], [ 0.012, 0.895], [ 0.027, 0.893], [ 0.019, 0.886], - [ 0.001, 0.883], [-0.012, 0.884], [-0.029, 0.883], [-0.038, 0.879], - [-0.057, 0.881], [-0.062, 0.876], [-0.078, 0.876], [-0.087, 0.872], - [-0.030, 0.907], [-0.007, 0.905], [-0.057, 0.916], [-0.025, 0.933], - [-0.077, 0.990], [-0.059, 0.993]]) -x = np.degrees(xy[:, 0]) -y = np.degrees(xy[:, 1]) - -triangles = np.asarray([ - [67, 66, 1], [65, 2, 66], [ 1, 66, 2], [64, 2, 65], [63, 3, 64], - [60, 59, 57], [ 2, 64, 3], [ 3, 63, 4], [ 0, 67, 1], [62, 4, 63], - [57, 59, 56], [59, 58, 56], [61, 60, 69], [57, 69, 60], [ 4, 62, 68], - [ 6, 5, 9], [61, 68, 62], [69, 68, 61], [ 9, 5, 70], [ 6, 8, 7], - [ 4, 70, 5], [ 8, 6, 9], [56, 69, 57], [69, 56, 52], [70, 10, 9], - [54, 53, 55], [56, 55, 53], [68, 70, 4], [52, 56, 53], [11, 10, 12], - [69, 71, 68], [68, 13, 70], [10, 70, 13], [51, 50, 52], [13, 68, 71], - [52, 71, 69], [12, 10, 13], [71, 52, 50], [71, 14, 13], [50, 49, 71], - [49, 48, 71], [14, 16, 15], [14, 71, 48], [17, 19, 18], [17, 20, 19], - [48, 16, 14], [48, 47, 16], [47, 46, 16], [16, 46, 45], [23, 22, 24], - [21, 24, 22], [17, 16, 45], [20, 17, 45], [21, 25, 24], [27, 26, 28], - [20, 72, 21], [25, 21, 72], [45, 72, 20], [25, 28, 26], [44, 73, 45], - [72, 45, 73], [28, 25, 29], [29, 25, 31], [43, 73, 44], [73, 43, 40], - [72, 73, 39], [72, 31, 25], [42, 40, 43], [31, 30, 29], [39, 73, 40], - [42, 41, 40], [72, 33, 31], [32, 31, 33], [39, 38, 72], [33, 72, 38], - [33, 38, 34], [37, 35, 38], [34, 38, 35], [35, 37, 36]]) - -# Rather than create a Triangulation object, can simply pass x, y and triangles -# arrays to triplot directly. It would be better to use a Triangulation object -# if the same triangulation was to be used more than once to save duplicated -# calculations. -plt.figure() -plt.gca().set_aspect('equal') -plt.triplot(x, y, triangles, 'go-', lw=1.0) -plt.title('triplot of user-specified triangulation') -plt.xlabel('Longitude (degrees)') -plt.ylabel('Latitude (degrees)') - -plt.show() diff --git a/mpl_examples/pylab_examples/triplot_demo_00.hires.png b/mpl_examples/pylab_examples/triplot_demo_00.hires.png deleted file mode 100644 index 893f8a9a4bc..00000000000 Binary files a/mpl_examples/pylab_examples/triplot_demo_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/triplot_demo_00.pdf b/mpl_examples/pylab_examples/triplot_demo_00.pdf deleted file mode 100644 index 7568ee35295..00000000000 Binary files a/mpl_examples/pylab_examples/triplot_demo_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/triplot_demo_00.png b/mpl_examples/pylab_examples/triplot_demo_00.png deleted file mode 100644 index 41da287e9a5..00000000000 Binary files a/mpl_examples/pylab_examples/triplot_demo_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/triplot_demo_01.hires.png b/mpl_examples/pylab_examples/triplot_demo_01.hires.png deleted file mode 100644 index 5622d5b4879..00000000000 Binary files a/mpl_examples/pylab_examples/triplot_demo_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/triplot_demo_01.pdf b/mpl_examples/pylab_examples/triplot_demo_01.pdf deleted file mode 100644 index 5ea88c746e4..00000000000 Binary files a/mpl_examples/pylab_examples/triplot_demo_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/triplot_demo_01.png b/mpl_examples/pylab_examples/triplot_demo_01.png deleted file mode 100644 index 26837648962..00000000000 Binary files a/mpl_examples/pylab_examples/triplot_demo_01.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/usetex_baseline_test.hires.png b/mpl_examples/pylab_examples/usetex_baseline_test.hires.png deleted file mode 100644 index 1e971c0ecf7..00000000000 Binary files a/mpl_examples/pylab_examples/usetex_baseline_test.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/usetex_baseline_test.pdf b/mpl_examples/pylab_examples/usetex_baseline_test.pdf deleted file mode 100644 index ca754d7c963..00000000000 Binary files a/mpl_examples/pylab_examples/usetex_baseline_test.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/usetex_baseline_test.png b/mpl_examples/pylab_examples/usetex_baseline_test.png deleted file mode 100644 index 422addd4d42..00000000000 Binary files a/mpl_examples/pylab_examples/usetex_baseline_test.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/usetex_baseline_test.py b/mpl_examples/pylab_examples/usetex_baseline_test.py deleted file mode 100644 index 09e631b0df7..00000000000 --- a/mpl_examples/pylab_examples/usetex_baseline_test.py +++ /dev/null @@ -1,77 +0,0 @@ - -import matplotlib -import matplotlib.pyplot as plt -import matplotlib.axes as maxes - -from matplotlib import rcParams -rcParams['text.usetex'] = True -rcParams['text.latex.unicode'] = True - - -class Axes(maxes.Axes): - """ - A hackish way to simultaneously draw texts w/ usetex=True and - usetex=False in the same figure. It does not work in the ps backend. - """ - - def __init__(self, *kl, **kw): - self.usetex = kw.pop("usetex", "False") - self.preview = kw.pop("preview", "False") - - maxes.Axes.__init__(self, *kl, **kw) - - def draw(self, renderer): - usetex = plt.rcParams["text.usetex"] - preview = plt.rcParams["text.latex.preview"] - plt.rcParams["text.usetex"] = self.usetex - plt.rcParams["text.latex.preview"] = self.preview - - maxes.Axes.draw(self, renderer) - - plt.rcParams["text.usetex"] = usetex - plt.rcParams["text.latex.preview"] = preview - -subplot = maxes.subplot_class_factory(Axes) - - -def test_window_extent(ax, usetex, preview): - - va = "baseline" - ax.xaxis.set_visible(False) - ax.yaxis.set_visible(False) - - #t = ax.text(0., 0., r"mlp", va="baseline", size=150) - text_kw = dict(va=va, - size=50, - bbox=dict(pad=0., ec="k", fc="none")) - - test_strings = ["lg", r"$\frac{1}{2}\pi$", - r"$p^{3^A}$", r"$p_{3_2}$"] - - ax.axvline(0, color="r") - - for i, s in enumerate(test_strings): - - ax.axhline(i, color="r") - ax.text(0., 3 - i, s, **text_kw) - - ax.set_xlim(-0.1, 1.1) - ax.set_ylim(-.8, 3.9) - - ax.set_title("usetex=%s\npreview=%s" % (str(usetex), str(preview))) - - -fig = plt.figure(figsize=(2.*3, 6.5)) - -for i, usetex, preview in [[0, False, False], - [1, True, False], - [2, True, True]]: - ax = subplot(fig, 1, 3, i + 1, usetex=usetex, preview=preview) - fig.add_subplot(ax) - fig.subplots_adjust(top=0.85) - - test_window_extent(ax, usetex=usetex, preview=preview) - - -plt.draw() -plt.show() diff --git a/mpl_examples/pylab_examples/usetex_demo.hires.png b/mpl_examples/pylab_examples/usetex_demo.hires.png deleted file mode 100644 index b37c22c0830..00000000000 Binary files a/mpl_examples/pylab_examples/usetex_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/usetex_demo.pdf b/mpl_examples/pylab_examples/usetex_demo.pdf deleted file mode 100644 index 7a33f8383c2..00000000000 Binary files a/mpl_examples/pylab_examples/usetex_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/usetex_demo.png b/mpl_examples/pylab_examples/usetex_demo.png deleted file mode 100644 index abb6a0903f6..00000000000 Binary files a/mpl_examples/pylab_examples/usetex_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/usetex_demo.py b/mpl_examples/pylab_examples/usetex_demo.py deleted file mode 100644 index 05797b83459..00000000000 --- a/mpl_examples/pylab_examples/usetex_demo.py +++ /dev/null @@ -1,70 +0,0 @@ -import matplotlib -matplotlib.rc('text', usetex=True) -import matplotlib.pyplot as plt -import numpy as np - -# interface tracking profiles -N = 500 -delta = 0.6 -X = np.linspace(-1, 1, N) -plt.plot(X, (1 - np.tanh(4.*X/delta))/2, # phase field tanh profiles - X, (X + 1)/2, # level set distance function - X, (1.4 + np.tanh(4.*X/delta))/4, # composition profile - X, X < 0, 'k--', # sharp interface - ) - -# legend -plt.legend(('phase field', 'level set', 'composition', 'sharp interface'), shadow=True, loc=(0.01, 0.55)) - -ltext = plt.gca().get_legend().get_texts() -plt.setp(ltext[0], fontsize=20) -plt.setp(ltext[1], fontsize=20) -plt.setp(ltext[2], fontsize=20) -plt.setp(ltext[3], fontsize=20) - -# the arrow -height = 0.1 -offset = 0.02 -plt.plot((-delta / 2., delta / 2), (height, height), 'k', linewidth=2) -plt.plot((-delta / 2, -delta / 2 + offset * 2), (height, height - offset), 'k', linewidth=2) -plt.plot((-delta / 2, -delta / 2 + offset * 2), (height, height + offset), 'k', linewidth=2) -plt.plot((delta / 2, delta / 2 - offset * 2), (height, height - offset), 'k', linewidth=2) -plt.plot((delta / 2, delta / 2 - offset * 2), (height, height + offset), 'k', linewidth=2) -plt.text(-0.06, height - 0.06, r'$\delta$', {'color': 'k', 'fontsize': 24}) - -# X-axis label -plt.xticks((-1, 0, 1), ('-1', '0', '1'), color='k', size=20) - -# Left Y-axis labels -plt.ylabel(r'\bf{phase field} $\phi$', {'color': 'b', - 'fontsize': 20}) -plt.yticks((0, 0.5, 1), ('0', '.5', '1'), color='k', size=20) - -# Right Y-axis labels -plt.text(1.05, 0.5, r"\bf{level set} $\phi$", {'color': 'g', 'fontsize': 20}, - horizontalalignment='left', - verticalalignment='center', - rotation=90, - clip_on=False) -plt.text(1.01, -0.02, "-1", {'color': 'k', 'fontsize': 20}) -plt.text(1.01, 0.98, "1", {'color': 'k', 'fontsize': 20}) -plt.text(1.01, 0.48, "0", {'color': 'k', 'fontsize': 20}) - -# level set equations -plt.text(0.1, 0.85, - r'$|\nabla\phi| = 1,$ \newline $ \frac{\partial \phi}{\partial t}' - r'+ U|\nabla \phi| = 0$', - {'color': 'g', 'fontsize': 20}) - -# phase field equations -plt.text(0.2, 0.15, - r'$\mathcal{F} = \int f\left( \phi, c \right) dV,$ \newline ' - r'$ \frac{ \partial \phi } { \partial t } = -M_{ \phi } ' - r'\frac{ \delta \mathcal{F} } { \delta \phi }$', - {'color': 'b', 'fontsize': 20}) - -# these went wrong in pdf in a previous version -plt.text(-.9, .42, r'gamma: $\gamma$', {'color': 'r', 'fontsize': 20}) -plt.text(-.9, .36, r'Omega: $\Omega$', {'color': 'b', 'fontsize': 20}) - -plt.show() diff --git a/mpl_examples/pylab_examples/usetex_fonteffects.hires.png b/mpl_examples/pylab_examples/usetex_fonteffects.hires.png deleted file mode 100644 index 25158ef7bdc..00000000000 Binary files a/mpl_examples/pylab_examples/usetex_fonteffects.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/usetex_fonteffects.pdf b/mpl_examples/pylab_examples/usetex_fonteffects.pdf deleted file mode 100644 index 3d39f7e070b..00000000000 Binary files a/mpl_examples/pylab_examples/usetex_fonteffects.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/usetex_fonteffects.png b/mpl_examples/pylab_examples/usetex_fonteffects.png deleted file mode 100644 index 5d3f77d29c1..00000000000 Binary files a/mpl_examples/pylab_examples/usetex_fonteffects.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/usetex_fonteffects.py b/mpl_examples/pylab_examples/usetex_fonteffects.py deleted file mode 100644 index 55bd4adec0c..00000000000 --- a/mpl_examples/pylab_examples/usetex_fonteffects.py +++ /dev/null @@ -1,23 +0,0 @@ -# This script demonstrates that font effects specified in your pdftex.map -# are now supported in pdf usetex. - -import matplotlib -import matplotlib.pyplot as plt -matplotlib.rc('text', usetex=True) - - -def setfont(font): - return r'\font\a %s at 14pt\a ' % font - -for y, font, text in zip(range(5), - ['ptmr8r', 'ptmri8r', 'ptmro8r', 'ptmr8rn', 'ptmrr8re'], - ['Nimbus Roman No9 L ' + x for x in - ['', 'Italics (real italics for comparison)', - '(slanted)', '(condensed)', '(extended)']]): - plt.text(0, y, setfont(font) + text) - -plt.ylim(-1, 5) -plt.xlim(-0.2, 0.6) -plt.setp(plt.gca(), frame_on=False, xticks=(), yticks=()) -plt.title('Usetex font effects') -plt.savefig('usetex_fonteffects.pdf') diff --git a/mpl_examples/pylab_examples/vline_hline_demo.hires.png b/mpl_examples/pylab_examples/vline_hline_demo.hires.png deleted file mode 100644 index 6e9769d25bf..00000000000 Binary files a/mpl_examples/pylab_examples/vline_hline_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/vline_hline_demo.pdf b/mpl_examples/pylab_examples/vline_hline_demo.pdf deleted file mode 100644 index 6111e6249ed..00000000000 Binary files a/mpl_examples/pylab_examples/vline_hline_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/vline_hline_demo.png b/mpl_examples/pylab_examples/vline_hline_demo.png deleted file mode 100644 index a8afaa3e6d5..00000000000 Binary files a/mpl_examples/pylab_examples/vline_hline_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/vline_hline_demo.py b/mpl_examples/pylab_examples/vline_hline_demo.py deleted file mode 100644 index d4fe9e0bf30..00000000000 --- a/mpl_examples/pylab_examples/vline_hline_demo.py +++ /dev/null @@ -1,33 +0,0 @@ -""" -Small demonstration of the hlines and vlines plots. -""" - -import matplotlib.pyplot as plt -import numpy as np -import numpy.random as rnd - - -def f(t): - s1 = np.sin(2 * np.pi * t) - e1 = np.exp(-t) - return np.absolute((s1 * e1)) + .05 - -t = np.arange(0.0, 5.0, 0.1) -s = f(t) -nse = rnd.normal(0.0, 0.3, t.shape) * s - -fig = plt.figure(figsize=(12, 6)) -vax = fig.add_subplot(121) -hax = fig.add_subplot(122) - -vax.plot(t, s + nse, '^') -vax.vlines(t, [0], s) -vax.set_xlabel('time (s)') -vax.set_title('Vertical lines demo') - -hax.plot(s + nse, t, '^') -hax.hlines(t, [0], s, lw=2) -hax.set_xlabel('time (s)') -hax.set_title('Horizontal lines demo') - -plt.show() diff --git a/mpl_examples/pylab_examples/xcorr_demo.hires.png b/mpl_examples/pylab_examples/xcorr_demo.hires.png deleted file mode 100644 index dee8dc11f52..00000000000 Binary files a/mpl_examples/pylab_examples/xcorr_demo.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/xcorr_demo.pdf b/mpl_examples/pylab_examples/xcorr_demo.pdf deleted file mode 100644 index b39d288e760..00000000000 Binary files a/mpl_examples/pylab_examples/xcorr_demo.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/xcorr_demo.png b/mpl_examples/pylab_examples/xcorr_demo.png deleted file mode 100644 index 805d0685a57..00000000000 Binary files a/mpl_examples/pylab_examples/xcorr_demo.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/xcorr_demo.py b/mpl_examples/pylab_examples/xcorr_demo.py deleted file mode 100644 index 8fae6aa555f..00000000000 --- a/mpl_examples/pylab_examples/xcorr_demo.py +++ /dev/null @@ -1,19 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - - -np.random.seed(0) - -x, y = np.random.randn(2, 100) -fig = plt.figure() -ax1 = fig.add_subplot(211) -ax1.xcorr(x, y, usevlines=True, maxlags=50, normed=True, lw=2) -ax1.grid(True) -ax1.axhline(0, color='black', lw=2) - -ax2 = fig.add_subplot(212, sharex=ax1) -ax2.acorr(x, usevlines=True, normed=True, maxlags=50, lw=2) -ax2.grid(True) -ax2.axhline(0, color='black', lw=2) - -plt.show() diff --git a/mpl_examples/pylab_examples/zorder_demo.py b/mpl_examples/pylab_examples/zorder_demo.py deleted file mode 100644 index f9c0ff4710c..00000000000 --- a/mpl_examples/pylab_examples/zorder_demo.py +++ /dev/null @@ -1,51 +0,0 @@ -""" -The default drawing order for axes is patches, lines, text. This -order is determined by the zorder attribute. The following defaults -are set - -Artist Z-order -Patch / PatchCollection 1 -Line2D / LineCollection 2 -Text 3 - -You can change the order for individual artists by setting the zorder. Any -individual plot() call can set a value for the zorder of that particular item. - -In the fist subplot below, the lines are drawn above the patch -collection from the scatter, which is the default. - -In the subplot below, the order is reversed. - -The second figure shows how to control the zorder of individual lines. -""" - -import matplotlib.pyplot as plt -import numpy as np - -x = np.random.random(20) -y = np.random.random(20) - -# Lines on top of scatter -plt.figure() -plt.subplot(211) -plt.plot(x, y, 'r', lw=3) -plt.scatter(x, y, s=120) -plt.title('Lines on top of dots') - -# Scatter plot on top of lines -plt.subplot(212) -plt.plot(x, y, 'r', zorder=1, lw=3) -plt.scatter(x, y, s=120, zorder=2) -plt.title('Dots on top of lines') - -# A new figure, with individually ordered items -x = np.linspace(0, 2*np.pi, 100) -plt.figure() -plt.plot(x, np.sin(x), linewidth=10, color='black', label='zorder=10', zorder=10) # on top -plt.plot(x, np.cos(1.3*x), linewidth=10, color='red', label='zorder=1', zorder=1) # bottom -plt.plot(x, np.sin(2.1*x), linewidth=10, color='green', label='zorder=3', zorder=3) -plt.axhline(0, linewidth=10, color='blue', label='zorder=2', zorder=2) -plt.title('Custom order of elements') -l = plt.legend() -l.set_zorder(20) # put the legend on top -plt.show() diff --git a/mpl_examples/pylab_examples/zorder_demo_00.hires.png b/mpl_examples/pylab_examples/zorder_demo_00.hires.png deleted file mode 100644 index f02ade3381f..00000000000 Binary files a/mpl_examples/pylab_examples/zorder_demo_00.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/zorder_demo_00.pdf b/mpl_examples/pylab_examples/zorder_demo_00.pdf deleted file mode 100644 index ca98ed34242..00000000000 Binary files a/mpl_examples/pylab_examples/zorder_demo_00.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/zorder_demo_00.png b/mpl_examples/pylab_examples/zorder_demo_00.png deleted file mode 100644 index 523911e8069..00000000000 Binary files a/mpl_examples/pylab_examples/zorder_demo_00.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/zorder_demo_01.hires.png b/mpl_examples/pylab_examples/zorder_demo_01.hires.png deleted file mode 100644 index 2e6d5595a9a..00000000000 Binary files a/mpl_examples/pylab_examples/zorder_demo_01.hires.png and /dev/null differ diff --git a/mpl_examples/pylab_examples/zorder_demo_01.pdf b/mpl_examples/pylab_examples/zorder_demo_01.pdf deleted file mode 100644 index 7fdff0c5d1f..00000000000 Binary files a/mpl_examples/pylab_examples/zorder_demo_01.pdf and /dev/null differ diff --git a/mpl_examples/pylab_examples/zorder_demo_01.png b/mpl_examples/pylab_examples/zorder_demo_01.png deleted file mode 100644 index e6b426097ee..00000000000 Binary files a/mpl_examples/pylab_examples/zorder_demo_01.png and /dev/null differ diff --git a/mpl_examples/pyplots/align_ylabels.pdf b/mpl_examples/pyplots/align_ylabels.pdf deleted file mode 100644 index 739df0baee8..00000000000 Binary files a/mpl_examples/pyplots/align_ylabels.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/align_ylabels.png b/mpl_examples/pyplots/align_ylabels.png deleted file mode 100644 index f29437dd200..00000000000 Binary files a/mpl_examples/pyplots/align_ylabels.png and /dev/null differ diff --git a/mpl_examples/pyplots/align_ylabels.py b/mpl_examples/pyplots/align_ylabels.py deleted file mode 100644 index 44f78845b68..00000000000 --- a/mpl_examples/pyplots/align_ylabels.py +++ /dev/null @@ -1,37 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -box = dict(facecolor='yellow', pad=5, alpha=0.2) - -fig = plt.figure() -fig.subplots_adjust(left=0.2, wspace=0.6) - -# Fixing random state for reproducibility -np.random.seed(19680801) - -ax1 = fig.add_subplot(221) -ax1.plot(2000*np.random.rand(10)) -ax1.set_title('ylabels not aligned') -ax1.set_ylabel('misaligned 1', bbox=box) -ax1.set_ylim(0, 2000) -ax3 = fig.add_subplot(223) -ax3.set_ylabel('misaligned 2',bbox=box) -ax3.plot(np.random.rand(10)) - - -labelx = -0.3 # axes coords - -ax2 = fig.add_subplot(222) -ax2.set_title('ylabels aligned') -ax2.plot(2000*np.random.rand(10)) -ax2.set_ylabel('aligned 1', bbox=box) -ax2.yaxis.set_label_coords(labelx, 0.5) -ax2.set_ylim(0, 2000) - -ax4 = fig.add_subplot(224) -ax4.plot(np.random.rand(10)) -ax4.set_ylabel('aligned 2', bbox=box) -ax4.yaxis.set_label_coords(labelx, 0.5) - - -plt.show() diff --git a/mpl_examples/pyplots/annotate_transform.pdf b/mpl_examples/pyplots/annotate_transform.pdf deleted file mode 100644 index 95c4bb27a9b..00000000000 Binary files a/mpl_examples/pyplots/annotate_transform.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/annotate_transform.png b/mpl_examples/pyplots/annotate_transform.png deleted file mode 100644 index 2c6c8e05f4f..00000000000 Binary files a/mpl_examples/pyplots/annotate_transform.png and /dev/null differ diff --git a/mpl_examples/pyplots/annotate_transform.py b/mpl_examples/pyplots/annotate_transform.py deleted file mode 100644 index c3abd236985..00000000000 --- a/mpl_examples/pyplots/annotate_transform.py +++ /dev/null @@ -1,34 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -x = np.arange(0, 10, 0.005) -y = np.exp(-x/2.) * np.sin(2*np.pi*x) - -fig = plt.figure() -ax = fig.add_subplot(111) -ax.plot(x, y) -ax.set_xlim(0, 10) -ax.set_ylim(-1, 1) - -xdata, ydata = 5, 0 -xdisplay, ydisplay = ax.transData.transform_point((xdata, ydata)) - -bbox = dict(boxstyle="round", fc="0.8") -arrowprops = dict( - arrowstyle = "->", - connectionstyle = "angle,angleA=0,angleB=90,rad=10") - -offset = 72 -ax.annotate('data = (%.1f, %.1f)'%(xdata, ydata), - (xdata, ydata), xytext=(-2*offset, offset), textcoords='offset points', - bbox=bbox, arrowprops=arrowprops) - - -disp = ax.annotate('display = (%.1f, %.1f)'%(xdisplay, ydisplay), - (xdisplay, ydisplay), xytext=(0.5*offset, -offset), - xycoords='figure pixels', - textcoords='offset points', - bbox=bbox, arrowprops=arrowprops) - - -plt.show() diff --git a/mpl_examples/pyplots/annotation_basic.pdf b/mpl_examples/pyplots/annotation_basic.pdf deleted file mode 100644 index 28dea27e4b4..00000000000 Binary files a/mpl_examples/pyplots/annotation_basic.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/annotation_basic.png b/mpl_examples/pyplots/annotation_basic.png deleted file mode 100644 index 18c5e2b254d..00000000000 Binary files a/mpl_examples/pyplots/annotation_basic.png and /dev/null differ diff --git a/mpl_examples/pyplots/annotation_basic.py b/mpl_examples/pyplots/annotation_basic.py deleted file mode 100644 index 846afd7b901..00000000000 --- a/mpl_examples/pyplots/annotation_basic.py +++ /dev/null @@ -1,16 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -fig = plt.figure() -ax = fig.add_subplot(111) - -t = np.arange(0.0, 5.0, 0.01) -s = np.cos(2*np.pi*t) -line, = ax.plot(t, s, lw=2) - -ax.annotate('local max', xy=(2, 1), xytext=(3, 1.5), - arrowprops=dict(facecolor='black', shrink=0.05), - ) - -ax.set_ylim(-2,2) -plt.show() diff --git a/mpl_examples/pyplots/annotation_polar.pdf b/mpl_examples/pyplots/annotation_polar.pdf deleted file mode 100644 index 0300046ffff..00000000000 Binary files a/mpl_examples/pyplots/annotation_polar.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/annotation_polar.png b/mpl_examples/pyplots/annotation_polar.png deleted file mode 100644 index dc70de10be6..00000000000 Binary files a/mpl_examples/pyplots/annotation_polar.png and /dev/null differ diff --git a/mpl_examples/pyplots/annotation_polar.py b/mpl_examples/pyplots/annotation_polar.py deleted file mode 100644 index 9eba8cfe0d7..00000000000 --- a/mpl_examples/pyplots/annotation_polar.py +++ /dev/null @@ -1,21 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -fig = plt.figure() -ax = fig.add_subplot(111, polar=True) -r = np.arange(0,1,0.001) -theta = 2*2*np.pi*r -line, = ax.plot(theta, r, color='#ee8d18', lw=3) - -ind = 800 -thisr, thistheta = r[ind], theta[ind] -ax.plot([thistheta], [thisr], 'o') -ax.annotate('a polar annotation', - xy=(thistheta, thisr), # theta, radius - xytext=(0.05, 0.05), # fraction, fraction - textcoords='figure fraction', - arrowprops=dict(facecolor='black', shrink=0.05), - horizontalalignment='left', - verticalalignment='bottom', - ) -plt.show() diff --git a/mpl_examples/pyplots/auto_subplots_adjust.pdf b/mpl_examples/pyplots/auto_subplots_adjust.pdf deleted file mode 100644 index 5ec31407481..00000000000 Binary files a/mpl_examples/pyplots/auto_subplots_adjust.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/auto_subplots_adjust.png b/mpl_examples/pyplots/auto_subplots_adjust.png deleted file mode 100644 index d0574d2ac6b..00000000000 Binary files a/mpl_examples/pyplots/auto_subplots_adjust.png and /dev/null differ diff --git a/mpl_examples/pyplots/auto_subplots_adjust.py b/mpl_examples/pyplots/auto_subplots_adjust.py deleted file mode 100644 index ca7f04144be..00000000000 --- a/mpl_examples/pyplots/auto_subplots_adjust.py +++ /dev/null @@ -1,30 +0,0 @@ -import matplotlib.pyplot as plt -import matplotlib.transforms as mtransforms -fig = plt.figure() -ax = fig.add_subplot(111) -ax.plot(range(10)) -ax.set_yticks((2,5,7)) -labels = ax.set_yticklabels(('really, really, really', 'long', 'labels')) - -def on_draw(event): - bboxes = [] - for label in labels: - bbox = label.get_window_extent() - # the figure transform goes from relative coords->pixels and we - # want the inverse of that - bboxi = bbox.inverse_transformed(fig.transFigure) - bboxes.append(bboxi) - - # this is the bbox that bounds all the bboxes, again in relative - # figure coords - bbox = mtransforms.Bbox.union(bboxes) - if fig.subplotpars.left < bbox.width: - # we need to move it over - fig.subplots_adjust(left=1.1*bbox.width) # pad a little - fig.canvas.draw() - return False - -fig.canvas.mpl_connect('draw_event', on_draw) - -plt.show() - diff --git a/mpl_examples/pyplots/compound_path_demo.pdf b/mpl_examples/pyplots/compound_path_demo.pdf deleted file mode 100644 index c59052a87f1..00000000000 Binary files a/mpl_examples/pyplots/compound_path_demo.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/compound_path_demo.png b/mpl_examples/pyplots/compound_path_demo.png deleted file mode 100644 index d0e53b7ee99..00000000000 Binary files a/mpl_examples/pyplots/compound_path_demo.png and /dev/null differ diff --git a/mpl_examples/pyplots/compound_path_demo.py b/mpl_examples/pyplots/compound_path_demo.py deleted file mode 100644 index ed7e7d6ce32..00000000000 --- a/mpl_examples/pyplots/compound_path_demo.py +++ /dev/null @@ -1,45 +0,0 @@ -import numpy as np - -import matplotlib.pyplot as plt -import matplotlib.patches as patches -import matplotlib.path as path - -fig = plt.figure() -ax = fig.add_subplot(111) - -# Fixing random state for reproducibility -np.random.seed(19680801) - -# histogram our data with numpy -data = np.random.randn(1000) -n, bins = np.histogram(data, 100) - -# get the corners of the rectangles for the histogram -left = np.array(bins[:-1]) -right = np.array(bins[1:]) -bottom = np.zeros(len(left)) -top = bottom + n -nrects = len(left) - -nverts = nrects*(1+3+1) -verts = np.zeros((nverts, 2)) -codes = np.ones(nverts, int) * path.Path.LINETO -codes[0::5] = path.Path.MOVETO -codes[4::5] = path.Path.CLOSEPOLY -verts[0::5,0] = left -verts[0::5,1] = bottom -verts[1::5,0] = left -verts[1::5,1] = top -verts[2::5,0] = right -verts[2::5,1] = top -verts[3::5,0] = right -verts[3::5,1] = bottom - -barpath = path.Path(verts, codes) -patch = patches.PathPatch(barpath, facecolor='green', edgecolor='yellow', alpha=0.5) -ax.add_patch(patch) - -ax.set_xlim(left[0], right[-1]) -ax.set_ylim(bottom.min(), top.max()) - -plt.show() diff --git a/mpl_examples/pyplots/dollar_ticks.pdf b/mpl_examples/pyplots/dollar_ticks.pdf deleted file mode 100644 index c0a9436b250..00000000000 Binary files a/mpl_examples/pyplots/dollar_ticks.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/dollar_ticks.png b/mpl_examples/pyplots/dollar_ticks.png deleted file mode 100644 index 6bae9fea040..00000000000 Binary files a/mpl_examples/pyplots/dollar_ticks.png and /dev/null differ diff --git a/mpl_examples/pyplots/dollar_ticks.py b/mpl_examples/pyplots/dollar_ticks.py deleted file mode 100644 index ca1069dabb7..00000000000 --- a/mpl_examples/pyplots/dollar_ticks.py +++ /dev/null @@ -1,20 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.ticker as ticker - -# Fixing random state for reproducibility -np.random.seed(19680801) - -fig = plt.figure() -ax = fig.add_subplot(111) -ax.plot(100*np.random.rand(20)) - -formatter = ticker.FormatStrFormatter('$%1.2f') -ax.yaxis.set_major_formatter(formatter) - -for tick in ax.yaxis.get_major_ticks(): - tick.label1On = False - tick.label2On = True - tick.label2.set_color('green') - -plt.show() diff --git a/mpl_examples/pyplots/fig_axes_customize_simple.pdf b/mpl_examples/pyplots/fig_axes_customize_simple.pdf deleted file mode 100644 index 0be6dba8bed..00000000000 Binary files a/mpl_examples/pyplots/fig_axes_customize_simple.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/fig_axes_customize_simple.png b/mpl_examples/pyplots/fig_axes_customize_simple.png deleted file mode 100644 index ca54b608f6f..00000000000 Binary files a/mpl_examples/pyplots/fig_axes_customize_simple.png and /dev/null differ diff --git a/mpl_examples/pyplots/fig_axes_customize_simple.py b/mpl_examples/pyplots/fig_axes_customize_simple.py deleted file mode 100644 index ab557794e70..00000000000 --- a/mpl_examples/pyplots/fig_axes_customize_simple.py +++ /dev/null @@ -1,26 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -# plt.figure creates a matplotlib.figure.Figure instance -fig = plt.figure() -rect = fig.patch # a rectangle instance -rect.set_facecolor('lightgoldenrodyellow') - -ax1 = fig.add_axes([0.1, 0.3, 0.4, 0.4]) -rect = ax1.patch -rect.set_facecolor('lightslategray') - - -for label in ax1.xaxis.get_ticklabels(): - # label is a Text instance - label.set_color('red') - label.set_rotation(45) - label.set_fontsize(16) - -for line in ax1.yaxis.get_ticklines(): - # line is a Line2D instance - line.set_color('green') - line.set_markersize(25) - line.set_markeredgewidth(3) - -plt.show() diff --git a/mpl_examples/pyplots/fig_axes_labels_simple.pdf b/mpl_examples/pyplots/fig_axes_labels_simple.pdf deleted file mode 100644 index 2869b7cf063..00000000000 Binary files a/mpl_examples/pyplots/fig_axes_labels_simple.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/fig_axes_labels_simple.png b/mpl_examples/pyplots/fig_axes_labels_simple.png deleted file mode 100644 index cb5356f0760..00000000000 Binary files a/mpl_examples/pyplots/fig_axes_labels_simple.png and /dev/null differ diff --git a/mpl_examples/pyplots/fig_axes_labels_simple.py b/mpl_examples/pyplots/fig_axes_labels_simple.py deleted file mode 100644 index 50b6dd65f3e..00000000000 --- a/mpl_examples/pyplots/fig_axes_labels_simple.py +++ /dev/null @@ -1,22 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -fig = plt.figure() -fig.subplots_adjust(top=0.8) -ax1 = fig.add_subplot(211) -ax1.set_ylabel('volts') -ax1.set_title('a sine wave') - -t = np.arange(0.0, 1.0, 0.01) -s = np.sin(2*np.pi*t) -line, = ax1.plot(t, s, color='blue', lw=2) - -# Fixing random state for reproducibility -np.random.seed(19680801) - -ax2 = fig.add_axes([0.15, 0.1, 0.7, 0.3]) -n, bins, patches = ax2.hist(np.random.randn(1000), 50, - facecolor='yellow', edgecolor='yellow') -ax2.set_xlabel('time (s)') - -plt.show() diff --git a/mpl_examples/pyplots/fig_x.pdf b/mpl_examples/pyplots/fig_x.pdf deleted file mode 100644 index 9fd4cee216f..00000000000 Binary files a/mpl_examples/pyplots/fig_x.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/fig_x.png b/mpl_examples/pyplots/fig_x.png deleted file mode 100644 index 0f587d4d0b4..00000000000 Binary files a/mpl_examples/pyplots/fig_x.png and /dev/null differ diff --git a/mpl_examples/pyplots/fig_x.py b/mpl_examples/pyplots/fig_x.py deleted file mode 100644 index c573f226630..00000000000 --- a/mpl_examples/pyplots/fig_x.py +++ /dev/null @@ -1,14 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.lines as lines - - -fig = plt.figure() - -l1 = lines.Line2D([0, 1], [0, 1], transform=fig.transFigure, figure=fig) - -l2 = lines.Line2D([0, 1], [1, 0], transform=fig.transFigure, figure=fig) - -fig.lines.extend([l1, l2]) - -plt.show() diff --git a/mpl_examples/pyplots/pyplot_annotate.pdf b/mpl_examples/pyplots/pyplot_annotate.pdf deleted file mode 100644 index 75c85401173..00000000000 Binary files a/mpl_examples/pyplots/pyplot_annotate.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/pyplot_annotate.png b/mpl_examples/pyplots/pyplot_annotate.png deleted file mode 100644 index 18c5e2b254d..00000000000 Binary files a/mpl_examples/pyplots/pyplot_annotate.png and /dev/null differ diff --git a/mpl_examples/pyplots/pyplot_annotate.py b/mpl_examples/pyplots/pyplot_annotate.py deleted file mode 100644 index 88390ca7c07..00000000000 --- a/mpl_examples/pyplots/pyplot_annotate.py +++ /dev/null @@ -1,15 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -ax = plt.subplot(111) - -t = np.arange(0.0, 5.0, 0.01) -s = np.cos(2*np.pi*t) -line, = plt.plot(t, s, lw=2) - -plt.annotate('local max', xy=(2, 1), xytext=(3, 1.5), - arrowprops=dict(facecolor='black', shrink=0.05), - ) - -plt.ylim(-2,2) -plt.show() diff --git a/mpl_examples/pyplots/pyplot_formatstr.pdf b/mpl_examples/pyplots/pyplot_formatstr.pdf deleted file mode 100644 index 91af8e8c440..00000000000 Binary files a/mpl_examples/pyplots/pyplot_formatstr.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/pyplot_formatstr.png b/mpl_examples/pyplots/pyplot_formatstr.png deleted file mode 100644 index 400a20a4e18..00000000000 Binary files a/mpl_examples/pyplots/pyplot_formatstr.png and /dev/null differ diff --git a/mpl_examples/pyplots/pyplot_formatstr.py b/mpl_examples/pyplots/pyplot_formatstr.py deleted file mode 100644 index b7a7786a602..00000000000 --- a/mpl_examples/pyplots/pyplot_formatstr.py +++ /dev/null @@ -1,4 +0,0 @@ -import matplotlib.pyplot as plt -plt.plot([1,2,3,4], [1,4,9,16], 'ro') -plt.axis([0, 6, 0, 20]) -plt.show() diff --git a/mpl_examples/pyplots/pyplot_mathtext.pdf b/mpl_examples/pyplots/pyplot_mathtext.pdf deleted file mode 100644 index 185e2755761..00000000000 Binary files a/mpl_examples/pyplots/pyplot_mathtext.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/pyplot_mathtext.png b/mpl_examples/pyplots/pyplot_mathtext.png deleted file mode 100644 index 8f7530d5edc..00000000000 Binary files a/mpl_examples/pyplots/pyplot_mathtext.png and /dev/null differ diff --git a/mpl_examples/pyplots/pyplot_mathtext.py b/mpl_examples/pyplots/pyplot_mathtext.py deleted file mode 100644 index d90f5cbb381..00000000000 --- a/mpl_examples/pyplots/pyplot_mathtext.py +++ /dev/null @@ -1,13 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -t = np.arange(0.0, 2.0, 0.01) -s = np.sin(2*np.pi*t) - -plt.plot(t,s) -plt.title(r'$\alpha_i > \beta_i$', fontsize=20) -plt.text(1, -0.6, r'$\sum_{i=0}^\infty x_i$', fontsize=20) -plt.text(0.6, 0.6, r'$\mathcal{A}\mathrm{sin}(2 \omega t)$', - fontsize=20) -plt.xlabel('time (s)') -plt.ylabel('volts (mV)') -plt.show() diff --git a/mpl_examples/pyplots/pyplot_scales.pdf b/mpl_examples/pyplots/pyplot_scales.pdf deleted file mode 100644 index d5e0b45184a..00000000000 Binary files a/mpl_examples/pyplots/pyplot_scales.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/pyplot_scales.png b/mpl_examples/pyplots/pyplot_scales.png deleted file mode 100644 index 2ae2cb2ffa9..00000000000 Binary files a/mpl_examples/pyplots/pyplot_scales.png and /dev/null differ diff --git a/mpl_examples/pyplots/pyplot_scales.py b/mpl_examples/pyplots/pyplot_scales.py deleted file mode 100644 index bdf2fb82370..00000000000 --- a/mpl_examples/pyplots/pyplot_scales.py +++ /dev/null @@ -1,55 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -from matplotlib.ticker import NullFormatter # useful for `logit` scale - -# Fixing random state for reproducibility -np.random.seed(19680801) - -# make up some data in the interval ]0, 1[ -y = np.random.normal(loc=0.5, scale=0.4, size=1000) -y = y[(y > 0) & (y < 1)] -y.sort() -x = np.arange(len(y)) - -# plot with various axes scales -plt.figure(1) - -# linear -plt.subplot(221) -plt.plot(x, y) -plt.yscale('linear') -plt.title('linear') -plt.grid(True) - - -# log -plt.subplot(222) -plt.plot(x, y) -plt.yscale('log') -plt.title('log') -plt.grid(True) - - -# symmetric log -plt.subplot(223) -plt.plot(x, y - y.mean()) -plt.yscale('symlog', linthreshy=0.01) -plt.title('symlog') -plt.grid(True) - -# logit -plt.subplot(224) -plt.plot(x, y) -plt.yscale('logit') -plt.title('logit') -plt.grid(True) -# Format the minor tick labels of the y-axis into empty strings with -# `NullFormatter`, to avoid cumbering the axis with too many labels. -plt.gca().yaxis.set_minor_formatter(NullFormatter()) -# Adjust the subplot layout, because the logit one may take more space -# than usual, due to y-tick labels like "1 - 10^{-3}" -plt.subplots_adjust(top=0.92, bottom=0.08, left=0.10, right=0.95, hspace=0.25, - wspace=0.35) - -plt.show() diff --git a/mpl_examples/pyplots/pyplot_simple.pdf b/mpl_examples/pyplots/pyplot_simple.pdf deleted file mode 100644 index 629f097dbdc..00000000000 Binary files a/mpl_examples/pyplots/pyplot_simple.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/pyplot_simple.png b/mpl_examples/pyplots/pyplot_simple.png deleted file mode 100644 index 6d321d4651d..00000000000 Binary files a/mpl_examples/pyplots/pyplot_simple.png and /dev/null differ diff --git a/mpl_examples/pyplots/pyplot_simple.py b/mpl_examples/pyplots/pyplot_simple.py deleted file mode 100644 index 46b9f225a97..00000000000 --- a/mpl_examples/pyplots/pyplot_simple.py +++ /dev/null @@ -1,4 +0,0 @@ -import matplotlib.pyplot as plt -plt.plot([1,2,3,4]) -plt.ylabel('some numbers') -plt.show() diff --git a/mpl_examples/pyplots/pyplot_text.pdf b/mpl_examples/pyplots/pyplot_text.pdf deleted file mode 100644 index f6982d00317..00000000000 Binary files a/mpl_examples/pyplots/pyplot_text.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/pyplot_text.png b/mpl_examples/pyplots/pyplot_text.png deleted file mode 100644 index 6969581bda3..00000000000 Binary files a/mpl_examples/pyplots/pyplot_text.png and /dev/null differ diff --git a/mpl_examples/pyplots/pyplot_text.py b/mpl_examples/pyplots/pyplot_text.py deleted file mode 100644 index b54a0f939da..00000000000 --- a/mpl_examples/pyplots/pyplot_text.py +++ /dev/null @@ -1,20 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -# Fixing random state for reproducibility -np.random.seed(19680801) - -mu, sigma = 100, 15 -x = mu + sigma * np.random.randn(10000) - -# the histogram of the data -n, bins, patches = plt.hist(x, 50, normed=1, facecolor='g', alpha=0.75) - - -plt.xlabel('Smarts') -plt.ylabel('Probability') -plt.title('Histogram of IQ') -plt.text(60, .025, r'$\mu=100,\ \sigma=15$') -plt.axis([40, 160, 0, 0.03]) -plt.grid(True) -plt.show() diff --git a/mpl_examples/pyplots/pyplot_three.pdf b/mpl_examples/pyplots/pyplot_three.pdf deleted file mode 100644 index 250ffe55e39..00000000000 Binary files a/mpl_examples/pyplots/pyplot_three.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/pyplot_three.png b/mpl_examples/pyplots/pyplot_three.png deleted file mode 100644 index 5be322070da..00000000000 Binary files a/mpl_examples/pyplots/pyplot_three.png and /dev/null differ diff --git a/mpl_examples/pyplots/pyplot_three.py b/mpl_examples/pyplots/pyplot_three.py deleted file mode 100644 index 2762d7cbd1d..00000000000 --- a/mpl_examples/pyplots/pyplot_three.py +++ /dev/null @@ -1,9 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -# evenly sampled time at 200ms intervals -t = np.arange(0., 5., 0.2) - -# red dashes, blue squares and green triangles -plt.plot(t, t, 'r--', t, t**2, 'bs', t, t**3, 'g^') -plt.show() diff --git a/mpl_examples/pyplots/pyplot_two_subplots.pdf b/mpl_examples/pyplots/pyplot_two_subplots.pdf deleted file mode 100644 index ebee86d4e3d..00000000000 Binary files a/mpl_examples/pyplots/pyplot_two_subplots.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/pyplot_two_subplots.png b/mpl_examples/pyplots/pyplot_two_subplots.png deleted file mode 100644 index 2adfd01c84e..00000000000 Binary files a/mpl_examples/pyplots/pyplot_two_subplots.png and /dev/null differ diff --git a/mpl_examples/pyplots/pyplot_two_subplots.py b/mpl_examples/pyplots/pyplot_two_subplots.py deleted file mode 100644 index bfc6ebc121d..00000000000 --- a/mpl_examples/pyplots/pyplot_two_subplots.py +++ /dev/null @@ -1,16 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -def f(t): - return np.exp(-t) * np.cos(2*np.pi*t) - -t1 = np.arange(0.0, 5.0, 0.1) -t2 = np.arange(0.0, 5.0, 0.02) - -plt.figure(1) -plt.subplot(211) -plt.plot(t1, f(t1), 'bo', t2, f(t2), 'k') - -plt.subplot(212) -plt.plot(t2, np.cos(2*np.pi*t2), 'r--') -plt.show() diff --git a/mpl_examples/pyplots/tex_demo.pdf b/mpl_examples/pyplots/tex_demo.pdf deleted file mode 100644 index f63dd1236a9..00000000000 Binary files a/mpl_examples/pyplots/tex_demo.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/tex_demo.png b/mpl_examples/pyplots/tex_demo.png deleted file mode 100644 index 394cf654623..00000000000 Binary files a/mpl_examples/pyplots/tex_demo.png and /dev/null differ diff --git a/mpl_examples/pyplots/tex_demo.py b/mpl_examples/pyplots/tex_demo.py deleted file mode 100644 index 7b228376e72..00000000000 --- a/mpl_examples/pyplots/tex_demo.py +++ /dev/null @@ -1,35 +0,0 @@ -""" -Demo of TeX rendering. - -You can use TeX to render all of your matplotlib text if the rc -parameter text.usetex is set. This works currently on the agg and ps -backends, and requires that you have tex and the other dependencies -described at http://matplotlib.org/users/usetex.html -properly installed on your system. The first time you run a script -you will see a lot of output from tex and associated tools. The next -time, the run may be silent, as a lot of the information is cached in -~/.tex.cache - -""" -import numpy as np -import matplotlib.pyplot as plt - - -# Example data -t = np.arange(0.0, 1.0 + 0.01, 0.01) -s = np.cos(4 * np.pi * t) + 2 - -plt.rc('text', usetex=True) -plt.rc('font', family='serif') -plt.plot(t, s) - -plt.xlabel(r'\textbf{time} (s)') -plt.ylabel(r'\textit{voltage} (mV)',fontsize=16) -plt.title(r"\TeX\ is Number " - r"$\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!", - fontsize=16, color='gray') -# Make room for the ridiculously large title. -plt.subplots_adjust(top=0.8) - -plt.savefig('tex_demo') -plt.show() diff --git a/mpl_examples/pyplots/text_commands.pdf b/mpl_examples/pyplots/text_commands.pdf deleted file mode 100644 index 7ea34b0946f..00000000000 Binary files a/mpl_examples/pyplots/text_commands.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/text_commands.png b/mpl_examples/pyplots/text_commands.png deleted file mode 100644 index bc22160e685..00000000000 Binary files a/mpl_examples/pyplots/text_commands.png and /dev/null differ diff --git a/mpl_examples/pyplots/text_commands.py b/mpl_examples/pyplots/text_commands.py deleted file mode 100644 index 92f40b60b9c..00000000000 --- a/mpl_examples/pyplots/text_commands.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -import matplotlib.pyplot as plt - -fig = plt.figure() -fig.suptitle('bold figure suptitle', fontsize=14, fontweight='bold') - -ax = fig.add_subplot(111) -fig.subplots_adjust(top=0.85) -ax.set_title('axes title') - -ax.set_xlabel('xlabel') -ax.set_ylabel('ylabel') - -ax.text(3, 8, 'boxed italics text in data coords', style='italic', - bbox={'facecolor':'red', 'alpha':0.5, 'pad':10}) - -ax.text(2, 6, r'an equation: $E=mc^2$', fontsize=15) - -ax.text(3, 2, u'unicode: Institut f\374r Festk\366rperphysik') - -ax.text(0.95, 0.01, 'colored text in axes coords', - verticalalignment='bottom', horizontalalignment='right', - transform=ax.transAxes, - color='green', fontsize=15) - - -ax.plot([2], [1], 'o') -ax.annotate('annotate', xy=(2, 1), xytext=(3, 4), - arrowprops=dict(facecolor='black', shrink=0.05)) - -ax.axis([0, 10, 0, 10]) - -plt.show() diff --git a/mpl_examples/pyplots/text_layout.pdf b/mpl_examples/pyplots/text_layout.pdf deleted file mode 100644 index ee342e7b6db..00000000000 Binary files a/mpl_examples/pyplots/text_layout.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/text_layout.png b/mpl_examples/pyplots/text_layout.png deleted file mode 100644 index d6d10e52323..00000000000 Binary files a/mpl_examples/pyplots/text_layout.png and /dev/null differ diff --git a/mpl_examples/pyplots/text_layout.py b/mpl_examples/pyplots/text_layout.py deleted file mode 100644 index 860c20d2211..00000000000 --- a/mpl_examples/pyplots/text_layout.py +++ /dev/null @@ -1,77 +0,0 @@ -import matplotlib.pyplot as plt -import matplotlib.patches as patches - -# build a rectangle in axes coords -left, width = .25, .5 -bottom, height = .25, .5 -right = left + width -top = bottom + height - -fig = plt.figure() -ax = fig.add_axes([0,0,1,1]) - -# axes coordinates are 0,0 is bottom left and 1,1 is upper right -p = patches.Rectangle( - (left, bottom), width, height, - fill=False, transform=ax.transAxes, clip_on=False - ) - -ax.add_patch(p) - -ax.text(left, bottom, 'left top', - horizontalalignment='left', - verticalalignment='top', - transform=ax.transAxes) - -ax.text(left, bottom, 'left bottom', - horizontalalignment='left', - verticalalignment='bottom', - transform=ax.transAxes) - -ax.text(right, top, 'right bottom', - horizontalalignment='right', - verticalalignment='bottom', - transform=ax.transAxes) - -ax.text(right, top, 'right top', - horizontalalignment='right', - verticalalignment='top', - transform=ax.transAxes) - -ax.text(right, bottom, 'center top', - horizontalalignment='center', - verticalalignment='top', - transform=ax.transAxes) - -ax.text(left, 0.5*(bottom+top), 'right center', - horizontalalignment='right', - verticalalignment='center', - rotation='vertical', - transform=ax.transAxes) - -ax.text(left, 0.5*(bottom+top), 'left center', - horizontalalignment='left', - verticalalignment='center', - rotation='vertical', - transform=ax.transAxes) - -ax.text(0.5*(left+right), 0.5*(bottom+top), 'middle', - horizontalalignment='center', - verticalalignment='center', - fontsize=20, color='red', - transform=ax.transAxes) - -ax.text(right, 0.5*(bottom+top), 'centered', - horizontalalignment='center', - verticalalignment='center', - rotation='vertical', - transform=ax.transAxes) - -ax.text(left, top, 'rotated\nwith newlines', - horizontalalignment='center', - verticalalignment='center', - rotation=45, - transform=ax.transAxes) - -ax.set_axis_off() -plt.show() diff --git a/mpl_examples/pyplots/whats_new_1_subplot3d.pdf b/mpl_examples/pyplots/whats_new_1_subplot3d.pdf deleted file mode 100644 index c34a7d0353f..00000000000 Binary files a/mpl_examples/pyplots/whats_new_1_subplot3d.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/whats_new_1_subplot3d.png b/mpl_examples/pyplots/whats_new_1_subplot3d.png deleted file mode 100644 index d93723d008f..00000000000 Binary files a/mpl_examples/pyplots/whats_new_1_subplot3d.png and /dev/null differ diff --git a/mpl_examples/pyplots/whats_new_1_subplot3d.py b/mpl_examples/pyplots/whats_new_1_subplot3d.py deleted file mode 100644 index 379157b0c5e..00000000000 --- a/mpl_examples/pyplots/whats_new_1_subplot3d.py +++ /dev/null @@ -1,30 +0,0 @@ -from mpl_toolkits.mplot3d.axes3d import Axes3D -from matplotlib import cm -#from matplotlib.ticker import LinearLocator, FixedLocator, FormatStrFormatter -import matplotlib.pyplot as plt -import numpy as np - -fig = plt.figure() - -ax = fig.add_subplot(1, 2, 1, projection='3d') -X = np.arange(-5, 5, 0.25) -Y = np.arange(-5, 5, 0.25) -X, Y = np.meshgrid(X, Y) -R = np.sqrt(X**2 + Y**2) -Z = np.sin(R) -surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet, - linewidth=0, antialiased=False) -ax.set_zlim3d(-1.01, 1.01) - -#ax.w_zaxis.set_major_locator(LinearLocator(10)) -#ax.w_zaxis.set_major_formatter(FormatStrFormatter('%.03f')) - -fig.colorbar(surf, shrink=0.5, aspect=5) - -from mpl_toolkits.mplot3d.axes3d import get_test_data -ax = fig.add_subplot(1, 2, 2, projection='3d') -X, Y, Z = get_test_data(0.05) -ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10) - -plt.show() - diff --git a/mpl_examples/pyplots/whats_new_98_4_fancy.pdf b/mpl_examples/pyplots/whats_new_98_4_fancy.pdf deleted file mode 100644 index c15a9236ba8..00000000000 Binary files a/mpl_examples/pyplots/whats_new_98_4_fancy.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/whats_new_98_4_fancy.png b/mpl_examples/pyplots/whats_new_98_4_fancy.png deleted file mode 100644 index db6fb74a9f5..00000000000 Binary files a/mpl_examples/pyplots/whats_new_98_4_fancy.png and /dev/null differ diff --git a/mpl_examples/pyplots/whats_new_98_4_fancy.py b/mpl_examples/pyplots/whats_new_98_4_fancy.py deleted file mode 100644 index e7ca6bf9471..00000000000 --- a/mpl_examples/pyplots/whats_new_98_4_fancy.py +++ /dev/null @@ -1,54 +0,0 @@ -import matplotlib.patches as mpatch -import matplotlib.pyplot as plt - -figheight = 8 -fig = plt.figure(1, figsize=(9, figheight), dpi=80) -fontsize = 0.4 * fig.dpi - -def make_boxstyles(ax): - styles = mpatch.BoxStyle.get_styles() - - for i, (stylename, styleclass) in enumerate(sorted(styles.items())): - ax.text(0.5, (float(len(styles)) - 0.5 - i)/len(styles), stylename, - ha="center", - size=fontsize, - transform=ax.transAxes, - bbox=dict(boxstyle=stylename, fc="w", ec="k")) - -def make_arrowstyles(ax): - styles = mpatch.ArrowStyle.get_styles() - - ax.set_xlim(0, 4) - ax.set_ylim(0, figheight) - - for i, (stylename, styleclass) in enumerate(sorted(styles.items())): - y = (float(len(styles)) -0.25 - i) # /figheight - p = mpatch.Circle((3.2, y), 0.2, fc="w") - ax.add_patch(p) - - ax.annotate(stylename, (3.2, y), - (2., y), - #xycoords="figure fraction", textcoords="figure fraction", - ha="right", va="center", - size=fontsize, - arrowprops=dict(arrowstyle=stylename, - patchB=p, - shrinkA=5, - shrinkB=5, - fc="w", ec="k", - connectionstyle="arc3,rad=-0.05", - ), - bbox=dict(boxstyle="square", fc="w")) - - ax.xaxis.set_visible(False) - ax.yaxis.set_visible(False) - - -ax1 = fig.add_subplot(121, frameon=False, xticks=[], yticks=[]) -make_boxstyles(ax1) - -ax2 = fig.add_subplot(122, frameon=False, xticks=[], yticks=[]) -make_arrowstyles(ax2) - - -plt.show() diff --git a/mpl_examples/pyplots/whats_new_98_4_fill_between.pdf b/mpl_examples/pyplots/whats_new_98_4_fill_between.pdf deleted file mode 100644 index 912ec7c70b2..00000000000 Binary files a/mpl_examples/pyplots/whats_new_98_4_fill_between.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/whats_new_98_4_fill_between.png b/mpl_examples/pyplots/whats_new_98_4_fill_between.png deleted file mode 100644 index fa857eb44c2..00000000000 Binary files a/mpl_examples/pyplots/whats_new_98_4_fill_between.png and /dev/null differ diff --git a/mpl_examples/pyplots/whats_new_98_4_fill_between.py b/mpl_examples/pyplots/whats_new_98_4_fill_between.py deleted file mode 100644 index 33670729131..00000000000 --- a/mpl_examples/pyplots/whats_new_98_4_fill_between.py +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env python -import matplotlib.mlab as mlab -import matplotlib.pyplot as plt -import numpy as np - -x = np.arange(0.0, 2, 0.01) -y1 = np.sin(2*np.pi*x) -y2 = 1.2*np.sin(4*np.pi*x) - -fig, ax = plt.subplots() -ax.plot(x, y1, x, y2, color='black') -ax.fill_between(x, y1, y2, where=y2>y1, facecolor='green') -ax.fill_between(x, y1, y2, where=y2<=y1, facecolor='red') -ax.set_title('fill between where') - -plt.show() diff --git a/mpl_examples/pyplots/whats_new_98_4_legend.pdf b/mpl_examples/pyplots/whats_new_98_4_legend.pdf deleted file mode 100644 index b0766cbc2a0..00000000000 Binary files a/mpl_examples/pyplots/whats_new_98_4_legend.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/whats_new_98_4_legend.png b/mpl_examples/pyplots/whats_new_98_4_legend.png deleted file mode 100644 index 6ff43692865..00000000000 Binary files a/mpl_examples/pyplots/whats_new_98_4_legend.png and /dev/null differ diff --git a/mpl_examples/pyplots/whats_new_98_4_legend.py b/mpl_examples/pyplots/whats_new_98_4_legend.py deleted file mode 100644 index 2a806126f3c..00000000000 --- a/mpl_examples/pyplots/whats_new_98_4_legend.py +++ /dev/null @@ -1,18 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np -import matplotlib.pyplot as plt - - -ax = plt.subplot(111) -t1 = np.arange(0.0, 1.0, 0.01) -for n in [1, 2, 3, 4]: - plt.plot(t1, t1**n, label="n=%d"%(n,)) - -leg = plt.legend(loc='best', ncol=2, mode="expand", shadow=True, fancybox=True) -leg.get_frame().set_alpha(0.5) - - -plt.show() - - - diff --git a/mpl_examples/pyplots/whats_new_99_axes_grid.pdf b/mpl_examples/pyplots/whats_new_99_axes_grid.pdf deleted file mode 100644 index 5a86030cd4b..00000000000 Binary files a/mpl_examples/pyplots/whats_new_99_axes_grid.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/whats_new_99_axes_grid.png b/mpl_examples/pyplots/whats_new_99_axes_grid.png deleted file mode 100644 index daacf457393..00000000000 Binary files a/mpl_examples/pyplots/whats_new_99_axes_grid.png and /dev/null differ diff --git a/mpl_examples/pyplots/whats_new_99_axes_grid.py b/mpl_examples/pyplots/whats_new_99_axes_grid.py deleted file mode 100644 index e3cb7fa4217..00000000000 --- a/mpl_examples/pyplots/whats_new_99_axes_grid.py +++ /dev/null @@ -1,47 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid.axes_rgb import RGBAxes - -def get_demo_image(): - # prepare image - delta = 0.5 - - extent = (-3,4,-4,3) - x = np.arange(-3.0, 4.001, delta) - y = np.arange(-4.0, 3.001, delta) - X, Y = np.meshgrid(x, y) - import matplotlib.mlab as mlab - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - Z = (Z1 - Z2) * 10 - - return Z, extent - - - -def get_rgb(): - Z, extent = get_demo_image() - - Z[Z<0] = 0. - Z = Z/Z.max() - - R = Z[:13,:13] - G = Z[2:,2:] - B = Z[:13,2:] - - return R, G, B - - -fig = plt.figure(1) -ax = RGBAxes(fig, [0.1, 0.1, 0.8, 0.8]) - -r, g, b = get_rgb() -kwargs = dict(origin="lower", interpolation="nearest") -ax.imshow_rgb(r, g, b, **kwargs) - -ax.RGB.set_xlim(0., 9.5) -ax.RGB.set_ylim(0.9, 10.6) - - -plt.draw() -plt.show() diff --git a/mpl_examples/pyplots/whats_new_99_mplot3d.pdf b/mpl_examples/pyplots/whats_new_99_mplot3d.pdf deleted file mode 100644 index 66b6a4d37db..00000000000 Binary files a/mpl_examples/pyplots/whats_new_99_mplot3d.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/whats_new_99_mplot3d.png b/mpl_examples/pyplots/whats_new_99_mplot3d.png deleted file mode 100644 index 242973dfd5e..00000000000 Binary files a/mpl_examples/pyplots/whats_new_99_mplot3d.png and /dev/null differ diff --git a/mpl_examples/pyplots/whats_new_99_mplot3d.py b/mpl_examples/pyplots/whats_new_99_mplot3d.py deleted file mode 100644 index bffb607105f..00000000000 --- a/mpl_examples/pyplots/whats_new_99_mplot3d.py +++ /dev/null @@ -1,18 +0,0 @@ -import random - -import numpy as np -import matplotlib.pyplot as plt -from matplotlib import cm -from mpl_toolkits.mplot3d import Axes3D - -X = np.arange(-5, 5, 0.25) -Y = np.arange(-5, 5, 0.25) -X, Y = np.meshgrid(X, Y) -R = np.sqrt(X**2 + Y**2) -Z = np.sin(R) - -fig = plt.figure() -ax = Axes3D(fig) -ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.viridis) - -plt.show() diff --git a/mpl_examples/pyplots/whats_new_99_spines.pdf b/mpl_examples/pyplots/whats_new_99_spines.pdf deleted file mode 100644 index 6988b31d04e..00000000000 Binary files a/mpl_examples/pyplots/whats_new_99_spines.pdf and /dev/null differ diff --git a/mpl_examples/pyplots/whats_new_99_spines.png b/mpl_examples/pyplots/whats_new_99_spines.png deleted file mode 100644 index 76876c518fc..00000000000 Binary files a/mpl_examples/pyplots/whats_new_99_spines.png and /dev/null differ diff --git a/mpl_examples/pyplots/whats_new_99_spines.py b/mpl_examples/pyplots/whats_new_99_spines.py deleted file mode 100644 index de95522f062..00000000000 --- a/mpl_examples/pyplots/whats_new_99_spines.py +++ /dev/null @@ -1,46 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - - -def adjust_spines(ax,spines): - for loc, spine in ax.spines.items(): - if loc in spines: - spine.set_position(('outward',10)) # outward by 10 points - else: - spine.set_color('none') # don't draw spine - - # turn off ticks where there is no spine - if 'left' in spines: - ax.yaxis.set_ticks_position('left') - else: - # no yaxis ticks - ax.yaxis.set_ticks([]) - - if 'bottom' in spines: - ax.xaxis.set_ticks_position('bottom') - else: - # no xaxis ticks - ax.xaxis.set_ticks([]) - -fig = plt.figure() - -x = np.linspace(0,2*np.pi,100) -y = 2*np.sin(x) - -ax = fig.add_subplot(2,2,1) -ax.plot(x,y) -adjust_spines(ax,['left']) - -ax = fig.add_subplot(2,2,2) -ax.plot(x,y) -adjust_spines(ax,[]) - -ax = fig.add_subplot(2,2,3) -ax.plot(x,y) -adjust_spines(ax,['left','bottom']) - -ax = fig.add_subplot(2,2,4) -ax.plot(x,y) -adjust_spines(ax,['bottom']) - -plt.show() diff --git a/mpl_examples/scales/scales.hires.png b/mpl_examples/scales/scales.hires.png deleted file mode 100644 index 95612192476..00000000000 Binary files a/mpl_examples/scales/scales.hires.png and /dev/null differ diff --git a/mpl_examples/scales/scales.pdf b/mpl_examples/scales/scales.pdf deleted file mode 100644 index a5227bc9ee4..00000000000 Binary files a/mpl_examples/scales/scales.pdf and /dev/null differ diff --git a/mpl_examples/scales/scales.png b/mpl_examples/scales/scales.png deleted file mode 100644 index e089720ce95..00000000000 Binary files a/mpl_examples/scales/scales.png and /dev/null differ diff --git a/mpl_examples/scales/scales.py b/mpl_examples/scales/scales.py deleted file mode 100644 index e00f04236f8..00000000000 --- a/mpl_examples/scales/scales.py +++ /dev/null @@ -1,51 +0,0 @@ -""" -Illustrate the scale transformations applied to axes, e.g. log, symlog, logit. -""" -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.ticker import NullFormatter - -np.random.seed(1) -# make up some data in the interval ]0, 1[ -y = np.random.normal(loc=0.5, scale=0.4, size=1000) -y = y[(y > 0) & (y < 1)] -y.sort() -x = np.arange(len(y)) - -# plot with various axes scales -fig, axs = plt.subplots(2, 2, sharex=True) -fig.subplots_adjust(left=0.08, right=0.98, wspace=0.3) - -# linear -ax = axs[0, 0] -ax.plot(x, y) -ax.set_yscale('linear') -ax.set_title('linear') -ax.grid(True) - - -# log -ax = axs[0, 1] -ax.plot(x, y) -ax.set_yscale('log') -ax.set_title('log') -ax.grid(True) - - -# symmetric log -ax = axs[1, 1] -ax.plot(x, y - y.mean()) -ax.set_yscale('symlog', linthreshy=0.02) -ax.set_title('symlog') -ax.grid(True) - -# logit -ax = axs[1, 0] -ax.plot(x, y) -ax.set_yscale('logit') -ax.set_title('logit') -ax.grid(True) -ax.yaxis.set_minor_formatter(NullFormatter()) - - -plt.show() diff --git a/mpl_examples/shapes_and_collections/artist_reference.hires.png b/mpl_examples/shapes_and_collections/artist_reference.hires.png deleted file mode 100644 index db9509d912a..00000000000 Binary files a/mpl_examples/shapes_and_collections/artist_reference.hires.png and /dev/null differ diff --git a/mpl_examples/shapes_and_collections/artist_reference.pdf b/mpl_examples/shapes_and_collections/artist_reference.pdf deleted file mode 100644 index 3fceed55e63..00000000000 Binary files a/mpl_examples/shapes_and_collections/artist_reference.pdf and /dev/null differ diff --git a/mpl_examples/shapes_and_collections/artist_reference.png b/mpl_examples/shapes_and_collections/artist_reference.png deleted file mode 100644 index 9822e5c5c99..00000000000 Binary files a/mpl_examples/shapes_and_collections/artist_reference.png and /dev/null differ diff --git a/mpl_examples/shapes_and_collections/artist_reference.py b/mpl_examples/shapes_and_collections/artist_reference.py deleted file mode 100644 index b1de6b827e4..00000000000 --- a/mpl_examples/shapes_and_collections/artist_reference.py +++ /dev/null @@ -1,104 +0,0 @@ -""" -Reference for matplotlib artists - -This example displays several of matplotlib's graphics primitives (artists) -drawn using matplotlib API. A full list of artists and the documentation is -available at http://matplotlib.org/api/artist_api.html. - -Copyright (c) 2010, Bartosz Telenczuk -BSD License -""" -import matplotlib.pyplot as plt -plt.rcdefaults() - -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.path as mpath -import matplotlib.lines as mlines -import matplotlib.patches as mpatches -from matplotlib.collections import PatchCollection - - -def label(xy, text): - y = xy[1] - 0.15 # shift y-value for label so that it's below the artist - plt.text(xy[0], y, text, ha="center", family='sans-serif', size=14) - - -fig, ax = plt.subplots() -# create 3x3 grid to plot the artists -grid = np.mgrid[0.2:0.8:3j, 0.2:0.8:3j].reshape(2, -1).T - -patches = [] - -# add a circle -circle = mpatches.Circle(grid[0], 0.1, ec="none") -patches.append(circle) -label(grid[0], "Circle") - -# add a rectangle -rect = mpatches.Rectangle(grid[1] - [0.025, 0.05], 0.05, 0.1, ec="none") -patches.append(rect) -label(grid[1], "Rectangle") - -# add a wedge -wedge = mpatches.Wedge(grid[2], 0.1, 30, 270, ec="none") -patches.append(wedge) -label(grid[2], "Wedge") - -# add a Polygon -polygon = mpatches.RegularPolygon(grid[3], 5, 0.1) -patches.append(polygon) -label(grid[3], "Polygon") - -# add an ellipse -ellipse = mpatches.Ellipse(grid[4], 0.2, 0.1) -patches.append(ellipse) -label(grid[4], "Ellipse") - -# add an arrow -arrow = mpatches.Arrow(grid[5, 0] - 0.05, grid[5, 1] - 0.05, 0.1, 0.1, width=0.1) -patches.append(arrow) -label(grid[5], "Arrow") - -# add a path patch -Path = mpath.Path -path_data = [ - (Path.MOVETO, [0.018, -0.11]), - (Path.CURVE4, [-0.031, -0.051]), - (Path.CURVE4, [-0.115, 0.073]), - (Path.CURVE4, [-0.03 , 0.073]), - (Path.LINETO, [-0.011, 0.039]), - (Path.CURVE4, [0.043, 0.121]), - (Path.CURVE4, [0.075, -0.005]), - (Path.CURVE4, [0.035, -0.027]), - (Path.CLOSEPOLY, [0.018, -0.11]) - ] -codes, verts = zip(*path_data) -path = mpath.Path(verts + grid[6], codes) -patch = mpatches.PathPatch(path) -patches.append(patch) -label(grid[6], "PathPatch") - -# add a fancy box -fancybox = mpatches.FancyBboxPatch( - grid[7] - [0.025, 0.05], 0.05, 0.1, - boxstyle=mpatches.BoxStyle("Round", pad=0.02)) -patches.append(fancybox) -label(grid[7], "FancyBboxPatch") - -# add a line -x, y = np.array([[-0.06, 0.0, 0.1], [0.05, -0.05, 0.05]]) -line = mlines.Line2D(x + grid[8, 0], y + grid[8, 1], lw=5., alpha=0.3) -label(grid[8], "Line2D") - -colors = np.linspace(0, 1, len(patches)) -collection = PatchCollection(patches, cmap=plt.cm.hsv, alpha=0.3) -collection.set_array(np.array(colors)) -ax.add_collection(collection) -ax.add_line(line) - -plt.subplots_adjust(left=0, right=1, bottom=0, top=1) -plt.axis('equal') -plt.axis('off') - -plt.show() diff --git a/mpl_examples/shapes_and_collections/path_patch_demo.hires.png b/mpl_examples/shapes_and_collections/path_patch_demo.hires.png deleted file mode 100644 index 3ea5c9122a7..00000000000 Binary files a/mpl_examples/shapes_and_collections/path_patch_demo.hires.png and /dev/null differ diff --git a/mpl_examples/shapes_and_collections/path_patch_demo.pdf b/mpl_examples/shapes_and_collections/path_patch_demo.pdf deleted file mode 100644 index 82594a21073..00000000000 Binary files a/mpl_examples/shapes_and_collections/path_patch_demo.pdf and /dev/null differ diff --git a/mpl_examples/shapes_and_collections/path_patch_demo.png b/mpl_examples/shapes_and_collections/path_patch_demo.png deleted file mode 100644 index 49a853d7f85..00000000000 Binary files a/mpl_examples/shapes_and_collections/path_patch_demo.png and /dev/null differ diff --git a/mpl_examples/shapes_and_collections/path_patch_demo.py b/mpl_examples/shapes_and_collections/path_patch_demo.py deleted file mode 100644 index fb0c8aa4759..00000000000 --- a/mpl_examples/shapes_and_collections/path_patch_demo.py +++ /dev/null @@ -1,34 +0,0 @@ -""" -Demo of a PathPatch object. -""" -import matplotlib.path as mpath -import matplotlib.patches as mpatches -import matplotlib.pyplot as plt - - -fig, ax = plt.subplots() - -Path = mpath.Path -path_data = [ - (Path.MOVETO, (1.58, -2.57)), - (Path.CURVE4, (0.35, -1.1)), - (Path.CURVE4, (-1.75, 2.0)), - (Path.CURVE4, (0.375, 2.0)), - (Path.LINETO, (0.85, 1.15)), - (Path.CURVE4, (2.2, 3.2)), - (Path.CURVE4, (3, 0.05)), - (Path.CURVE4, (2.0, -0.5)), - (Path.CLOSEPOLY, (1.58, -2.57)), - ] -codes, verts = zip(*path_data) -path = mpath.Path(verts, codes) -patch = mpatches.PathPatch(path, facecolor='r', alpha=0.5) -ax.add_patch(patch) - -# plot control points and connecting lines -x, y = zip(*path.vertices) -line, = ax.plot(x, y, 'go-') - -ax.grid() -ax.axis('equal') -plt.show() diff --git a/mpl_examples/shapes_and_collections/scatter_demo.hires.png b/mpl_examples/shapes_and_collections/scatter_demo.hires.png deleted file mode 100644 index 996924ee570..00000000000 Binary files a/mpl_examples/shapes_and_collections/scatter_demo.hires.png and /dev/null differ diff --git a/mpl_examples/shapes_and_collections/scatter_demo.pdf b/mpl_examples/shapes_and_collections/scatter_demo.pdf deleted file mode 100644 index 38727f1480f..00000000000 Binary files a/mpl_examples/shapes_and_collections/scatter_demo.pdf and /dev/null differ diff --git a/mpl_examples/shapes_and_collections/scatter_demo.png b/mpl_examples/shapes_and_collections/scatter_demo.png deleted file mode 100644 index 0d2c23c016e..00000000000 Binary files a/mpl_examples/shapes_and_collections/scatter_demo.png and /dev/null differ diff --git a/mpl_examples/shapes_and_collections/scatter_demo.py b/mpl_examples/shapes_and_collections/scatter_demo.py deleted file mode 100644 index 8fff9182ccd..00000000000 --- a/mpl_examples/shapes_and_collections/scatter_demo.py +++ /dev/null @@ -1,15 +0,0 @@ -""" -Simple demo of a scatter plot. -""" -import numpy as np -import matplotlib.pyplot as plt - - -N = 50 -x = np.random.rand(N) -y = np.random.rand(N) -colors = np.random.rand(N) -area = np.pi * (15 * np.random.rand(N))**2 # 0 to 15 point radii - -plt.scatter(x, y, s=area, c=colors, alpha=0.5) -plt.show() diff --git a/mpl_examples/showcase/anatomy.pdf b/mpl_examples/showcase/anatomy.pdf deleted file mode 100644 index 1debf8abd94..00000000000 Binary files a/mpl_examples/showcase/anatomy.pdf and /dev/null differ diff --git a/mpl_examples/showcase/anatomy.png b/mpl_examples/showcase/anatomy.png deleted file mode 100644 index f27cad981a7..00000000000 Binary files a/mpl_examples/showcase/anatomy.png and /dev/null differ diff --git a/mpl_examples/showcase/anatomy.py b/mpl_examples/showcase/anatomy.py deleted file mode 100644 index 9ce4227460f..00000000000 --- a/mpl_examples/showcase/anatomy.py +++ /dev/null @@ -1,140 +0,0 @@ -# This figure shows the name of several matplotlib elements composing a figure - -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.ticker import AutoMinorLocator, MultipleLocator, FuncFormatter - - -np.random.seed(19680801) - -X = np.linspace(0.5, 3.5, 100) -Y1 = 3+np.cos(X) -Y2 = 1+np.cos(1+X/0.75)/2 -Y3 = np.random.uniform(Y1, Y2, len(X)) - -fig = plt.figure(figsize=(8, 8)) -ax = fig.add_subplot(1, 1, 1, aspect=1) - - -def minor_tick(x, pos): - if not x % 1.0: - return "" - return "%.2f" % x - -ax.xaxis.set_major_locator(MultipleLocator(1.000)) -ax.xaxis.set_minor_locator(AutoMinorLocator(4)) -ax.yaxis.set_major_locator(MultipleLocator(1.000)) -ax.yaxis.set_minor_locator(AutoMinorLocator(4)) -ax.xaxis.set_minor_formatter(FuncFormatter(minor_tick)) - -ax.set_xlim(0, 4) -ax.set_ylim(0, 4) - -ax.tick_params(which='major', width=1.0) -ax.tick_params(which='major', length=10) -ax.tick_params(which='minor', width=1.0, labelsize=10) -ax.tick_params(which='minor', length=5, labelsize=10, labelcolor='0.25') - -ax.grid(linestyle="--", linewidth=0.5, color='.25', zorder=-10) - -ax.plot(X, Y1, c=(0.25, 0.25, 1.00), lw=2, label="Blue signal", zorder=10) -ax.plot(X, Y2, c=(1.00, 0.25, 0.25), lw=2, label="Red signal") -ax.plot(X, Y3, linewidth=0, - marker='o', markerfacecolor='w', markeredgecolor='k') - -ax.set_title("Anatomy of a figure", fontsize=20, verticalalignment='bottom') -ax.set_xlabel("X axis label") -ax.set_ylabel("Y axis label") - -ax.legend() - - -def circle(x, y, radius=0.15): - from matplotlib.patches import Circle - from matplotlib.patheffects import withStroke - circle = Circle((x, y), radius, clip_on=False, zorder=10, linewidth=1, - edgecolor='black', facecolor=(0, 0, 0, .0125), - path_effects=[withStroke(linewidth=5, foreground='w')]) - ax.add_artist(circle) - - -def text(x, y, text): - ax.text(x, y, text, backgroundcolor="white", - ha='center', va='top', weight='bold', color='blue') - - -# Minor tick -circle(0.50, -0.10) -text(0.50, -0.32, "Minor tick label") - -# Major tick -circle(-0.03, 4.00) -text(0.03, 3.80, "Major tick") - -# Minor tick -circle(0.00, 3.50) -text(0.00, 3.30, "Minor tick") - -# Major tick label -circle(-0.15, 3.00) -text(-0.15, 2.80, "Major tick label") - -# X Label -circle(1.80, -0.27) -text(1.80, -0.45, "X axis label") - -# Y Label -circle(-0.27, 1.80) -text(-0.27, 1.6, "Y axis label") - -# Title -circle(1.60, 4.13) -text(1.60, 3.93, "Title") - -# Blue plot -circle(1.75, 2.80) -text(1.75, 2.60, "Line\n(line plot)") - -# Red plot -circle(1.20, 0.60) -text(1.20, 0.40, "Line\n(line plot)") - -# Scatter plot -circle(3.20, 1.75) -text(3.20, 1.55, "Markers\n(scatter plot)") - -# Grid -circle(3.00, 3.00) -text(3.00, 2.80, "Grid") - -# Legend -circle(3.70, 3.80) -text(3.70, 3.60, "Legend") - -# Axes -circle(0.5, 0.5) -text(0.5, 0.3, "Axes") - -# Figure -circle(-0.3, 0.65) -text(-0.3, 0.45, "Figure") - -color = 'blue' -ax.annotate('Spines', xy=(4.0, 0.35), xycoords='data', - xytext=(3.3, 0.5), textcoords='data', - weight='bold', color=color, - arrowprops=dict(arrowstyle='->', - connectionstyle="arc3", - color=color)) - -ax.annotate('', xy=(3.15, 0.0), xycoords='data', - xytext=(3.45, 0.45), textcoords='data', - weight='bold', color=color, - arrowprops=dict(arrowstyle='->', - connectionstyle="arc3", - color=color)) - -ax.text(4.0, -0.4, "Made with http://matplotlib.org", - fontsize=10, ha="right", color='.5') - -plt.show() diff --git a/mpl_examples/showcase/bachelors_degrees_by_gender.hires.png b/mpl_examples/showcase/bachelors_degrees_by_gender.hires.png deleted file mode 100644 index 32b49eeeb30..00000000000 Binary files a/mpl_examples/showcase/bachelors_degrees_by_gender.hires.png and /dev/null differ diff --git a/mpl_examples/showcase/bachelors_degrees_by_gender.pdf b/mpl_examples/showcase/bachelors_degrees_by_gender.pdf deleted file mode 100644 index 8ee72dc4a72..00000000000 Binary files a/mpl_examples/showcase/bachelors_degrees_by_gender.pdf and /dev/null differ diff --git a/mpl_examples/showcase/bachelors_degrees_by_gender.png b/mpl_examples/showcase/bachelors_degrees_by_gender.png deleted file mode 100644 index f9420278f2e..00000000000 Binary files a/mpl_examples/showcase/bachelors_degrees_by_gender.png and /dev/null differ diff --git a/mpl_examples/showcase/bachelors_degrees_by_gender.py b/mpl_examples/showcase/bachelors_degrees_by_gender.py deleted file mode 100644 index fb5132cc422..00000000000 --- a/mpl_examples/showcase/bachelors_degrees_by_gender.py +++ /dev/null @@ -1,101 +0,0 @@ -import matplotlib.pyplot as plt -from matplotlib.mlab import csv2rec -from matplotlib.cbook import get_sample_data - -fname = get_sample_data('percent_bachelors_degrees_women_usa.csv') -gender_degree_data = csv2rec(fname) - -# These are the colors that will be used in the plot -color_sequence = ['#1f77b4', '#aec7e8', '#ff7f0e', '#ffbb78', '#2ca02c', - '#98df8a', '#d62728', '#ff9896', '#9467bd', '#c5b0d5', - '#8c564b', '#c49c94', '#e377c2', '#f7b6d2', '#7f7f7f', - '#c7c7c7', '#bcbd22', '#dbdb8d', '#17becf', '#9edae5'] - -# You typically want your plot to be ~1.33x wider than tall. This plot -# is a rare exception because of the number of lines being plotted on it. -# Common sizes: (10, 7.5) and (12, 9) -fig, ax = plt.subplots(1, 1, figsize=(12, 14)) - -# Remove the plot frame lines. They are unnecessary here. -ax.spines['top'].set_visible(False) -ax.spines['bottom'].set_visible(False) -ax.spines['right'].set_visible(False) -ax.spines['left'].set_visible(False) - -# Ensure that the axis ticks only show up on the bottom and left of the plot. -# Ticks on the right and top of the plot are generally unnecessary. -ax.get_xaxis().tick_bottom() -ax.get_yaxis().tick_left() - -fig.subplots_adjust(left=.06, right=.75, bottom=.02, top=.94) -# Limit the range of the plot to only where the data is. -# Avoid unnecessary whitespace. -ax.set_xlim(1969.5, 2011.1) -ax.set_ylim(-0.25, 90) - -# Make sure your axis ticks are large enough to be easily read. -# You don't want your viewers squinting to read your plot. -plt.xticks(range(1970, 2011, 10), fontsize=14) -plt.yticks(range(0, 91, 10), fontsize=14) -ax.xaxis.set_major_formatter(plt.FuncFormatter('{:.0f}'.format)) -ax.yaxis.set_major_formatter(plt.FuncFormatter('{:.0f}%'.format)) - -# Provide tick lines across the plot to help your viewers trace along -# the axis ticks. Make sure that the lines are light and small so they -# don't obscure the primary data lines. -plt.grid(True, 'major', 'y', ls='--', lw=.5, c='k', alpha=.3) - -# Remove the tick marks; they are unnecessary with the tick lines we just -# plotted. -plt.tick_params(axis='both', which='both', bottom='off', top='off', - labelbottom='on', left='off', right='off', labelleft='on') - -# Now that the plot is prepared, it's time to actually plot the data! -# Note that I plotted the majors in order of the highest % in the final year. -majors = ['Health Professions', 'Public Administration', 'Education', - 'Psychology', 'Foreign Languages', 'English', - 'Communications\nand Journalism', 'Art and Performance', 'Biology', - 'Agriculture', 'Social Sciences and History', 'Business', - 'Math and Statistics', 'Architecture', 'Physical Sciences', - 'Computer Science', 'Engineering'] - -y_offsets = {'Foreign Languages': 0.5, 'English': -0.5, - 'Communications\nand Journalism': 0.75, - 'Art and Performance': -0.25, 'Agriculture': 1.25, - 'Social Sciences and History': 0.25, 'Business': -0.75, - 'Math and Statistics': 0.75, 'Architecture': -0.75, - 'Computer Science': 0.75, 'Engineering': -0.25} - -for rank, column in enumerate(majors): - # Plot each line separately with its own color. - column_rec_name = column.replace('\n', '_').replace(' ', '_').lower() - - line = plt.plot(gender_degree_data.year, - gender_degree_data[column_rec_name], - lw=2.5, - color=color_sequence[rank]) - - # Add a text label to the right end of every line. Most of the code below - # is adding specific offsets y position because some labels overlapped. - y_pos = gender_degree_data[column_rec_name][-1] - 0.5 - - if column in y_offsets: - y_pos += y_offsets[column] - - # Again, make sure that all labels are large enough to be easily read - # by the viewer. - plt.text(2011.5, y_pos, column, fontsize=14, color=color_sequence[rank]) - -# Make the title big enough so it spans the entire plot, but don't make it -# so big that it requires two lines to show. - -# Note that if the title is descriptive enough, it is unnecessary to include -# axis labels; they are self-evident, in this plot's case. -fig.suptitle('Percentage of Bachelor\'s degrees conferred to women in ' - 'the U.S.A. by major (1970-2011)\n', fontsize=18, ha='center') - -# Finally, save the figure as a PNG. -# You can also save it as a PDF, JPEG, etc. -# Just change the file extension in this call. -# plt.savefig('percent-bachelors-degrees-women-usa.png', bbox_inches='tight') -plt.show() diff --git a/mpl_examples/showcase/firefox.pdf b/mpl_examples/showcase/firefox.pdf deleted file mode 100644 index 6badef9a3dc..00000000000 Binary files a/mpl_examples/showcase/firefox.pdf and /dev/null differ diff --git a/mpl_examples/showcase/firefox.png b/mpl_examples/showcase/firefox.png deleted file mode 100644 index f2da0ee390a..00000000000 Binary files a/mpl_examples/showcase/firefox.png and /dev/null differ diff --git a/mpl_examples/showcase/firefox.py b/mpl_examples/showcase/firefox.py deleted file mode 100644 index 0f597812fa8..00000000000 --- a/mpl_examples/showcase/firefox.py +++ /dev/null @@ -1,71 +0,0 @@ -""" -======= -Firefox -======= - -This example shows how to create the Firefox logo with path and patches. -""" - -import re -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.path import Path -import matplotlib.patches as patches - -# From: http://raphaeljs.com/icons/#firefox -firefox = "M28.4,22.469c0.479-0.964,0.851-1.991,1.095-3.066c0.953-3.661,0.666-6.854,0.666-6.854l-0.327,2.104c0,0-0.469-3.896-1.044-5.353c-0.881-2.231-1.273-2.214-1.274-2.21c0.542,1.379,0.494,2.169,0.483,2.288c-0.01-0.016-0.019-0.032-0.027-0.047c-0.131-0.324-0.797-1.819-2.225-2.878c-2.502-2.481-5.943-4.014-9.745-4.015c-4.056,0-7.705,1.745-10.238,4.525C5.444,6.5,5.183,5.938,5.159,5.317c0,0-0.002,0.002-0.006,0.005c0-0.011-0.003-0.021-0.003-0.031c0,0-1.61,1.247-1.436,4.612c-0.299,0.574-0.56,1.172-0.777,1.791c-0.375,0.817-0.75,2.004-1.059,3.746c0,0,0.133-0.422,0.399-0.988c-0.064,0.482-0.103,0.971-0.116,1.467c-0.09,0.845-0.118,1.865-0.039,3.088c0,0,0.032-0.406,0.136-1.021c0.834,6.854,6.667,12.165,13.743,12.165l0,0c1.86,0,3.636-0.37,5.256-1.036C24.938,27.771,27.116,25.196,28.4,22.469zM16.002,3.356c2.446,0,4.73,0.68,6.68,1.86c-2.274-0.528-3.433-0.261-3.423-0.248c0.013,0.015,3.384,0.589,3.981,1.411c0,0-1.431,0-2.856,0.41c-0.065,0.019,5.242,0.663,6.327,5.966c0,0-0.582-1.213-1.301-1.42c0.473,1.439,0.351,4.17-0.1,5.528c-0.058,0.174-0.118-0.755-1.004-1.155c0.284,2.037-0.018,5.268-1.432,6.158c-0.109,0.07,0.887-3.189,0.201-1.93c-4.093,6.276-8.959,2.539-10.934,1.208c1.585,0.388,3.267,0.108,4.242-0.559c0.982-0.672,1.564-1.162,2.087-1.047c0.522,0.117,0.87-0.407,0.464-0.872c-0.405-0.466-1.392-1.105-2.725-0.757c-0.94,0.247-2.107,1.287-3.886,0.233c-1.518-0.899-1.507-1.63-1.507-2.095c0-0.366,0.257-0.88,0.734-1.028c0.58,0.062,1.044,0.214,1.537,0.466c0.005-0.135,0.006-0.315-0.001-0.519c0.039-0.077,0.015-0.311-0.047-0.596c-0.036-0.287-0.097-0.582-0.19-0.851c0.01-0.002,0.017-0.007,0.021-0.021c0.076-0.344,2.147-1.544,2.299-1.659c0.153-0.114,0.55-0.378,0.506-1.183c-0.015-0.265-0.058-0.294-2.232-0.286c-0.917,0.003-1.425-0.894-1.589-1.245c0.222-1.231,0.863-2.11,1.919-2.704c0.02-0.011,0.015-0.021-0.008-0.027c0.219-0.127-2.524-0.006-3.76,1.604C9.674,8.045,9.219,7.95,8.71,7.95c-0.638,0-1.139,0.07-1.603,0.187c-0.05,0.013-0.122,0.011-0.208-0.001C6.769,8.04,6.575,7.88,6.365,7.672c0.161-0.18,0.324-0.356,0.495-0.526C9.201,4.804,12.43,3.357,16.002,3.356z" - - -def svg_parse(path): - commands = {'M': (Path.MOVETO,), - 'L': (Path.LINETO,), - 'Q': (Path.CURVE3,)*2, - 'C': (Path.CURVE4,)*3, - 'Z': (Path.CLOSEPOLY,)} - path_re = re.compile(r'([MLHVCSQTAZ])([^MLHVCSQTAZ]+)', re.IGNORECASE) - float_re = re.compile(r'(?:[\s,]*)([+-]?\d+(?:\.\d+)?)') - vertices = [] - codes = [] - last = (0, 0) - for cmd, values in path_re.findall(path): - points = [float(v) for v in float_re.findall(values)] - points = np.array(points).reshape((len(points)//2, 2)) - if cmd.islower(): - points += last - cmd = cmd.capitalize() - last = points[-1] - codes.extend(commands[cmd]) - vertices.extend(points.tolist()) - return codes, vertices - -# SVG to matplotlib -codes, verts = svg_parse(firefox) -verts = np.array(verts) -path = Path(verts, codes) - -# Make upside down -verts[:, 1] *= -1 -xmin, xmax = verts[:, 0].min()-1, verts[:, 0].max()+1 -ymin, ymax = verts[:, 1].min()-1, verts[:, 1].max()+1 - -fig = plt.figure(figsize=(5, 5)) -ax = fig.add_axes([0.0, 0.0, 1.0, 1.0], frameon=False, aspect=1) - -# White outline (width = 6) -patch = patches.PathPatch(path, facecolor='None', edgecolor='w', lw=6) -ax.add_patch(patch) - -# Actual shape with black outline -patch = patches.PathPatch(path, facecolor='orange', edgecolor='k', lw=2) -ax.add_patch(patch) - -# Centering -ax.set_xlim(xmin, xmax) -ax.set_ylim(ymin, ymax) - -# No ticks -ax.set_xticks([]) -ax.set_yticks([]) - -# Display -plt.show() diff --git a/mpl_examples/showcase/integral_demo.hires.png b/mpl_examples/showcase/integral_demo.hires.png deleted file mode 100644 index dd9a9d32c16..00000000000 Binary files a/mpl_examples/showcase/integral_demo.hires.png and /dev/null differ diff --git a/mpl_examples/showcase/integral_demo.pdf b/mpl_examples/showcase/integral_demo.pdf deleted file mode 100644 index b2153483a09..00000000000 Binary files a/mpl_examples/showcase/integral_demo.pdf and /dev/null differ diff --git a/mpl_examples/showcase/integral_demo.png b/mpl_examples/showcase/integral_demo.png deleted file mode 100644 index 90f34b7a15d..00000000000 Binary files a/mpl_examples/showcase/integral_demo.png and /dev/null differ diff --git a/mpl_examples/showcase/integral_demo.py b/mpl_examples/showcase/integral_demo.py deleted file mode 100644 index 144a5e93f77..00000000000 --- a/mpl_examples/showcase/integral_demo.py +++ /dev/null @@ -1,51 +0,0 @@ -""" -Plot demonstrating the integral as the area under a curve. - -Although this is a simple example, it demonstrates some important tweaks: - - * A simple line plot with custom color and line width. - * A shaded region created using a Polygon patch. - * A text label with mathtext rendering. - * figtext calls to label the x- and y-axes. - * Use of axis spines to hide the top and right spines. - * Custom tick placement and labels. -""" -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.patches import Polygon - - -def func(x): - return (x - 3) * (x - 5) * (x - 7) + 85 - - -a, b = 2, 9 # integral limits -x = np.linspace(0, 10) -y = func(x) - -fig, ax = plt.subplots() -plt.plot(x, y, 'r', linewidth=2) -plt.ylim(ymin=0) - -# Make the shaded region -ix = np.linspace(a, b) -iy = func(ix) -verts = [(a, 0)] + list(zip(ix, iy)) + [(b, 0)] -poly = Polygon(verts, facecolor='0.9', edgecolor='0.5') -ax.add_patch(poly) - -plt.text(0.5 * (a + b), 30, r"$\int_a^b f(x)\mathrm{d}x$", - horizontalalignment='center', fontsize=20) - -plt.figtext(0.9, 0.05, '$x$') -plt.figtext(0.1, 0.9, '$y$') - -ax.spines['right'].set_visible(False) -ax.spines['top'].set_visible(False) -ax.xaxis.set_ticks_position('bottom') - -ax.set_xticks((a, b)) -ax.set_xticklabels(('$a$', '$b$')) -ax.set_yticks([]) - -plt.show() diff --git a/mpl_examples/showcase/mandelbrot.pdf b/mpl_examples/showcase/mandelbrot.pdf deleted file mode 100644 index 62f099fc5ae..00000000000 Binary files a/mpl_examples/showcase/mandelbrot.pdf and /dev/null differ diff --git a/mpl_examples/showcase/mandelbrot.png b/mpl_examples/showcase/mandelbrot.png deleted file mode 100644 index 9b0b4d32f36..00000000000 Binary files a/mpl_examples/showcase/mandelbrot.png and /dev/null differ diff --git a/mpl_examples/showcase/mandelbrot.py b/mpl_examples/showcase/mandelbrot.py deleted file mode 100644 index 877964b80ed..00000000000 --- a/mpl_examples/showcase/mandelbrot.py +++ /dev/null @@ -1,76 +0,0 @@ -""" -=================================== -Shaded & power normalized rendering -=================================== - -The Mandelbrot set rendering can be improved by using a normalized recount -associated with a power normalized colormap (gamma=0.3). Rendering can be -further enhanced thanks to shading. - -The `maxiter` gives the precision of the computation. `maxiter=200` should -take a few seconds on most modern laptops. -""" -import numpy as np - - -def mandelbrot_set(xmin, xmax, ymin, ymax, xn, yn, maxiter, horizon=2.0): - X = np.linspace(xmin, xmax, xn, dtype=np.float32) - Y = np.linspace(ymin, ymax, yn, dtype=np.float32) - C = X + Y[:, None]*1j - N = np.zeros(C.shape, dtype=int) - Z = np.zeros(C.shape, np.complex64) - for n in range(maxiter): - I = np.less(abs(Z), horizon) - N[I] = n - Z[I] = Z[I]**2 + C[I] - N[N == maxiter-1] = 0 - return Z, N - - -if __name__ == '__main__': - import time - import matplotlib - from matplotlib import colors - import matplotlib.pyplot as plt - - xmin, xmax, xn = -2.25, +0.75, 3000/2 - ymin, ymax, yn = -1.25, +1.25, 2500/2 - maxiter = 200 - horizon = 2.0 ** 40 - log_horizon = np.log(np.log(horizon))/np.log(2) - Z, N = mandelbrot_set(xmin, xmax, ymin, ymax, xn, yn, maxiter, horizon) - - # Normalized recount as explained in: - # https://linas.org/art-gallery/escape/smooth.html - # https://www.ibm.com/developerworks/community/blogs/jfp/entry/My_Christmas_Gift - - # This line will generate warnings for null values but it is faster to - # process them afterwards using the nan_to_num - with np.errstate(invalid='ignore'): - M = np.nan_to_num(N + 1 - - np.log(np.log(abs(Z)))/np.log(2) + - log_horizon) - - dpi = 72 - width = 10 - height = 10*yn/xn - fig = plt.figure(figsize=(width, height), dpi=dpi) - ax = fig.add_axes([0.0, 0.0, 1.0, 1.0], frameon=False, aspect=1) - - # Shaded rendering - light = colors.LightSource(azdeg=315, altdeg=10) - M = light.shade(M, cmap=plt.cm.hot, vert_exag=1.5, - norm=colors.PowerNorm(0.3), blend_mode='hsv') - plt.imshow(M, extent=[xmin, xmax, ymin, ymax], interpolation="bicubic") - ax.set_xticks([]) - ax.set_yticks([]) - - # Some advertisement for matplotlib - year = time.strftime("%Y") - major, minor, micro = matplotlib.__version__.split('.', 2) - text = ("The Mandelbrot fractal set\n" - "Rendered with matplotlib %s.%s, %s - http://matplotlib.org" - % (major, minor, year)) - ax.text(xmin+.025, ymin+.025, text, color="white", fontsize=12, alpha=0.5) - - plt.show() diff --git a/mpl_examples/showcase/xkcd.py b/mpl_examples/showcase/xkcd.py deleted file mode 100644 index 8e905f0fca1..00000000000 --- a/mpl_examples/showcase/xkcd.py +++ /dev/null @@ -1,61 +0,0 @@ -""" -==== -XKCD -==== - -Shows how to create an xkcd-like plot. -""" -import matplotlib.pyplot as plt -import numpy as np - -with plt.xkcd(): - # Based on "Stove Ownership" from XKCD by Randall Monroe - # http://xkcd.com/418/ - - fig = plt.figure() - ax = fig.add_axes((0.1, 0.2, 0.8, 0.7)) - ax.spines['right'].set_color('none') - ax.spines['top'].set_color('none') - plt.xticks([]) - plt.yticks([]) - ax.set_ylim([-30, 10]) - - data = np.ones(100) - data[70:] -= np.arange(30) - - plt.annotate( - 'THE DAY I REALIZED\nI COULD COOK BACON\nWHENEVER I WANTED', - xy=(70, 1), arrowprops=dict(arrowstyle='->'), xytext=(15, -10)) - - plt.plot(data) - - plt.xlabel('time') - plt.ylabel('my overall health') - fig.text( - 0.5, 0.05, - '"Stove Ownership" from xkcd by Randall Monroe', - ha='center') - - # Based on "The Data So Far" from XKCD by Randall Monroe - # http://xkcd.com/373/ - - fig = plt.figure() - ax = fig.add_axes((0.1, 0.2, 0.8, 0.7)) - ax.bar([0, 1], [0, 100], 0.25) - ax.spines['right'].set_color('none') - ax.spines['top'].set_color('none') - ax.xaxis.set_ticks_position('bottom') - ax.set_xticks([0, 1]) - ax.set_xlim([-0.5, 1.5]) - ax.set_ylim([0, 110]) - ax.set_xticklabels(['CONFIRMED BY\nEXPERIMENT', 'REFUTED BY\nEXPERIMENT']) - plt.yticks([]) - - plt.title("CLAIMS OF SUPERNATURAL POWERS") - - fig.text( - 0.5, 0.05, - '"The Data So Far" from xkcd by Randall Monroe', - ha='center') - -plt.show() diff --git a/mpl_examples/showcase/xkcd_00.hires.png b/mpl_examples/showcase/xkcd_00.hires.png deleted file mode 100644 index 5d764729a5c..00000000000 Binary files a/mpl_examples/showcase/xkcd_00.hires.png and /dev/null differ diff --git a/mpl_examples/showcase/xkcd_00.pdf b/mpl_examples/showcase/xkcd_00.pdf deleted file mode 100644 index a7d03b68745..00000000000 Binary files a/mpl_examples/showcase/xkcd_00.pdf and /dev/null differ diff --git a/mpl_examples/showcase/xkcd_00.png b/mpl_examples/showcase/xkcd_00.png deleted file mode 100644 index aa8b56fc6df..00000000000 Binary files a/mpl_examples/showcase/xkcd_00.png and /dev/null differ diff --git a/mpl_examples/showcase/xkcd_01.hires.png b/mpl_examples/showcase/xkcd_01.hires.png deleted file mode 100644 index ecb853ec355..00000000000 Binary files a/mpl_examples/showcase/xkcd_01.hires.png and /dev/null differ diff --git a/mpl_examples/showcase/xkcd_01.pdf b/mpl_examples/showcase/xkcd_01.pdf deleted file mode 100644 index fc3fd058163..00000000000 Binary files a/mpl_examples/showcase/xkcd_01.pdf and /dev/null differ diff --git a/mpl_examples/showcase/xkcd_01.png b/mpl_examples/showcase/xkcd_01.png deleted file mode 100644 index eb188f85b1d..00000000000 Binary files a/mpl_examples/showcase/xkcd_01.png and /dev/null differ diff --git a/mpl_examples/specialty_plots/advanced_hillshading.py b/mpl_examples/specialty_plots/advanced_hillshading.py deleted file mode 100644 index 34ff41be71d..00000000000 --- a/mpl_examples/specialty_plots/advanced_hillshading.py +++ /dev/null @@ -1,71 +0,0 @@ -""" -Demonstrates a few common tricks with shaded plots. -""" -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.colors import LightSource, Normalize - - -def display_colorbar(): - """Display a correct numeric colorbar for a shaded plot.""" - y, x = np.mgrid[-4:2:200j, -4:2:200j] - z = 10 * np.cos(x**2 + y**2) - - cmap = plt.cm.copper - ls = LightSource(315, 45) - rgb = ls.shade(z, cmap) - - fig, ax = plt.subplots() - ax.imshow(rgb, interpolation='bilinear') - - # Use a proxy artist for the colorbar... - im = ax.imshow(z, cmap=cmap) - im.remove() - fig.colorbar(im) - - ax.set_title('Using a colorbar with a shaded plot', size='x-large') - - -def avoid_outliers(): - """Use a custom norm to control the displayed z-range of a shaded plot.""" - y, x = np.mgrid[-4:2:200j, -4:2:200j] - z = 10 * np.cos(x**2 + y**2) - - # Add some outliers... - z[100, 105] = 2000 - z[120, 110] = -9000 - - ls = LightSource(315, 45) - fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(8, 4.5)) - - rgb = ls.shade(z, plt.cm.copper) - ax1.imshow(rgb, interpolation='bilinear') - ax1.set_title('Full range of data') - - rgb = ls.shade(z, plt.cm.copper, vmin=-10, vmax=10) - ax2.imshow(rgb, interpolation='bilinear') - ax2.set_title('Manually set range') - - fig.suptitle('Avoiding Outliers in Shaded Plots', size='x-large') - - -def shade_other_data(): - """Demonstrates displaying different variables through shade and color.""" - y, x = np.mgrid[-4:2:200j, -4:2:200j] - z1 = np.sin(x**2) # Data to hillshade - z2 = np.cos(x**2 + y**2) # Data to color - - norm = Normalize(z2.min(), z2.max()) - cmap = plt.cm.RdBu - - ls = LightSource(315, 45) - rgb = ls.shade_rgb(cmap(norm(z2)), z1) - - fig, ax = plt.subplots() - ax.imshow(rgb, interpolation='bilinear') - ax.set_title('Shade by one variable, color by another', size='x-large') - -display_colorbar() -avoid_outliers() -shade_other_data() -plt.show() diff --git a/mpl_examples/specialty_plots/advanced_hillshading_00.hires.png b/mpl_examples/specialty_plots/advanced_hillshading_00.hires.png deleted file mode 100644 index 4f223c4d5da..00000000000 Binary files a/mpl_examples/specialty_plots/advanced_hillshading_00.hires.png and /dev/null differ diff --git a/mpl_examples/specialty_plots/advanced_hillshading_00.pdf b/mpl_examples/specialty_plots/advanced_hillshading_00.pdf deleted file mode 100644 index 8498fd45cf5..00000000000 Binary files a/mpl_examples/specialty_plots/advanced_hillshading_00.pdf and /dev/null differ diff --git a/mpl_examples/specialty_plots/advanced_hillshading_00.png b/mpl_examples/specialty_plots/advanced_hillshading_00.png deleted file mode 100644 index 8f05f783c27..00000000000 Binary files a/mpl_examples/specialty_plots/advanced_hillshading_00.png and /dev/null differ diff --git a/mpl_examples/specialty_plots/advanced_hillshading_01.hires.png b/mpl_examples/specialty_plots/advanced_hillshading_01.hires.png deleted file mode 100644 index f8cfb2b1355..00000000000 Binary files a/mpl_examples/specialty_plots/advanced_hillshading_01.hires.png and /dev/null differ diff --git a/mpl_examples/specialty_plots/advanced_hillshading_01.pdf b/mpl_examples/specialty_plots/advanced_hillshading_01.pdf deleted file mode 100644 index ac414189d76..00000000000 Binary files a/mpl_examples/specialty_plots/advanced_hillshading_01.pdf and /dev/null differ diff --git a/mpl_examples/specialty_plots/advanced_hillshading_01.png b/mpl_examples/specialty_plots/advanced_hillshading_01.png deleted file mode 100644 index 0f1a55a2b9d..00000000000 Binary files a/mpl_examples/specialty_plots/advanced_hillshading_01.png and /dev/null differ diff --git a/mpl_examples/specialty_plots/advanced_hillshading_02.hires.png b/mpl_examples/specialty_plots/advanced_hillshading_02.hires.png deleted file mode 100644 index 3bc8598c919..00000000000 Binary files a/mpl_examples/specialty_plots/advanced_hillshading_02.hires.png and /dev/null differ diff --git a/mpl_examples/specialty_plots/advanced_hillshading_02.pdf b/mpl_examples/specialty_plots/advanced_hillshading_02.pdf deleted file mode 100644 index 58998c937ad..00000000000 Binary files a/mpl_examples/specialty_plots/advanced_hillshading_02.pdf and /dev/null differ diff --git a/mpl_examples/specialty_plots/advanced_hillshading_02.png b/mpl_examples/specialty_plots/advanced_hillshading_02.png deleted file mode 100644 index 50c192ef740..00000000000 Binary files a/mpl_examples/specialty_plots/advanced_hillshading_02.png and /dev/null differ diff --git a/mpl_examples/specialty_plots/hinton_demo.hires.png b/mpl_examples/specialty_plots/hinton_demo.hires.png deleted file mode 100644 index ba3cd2d4a8e..00000000000 Binary files a/mpl_examples/specialty_plots/hinton_demo.hires.png and /dev/null differ diff --git a/mpl_examples/specialty_plots/hinton_demo.pdf b/mpl_examples/specialty_plots/hinton_demo.pdf deleted file mode 100644 index fff3fca3044..00000000000 Binary files a/mpl_examples/specialty_plots/hinton_demo.pdf and /dev/null differ diff --git a/mpl_examples/specialty_plots/hinton_demo.png b/mpl_examples/specialty_plots/hinton_demo.png deleted file mode 100644 index 658b0c83f10..00000000000 Binary files a/mpl_examples/specialty_plots/hinton_demo.png and /dev/null differ diff --git a/mpl_examples/specialty_plots/hinton_demo.py b/mpl_examples/specialty_plots/hinton_demo.py deleted file mode 100644 index e022c079393..00000000000 --- a/mpl_examples/specialty_plots/hinton_demo.py +++ /dev/null @@ -1,40 +0,0 @@ -""" -Demo of a function to create Hinton diagrams. - -Hinton diagrams are useful for visualizing the values of a 2D array (e.g. -a weight matrix): Positive and negative values are represented by white and -black squares, respectively, and the size of each square represents the -magnitude of each value. - -Initial idea from David Warde-Farley on the SciPy Cookbook -""" -import numpy as np -import matplotlib.pyplot as plt - - -def hinton(matrix, max_weight=None, ax=None): - """Draw Hinton diagram for visualizing a weight matrix.""" - ax = ax if ax is not None else plt.gca() - - if not max_weight: - max_weight = 2 ** np.ceil(np.log(np.abs(matrix).max()) / np.log(2)) - - ax.patch.set_facecolor('gray') - ax.set_aspect('equal', 'box') - ax.xaxis.set_major_locator(plt.NullLocator()) - ax.yaxis.set_major_locator(plt.NullLocator()) - - for (x, y), w in np.ndenumerate(matrix): - color = 'white' if w > 0 else 'black' - size = np.sqrt(np.abs(w) / max_weight) - rect = plt.Rectangle([x - size / 2, y - size / 2], size, size, - facecolor=color, edgecolor=color) - ax.add_patch(rect) - - ax.autoscale_view() - ax.invert_yaxis() - - -if __name__ == '__main__': - hinton(np.random.rand(20, 20) - 0.5) - plt.show() diff --git a/mpl_examples/specialty_plots/topographic_hillshading.hires.png b/mpl_examples/specialty_plots/topographic_hillshading.hires.png deleted file mode 100644 index f7659ea6454..00000000000 Binary files a/mpl_examples/specialty_plots/topographic_hillshading.hires.png and /dev/null differ diff --git a/mpl_examples/specialty_plots/topographic_hillshading.pdf b/mpl_examples/specialty_plots/topographic_hillshading.pdf deleted file mode 100644 index 5f0f3956c75..00000000000 Binary files a/mpl_examples/specialty_plots/topographic_hillshading.pdf and /dev/null differ diff --git a/mpl_examples/specialty_plots/topographic_hillshading.png b/mpl_examples/specialty_plots/topographic_hillshading.png deleted file mode 100644 index 6f608b94292..00000000000 Binary files a/mpl_examples/specialty_plots/topographic_hillshading.png and /dev/null differ diff --git a/mpl_examples/specialty_plots/topographic_hillshading.py b/mpl_examples/specialty_plots/topographic_hillshading.py deleted file mode 100644 index 3ca750b5604..00000000000 --- a/mpl_examples/specialty_plots/topographic_hillshading.py +++ /dev/null @@ -1,70 +0,0 @@ -""" -Demonstrates the visual effect of varying blend mode and vertical exaggeration -on "hillshaded" plots. - -Note that the "overlay" and "soft" blend modes work well for complex surfaces -such as this example, while the default "hsv" blend mode works best for smooth -surfaces such as many mathematical functions. - -In most cases, hillshading is used purely for visual purposes, and *dx*/*dy* -can be safely ignored. In that case, you can tweak *vert_exag* (vertical -exaggeration) by trial and error to give the desired visual effect. However, -this example demonstrates how to use the *dx* and *dy* kwargs to ensure that -the *vert_exag* parameter is the true vertical exaggeration. -""" -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.cbook import get_sample_data -from matplotlib.colors import LightSource - -dem = np.load(get_sample_data('jacksboro_fault_dem.npz')) -z = dem['elevation'] - -#-- Optional dx and dy for accurate vertical exaggeration -------------------- -# If you need topographically accurate vertical exaggeration, or you don't want -# to guess at what *vert_exag* should be, you'll need to specify the cellsize -# of the grid (i.e. the *dx* and *dy* parameters). Otherwise, any *vert_exag* -# value you specify will be relative to the grid spacing of your input data -# (in other words, *dx* and *dy* default to 1.0, and *vert_exag* is calculated -# relative to those parameters). Similarly, *dx* and *dy* are assumed to be in -# the same units as your input z-values. Therefore, we'll need to convert the -# given dx and dy from decimal degrees to meters. -dx, dy = dem['dx'], dem['dy'] -dy = 111200 * dy -dx = 111200 * dx * np.cos(np.radians(dem['ymin'])) -#----------------------------------------------------------------------------- - -# Shade from the northwest, with the sun 45 degrees from horizontal -ls = LightSource(azdeg=315, altdeg=45) -cmap = plt.cm.gist_earth - -fig, axes = plt.subplots(nrows=4, ncols=3, figsize=(8, 9)) -plt.setp(axes.flat, xticks=[], yticks=[]) - -# Vary vertical exaggeration and blend mode and plot all combinations -for col, ve in zip(axes.T, [0.1, 1, 10]): - # Show the hillshade intensity image in the first row - col[0].imshow(ls.hillshade(z, vert_exag=ve, dx=dx, dy=dy), cmap='gray') - - # Place hillshaded plots with different blend modes in the rest of the rows - for ax, mode in zip(col[1:], ['hsv', 'overlay', 'soft']): - rgb = ls.shade(z, cmap=cmap, blend_mode=mode, - vert_exag=ve, dx=dx, dy=dy) - ax.imshow(rgb) - -# Label rows and columns -for ax, ve in zip(axes[0], [0.1, 1, 10]): - ax.set_title('{0}'.format(ve), size=18) -for ax, mode in zip(axes[:, 0], ['Hillshade', 'hsv', 'overlay', 'soft']): - ax.set_ylabel(mode, size=18) - -# Group labels... -axes[0, 1].annotate('Vertical Exaggeration', (0.5, 1), xytext=(0, 30), - textcoords='offset points', xycoords='axes fraction', - ha='center', va='bottom', size=20) -axes[2, 0].annotate('Blend Mode', (0, 0.5), xytext=(-30, 0), - textcoords='offset points', xycoords='axes fraction', - ha='right', va='center', size=20, rotation=90) -fig.subplots_adjust(bottom=0.05, right=0.95) - -plt.show() diff --git a/mpl_examples/statistics/boxplot_color_demo.hires.png b/mpl_examples/statistics/boxplot_color_demo.hires.png deleted file mode 100644 index 31149ea8b54..00000000000 Binary files a/mpl_examples/statistics/boxplot_color_demo.hires.png and /dev/null differ diff --git a/mpl_examples/statistics/boxplot_color_demo.pdf b/mpl_examples/statistics/boxplot_color_demo.pdf deleted file mode 100644 index bd36a56a720..00000000000 Binary files a/mpl_examples/statistics/boxplot_color_demo.pdf and /dev/null differ diff --git a/mpl_examples/statistics/boxplot_color_demo.png b/mpl_examples/statistics/boxplot_color_demo.png deleted file mode 100644 index 7b5568fbc62..00000000000 Binary files a/mpl_examples/statistics/boxplot_color_demo.png and /dev/null differ diff --git a/mpl_examples/statistics/boxplot_color_demo.py b/mpl_examples/statistics/boxplot_color_demo.py deleted file mode 100644 index ced5b03316f..00000000000 --- a/mpl_examples/statistics/boxplot_color_demo.py +++ /dev/null @@ -1,53 +0,0 @@ -""" -================================= -Box plots with custom fill colors -================================= - -This plot illustrates how to create two types of box plots -(rectangular and notched), and how to fill them with custom -colors by accessing the properties of the artists of the -box plots. Additionally, the ``labels`` parameter is used to -provide x-tick labels for each sample. - -A good general reference on boxplots and their history can be found -here: http://vita.had.co.nz/papers/boxplots.pdf -""" - -import matplotlib.pyplot as plt -import numpy as np - -# Random test data -np.random.seed(123) -all_data = [np.random.normal(0, std, 100) for std in range(1, 4)] - -fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(9, 4)) - -# rectangular box plot -bplot1 = axes[0].boxplot(all_data, - vert=True, # vertical box aligmnent - patch_artist=True) # fill with color - -# notch shape box plot -bplot2 = axes[1].boxplot(all_data, - notch=True, # notch shape - vert=True, # vertical box aligmnent - patch_artist=True) # fill with color - -# fill with colors -colors = ['pink', 'lightblue', 'lightgreen'] -for bplot in (bplot1, bplot2): - for patch, color in zip(bplot['boxes'], colors): - patch.set_facecolor(color) - -# adding horizontal grid lines -for ax in axes: - ax.yaxis.grid(True) - ax.set_xticks([y+1 for y in range(len(all_data))], ) - ax.set_xlabel('xlabel') - ax.set_ylabel('ylabel') - -# add x-tick labels -plt.setp(axes, xticks=[y+1 for y in range(len(all_data))], - xticklabels=['x1', 'x2', 'x3', 'x4']) - -plt.show() diff --git a/mpl_examples/statistics/boxplot_demo.py b/mpl_examples/statistics/boxplot_demo.py deleted file mode 100644 index d065fd5997c..00000000000 --- a/mpl_examples/statistics/boxplot_demo.py +++ /dev/null @@ -1,93 +0,0 @@ -""" -========================================= -Demo of artist customization in box plots -========================================= - -This example demonstrates how to use the various kwargs -to fully customize box plots. The first figure demonstrates -how to remove and add individual components (note that the -mean is the only value not shown by default). The second -figure demonstrates how the styles of the artists can -be customized. It also demonstrates how to set the limit -of the whiskers to specific percentiles (lower right axes) - -A good general reference on boxplots and their history can be found -here: http://vita.had.co.nz/papers/boxplots.pdf - -""" - -import numpy as np -import matplotlib.pyplot as plt - -# fake data -np.random.seed(937) -data = np.random.lognormal(size=(37, 4), mean=1.5, sigma=1.75) -labels = list('ABCD') -fs = 10 # fontsize - -# demonstrate how to toggle the display of different elements: -fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(6, 6), sharey=True) -axes[0, 0].boxplot(data, labels=labels) -axes[0, 0].set_title('Default', fontsize=fs) - -axes[0, 1].boxplot(data, labels=labels, showmeans=True) -axes[0, 1].set_title('showmeans=True', fontsize=fs) - -axes[0, 2].boxplot(data, labels=labels, showmeans=True, meanline=True) -axes[0, 2].set_title('showmeans=True,\nmeanline=True', fontsize=fs) - -axes[1, 0].boxplot(data, labels=labels, showbox=False, showcaps=False) -tufte_title = 'Tufte Style \n(showbox=False,\nshowcaps=False)' -axes[1, 0].set_title(tufte_title, fontsize=fs) - -axes[1, 1].boxplot(data, labels=labels, notch=True, bootstrap=10000) -axes[1, 1].set_title('notch=True,\nbootstrap=10000', fontsize=fs) - -axes[1, 2].boxplot(data, labels=labels, showfliers=False) -axes[1, 2].set_title('showfliers=False', fontsize=fs) - -for ax in axes.flatten(): - ax.set_yscale('log') - ax.set_yticklabels([]) - -fig.subplots_adjust(hspace=0.4) -plt.show() - - -# demonstrate how to customize the display different elements: -boxprops = dict(linestyle='--', linewidth=3, color='darkgoldenrod') -flierprops = dict(marker='o', markerfacecolor='green', markersize=12, - linestyle='none') -medianprops = dict(linestyle='-.', linewidth=2.5, color='firebrick') -meanpointprops = dict(marker='D', markeredgecolor='black', - markerfacecolor='firebrick') -meanlineprops = dict(linestyle='--', linewidth=2.5, color='purple') - -fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(6, 6), sharey=True) -axes[0, 0].boxplot(data, boxprops=boxprops) -axes[0, 0].set_title('Custom boxprops', fontsize=fs) - -axes[0, 1].boxplot(data, flierprops=flierprops, medianprops=medianprops) -axes[0, 1].set_title('Custom medianprops\nand flierprops', fontsize=fs) - -axes[0, 2].boxplot(data, whis='range') -axes[0, 2].set_title('whis="range"', fontsize=fs) - -axes[1, 0].boxplot(data, meanprops=meanpointprops, meanline=False, - showmeans=True) -axes[1, 0].set_title('Custom mean\nas point', fontsize=fs) - -axes[1, 1].boxplot(data, meanprops=meanlineprops, meanline=True, - showmeans=True) -axes[1, 1].set_title('Custom mean\nas line', fontsize=fs) - -axes[1, 2].boxplot(data, whis=[15, 85]) -axes[1, 2].set_title('whis=[15, 85]\n#percentiles', fontsize=fs) - -for ax in axes.flatten(): - ax.set_yscale('log') - ax.set_yticklabels([]) - -fig.suptitle("I never said they'd be pretty") -fig.subplots_adjust(hspace=0.4) -plt.show() diff --git a/mpl_examples/statistics/boxplot_demo_00_00.hires.png b/mpl_examples/statistics/boxplot_demo_00_00.hires.png deleted file mode 100644 index 726fb4cc118..00000000000 Binary files a/mpl_examples/statistics/boxplot_demo_00_00.hires.png and /dev/null differ diff --git a/mpl_examples/statistics/boxplot_demo_00_00.pdf b/mpl_examples/statistics/boxplot_demo_00_00.pdf deleted file mode 100644 index b9a88e92913..00000000000 Binary files a/mpl_examples/statistics/boxplot_demo_00_00.pdf and /dev/null differ diff --git a/mpl_examples/statistics/boxplot_demo_00_00.png b/mpl_examples/statistics/boxplot_demo_00_00.png deleted file mode 100644 index 7d7b66eb9bb..00000000000 Binary files a/mpl_examples/statistics/boxplot_demo_00_00.png and /dev/null differ diff --git a/mpl_examples/statistics/boxplot_demo_01_00.hires.png b/mpl_examples/statistics/boxplot_demo_01_00.hires.png deleted file mode 100644 index 17c3a905e82..00000000000 Binary files a/mpl_examples/statistics/boxplot_demo_01_00.hires.png and /dev/null differ diff --git a/mpl_examples/statistics/boxplot_demo_01_00.pdf b/mpl_examples/statistics/boxplot_demo_01_00.pdf deleted file mode 100644 index 41ff34d42f5..00000000000 Binary files a/mpl_examples/statistics/boxplot_demo_01_00.pdf and /dev/null differ diff --git a/mpl_examples/statistics/boxplot_demo_01_00.png b/mpl_examples/statistics/boxplot_demo_01_00.png deleted file mode 100644 index 6d53f972110..00000000000 Binary files a/mpl_examples/statistics/boxplot_demo_01_00.png and /dev/null differ diff --git a/mpl_examples/statistics/boxplot_vs_violin_demo.hires.png b/mpl_examples/statistics/boxplot_vs_violin_demo.hires.png deleted file mode 100644 index 5cd07c7fddd..00000000000 Binary files a/mpl_examples/statistics/boxplot_vs_violin_demo.hires.png and /dev/null differ diff --git a/mpl_examples/statistics/boxplot_vs_violin_demo.pdf b/mpl_examples/statistics/boxplot_vs_violin_demo.pdf deleted file mode 100644 index 7488cabade8..00000000000 Binary files a/mpl_examples/statistics/boxplot_vs_violin_demo.pdf and /dev/null differ diff --git a/mpl_examples/statistics/boxplot_vs_violin_demo.png b/mpl_examples/statistics/boxplot_vs_violin_demo.png deleted file mode 100644 index 495489bd78b..00000000000 Binary files a/mpl_examples/statistics/boxplot_vs_violin_demo.png and /dev/null differ diff --git a/mpl_examples/statistics/boxplot_vs_violin_demo.py b/mpl_examples/statistics/boxplot_vs_violin_demo.py deleted file mode 100644 index bc1100e51a5..00000000000 --- a/mpl_examples/statistics/boxplot_vs_violin_demo.py +++ /dev/null @@ -1,51 +0,0 @@ -""" -=================================== -Box plot vs. violin plot comparison -=================================== - -Note that although violin plots are closely related to Tukey's (1977) -box plots, they add useful information such as the distribution of the -sample data (density trace). - -By default, box plots show data points outside 1.5 * the inter-quartile -range as outliers above or below the whiskers whereas violin plots show -the whole range of the data. - -A good general reference on boxplots and their history can be found -here: http://vita.had.co.nz/papers/boxplots.pdf - -Violin plots require matplotlib >= 1.4. - -For more information on violin plots, the scikit-learn docs have a great -section: http://scikit-learn.org/stable/modules/density.html -""" - -import matplotlib.pyplot as plt -import numpy as np - -fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(9, 4)) - -# generate some random test data -all_data = [np.random.normal(0, std, 100) for std in range(6, 10)] - -# plot violin plot -axes[0].violinplot(all_data, - showmeans=False, - showmedians=True) -axes[0].set_title('violin plot') - -# plot box plot -axes[1].boxplot(all_data) -axes[1].set_title('box plot') - -# adding horizontal grid lines -for ax in axes: - ax.yaxis.grid(True) - ax.set_xticks([y+1 for y in range(len(all_data))]) - ax.set_xlabel('xlabel') - ax.set_ylabel('ylabel') - -# add x-tick labels -plt.setp(axes, xticks=[y+1 for y in range(len(all_data))], - xticklabels=['x1', 'x2', 'x3', 'x4']) -plt.show() diff --git a/mpl_examples/statistics/bxp_demo.py b/mpl_examples/statistics/bxp_demo.py deleted file mode 100644 index 90d8b4c4e39..00000000000 --- a/mpl_examples/statistics/bxp_demo.py +++ /dev/null @@ -1,97 +0,0 @@ -""" -=================================== -Demo of the boxplot drawer function -=================================== - -This example demonstrates how to pass pre-computed box plot -statistics to the box plot drawer. The first figure demonstrates -how to remove and add individual components (note that the -mean is the only value not shown by default). The second -figure demonstrates how the styles of the artists can -be customized. - -A good general reference on boxplots and their history can be found -here: http://vita.had.co.nz/papers/boxplots.pdf -""" - -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.cbook as cbook - -# fake data -np.random.seed(937) -data = np.random.lognormal(size=(37, 4), mean=1.5, sigma=1.75) -labels = list('ABCD') - -# compute the boxplot stats -stats = cbook.boxplot_stats(data, labels=labels, bootstrap=10000) -# After we've computed the stats, we can go through and change anything. -# Just to prove it, I'll set the median of each set to the median of all -# the data, and double the means -for n in range(len(stats)): - stats[n]['med'] = np.median(data) - stats[n]['mean'] *= 2 - -print(stats[0].keys()) - -fs = 10 # fontsize - -# demonstrate how to toggle the display of different elements: -fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(6, 6), sharey=True) -axes[0, 0].bxp(stats) -axes[0, 0].set_title('Default', fontsize=fs) - -axes[0, 1].bxp(stats, showmeans=True) -axes[0, 1].set_title('showmeans=True', fontsize=fs) - -axes[0, 2].bxp(stats, showmeans=True, meanline=True) -axes[0, 2].set_title('showmeans=True,\nmeanline=True', fontsize=fs) - -axes[1, 0].bxp(stats, showbox=False, showcaps=False) -tufte_title = 'Tufte Style\n(showbox=False,\nshowcaps=False)' -axes[1, 0].set_title(tufte_title, fontsize=fs) - -axes[1, 1].bxp(stats, shownotches=True) -axes[1, 1].set_title('notch=True', fontsize=fs) - -axes[1, 2].bxp(stats, showfliers=False) -axes[1, 2].set_title('showfliers=False', fontsize=fs) - -for ax in axes.flatten(): - ax.set_yscale('log') - ax.set_yticklabels([]) - -fig.subplots_adjust(hspace=0.4) -plt.show() - -# demonstrate how to customize the display different elements: -boxprops = dict(linestyle='--', linewidth=3, color='darkgoldenrod') -flierprops = dict(marker='o', markerfacecolor='green', markersize=12, - linestyle='none') -medianprops = dict(linestyle='-.', linewidth=2.5, color='firebrick') -meanpointprops = dict(marker='D', markeredgecolor='black', - markerfacecolor='firebrick') -meanlineprops = dict(linestyle='--', linewidth=2.5, color='purple') - -fig, axes = plt.subplots(nrows=2, ncols=2, figsize=(6, 6), sharey=True) -axes[0, 0].bxp(stats, boxprops=boxprops) -axes[0, 0].set_title('Custom boxprops', fontsize=fs) - -axes[0, 1].bxp(stats, flierprops=flierprops, medianprops=medianprops) -axes[0, 1].set_title('Custom medianprops\nand flierprops', fontsize=fs) - -axes[1, 0].bxp(stats, meanprops=meanpointprops, meanline=False, - showmeans=True) -axes[1, 0].set_title('Custom mean\nas point', fontsize=fs) - -axes[1, 1].bxp(stats, meanprops=meanlineprops, meanline=True, - showmeans=True) -axes[1, 1].set_title('Custom mean\nas line', fontsize=fs) - -for ax in axes.flatten(): - ax.set_yscale('log') - ax.set_yticklabels([]) - -fig.suptitle("I never said they'd be pretty") -fig.subplots_adjust(hspace=0.4) -plt.show() diff --git a/mpl_examples/statistics/bxp_demo_00_00.hires.png b/mpl_examples/statistics/bxp_demo_00_00.hires.png deleted file mode 100644 index 2651ae3bf27..00000000000 Binary files a/mpl_examples/statistics/bxp_demo_00_00.hires.png and /dev/null differ diff --git a/mpl_examples/statistics/bxp_demo_00_00.pdf b/mpl_examples/statistics/bxp_demo_00_00.pdf deleted file mode 100644 index ee1b4a515bf..00000000000 Binary files a/mpl_examples/statistics/bxp_demo_00_00.pdf and /dev/null differ diff --git a/mpl_examples/statistics/bxp_demo_00_00.png b/mpl_examples/statistics/bxp_demo_00_00.png deleted file mode 100644 index 9b07e4ba31b..00000000000 Binary files a/mpl_examples/statistics/bxp_demo_00_00.png and /dev/null differ diff --git a/mpl_examples/statistics/bxp_demo_01_00.hires.png b/mpl_examples/statistics/bxp_demo_01_00.hires.png deleted file mode 100644 index 89ac6d96156..00000000000 Binary files a/mpl_examples/statistics/bxp_demo_01_00.hires.png and /dev/null differ diff --git a/mpl_examples/statistics/bxp_demo_01_00.pdf b/mpl_examples/statistics/bxp_demo_01_00.pdf deleted file mode 100644 index abd8c64c5c1..00000000000 Binary files a/mpl_examples/statistics/bxp_demo_01_00.pdf and /dev/null differ diff --git a/mpl_examples/statistics/bxp_demo_01_00.png b/mpl_examples/statistics/bxp_demo_01_00.png deleted file mode 100644 index 3e9d019ed4b..00000000000 Binary files a/mpl_examples/statistics/bxp_demo_01_00.png and /dev/null differ diff --git a/mpl_examples/statistics/customized_violin_demo.pdf b/mpl_examples/statistics/customized_violin_demo.pdf deleted file mode 100644 index a093132c599..00000000000 Binary files a/mpl_examples/statistics/customized_violin_demo.pdf and /dev/null differ diff --git a/mpl_examples/statistics/customized_violin_demo.png b/mpl_examples/statistics/customized_violin_demo.png deleted file mode 100644 index a6f3c35ff6f..00000000000 Binary files a/mpl_examples/statistics/customized_violin_demo.png and /dev/null differ diff --git a/mpl_examples/statistics/customized_violin_demo.py b/mpl_examples/statistics/customized_violin_demo.py deleted file mode 100644 index e37a034400d..00000000000 --- a/mpl_examples/statistics/customized_violin_demo.py +++ /dev/null @@ -1,76 +0,0 @@ -""" -================================= -Demo of violin plot customization -================================= - -This example demonstrates how to fully customize violin plots. -The first plot shows the default style by providing only -the data. The second plot first limits what matplotlib draws -with additional kwargs. Then a simplified representation of -a box plot is drawn on top. Lastly, the styles of the artists -of the violins are modified. - -For more information on violin plots, the scikit-learn docs have a great -section: http://scikit-learn.org/stable/modules/density.html -""" - -import matplotlib.pyplot as plt -import numpy as np - - -def adjacent_values(vals, q1, q3): - upper_adjacent_value = q3 + (q3 - q1) * 1.5 - upper_adjacent_value = np.clip(upper_adjacent_value, q3, vals[-1]) - - lower_adjacent_value = q1 - (q3 - q1) * 1.5 - lower_adjacent_value = np.clip(lower_adjacent_value, vals[0], q1) - return lower_adjacent_value, upper_adjacent_value - - -def set_axis_style(ax, labels): - ax.get_xaxis().set_tick_params(direction='out') - ax.xaxis.set_ticks_position('bottom') - ax.set_xticks(np.arange(1, len(labels) + 1)) - ax.set_xticklabels(labels) - ax.set_xlim(0.25, len(labels) + 0.75) - ax.set_xlabel('Sample name') - - -# create test data -np.random.seed(123) -data = [sorted(np.random.normal(0, std, 100)) for std in range(1, 5)] - -fig, (ax1, ax2) = plt.subplots(nrows=1, ncols=2, figsize=(9, 4), sharey=True) - -ax1.set_title('Default violin plot') -ax1.set_ylabel('Observed values') -ax1.violinplot(data) - -ax2.set_title('Customized violin plot') -parts = ax2.violinplot( - data, showmeans=False, showmedians=False, - showextrema=False) - -for pc in parts['bodies']: - pc.set_facecolor('#D43F3A') - pc.set_edgecolor('black') - pc.set_alpha(1) - -quartile1, medians, quartile3 = np.percentile(data, [25, 50, 75], axis=1) -whiskers = np.array([ - adjacent_values(sorted_array, q1, q3) - for sorted_array, q1, q3 in zip(data, quartile1, quartile3)]) -whiskersMin, whiskersMax = whiskers[:, 0], whiskers[:, 1] - -inds = np.arange(1, len(medians) + 1) -ax2.scatter(inds, medians, marker='o', color='white', s=30, zorder=3) -ax2.vlines(inds, quartile1, quartile3, color='k', linestyle='-', lw=5) -ax2.vlines(inds, whiskersMin, whiskersMax, color='k', linestyle='-', lw=1) - -# set style for the axes -labels = ['A', 'B', 'C', 'D'] -for ax in [ax1, ax2]: - set_axis_style(ax, labels) - -plt.subplots_adjust(bottom=0.15, wspace=0.05) -plt.show() diff --git a/mpl_examples/statistics/errorbar_demo.hires.png b/mpl_examples/statistics/errorbar_demo.hires.png deleted file mode 100644 index cbf0c81f342..00000000000 Binary files a/mpl_examples/statistics/errorbar_demo.hires.png and /dev/null differ diff --git a/mpl_examples/statistics/errorbar_demo.pdf b/mpl_examples/statistics/errorbar_demo.pdf deleted file mode 100644 index 756aae1c92c..00000000000 Binary files a/mpl_examples/statistics/errorbar_demo.pdf and /dev/null differ diff --git a/mpl_examples/statistics/errorbar_demo.png b/mpl_examples/statistics/errorbar_demo.png deleted file mode 100644 index 7522f385cde..00000000000 Binary files a/mpl_examples/statistics/errorbar_demo.png and /dev/null differ diff --git a/mpl_examples/statistics/errorbar_demo.py b/mpl_examples/statistics/errorbar_demo.py deleted file mode 100644 index 540cec3ab9b..00000000000 --- a/mpl_examples/statistics/errorbar_demo.py +++ /dev/null @@ -1,20 +0,0 @@ -""" -============================= -Demo of the errorbar function -============================= - -This exhibits the most basic use of the error bar method. -In this case, constant values are provided for the error -in both the x- and y-directions. -""" - -import numpy as np -import matplotlib.pyplot as plt - -# example data -x = np.arange(0.1, 4, 0.5) -y = np.exp(-x) - -fig, ax = plt.subplots() -ax.errorbar(x, y, xerr=0.2, yerr=0.4) -plt.show() diff --git a/mpl_examples/statistics/errorbar_demo_features.hires.png b/mpl_examples/statistics/errorbar_demo_features.hires.png deleted file mode 100644 index 10954d150bc..00000000000 Binary files a/mpl_examples/statistics/errorbar_demo_features.hires.png and /dev/null differ diff --git a/mpl_examples/statistics/errorbar_demo_features.pdf b/mpl_examples/statistics/errorbar_demo_features.pdf deleted file mode 100644 index 52fac95969e..00000000000 Binary files a/mpl_examples/statistics/errorbar_demo_features.pdf and /dev/null differ diff --git a/mpl_examples/statistics/errorbar_demo_features.png b/mpl_examples/statistics/errorbar_demo_features.png deleted file mode 100644 index 743840b6ac2..00000000000 Binary files a/mpl_examples/statistics/errorbar_demo_features.png and /dev/null differ diff --git a/mpl_examples/statistics/errorbar_demo_features.py b/mpl_examples/statistics/errorbar_demo_features.py deleted file mode 100644 index dfe8f68b552..00000000000 --- a/mpl_examples/statistics/errorbar_demo_features.py +++ /dev/null @@ -1,47 +0,0 @@ -""" -=================================================== -Demo of the different ways of specifying error bars -=================================================== - -Errors can be specified as a constant value (as shown in -`errorbar_demo.py`). However, this example demonstrates -how they vary by specifying arrays of error values. - -If the raw ``x`` and ``y`` data have length N, there are two options: - -Array of shape (N,): - Error varies for each point, but the error values are - symmetric (i.e. the lower and upper values are equal). - -Array of shape (2, N): - Error varies for each point, and the lower and upper limits - (in that order) are different (asymmetric case) - -In addition, this example demonstrates how to use log -scale with error bars. -""" - -import numpy as np -import matplotlib.pyplot as plt - -# example data -x = np.arange(0.1, 4, 0.5) -y = np.exp(-x) - -# example error bar values that vary with x-position -error = 0.1 + 0.2 * x - -fig, (ax0, ax1) = plt.subplots(nrows=2, sharex=True) -ax0.errorbar(x, y, yerr=error, fmt='-o') -ax0.set_title('variable, symmetric error') - -# error bar values w/ different -/+ errors that -# also vary with the x-position -lower_error = 0.4 * error -upper_error = error -asymmetric_error = [lower_error, upper_error] - -ax1.errorbar(x, y, xerr=asymmetric_error, fmt='o') -ax1.set_title('variable, asymmetric error') -ax1.set_yscale('log') -plt.show() diff --git a/mpl_examples/statistics/errorbar_limits.hires.png b/mpl_examples/statistics/errorbar_limits.hires.png deleted file mode 100644 index d4091127726..00000000000 Binary files a/mpl_examples/statistics/errorbar_limits.hires.png and /dev/null differ diff --git a/mpl_examples/statistics/errorbar_limits.pdf b/mpl_examples/statistics/errorbar_limits.pdf deleted file mode 100644 index c579df04f1e..00000000000 Binary files a/mpl_examples/statistics/errorbar_limits.pdf and /dev/null differ diff --git a/mpl_examples/statistics/errorbar_limits.png b/mpl_examples/statistics/errorbar_limits.png deleted file mode 100644 index 523d9e374a0..00000000000 Binary files a/mpl_examples/statistics/errorbar_limits.png and /dev/null differ diff --git a/mpl_examples/statistics/errorbar_limits.py b/mpl_examples/statistics/errorbar_limits.py deleted file mode 100644 index a765445598f..00000000000 --- a/mpl_examples/statistics/errorbar_limits.py +++ /dev/null @@ -1,76 +0,0 @@ -""" -=========================================================== -Demo of how to include upper and lower limits in error bars -=========================================================== - -In matplotlib, errors bars can have "limits". Applying limits to the -error bars essentially makes the error unidirectional. Because of that, -upper and lower limits can be applied in both the y- and x-directions -via the ``uplims``, ``lolims``, ``xuplims``, and ``xlolims`` parameters, -respectively. These parameters can be scalar or boolean arrays. - -For example, if ``xlolims`` is ``True``, the x-error bars will only -extend from the data towards increasing values. If ``uplims`` is an -array filled with ``False`` except for the 4th and 7th values, all of the -y-error bars will be bidirectional, except the 4th and 7th bars, which -will extend from the data towards decreasing y-values. -""" - -import numpy as np -import matplotlib.pyplot as plt - -# example data -x = np.array([0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0]) -y = np.exp(-x) -xerr = 0.1 -yerr = 0.2 - -# lower & upper limits of the error -lolims = np.array([0, 0, 1, 0, 1, 0, 0, 0, 1, 0], dtype=bool) -uplims = np.array([0, 1, 0, 0, 0, 1, 0, 0, 0, 1], dtype=bool) -ls = 'dotted' - -fig, ax = plt.subplots(figsize=(7, 4)) - -# standard error bars -ax.errorbar(x, y, xerr=xerr, yerr=yerr, linestyle=ls) - -# including upper limits -ax.errorbar(x, y + 0.5, xerr=xerr, yerr=yerr, uplims=uplims, - linestyle=ls) - -# including lower limits -ax.errorbar(x, y + 1.0, xerr=xerr, yerr=yerr, lolims=lolims, - linestyle=ls) - -# including upper and lower limits -ax.errorbar(x, y + 1.5, xerr=xerr, yerr=yerr, - lolims=lolims, uplims=uplims, - marker='o', markersize=8, - linestyle=ls) - -# Plot a series with lower and upper limits in both x & y -# constant x-error with varying y-error -xerr = 0.2 -yerr = np.zeros(x.shape) + 0.2 -yerr[[3, 6]] = 0.3 - -# mock up some limits by modifying previous data -xlolims = lolims -xuplims = uplims -lolims = np.zeros(x.shape) -uplims = np.zeros(x.shape) -lolims[[6]] = True # only limited at this index -uplims[[3]] = True # only limited at this index - -# do the plotting -ax.errorbar(x, y + 2.1, xerr=xerr, yerr=yerr, - xlolims=xlolims, xuplims=xuplims, - uplims=uplims, lolims=lolims, - marker='o', markersize=8, - linestyle='none') - -# tidy up the figure -ax.set_xlim((0, 5.5)) -ax.set_title('Errorbar upper and lower limits') -plt.show() diff --git a/mpl_examples/statistics/errorbars_and_boxes.pdf b/mpl_examples/statistics/errorbars_and_boxes.pdf deleted file mode 100644 index 168561c6425..00000000000 Binary files a/mpl_examples/statistics/errorbars_and_boxes.pdf and /dev/null differ diff --git a/mpl_examples/statistics/errorbars_and_boxes.png b/mpl_examples/statistics/errorbars_and_boxes.png deleted file mode 100644 index 90ab98f842b..00000000000 Binary files a/mpl_examples/statistics/errorbars_and_boxes.png and /dev/null differ diff --git a/mpl_examples/statistics/errorbars_and_boxes.py b/mpl_examples/statistics/errorbars_and_boxes.py deleted file mode 100644 index 113e299be23..00000000000 --- a/mpl_examples/statistics/errorbars_and_boxes.py +++ /dev/null @@ -1,73 +0,0 @@ -""" -============================================================ -Demo on creating boxes from error bars using PatchCollection -============================================================ - -In this example, we snazz up a pretty standard error bar plot by adding -a rectangle patch defined by the limits of the bars in both the x- and -y- directions. To do this, we have to write our own custom function -called ``make_error_boxes``. Close inspection of this function will -reveal the preferred pattern in writing functions for matplotlib: - - 1. an ``Axes`` object is passed directly to the function - 2. the function operates on the `Axes` methods directly, not through - the ``pyplot`` interface - 3. plotting kwargs that could be abbreviated are spelled out for - better code readability in the future (for example we use - ``facecolor`` instead of ``fc``) - 4. the artists returned by the ``Axes`` plotting methods are then - returned by the function so that, if desired, their styles - can be modified later outside of the function (they are not - modified in this example). -""" - -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.collections import PatchCollection -from matplotlib.patches import Rectangle - -# Number of data points -n = 5 - -# Dummy data -np.random.seed(10) -x = np.arange(0, n, 1) -y = np.random.rand(n) * 5. - -# Dummy errors (above and below) -xerr = np.random.rand(2, n) + 0.1 -yerr = np.random.rand(2, n) + 0.2 - - -def make_error_boxes(ax, xdata, ydata, xerror, yerror, facecolor='r', - edgecolor='None', alpha=0.5): - - # Create list for all the error patches - errorboxes = [] - - # Loop over data points; create box from errors at each point - for x, y, xe, ye in zip(xdata, ydata, xerror.T, yerror.T): - rect = Rectangle((x - xe[0], y - ye[0]), xe.sum(), ye.sum()) - errorboxes.append(rect) - - # Create patch collection with specified colour/alpha - pc = PatchCollection(errorboxes, facecolor=facecolor, alpha=alpha, - edgecolor=edgecolor) - - # Add collection to axes - ax.add_collection(pc) - - # Plot errorbars - artists = ax.errorbar(xdata, ydata, xerr=xerror, yerr=yerror, - fmt='None', ecolor='k') - - return artists - - -# Create figure and axes -fig, ax = plt.subplots(1) - -# Call function to create error boxes -_ = make_error_boxes(ax, x, y, xerr, yerr) - -plt.show() diff --git a/mpl_examples/statistics/histogram_demo_cumulative.hires.png b/mpl_examples/statistics/histogram_demo_cumulative.hires.png deleted file mode 100644 index a44447e4415..00000000000 Binary files a/mpl_examples/statistics/histogram_demo_cumulative.hires.png and /dev/null differ diff --git a/mpl_examples/statistics/histogram_demo_cumulative.pdf b/mpl_examples/statistics/histogram_demo_cumulative.pdf deleted file mode 100644 index 2f43a32fdd4..00000000000 Binary files a/mpl_examples/statistics/histogram_demo_cumulative.pdf and /dev/null differ diff --git a/mpl_examples/statistics/histogram_demo_cumulative.png b/mpl_examples/statistics/histogram_demo_cumulative.png deleted file mode 100644 index ad97f03a896..00000000000 Binary files a/mpl_examples/statistics/histogram_demo_cumulative.png and /dev/null differ diff --git a/mpl_examples/statistics/histogram_demo_cumulative.py b/mpl_examples/statistics/histogram_demo_cumulative.py deleted file mode 100644 index 1e8f76cff8a..00000000000 --- a/mpl_examples/statistics/histogram_demo_cumulative.py +++ /dev/null @@ -1,72 +0,0 @@ -""" -========================================================== -Demo of using histograms to plot a cumulative distribution -========================================================== - -This shows how to plot a cumulative, normalized histogram as a -step function in order to visualize the empirical cumulative -distribution function (CDF) of a sample. We also use the ``mlab`` -module to show the theoretical CDF. - -A couple of other options to the ``hist`` function are demonstrated. -Namely, we use the ``normed`` parameter to normalize the histogram and -a couple of different options to the ``cumulative`` parameter. -The ``normed`` parameter takes a boolean value. When ``True``, the bin -heights are scaled such that the total area of the histogram is 1. The -``cumulative`` kwarg is a little more nuanced. Like ``normed``, you -can pass it True or False, but you can also pass it -1 to reverse the -distribution. - -Since we're showing a normalized and cumulative histogram, these curves -are effectively the cumulative distribution functions (CDFs) of the -samples. In engineering, empirical CDFs are sometimes called -"non-exceedance" curves. In other words, you can look at the -y-value for a given-x-value to get the probability of and observation -from the sample not exceeding that x-value. For example, the value of -225 on the x-axis corresponds to about 0.85 on the y-axis, so there's an -85% chance that an observation in the sample does not exceed 225. -Conversely, setting, ``cumulative`` to -1 as is done in the -last series for this example, creates a "exceedance" curve. - -Selecting different bin counts and sizes can significantly affect the -shape of a histogram. The Astropy docs have a great section on how to -select these parameters: -http://docs.astropy.org/en/stable/visualization/histogram.html - -""" - -import numpy as np -import matplotlib.pyplot as plt -from matplotlib import mlab - -np.random.seed(0) - -mu = 200 -sigma = 25 -n_bins = 50 -x = np.random.normal(mu, sigma, size=100) - -fig, ax = plt.subplots(figsize=(8, 4)) - -# plot the cumulative histogram -n, bins, patches = ax.hist(x, n_bins, normed=1, histtype='step', - cumulative=True, label='Empirical') - -# Add a line showing the expected distribution. -y = mlab.normpdf(bins, mu, sigma).cumsum() -y /= y[-1] - -ax.plot(bins, y, 'k--', linewidth=1.5, label='Theoretical') - -# Overlay a reversed cumulative histogram. -ax.hist(x, bins=bins, normed=1, histtype='step', cumulative=-1, - label='Reversed emp.') - -# tidy up the figure -ax.grid(True) -ax.legend(loc='right') -ax.set_title('Cumulative step histograms') -ax.set_xlabel('Annual rainfall (mm)') -ax.set_ylabel('Likelihood of occurrence') - -plt.show() diff --git a/mpl_examples/statistics/histogram_demo_features.hires.png b/mpl_examples/statistics/histogram_demo_features.hires.png deleted file mode 100644 index bb3869685fe..00000000000 Binary files a/mpl_examples/statistics/histogram_demo_features.hires.png and /dev/null differ diff --git a/mpl_examples/statistics/histogram_demo_features.pdf b/mpl_examples/statistics/histogram_demo_features.pdf deleted file mode 100644 index 1909776414b..00000000000 Binary files a/mpl_examples/statistics/histogram_demo_features.pdf and /dev/null differ diff --git a/mpl_examples/statistics/histogram_demo_features.png b/mpl_examples/statistics/histogram_demo_features.png deleted file mode 100644 index 2994394d196..00000000000 Binary files a/mpl_examples/statistics/histogram_demo_features.png and /dev/null differ diff --git a/mpl_examples/statistics/histogram_demo_features.py b/mpl_examples/statistics/histogram_demo_features.py deleted file mode 100644 index c662f36ac5e..00000000000 --- a/mpl_examples/statistics/histogram_demo_features.py +++ /dev/null @@ -1,49 +0,0 @@ -""" -========================================================= -Demo of the histogram (hist) function with a few features -========================================================= - -In addition to the basic histogram, this demo shows a few optional -features: - - * Setting the number of data bins - * The ``normed`` flag, which normalizes bin heights so that the - integral of the histogram is 1. The resulting histogram is an - approximation of the probability density function. - * Setting the face color of the bars - * Setting the opacity (alpha value). - -Selecting different bin counts and sizes can significantly affect the -shape of a histogram. The Astropy docs have a great section on how to -select these parameters: -http://docs.astropy.org/en/stable/visualization/histogram.html -""" - -import numpy as np -import matplotlib.mlab as mlab -import matplotlib.pyplot as plt - -np.random.seed(0) - -# example data -mu = 100 # mean of distribution -sigma = 15 # standard deviation of distribution -x = mu + sigma * np.random.randn(437) - -num_bins = 50 - -fig, ax = plt.subplots() - -# the histogram of the data -n, bins, patches = ax.hist(x, num_bins, normed=1) - -# add a 'best fit' line -y = mlab.normpdf(bins, mu, sigma) -ax.plot(bins, y, '--') -ax.set_xlabel('Smarts') -ax.set_ylabel('Probability density') -ax.set_title(r'Histogram of IQ: $\mu=100$, $\sigma=15$') - -# Tweak spacing to prevent clipping of ylabel -fig.tight_layout() -plt.show() diff --git a/mpl_examples/statistics/histogram_demo_histtypes.hires.png b/mpl_examples/statistics/histogram_demo_histtypes.hires.png deleted file mode 100644 index 7d7adf70e50..00000000000 Binary files a/mpl_examples/statistics/histogram_demo_histtypes.hires.png and /dev/null differ diff --git a/mpl_examples/statistics/histogram_demo_histtypes.pdf b/mpl_examples/statistics/histogram_demo_histtypes.pdf deleted file mode 100644 index 15fbf9bd0a0..00000000000 Binary files a/mpl_examples/statistics/histogram_demo_histtypes.pdf and /dev/null differ diff --git a/mpl_examples/statistics/histogram_demo_histtypes.png b/mpl_examples/statistics/histogram_demo_histtypes.png deleted file mode 100644 index ebe03ff0d0f..00000000000 Binary files a/mpl_examples/statistics/histogram_demo_histtypes.png and /dev/null differ diff --git a/mpl_examples/statistics/histogram_demo_histtypes.py b/mpl_examples/statistics/histogram_demo_histtypes.py deleted file mode 100644 index 5a6f9fe08a8..00000000000 --- a/mpl_examples/statistics/histogram_demo_histtypes.py +++ /dev/null @@ -1,35 +0,0 @@ -""" -================================================================ -Demo of the histogram function's different ``histtype`` settings -================================================================ - -* Histogram with step curve that has a color fill. -* Histogram with custom and unequal bin widths. - -Selecting different bin counts and sizes can significantly affect the -shape of a histogram. The Astropy docs have a great section on how to -select these parameters: -http://docs.astropy.org/en/stable/visualization/histogram.html -""" - -import numpy as np -import matplotlib.pyplot as plt - -np.random.seed(0) - -mu = 200 -sigma = 25 -x = np.random.normal(mu, sigma, size=100) - -fig, (ax0, ax1) = plt.subplots(ncols=2, figsize=(8, 4)) - -ax0.hist(x, 20, normed=1, histtype='stepfilled', facecolor='g', alpha=0.75) -ax0.set_title('stepfilled') - -# Create a histogram by providing the bin edges (unequally spaced). -bins = [100, 150, 180, 195, 205, 220, 250, 300] -ax1.hist(x, bins, normed=1, histtype='bar', rwidth=0.8) -ax1.set_title('unequal bins') - -fig.tight_layout() -plt.show() diff --git a/mpl_examples/statistics/histogram_demo_multihist.hires.png b/mpl_examples/statistics/histogram_demo_multihist.hires.png deleted file mode 100644 index a1851068f22..00000000000 Binary files a/mpl_examples/statistics/histogram_demo_multihist.hires.png and /dev/null differ diff --git a/mpl_examples/statistics/histogram_demo_multihist.pdf b/mpl_examples/statistics/histogram_demo_multihist.pdf deleted file mode 100644 index 8426ac4bda8..00000000000 Binary files a/mpl_examples/statistics/histogram_demo_multihist.pdf and /dev/null differ diff --git a/mpl_examples/statistics/histogram_demo_multihist.png b/mpl_examples/statistics/histogram_demo_multihist.png deleted file mode 100644 index 28bc7a49db3..00000000000 Binary files a/mpl_examples/statistics/histogram_demo_multihist.png and /dev/null differ diff --git a/mpl_examples/statistics/histogram_demo_multihist.py b/mpl_examples/statistics/histogram_demo_multihist.py deleted file mode 100644 index 04619cd670e..00000000000 --- a/mpl_examples/statistics/histogram_demo_multihist.py +++ /dev/null @@ -1,47 +0,0 @@ -""" -============================================================= -Demo of the histogram (hist) function with multiple data sets -============================================================= - -Plot histogram with multiple sample sets and demonstrate: - - * Use of legend with multiple sample sets - * Stacked bars - * Step curve with no fill - * Data sets of different sample sizes - -Selecting different bin counts and sizes can significantly affect the -shape of a histogram. The Astropy docs have a great section on how to -select these parameters: -http://docs.astropy.org/en/stable/visualization/histogram.html -""" - -import numpy as np -import matplotlib.pyplot as plt - -np.random.seed(0) - -n_bins = 10 -x = np.random.randn(1000, 3) - -fig, axes = plt.subplots(nrows=2, ncols=2) -ax0, ax1, ax2, ax3 = axes.flatten() - -colors = ['red', 'tan', 'lime'] -ax0.hist(x, n_bins, normed=1, histtype='bar', color=colors, label=colors) -ax0.legend(prop={'size': 10}) -ax0.set_title('bars with legend') - -ax1.hist(x, n_bins, normed=1, histtype='bar', stacked=True) -ax1.set_title('stacked bar') - -ax2.hist(x, n_bins, histtype='step', stacked=True, fill=False) -ax2.set_title('stack step (unfilled)') - -# Make a multiple-histogram of data-sets with different length. -x_multi = [np.random.randn(n) for n in [10000, 5000, 2000]] -ax3.hist(x_multi, n_bins, histtype='bar') -ax3.set_title('different sample sizes') - -fig.tight_layout() -plt.show() diff --git a/mpl_examples/statistics/multiple_histograms_side_by_side.hires.png b/mpl_examples/statistics/multiple_histograms_side_by_side.hires.png deleted file mode 100644 index 1da4e7998a1..00000000000 Binary files a/mpl_examples/statistics/multiple_histograms_side_by_side.hires.png and /dev/null differ diff --git a/mpl_examples/statistics/multiple_histograms_side_by_side.pdf b/mpl_examples/statistics/multiple_histograms_side_by_side.pdf deleted file mode 100644 index 101445f2df0..00000000000 Binary files a/mpl_examples/statistics/multiple_histograms_side_by_side.pdf and /dev/null differ diff --git a/mpl_examples/statistics/multiple_histograms_side_by_side.png b/mpl_examples/statistics/multiple_histograms_side_by_side.png deleted file mode 100644 index e5f0f6e4f46..00000000000 Binary files a/mpl_examples/statistics/multiple_histograms_side_by_side.png and /dev/null differ diff --git a/mpl_examples/statistics/multiple_histograms_side_by_side.py b/mpl_examples/statistics/multiple_histograms_side_by_side.py deleted file mode 100644 index b150f8b5319..00000000000 --- a/mpl_examples/statistics/multiple_histograms_side_by_side.py +++ /dev/null @@ -1,63 +0,0 @@ -""" -======================================================= -Demo of how to produce multiple histograms side by side -======================================================= - -This example plots horizontal histograms of different samples along -a categorical x-axis. Additionally, the histograms are plotted to -be symmetrical about their x-position, thus making them very similar -to violin plots. - -To make this highly specialized plot, we can't use the standard ``hist`` -method. Instead we use ``barh`` to draw the horizontal bars directly. The -vertical positions and lengths of the bars are computed via the -``np.histogram`` function. The histograms for all the samples are -computed using the same range (min and max values) and number of bins, -so that the bins for each sample are in the same vertical positions. - -Selecting different bin counts and sizes can significantly affect the -shape of a histogram. The Astropy docs have a great section on how to -select these parameters: -http://docs.astropy.org/en/stable/visualization/histogram.html -""" - -import numpy as np -import matplotlib.pyplot as plt - -np.random.seed(0) -number_of_bins = 20 - -# An example of three data sets to compare -number_of_data_points = 387 -labels = ["A", "B", "C"] -data_sets = [np.random.normal(0, 1, number_of_data_points), - np.random.normal(6, 1, number_of_data_points), - np.random.normal(-3, 1, number_of_data_points)] - -# Computed quantities to aid plotting -hist_range = (np.min(data_sets), np.max(data_sets)) -binned_data_sets = [ - np.histogram(d, range=hist_range, bins=number_of_bins)[0] - for d in data_sets -] -binned_maximums = np.max(binned_data_sets, axis=1) -x_locations = np.arange(0, sum(binned_maximums), np.max(binned_maximums)) - -# The bin_edges are the same for all of the histograms -bin_edges = np.linspace(hist_range[0], hist_range[1], number_of_bins + 1) -centers = 0.5 * (bin_edges + np.roll(bin_edges, 1))[:-1] -heights = np.diff(bin_edges) - -# Cycle through and plot each histogram -fig, ax = plt.subplots() -for x_loc, binned_data in zip(x_locations, binned_data_sets): - lefts = x_loc - 0.5 * binned_data - ax.barh(centers, binned_data, height=heights, left=lefts) - -ax.set_xticks(x_locations) -ax.set_xticklabels(labels) - -ax.set_ylabel("Data values") -ax.set_xlabel("Data sets") - -plt.show() diff --git a/mpl_examples/statistics/violinplot_demo.hires.png b/mpl_examples/statistics/violinplot_demo.hires.png deleted file mode 100644 index 1987ae4c497..00000000000 Binary files a/mpl_examples/statistics/violinplot_demo.hires.png and /dev/null differ diff --git a/mpl_examples/statistics/violinplot_demo.pdf b/mpl_examples/statistics/violinplot_demo.pdf deleted file mode 100644 index df1e5774639..00000000000 Binary files a/mpl_examples/statistics/violinplot_demo.pdf and /dev/null differ diff --git a/mpl_examples/statistics/violinplot_demo.png b/mpl_examples/statistics/violinplot_demo.png deleted file mode 100644 index 09c66271cfb..00000000000 Binary files a/mpl_examples/statistics/violinplot_demo.png and /dev/null differ diff --git a/mpl_examples/statistics/violinplot_demo.py b/mpl_examples/statistics/violinplot_demo.py deleted file mode 100644 index fdd30e98078..00000000000 --- a/mpl_examples/statistics/violinplot_demo.py +++ /dev/null @@ -1,62 +0,0 @@ -""" -================================== -Demo of the basics of violin plots -================================== - -Violin plots are similar to histograms and box plots in that they show -an abstract representation of the probability distribution of the -sample. Rather than showing counts of data points that fall into bins -or order statistics, violin plots use kernel density estimation (KDE) to -compute an empirical distribution of the sample. That computation -is controlled by several parameters. This example demonstrates how to -modify the number of points at which the KDE is evaluated (``points``) -and how to modify the band-width of the KDE (``bw_method``). - -For more information on violin plots and KDE, the scikit-learn docs -have a great section: http://scikit-learn.org/stable/modules/density.html -""" - -import random -import numpy as np -import matplotlib.pyplot as plt - -# fake data -fs = 10 # fontsize -pos = [1, 2, 4, 5, 7, 8] -data = [np.random.normal(0, std, size=100) for std in pos] - -fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(6, 6)) - -axes[0, 0].violinplot(data, pos, points=20, widths=0.3, - showmeans=True, showextrema=True, showmedians=True) -axes[0, 0].set_title('Custom violinplot 1', fontsize=fs) - -axes[0, 1].violinplot(data, pos, points=40, widths=0.5, - showmeans=True, showextrema=True, showmedians=True, - bw_method='silverman') -axes[0, 1].set_title('Custom violinplot 2', fontsize=fs) - -axes[0, 2].violinplot(data, pos, points=60, widths=0.7, showmeans=True, - showextrema=True, showmedians=True, bw_method=0.5) -axes[0, 2].set_title('Custom violinplot 3', fontsize=fs) - -axes[1, 0].violinplot(data, pos, points=80, vert=False, widths=0.7, - showmeans=True, showextrema=True, showmedians=True) -axes[1, 0].set_title('Custom violinplot 4', fontsize=fs) - -axes[1, 1].violinplot(data, pos, points=100, vert=False, widths=0.9, - showmeans=True, showextrema=True, showmedians=True, - bw_method='silverman') -axes[1, 1].set_title('Custom violinplot 5', fontsize=fs) - -axes[1, 2].violinplot(data, pos, points=200, vert=False, widths=1.1, - showmeans=True, showextrema=True, showmedians=True, - bw_method=0.5) -axes[1, 2].set_title('Custom violinplot 6', fontsize=fs) - -for ax in axes.flatten(): - ax.set_yticklabels([]) - -fig.suptitle("Violin Plotting Examples") -fig.subplots_adjust(hspace=0.4) -plt.show() diff --git a/mpl_examples/style_sheets/plot_bmh.hires.png b/mpl_examples/style_sheets/plot_bmh.hires.png deleted file mode 100644 index 647c92ee841..00000000000 Binary files a/mpl_examples/style_sheets/plot_bmh.hires.png and /dev/null differ diff --git a/mpl_examples/style_sheets/plot_bmh.pdf b/mpl_examples/style_sheets/plot_bmh.pdf deleted file mode 100644 index 0d8e0130806..00000000000 Binary files a/mpl_examples/style_sheets/plot_bmh.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/plot_bmh.png b/mpl_examples/style_sheets/plot_bmh.png deleted file mode 100644 index 185180616c8..00000000000 Binary files a/mpl_examples/style_sheets/plot_bmh.png and /dev/null differ diff --git a/mpl_examples/style_sheets/plot_bmh.py b/mpl_examples/style_sheets/plot_bmh.py deleted file mode 100644 index 604b6166d94..00000000000 --- a/mpl_examples/style_sheets/plot_bmh.py +++ /dev/null @@ -1,31 +0,0 @@ -""" -======================================== -Bayesian Methods for Hackers style sheet -======================================== - -This example demonstrates the style used in the Bayesian Methods for Hackers -[1]_ online book. - -.. [1] http://camdavidsonpilon.github.io/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/ - -""" -from numpy.random import beta -import matplotlib.pyplot as plt - - -plt.style.use('bmh') - - -def plot_beta_hist(ax, a, b): - ax.hist(beta(a, b, size=10000), histtype="stepfilled", - bins=25, alpha=0.8, normed=True) - - -fig, ax = plt.subplots() -plot_beta_hist(ax, 10, 10) -plot_beta_hist(ax, 4, 12) -plot_beta_hist(ax, 50, 12) -plot_beta_hist(ax, 6, 55) -ax.set_title("'bmh' style sheet") - -plt.show() diff --git a/mpl_examples/style_sheets/plot_dark_background.hires.png b/mpl_examples/style_sheets/plot_dark_background.hires.png deleted file mode 100644 index 2077e6f0c54..00000000000 Binary files a/mpl_examples/style_sheets/plot_dark_background.hires.png and /dev/null differ diff --git a/mpl_examples/style_sheets/plot_dark_background.pdf b/mpl_examples/style_sheets/plot_dark_background.pdf deleted file mode 100644 index a8c4beb3b9c..00000000000 Binary files a/mpl_examples/style_sheets/plot_dark_background.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/plot_dark_background.png b/mpl_examples/style_sheets/plot_dark_background.png deleted file mode 100644 index 8b811ae072c..00000000000 Binary files a/mpl_examples/style_sheets/plot_dark_background.png and /dev/null differ diff --git a/mpl_examples/style_sheets/plot_dark_background.py b/mpl_examples/style_sheets/plot_dark_background.py deleted file mode 100644 index 4342667cfbe..00000000000 --- a/mpl_examples/style_sheets/plot_dark_background.py +++ /dev/null @@ -1,29 +0,0 @@ -""" -=========================== -Dark background style sheet -=========================== - -This example demonstrates the "dark_background" style, which uses white for -elements that are typically black (text, borders, etc). Note that not all plot -elements default to colors defined by an rc parameter. - -""" -import numpy as np -import matplotlib.pyplot as plt - - -plt.style.use('dark_background') - -fig, ax = plt.subplots() - -L = 6 -x = np.linspace(0, L) -ncolors = len(plt.rcParams['axes.prop_cycle']) -shift = np.linspace(0, L, ncolors, endpoint=False) -for s in shift: - ax.plot(x, np.sin(x + s), 'o-') -ax.set_xlabel('x-axis') -ax.set_ylabel('y-axis') -ax.set_title("'dark_background' style sheet") - -plt.show() diff --git a/mpl_examples/style_sheets/plot_fivethirtyeight.hires.png b/mpl_examples/style_sheets/plot_fivethirtyeight.hires.png deleted file mode 100644 index 53040990d8a..00000000000 Binary files a/mpl_examples/style_sheets/plot_fivethirtyeight.hires.png and /dev/null differ diff --git a/mpl_examples/style_sheets/plot_fivethirtyeight.pdf b/mpl_examples/style_sheets/plot_fivethirtyeight.pdf deleted file mode 100644 index 39b9ec51c47..00000000000 Binary files a/mpl_examples/style_sheets/plot_fivethirtyeight.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/plot_fivethirtyeight.png b/mpl_examples/style_sheets/plot_fivethirtyeight.png deleted file mode 100644 index 95c85d96efe..00000000000 Binary files a/mpl_examples/style_sheets/plot_fivethirtyeight.png and /dev/null differ diff --git a/mpl_examples/style_sheets/plot_fivethirtyeight.py b/mpl_examples/style_sheets/plot_fivethirtyeight.py deleted file mode 100644 index f7653171b79..00000000000 --- a/mpl_examples/style_sheets/plot_fivethirtyeight.py +++ /dev/null @@ -1,31 +0,0 @@ -""" -=========================== -FiveThirtyEight style sheet -=========================== - -This shows an example of the "fivethirtyeight" styling, which -tries to replicate the styles from FiveThirtyEight.com. -""" - -from matplotlib import pyplot as plt -import numpy as np - - -plt.style.use('fivethirtyeight') - -x = np.linspace(0, 10) - -# Fixing random state for reproducibility -np.random.seed(19680801) - -fig, ax = plt.subplots() - -ax.plot(x, np.sin(x) + x + np.random.randn(50)) -ax.plot(x, np.sin(x) + 0.5 * x + np.random.randn(50)) -ax.plot(x, np.sin(x) + 2 * x + np.random.randn(50)) -ax.plot(x, np.sin(x) - 0.5 * x + np.random.randn(50)) -ax.plot(x, np.sin(x) - 2 * x + np.random.randn(50)) -ax.plot(x, np.sin(x) + np.random.randn(50)) -ax.set_title("'fivethirtyeight' style sheet") - -plt.show() diff --git a/mpl_examples/style_sheets/plot_ggplot.hires.png b/mpl_examples/style_sheets/plot_ggplot.hires.png deleted file mode 100644 index 80ce2071e3c..00000000000 Binary files a/mpl_examples/style_sheets/plot_ggplot.hires.png and /dev/null differ diff --git a/mpl_examples/style_sheets/plot_ggplot.pdf b/mpl_examples/style_sheets/plot_ggplot.pdf deleted file mode 100644 index ad1558455e0..00000000000 Binary files a/mpl_examples/style_sheets/plot_ggplot.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/plot_ggplot.png b/mpl_examples/style_sheets/plot_ggplot.png deleted file mode 100644 index c2e0cb4509d..00000000000 Binary files a/mpl_examples/style_sheets/plot_ggplot.png and /dev/null differ diff --git a/mpl_examples/style_sheets/plot_ggplot.py b/mpl_examples/style_sheets/plot_ggplot.py deleted file mode 100644 index c548e0851d5..00000000000 --- a/mpl_examples/style_sheets/plot_ggplot.py +++ /dev/null @@ -1,55 +0,0 @@ -""" -================== -ggplot style sheet -================== - -This example demonstrates the "ggplot" style, which adjusts the style to -emulate ggplot_ (a popular plotting package for R_). - -These settings were shamelessly stolen from [1]_ (with permission). - -.. [1] http://www.huyng.com/posts/sane-color-scheme-for-matplotlib/ - -.. _ggplot: http://ggplot2.org/ -.. _R: https://www.r-project.org/ - -""" -import numpy as np -import matplotlib.pyplot as plt - -plt.style.use('ggplot') - -fig, axes = plt.subplots(ncols=2, nrows=2) -ax1, ax2, ax3, ax4 = axes.ravel() - -# scatter plot (Note: `plt.scatter` doesn't use default colors) -x, y = np.random.normal(size=(2, 200)) -ax1.plot(x, y, 'o') - -# sinusoidal lines with colors from default color cycle -L = 2*np.pi -x = np.linspace(0, L) -ncolors = len(plt.rcParams['axes.prop_cycle']) -shift = np.linspace(0, L, ncolors, endpoint=False) -for s in shift: - ax2.plot(x, np.sin(x + s), '-') -ax2.margins(0) - -# bar graphs -x = np.arange(5) -y1, y2 = np.random.randint(1, 25, size=(2, 5)) -width = 0.25 -ax3.bar(x, y1, width) -ax3.bar(x + width, y2, width, - color=list(plt.rcParams['axes.prop_cycle'])[2]['color']) -ax3.set_xticks(x + width) -ax3.set_xticklabels(['a', 'b', 'c', 'd', 'e']) - -# circles with colors from default color cycle -for i, color in enumerate(plt.rcParams['axes.prop_cycle']): - xy = np.random.normal(size=2) - ax4.add_patch(plt.Circle(xy, radius=0.3, color=color['color'])) -ax4.axis('equal') -ax4.margins(0) - -plt.show() diff --git a/mpl_examples/style_sheets/plot_grayscale.hires.png b/mpl_examples/style_sheets/plot_grayscale.hires.png deleted file mode 100644 index 4011596f2f4..00000000000 Binary files a/mpl_examples/style_sheets/plot_grayscale.hires.png and /dev/null differ diff --git a/mpl_examples/style_sheets/plot_grayscale.pdf b/mpl_examples/style_sheets/plot_grayscale.pdf deleted file mode 100644 index d684012f0ea..00000000000 Binary files a/mpl_examples/style_sheets/plot_grayscale.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/plot_grayscale.png b/mpl_examples/style_sheets/plot_grayscale.png deleted file mode 100644 index b46c0747006..00000000000 Binary files a/mpl_examples/style_sheets/plot_grayscale.png and /dev/null differ diff --git a/mpl_examples/style_sheets/plot_grayscale.py b/mpl_examples/style_sheets/plot_grayscale.py deleted file mode 100644 index 80a251e729e..00000000000 --- a/mpl_examples/style_sheets/plot_grayscale.py +++ /dev/null @@ -1,38 +0,0 @@ -""" -===================== -Grayscale style sheet -===================== - -This example demonstrates the "grayscale" style sheet, which changes all colors -that are defined as rc parameters to grayscale. Note, however, that not all -plot elements default to colors defined by an rc parameter. - -""" -import numpy as np -import matplotlib.pyplot as plt - - -def color_cycle_example(ax): - L = 6 - x = np.linspace(0, L) - ncolors = len(plt.rcParams['axes.prop_cycle']) - shift = np.linspace(0, L, ncolors, endpoint=False) - for s in shift: - ax.plot(x, np.sin(x + s), 'o-') - - -def image_and_patch_example(ax): - ax.imshow(np.random.random(size=(20, 20)), interpolation='none') - c = plt.Circle((5, 5), radius=5, label='patch') - ax.add_patch(c) - - -plt.style.use('grayscale') - -fig, (ax1, ax2) = plt.subplots(ncols=2) -fig.suptitle("'grayscale' style sheet") - -color_cycle_example(ax1) -image_and_patch_example(ax2) - -plt.show() diff --git a/mpl_examples/style_sheets/style_sheets_reference.py b/mpl_examples/style_sheets/style_sheets_reference.py deleted file mode 100644 index ef12c1ac3a0..00000000000 --- a/mpl_examples/style_sheets/style_sheets_reference.py +++ /dev/null @@ -1,146 +0,0 @@ -""" -====================== -Style sheets reference -====================== - -This script demonstrates the different available style sheets on a -common set of example plots: scatter plot, image, bar graph, patches, -line plot and histogram, - -""" - -import numpy as np -import matplotlib.pyplot as plt - - -def plot_scatter(ax, prng, nb_samples=100): - """Scatter plot. - """ - for mu, sigma, marker in [(-.5, 0.75, 'o'), (0.75, 1., 's')]: - x, y = prng.normal(loc=mu, scale=sigma, size=(2, nb_samples)) - ax.plot(x, y, ls='none', marker=marker) - ax.set_xlabel('X-label') - return ax - - -def plot_colored_sinusoidal_lines(ax): - """Plot sinusoidal lines with colors following the style color cycle. - """ - L = 2 * np.pi - x = np.linspace(0, L) - nb_colors = len(plt.rcParams['axes.prop_cycle']) - shift = np.linspace(0, L, nb_colors, endpoint=False) - for s in shift: - ax.plot(x, np.sin(x + s), '-') - ax.set_xlim([x[0], x[-1]]) - return ax - - -def plot_bar_graphs(ax, prng, min_value=5, max_value=25, nb_samples=5): - """Plot two bar graphs side by side, with letters as x-tick labels. - """ - x = np.arange(nb_samples) - ya, yb = prng.randint(min_value, max_value, size=(2, nb_samples)) - width = 0.25 - ax.bar(x, ya, width) - ax.bar(x + width, yb, width, color='C2') - ax.set_xticks(x + width) - ax.set_xticklabels(['a', 'b', 'c', 'd', 'e']) - return ax - - -def plot_colored_circles(ax, prng, nb_samples=15): - """Plot circle patches. - - NB: draws a fixed amount of samples, rather than using the length of - the color cycle, because different styles may have different numbers - of colors. - """ - for sty_dict, j in zip(plt.rcParams['axes.prop_cycle'], range(nb_samples)): - ax.add_patch(plt.Circle(prng.normal(scale=3, size=2), - radius=1.0, color=sty_dict['color'])) - # Force the limits to be the same across the styles (because different - # styles may have different numbers of available colors). - ax.set_xlim([-4, 8]) - ax.set_ylim([-5, 6]) - ax.set_aspect('equal', adjustable='box') # to plot circles as circles - return ax - - -def plot_image_and_patch(ax, prng, size=(20, 20)): - """Plot an image with random values and superimpose a circular patch. - """ - values = prng.random_sample(size=size) - ax.imshow(values, interpolation='none') - c = plt.Circle((5, 5), radius=5, label='patch') - ax.add_patch(c) - # Remove ticks - ax.set_xticks([]) - ax.set_yticks([]) - - -def plot_histograms(ax, prng, nb_samples=10000): - """Plot 4 histograms and a text annotation. - """ - params = ((10, 10), (4, 12), (50, 12), (6, 55)) - for a, b in params: - values = prng.beta(a, b, size=nb_samples) - ax.hist(values, histtype="stepfilled", bins=30, alpha=0.8, normed=True) - # Add a small annotation. - ax.annotate('Annotation', xy=(0.25, 4.25), xycoords='data', - xytext=(0.9, 0.9), textcoords='axes fraction', - va="top", ha="right", - bbox=dict(boxstyle="round", alpha=0.2), - arrowprops=dict( - arrowstyle="->", - connectionstyle="angle,angleA=-95,angleB=35,rad=10"), - ) - return ax - - -def plot_figure(style_label=""): - """Setup and plot the demonstration figure with a given style. - """ - # Use a dedicated RandomState instance to draw the same "random" values - # across the different figures. - prng = np.random.RandomState(96917002) - - # Tweak the figure size to be better suited for a row of numerous plots: - # double the width and halve the height. NB: use relative changes because - # some styles may have a figure size different from the default one. - (fig_width, fig_height) = plt.rcParams['figure.figsize'] - fig_size = [fig_width * 2, fig_height / 2] - - fig, axes = plt.subplots(ncols=6, nrows=1, num=style_label, - figsize=fig_size, squeeze=True) - axes[0].set_ylabel(style_label) - - plot_scatter(axes[0], prng) - plot_image_and_patch(axes[1], prng) - plot_bar_graphs(axes[2], prng) - plot_colored_circles(axes[3], prng) - plot_colored_sinusoidal_lines(axes[4]) - plot_histograms(axes[5], prng) - - fig.tight_layout() - - return fig - - -if __name__ == "__main__": - - # Setup a list of all available styles, in alphabetical order but - # the `default` and `classic` ones, which will be forced resp. in - # first and second position. - style_list = list(plt.style.available) # *new* list: avoids side effects. - style_list.remove('classic') # `classic` is in the list: first remove it. - style_list.sort() - style_list.insert(0, u'default') - style_list.insert(1, u'classic') - - # Plot a demonstration figure for every available style sheet. - for style_label in style_list: - with plt.style.context(style_label): - fig = plot_figure(style_label=style_label) - - plt.show() diff --git a/mpl_examples/style_sheets/style_sheets_reference_00.pdf b/mpl_examples/style_sheets/style_sheets_reference_00.pdf deleted file mode 100644 index e131ff05710..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_00.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_00.png b/mpl_examples/style_sheets/style_sheets_reference_00.png deleted file mode 100644 index 8ae967568c9..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_00.png and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_01.pdf b/mpl_examples/style_sheets/style_sheets_reference_01.pdf deleted file mode 100644 index c4b4184b62e..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_01.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_01.png b/mpl_examples/style_sheets/style_sheets_reference_01.png deleted file mode 100644 index 3081c89cff8..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_01.png and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_02.pdf b/mpl_examples/style_sheets/style_sheets_reference_02.pdf deleted file mode 100644 index 55d52106d43..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_02.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_02.png b/mpl_examples/style_sheets/style_sheets_reference_02.png deleted file mode 100644 index 1110399ccb8..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_02.png and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_03.pdf b/mpl_examples/style_sheets/style_sheets_reference_03.pdf deleted file mode 100644 index 44a73b1c2a6..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_03.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_03.png b/mpl_examples/style_sheets/style_sheets_reference_03.png deleted file mode 100644 index 4bfaea5dfff..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_03.png and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_04.pdf b/mpl_examples/style_sheets/style_sheets_reference_04.pdf deleted file mode 100644 index d2a68ebf514..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_04.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_04.png b/mpl_examples/style_sheets/style_sheets_reference_04.png deleted file mode 100644 index 23a535895e6..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_04.png and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_05.pdf b/mpl_examples/style_sheets/style_sheets_reference_05.pdf deleted file mode 100644 index 2e49fd2e55f..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_05.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_05.png b/mpl_examples/style_sheets/style_sheets_reference_05.png deleted file mode 100644 index 01bfedc0209..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_05.png and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_06.pdf b/mpl_examples/style_sheets/style_sheets_reference_06.pdf deleted file mode 100644 index 82027302dcd..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_06.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_06.png b/mpl_examples/style_sheets/style_sheets_reference_06.png deleted file mode 100644 index b00545674e9..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_06.png and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_07.pdf b/mpl_examples/style_sheets/style_sheets_reference_07.pdf deleted file mode 100644 index b3255da144f..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_07.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_07.png b/mpl_examples/style_sheets/style_sheets_reference_07.png deleted file mode 100644 index 7fd34b8a499..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_07.png and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_08.pdf b/mpl_examples/style_sheets/style_sheets_reference_08.pdf deleted file mode 100644 index 02f78f21175..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_08.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_08.png b/mpl_examples/style_sheets/style_sheets_reference_08.png deleted file mode 100644 index 04301a4db74..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_08.png and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_09.pdf b/mpl_examples/style_sheets/style_sheets_reference_09.pdf deleted file mode 100644 index fdca4e17c37..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_09.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_09.png b/mpl_examples/style_sheets/style_sheets_reference_09.png deleted file mode 100644 index 15337888dc8..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_09.png and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_10.pdf b/mpl_examples/style_sheets/style_sheets_reference_10.pdf deleted file mode 100644 index 3960722eab5..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_10.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_10.png b/mpl_examples/style_sheets/style_sheets_reference_10.png deleted file mode 100644 index 802d0d54219..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_10.png and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_11.pdf b/mpl_examples/style_sheets/style_sheets_reference_11.pdf deleted file mode 100644 index 916b81b1f81..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_11.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_11.png b/mpl_examples/style_sheets/style_sheets_reference_11.png deleted file mode 100644 index 4f78a40c4b2..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_11.png and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_12.pdf b/mpl_examples/style_sheets/style_sheets_reference_12.pdf deleted file mode 100644 index ec8ac178cbb..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_12.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_12.png b/mpl_examples/style_sheets/style_sheets_reference_12.png deleted file mode 100644 index 06eefb35733..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_12.png and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_13.pdf b/mpl_examples/style_sheets/style_sheets_reference_13.pdf deleted file mode 100644 index b930698a72d..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_13.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_13.png b/mpl_examples/style_sheets/style_sheets_reference_13.png deleted file mode 100644 index 9a805f19e1b..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_13.png and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_14.pdf b/mpl_examples/style_sheets/style_sheets_reference_14.pdf deleted file mode 100644 index 0e22545bb9c..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_14.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_14.png b/mpl_examples/style_sheets/style_sheets_reference_14.png deleted file mode 100644 index 4b81b5c8b71..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_14.png and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_15.pdf b/mpl_examples/style_sheets/style_sheets_reference_15.pdf deleted file mode 100644 index 6e952cb40ff..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_15.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_15.png b/mpl_examples/style_sheets/style_sheets_reference_15.png deleted file mode 100644 index e17e2018d41..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_15.png and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_16.pdf b/mpl_examples/style_sheets/style_sheets_reference_16.pdf deleted file mode 100644 index 916c469e1a4..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_16.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_16.png b/mpl_examples/style_sheets/style_sheets_reference_16.png deleted file mode 100644 index 983f79236c6..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_16.png and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_17.pdf b/mpl_examples/style_sheets/style_sheets_reference_17.pdf deleted file mode 100644 index 7b7788c3be5..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_17.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_17.png b/mpl_examples/style_sheets/style_sheets_reference_17.png deleted file mode 100644 index b6e807a7eca..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_17.png and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_18.pdf b/mpl_examples/style_sheets/style_sheets_reference_18.pdf deleted file mode 100644 index 3f8928bc483..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_18.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_18.png b/mpl_examples/style_sheets/style_sheets_reference_18.png deleted file mode 100644 index b49c63a2f88..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_18.png and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_19.pdf b/mpl_examples/style_sheets/style_sheets_reference_19.pdf deleted file mode 100644 index 8467cfcf35d..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_19.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_19.png b/mpl_examples/style_sheets/style_sheets_reference_19.png deleted file mode 100644 index 063b53944ed..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_19.png and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_20.pdf b/mpl_examples/style_sheets/style_sheets_reference_20.pdf deleted file mode 100644 index 8cfb6479e53..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_20.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_20.png b/mpl_examples/style_sheets/style_sheets_reference_20.png deleted file mode 100644 index d8c7bccaa5b..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_20.png and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_21.pdf b/mpl_examples/style_sheets/style_sheets_reference_21.pdf deleted file mode 100644 index 215e82e4b36..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_21.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_21.png b/mpl_examples/style_sheets/style_sheets_reference_21.png deleted file mode 100644 index 6a560e51a3b..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_21.png and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_22.pdf b/mpl_examples/style_sheets/style_sheets_reference_22.pdf deleted file mode 100644 index 2bb7bd554e1..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_22.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_22.png b/mpl_examples/style_sheets/style_sheets_reference_22.png deleted file mode 100644 index fb8d26249d5..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_22.png and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_23.pdf b/mpl_examples/style_sheets/style_sheets_reference_23.pdf deleted file mode 100644 index 0380bd1f04b..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_23.pdf and /dev/null differ diff --git a/mpl_examples/style_sheets/style_sheets_reference_23.png b/mpl_examples/style_sheets/style_sheets_reference_23.png deleted file mode 100644 index eca5ac9457e..00000000000 Binary files a/mpl_examples/style_sheets/style_sheets_reference_23.png and /dev/null differ diff --git a/mpl_examples/subplots_axes_and_figures/fahrenheit_celsius_scales.hires.png b/mpl_examples/subplots_axes_and_figures/fahrenheit_celsius_scales.hires.png deleted file mode 100644 index 8326ecfed27..00000000000 Binary files a/mpl_examples/subplots_axes_and_figures/fahrenheit_celsius_scales.hires.png and /dev/null differ diff --git a/mpl_examples/subplots_axes_and_figures/fahrenheit_celsius_scales.pdf b/mpl_examples/subplots_axes_and_figures/fahrenheit_celsius_scales.pdf deleted file mode 100644 index ea9fe9010ad..00000000000 Binary files a/mpl_examples/subplots_axes_and_figures/fahrenheit_celsius_scales.pdf and /dev/null differ diff --git a/mpl_examples/subplots_axes_and_figures/fahrenheit_celsius_scales.png b/mpl_examples/subplots_axes_and_figures/fahrenheit_celsius_scales.png deleted file mode 100644 index d2fc1885a81..00000000000 Binary files a/mpl_examples/subplots_axes_and_figures/fahrenheit_celsius_scales.png and /dev/null differ diff --git a/mpl_examples/subplots_axes_and_figures/fahrenheit_celsius_scales.py b/mpl_examples/subplots_axes_and_figures/fahrenheit_celsius_scales.py deleted file mode 100644 index 2318f167867..00000000000 --- a/mpl_examples/subplots_axes_and_figures/fahrenheit_celsius_scales.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Demo of how to display two scales on the left and right y axis. - -This example uses the Fahrenheit and Celsius scales. -""" -import matplotlib.pyplot as plt -import numpy as np - - -def fahrenheit2celsius(temp): - """ - Returns temperature in Celsius. - """ - return (5. / 9.) * (temp - 32) - - -def convert_ax_c_to_celsius(ax_f): - """ - Update second axis according with first axis. - """ - y1, y2 = ax_f.get_ylim() - ax_c.set_ylim(fahrenheit2celsius(y1), fahrenheit2celsius(y2)) - ax_c.figure.canvas.draw() - -fig, ax_f = plt.subplots() -ax_c = ax_f.twinx() - -# automatically update ylim of ax2 when ylim of ax1 changes. -ax_f.callbacks.connect("ylim_changed", convert_ax_c_to_celsius) -ax_f.plot(np.linspace(-40, 120, 100)) -ax_f.set_xlim(0, 100) - -ax_f.set_title('Two scales: Fahrenheit and Celsius') -ax_f.set_ylabel('Fahrenheit') -ax_c.set_ylabel('Celsius') - -plt.show() diff --git a/mpl_examples/subplots_axes_and_figures/subplot_demo.hires.png b/mpl_examples/subplots_axes_and_figures/subplot_demo.hires.png deleted file mode 100644 index 0830403e93c..00000000000 Binary files a/mpl_examples/subplots_axes_and_figures/subplot_demo.hires.png and /dev/null differ diff --git a/mpl_examples/subplots_axes_and_figures/subplot_demo.pdf b/mpl_examples/subplots_axes_and_figures/subplot_demo.pdf deleted file mode 100644 index c4e5ea69c25..00000000000 Binary files a/mpl_examples/subplots_axes_and_figures/subplot_demo.pdf and /dev/null differ diff --git a/mpl_examples/subplots_axes_and_figures/subplot_demo.png b/mpl_examples/subplots_axes_and_figures/subplot_demo.png deleted file mode 100644 index 3618aa86464..00000000000 Binary files a/mpl_examples/subplots_axes_and_figures/subplot_demo.png and /dev/null differ diff --git a/mpl_examples/subplots_axes_and_figures/subplot_demo.py b/mpl_examples/subplots_axes_and_figures/subplot_demo.py deleted file mode 100644 index e00d7cb6f24..00000000000 --- a/mpl_examples/subplots_axes_and_figures/subplot_demo.py +++ /dev/null @@ -1,24 +0,0 @@ -""" -Simple demo with multiple subplots. -""" -import numpy as np -import matplotlib.pyplot as plt - - -x1 = np.linspace(0.0, 5.0) -x2 = np.linspace(0.0, 2.0) - -y1 = np.cos(2 * np.pi * x1) * np.exp(-x1) -y2 = np.cos(2 * np.pi * x2) - -plt.subplot(2, 1, 1) -plt.plot(x1, y1, 'o-') -plt.title('A tale of 2 subplots') -plt.ylabel('Damped oscillation') - -plt.subplot(2, 1, 2) -plt.plot(x2, y2, '.-') -plt.xlabel('time (s)') -plt.ylabel('Undamped') - -plt.show() diff --git a/mpl_examples/text_labels_and_annotations/autowrap_demo.hires.png b/mpl_examples/text_labels_and_annotations/autowrap_demo.hires.png deleted file mode 100644 index f73efe234ed..00000000000 Binary files a/mpl_examples/text_labels_and_annotations/autowrap_demo.hires.png and /dev/null differ diff --git a/mpl_examples/text_labels_and_annotations/autowrap_demo.pdf b/mpl_examples/text_labels_and_annotations/autowrap_demo.pdf deleted file mode 100644 index da434693cb4..00000000000 Binary files a/mpl_examples/text_labels_and_annotations/autowrap_demo.pdf and /dev/null differ diff --git a/mpl_examples/text_labels_and_annotations/autowrap_demo.png b/mpl_examples/text_labels_and_annotations/autowrap_demo.png deleted file mode 100644 index 2a31993d174..00000000000 Binary files a/mpl_examples/text_labels_and_annotations/autowrap_demo.png and /dev/null differ diff --git a/mpl_examples/text_labels_and_annotations/autowrap_demo.py b/mpl_examples/text_labels_and_annotations/autowrap_demo.py deleted file mode 100644 index fa6080b70c5..00000000000 --- a/mpl_examples/text_labels_and_annotations/autowrap_demo.py +++ /dev/null @@ -1,25 +0,0 @@ -""" -================== -Auto-wrapping text -================== - -Matplotlib can wrap text automatically, but if it's too long, the text will be -displayed slightly outside of the boundaries of the axis anyways. -""" - -import matplotlib.pyplot as plt - -fig = plt.figure() -plt.axis([0, 10, 0, 10]) -t = "This is a really long string that I'd rather have wrapped so that it"\ - " doesn't go outside of the figure, but if it's long enough it will go"\ - " off the top or bottom!" -plt.text(4, 1, t, ha='left', rotation=15, wrap=True) -plt.text(6, 5, t, ha='left', rotation=15, wrap=True) -plt.text(5, 5, t, ha='right', rotation=-15, wrap=True) -plt.text(5, 10, t, fontsize=18, style='oblique', ha='center', - va='top', wrap=True) -plt.text(3, 4, t, family='serif', style='italic', ha='right', wrap=True) -plt.text(-1, 0, t, ha='left', rotation=-15, wrap=True) - -plt.show() diff --git a/mpl_examples/text_labels_and_annotations/rainbow_text.hires.png b/mpl_examples/text_labels_and_annotations/rainbow_text.hires.png deleted file mode 100644 index b0fea2b4615..00000000000 Binary files a/mpl_examples/text_labels_and_annotations/rainbow_text.hires.png and /dev/null differ diff --git a/mpl_examples/text_labels_and_annotations/rainbow_text.pdf b/mpl_examples/text_labels_and_annotations/rainbow_text.pdf deleted file mode 100644 index 67bb2b0902a..00000000000 Binary files a/mpl_examples/text_labels_and_annotations/rainbow_text.pdf and /dev/null differ diff --git a/mpl_examples/text_labels_and_annotations/rainbow_text.png b/mpl_examples/text_labels_and_annotations/rainbow_text.png deleted file mode 100644 index 05e76999910..00000000000 Binary files a/mpl_examples/text_labels_and_annotations/rainbow_text.png and /dev/null differ diff --git a/mpl_examples/text_labels_and_annotations/rainbow_text.py b/mpl_examples/text_labels_and_annotations/rainbow_text.py deleted file mode 100644 index 95142175ce3..00000000000 --- a/mpl_examples/text_labels_and_annotations/rainbow_text.py +++ /dev/null @@ -1,62 +0,0 @@ -# -*- coding: utf-8 -*- -""" -The example shows how to string together several text objects. - -HISTORY -------- -On the matplotlib-users list back in February 2012, Gökhan Sever asked the -following question: - - Is there a way in matplotlib to partially specify the color of a string? - - Example: - - plt.ylabel("Today is cloudy.") - How can I show "today" as red, "is" as green and "cloudy." as blue? - - Thanks. - -Paul Ivanov responded with this answer: -""" -import matplotlib.pyplot as plt -from matplotlib import transforms - - -def rainbow_text(x, y, strings, colors, ax=None, **kw): - """ - Take a list of ``strings`` and ``colors`` and place them next to each - other, with text strings[i] being shown in colors[i]. - - This example shows how to do both vertical and horizontal text, and will - pass all keyword arguments to plt.text, so you can set the font size, - family, etc. - - The text will get added to the ``ax`` axes, if provided, otherwise the - currently active axes will be used. - """ - if ax is None: - ax = plt.gca() - t = ax.transData - canvas = ax.figure.canvas - - # horizontal version - for s, c in zip(strings, colors): - text = ax.text(x, y, s + " ", color=c, transform=t, **kw) - text.draw(canvas.get_renderer()) - ex = text.get_window_extent() - t = transforms.offset_copy(text._transform, x=ex.width, units='dots') - - # vertical version - for s, c in zip(strings, colors): - text = ax.text(x, y, s + " ", color=c, transform=t, - rotation=90, va='bottom', ha='center', **kw) - text.draw(canvas.get_renderer()) - ex = text.get_window_extent() - t = transforms.offset_copy(text._transform, y=ex.height, units='dots') - - -rainbow_text(0, 0, "all unicorns poop rainbows ! ! !".split(), - ['red', 'cyan', 'brown', 'green', 'blue', 'purple', 'black'], - size=16) - -plt.show() diff --git a/mpl_examples/text_labels_and_annotations/text_demo_fontdict.hires.png b/mpl_examples/text_labels_and_annotations/text_demo_fontdict.hires.png deleted file mode 100644 index ec01f9a43fd..00000000000 Binary files a/mpl_examples/text_labels_and_annotations/text_demo_fontdict.hires.png and /dev/null differ diff --git a/mpl_examples/text_labels_and_annotations/text_demo_fontdict.pdf b/mpl_examples/text_labels_and_annotations/text_demo_fontdict.pdf deleted file mode 100644 index cb4402531e9..00000000000 Binary files a/mpl_examples/text_labels_and_annotations/text_demo_fontdict.pdf and /dev/null differ diff --git a/mpl_examples/text_labels_and_annotations/text_demo_fontdict.png b/mpl_examples/text_labels_and_annotations/text_demo_fontdict.png deleted file mode 100644 index 0936b9485b7..00000000000 Binary files a/mpl_examples/text_labels_and_annotations/text_demo_fontdict.png and /dev/null differ diff --git a/mpl_examples/text_labels_and_annotations/text_demo_fontdict.py b/mpl_examples/text_labels_and_annotations/text_demo_fontdict.py deleted file mode 100644 index ad6fa8cc972..00000000000 --- a/mpl_examples/text_labels_and_annotations/text_demo_fontdict.py +++ /dev/null @@ -1,31 +0,0 @@ -""" -======================================================= -Controlling style of text and labels using a dictionary -======================================================= - -This example shows how to share parameters across many text objects and labels -by creating a dictionary of options passed across several functions. -""" - -import numpy as np -import matplotlib.pyplot as plt - - -font = {'family': 'serif', - 'color': 'darkred', - 'weight': 'normal', - 'size': 16, - } - -x = np.linspace(0.0, 5.0, 100) -y = np.cos(2*np.pi*x) * np.exp(-x) - -plt.plot(x, y, 'k') -plt.title('Damped exponential decay', fontdict=font) -plt.text(2, 0.65, r'$\cos(2 \pi t) \exp(-t)$', fontdict=font) -plt.xlabel('time (s)', fontdict=font) -plt.ylabel('voltage (mV)', fontdict=font) - -# Tweak spacing to prevent clipping of ylabel -plt.subplots_adjust(left=0.15) -plt.show() diff --git a/mpl_examples/text_labels_and_annotations/unicode_demo.hires.png b/mpl_examples/text_labels_and_annotations/unicode_demo.hires.png deleted file mode 100644 index b31c2285edb..00000000000 Binary files a/mpl_examples/text_labels_and_annotations/unicode_demo.hires.png and /dev/null differ diff --git a/mpl_examples/text_labels_and_annotations/unicode_demo.pdf b/mpl_examples/text_labels_and_annotations/unicode_demo.pdf deleted file mode 100644 index b05ec38bc4c..00000000000 Binary files a/mpl_examples/text_labels_and_annotations/unicode_demo.pdf and /dev/null differ diff --git a/mpl_examples/text_labels_and_annotations/unicode_demo.png b/mpl_examples/text_labels_and_annotations/unicode_demo.png deleted file mode 100644 index cbfba78ca70..00000000000 Binary files a/mpl_examples/text_labels_and_annotations/unicode_demo.png and /dev/null differ diff --git a/mpl_examples/text_labels_and_annotations/unicode_demo.py b/mpl_examples/text_labels_and_annotations/unicode_demo.py deleted file mode 100644 index 5fc39bea0f4..00000000000 --- a/mpl_examples/text_labels_and_annotations/unicode_demo.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -""" -Demo of unicode support in text and labels. -""" -from __future__ import unicode_literals - -import matplotlib.pyplot as plt - - -plt.title('Développés et fabriqués') -plt.xlabel("réactivité nous permettent d'être sélectionnés et adoptés") -plt.ylabel('André was here!') -plt.text(0.2, 0.8, 'Institut für Festkörperphysik', rotation=45) -plt.text(0.4, 0.2, 'AVA (check kerning)') - -plt.show() diff --git a/mpl_examples/ticks_and_spines/spines_demo.hires.png b/mpl_examples/ticks_and_spines/spines_demo.hires.png deleted file mode 100644 index edfcc26e5f4..00000000000 Binary files a/mpl_examples/ticks_and_spines/spines_demo.hires.png and /dev/null differ diff --git a/mpl_examples/ticks_and_spines/spines_demo.pdf b/mpl_examples/ticks_and_spines/spines_demo.pdf deleted file mode 100644 index 4567c8847bc..00000000000 Binary files a/mpl_examples/ticks_and_spines/spines_demo.pdf and /dev/null differ diff --git a/mpl_examples/ticks_and_spines/spines_demo.png b/mpl_examples/ticks_and_spines/spines_demo.png deleted file mode 100644 index f8911f6e3ef..00000000000 Binary files a/mpl_examples/ticks_and_spines/spines_demo.png and /dev/null differ diff --git a/mpl_examples/ticks_and_spines/spines_demo.py b/mpl_examples/ticks_and_spines/spines_demo.py deleted file mode 100644 index 6c25e899c87..00000000000 --- a/mpl_examples/ticks_and_spines/spines_demo.py +++ /dev/null @@ -1,46 +0,0 @@ -""" -====== -Spines -====== - -This demo compares: - - normal axes, with spines on all four sides; - - an axes with spines only on the left and bottom; - - an axes using custom bounds to limit the extent of the spine. -""" -import numpy as np -import matplotlib.pyplot as plt - - -x = np.linspace(0, 2 * np.pi, 100) -y = 2 * np.sin(x) - -fig, (ax0, ax1, ax2) = plt.subplots(nrows=3) - -ax0.plot(x, y) -ax0.set_title('normal spines') - -ax1.plot(x, y) -ax1.set_title('bottom-left spines') - -# Hide the right and top spines -ax1.spines['right'].set_visible(False) -ax1.spines['top'].set_visible(False) -# Only show ticks on the left and bottom spines -ax1.yaxis.set_ticks_position('left') -ax1.xaxis.set_ticks_position('bottom') - -ax2.plot(x, y) - -# Only draw spine between the y-ticks -ax2.spines['left'].set_bounds(-1, 1) -# Hide the right and top spines -ax2.spines['right'].set_visible(False) -ax2.spines['top'].set_visible(False) -# Only show ticks on the left and bottom spines -ax2.yaxis.set_ticks_position('left') -ax2.xaxis.set_ticks_position('bottom') - -# Tweak spacing between subplots to prevent labels from overlapping -plt.subplots_adjust(hspace=0.5) -plt.show() diff --git a/mpl_examples/ticks_and_spines/spines_demo_bounds.hires.png b/mpl_examples/ticks_and_spines/spines_demo_bounds.hires.png deleted file mode 100644 index 65390dcb140..00000000000 Binary files a/mpl_examples/ticks_and_spines/spines_demo_bounds.hires.png and /dev/null differ diff --git a/mpl_examples/ticks_and_spines/spines_demo_bounds.pdf b/mpl_examples/ticks_and_spines/spines_demo_bounds.pdf deleted file mode 100644 index 947f5bf7bec..00000000000 Binary files a/mpl_examples/ticks_and_spines/spines_demo_bounds.pdf and /dev/null differ diff --git a/mpl_examples/ticks_and_spines/spines_demo_bounds.png b/mpl_examples/ticks_and_spines/spines_demo_bounds.png deleted file mode 100644 index 5d351d04294..00000000000 Binary files a/mpl_examples/ticks_and_spines/spines_demo_bounds.png and /dev/null differ diff --git a/mpl_examples/ticks_and_spines/spines_demo_bounds.py b/mpl_examples/ticks_and_spines/spines_demo_bounds.py deleted file mode 100644 index 4828e72a0af..00000000000 --- a/mpl_examples/ticks_and_spines/spines_demo_bounds.py +++ /dev/null @@ -1,32 +0,0 @@ -""" -Demo of spines using custom bounds to limit the extent of the spine. -""" -import numpy as np -import matplotlib.pyplot as plt - - -x = np.linspace(0, 2*np.pi, 50) -y = np.sin(x) -y2 = y + 0.1 * np.random.normal(size=x.shape) - -fig, ax = plt.subplots() -ax.plot(x, y, 'k--') -ax.plot(x, y2, 'ro') - -# set ticks and tick labels -ax.set_xlim((0, 2*np.pi)) -ax.set_xticks([0, np.pi, 2*np.pi]) -ax.set_xticklabels(['0', '$\pi$', '2$\pi$']) -ax.set_ylim((-1.5, 1.5)) -ax.set_yticks([-1, 0, 1]) - -# Only draw spine between the y-ticks -ax.spines['left'].set_bounds(-1, 1) -# Hide the right and top spines -ax.spines['right'].set_visible(False) -ax.spines['top'].set_visible(False) -# Only show ticks on the left and bottom spines -ax.yaxis.set_ticks_position('left') -ax.xaxis.set_ticks_position('bottom') - -plt.show() diff --git a/mpl_examples/ticks_and_spines/spines_demo_dropped.hires.png b/mpl_examples/ticks_and_spines/spines_demo_dropped.hires.png deleted file mode 100644 index 98907ae6b78..00000000000 Binary files a/mpl_examples/ticks_and_spines/spines_demo_dropped.hires.png and /dev/null differ diff --git a/mpl_examples/ticks_and_spines/spines_demo_dropped.pdf b/mpl_examples/ticks_and_spines/spines_demo_dropped.pdf deleted file mode 100644 index b1e644b0c0a..00000000000 Binary files a/mpl_examples/ticks_and_spines/spines_demo_dropped.pdf and /dev/null differ diff --git a/mpl_examples/ticks_and_spines/spines_demo_dropped.png b/mpl_examples/ticks_and_spines/spines_demo_dropped.png deleted file mode 100644 index e69e268f2df..00000000000 Binary files a/mpl_examples/ticks_and_spines/spines_demo_dropped.png and /dev/null differ diff --git a/mpl_examples/ticks_and_spines/spines_demo_dropped.py b/mpl_examples/ticks_and_spines/spines_demo_dropped.py deleted file mode 100644 index 968614576dd..00000000000 --- a/mpl_examples/ticks_and_spines/spines_demo_dropped.py +++ /dev/null @@ -1,28 +0,0 @@ -""" -============== -Dropped spines -============== - -Demo of spines offset from the axes (a.k.a. "dropped spines"). -""" -import numpy as np -import matplotlib.pyplot as plt - - -fig, ax = plt.subplots() - -image = np.random.uniform(size=(10, 10)) -ax.imshow(image, cmap=plt.cm.gray, interpolation='nearest') -ax.set_title('dropped spines') - -# Move left and bottom spines outward by 10 points -ax.spines['left'].set_position(('outward', 10)) -ax.spines['bottom'].set_position(('outward', 10)) -# Hide the right and top spines -ax.spines['right'].set_visible(False) -ax.spines['top'].set_visible(False) -# Only show ticks on the left and bottom spines -ax.yaxis.set_ticks_position('left') -ax.xaxis.set_ticks_position('bottom') - -plt.show() diff --git a/mpl_examples/ticks_and_spines/tick-formatters.pdf b/mpl_examples/ticks_and_spines/tick-formatters.pdf deleted file mode 100644 index e2bc6227faf..00000000000 Binary files a/mpl_examples/ticks_and_spines/tick-formatters.pdf and /dev/null differ diff --git a/mpl_examples/ticks_and_spines/tick-formatters.png b/mpl_examples/ticks_and_spines/tick-formatters.png deleted file mode 100644 index e3cea4f95bb..00000000000 Binary files a/mpl_examples/ticks_and_spines/tick-formatters.png and /dev/null differ diff --git a/mpl_examples/ticks_and_spines/tick-formatters.py b/mpl_examples/ticks_and_spines/tick-formatters.py deleted file mode 100644 index fa0b8f73def..00000000000 --- a/mpl_examples/ticks_and_spines/tick-formatters.py +++ /dev/null @@ -1,98 +0,0 @@ -""" -=============== -Tick formatters -=============== - -Show the different tick formatters. -""" - -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.ticker as ticker - - -# Setup a plot such that only the bottom spine is shown -def setup(ax): - ax.spines['right'].set_color('none') - ax.spines['left'].set_color('none') - ax.yaxis.set_major_locator(ticker.NullLocator()) - ax.spines['top'].set_color('none') - ax.xaxis.set_ticks_position('bottom') - ax.tick_params(which='major', width=1.00, length=5) - ax.tick_params(which='minor', width=0.75, length=2.5, labelsize=10) - ax.set_xlim(0, 5) - ax.set_ylim(0, 1) - ax.patch.set_alpha(0.0) - - -plt.figure(figsize=(8, 5)) -n = 6 - -# Null formatter -ax = plt.subplot(n, 1, 1) -setup(ax) -ax.xaxis.set_major_locator(ticker.MultipleLocator(1.00)) -ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.25)) -ax.xaxis.set_major_formatter(ticker.NullFormatter()) -ax.xaxis.set_minor_formatter(ticker.NullFormatter()) -ax.text(0.0, 0.1, "NullFormatter()", fontsize=16, transform=ax.transAxes) - -# Fixed formatter -ax = plt.subplot(n, 1, 2) -setup(ax) -ax.xaxis.set_major_locator(ticker.MultipleLocator(1.0)) -ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.25)) -majors = ["", "0", "1", "2", "3", "4", "5"] -ax.xaxis.set_major_formatter(ticker.FixedFormatter(majors)) -minors = [""] + ["%.2f" % (x-int(x)) if (x-int(x)) - else "" for x in np.arange(0, 5, 0.25)] -ax.xaxis.set_minor_formatter(ticker.FixedFormatter(minors)) -ax.text(0.0, 0.1, "FixedFormatter(['', '0', '1', ...])", - fontsize=15, transform=ax.transAxes) - - -# Func formatter -def major_formatter(x, pos): - return "[%.2f]" % x - - -ax = plt.subplot(n, 1, 3) -setup(ax) -ax.xaxis.set_major_locator(ticker.MultipleLocator(1.00)) -ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.25)) -ax.xaxis.set_major_formatter(ticker.FuncFormatter(major_formatter)) -ax.text(0.0, 0.1, 'FuncFormatter(lambda x, pos: "[%.2f]" % x)', - fontsize=15, transform=ax.transAxes) - - -# FormatStr formatter -ax = plt.subplot(n, 1, 4) -setup(ax) -ax.xaxis.set_major_locator(ticker.MultipleLocator(1.00)) -ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.25)) -ax.xaxis.set_major_formatter(ticker.FormatStrFormatter(">%d<")) -ax.text(0.0, 0.1, "FormatStrFormatter('>%d<')", - fontsize=15, transform=ax.transAxes) - -# Scalar formatter -ax = plt.subplot(n, 1, 5) -setup(ax) -ax.xaxis.set_major_locator(ticker.AutoLocator()) -ax.xaxis.set_minor_locator(ticker.AutoMinorLocator()) -ax.xaxis.set_major_formatter(ticker.ScalarFormatter(useMathText=True)) -ax.text(0.0, 0.1, "ScalarFormatter()", fontsize=15, transform=ax.transAxes) - -# StrMethod formatter -ax = plt.subplot(n, 1, 6) -setup(ax) -ax.xaxis.set_major_locator(ticker.MultipleLocator(1.00)) -ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.25)) -ax.xaxis.set_major_formatter(ticker.StrMethodFormatter("{x}")) -ax.text(0.0, 0.1, "StrMethodFormatter('{x}')", - fontsize=15, transform=ax.transAxes) - -# Push the top of the top axes outside the figure because we only show the -# bottom spine. -plt.subplots_adjust(left=0.05, right=0.95, bottom=0.05, top=1.05) - -plt.show() diff --git a/mpl_examples/ticks_and_spines/tick-locators.pdf b/mpl_examples/ticks_and_spines/tick-locators.pdf deleted file mode 100644 index dbdfbf5c091..00000000000 Binary files a/mpl_examples/ticks_and_spines/tick-locators.pdf and /dev/null differ diff --git a/mpl_examples/ticks_and_spines/tick-locators.png b/mpl_examples/ticks_and_spines/tick-locators.png deleted file mode 100644 index 85918a380c8..00000000000 Binary files a/mpl_examples/ticks_and_spines/tick-locators.png and /dev/null differ diff --git a/mpl_examples/ticks_and_spines/tick-locators.py b/mpl_examples/ticks_and_spines/tick-locators.py deleted file mode 100644 index 072d5e9ec9c..00000000000 --- a/mpl_examples/ticks_and_spines/tick-locators.py +++ /dev/null @@ -1,101 +0,0 @@ -""" -============= -Tick locators -============= - -Show the different tick locators. -""" - -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.ticker as ticker - - -# Setup a plot such that only the bottom spine is shown -def setup(ax): - ax.spines['right'].set_color('none') - ax.spines['left'].set_color('none') - ax.yaxis.set_major_locator(ticker.NullLocator()) - ax.spines['top'].set_color('none') - ax.xaxis.set_ticks_position('bottom') - ax.tick_params(which='major', width=1.00) - ax.tick_params(which='major', length=5) - ax.tick_params(which='minor', width=0.75) - ax.tick_params(which='minor', length=2.5) - ax.set_xlim(0, 5) - ax.set_ylim(0, 1) - ax.patch.set_alpha(0.0) - - -plt.figure(figsize=(8, 6)) -n = 8 - -# Null Locator -ax = plt.subplot(n, 1, 1) -setup(ax) -ax.xaxis.set_major_locator(ticker.NullLocator()) -ax.xaxis.set_minor_locator(ticker.NullLocator()) -ax.text(0.0, 0.1, "NullLocator()", fontsize=14, transform=ax.transAxes) - -# Multiple Locator -ax = plt.subplot(n, 1, 2) -setup(ax) -ax.xaxis.set_major_locator(ticker.MultipleLocator(0.5)) -ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.1)) -ax.text(0.0, 0.1, "MultipleLocator(0.5)", fontsize=14, - transform=ax.transAxes) - -# Fixed Locator -ax = plt.subplot(n, 1, 3) -setup(ax) -majors = [0, 1, 5] -ax.xaxis.set_major_locator(ticker.FixedLocator(majors)) -minors = np.linspace(0, 1, 11)[1:-1] -ax.xaxis.set_minor_locator(ticker.FixedLocator(minors)) -ax.text(0.0, 0.1, "FixedLocator([0, 1, 5])", fontsize=14, - transform=ax.transAxes) - -# Linear Locator -ax = plt.subplot(n, 1, 4) -setup(ax) -ax.xaxis.set_major_locator(ticker.LinearLocator(3)) -ax.xaxis.set_minor_locator(ticker.LinearLocator(31)) -ax.text(0.0, 0.1, "LinearLocator(numticks=3)", - fontsize=14, transform=ax.transAxes) - -# Index Locator -ax = plt.subplot(n, 1, 5) -setup(ax) -ax.plot(range(0, 5), [0]*5, color='White') -ax.xaxis.set_major_locator(ticker.IndexLocator(base=.5, offset=.25)) -ax.text(0.0, 0.1, "IndexLocator(base=0.5, offset=0.25)", - fontsize=14, transform=ax.transAxes) - -# Auto Locator -ax = plt.subplot(n, 1, 6) -setup(ax) -ax.xaxis.set_major_locator(ticker.AutoLocator()) -ax.xaxis.set_minor_locator(ticker.AutoMinorLocator()) -ax.text(0.0, 0.1, "AutoLocator()", fontsize=14, transform=ax.transAxes) - -# MaxN Locator -ax = plt.subplot(n, 1, 7) -setup(ax) -ax.xaxis.set_major_locator(ticker.MaxNLocator(4)) -ax.xaxis.set_minor_locator(ticker.MaxNLocator(40)) -ax.text(0.0, 0.1, "MaxNLocator(n=4)", fontsize=14, transform=ax.transAxes) - -# Log Locator -ax = plt.subplot(n, 1, 8) -setup(ax) -ax.set_xlim(10**3, 10**10) -ax.set_xscale('log') -ax.xaxis.set_major_locator(ticker.LogLocator(base=10.0, numticks=15)) -ax.text(0.0, 0.1, "LogLocator(base=10, numticks=15)", - fontsize=15, transform=ax.transAxes) - -# Push the top of the top axes outside the figure because we only show the -# bottom spine. -plt.subplots_adjust(left=0.05, right=0.95, bottom=0.05, top=1.05) - -plt.show() diff --git a/mpl_examples/ticks_and_spines/tick_labels_from_values.hires.png b/mpl_examples/ticks_and_spines/tick_labels_from_values.hires.png deleted file mode 100644 index ca75946370f..00000000000 Binary files a/mpl_examples/ticks_and_spines/tick_labels_from_values.hires.png and /dev/null differ diff --git a/mpl_examples/ticks_and_spines/tick_labels_from_values.pdf b/mpl_examples/ticks_and_spines/tick_labels_from_values.pdf deleted file mode 100644 index 491b273917c..00000000000 Binary files a/mpl_examples/ticks_and_spines/tick_labels_from_values.pdf and /dev/null differ diff --git a/mpl_examples/ticks_and_spines/tick_labels_from_values.png b/mpl_examples/ticks_and_spines/tick_labels_from_values.png deleted file mode 100644 index aadce0d198f..00000000000 Binary files a/mpl_examples/ticks_and_spines/tick_labels_from_values.png and /dev/null differ diff --git a/mpl_examples/ticks_and_spines/tick_labels_from_values.py b/mpl_examples/ticks_and_spines/tick_labels_from_values.py deleted file mode 100644 index fca78eb46ff..00000000000 --- a/mpl_examples/ticks_and_spines/tick_labels_from_values.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -========================================= -Setting tick labels from a list of values -========================================= - -Using ax.set_xticks causes the tick labels to be set on the currently -chosen ticks. However, you may want to allow matplotlib to dynamically -choose the number of ticks and their spacing. - -In this case it may be better to determine the tick label from the -value at the tick. The following example shows how to do this. - -NB: The MaxNLocator is used here to ensure that the tick values -take integer values. - -""" - -import matplotlib.pyplot as plt -from matplotlib.ticker import FuncFormatter, MaxNLocator -fig = plt.figure() -ax = fig.add_subplot(111) -xs = range(26) -ys = range(26) -labels = list('abcdefghijklmnopqrstuvwxyz') - - -def format_fn(tick_val, tick_pos): - if int(tick_val) in xs: - return labels[int(tick_val)] - else: - return '' - - -ax.xaxis.set_major_formatter(FuncFormatter(format_fn)) -ax.xaxis.set_major_locator(MaxNLocator(integer=True)) -ax.plot(xs, ys) -plt.show() diff --git a/mpl_examples/ticks_and_spines/ticklabels_demo_rotation.hires.png b/mpl_examples/ticks_and_spines/ticklabels_demo_rotation.hires.png deleted file mode 100644 index e277dc90ba7..00000000000 Binary files a/mpl_examples/ticks_and_spines/ticklabels_demo_rotation.hires.png and /dev/null differ diff --git a/mpl_examples/ticks_and_spines/ticklabels_demo_rotation.pdf b/mpl_examples/ticks_and_spines/ticklabels_demo_rotation.pdf deleted file mode 100644 index 6ba251f4c15..00000000000 Binary files a/mpl_examples/ticks_and_spines/ticklabels_demo_rotation.pdf and /dev/null differ diff --git a/mpl_examples/ticks_and_spines/ticklabels_demo_rotation.png b/mpl_examples/ticks_and_spines/ticklabels_demo_rotation.png deleted file mode 100644 index 8bcf202f88f..00000000000 Binary files a/mpl_examples/ticks_and_spines/ticklabels_demo_rotation.png and /dev/null differ diff --git a/mpl_examples/ticks_and_spines/ticklabels_demo_rotation.py b/mpl_examples/ticks_and_spines/ticklabels_demo_rotation.py deleted file mode 100644 index b5bb4c64fec..00000000000 --- a/mpl_examples/ticks_and_spines/ticklabels_demo_rotation.py +++ /dev/null @@ -1,22 +0,0 @@ -""" -=========================== -Rotating custom tick labels -=========================== - -Demo of custom tick-labels with user-defined rotation. -""" -import matplotlib.pyplot as plt - - -x = [1, 2, 3, 4] -y = [1, 4, 9, 6] -labels = ['Frogs', 'Hogs', 'Bogs', 'Slogs'] - -plt.plot(x, y, 'ro') -# You can specify a rotation for the tick labels in degrees or with keywords. -plt.xticks(x, labels, rotation='vertical') -# Pad margins so that markers don't get clipped by the axes -plt.margins(0.2) -# Tweak spacing to prevent clipping of tick-labels -plt.subplots_adjust(bottom=0.15) -plt.show() diff --git a/mpl_examples/units/annotate_with_units.hires.png b/mpl_examples/units/annotate_with_units.hires.png deleted file mode 100644 index e34a6afb1ea..00000000000 Binary files a/mpl_examples/units/annotate_with_units.hires.png and /dev/null differ diff --git a/mpl_examples/units/annotate_with_units.pdf b/mpl_examples/units/annotate_with_units.pdf deleted file mode 100644 index 2d887aa3ad0..00000000000 Binary files a/mpl_examples/units/annotate_with_units.pdf and /dev/null differ diff --git a/mpl_examples/units/annotate_with_units.png b/mpl_examples/units/annotate_with_units.png deleted file mode 100644 index cdc676e0c77..00000000000 Binary files a/mpl_examples/units/annotate_with_units.png and /dev/null differ diff --git a/mpl_examples/units/annotate_with_units.py b/mpl_examples/units/annotate_with_units.py deleted file mode 100644 index 67fea4584e2..00000000000 --- a/mpl_examples/units/annotate_with_units.py +++ /dev/null @@ -1,32 +0,0 @@ -""" -===================== -Annotation with units -===================== - -The example illustrates how to create text and arrow -annotations using a centimeter-scale plot. - -""" -import matplotlib.pyplot as plt -from basic_units import cm - -fig, ax = plt.subplots() - -ax.annotate("Note 01", [0.5*cm, 0.5*cm]) - -# xy and text both unitized -ax.annotate('local max', xy=(3*cm, 1*cm), xycoords='data', - xytext=(0.8*cm, 0.95*cm), textcoords='data', - arrowprops=dict(facecolor='black', shrink=0.05), - horizontalalignment='right', verticalalignment='top') - -# mixing units w/ nonunits -ax.annotate('local max', xy=(3*cm, 1*cm), xycoords='data', - xytext=(0.8, 0.95), textcoords='axes fraction', - arrowprops=dict(facecolor='black', shrink=0.05), - horizontalalignment='right', verticalalignment='top') - - -ax.set_xlim(0*cm, 4*cm) -ax.set_ylim(0*cm, 4*cm) -plt.show() diff --git a/mpl_examples/units/artist_tests.hires.png b/mpl_examples/units/artist_tests.hires.png deleted file mode 100644 index 25847efc852..00000000000 Binary files a/mpl_examples/units/artist_tests.hires.png and /dev/null differ diff --git a/mpl_examples/units/artist_tests.pdf b/mpl_examples/units/artist_tests.pdf deleted file mode 100644 index 64c67c91a62..00000000000 Binary files a/mpl_examples/units/artist_tests.pdf and /dev/null differ diff --git a/mpl_examples/units/artist_tests.png b/mpl_examples/units/artist_tests.png deleted file mode 100644 index 3ce2f52d4b4..00000000000 Binary files a/mpl_examples/units/artist_tests.png and /dev/null differ diff --git a/mpl_examples/units/artist_tests.py b/mpl_examples/units/artist_tests.py deleted file mode 100644 index 6483c57c42b..00000000000 --- a/mpl_examples/units/artist_tests.py +++ /dev/null @@ -1,58 +0,0 @@ -""" -============ -Artist tests -============ - -Test unit support with each of the Matplotlib primitive artist types. - -The axis handles unit conversions and the artists keep a pointer to their axis -parent. You must initialize the artists with the axis instance if you want to -use them with unit data, or else they will not know how to convert the units -to scalars. -""" -import random -import matplotlib.lines as lines -import matplotlib.patches as patches -import matplotlib.text as text -import matplotlib.collections as collections - -from basic_units import cm, inch -import numpy as np -import matplotlib.pyplot as plt - -fig, ax = plt.subplots() -ax.xaxis.set_units(cm) -ax.yaxis.set_units(cm) - -if 0: - # test a line collection - # Not supported at present. - verts = [] - for i in range(10): - # a random line segment in inches - verts.append(zip(*inch*10*np.random.rand(2, random.randint(2, 15)))) - lc = collections.LineCollection(verts, axes=ax) - ax.add_collection(lc) - -# test a plain-ol-line -line = lines.Line2D([0*cm, 1.5*cm], [0*cm, 2.5*cm], - lw=2, color='black', axes=ax) -ax.add_line(line) - -if 0: - # test a patch - # Not supported at present. - rect = patches.Rectangle((1*cm, 1*cm), width=5*cm, height=2*cm, - alpha=0.2, axes=ax) - ax.add_patch(rect) - - -t = text.Text(3*cm, 2.5*cm, 'text label', ha='left', va='bottom', axes=ax) -ax.add_artist(t) - -ax.set_xlim(-1*cm, 10*cm) -ax.set_ylim(-1*cm, 10*cm) -# ax.xaxis.set_units(inch) -ax.grid(True) -ax.set_title("Artists with units") -plt.show() diff --git a/mpl_examples/units/bar_demo2.hires.png b/mpl_examples/units/bar_demo2.hires.png deleted file mode 100644 index 46666dd83b0..00000000000 Binary files a/mpl_examples/units/bar_demo2.hires.png and /dev/null differ diff --git a/mpl_examples/units/bar_demo2.pdf b/mpl_examples/units/bar_demo2.pdf deleted file mode 100644 index 5a9b7fa31dd..00000000000 Binary files a/mpl_examples/units/bar_demo2.pdf and /dev/null differ diff --git a/mpl_examples/units/bar_demo2.png b/mpl_examples/units/bar_demo2.png deleted file mode 100644 index 2d0bb411a16..00000000000 Binary files a/mpl_examples/units/bar_demo2.png and /dev/null differ diff --git a/mpl_examples/units/bar_demo2.py b/mpl_examples/units/bar_demo2.py deleted file mode 100644 index d956c1760bd..00000000000 --- a/mpl_examples/units/bar_demo2.py +++ /dev/null @@ -1,34 +0,0 @@ -""" -=================== -Bar demo with units -=================== - -A plot using a variety of centimetre and inch conversions. This example shows -how default unit introspection works (ax1), how various keywords can be used to -set the x and y units to override the defaults (ax2, ax3, ax4) and how one can -set the xlimits using scalars (ax3, current units assumed) or units -(conversions applied to get the numbers to current units). - -""" -import numpy as np -from basic_units import cm, inch -import matplotlib.pyplot as plt - -cms = cm * np.arange(0, 10, 2) -bottom = 0 * cm -width = 0.8 * cm - -fig, axs = plt.subplots(2, 2) - -axs[0, 0].bar(cms, cms, bottom=bottom) - -axs[0, 1].bar(cms, cms, bottom=bottom, width=width, xunits=cm, yunits=inch) - -axs[1, 0].bar(cms, cms, bottom=bottom, width=width, xunits=inch, yunits=cm) -axs[1, 0].set_xlim(2, 6) # scalars are interpreted in current units - -axs[1, 1].bar(cms, cms, bottom=bottom, width=width, xunits=inch, yunits=inch) -axs[1, 1].set_xlim(2 * cm, 6 * cm) # cm are converted to inches - -fig.tight_layout() -plt.show() diff --git a/mpl_examples/units/bar_unit_demo.hires.png b/mpl_examples/units/bar_unit_demo.hires.png deleted file mode 100644 index d46b8c4e456..00000000000 Binary files a/mpl_examples/units/bar_unit_demo.hires.png and /dev/null differ diff --git a/mpl_examples/units/bar_unit_demo.pdf b/mpl_examples/units/bar_unit_demo.pdf deleted file mode 100644 index d447e9ec7aa..00000000000 Binary files a/mpl_examples/units/bar_unit_demo.pdf and /dev/null differ diff --git a/mpl_examples/units/bar_unit_demo.png b/mpl_examples/units/bar_unit_demo.png deleted file mode 100644 index 5ac478ffd38..00000000000 Binary files a/mpl_examples/units/bar_unit_demo.png and /dev/null differ diff --git a/mpl_examples/units/bar_unit_demo.py b/mpl_examples/units/bar_unit_demo.py deleted file mode 100644 index 1e275cbd2c7..00000000000 --- a/mpl_examples/units/bar_unit_demo.py +++ /dev/null @@ -1,40 +0,0 @@ -""" -========================= -Group barchart with units -========================= - -This is the same example as - -the barchart demo in centimeters. -""" - -import numpy as np -from basic_units import cm, inch -import matplotlib.pyplot as plt - - -N = 5 -menMeans = (150*cm, 160*cm, 146*cm, 172*cm, 155*cm) -menStd = (20*cm, 30*cm, 32*cm, 10*cm, 20*cm) - -fig, ax = plt.subplots() - -ind = np.arange(N) # the x locations for the groups -width = 0.35 # the width of the bars -p1 = ax.bar(ind, menMeans, width, color='r', bottom=0*cm, yerr=menStd) - - -womenMeans = (145*cm, 149*cm, 172*cm, 165*cm, 200*cm) -womenStd = (30*cm, 25*cm, 20*cm, 31*cm, 22*cm) -p2 = ax.bar(ind + width, womenMeans, width, - color='y', bottom=0*cm, yerr=womenStd) - -ax.set_title('Scores by group and gender') -ax.set_xticks(ind + width / 2) -ax.set_xticklabels(('G1', 'G2', 'G3', 'G4', 'G5')) - -ax.legend((p1[0], p2[0]), ('Men', 'Women')) -ax.yaxis.set_units(inch) -ax.autoscale_view() - -plt.show() diff --git a/mpl_examples/units/basic_units.py b/mpl_examples/units/basic_units.py deleted file mode 100644 index f8425f1ec45..00000000000 --- a/mpl_examples/units/basic_units.py +++ /dev/null @@ -1,370 +0,0 @@ -import math - -import numpy as np - -import matplotlib.units as units -import matplotlib.ticker as ticker -from matplotlib.axes import Axes -from matplotlib.cbook import iterable - - -class ProxyDelegate(object): - def __init__(self, fn_name, proxy_type): - self.proxy_type = proxy_type - self.fn_name = fn_name - - def __get__(self, obj, objtype=None): - return self.proxy_type(self.fn_name, obj) - - -class TaggedValueMeta (type): - def __init__(cls, name, bases, dict): - for fn_name in cls._proxies.keys(): - try: - dummy = getattr(cls, fn_name) - except AttributeError: - setattr(cls, fn_name, - ProxyDelegate(fn_name, cls._proxies[fn_name])) - - -class PassThroughProxy(object): - def __init__(self, fn_name, obj): - self.fn_name = fn_name - self.target = obj.proxy_target - - def __call__(self, *args): - fn = getattr(self.target, self.fn_name) - ret = fn(*args) - return ret - - -class ConvertArgsProxy(PassThroughProxy): - def __init__(self, fn_name, obj): - PassThroughProxy.__init__(self, fn_name, obj) - self.unit = obj.unit - - def __call__(self, *args): - converted_args = [] - for a in args: - try: - converted_args.append(a.convert_to(self.unit)) - except AttributeError: - converted_args.append(TaggedValue(a, self.unit)) - converted_args = tuple([c.get_value() for c in converted_args]) - return PassThroughProxy.__call__(self, *converted_args) - - -class ConvertReturnProxy(PassThroughProxy): - def __init__(self, fn_name, obj): - PassThroughProxy.__init__(self, fn_name, obj) - self.unit = obj.unit - - def __call__(self, *args): - ret = PassThroughProxy.__call__(self, *args) - if (type(ret) == type(NotImplemented)): - return NotImplemented - return TaggedValue(ret, self.unit) - - -class ConvertAllProxy(PassThroughProxy): - def __init__(self, fn_name, obj): - PassThroughProxy.__init__(self, fn_name, obj) - self.unit = obj.unit - - def __call__(self, *args): - converted_args = [] - arg_units = [self.unit] - for a in args: - if hasattr(a, 'get_unit') and not hasattr(a, 'convert_to'): - # if this arg has a unit type but no conversion ability, - # this operation is prohibited - return NotImplemented - - if hasattr(a, 'convert_to'): - try: - a = a.convert_to(self.unit) - except: - pass - arg_units.append(a.get_unit()) - converted_args.append(a.get_value()) - else: - converted_args.append(a) - if hasattr(a, 'get_unit'): - arg_units.append(a.get_unit()) - else: - arg_units.append(None) - converted_args = tuple(converted_args) - ret = PassThroughProxy.__call__(self, *converted_args) - if (type(ret) == type(NotImplemented)): - return NotImplemented - ret_unit = unit_resolver(self.fn_name, arg_units) - if (ret_unit == NotImplemented): - return NotImplemented - return TaggedValue(ret, ret_unit) - - -class _TaggedValue(object): - - _proxies = {'__add__': ConvertAllProxy, - '__sub__': ConvertAllProxy, - '__mul__': ConvertAllProxy, - '__rmul__': ConvertAllProxy, - '__cmp__': ConvertAllProxy, - '__lt__': ConvertAllProxy, - '__gt__': ConvertAllProxy, - '__len__': PassThroughProxy} - - def __new__(cls, value, unit): - # generate a new subclass for value - value_class = type(value) - try: - subcls = type('TaggedValue_of_%s' % (value_class.__name__), - tuple([cls, value_class]), - {}) - if subcls not in units.registry: - units.registry[subcls] = basicConverter - return object.__new__(subcls) - except TypeError: - if cls not in units.registry: - units.registry[cls] = basicConverter - return object.__new__(cls) - - def __init__(self, value, unit): - self.value = value - self.unit = unit - self.proxy_target = self.value - - def __getattribute__(self, name): - if (name.startswith('__')): - return object.__getattribute__(self, name) - variable = object.__getattribute__(self, 'value') - if (hasattr(variable, name) and name not in self.__class__.__dict__): - return getattr(variable, name) - return object.__getattribute__(self, name) - - def __array__(self, t=None, context=None): - if t is not None: - return np.asarray(self.value).astype(t) - else: - return np.asarray(self.value, 'O') - - def __array_wrap__(self, array, context): - return TaggedValue(array, self.unit) - - def __repr__(self): - return 'TaggedValue(' + repr(self.value) + ', ' + repr(self.unit) + ')' - - def __str__(self): - return str(self.value) + ' in ' + str(self.unit) - - def __len__(self): - return len(self.value) - - def __iter__(self): - class IteratorProxy(object): - def __init__(self, iter, unit): - self.iter = iter - self.unit = unit - - def __next__(self): - value = next(self.iter) - return TaggedValue(value, self.unit) - next = __next__ # for Python 2 - return IteratorProxy(iter(self.value), self.unit) - - def get_compressed_copy(self, mask): - new_value = np.ma.masked_array(self.value, mask=mask).compressed() - return TaggedValue(new_value, self.unit) - - def convert_to(self, unit): - if (unit == self.unit or not unit): - return self - new_value = self.unit.convert_value_to(self.value, unit) - return TaggedValue(new_value, unit) - - def get_value(self): - return self.value - - def get_unit(self): - return self.unit - - -TaggedValue = TaggedValueMeta('TaggedValue', (_TaggedValue, ), {}) - - -class BasicUnit(object): - def __init__(self, name, fullname=None): - self.name = name - if fullname is None: - fullname = name - self.fullname = fullname - self.conversions = dict() - - def __repr__(self): - return 'BasicUnit(%s)' % self.name - - def __str__(self): - return self.fullname - - def __call__(self, value): - return TaggedValue(value, self) - - def __mul__(self, rhs): - value = rhs - unit = self - if hasattr(rhs, 'get_unit'): - value = rhs.get_value() - unit = rhs.get_unit() - unit = unit_resolver('__mul__', (self, unit)) - if (unit == NotImplemented): - return NotImplemented - return TaggedValue(value, unit) - - def __rmul__(self, lhs): - return self*lhs - - def __array_wrap__(self, array, context): - return TaggedValue(array, self) - - def __array__(self, t=None, context=None): - ret = np.array([1]) - if t is not None: - return ret.astype(t) - else: - return ret - - def add_conversion_factor(self, unit, factor): - def convert(x): - return x*factor - self.conversions[unit] = convert - - def add_conversion_fn(self, unit, fn): - self.conversions[unit] = fn - - def get_conversion_fn(self, unit): - return self.conversions[unit] - - def convert_value_to(self, value, unit): - conversion_fn = self.conversions[unit] - ret = conversion_fn(value) - return ret - - def get_unit(self): - return self - - -class UnitResolver(object): - def addition_rule(self, units): - for unit_1, unit_2 in zip(units[:-1], units[1:]): - if (unit_1 != unit_2): - return NotImplemented - return units[0] - - def multiplication_rule(self, units): - non_null = [u for u in units if u] - if (len(non_null) > 1): - return NotImplemented - return non_null[0] - - op_dict = { - '__mul__': multiplication_rule, - '__rmul__': multiplication_rule, - '__add__': addition_rule, - '__radd__': addition_rule, - '__sub__': addition_rule, - '__rsub__': addition_rule} - - def __call__(self, operation, units): - if (operation not in self.op_dict): - return NotImplemented - - return self.op_dict[operation](self, units) - - -unit_resolver = UnitResolver() - -cm = BasicUnit('cm', 'centimeters') -inch = BasicUnit('inch', 'inches') -inch.add_conversion_factor(cm, 2.54) -cm.add_conversion_factor(inch, 1/2.54) - -radians = BasicUnit('rad', 'radians') -degrees = BasicUnit('deg', 'degrees') -radians.add_conversion_factor(degrees, 180.0/np.pi) -degrees.add_conversion_factor(radians, np.pi/180.0) - -secs = BasicUnit('s', 'seconds') -hertz = BasicUnit('Hz', 'Hertz') -minutes = BasicUnit('min', 'minutes') - -secs.add_conversion_fn(hertz, lambda x: 1./x) -secs.add_conversion_factor(minutes, 1/60.0) - - -# radians formatting -def rad_fn(x, pos=None): - n = int((x / np.pi) * 2.0 + 0.25) - if n == 0: - return '0' - elif n == 1: - return r'$\pi/2$' - elif n == 2: - return r'$\pi$' - elif n % 2 == 0: - return r'$%s\pi$' % (n//2,) - else: - return r'$%s\pi/2$' % (n,) - - -class BasicUnitConverter(units.ConversionInterface): - @staticmethod - def axisinfo(unit, axis): - 'return AxisInfo instance for x and unit' - - if unit == radians: - return units.AxisInfo( - majloc=ticker.MultipleLocator(base=np.pi/2), - majfmt=ticker.FuncFormatter(rad_fn), - label=unit.fullname, - ) - elif unit == degrees: - return units.AxisInfo( - majloc=ticker.AutoLocator(), - majfmt=ticker.FormatStrFormatter(r'$%i^\circ$'), - label=unit.fullname, - ) - elif unit is not None: - if hasattr(unit, 'fullname'): - return units.AxisInfo(label=unit.fullname) - elif hasattr(unit, 'unit'): - return units.AxisInfo(label=unit.unit.fullname) - return None - - @staticmethod - def convert(val, unit, axis): - if units.ConversionInterface.is_numlike(val): - return val - if iterable(val): - return [thisval.convert_to(unit).get_value() for thisval in val] - else: - return val.convert_to(unit).get_value() - - @staticmethod - def default_units(x, axis): - 'return the default unit for x or None' - if iterable(x): - for thisx in x: - return thisx.unit - return x.unit - - -def cos(x): - if iterable(x): - return [math.cos(val.convert_to(radians).get_value()) for val in x] - else: - return math.cos(x.convert_to(radians).get_value()) - - -basicConverter = BasicUnitConverter() -units.registry[BasicUnit] = basicConverter -units.registry[TaggedValue] = basicConverter diff --git a/mpl_examples/units/ellipse_with_units.py b/mpl_examples/units/ellipse_with_units.py deleted file mode 100644 index 2127d6c0323..00000000000 --- a/mpl_examples/units/ellipse_with_units.py +++ /dev/null @@ -1,70 +0,0 @@ -""" -Compare the ellipse generated with arcs versus a polygonal approximation -""" -from basic_units import cm -import numpy as np -from matplotlib import patches -import matplotlib.pyplot as plt - - -xcenter, ycenter = 0.38*cm, 0.52*cm -#xcenter, ycenter = 0., 0. -width, height = 1e-1*cm, 3e-1*cm -angle = -30 - -theta = np.arange(0.0, 360.0, 1.0)*np.pi/180.0 -x = 0.5 * width * np.cos(theta) -y = 0.5 * height * np.sin(theta) - -rtheta = np.radians(angle) -R = np.array([ - [np.cos(rtheta), -np.sin(rtheta)], - [np.sin(rtheta), np.cos(rtheta)], - ]) - - -x, y = np.dot(R, np.array([x, y])) -x += xcenter -y += ycenter - -fig = plt.figure() -ax = fig.add_subplot(211, aspect='auto') -ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1) - -e1 = patches.Ellipse((xcenter, ycenter), width, height, - angle=angle, linewidth=2, fill=False, zorder=2) - -ax.add_patch(e1) - -ax = fig.add_subplot(212, aspect='equal') -ax.fill(x, y, alpha=0.2, facecolor='green', edgecolor='green', zorder=1) -e2 = patches.Ellipse((xcenter, ycenter), width, height, - angle=angle, linewidth=2, fill=False, zorder=2) - - -ax.add_patch(e2) - -#fig.savefig('ellipse_compare.png') -fig.savefig('ellipse_compare') - -fig = plt.figure() -ax = fig.add_subplot(211, aspect='auto') -ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1) - -e1 = patches.Arc((xcenter, ycenter), width, height, - angle=angle, linewidth=2, fill=False, zorder=2) - -ax.add_patch(e1) - -ax = fig.add_subplot(212, aspect='equal') -ax.fill(x, y, alpha=0.2, facecolor='green', edgecolor='green', zorder=1) -e2 = patches.Arc((xcenter, ycenter), width, height, - angle=angle, linewidth=2, fill=False, zorder=2) - - -ax.add_patch(e2) - -#fig.savefig('arc_compare.png') -fig.savefig('arc_compare') - -plt.show() diff --git a/mpl_examples/units/ellipse_with_units_00.hires.png b/mpl_examples/units/ellipse_with_units_00.hires.png deleted file mode 100644 index d0b0e824ed5..00000000000 Binary files a/mpl_examples/units/ellipse_with_units_00.hires.png and /dev/null differ diff --git a/mpl_examples/units/ellipse_with_units_00.pdf b/mpl_examples/units/ellipse_with_units_00.pdf deleted file mode 100644 index 53fc48c16ab..00000000000 Binary files a/mpl_examples/units/ellipse_with_units_00.pdf and /dev/null differ diff --git a/mpl_examples/units/ellipse_with_units_00.png b/mpl_examples/units/ellipse_with_units_00.png deleted file mode 100644 index 07ba2fd65d9..00000000000 Binary files a/mpl_examples/units/ellipse_with_units_00.png and /dev/null differ diff --git a/mpl_examples/units/ellipse_with_units_01.hires.png b/mpl_examples/units/ellipse_with_units_01.hires.png deleted file mode 100644 index cb7d4f6a833..00000000000 Binary files a/mpl_examples/units/ellipse_with_units_01.hires.png and /dev/null differ diff --git a/mpl_examples/units/ellipse_with_units_01.pdf b/mpl_examples/units/ellipse_with_units_01.pdf deleted file mode 100644 index a39d32a15cb..00000000000 Binary files a/mpl_examples/units/ellipse_with_units_01.pdf and /dev/null differ diff --git a/mpl_examples/units/ellipse_with_units_01.png b/mpl_examples/units/ellipse_with_units_01.png deleted file mode 100644 index 05d3b514270..00000000000 Binary files a/mpl_examples/units/ellipse_with_units_01.png and /dev/null differ diff --git a/mpl_examples/units/evans_test.hires.png b/mpl_examples/units/evans_test.hires.png deleted file mode 100644 index ef2f6403249..00000000000 Binary files a/mpl_examples/units/evans_test.hires.png and /dev/null differ diff --git a/mpl_examples/units/evans_test.pdf b/mpl_examples/units/evans_test.pdf deleted file mode 100644 index 5c7de19ea3a..00000000000 Binary files a/mpl_examples/units/evans_test.pdf and /dev/null differ diff --git a/mpl_examples/units/evans_test.png b/mpl_examples/units/evans_test.png deleted file mode 100644 index 947f7a6914d..00000000000 Binary files a/mpl_examples/units/evans_test.png and /dev/null differ diff --git a/mpl_examples/units/evans_test.py b/mpl_examples/units/evans_test.py deleted file mode 100644 index 85b6dbef1c7..00000000000 --- a/mpl_examples/units/evans_test.py +++ /dev/null @@ -1,98 +0,0 @@ -""" -========== -Evans test -========== - -A mockup "Foo" units class which supports -conversion and different tick formatting depending on the "unit". -Here the "unit" is just a scalar conversion factor, but this example shows mpl -is entirely agnostic to what kind of units client packages use. - -""" -from matplotlib.cbook import iterable -import matplotlib.units as units -import matplotlib.ticker as ticker -import matplotlib.pyplot as plt - - -class Foo(object): - def __init__(self, val, unit=1.0): - self.unit = unit - self._val = val * unit - - def value(self, unit): - if unit is None: - unit = self.unit - return self._val / unit - - -class FooConverter(object): - @staticmethod - def axisinfo(unit, axis): - 'return the Foo AxisInfo' - if unit == 1.0 or unit == 2.0: - return units.AxisInfo( - majloc=ticker.IndexLocator(8, 0), - majfmt=ticker.FormatStrFormatter("VAL: %s"), - label='foo', - ) - - else: - return None - - @staticmethod - def convert(obj, unit, axis): - """ - convert obj using unit. If obj is a sequence, return the - converted sequence - """ - if units.ConversionInterface.is_numlike(obj): - return obj - - if iterable(obj): - return [o.value(unit) for o in obj] - else: - return obj.value(unit) - - @staticmethod - def default_units(x, axis): - 'return the default unit for x or None' - if iterable(x): - for thisx in x: - return thisx.unit - else: - return x.unit - - -units.registry[Foo] = FooConverter() - -# create some Foos -x = [] -for val in range(0, 50, 2): - x.append(Foo(val, 1.0)) - -# and some arbitrary y data -y = [i for i in range(len(x))] - - -# plot specifying units -fig = plt.figure() -fig.suptitle("Custom units") -fig.subplots_adjust(bottom=0.2) -ax = fig.add_subplot(1, 2, 2) -ax.plot(x, y, 'o', xunits=2.0) -for label in ax.get_xticklabels(): - label.set_rotation(30) - label.set_ha('right') -ax.set_title("xunits = 2.0") - - -# plot without specifying units; will use the None branch for axisinfo -ax = fig.add_subplot(1, 2, 1) -ax.plot(x, y) # uses default units -ax.set_title('default units') -for label in ax.get_xticklabels(): - label.set_rotation(30) - label.set_ha('right') - -plt.show() diff --git a/mpl_examples/units/radian_demo.hires.png b/mpl_examples/units/radian_demo.hires.png deleted file mode 100644 index 008ebb652ba..00000000000 Binary files a/mpl_examples/units/radian_demo.hires.png and /dev/null differ diff --git a/mpl_examples/units/radian_demo.pdf b/mpl_examples/units/radian_demo.pdf deleted file mode 100644 index 03b852117ba..00000000000 Binary files a/mpl_examples/units/radian_demo.pdf and /dev/null differ diff --git a/mpl_examples/units/radian_demo.png b/mpl_examples/units/radian_demo.png deleted file mode 100644 index 6d97b076180..00000000000 Binary files a/mpl_examples/units/radian_demo.png and /dev/null differ diff --git a/mpl_examples/units/radian_demo.py b/mpl_examples/units/radian_demo.py deleted file mode 100644 index 5b0d010c154..00000000000 --- a/mpl_examples/units/radian_demo.py +++ /dev/null @@ -1,26 +0,0 @@ -""" -============ -Radian ticks -============ - -Plot with radians from the basic_units mockup example package. - -This example shows how the unit class can determine the tick locating, -formatting and axis labeling. -""" -import numpy as np -from basic_units import radians, degrees, cos -from matplotlib.pyplot import figure, show - -x = [val*radians for val in np.arange(0, 15, 0.01)] - -fig = figure() -fig.subplots_adjust(hspace=0.3) - -ax = fig.add_subplot(211) -line1, = ax.plot(x, cos(x), xunits=radians) - -ax = fig.add_subplot(212) -line2, = ax.plot(x, cos(x), xunits=degrees) - -show() diff --git a/mpl_examples/units/units_sample.hires.png b/mpl_examples/units/units_sample.hires.png deleted file mode 100644 index cf1a94f162f..00000000000 Binary files a/mpl_examples/units/units_sample.hires.png and /dev/null differ diff --git a/mpl_examples/units/units_sample.pdf b/mpl_examples/units/units_sample.pdf deleted file mode 100644 index 91dee851a42..00000000000 Binary files a/mpl_examples/units/units_sample.pdf and /dev/null differ diff --git a/mpl_examples/units/units_sample.png b/mpl_examples/units/units_sample.png deleted file mode 100644 index 37c197b0b06..00000000000 Binary files a/mpl_examples/units/units_sample.png and /dev/null differ diff --git a/mpl_examples/units/units_sample.py b/mpl_examples/units/units_sample.py deleted file mode 100644 index 3057dbe05a0..00000000000 --- a/mpl_examples/units/units_sample.py +++ /dev/null @@ -1,34 +0,0 @@ -""" -====================== -Inches and Centimeters -====================== - -The example illustrates the ability to override default x and y units (ax1) to -inches and centimeters using the `xunits` and `yunits` parameters for the -`plot` function. Note that conversions are applied to get numbers to correct -units. - -""" -from basic_units import cm, inch -import matplotlib.pyplot as plt -import numpy - -cms = cm * numpy.arange(0, 10, 2) - -fig = plt.figure() - -ax1 = fig.add_subplot(2, 2, 1) -ax1.plot(cms, cms) - -ax2 = fig.add_subplot(2, 2, 2) -ax2.plot(cms, cms, xunits=cm, yunits=inch) - -ax3 = fig.add_subplot(2, 2, 3) -ax3.plot(cms, cms, xunits=inch, yunits=cm) -ax3.set_xlim(3, 6) # scalars are interpreted in current units - -ax4 = fig.add_subplot(2, 2, 4) -ax4.plot(cms, cms, xunits=inch, yunits=inch) -ax4.set_xlim(3*cm, 6*cm) # cm are converted to inches - -plt.show() diff --git a/mpl_examples/units/units_scatter.hires.png b/mpl_examples/units/units_scatter.hires.png deleted file mode 100644 index 9731ba10d3d..00000000000 Binary files a/mpl_examples/units/units_scatter.hires.png and /dev/null differ diff --git a/mpl_examples/units/units_scatter.pdf b/mpl_examples/units/units_scatter.pdf deleted file mode 100644 index dda354cf701..00000000000 Binary files a/mpl_examples/units/units_scatter.pdf and /dev/null differ diff --git a/mpl_examples/units/units_scatter.png b/mpl_examples/units/units_scatter.png deleted file mode 100644 index 710abf90353..00000000000 Binary files a/mpl_examples/units/units_scatter.png and /dev/null differ diff --git a/mpl_examples/units/units_scatter.py b/mpl_examples/units/units_scatter.py deleted file mode 100644 index 4723369943c..00000000000 --- a/mpl_examples/units/units_scatter.py +++ /dev/null @@ -1,35 +0,0 @@ -""" -============= -Unit handling -============= - -basic_units is a mockup of a true units package used for testing -purposed, which illustrates the basic interface that a units package -must provide to matplotlib. - -The example below shows support for unit conversions over masked -arrays. -""" -import numpy as np -import matplotlib.pyplot as plt -from basic_units import secs, hertz, minutes - -# create masked array -data = (1, 2, 3, 4, 5, 6, 7, 8) -mask = (1, 0, 1, 0, 0, 0, 1, 0) -xsecs = secs * np.ma.MaskedArray(data, mask, float) - -fig, (ax1, ax2, ax3) = plt.subplots(nrows=3, sharex=True) -ax1.scatter(xsecs, xsecs) -ax1.yaxis.set_units(secs) -ax1.axis([0, 10, 0, 10]) - -ax2.scatter(xsecs, xsecs, yunits=hertz) -ax2.axis([0, 10, 0, 1]) - -ax3.scatter(xsecs, xsecs, yunits=hertz) -ax3.yaxis.set_units(minutes) -ax3.axis([0, 10, 0, 1]) - -fig.tight_layout() -plt.show() diff --git a/mpl_examples/widgets/cursor.hires.png b/mpl_examples/widgets/cursor.hires.png deleted file mode 100644 index 4ab576d37d2..00000000000 Binary files a/mpl_examples/widgets/cursor.hires.png and /dev/null differ diff --git a/mpl_examples/widgets/cursor.pdf b/mpl_examples/widgets/cursor.pdf deleted file mode 100644 index 42b8399b80f..00000000000 Binary files a/mpl_examples/widgets/cursor.pdf and /dev/null differ diff --git a/mpl_examples/widgets/cursor.png b/mpl_examples/widgets/cursor.png deleted file mode 100644 index 353287d9e2f..00000000000 Binary files a/mpl_examples/widgets/cursor.png and /dev/null differ diff --git a/mpl_examples/widgets/cursor.py b/mpl_examples/widgets/cursor.py deleted file mode 100644 index 209223b72a1..00000000000 --- a/mpl_examples/widgets/cursor.py +++ /dev/null @@ -1,17 +0,0 @@ -from matplotlib.widgets import Cursor -import numpy as np -import matplotlib.pyplot as plt - - -fig = plt.figure(figsize=(8, 6)) -ax = fig.add_subplot(111, facecolor='#FFFFCC') - -x, y = 4*(np.random.rand(2, 100) - .5) -ax.plot(x, y, 'o') -ax.set_xlim(-2, 2) -ax.set_ylim(-2, 2) - -# set useblit = True on gtkagg for enhanced performance -cursor = Cursor(ax, useblit=True, color='red', linewidth=2) - -plt.show() diff --git a/mpl_examples/widgets/slider_demo.hires.png b/mpl_examples/widgets/slider_demo.hires.png deleted file mode 100644 index beb58adef2d..00000000000 Binary files a/mpl_examples/widgets/slider_demo.hires.png and /dev/null differ diff --git a/mpl_examples/widgets/slider_demo.pdf b/mpl_examples/widgets/slider_demo.pdf deleted file mode 100644 index e9f922484ed..00000000000 Binary files a/mpl_examples/widgets/slider_demo.pdf and /dev/null differ diff --git a/mpl_examples/widgets/slider_demo.png b/mpl_examples/widgets/slider_demo.png deleted file mode 100644 index 3627ef76250..00000000000 Binary files a/mpl_examples/widgets/slider_demo.png and /dev/null differ diff --git a/mpl_examples/widgets/slider_demo.py b/mpl_examples/widgets/slider_demo.py deleted file mode 100644 index 70e6cb8d1ea..00000000000 --- a/mpl_examples/widgets/slider_demo.py +++ /dev/null @@ -1,48 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.widgets import Slider, Button, RadioButtons - -fig, ax = plt.subplots() -plt.subplots_adjust(left=0.25, bottom=0.25) -t = np.arange(0.0, 1.0, 0.001) -a0 = 5 -f0 = 3 -s = a0*np.sin(2*np.pi*f0*t) -l, = plt.plot(t, s, lw=2, color='red') -plt.axis([0, 1, -10, 10]) - -axcolor = 'lightgoldenrodyellow' -axfreq = plt.axes([0.25, 0.1, 0.65, 0.03], facecolor=axcolor) -axamp = plt.axes([0.25, 0.15, 0.65, 0.03], facecolor=axcolor) - -sfreq = Slider(axfreq, 'Freq', 0.1, 30.0, valinit=f0) -samp = Slider(axamp, 'Amp', 0.1, 10.0, valinit=a0) - - -def update(val): - amp = samp.val - freq = sfreq.val - l.set_ydata(amp*np.sin(2*np.pi*freq*t)) - fig.canvas.draw_idle() -sfreq.on_changed(update) -samp.on_changed(update) - -resetax = plt.axes([0.8, 0.025, 0.1, 0.04]) -button = Button(resetax, 'Reset', color=axcolor, hovercolor='0.975') - - -def reset(event): - sfreq.reset() - samp.reset() -button.on_clicked(reset) - -rax = plt.axes([0.025, 0.5, 0.15, 0.15], facecolor=axcolor) -radio = RadioButtons(rax, ('red', 'blue', 'green'), active=0) - - -def colorfunc(label): - l.set_color(label) - fig.canvas.draw_idle() -radio.on_clicked(colorfunc) - -plt.show() diff --git a/mpl_toolkits/axes_grid/api/anchored_artists_api.html b/mpl_toolkits/axes_grid/api/anchored_artists_api.html deleted file mode 100644 index 79d1322330c..00000000000 --- a/mpl_toolkits/axes_grid/api/anchored_artists_api.html +++ /dev/null @@ -1,691 +0,0 @@ - - - - - - - - mpl_toolkits.axes_grid1.anchored_artists — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    mpl_toolkits.axes_grid1.anchored_artists

    -
    -
    -class mpl_toolkits.axes_grid1.anchored_artists.AnchoredAuxTransformBox(transform, loc, pad=0.4, borderpad=0.5, prop=None, frameon=True, **kwargs)
    -

    Bases: matplotlib.offsetbox.AnchoredOffsetbox

    -

    An anchored container with transformed coordinates.

    -

    Artists added to the drawing_area are scaled according to the -coordinates of the transformation used. The dimensions of this artist -will scale to contain the artists added.

    - --- - - - -
    Parameters:

    transform : matplotlib.transforms.Transform

    -
    -

    The transformation object for the coordinate system in use, i.e., -matplotlib.axes.Axes.transData.

    -
    -

    loc : int

    -
    -

    Location of this artist. Valid location codes are:

    -
    'upper right'  : 1,
    -'upper left'   : 2,
    -'lower left'   : 3,
    -'lower right'  : 4,
    -'right'        : 5,
    -'center left'  : 6,
    -'center right' : 7,
    -'lower center' : 8,
    -'upper center' : 9,
    -'center'       : 10
    -
    -
    -
    -

    pad : int or float, optional

    -
    -

    Padding around the child objects, in fraction of the font -size. Defaults to 0.4.

    -
    -

    borderpad : int or float, optional

    -
    -

    Border padding, in fraction of the font size. -Defaults to 0.5.

    -
    -

    prop : matplotlib.font_manager.FontProperties, optional

    -
    -

    Font property used as a reference for paddings.

    -
    -

    frameon : bool, optional

    -
    -

    If True, draw a box around this artists. Defaults to True.

    -
    -

    **kwargs :

    -
    -

    Keyworded arguments to pass to -matplotlib.offsetbox.AnchoredOffsetbox.

    -
    -
    -

    Examples

    -

    To display an ellipse in the upper left, with a width of 0.1 and -height of 0.4 in data coordinates:

    -
    >>> box = AnchoredAuxTransformBox(ax.transData, loc=2)
    ->>> el = Ellipse((0,0), width=0.1, height=0.4, angle=30)
    ->>> box.drawing_area.add_artist(el)
    ->>> ax.add_artist(box)
    -
    -
    -

    Attributes

    - ---- - - - - - -
    drawing_area(matplotlib.offsetbox.AuxTransformBox) A container for artists to display.
    -
    - -
    -
    -class mpl_toolkits.axes_grid1.anchored_artists.AnchoredDrawingArea(width, height, xdescent, ydescent, loc, pad=0.4, borderpad=0.5, prop=None, frameon=True, **kwargs)
    -

    Bases: matplotlib.offsetbox.AnchoredOffsetbox

    -

    An anchored container with a fixed size and fillable DrawingArea.

    -

    Artists added to the drawing_area will have their coordinates -interpreted as pixels. Any transformations set on the artists will be -overridden.

    - --- - - - -
    Parameters:

    width, height : int or float

    -
    -

    width and height of the container, in pixels.

    -
    -

    xdescent, ydescent : int or float

    -
    -

    descent of the container in the x- and y- direction, in pixels.

    -
    -

    loc : int

    -
    -

    Location of this artist. Valid location codes are:

    -
    'upper right'  : 1,
    -'upper left'   : 2,
    -'lower left'   : 3,
    -'lower right'  : 4,
    -'right'        : 5,
    -'center left'  : 6,
    -'center right' : 7,
    -'lower center' : 8,
    -'upper center' : 9,
    -'center'       : 10
    -
    -
    -
    -

    pad : int or float, optional

    -
    -

    Padding around the child objects, in fraction of the font -size. Defaults to 0.4.

    -
    -

    borderpad : int or float, optional

    -
    -

    Border padding, in fraction of the font size. -Defaults to 0.5.

    -
    -

    prop : matplotlib.font_manager.FontProperties, optional

    -
    -

    Font property used as a reference for paddings.

    -
    -

    frameon : bool, optional

    -
    -

    If True, draw a box around this artists. Defaults to True.

    -
    -

    **kwargs :

    -
    -

    Keyworded arguments to pass to -matplotlib.offsetbox.AnchoredOffsetbox.

    -
    -
    -

    Examples

    -

    To display blue and red circles of different sizes in the upper right -of an axes ax:

    -
    >>> ada = AnchoredDrawingArea(20, 20, 0, 0, loc=1, frameon=False)
    ->>> ada.drawing_area.add_artist(Circle((10, 10), 10, fc="b"))
    ->>> ada.drawing_area.add_artist(Circle((30, 10), 5, fc="r"))
    ->>> ax.add_artist(ada)
    -
    -
    -

    Attributes

    - ---- - - - - - -
    drawing_area(matplotlib.offsetbox.DrawingArea) A container for artists to display.
    -
    - -
    -
    -class mpl_toolkits.axes_grid1.anchored_artists.AnchoredEllipse(transform, width, height, angle, loc, pad=0.1, borderpad=0.1, prop=None, frameon=True, **kwargs)
    -

    Bases: matplotlib.offsetbox.AnchoredOffsetbox

    -

    Draw an anchored ellipse of a given size.

    - --- - - - -
    Parameters:

    transform : matplotlib.transforms.Transform

    -
    -

    The transformation object for the coordinate system in use, i.e., -matplotlib.axes.Axes.transData.

    -
    -

    width, height : int or float

    -
    -

    Width and height of the ellipse, given in coordinates of -transform.

    -
    -

    angle : int or float

    -
    -

    Rotation of the ellipse, in degrees, anti-clockwise.

    -
    -

    loc : int

    -
    -

    Location of this size bar. Valid location codes are:

    -
    'upper right'  : 1,
    -'upper left'   : 2,
    -'lower left'   : 3,
    -'lower right'  : 4,
    -'right'        : 5,
    -'center left'  : 6,
    -'center right' : 7,
    -'lower center' : 8,
    -'upper center' : 9,
    -'center'       : 10
    -
    -
    -
    -

    pad : int or float, optional

    -
    -

    Padding around the ellipse, in fraction of the font size. Defaults -to 0.1.

    -
    -

    borderpad : int or float, optional

    -
    -

    Border padding, in fraction of the font size. Defaults to 0.1.

    -
    -

    frameon : bool, optional

    -
    -

    If True, draw a box around the ellipse. Defaults to True.

    -
    -

    prop : matplotlib.font_manager.FontProperties, optional

    -
    -

    Font property used as a reference for paddings.

    -
    -

    **kwargs :

    -
    -

    Keyworded arguments to pass to -matplotlib.offsetbox.AnchoredOffsetbox.

    -
    -
    -

    Attributes

    - ---- - - - - - -
    ellipse(matplotlib.patches.Ellipse) Ellipse patch drawn.
    -
    - -
    -
    -class mpl_toolkits.axes_grid1.anchored_artists.AnchoredSizeBar(transform, size, label, loc, pad=0.1, borderpad=0.1, sep=2, frameon=True, size_vertical=0, color='black', label_top=False, fontproperties=None, **kwargs)
    -

    Bases: matplotlib.offsetbox.AnchoredOffsetbox

    -

    Draw a horizontal scale bar with a center-aligned label underneath.

    - --- - - - -
    Parameters:

    transform : matplotlib.transforms.Transform

    -
    -

    The transformation object for the coordinate system in use, i.e., -matplotlib.axes.Axes.transData.

    -
    -

    size : int or float

    -
    -

    Horizontal length of the size bar, given in coordinates of -transform.

    -
    -

    label : str

    -
    -

    Label to display.

    -
    -

    loc : int

    -
    -

    Location of this size bar. Valid location codes are:

    -
    'upper right'  : 1,
    -'upper left'   : 2,
    -'lower left'   : 3,
    -'lower right'  : 4,
    -'right'        : 5,
    -'center left'  : 6,
    -'center right' : 7,
    -'lower center' : 8,
    -'upper center' : 9,
    -'center'       : 10
    -
    -
    -
    -

    pad : int or float, optional

    -
    -

    Padding around the label and size bar, in fraction of the font -size. Defaults to 0.1.

    -
    -

    borderpad : int or float, optional

    -
    -

    Border padding, in fraction of the font size. -Defaults to 0.1.

    -
    -

    sep : int or float, optional

    -
    -

    Seperation between the label and the size bar, in points. -Defaults to 2.

    -
    -

    frameon : bool, optional

    -
    -

    If True, draw a box around the horizontal bar and label. -Defaults to True.

    -
    -

    size_vertical : int or float, optional

    -
    -

    Vertical length of the size bar, given in coordinates of -transform. Defaults to 0.

    -
    -

    color : str, optional

    -
    -

    Color for the size bar and label. -Defaults to black.

    -
    -

    label_top : bool, optional

    -
    -

    If True, the label will be over the size bar. -Defaults to False.

    -
    -

    fontproperties : matplotlib.font_manager.FontProperties, optional

    -
    -

    Font properties for the label text.

    -
    -

    **kwargs :

    -
    -

    Keyworded arguments to pass to -matplotlib.offsetbox.AnchoredOffsetbox.

    -
    -
    -

    Notes

    -

    If prop is passed as a keyworded argument, but fontproperties is -not, then prop is be assumed to be the intended fontproperties. -Using both prop and fontproperties is not supported.

    -

    Examples

    -
    >>> import matplotlib.pyplot as plt
    ->>> import numpy as np
    ->>> from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar
    ->>> fig, ax = plt.subplots()
    ->>> ax.imshow(np.random.random((10,10)))
    ->>> bar = AnchoredSizeBar(ax.transData, 3, '3 data units', 4)
    ->>> ax.add_artist(bar)
    ->>> fig.show()
    -
    -
    -

    Using all the optional parameters

    -
    >>> import matplotlib.font_manager as fm
    ->>> fontprops = fm.FontProperties(size=14, family='monospace')
    ->>> bar = AnchoredSizeBar(ax.transData, 3, '3 units', 4, pad=0.5, sep=5, borderpad=0.5, frameon=False, size_vertical=0.5, color='white', fontproperties=fontprops)
    -
    -
    -

    Attributes

    - ---- - - - - - - - - -
    size_bar(matplotlib.offsetbox.AuxTransformBox) Container for the size bar.
    txt_label(matplotlib.offsetbox.TextArea) Container for the label of the size bar.
    -
    - -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/mpl_toolkits/axes_grid/api/axes_divider_api.html b/mpl_toolkits/axes_grid/api/axes_divider_api.html deleted file mode 100644 index 1628ba67912..00000000000 --- a/mpl_toolkits/axes_grid/api/axes_divider_api.html +++ /dev/null @@ -1,806 +0,0 @@ - - - - - - - - mpl_toolkits.axes_grid.axes_divider — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    mpl_toolkits.axes_grid.axes_divider

    -
    -
    -class mpl_toolkits.axes_grid.axes_divider.Divider(fig, pos, horizontal, vertical, aspect=None, anchor='C')
    -

    This is the class that is used calculates the axes position. It -divides the given rectangular area into several -sub-rectangles. You initialize the divider by setting the -horizontal and vertical lists of sizes -(mpl_toolkits.axes_grid.axes_size) that the division will -be based on. You then use the new_locator method to create a -callable object that can be used as the axes_locator of the -axes.

    - --- - - - -
    Parameters:

    fig : Figure

    -

    pos : tuple of 4 floats

    -
    -

    position of the rectangle that will be divided

    -
    -

    horizontal : list of axes_size

    -
    -

    sizes for horizontal division

    -
    -

    vertical : list of axes_size

    -
    -

    sizes for vertical division

    -
    -

    aspect : bool

    -
    -

    if True, the overall rectangular area is reduced -so that the relative part of the horizontal and -vertical scales have the same scale.

    -
    -

    anchor : {‘C’, ‘SW’, ‘S’, ‘SE’, ‘E’, ‘NE’, ‘N’, ‘NW’, ‘W’}

    -
    -

    placement of the reduced rectangle when aspect is True

    -
    -
    -
    -
    -add_auto_adjustable_area(use_axes, pad=0.1, adjust_dirs=None)
    -
    - -
    -
    -append_size(position, size)
    -
    - -
    -
    -get_anchor()
    -

    return the anchor

    -
    - -
    -
    -get_aspect()
    -

    return aspect

    -
    - -
    -
    -get_horizontal()
    -

    return horizontal sizes

    -
    - -
    -
    -get_horizontal_sizes(renderer)
    -
    - -
    -
    -get_locator()
    -
    - -
    -
    -get_position()
    -

    return the position of the rectangle.

    -
    - -
    -
    -get_position_runtime(ax, renderer)
    -
    - -
    -
    -get_vertical()
    -

    return vertical sizes

    -
    - -
    -
    -get_vertical_sizes(renderer)
    -
    - -
    -
    -get_vsize_hsize()
    -
    - -
    -
    -locate(nx, ny, nx1=None, ny1=None, axes=None, renderer=None)
    -
    --- - - - -
    Parameters:

    nx, nx1 : int

    -
    -

    Integers specifying the column-position of the -cell. When nx1 is None, a single nx-th column is -specified. Otherwise location of columns spanning between nx -to nx1 (but excluding nx1-th column) is specified.

    -
    -

    ny, ny1 : int

    -
    -

    Same as nx and nx1, but for row positions.

    -
    -

    axes

    -

    renderer

    -
    -
    - -
    -
    -new_locator(nx, ny, nx1=None, ny1=None)
    -

    Returns a new locator -(mpl_toolkits.axes_grid.axes_divider.AxesLocator) for -specified cell.

    - --- - - - -
    Parameters:

    nx, nx1 : int

    -
    -

    Integers specifying the column-position of the -cell. When nx1 is None, a single nx-th column is -specified. Otherwise location of columns spanning between nx -to nx1 (but excluding nx1-th column) is specified.

    -
    -

    ny, ny1 : int

    -
    -

    Same as nx and nx1, but for row positions.

    -
    -
    -
    - -
    -
    -set_anchor(anchor)
    -
    --- - - - -
    Parameters:

    anchor : {‘C’, ‘SW’, ‘S’, ‘SE’, ‘E’, ‘NE’, ‘N’, ‘NW’, ‘W’}

    -
    -
    -

    anchor position

    -
    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    valuedescription
    ‘C’Center
    ‘SW’bottom left
    ‘S’bottom
    ‘SE’bottom right
    ‘E’right
    ‘NE’top right
    ‘N’top
    ‘NW’top left
    ‘W’left
    -
    -
    -
    - -
    -
    -set_aspect(aspect=False)
    -
    --- - - - -
    Parameters:aspect : bool
    -
    - -
    -
    -set_horizontal(h)
    -
    --- - - - -
    Parameters:

    h : list of axes_size

    -
    -

    sizes for horizontal division

    -
    -
    -
    - -
    -
    -set_locator(_locator)
    -
    - -
    -
    -set_position(pos)
    -

    set the position of the rectangle.

    - --- - - - -
    Parameters:

    pos : tuple of 4 floats

    -
    -

    position of the rectangle that will be divided

    -
    -
    -
    - -
    -
    -set_vertical(v)
    -
    --- - - - -
    Parameters:

    v : list of axes_size

    -
    -

    sizes for vertical division

    -
    -
    -
    - -
    - -
    -
    -class mpl_toolkits.axes_grid.axes_divider.AxesLocator(axes_divider, nx, ny, nx1=None, ny1=None)
    -

    A simple callable object, initialized with AxesDivider class, -returns the position and size of the given cell.

    - --- - - - -
    Parameters:

    axes_divider : AxesDivider

    -

    nx, nx1 : int

    -
    -

    Integers specifying the column-position of the -cell. When nx1 is None, a single nx-th column is -specified. Otherwise location of columns spanning between nx -to nx1 (but excluding nx1-th column) is specified.

    -
    -

    ny, ny1 : int

    -
    -

    Same as nx and nx1, but for row positions.

    -
    -
    -
    -
    -get_subplotspec()
    -
    - -
    - -
    -
    -class mpl_toolkits.axes_grid.axes_divider.SubplotDivider(fig, *args, **kwargs)
    -

    The Divider class whose rectangle area is specified as a subplot geometry.

    - --- - - - -
    Parameters:

    fig : matplotlib.figure.Figure

    -

    args : tuple (numRows, numCols, plotNum)

    -
    -

    The array of subplots in the figure has dimensions numRows, -numCols, and plotNum is the number of the subplot -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 -decimal integer numRows * 100 + numCols * 10 + plotNum.

    -
    -
    -
    -
    -change_geometry(numrows, numcols, num)
    -

    change subplot geometry, e.g., from 1,1,1 to 2,2,3

    -
    - -
    -
    -get_geometry()
    -

    get the subplot geometry, e.g., 2,2,3

    -
    - -
    -
    -get_position()
    -

    return the bounds of the subplot box

    -
    - -
    -
    -get_subplotspec()
    -

    get the SubplotSpec instance

    -
    - -
    -
    -set_subplotspec(subplotspec)
    -

    set the SubplotSpec instance

    -
    - -
    -
    -update_params()
    -

    update the subplot position from fig.subplotpars

    -
    - -
    - -
    -
    -class mpl_toolkits.axes_grid.axes_divider.AxesDivider(axes, xref=None, yref=None)
    -

    Divider based on the pre-existing axes.

    - --- - - - -
    Parameters:

    axes : Axes

    -

    xref

    -

    yref

    -
    -
    -
    -append_axes(position, size, pad=None, add_to_figure=True, **kwargs)
    -

    create an axes at the given position with the same height -(or width) of the main axes.

    -
    -
    -
    position
    -
    [“left”|”right”|”bottom”|”top”]
    -
    -

    size and pad should be axes_grid.axes_size compatible.

    -
    -
    - -
    -
    -new_horizontal(size, pad=None, pack_start=False, **kwargs)
    -

    Add a new axes on the right (or left) side of the main axes.

    - --- - - - -
    Parameters:

    size : axes_size or float or string

    -
    -

    A width of the axes. If float or string is given, from_any -function is used to create the size, with ref_size set to AxesX -instance of the current axes.

    -
    -

    pad : axes_size or float or string

    -
    -

    Pad between the axes. It takes same argument as size.

    -
    -

    pack_start : bool

    -
    -

    If False, the new axes is appended at the end -of the list, i.e., it became the right-most axes. If True, it is -inserted at the start of the list, and becomes the left-most axes.

    -
    -

    kwargs

    -
    -

    All extra keywords arguments are passed to the created axes. -If axes_class is given, the new axes will be created as an -instance of the given class. Otherwise, the same class of the -main axes will be used.

    -
    -
    -
    - -
    -
    -new_vertical(size, pad=None, pack_start=False, **kwargs)
    -

    Add a new axes on the top (or bottom) side of the main axes.

    - --- - - - -
    Parameters:

    size : axes_size or float or string

    -
    -

    A height of the axes. If float or string is given, from_any -function is used to create the size, with ref_size set to AxesX -instance of the current axes.

    -
    -

    pad : axes_size or float or string

    -
    -

    Pad between the axes. It takes same argument as size.

    -
    -

    pack_start : bool

    -
    -

    If False, the new axes is appended at the end -of the list, i.e., it became the right-most axes. If True, it is -inserted at the start of the list, and becomes the left-most axes.

    -
    -

    kwargs

    -
    -

    All extra keywords arguments are passed to the created axes. -If axes_class is given, the new axes will be created as an -instance of the given class. Otherwise, the same class of the -main axes will be used.

    -
    -
    -
    - -
    - -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/mpl_toolkits/axes_grid/api/axes_grid_api.html b/mpl_toolkits/axes_grid/api/axes_grid_api.html deleted file mode 100644 index 8a4a438aa2f..00000000000 --- a/mpl_toolkits/axes_grid/api/axes_grid_api.html +++ /dev/null @@ -1,467 +0,0 @@ - - - - - - - - mpl_toolkits.axes_grid.axes_grid — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    mpl_toolkits.axes_grid.axes_grid

    -
    -
    -class mpl_toolkits.axes_grid.axes_grid.Grid(fig, rect, nrows_ncols, ngrids=None, direction='row', axes_pad=0.02, add_all=True, share_all=False, share_x=True, share_y=True, label_mode='L', axes_class=None)
    -

    Build an Grid instance with a grid nrows*ncols -Axes in -Figure fig with -rect=[left, bottom, width, height] (in -Figure coordinates) or -the subplot position code (e.g., “121”).

    -

    Optional keyword arguments:

    -
    -
    ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeywordDefaultDescription
    direction“row”[ “row” | “column” ]
    axes_pad0.02float| pad between axes given in inches -or tuple-like of floats, -(horizontal padding, vertical padding)
    add_allTrue[ True | False ]
    share_allFalse[ True | False ]
    share_xTrue[ True | False ]
    share_yTrue[ True | False ]
    label_mode“L”[ “L” | “1” | “all” ]
    axes_classNonea type object which must be a subclass -of Axes
    -
    -
    - -
    -
    -class mpl_toolkits.axes_grid.axes_grid.ImageGrid(fig, rect, nrows_ncols, ngrids=None, direction='row', axes_pad=0.02, add_all=True, share_all=False, aspect=True, label_mode='L', cbar_mode=None, cbar_location='right', cbar_pad=None, cbar_size='5%', cbar_set_cax=True, axes_class=None)
    -

    Build an ImageGrid instance with a grid nrows*ncols -Axes in -Figure fig with -rect=[left, bottom, width, height] (in -Figure coordinates) or -the subplot position code (e.g., “121”).

    -

    Optional keyword arguments:

    -
    -
    ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeywordDefaultDescription
    direction“row”[ “row” | “column” ]
    axes_pad0.02float| pad between axes given in inches -or tuple-like of floats, -(horizontal padding, vertical padding)
    add_allTrue[ True | False ]
    share_allFalse[ True | False ]
    aspectTrue[ True | False ]
    label_mode“L”[ “L” | “1” | “all” ]
    cbar_modeNone[ “each” | “single” | “edge” ]
    cbar_location“right”[ “left” | “right” | “bottom” | “top” ]
    cbar_padNone 
    cbar_size“5%” 
    cbar_set_caxTrue[ True | False ]
    axes_classNonea type object which must be a subclass -of axes_grid’s subclass of -Axes
    -
    -
    -
    cbar_set_cax : if True, each axes in the grid has a cax
    -
    attribute that is bind to associated cbar_axes.
    -
    -
    - -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/mpl_toolkits/axes_grid/api/axes_size_api.html b/mpl_toolkits/axes_grid/api/axes_size_api.html deleted file mode 100644 index 4e1c2cad85d..00000000000 --- a/mpl_toolkits/axes_grid/api/axes_size_api.html +++ /dev/null @@ -1,386 +0,0 @@ - - - - - - - - mpl_toolkits.axes_grid.axes_size — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    mpl_toolkits.axes_grid.axes_size

    -
    -
    -class mpl_toolkits.axes_grid.axes_size.Fixed(fixed_size)
    -

    Simple fixed size with absolute part = fixed_size and relative part = 0

    -
    - -
    -
    -class mpl_toolkits.axes_grid.axes_size.Scaled(scalable_size)
    -

    Simple scaled(?) size with absolute part = 0 and relative part = scalable_size

    -
    - -
    -
    -class mpl_toolkits.axes_grid.axes_size.AxesX(axes, aspect=1.0, ref_ax=None)
    -

    Scaled size whose relative part corresponds to the data width -of the axes multiplied by the aspect.

    -
    - -
    -
    -class mpl_toolkits.axes_grid.axes_size.AxesY(axes, aspect=1.0, ref_ax=None)
    -

    Scaled size whose relative part corresponds to the data height -of the axes multiplied by the aspect.

    -
    - -
    -
    -class mpl_toolkits.axes_grid.axes_size.MaxWidth(artist_list)
    -

    Size whose absolute part is the largest width of -the given artist_list.

    -
    - -
    -
    -class mpl_toolkits.axes_grid.axes_size.MaxHeight(artist_list)
    -

    Size whose absolute part is the largest height of -the given artist_list.

    -
    - -
    -
    -class mpl_toolkits.axes_grid.axes_size.Fraction(fraction, ref_size)
    -

    An instance whose size is a fraction of the ref_size.

    -
    >>> s = Fraction(0.3, AxesX(ax))
    -
    -
    -
    - -
    -
    -class mpl_toolkits.axes_grid.axes_size.Padded(size, pad)
    -

    Return a instance where the absolute part of size is -increase by the amount of pad.

    -
    - -
    -
    -mpl_toolkits.axes_grid.axes_size.from_any(size, fraction_ref=None)
    -

    Creates Fixed unit when the first argument is a float, or a -Fraction unit if that is a string that ends with %. The second -argument is only meaningful when Fraction unit is created.:

    -
    >>> a = Size.from_any(1.2) # => Size.Fixed(1.2)
    ->>> Size.from_any("50%", a) # => Size.Fraction(0.5, a)
    -
    -
    -
    - -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/mpl_toolkits/axes_grid/api/axis_artist_api.html b/mpl_toolkits/axes_grid/api/axis_artist_api.html deleted file mode 100644 index 444cf5321a9..00000000000 --- a/mpl_toolkits/axes_grid/api/axis_artist_api.html +++ /dev/null @@ -1,684 +0,0 @@ - - - - - - - - mpl_toolkits.axes_grid.axis_artist — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    mpl_toolkits.axes_grid.axis_artist

    -
    -
    -class mpl_toolkits.axes_grid.axis_artist.AxisArtist(axes, helper, offset=None, axis_direction='bottom', **kw)
    -

    An artist which draws axis (a line along which the n-th axes coord -is constant) line, ticks, ticklabels, and axis label.

    -

    axes : axes -helper : an AxisArtistHelper instance.

    -
    -
    -LABELPAD
    -
    - -
    -
    -ZORDER = 2.5
    -
    - -
    -
    -draw(artist, renderer, *args, **kwargs)
    -

    Draw the axis lines, tick lines and labels

    -
    - -
    -
    -get_axisline_style()
    -

    return the current axisline style.

    -
    - -
    -
    -get_helper()
    -

    Return axis artist helper instance.

    -
    - -
    -
    -get_tightbbox(renderer)
    -
    - -
    -
    -get_transform()
    -
    - -
    -
    -invert_ticklabel_direction()
    -
    - -
    -
    -set_axis_direction(axis_direction)
    -

    Adjust the direction, text angle, text alignment of -ticklabels, labels following the matplotlib convention for -the rectangle axes.

    -

    The axis_direction must be one of [left, right, bottom, -top].

    - ------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    propertyleftbottomrighttop
    ticklabels location“-““+”“+”“-“
    axislabel location“-““+”“+”“-“
    ticklabels angle900-90180
    ticklabel vacenterbaselinecenterbaseline
    ticklabel harightcenterrightcenter
    axislabel angle18000180
    axislabel vacentertopcenterbottom
    axislabel harightcenterrightcenter
    -

    Note that the direction “+” and “-” are relative to the direction of -the increasing coordinate. Also, the text angles are actually -relative to (90 + angle of the direction to the ticklabel), -which gives 0 for bottom axis.

    -
    - -
    -
    -set_axislabel_direction(label_direction)
    -

    Adjust the direction of the axislabel.

    -
    -
    ACCEPTS: [ “+” | “-” ]
    -

    Note that the label_direction ‘+’ and ‘-‘ are relative to the -direction of the increasing coordinate.

    -
    - -
    -
    -set_axisline_style(axisline_style=None, **kw)
    -

    Set the axisline style.

    -
    -
    axisline_style can be a string with axisline style name with optional
    -

    comma-separated attributes. Alternatively, the attrs can -be provided as keywords.

    -

    set_arrowstyle(“->,size=1.5”) -set_arrowstyle(“->”, size=1.5)

    -
    -
    -

    Old attrs simply are forgotten.

    -

    Without argument (or with arrowstyle=None), return -available styles as a list of strings.

    -
    - -
    -
    -set_label(s)
    -
    - -
    -
    -set_ticklabel_direction(tick_direction)
    -

    Adjust the direction of the ticklabel.

    -
    -
    ACCEPTS: [ “+” | “-” ]
    -

    Note that the label_direction ‘+’ and ‘-‘ are relative to the -direction of the increasing coordinate.

    -
    - -
    -
    -toggle(all=None, ticks=None, ticklabels=None, label=None)
    -

    Toggle visibility of ticks, ticklabels, and (axis) label. -To turn all off,

    -
    axis.toggle(all=False)
    -
    -
    -

    To turn all off but ticks on

    -
    axis.toggle(all=False, ticks=True)
    -
    -
    -

    To turn all on but (axis) label off

    -
    axis.toggle(all=True, label=False))
    -
    -
    -
    - -
    - -
    -
    -class mpl_toolkits.axes_grid.axis_artist.Ticks(ticksize, tick_out=False, **kwargs)
    -

    Ticks are derived from Line2D, and note that ticks themselves -are markers. Thus, you should use set_mec, set_mew, etc.

    -

    To change the tick size (length), you need to use -set_ticksize. To change the direction of the ticks (ticks are -in opposite direction of ticklabels by default), use -set_tick_out(False).

    -
    -
    -get_tick_out()
    -

    Return True if the tick will be rotated by 180 degree.

    -
    - -
    -
    -get_ticksize()
    -

    Return length of the ticks in points.

    -
    - -
    -
    -set_tick_out(b)
    -

    set True if tick need to be rotated by 180 degree.

    -
    - -
    -
    -set_ticksize(ticksize)
    -

    set length of the ticks in points.

    -
    - -
    - -
    -
    -class mpl_toolkits.axes_grid.axis_artist.AxisLabel(*kl, **kwargs)
    -

    Axis Label. Derived from Text. The position of the text is updated -in the fly, so changing text position has no effect. Otherwise, the -properties can be changed as a normal Text.

    -

    To change the pad between ticklabels and axis label, use set_pad.

    -
    -
    -get_pad()
    -

    return pad in points. See set_pad for more details.

    -
    - -
    -
    -set_axis_direction(d)
    -

    Adjust the text angle and text alignment of axis label -according to the matplotlib convention.

    - ------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    propertyleftbottomrighttop
    axislabel angle18000180
    axislabel vacentertopcenterbottom
    axislabel harightcenterrightcenter
    -

    Note that the text angles are actually relative to (90 + angle -of the direction to the ticklabel), which gives 0 for bottom -axis.

    -
    - -
    -
    -set_pad(pad)
    -

    Set the pad in points. Note that the actual pad will be the -sum of the internal pad and the external pad (that are set -automatically by the AxisArtist), and it only set the internal -pad

    -
    - -
    - -
    -
    -class mpl_toolkits.axes_grid.axis_artist.TickLabels(**kwargs)
    -

    Tick Labels. While derived from Text, this single artist draws all -ticklabels. As in AxisLabel, the position of the text is updated -in the fly, so changing text position has no effect. Otherwise, -the properties can be changed as a normal Text. Unlike the -ticklabels of the mainline matplotlib, properties of single -ticklabel alone cannot modified.

    -

    To change the pad between ticks and ticklabels, use set_pad.

    -
    -
    -get_texts_widths_heights_descents(renderer)
    -

    return a list of width, height, descent for ticklabels.

    -
    - -
    -
    -set_axis_direction(label_direction)
    -

    Adjust the text angle and text alignment of ticklabels -according to the matplotlib convention.

    -

    The label_direction must be one of [left, right, bottom, -top].

    - ------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    propertyleftbottomrighttop
    ticklabels angle900-90180
    ticklabel vacenterbaselinecenterbaseline
    ticklabel harightcenterrightcenter
    -

    Note that the text angles are actually relative to (90 + angle -of the direction to the ticklabel), which gives 0 for bottom -axis.

    -
    - -
    - -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/mpl_toolkits/axes_grid/api/index.html b/mpl_toolkits/axes_grid/api/index.html deleted file mode 100644 index 8fabf77decd..00000000000 --- a/mpl_toolkits/axes_grid/api/index.html +++ /dev/null @@ -1,358 +0,0 @@ - - - - - - - - The Matplotlib AxesGrid Toolkit API — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -

    Table Of Contents

    - - -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    The Matplotlib AxesGrid Toolkit API

    - --- - - - - - -
    Release:2.0.2
    Date:May 10, 2017
    - -
    -
    -

    The Matplotlib axes_grid1 Toolkit API

    - --- - - - - - -
    Release:2.0.2
    Date:May 10, 2017
    - -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/mpl_toolkits/axes_grid/api/inset_locator_api.html b/mpl_toolkits/axes_grid/api/inset_locator_api.html deleted file mode 100644 index 661dfd0ee3a..00000000000 --- a/mpl_toolkits/axes_grid/api/inset_locator_api.html +++ /dev/null @@ -1,1541 +0,0 @@ - - - - - - - - mpl_toolkits.axes_grid1.inset_locator — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    mpl_toolkits.axes_grid1.inset_locator

    -

    A collection of functions and objects for creating or placing inset axes.

    -
    -
    -class mpl_toolkits.axes_grid1.inset_locator.AnchoredLocatorBase(bbox_to_anchor, offsetbox, loc, borderpad=0.5, bbox_transform=None)
    -

    Bases: matplotlib.offsetbox.AnchoredOffsetbox

    -
    -
    -draw(renderer)
    -
    - -
    - -
    -
    -class mpl_toolkits.axes_grid1.inset_locator.AnchoredSizeLocator(bbox_to_anchor, x_size, y_size, loc, borderpad=0.5, bbox_transform=None)
    -

    Bases: mpl_toolkits.axes_grid1.inset_locator.AnchoredLocatorBase

    -
    -
    -get_extent(renderer)
    -
    - -
    - -
    -
    -class mpl_toolkits.axes_grid1.inset_locator.AnchoredZoomLocator(parent_axes, zoom, loc, borderpad=0.5, bbox_to_anchor=None, bbox_transform=None)
    -

    Bases: mpl_toolkits.axes_grid1.inset_locator.AnchoredLocatorBase

    -
    -
    -get_extent(renderer)
    -
    - -
    - -
    -
    -class mpl_toolkits.axes_grid1.inset_locator.BboxConnector(bbox1, bbox2, loc1, loc2=None, **kwargs)
    -

    Bases: matplotlib.patches.Patch

    -

    Connect two bboxes with a straight line.

    - --- - - - -
    Parameters:

    bbox1, bbox2 : matplotlib.transforms.Bbox

    -
    -

    Bounding boxes to connect.

    -
    -

    loc1 : {1, 2, 3, 4}

    -
    -

    Corner of bbox1 to draw the line. Valid values are:

    -
    'upper right'  : 1,
    -'upper left'   : 2,
    -'lower left'   : 3,
    -'lower right'  : 4
    -
    -
    -
    -

    loc2 : {1, 2, 3, 4}, optional

    -
    -

    Corner of bbox2 to draw the line. If None, defaults to loc1. -Valid values are:

    -
    'upper right'  : 1,
    -'upper left'   : 2,
    -'lower left'   : 3,
    -'lower right'  : 4
    -
    -
    -
    -

    **kwargs

    -
    -
    -

    Patch properties for the line drawn. Valid arguments include:

    -
    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PropertyDescription
    agg_filterunknown
    alphafloat or None
    animated[True | False]
    antialiased or aa[True | False] or None for default
    axesan Axes instance
    capstyle[‘butt’ | ‘round’ | ‘projecting’]
    clip_boxa matplotlib.transforms.Bbox instance
    clip_on[True | False]
    clip_path[ (Path, Transform) | Patch | None ]
    colormatplotlib color spec
    containsa callable function
    edgecolor or ecmpl color spec, None, ‘none’, or ‘auto’
    facecolor or fcmpl color spec, or None for default, or ‘none’ for no color
    figurea matplotlib.figure.Figure instance
    fill[True | False]
    gidan id string
    hatch[‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
    joinstyle[‘miter’ | ‘round’ | ‘bevel’]
    labelstring or anything printable with ‘%s’ conversion.
    linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
    linewidth or lwfloat or None for default
    path_effectsunknown
    picker[None|float|boolean|callable]
    rasterized[True | False | None]
    sketch_paramsunknown
    snapunknown
    transformTransform instance
    urla url string
    visible[True | False]
    zorderany number
    -
    -
    -
    -
    -static connect_bbox(bbox1, bbox2, loc1, loc2=None)
    -

    Helper function to obtain a Path from one bbox to another.

    - --- - - - - - -
    Parameters:

    bbox1, bbox2 : matplotlib.transforms.Bbox

    -
    -

    Bounding boxes to connect.

    -
    -

    loc1 : {1, 2, 3, 4}

    -
    -

    Corner of bbox1 to use. Valid values are:

    -
    'upper right'  : 1,
    -'upper left'   : 2,
    -'lower left'   : 3,
    -'lower right'  : 4
    -
    -
    -
    -

    loc2 : {1, 2, 3, 4}, optional

    -
    -

    Corner of bbox2 to use. If None, defaults to loc1. -Valid values are:

    -
    'upper right'  : 1,
    -'upper left'   : 2,
    -'lower left'   : 3,
    -'lower right'  : 4
    -
    -
    -
    -
    Returns:

    path : matplotlib.path.Path

    -
    -

    A line segment from the loc1 corner of bbox1 to the loc2 -corner of bbox2.

    -
    -
    -
    - -
    -
    -static get_bbox_edge_pos(bbox, loc)
    -

    Helper function to obtain the location of a corner of a bbox

    - --- - - - - - -
    Parameters:

    bbox : matplotlib.transforms.Bbox

    -

    loc : {1, 2, 3, 4}

    -
    -

    Corner of bbox. Valid values are:

    -
    'upper right'  : 1,
    -'upper left'   : 2,
    -'lower left'   : 3,
    -'lower right'  : 4
    -
    -
    -
    -
    Returns:

    x, y : float

    -
    -

    Coordinates of the corner specified by loc.

    -
    -
    -
    - -
    -
    -get_path()
    -

    Return the path of this patch

    -
    - -
    - -
    -
    -class mpl_toolkits.axes_grid1.inset_locator.BboxConnectorPatch(bbox1, bbox2, loc1a, loc2a, loc1b, loc2b, **kwargs)
    -

    Bases: mpl_toolkits.axes_grid1.inset_locator.BboxConnector

    -

    Connect two bboxes with a quadrilateral.

    -

    The quadrilateral is specified by two lines that start and end at corners -of the bboxes. The four sides of the quadrilateral are defined by the two -lines given, the line between the two corners specified in bbox1 and the -line between the two corners specified in bbox2.

    - --- - - - -
    Parameters:

    bbox1, bbox2 : matplotlib.transforms.Bbox

    -
    -

    Bounding boxes to connect.

    -
    -

    loc1a, loc2a : {1, 2, 3, 4}

    -
    -

    Corners of bbox1 and bbox2 to draw the first line. -Valid values are:

    -
    'upper right'  : 1,
    -'upper left'   : 2,
    -'lower left'   : 3,
    -'lower right'  : 4
    -
    -
    -
    -

    loc1b, loc2b : {1, 2, 3, 4}

    -
    -

    Corners of bbox1 and bbox2 to draw the second line. -Valid values are:

    -
    'upper right'  : 1,
    -'upper left'   : 2,
    -'lower left'   : 3,
    -'lower right'  : 4
    -
    -
    -
    -

    **kwargs

    -
    -
    -

    Patch properties for the line drawn:

    -
    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PropertyDescription
    agg_filterunknown
    alphafloat or None
    animated[True | False]
    antialiased or aa[True | False] or None for default
    axesan Axes instance
    capstyle[‘butt’ | ‘round’ | ‘projecting’]
    clip_boxa matplotlib.transforms.Bbox instance
    clip_on[True | False]
    clip_path[ (Path, Transform) | Patch | None ]
    colormatplotlib color spec
    containsa callable function
    edgecolor or ecmpl color spec, None, ‘none’, or ‘auto’
    facecolor or fcmpl color spec, or None for default, or ‘none’ for no color
    figurea matplotlib.figure.Figure instance
    fill[True | False]
    gidan id string
    hatch[‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
    joinstyle[‘miter’ | ‘round’ | ‘bevel’]
    labelstring or anything printable with ‘%s’ conversion.
    linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
    linewidth or lwfloat or None for default
    path_effectsunknown
    picker[None|float|boolean|callable]
    rasterized[True | False | None]
    sketch_paramsunknown
    snapunknown
    transformTransform instance
    urla url string
    visible[True | False]
    zorderany number
    -
    -
    -
    -
    -get_path()
    -

    Return the path of this patch

    -
    - -
    - -
    -
    -class mpl_toolkits.axes_grid1.inset_locator.BboxPatch(bbox, **kwargs)
    -

    Bases: matplotlib.patches.Patch

    -

    Patch showing the shape bounded by a Bbox.

    - --- - - - -
    Parameters:

    bbox : matplotlib.transforms.Bbox

    -
    -

    Bbox to use for the extents of this patch.

    -
    -

    **kwargs

    -
    -
    -

    Patch properties. Valid arguments include:

    -
    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PropertyDescription
    agg_filterunknown
    alphafloat or None
    animated[True | False]
    antialiased or aa[True | False] or None for default
    axesan Axes instance
    capstyle[‘butt’ | ‘round’ | ‘projecting’]
    clip_boxa matplotlib.transforms.Bbox instance
    clip_on[True | False]
    clip_path[ (Path, Transform) | Patch | None ]
    colormatplotlib color spec
    containsa callable function
    edgecolor or ecmpl color spec, None, ‘none’, or ‘auto’
    facecolor or fcmpl color spec, or None for default, or ‘none’ for no color
    figurea matplotlib.figure.Figure instance
    fill[True | False]
    gidan id string
    hatch[‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
    joinstyle[‘miter’ | ‘round’ | ‘bevel’]
    labelstring or anything printable with ‘%s’ conversion.
    linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
    linewidth or lwfloat or None for default
    path_effectsunknown
    picker[None|float|boolean|callable]
    rasterized[True | False | None]
    sketch_paramsunknown
    snapunknown
    transformTransform instance
    urla url string
    visible[True | False]
    zorderany number
    -
    -
    -
    -
    -get_path()
    -

    Return the path of this patch

    -
    - -
    - -
    -
    -class mpl_toolkits.axes_grid1.inset_locator.InsetPosition(parent, lbwh)
    -

    Bases: object

    -

    An object for positioning an inset axes.

    -

    This is created by specifying the normalized coordinates in the axes, -instead of the figure.

    - --- - - - -
    Parameters:

    parent : matplotlib.axes.Axes

    -
    -

    Axes to use for normalizing coordinates.

    -
    -

    lbwh : iterable of four floats

    -
    -

    The left edge, bottom edge, width, and height of the inset axes, in -units of the normalized coordinate of the parent axes.

    -
    -
    - -

    Examples

    -

    The following bounds the inset axes to a box with 20% of the parent -axes’s height and 40% of the width. The size of the axes specified -([0, 0, 1, 1]) ensures that the axes completely fills the bounding box:

    -
    >>> parent_axes = plt.gca()
    ->>> ax_ins = plt.axes([0, 0, 1, 1])
    ->>> ip = InsetPosition(ax, [0.5, 0.1, 0.4, 0.2])
    ->>> ax_ins.set_axes_locator(ip)
    -
    -
    -
    - -
    -
    -mpl_toolkits.axes_grid1.inset_locator.inset_axes(parent_axes, width, height, loc=1, bbox_to_anchor=None, bbox_transform=None, axes_class=None, axes_kwargs=None, borderpad=0.5)
    -

    Create an inset axes with a given width and height.

    -

    Both sizes used can be specified either in inches or percentage of the -parent axes.

    - --- - - - - - -
    Parameters:

    parent_axes : matplotlib.axes.Axes

    -
    -

    Axes to place the inset axes.

    -
    -

    width, height : float or str

    -
    -

    Size of the inset axes to create.

    -
    -

    loc : int or string, optional, default to 1

    -
    -

    Location to place the inset axes. The valid locations are:

    -
    'upper right'  : 1,
    -'upper left'   : 2,
    -'lower left'   : 3,
    -'lower right'  : 4,
    -'right'        : 5,
    -'center left'  : 6,
    -'center right' : 7,
    -'lower center' : 8,
    -'upper center' : 9,
    -'center'       : 10
    -
    -
    -
    -

    bbox_to_anchor : tuple or matplotlib.transforms.BboxBase, optional

    -
    -

    Bbox that the inset axes will be anchored. Can be a tuple of -[left, bottom, width, height], or a tuple of [left, bottom].

    -
    -

    bbox_transform : matplotlib.transforms.Transform, optional

    -
    -

    Transformation for the bbox. if None, parent_axes.transAxes is used.

    -
    -

    axes_class : matplotlib.axes.Axes type, optional

    -
    -

    If specified, the inset axes created with be created with this class’s -constructor.

    -
    -

    axes_kwargs : dict, optional

    -
    -
    -

    Keyworded arguments to pass to the constructor of the inset axes. -Valid arguments include:

    -
    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PropertyDescription
    adjustable[ ‘box’ | ‘datalim’ | ‘box-forced’]
    agg_filterunknown
    alphafloat (0.0 transparent through 1.0 opaque)
    anchorunknown
    animated[True | False]
    aspectunknown
    autoscale_onunknown
    autoscalex_onunknown
    autoscaley_onunknown
    axesan Axes instance
    axes_locatorunknown
    axisbelow[ True | False | ‘line’ ]
    clip_boxa matplotlib.transforms.Bbox instance
    clip_on[True | False]
    clip_path[ (Path, Transform) | Patch | None ]
    color_cycleunknown
    containsa callable function
    facecolorunknown
    fcunknown
    figureunknown
    frame_on[ True | False ]
    gidan id string
    labelstring or anything printable with ‘%s’ conversion.
    navigate[ True | False ]
    navigate_modeunknown
    path_effectsunknown
    picker[None|float|boolean|callable]
    positionunknown
    rasterization_zorderunknown
    rasterized[True | False | None]
    sketch_paramsunknown
    snapunknown
    titleunknown
    transformTransform instance
    urla url string
    visible[True | False]
    xboundunknown
    xlabelunknown
    xlimunknown
    xmarginunknown
    xscale[‘linear’ | ‘log’ | ‘logit’ | ‘symlog’]
    xticklabelssequence of strings
    xtickssequence of floats
    yboundunknown
    ylabelunknown
    ylimunknown
    ymarginunknown
    yscale[‘linear’ | ‘log’ | ‘logit’ | ‘symlog’]
    yticklabelssequence of strings
    ytickssequence of floats
    zorderany number
    -
    -

    borderpad : float, optional

    -
    -

    Padding between inset axes and the bbox_to_anchor. Defaults to 0.5.

    -
    -
    Returns:

    inset_axes : axes_class

    -
    -

    Inset axes object created.

    -
    -
    -
    - -
    -
    -mpl_toolkits.axes_grid1.inset_locator.mark_inset(parent_axes, inset_axes, loc1, loc2, **kwargs)
    -

    Draw a box to mark the location of an area represented by an inset axes.

    -

    This function draws a box in parent_axes at the bounding box of -inset_axes, and shows a connection with the inset axes by drawing lines -at the corners, giving a “zoomed in” effect.

    - --- - - - - - -
    Parameters:

    parent_axes : matplotlib.axes.Axes

    -
    -

    Axes which contains the area of the inset axes.

    -
    -

    inset_axes : matplotlib.axes.Axes

    -
    -

    The inset axes.

    -
    -

    loc1, loc2 : {1, 2, 3, 4}

    -
    -

    Corners to use for connecting the inset axes and the area in the -parent axes.

    -
    -

    **kwargs

    -
    -
    -

    Patch properties for the lines and box drawn:

    -
    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PropertyDescription
    agg_filterunknown
    alphafloat or None
    animated[True | False]
    antialiased or aa[True | False] or None for default
    axesan Axes instance
    capstyle[‘butt’ | ‘round’ | ‘projecting’]
    clip_boxa matplotlib.transforms.Bbox instance
    clip_on[True | False]
    clip_path[ (Path, Transform) | Patch | None ]
    colormatplotlib color spec
    containsa callable function
    edgecolor or ecmpl color spec, None, ‘none’, or ‘auto’
    facecolor or fcmpl color spec, or None for default, or ‘none’ for no color
    figurea matplotlib.figure.Figure instance
    fill[True | False]
    gidan id string
    hatch[‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
    joinstyle[‘miter’ | ‘round’ | ‘bevel’]
    labelstring or anything printable with ‘%s’ conversion.
    linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
    linewidth or lwfloat or None for default
    path_effectsunknown
    picker[None|float|boolean|callable]
    rasterized[True | False | None]
    sketch_paramsunknown
    snapunknown
    transformTransform instance
    urla url string
    visible[True | False]
    zorderany number
    -
    -
    Returns:

    pp : matplotlib.patches.Patch

    -
    -

    The patch drawn to represent the area of the inset axes.

    -
    -

    p1, p2 : matplotlib.patches.Patch

    -
    -

    The patches connecting two corners of the inset axes and its area.

    -
    -
    -
    - -
    -
    -mpl_toolkits.axes_grid1.inset_locator.zoomed_inset_axes(parent_axes, zoom, loc=1, bbox_to_anchor=None, bbox_transform=None, axes_class=None, axes_kwargs=None, borderpad=0.5)
    -

    Create an anchored inset axes by scaling a parent axes.

    - --- - - - - - -
    Parameters:

    parent_axes : matplotlib.axes.Axes

    -
    -

    Axes to place the inset axes.

    -
    -

    zoom : float

    -
    -

    Scaling factor of the data axes. zoom > 1 will enlargen the -coordinates (i.e., “zoomed in”), while zoom < 1 will shrink the -coordinates (i.e., “zoomed out”).

    -
    -

    loc : int or string, optional, default to 1

    -
    -

    Location to place the inset axes. The valid locations are:

    -
    'upper right'  : 1,
    -'upper left'   : 2,
    -'lower left'   : 3,
    -'lower right'  : 4,
    -'right'        : 5,
    -'center left'  : 6,
    -'center right' : 7,
    -'lower center' : 8,
    -'upper center' : 9,
    -'center'       : 10
    -
    -
    -
    -

    bbox_to_anchor : tuple or matplotlib.transforms.BboxBase, optional

    -
    -

    Bbox that the inset axes will be anchored. Can be a tuple of -[left, bottom, width, height], or a tuple of [left, bottom].

    -
    -

    bbox_transform : matplotlib.transforms.Transform, optional

    -
    -

    Transformation for the bbox. if None, parent_axes.transAxes is used.

    -
    -

    axes_class : matplotlib.axes.Axes type, optional

    -
    -

    If specified, the inset axes created with be created with this class’s -constructor.

    -
    -

    axes_kwargs : dict, optional

    -
    -
    -

    Keyworded arguments to pass to the constructor of the inset axes. -Valid arguments include:

    -
    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PropertyDescription
    adjustable[ ‘box’ | ‘datalim’ | ‘box-forced’]
    agg_filterunknown
    alphafloat (0.0 transparent through 1.0 opaque)
    anchorunknown
    animated[True | False]
    aspectunknown
    autoscale_onunknown
    autoscalex_onunknown
    autoscaley_onunknown
    axesan Axes instance
    axes_locatorunknown
    axisbelow[ True | False | ‘line’ ]
    clip_boxa matplotlib.transforms.Bbox instance
    clip_on[True | False]
    clip_path[ (Path, Transform) | Patch | None ]
    color_cycleunknown
    containsa callable function
    facecolorunknown
    fcunknown
    figureunknown
    frame_on[ True | False ]
    gidan id string
    labelstring or anything printable with ‘%s’ conversion.
    navigate[ True | False ]
    navigate_modeunknown
    path_effectsunknown
    picker[None|float|boolean|callable]
    positionunknown
    rasterization_zorderunknown
    rasterized[True | False | None]
    sketch_paramsunknown
    snapunknown
    titleunknown
    transformTransform instance
    urla url string
    visible[True | False]
    xboundunknown
    xlabelunknown
    xlimunknown
    xmarginunknown
    xscale[‘linear’ | ‘log’ | ‘logit’ | ‘symlog’]
    xticklabelssequence of strings
    xtickssequence of floats
    yboundunknown
    ylabelunknown
    ylimunknown
    ymarginunknown
    yscale[‘linear’ | ‘log’ | ‘logit’ | ‘symlog’]
    yticklabelssequence of strings
    ytickssequence of floats
    zorderany number
    -
    -

    borderpad : float, optional

    -
    -

    Padding between inset axes and the bbox_to_anchor. Defaults to 0.5.

    -
    -
    Returns:

    inset_axes : axes_class

    -
    -

    Inset axes object created.

    -
    -
    -
    - -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/mpl_toolkits/axes_grid/examples/demo_axes_grid.hires.png b/mpl_toolkits/axes_grid/examples/demo_axes_grid.hires.png deleted file mode 100644 index d5c34bcf391..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/demo_axes_grid.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/demo_axes_grid.pdf b/mpl_toolkits/axes_grid/examples/demo_axes_grid.pdf deleted file mode 100644 index 4749088e97c..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/demo_axes_grid.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/demo_axes_grid.png b/mpl_toolkits/axes_grid/examples/demo_axes_grid.png deleted file mode 100644 index 9399197bd42..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/demo_axes_grid.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/demo_axes_grid.py b/mpl_toolkits/axes_grid/examples/demo_axes_grid.py deleted file mode 100644 index 7d74cc5072e..00000000000 --- a/mpl_toolkits/axes_grid/examples/demo_axes_grid.py +++ /dev/null @@ -1,133 +0,0 @@ -import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid1 import AxesGrid - - -def get_demo_image(): - import numpy as np - from matplotlib.cbook import get_sample_data - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3, 4, -4, 3) - - -def demo_simple_grid(fig): - """ - A grid of 2x2 images with 0.05 inch pad between images and only - the lower-left axes is labeled. - """ - grid = AxesGrid(fig, 141, # similar to subplot(141) - nrows_ncols=(2, 2), - axes_pad=0.05, - label_mode="1", - ) - - Z, extent = get_demo_image() - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest") - - # This only affects axes in first column and second row as share_all = - # False. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - - -def demo_grid_with_single_cbar(fig): - """ - A grid of 2x2 images with a single colorbar - """ - grid = AxesGrid(fig, 142, # similar to subplot(142) - nrows_ncols=(2, 2), - axes_pad=0.0, - share_all=True, - label_mode="L", - cbar_location="top", - cbar_mode="single", - ) - - Z, extent = get_demo_image() - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest") - #plt.colorbar(im, cax = grid.cbar_axes[0]) - grid.cbar_axes[0].colorbar(im) - - for cax in grid.cbar_axes: - cax.toggle_label(False) - - # This affects all axes as share_all = True. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - - -def demo_grid_with_each_cbar(fig): - """ - A grid of 2x2 images. Each image has its own colorbar. - """ - - grid = AxesGrid(fig, 143, # similar to subplot(143) - nrows_ncols=(2, 2), - axes_pad=0.1, - label_mode="1", - share_all=True, - cbar_location="top", - cbar_mode="each", - cbar_size="7%", - cbar_pad="2%", - ) - Z, extent = get_demo_image() - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest") - grid.cbar_axes[i].colorbar(im) - - for cax in grid.cbar_axes: - cax.toggle_label(False) - - # This affects all axes because we set share_all = True. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - - -def demo_grid_with_each_cbar_labelled(fig): - """ - A grid of 2x2 images. Each image has its own colorbar. - """ - - grid = AxesGrid(fig, 144, # similar to subplot(144) - nrows_ncols=(2, 2), - axes_pad=(0.45, 0.15), - label_mode="1", - share_all=True, - cbar_location="right", - cbar_mode="each", - cbar_size="7%", - cbar_pad="2%", - ) - Z, extent = get_demo_image() - - # Use a different colorbar range every time - limits = ((0, 1), (-2, 2), (-1.7, 1.4), (-1.5, 1)) - for i in range(4): - im = grid[i].imshow(Z, extent=extent, interpolation="nearest", - vmin=limits[i][0], vmax=limits[i][1]) - grid.cbar_axes[i].colorbar(im) - - for i, cax in enumerate(grid.cbar_axes): - cax.set_yticks((limits[i][0], limits[i][1])) - - # This affects all axes because we set share_all = True. - grid.axes_llc.set_xticks([-2, 0, 2]) - grid.axes_llc.set_yticks([-2, 0, 2]) - - -if 1: - F = plt.figure(1, (10.5, 2.5)) - - F.subplots_adjust(left=0.05, right=0.95) - - demo_simple_grid(F) - demo_grid_with_single_cbar(F) - demo_grid_with_each_cbar(F) - demo_grid_with_each_cbar_labelled(F) - - plt.draw() - plt.show() diff --git a/mpl_toolkits/axes_grid/examples/demo_curvelinear_grid.hires.png b/mpl_toolkits/axes_grid/examples/demo_curvelinear_grid.hires.png deleted file mode 100644 index 60c7c57a8e3..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/demo_curvelinear_grid.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/demo_curvelinear_grid.pdf b/mpl_toolkits/axes_grid/examples/demo_curvelinear_grid.pdf deleted file mode 100644 index 82afc1fba78..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/demo_curvelinear_grid.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/demo_curvelinear_grid.png b/mpl_toolkits/axes_grid/examples/demo_curvelinear_grid.png deleted file mode 100644 index 16bafea95e7..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/demo_curvelinear_grid.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/demo_curvelinear_grid.py b/mpl_toolkits/axes_grid/examples/demo_curvelinear_grid.py deleted file mode 100644 index ad8d0f51e81..00000000000 --- a/mpl_toolkits/axes_grid/examples/demo_curvelinear_grid.py +++ /dev/null @@ -1,137 +0,0 @@ -""" -Custom grid and ticklines. - -This example demonstrates how to use GridHelperCurveLinear to define -custom grids and ticklines by applying a transformation on the grid. -This can be used, as showcase on the second plot, to create polar -projections in a rectangular box. -""" - -import numpy as np - -import matplotlib.pyplot as plt -import matplotlib.cbook as cbook - -from mpl_toolkits.axisartist import Subplot -from mpl_toolkits.axisartist import SubplotHost, \ - ParasiteAxesAuxTrans -from mpl_toolkits.axisartist.grid_helper_curvelinear import \ - GridHelperCurveLinear - - -def curvelinear_test1(fig): - """ - grid for custom transform. - """ - - def tr(x, y): - x, y = np.asarray(x), np.asarray(y) - return x, y - x - - def inv_tr(x, y): - x, y = np.asarray(x), np.asarray(y) - return x, y + x - - grid_helper = GridHelperCurveLinear((tr, inv_tr)) - - ax1 = Subplot(fig, 1, 2, 1, grid_helper=grid_helper) - # ax1 will have a ticks and gridlines defined by the given - # transform (+ transData of the Axes). Note that the transform of - # the Axes itself (i.e., transData) is not affected by the given - # transform. - - fig.add_subplot(ax1) - - xx, yy = tr([3, 6], [5.0, 10.]) - ax1.plot(xx, yy, linewidth=2.0) - - ax1.set_aspect(1.) - ax1.set_xlim(0, 10.) - ax1.set_ylim(0, 10.) - - ax1.axis["t"] = ax1.new_floating_axis(0, 3.) - ax1.axis["t2"] = ax1.new_floating_axis(1, 7.) - ax1.grid(True, zorder=0) - - -import mpl_toolkits.axisartist.angle_helper as angle_helper - -from matplotlib.projections import PolarAxes -from matplotlib.transforms import Affine2D - - -def curvelinear_test2(fig): - """ - polar projection, but in a rectangular box. - """ - - # PolarAxes.PolarTransform takes radian. However, we want our coordinate - # system in degree - tr = Affine2D().scale(np.pi/180., 1.) + PolarAxes.PolarTransform() - - # polar projection, which involves cycle, and also has limits in - # its coordinates, needs a special method to find the extremes - # (min, max of the coordinate within the view). - - # 20, 20 : number of sampling points along x, y direction - extreme_finder = angle_helper.ExtremeFinderCycle(20, 20, - lon_cycle=360, - lat_cycle=None, - lon_minmax=None, - lat_minmax=(0, np.inf), - ) - - grid_locator1 = angle_helper.LocatorDMS(12) - # Find a grid values appropriate for the coordinate (degree, - # minute, second). - - tick_formatter1 = angle_helper.FormatterDMS() - # And also uses an appropriate formatter. Note that,the - # acceptable Locator and Formatter class is a bit different than - # that of mpl's, and you cannot directly use mpl's Locator and - # Formatter here (but may be possible in the future). - - grid_helper = GridHelperCurveLinear(tr, - extreme_finder=extreme_finder, - grid_locator1=grid_locator1, - tick_formatter1=tick_formatter1 - ) - - ax1 = SubplotHost(fig, 1, 2, 2, grid_helper=grid_helper) - - # make ticklabels of right and top axis visible. - ax1.axis["right"].major_ticklabels.set_visible(True) - ax1.axis["top"].major_ticklabels.set_visible(True) - - # let right axis shows ticklabels for 1st coordinate (angle) - ax1.axis["right"].get_helper().nth_coord_ticks = 0 - # let bottom axis shows ticklabels for 2nd coordinate (radius) - ax1.axis["bottom"].get_helper().nth_coord_ticks = 1 - - fig.add_subplot(ax1) - - # A parasite axes with given transform - ax2 = ParasiteAxesAuxTrans(ax1, tr, "equal") - # note that ax2.transData == tr + ax1.transData - # Anything you draw in ax2 will match the ticks and grids of ax1. - ax1.parasites.append(ax2) - intp = cbook.simple_linear_interpolation - ax2.plot(intp(np.array([0, 30]), 50), - intp(np.array([10., 10.]), 50), - linewidth=2.0) - - ax1.set_aspect(1.) - ax1.set_xlim(-5, 12) - ax1.set_ylim(-5, 10) - - ax1.grid(True, zorder=0) - -if 1: - fig = plt.figure(1, figsize=(7, 4)) - fig.clf() - - curvelinear_test1(fig) - curvelinear_test2(fig) - - plt.draw() - plt.show() diff --git a/mpl_toolkits/axes_grid/examples/demo_floating_axes.hires.png b/mpl_toolkits/axes_grid/examples/demo_floating_axes.hires.png deleted file mode 100644 index ae34d666195..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/demo_floating_axes.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/demo_floating_axes.pdf b/mpl_toolkits/axes_grid/examples/demo_floating_axes.pdf deleted file mode 100644 index 5981cd06541..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/demo_floating_axes.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/demo_floating_axes.png b/mpl_toolkits/axes_grid/examples/demo_floating_axes.png deleted file mode 100644 index d60a886d4e4..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/demo_floating_axes.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/demo_floating_axes.py b/mpl_toolkits/axes_grid/examples/demo_floating_axes.py deleted file mode 100644 index f2b35f478b4..00000000000 --- a/mpl_toolkits/axes_grid/examples/demo_floating_axes.py +++ /dev/null @@ -1,154 +0,0 @@ -""" -Demo of the floating axes. - -This demo shows features of functions in floating_axes: - * Using scatter function and bar function with changing the - shape of the plot. - * Using GridHelperCurveLinear to rotate the plot and set the - boundary of the plot. - * Using FloatingSubplot to create a subplot using the return - value from GridHelperCurveLinear. - * Making sector plot by adding more features to GridHelperCurveLinear. -""" -from matplotlib.transforms import Affine2D -import mpl_toolkits.axisartist.floating_axes as floating_axes -import numpy as np -import mpl_toolkits.axisartist.angle_helper as angle_helper -from matplotlib.projections import PolarAxes -from mpl_toolkits.axisartist.grid_finder import (FixedLocator, MaxNLocator, - DictFormatter) -import matplotlib.pyplot as plt - - -def setup_axes1(fig, rect): - """ - A simple one. - """ - tr = Affine2D().scale(2, 1).rotate_deg(30) - - grid_helper = floating_axes.GridHelperCurveLinear( - tr, extremes=(-0.5, 3.5, 0, 4)) - - ax1 = floating_axes.FloatingSubplot(fig, rect, grid_helper=grid_helper) - fig.add_subplot(ax1) - - aux_ax = ax1.get_aux_axes(tr) - - grid_helper.grid_finder.grid_locator1._nbins = 4 - grid_helper.grid_finder.grid_locator2._nbins = 4 - - return ax1, aux_ax - - -def setup_axes2(fig, rect): - """ - With custom locator and formatter. - Note that the extreme values are swapped. - """ - tr = PolarAxes.PolarTransform() - - pi = np.pi - angle_ticks = [(0, r"$0$"), - (.25*pi, r"$\frac{1}{4}\pi$"), - (.5*pi, r"$\frac{1}{2}\pi$")] - grid_locator1 = FixedLocator([v for v, s in angle_ticks]) - tick_formatter1 = DictFormatter(dict(angle_ticks)) - - grid_locator2 = MaxNLocator(2) - - grid_helper = floating_axes.GridHelperCurveLinear( - tr, extremes=(.5*pi, 0, 2, 1), - grid_locator1=grid_locator1, - grid_locator2=grid_locator2, - tick_formatter1=tick_formatter1, - tick_formatter2=None) - - ax1 = floating_axes.FloatingSubplot(fig, rect, grid_helper=grid_helper) - fig.add_subplot(ax1) - - # create a parasite axes whose transData in RA, cz - aux_ax = ax1.get_aux_axes(tr) - - aux_ax.patch = ax1.patch # for aux_ax to have a clip path as in ax - ax1.patch.zorder = 0.9 # but this has a side effect that the patch is - # drawn twice, and possibly over some other - # artists. So, we decrease the zorder a bit to - # prevent this. - - return ax1, aux_ax - - -def setup_axes3(fig, rect): - """ - Sometimes, things like axis_direction need to be adjusted. - """ - - # rotate a bit for better orientation - tr_rotate = Affine2D().translate(-95, 0) - - # scale degree to radians - tr_scale = Affine2D().scale(np.pi/180., 1.) - - tr = tr_rotate + tr_scale + PolarAxes.PolarTransform() - - grid_locator1 = angle_helper.LocatorHMS(4) - tick_formatter1 = angle_helper.FormatterHMS() - - grid_locator2 = MaxNLocator(3) - - ra0, ra1 = 8.*15, 14.*15 - cz0, cz1 = 0, 14000 - grid_helper = floating_axes.GridHelperCurveLinear( - tr, extremes=(ra0, ra1, cz0, cz1), - grid_locator1=grid_locator1, - grid_locator2=grid_locator2, - tick_formatter1=tick_formatter1, - tick_formatter2=None) - - ax1 = floating_axes.FloatingSubplot(fig, rect, grid_helper=grid_helper) - fig.add_subplot(ax1) - - # adjust axis - ax1.axis["left"].set_axis_direction("bottom") - ax1.axis["right"].set_axis_direction("top") - - ax1.axis["bottom"].set_visible(False) - ax1.axis["top"].set_axis_direction("bottom") - ax1.axis["top"].toggle(ticklabels=True, label=True) - ax1.axis["top"].major_ticklabels.set_axis_direction("top") - ax1.axis["top"].label.set_axis_direction("top") - - ax1.axis["left"].label.set_text(r"cz [km$^{-1}$]") - ax1.axis["top"].label.set_text(r"$\alpha_{1950}$") - - # create a parasite axes whose transData in RA, cz - aux_ax = ax1.get_aux_axes(tr) - - aux_ax.patch = ax1.patch # for aux_ax to have a clip path as in ax - ax1.patch.zorder = 0.9 # but this has a side effect that the patch is - # drawn twice, and possibly over some other - # artists. So, we decrease the zorder a bit to - # prevent this. - - return ax1, aux_ax - - -########################################################## -fig = plt.figure(1, figsize=(8, 4)) -fig.subplots_adjust(wspace=0.3, left=0.05, right=0.95) - -ax1, aux_ax1 = setup_axes1(fig, 131) -aux_ax1.bar([0, 1, 2, 3], [3, 2, 1, 3]) - -ax2, aux_ax2 = setup_axes2(fig, 132) -theta = np.random.rand(10)*.5*np.pi -radius = np.random.rand(10) + 1. -aux_ax2.scatter(theta, radius) - -ax3, aux_ax3 = setup_axes3(fig, 133) - -theta = (8 + np.random.rand(10)*(14 - 8))*15. # in degrees -radius = np.random.rand(10)*14000. -aux_ax3.scatter(theta, radius) - -plt.show() diff --git a/mpl_toolkits/axes_grid/examples/demo_floating_axis.hires.png b/mpl_toolkits/axes_grid/examples/demo_floating_axis.hires.png deleted file mode 100644 index f3d7da625ae..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/demo_floating_axis.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/demo_floating_axis.pdf b/mpl_toolkits/axes_grid/examples/demo_floating_axis.pdf deleted file mode 100644 index 3a366089972..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/demo_floating_axis.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/demo_floating_axis.png b/mpl_toolkits/axes_grid/examples/demo_floating_axis.png deleted file mode 100644 index a7e2088c5c9..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/demo_floating_axis.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/demo_floating_axis.py b/mpl_toolkits/axes_grid/examples/demo_floating_axis.py deleted file mode 100644 index 44eca5ad877..00000000000 --- a/mpl_toolkits/axes_grid/examples/demo_floating_axis.py +++ /dev/null @@ -1,70 +0,0 @@ -""" -Axis within rectangular frame - -The following code demonstrates how to put a floating polar curve within a -rectangular box. In order to get a better sense of polar curves, please look at -demo_curvelinear_grid.py. -""" -import numpy as np -import matplotlib.pyplot as plt -import mpl_toolkits.axisartist.angle_helper as angle_helper -from matplotlib.projections import PolarAxes -from matplotlib.transforms import Affine2D -from mpl_toolkits.axisartist import SubplotHost -from mpl_toolkits.axisartist import GridHelperCurveLinear - - -def curvelinear_test2(fig): - """ - polar projection, but in a rectangular box. - """ - global ax1 - # see demo_curvelinear_grid.py for details - tr = Affine2D().scale(np.pi / 180., 1.) + PolarAxes.PolarTransform() - - extreme_finder = angle_helper.ExtremeFinderCycle(20, - 20, - lon_cycle=360, - lat_cycle=None, - lon_minmax=None, - lat_minmax=(0, - np.inf), - ) - - grid_locator1 = angle_helper.LocatorDMS(12) - - tick_formatter1 = angle_helper.FormatterDMS() - - grid_helper = GridHelperCurveLinear(tr, - extreme_finder=extreme_finder, - grid_locator1=grid_locator1, - tick_formatter1=tick_formatter1 - ) - - ax1 = SubplotHost(fig, 1, 1, 1, grid_helper=grid_helper) - - fig.add_subplot(ax1) - - # Now creates floating axis - - # floating axis whose first coordinate (theta) is fixed at 60 - ax1.axis["lat"] = axis = ax1.new_floating_axis(0, 60) - axis.label.set_text(r"$\theta = 60^{\circ}$") - axis.label.set_visible(True) - - # floating axis whose second coordinate (r) is fixed at 6 - ax1.axis["lon"] = axis = ax1.new_floating_axis(1, 6) - axis.label.set_text(r"$r = 6$") - - ax1.set_aspect(1.) - ax1.set_xlim(-5, 12) - ax1.set_ylim(-5, 10) - - ax1.grid(True) - -fig = plt.figure(1, figsize=(5, 5)) -fig.clf() - -curvelinear_test2(fig) - -plt.show() diff --git a/mpl_toolkits/axes_grid/examples/demo_parasite_axes2.pdf b/mpl_toolkits/axes_grid/examples/demo_parasite_axes2.pdf deleted file mode 100644 index e2ad97f3d75..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/demo_parasite_axes2.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/demo_parasite_axes2.png b/mpl_toolkits/axes_grid/examples/demo_parasite_axes2.png deleted file mode 100644 index bac1bdf5e67..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/demo_parasite_axes2.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/demo_parasite_axes2.py b/mpl_toolkits/axes_grid/examples/demo_parasite_axes2.py deleted file mode 100644 index e4053ef0a07..00000000000 --- a/mpl_toolkits/axes_grid/examples/demo_parasite_axes2.py +++ /dev/null @@ -1,51 +0,0 @@ -""" -Parasite axis demo - -The following code is an example of a parasite axis. It aims to show a user how -to plot multiple different values onto one single plot. Notice how in this -example, par1 and par2 are both calling twinx meaning both are tied directly to -the x-axis. From there, each of those two axis can behave separately from the -each other, meaning they can take on separate values from themselves as well as -the x-axis. -""" -from mpl_toolkits.axes_grid1 import host_subplot -import mpl_toolkits.axisartist as AA -import matplotlib.pyplot as plt - -host = host_subplot(111, axes_class=AA.Axes) -plt.subplots_adjust(right=0.75) - -par1 = host.twinx() -par2 = host.twinx() - -offset = 60 -new_fixed_axis = par2.get_grid_helper().new_fixed_axis -par2.axis["right"] = new_fixed_axis(loc="right", - axes=par2, - offset=(offset, 0)) - -par2.axis["right"].toggle(all=True) - -host.set_xlim(0, 2) -host.set_ylim(0, 2) - -host.set_xlabel("Distance") -host.set_ylabel("Density") -par1.set_ylabel("Temperature") -par2.set_ylabel("Velocity") - -p1, = host.plot([0, 1, 2], [0, 1, 2], label="Density") -p2, = par1.plot([0, 1, 2], [0, 3, 2], label="Temperature") -p3, = par2.plot([0, 1, 2], [50, 30, 15], label="Velocity") - -par1.set_ylim(0, 4) -par2.set_ylim(1, 65) - -host.legend() - -host.axis["left"].label.set_color(p1.get_color()) -par1.axis["right"].label.set_color(p2.get_color()) -par2.axis["right"].label.set_color(p3.get_color()) - -plt.draw() -plt.show() diff --git a/mpl_toolkits/axes_grid/examples/demo_parasite_axes2_00_00.hires.png b/mpl_toolkits/axes_grid/examples/demo_parasite_axes2_00_00.hires.png deleted file mode 100644 index 54dcc739655..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/demo_parasite_axes2_00_00.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/demo_parasite_axes2_00_00.pdf b/mpl_toolkits/axes_grid/examples/demo_parasite_axes2_00_00.pdf deleted file mode 100644 index 4128b78017e..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/demo_parasite_axes2_00_00.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/demo_parasite_axes2_00_00.png b/mpl_toolkits/axes_grid/examples/demo_parasite_axes2_00_00.png deleted file mode 100644 index 8e47e722b4a..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/demo_parasite_axes2_00_00.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/inset_locator_demo.hires.png b/mpl_toolkits/axes_grid/examples/inset_locator_demo.hires.png deleted file mode 100644 index 82b840f7b61..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/inset_locator_demo.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/inset_locator_demo.pdf b/mpl_toolkits/axes_grid/examples/inset_locator_demo.pdf deleted file mode 100644 index a6fe6e51979..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/inset_locator_demo.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/inset_locator_demo.png b/mpl_toolkits/axes_grid/examples/inset_locator_demo.png deleted file mode 100644 index 67fb211e808..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/inset_locator_demo.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/inset_locator_demo.py b/mpl_toolkits/axes_grid/examples/inset_locator_demo.py deleted file mode 100644 index 6b7582b3f5b..00000000000 --- a/mpl_toolkits/axes_grid/examples/inset_locator_demo.py +++ /dev/null @@ -1,46 +0,0 @@ -import matplotlib.pyplot as plt - -from mpl_toolkits.axes_grid1.inset_locator import inset_axes, zoomed_inset_axes -from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar - - -def add_sizebar(ax, size): - asb = AnchoredSizeBar(ax.transData, - size, - str(size), - loc=8, - pad=0.1, borderpad=0.5, sep=5, - frameon=False) - ax.add_artist(asb) - - -fig, (ax, ax2) = plt.subplots(1, 2, figsize=[5.5, 3]) - -# first subplot -ax.set_aspect(1.) - -axins = inset_axes(ax, - width="30%", # width = 30% of parent_bbox - height=1., # height : 1 inch - loc=3) - -plt.xticks(visible=False) -plt.yticks(visible=False) - - -# second subplot -ax2.set_aspect(1.) - -axins = zoomed_inset_axes(ax2, 0.5, loc=1) # zoom = 0.5 -# fix the number of ticks on the inset axes -axins.yaxis.get_major_locator().set_params(nbins=7) -axins.xaxis.get_major_locator().set_params(nbins=7) - -plt.xticks(visible=False) -plt.yticks(visible=False) - -add_sizebar(ax2, 0.5) -add_sizebar(axins, 0.5) - -plt.draw() -plt.show() diff --git a/mpl_toolkits/axes_grid/examples/inset_locator_demo2.hires.png b/mpl_toolkits/axes_grid/examples/inset_locator_demo2.hires.png deleted file mode 100644 index f712f598125..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/inset_locator_demo2.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/inset_locator_demo2.pdf b/mpl_toolkits/axes_grid/examples/inset_locator_demo2.pdf deleted file mode 100644 index 3e58e3966d0..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/inset_locator_demo2.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/inset_locator_demo2.png b/mpl_toolkits/axes_grid/examples/inset_locator_demo2.png deleted file mode 100644 index 5b03524b8ec..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/inset_locator_demo2.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/inset_locator_demo2.py b/mpl_toolkits/axes_grid/examples/inset_locator_demo2.py deleted file mode 100644 index 51374cbbc7c..00000000000 --- a/mpl_toolkits/axes_grid/examples/inset_locator_demo2.py +++ /dev/null @@ -1,49 +0,0 @@ -import matplotlib.pyplot as plt - -from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes -from mpl_toolkits.axes_grid1.inset_locator import mark_inset - -import numpy as np - - -def get_demo_image(): - from matplotlib.cbook import get_sample_data - import numpy as np - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3, 4, -4, 3) - -fig, ax = plt.subplots(figsize=[5, 4]) - -# prepare the demo image -Z, extent = get_demo_image() -Z2 = np.zeros([150, 150], dtype="d") -ny, nx = Z.shape -Z2[30:30 + ny, 30:30 + nx] = Z - -# extent = [-3, 4, -4, 3] -ax.imshow(Z2, extent=extent, interpolation="nearest", - origin="lower") - -axins = zoomed_inset_axes(ax, 6, loc=1) # zoom = 6 -axins.imshow(Z2, extent=extent, interpolation="nearest", - origin="lower") - -# sub region of the original image -x1, x2, y1, y2 = -1.5, -0.9, -2.5, -1.9 -axins.set_xlim(x1, x2) -axins.set_ylim(y1, y2) -# fix the number of ticks on the inset axes -axins.yaxis.get_major_locator().set_params(nbins=7) -axins.xaxis.get_major_locator().set_params(nbins=7) - -plt.xticks(visible=False) -plt.yticks(visible=False) - -# draw a bbox of the region of the inset axes in the parent axes and -# connecting lines between the bbox and the inset axes area -mark_inset(ax, axins, loc1=2, loc2=4, fc="none", ec="0.5") - -plt.draw() -plt.show() diff --git a/mpl_toolkits/axes_grid/examples/parasite_simple2.hires.png b/mpl_toolkits/axes_grid/examples/parasite_simple2.hires.png deleted file mode 100644 index 361fa043d42..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/parasite_simple2.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/parasite_simple2.pdf b/mpl_toolkits/axes_grid/examples/parasite_simple2.pdf deleted file mode 100644 index ad381d3d2a6..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/parasite_simple2.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/parasite_simple2.png b/mpl_toolkits/axes_grid/examples/parasite_simple2.png deleted file mode 100644 index 6c4a20ead69..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/parasite_simple2.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/parasite_simple2.py b/mpl_toolkits/axes_grid/examples/parasite_simple2.py deleted file mode 100644 index 1ab516f0156..00000000000 --- a/mpl_toolkits/axes_grid/examples/parasite_simple2.py +++ /dev/null @@ -1,42 +0,0 @@ -import matplotlib.transforms as mtransforms -import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid1.parasite_axes import SubplotHost - -obs = [["01_S1", 3.88, 0.14, 1970, 63], - ["01_S4", 5.6, 0.82, 1622, 150], - ["02_S1", 2.4, 0.54, 1570, 40], - ["03_S1", 4.1, 0.62, 2380, 170]] - - -fig = plt.figure() - -ax_kms = SubplotHost(fig, 1, 1, 1, aspect=1.) - -# angular proper motion("/yr) to linear velocity(km/s) at distance=2.3kpc -pm_to_kms = 1./206265.*2300*3.085e18/3.15e7/1.e5 - -aux_trans = mtransforms.Affine2D().scale(pm_to_kms, 1.) -ax_pm = ax_kms.twin(aux_trans) -ax_pm.set_viewlim_mode("transform") - -fig.add_subplot(ax_kms) - -for n, ds, dse, w, we in obs: - time = ((2007 + (10. + 4/30.)/12) - 1988.5) - v = ds / time * pm_to_kms - ve = dse / time * pm_to_kms - ax_kms.errorbar([v], [w], xerr=[ve], yerr=[we], color="k") - - -ax_kms.axis["bottom"].set_label("Linear velocity at 2.3 kpc [km/s]") -ax_kms.axis["left"].set_label("FWHM [km/s]") -ax_pm.axis["top"].set_label(r"Proper Motion [$''$/yr]") -ax_pm.axis["top"].label.set_visible(True) -ax_pm.axis["right"].major_ticklabels.set_visible(False) - -ax_kms.set_xlim(950, 3700) -ax_kms.set_ylim(950, 3100) -# xlim and ylim of ax_pms will be automatically adjusted. - -plt.draw() -plt.show() diff --git a/mpl_toolkits/axes_grid/examples/scatter_hist.hires.png b/mpl_toolkits/axes_grid/examples/scatter_hist.hires.png deleted file mode 100644 index 78f43805b99..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/scatter_hist.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/scatter_hist.pdf b/mpl_toolkits/axes_grid/examples/scatter_hist.pdf deleted file mode 100644 index eb4a2c5111f..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/scatter_hist.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/scatter_hist.png b/mpl_toolkits/axes_grid/examples/scatter_hist.png deleted file mode 100644 index 94bb830544b..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/scatter_hist.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/scatter_hist.py b/mpl_toolkits/axes_grid/examples/scatter_hist.py deleted file mode 100644 index ff6e1412c1f..00000000000 --- a/mpl_toolkits/axes_grid/examples/scatter_hist.py +++ /dev/null @@ -1,51 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid1 import make_axes_locatable - -# the random data -x = np.random.randn(1000) -y = np.random.randn(1000) - - -fig, axScatter = plt.subplots(figsize=(5.5, 5.5)) - -# the scatter plot: -axScatter.scatter(x, y) -axScatter.set_aspect(1.) - -# create new axes on the right and on the top of the current axes -# The first argument of the new_vertical(new_horizontal) method is -# the height (width) of the axes to be created in inches. -divider = make_axes_locatable(axScatter) -axHistx = divider.append_axes("top", 1.2, pad=0.1, sharex=axScatter) -axHisty = divider.append_axes("right", 1.2, pad=0.1, sharey=axScatter) - -# make some labels invisible -plt.setp(axHistx.get_xticklabels() + axHisty.get_yticklabels(), - visible=False) - -# now determine nice limits by hand: -binwidth = 0.25 -xymax = np.max([np.max(np.fabs(x)), np.max(np.fabs(y))]) -lim = (int(xymax/binwidth) + 1)*binwidth - -bins = np.arange(-lim, lim + binwidth, binwidth) -axHistx.hist(x, bins=bins) -axHisty.hist(y, bins=bins, orientation='horizontal') - -# the xaxis of axHistx and yaxis of axHisty are shared with axScatter, -# thus there is no need to manually adjust the xlim and ylim of these -# axis. - -#axHistx.axis["bottom"].major_ticklabels.set_visible(False) -for tl in axHistx.get_xticklabels(): - tl.set_visible(False) -axHistx.set_yticks([0, 50, 100]) - -#axHisty.axis["left"].major_ticklabels.set_visible(False) -for tl in axHisty.get_yticklabels(): - tl.set_visible(False) -axHisty.set_xticks([0, 50, 100]) - -plt.draw() -plt.show() diff --git a/mpl_toolkits/axes_grid/examples/simple_anchored_artists.hires.png b/mpl_toolkits/axes_grid/examples/simple_anchored_artists.hires.png deleted file mode 100644 index c378fa5e4a8..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/simple_anchored_artists.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/simple_anchored_artists.pdf b/mpl_toolkits/axes_grid/examples/simple_anchored_artists.pdf deleted file mode 100644 index 97efab7050e..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/simple_anchored_artists.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/simple_anchored_artists.png b/mpl_toolkits/axes_grid/examples/simple_anchored_artists.png deleted file mode 100644 index 302c01065de..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/simple_anchored_artists.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/simple_anchored_artists.py b/mpl_toolkits/axes_grid/examples/simple_anchored_artists.py deleted file mode 100644 index 26ef0f6a26a..00000000000 --- a/mpl_toolkits/axes_grid/examples/simple_anchored_artists.py +++ /dev/null @@ -1,62 +0,0 @@ -import matplotlib.pyplot as plt - - -def draw_text(ax): - from matplotlib.offsetbox import AnchoredText - at = AnchoredText("Figure 1a", - loc=2, prop=dict(size=8), frameon=True, - ) - at.patch.set_boxstyle("round,pad=0.,rounding_size=0.2") - ax.add_artist(at) - - at2 = AnchoredText("Figure 1(b)", - loc=3, prop=dict(size=8), frameon=True, - bbox_to_anchor=(0., 1.), - bbox_transform=ax.transAxes - ) - at2.patch.set_boxstyle("round,pad=0.,rounding_size=0.2") - ax.add_artist(at2) - - -def draw_circle(ax): # circle in the canvas coordinate - from mpl_toolkits.axes_grid1.anchored_artists import AnchoredDrawingArea - from matplotlib.patches import Circle - ada = AnchoredDrawingArea(20, 20, 0, 0, - loc=1, pad=0., frameon=False) - p = Circle((10, 10), 10) - ada.da.add_artist(p) - ax.add_artist(ada) - - -def draw_ellipse(ax): - from mpl_toolkits.axes_grid1.anchored_artists import AnchoredEllipse - # draw an ellipse of width=0.1, height=0.15 in the data coordinate - ae = AnchoredEllipse(ax.transData, width=0.1, height=0.15, angle=0., - loc=3, pad=0.5, borderpad=0.4, frameon=True) - - ax.add_artist(ae) - - -def draw_sizebar(ax): - from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar - # draw a horizontal bar with length of 0.1 in Data coordinate - # (ax.transData) with a label underneath. - asb = AnchoredSizeBar(ax.transData, - 0.1, - r"1$^{\prime}$", - loc=8, - pad=0.1, borderpad=0.5, sep=5, - frameon=False) - ax.add_artist(asb) - - -if 1: - ax = plt.gca() - ax.set_aspect(1.) - - draw_text(ax) - draw_circle(ax) - draw_ellipse(ax) - draw_sizebar(ax) - - plt.show() diff --git a/mpl_toolkits/axes_grid/examples/simple_axesgrid.hires.png b/mpl_toolkits/axes_grid/examples/simple_axesgrid.hires.png deleted file mode 100644 index ef8168b2c23..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/simple_axesgrid.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/simple_axesgrid.pdf b/mpl_toolkits/axes_grid/examples/simple_axesgrid.pdf deleted file mode 100644 index 281019dac65..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/simple_axesgrid.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/simple_axesgrid.png b/mpl_toolkits/axes_grid/examples/simple_axesgrid.png deleted file mode 100644 index 29f77476284..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/simple_axesgrid.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/simple_axesgrid.py b/mpl_toolkits/axes_grid/examples/simple_axesgrid.py deleted file mode 100644 index b8c45f2aae6..00000000000 --- a/mpl_toolkits/axes_grid/examples/simple_axesgrid.py +++ /dev/null @@ -1,17 +0,0 @@ -import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid1 import ImageGrid -import numpy as np - -im = np.arange(100) -im.shape = 10, 10 - -fig = plt.figure(1, (4., 4.)) -grid = ImageGrid(fig, 111, # similar to subplot(111) - nrows_ncols=(2, 2), # creates 2x2 grid of axes - axes_pad=0.1, # pad between axes in inch. - ) - -for i in range(4): - grid[i].imshow(im) # The AxesGrid object work as a list of axes. - -plt.show() diff --git a/mpl_toolkits/axes_grid/examples/simple_axesgrid2.hires.png b/mpl_toolkits/axes_grid/examples/simple_axesgrid2.hires.png deleted file mode 100644 index 5661a089ffa..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/simple_axesgrid2.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/simple_axesgrid2.pdf b/mpl_toolkits/axes_grid/examples/simple_axesgrid2.pdf deleted file mode 100644 index 3973c953a9d..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/simple_axesgrid2.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/simple_axesgrid2.png b/mpl_toolkits/axes_grid/examples/simple_axesgrid2.png deleted file mode 100644 index a1dbac3bed3..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/simple_axesgrid2.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/simple_axesgrid2.py b/mpl_toolkits/axes_grid/examples/simple_axesgrid2.py deleted file mode 100644 index 0eac5461613..00000000000 --- a/mpl_toolkits/axes_grid/examples/simple_axesgrid2.py +++ /dev/null @@ -1,33 +0,0 @@ -import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid1 import ImageGrid - - -def get_demo_image(): - import numpy as np - from matplotlib.cbook import get_sample_data - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3, 4, -4, 3) - -F = plt.figure(1, (5.5, 3.5)) -grid = ImageGrid(F, 111, # similar to subplot(111) - nrows_ncols=(1, 3), - axes_pad=0.1, - add_all=True, - label_mode="L", - ) - -Z, extent = get_demo_image() # demo image - -im1 = Z -im2 = Z[:, :10] -im3 = Z[:, 10:] -vmin, vmax = Z.min(), Z.max() -for i, im in enumerate([im1, im2, im3]): - ax = grid[i] - ax.imshow(im, origin="lower", vmin=vmin, - vmax=vmax, interpolation="nearest") - -plt.draw() -plt.show() diff --git a/mpl_toolkits/axes_grid/examples/simple_axisline4.hires.png b/mpl_toolkits/axes_grid/examples/simple_axisline4.hires.png deleted file mode 100644 index d76500fe955..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/simple_axisline4.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/simple_axisline4.pdf b/mpl_toolkits/axes_grid/examples/simple_axisline4.pdf deleted file mode 100644 index 5094653f1ad..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/simple_axisline4.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/simple_axisline4.png b/mpl_toolkits/axes_grid/examples/simple_axisline4.png deleted file mode 100644 index f7f0132c7c9..00000000000 Binary files a/mpl_toolkits/axes_grid/examples/simple_axisline4.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/examples/simple_axisline4.py b/mpl_toolkits/axes_grid/examples/simple_axisline4.py deleted file mode 100644 index cac8fe0ccb9..00000000000 --- a/mpl_toolkits/axes_grid/examples/simple_axisline4.py +++ /dev/null @@ -1,19 +0,0 @@ -import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid1 import host_subplot -import mpl_toolkits.axisartist as AA -import numpy as np - -ax = host_subplot(111, axes_class=AA.Axes) -xx = np.arange(0, 2*np.pi, 0.01) -ax.plot(xx, np.sin(xx)) - -ax2 = ax.twin() # ax2 is responsible for "top" axis and "right" axis -ax2.set_xticks([0., .5*np.pi, np.pi, 1.5*np.pi, 2*np.pi]) -ax2.set_xticklabels(["$0$", r"$\frac{1}{2}\pi$", - r"$\pi$", r"$\frac{3}{2}\pi$", r"$2\pi$"]) - -ax2.axis["right"].major_ticklabels.set_visible(False) -ax2.axis["top"].major_ticklabels.set_visible(True) - -plt.draw() -plt.show() diff --git a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step01.hires.png b/mpl_toolkits/axes_grid/figures/axis_direction_demo_step01.hires.png deleted file mode 100644 index ec50ce21c4a..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step01.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step01.pdf b/mpl_toolkits/axes_grid/figures/axis_direction_demo_step01.pdf deleted file mode 100644 index 19ceb4a348b..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step01.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step01.png b/mpl_toolkits/axes_grid/figures/axis_direction_demo_step01.png deleted file mode 100644 index 3a2a28b3c3c..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step01.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step01.py b/mpl_toolkits/axes_grid/figures/axis_direction_demo_step01.py deleted file mode 100644 index 3ff931baa5c..00000000000 --- a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step01.py +++ /dev/null @@ -1,25 +0,0 @@ -import matplotlib.pyplot as plt -import mpl_toolkits.axisartist as axisartist - -def setup_axes(fig, rect): - ax = axisartist.Subplot(fig, rect) - fig.add_axes(ax) - - ax.set_ylim(-0.1, 1.5) - ax.set_yticks([0, 1]) - - ax.axis[:].set_visible(False) - - ax.axis["x"] = ax.new_floating_axis(1, 0.5) - ax.axis["x"].set_axisline_style("->", size=1.5) - - return ax - -fig = plt.figure(figsize=(3,2.5)) -fig.subplots_adjust(top=0.8) -ax1 = setup_axes(fig, "111") - -ax1.axis["x"].set_axis_direction("left") - - -plt.show() diff --git a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step02.hires.png b/mpl_toolkits/axes_grid/figures/axis_direction_demo_step02.hires.png deleted file mode 100644 index 945fd7e6852..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step02.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step02.pdf b/mpl_toolkits/axes_grid/figures/axis_direction_demo_step02.pdf deleted file mode 100644 index f7e099c4e9c..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step02.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step02.png b/mpl_toolkits/axes_grid/figures/axis_direction_demo_step02.png deleted file mode 100644 index da51f77f9be..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step02.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step02.py b/mpl_toolkits/axes_grid/figures/axis_direction_demo_step02.py deleted file mode 100644 index bddedcea73d..00000000000 --- a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step02.py +++ /dev/null @@ -1,36 +0,0 @@ -import matplotlib.pyplot as plt -import mpl_toolkits.axisartist as axisartist - -def setup_axes(fig, rect): - ax = axisartist.Subplot(fig, rect) - fig.add_axes(ax) - - ax.set_ylim(-0.1, 1.5) - ax.set_yticks([0, 1]) - - #ax.axis[:].toggle(all=False) - #ax.axis[:].line.set_visible(False) - ax.axis[:].set_visible(False) - - ax.axis["x"] = ax.new_floating_axis(1, 0.5) - ax.axis["x"].set_axisline_style("->", size=1.5) - - return ax - -fig = plt.figure(figsize=(6,2.5)) -fig.subplots_adjust(bottom=0.2, top=0.8) - -ax1 = setup_axes(fig, "121") -ax1.axis["x"].set_ticklabel_direction("+") -ax1.annotate("ticklabel direction=$+$", (0.5, 0), xycoords="axes fraction", - xytext=(0, -10), textcoords="offset points", - va="top", ha="center") - -ax2 = setup_axes(fig, "122") -ax2.axis["x"].set_ticklabel_direction("-") -ax2.annotate("ticklabel direction=$-$", (0.5, 0), xycoords="axes fraction", - xytext=(0, -10), textcoords="offset points", - va="top", ha="center") - - -plt.show() diff --git a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step03.hires.png b/mpl_toolkits/axes_grid/figures/axis_direction_demo_step03.hires.png deleted file mode 100644 index afe2c7c9895..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step03.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step03.pdf b/mpl_toolkits/axes_grid/figures/axis_direction_demo_step03.pdf deleted file mode 100644 index e1ce1cfffb6..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step03.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step03.png b/mpl_toolkits/axes_grid/figures/axis_direction_demo_step03.png deleted file mode 100644 index 2c27c2d24dc..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step03.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step03.py b/mpl_toolkits/axes_grid/figures/axis_direction_demo_step03.py deleted file mode 100644 index 69963d22ee6..00000000000 --- a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step03.py +++ /dev/null @@ -1,40 +0,0 @@ -import matplotlib.pyplot as plt -import mpl_toolkits.axisartist as axisartist - -def setup_axes(fig, rect): - ax = axisartist.Subplot(fig, rect) - fig.add_axes(ax) - - ax.set_ylim(-0.1, 1.5) - ax.set_yticks([0, 1]) - - #ax.axis[:].toggle(all=False) - #ax.axis[:].line.set_visible(False) - ax.axis[:].set_visible(False) - - ax.axis["x"] = ax.new_floating_axis(1, 0.5) - ax.axis["x"].set_axisline_style("->", size=1.5) - - return ax - -fig = plt.figure(figsize=(6,2.5)) -fig.subplots_adjust(bottom=0.2, top=0.8) - -ax1 = setup_axes(fig, "121") -ax1.axis["x"].label.set_text("Label") -ax1.axis["x"].toggle(ticklabels=False) -ax1.axis["x"].set_axislabel_direction("+") -ax1.annotate("label direction=$+$", (0.5, 0), xycoords="axes fraction", - xytext=(0, -10), textcoords="offset points", - va="top", ha="center") - -ax2 = setup_axes(fig, "122") -ax2.axis["x"].label.set_text("Label") -ax2.axis["x"].toggle(ticklabels=False) -ax2.axis["x"].set_axislabel_direction("-") -ax2.annotate("label direction=$-$", (0.5, 0), xycoords="axes fraction", - xytext=(0, -10), textcoords="offset points", - va="top", ha="center") - - -plt.show() diff --git a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step04.hires.png b/mpl_toolkits/axes_grid/figures/axis_direction_demo_step04.hires.png deleted file mode 100644 index c685e7b6d26..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step04.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step04.pdf b/mpl_toolkits/axes_grid/figures/axis_direction_demo_step04.pdf deleted file mode 100644 index 141e4c999bf..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step04.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step04.png b/mpl_toolkits/axes_grid/figures/axis_direction_demo_step04.png deleted file mode 100644 index e89ce93d901..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step04.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step04.py b/mpl_toolkits/axes_grid/figures/axis_direction_demo_step04.py deleted file mode 100644 index 2b5bf867393..00000000000 --- a/mpl_toolkits/axes_grid/figures/axis_direction_demo_step04.py +++ /dev/null @@ -1,54 +0,0 @@ -import matplotlib.pyplot as plt -import mpl_toolkits.axisartist as axisartist - -def setup_axes(fig, rect): - ax = axisartist.Subplot(fig, rect) - fig.add_axes(ax) - - ax.set_ylim(-0.1, 1.5) - ax.set_yticks([0, 1]) - - ax.axis[:].set_visible(False) - - ax.axis["x1"] = ax.new_floating_axis(1, 0.3) - ax.axis["x1"].set_axisline_style("->", size=1.5) - - ax.axis["x2"] = ax.new_floating_axis(1, 0.7) - ax.axis["x2"].set_axisline_style("->", size=1.5) - - return ax - -fig = plt.figure(figsize=(6,2.5)) -fig.subplots_adjust(bottom=0.2, top=0.8) - -ax1 = setup_axes(fig, "121") -ax1.axis["x1"].label.set_text("rotation=0") -ax1.axis["x1"].toggle(ticklabels=False) - -ax1.axis["x2"].label.set_text("rotation=10") -ax1.axis["x2"].label.set_rotation(10) -ax1.axis["x2"].toggle(ticklabels=False) - -ax1.annotate("label direction=$+$", (0.5, 0), xycoords="axes fraction", - xytext=(0, -10), textcoords="offset points", - va="top", ha="center") - -ax2 = setup_axes(fig, "122") - -ax2.axis["x1"].set_axislabel_direction("-") -ax2.axis["x2"].set_axislabel_direction("-") - -ax2.axis["x1"].label.set_text("rotation=0") -ax2.axis["x1"].toggle(ticklabels=False) - -ax2.axis["x2"].label.set_text("rotation=10") -ax2.axis["x2"].label.set_rotation(10) -ax2.axis["x2"].toggle(ticklabels=False) - - -ax2.annotate("label direction=$-$", (0.5, 0), xycoords="axes fraction", - xytext=(0, -10), textcoords="offset points", - va="top", ha="center") - - -plt.show() diff --git a/mpl_toolkits/axes_grid/figures/demo_axis_direction.hires.png b/mpl_toolkits/axes_grid/figures/demo_axis_direction.hires.png deleted file mode 100644 index 47307a79be9..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/demo_axis_direction.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/demo_axis_direction.pdf b/mpl_toolkits/axes_grid/figures/demo_axis_direction.pdf deleted file mode 100644 index c08e506465c..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/demo_axis_direction.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/demo_axis_direction.png b/mpl_toolkits/axes_grid/figures/demo_axis_direction.png deleted file mode 100644 index d0e96ce8347..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/demo_axis_direction.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/demo_axis_direction.py b/mpl_toolkits/axes_grid/figures/demo_axis_direction.py deleted file mode 100644 index a198b0b1959..00000000000 --- a/mpl_toolkits/axes_grid/figures/demo_axis_direction.py +++ /dev/null @@ -1,98 +0,0 @@ - - -import numpy as np -import mpl_toolkits.axisartist.angle_helper as angle_helper -import mpl_toolkits.axisartist.grid_finder as grid_finder -from matplotlib.projections import PolarAxes -from matplotlib.transforms import Affine2D - -import mpl_toolkits.axisartist as axisartist - -from mpl_toolkits.axisartist.grid_helper_curvelinear import GridHelperCurveLinear - - -def setup_axes(fig, rect): - """ - polar projection, but in a rectangular box. - """ - - # see demo_curvelinear_grid.py for details - tr = Affine2D().scale(np.pi/180., 1.) + PolarAxes.PolarTransform() - - extreme_finder = angle_helper.ExtremeFinderCycle(20, 20, - lon_cycle = 360, - lat_cycle = None, - lon_minmax = None, - lat_minmax = (0, np.inf), - ) - - grid_locator1 = angle_helper.LocatorDMS(12) - grid_locator2 = grid_finder.MaxNLocator(5) - - tick_formatter1 = angle_helper.FormatterDMS() - - grid_helper = GridHelperCurveLinear(tr, - extreme_finder=extreme_finder, - grid_locator1=grid_locator1, - grid_locator2=grid_locator2, - tick_formatter1=tick_formatter1 - ) - - - ax1 = axisartist.Subplot(fig, rect, grid_helper=grid_helper) - ax1.axis[:].toggle(ticklabels=False) - - fig.add_subplot(ax1) - - ax1.set_aspect(1.) - ax1.set_xlim(-5, 12) - ax1.set_ylim(-5, 10) - - #ax1.grid(True) - - return ax1 - - -def add_floating_axis1(ax1): - ax1.axis["lat"] = axis = ax1.new_floating_axis(0, 30) - axis.label.set_text(r"$\theta = 30^{\circ}$") - axis.label.set_visible(True) - - return axis - - -def add_floating_axis2(ax1): - ax1.axis["lon"] = axis = ax1.new_floating_axis(1, 6) - axis.label.set_text(r"$r = 6$") - axis.label.set_visible(True) - - return axis - - -import matplotlib.pyplot as plt -fig = plt.figure(1, figsize=(8, 4.)) -fig.clf() -fig.subplots_adjust(left=0.01, right=0.99, bottom=0.01, top=0.99, - wspace=0.01, hspace=0.01) - -for i, d in enumerate(["bottom", "left", "top", "right"]): - ax1 = setup_axes(fig, rect=241++i) - axis = add_floating_axis1(ax1) - axis.set_axis_direction(d) - ax1.annotate(d, (0, 1), (5, -5), - xycoords="axes fraction", textcoords="offset points", - va="top", ha="left") - -for i, d in enumerate(["bottom", "left", "top", "right"]): - ax1 = setup_axes(fig, rect=245++i) - axis = add_floating_axis2(ax1) - axis.set_axis_direction(d) - ax1.annotate(d, (0, 1), (5, -5), - xycoords="axes fraction", textcoords="offset points", - va="top", ha="left") - - - -plt.show() - - diff --git a/mpl_toolkits/axes_grid/figures/demo_ticklabel_alignment.hires.png b/mpl_toolkits/axes_grid/figures/demo_ticklabel_alignment.hires.png deleted file mode 100644 index 32981dbcfaf..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/demo_ticklabel_alignment.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/demo_ticklabel_alignment.pdf b/mpl_toolkits/axes_grid/figures/demo_ticklabel_alignment.pdf deleted file mode 100644 index 3d9bb7394f8..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/demo_ticklabel_alignment.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/demo_ticklabel_alignment.png b/mpl_toolkits/axes_grid/figures/demo_ticklabel_alignment.png deleted file mode 100644 index 42cee2ee1b6..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/demo_ticklabel_alignment.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/demo_ticklabel_alignment.py b/mpl_toolkits/axes_grid/figures/demo_ticklabel_alignment.py deleted file mode 100644 index 78f81ad47df..00000000000 --- a/mpl_toolkits/axes_grid/figures/demo_ticklabel_alignment.py +++ /dev/null @@ -1,38 +0,0 @@ - - -import matplotlib.pyplot as plt -import mpl_toolkits.axisartist as axisartist - - -def setup_axes(fig, rect): - - ax = axisartist.Subplot(fig, rect) - fig.add_subplot(ax) - - ax.set_yticks([0.2, 0.8]) - ax.set_yticklabels(["short", "loooong"]) - ax.set_xticks([0.2, 0.8]) - ax.set_xticklabels([r"$\frac{1}{2}\pi$", r"$\pi$"]) - - return ax - -fig = plt.figure(1, figsize=(3, 5)) -fig.subplots_adjust(left=0.5, hspace=0.7) - - - -ax = setup_axes(fig, 311) -ax.set_ylabel("ha=right") -ax.set_xlabel("va=baseline") - -ax = setup_axes(fig, 312) -ax.axis["left"].major_ticklabels.set_ha("center") -ax.axis["bottom"].major_ticklabels.set_va("top") -ax.set_ylabel("ha=center") -ax.set_xlabel("va=top") - -ax = setup_axes(fig, 313) -ax.axis["left"].major_ticklabels.set_ha("left") -ax.axis["bottom"].major_ticklabels.set_va("bottom") -ax.set_ylabel("ha=left") -ax.set_xlabel("va=bottom") diff --git a/mpl_toolkits/axes_grid/figures/parasite_simple.hires.png b/mpl_toolkits/axes_grid/figures/parasite_simple.hires.png deleted file mode 100644 index 4be28cedbd3..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/parasite_simple.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/parasite_simple.pdf b/mpl_toolkits/axes_grid/figures/parasite_simple.pdf deleted file mode 100644 index b9464753b22..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/parasite_simple.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/parasite_simple.png b/mpl_toolkits/axes_grid/figures/parasite_simple.png deleted file mode 100644 index 36086c4ffd6..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/parasite_simple.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/parasite_simple.py b/mpl_toolkits/axes_grid/figures/parasite_simple.py deleted file mode 100644 index c66d3c2ce30..00000000000 --- a/mpl_toolkits/axes_grid/figures/parasite_simple.py +++ /dev/null @@ -1,24 +0,0 @@ -from mpl_toolkits.axes_grid1 import host_subplot -import matplotlib.pyplot as plt - -host = host_subplot(111) - -par = host.twinx() - -host.set_xlabel("Distance") -host.set_ylabel("Density") -par.set_ylabel("Temperature") - -p1, = host.plot([0, 1, 2], [0, 1, 2], label="Density") -p2, = par.plot([0, 1, 2], [0, 3, 2], label="Temperature") - -leg = plt.legend() - -host.yaxis.get_label().set_color(p1.get_color()) -leg.texts[0].set_color(p1.get_color()) - -par.yaxis.get_label().set_color(p2.get_color()) -leg.texts[1].set_color(p2.get_color()) - -plt.show() - diff --git a/mpl_toolkits/axes_grid/figures/simple_axes_divider2.hires.png b/mpl_toolkits/axes_grid/figures/simple_axes_divider2.hires.png deleted file mode 100644 index 7485b134395..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_axes_divider2.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_axes_divider2.pdf b/mpl_toolkits/axes_grid/figures/simple_axes_divider2.pdf deleted file mode 100644 index 026852b05c6..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_axes_divider2.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_axes_divider2.png b/mpl_toolkits/axes_grid/figures/simple_axes_divider2.png deleted file mode 100644 index b4d1924c76d..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_axes_divider2.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_axes_divider2.py b/mpl_toolkits/axes_grid/figures/simple_axes_divider2.py deleted file mode 100644 index 7b866c3c058..00000000000 --- a/mpl_toolkits/axes_grid/figures/simple_axes_divider2.py +++ /dev/null @@ -1,29 +0,0 @@ -import mpl_toolkits.axes_grid.axes_size as Size -from mpl_toolkits.axes_grid import Divider -import matplotlib.pyplot as plt - -fig1 = plt.figure(1, (5.5, 4.)) - -# the rect parameter will be ignore as we will set axes_locator -rect = (0.1, 0.1, 0.8, 0.8) -ax = [fig1.add_axes(rect, label="%d"%i) for i in range(4)] - -horiz = [Size.Scaled(1.5), Size.Fixed(.5), Size.Scaled(1.), - Size.Scaled(.5)] - -vert = [Size.Scaled(1.), Size.Fixed(.5), Size.Scaled(1.5)] - -# divide the axes rectangle into grid whose size is specified by horiz * vert -divider = Divider(fig1, rect, horiz, vert, aspect=False) - -ax[0].set_axes_locator(divider.new_locator(nx=0, ny=0)) -ax[1].set_axes_locator(divider.new_locator(nx=0, ny=2)) -ax[2].set_axes_locator(divider.new_locator(nx=2, ny=2)) -ax[3].set_axes_locator(divider.new_locator(nx=2, nx1=4, ny=0)) - -for ax1 in ax: - plt.setp(ax1.get_xticklabels()+ax1.get_yticklabels(), - visible=False) - -plt.draw() -plt.show() diff --git a/mpl_toolkits/axes_grid/figures/simple_axes_divider3.hires.png b/mpl_toolkits/axes_grid/figures/simple_axes_divider3.hires.png deleted file mode 100644 index 41a56122f1f..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_axes_divider3.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_axes_divider3.pdf b/mpl_toolkits/axes_grid/figures/simple_axes_divider3.pdf deleted file mode 100644 index d77f51904ab..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_axes_divider3.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_axes_divider3.png b/mpl_toolkits/axes_grid/figures/simple_axes_divider3.png deleted file mode 100644 index 4d2ab884e87..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_axes_divider3.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_axes_divider3.py b/mpl_toolkits/axes_grid/figures/simple_axes_divider3.py deleted file mode 100644 index 203bdd5068e..00000000000 --- a/mpl_toolkits/axes_grid/figures/simple_axes_divider3.py +++ /dev/null @@ -1,38 +0,0 @@ -import mpl_toolkits.axes_grid.axes_size as Size -from mpl_toolkits.axes_grid import Divider -import matplotlib.pyplot as plt - - -fig1 = plt.figure(1, (5.5, 4)) - -# the rect parameter will be ignore as we will set axes_locator -rect = (0.1, 0.1, 0.8, 0.8) -ax = [fig1.add_axes(rect, label="%d"%i) for i in range(4)] - - -horiz = [Size.AxesX(ax[0]), Size.Fixed(.5), Size.AxesX(ax[1])] -vert = [Size.AxesY(ax[0]), Size.Fixed(.5), Size.AxesY(ax[2])] - -# divide the axes rectangle into grid whose size is specified by horiz * vert -divider = Divider(fig1, rect, horiz, vert, aspect=False) - - -ax[0].set_axes_locator(divider.new_locator(nx=0, ny=0)) -ax[1].set_axes_locator(divider.new_locator(nx=2, ny=0)) -ax[2].set_axes_locator(divider.new_locator(nx=0, ny=2)) -ax[3].set_axes_locator(divider.new_locator(nx=2, ny=2)) - -ax[0].set_xlim(0, 2) -ax[1].set_xlim(0, 1) - -ax[0].set_ylim(0, 1) -ax[2].set_ylim(0, 2) - -divider.set_aspect(1.) - -for ax1 in ax: - plt.setp(ax1.get_xticklabels()+ax1.get_yticklabels(), - visible=False) - -plt.draw() -plt.show() diff --git a/mpl_toolkits/axes_grid/figures/simple_axis_direction01.hires.png b/mpl_toolkits/axes_grid/figures/simple_axis_direction01.hires.png deleted file mode 100644 index 9e3c634018b..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_axis_direction01.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_axis_direction01.pdf b/mpl_toolkits/axes_grid/figures/simple_axis_direction01.pdf deleted file mode 100644 index 1bacb7e5abe..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_axis_direction01.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_axis_direction01.png b/mpl_toolkits/axes_grid/figures/simple_axis_direction01.png deleted file mode 100644 index e30e2608cc6..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_axis_direction01.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_axis_direction01.py b/mpl_toolkits/axes_grid/figures/simple_axis_direction01.py deleted file mode 100644 index d182d582694..00000000000 --- a/mpl_toolkits/axes_grid/figures/simple_axis_direction01.py +++ /dev/null @@ -1,15 +0,0 @@ -import matplotlib.pyplot as plt -import mpl_toolkits.axisartist as axisartist - -fig = plt.figure(figsize=(4,2.5)) -ax1 = fig.add_subplot(axisartist.Subplot(fig, "111")) -fig.subplots_adjust(right=0.8) - -ax1.axis["left"].major_ticklabels.set_axis_direction("top") -ax1.axis["left"].label.set_text("Label") - -ax1.axis["right"].label.set_visible(True) -ax1.axis["right"].label.set_text("Label") -ax1.axis["right"].label.set_axis_direction("left") - -plt.show() diff --git a/mpl_toolkits/axes_grid/figures/simple_axis_direction03.hires.png b/mpl_toolkits/axes_grid/figures/simple_axis_direction03.hires.png deleted file mode 100644 index 1bb50532f94..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_axis_direction03.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_axis_direction03.pdf b/mpl_toolkits/axes_grid/figures/simple_axis_direction03.pdf deleted file mode 100644 index 911ff53fcc8..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_axis_direction03.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_axis_direction03.png b/mpl_toolkits/axes_grid/figures/simple_axis_direction03.png deleted file mode 100644 index 576bbbb4b19..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_axis_direction03.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_axis_direction03.py b/mpl_toolkits/axes_grid/figures/simple_axis_direction03.py deleted file mode 100644 index 0cffb9ffe53..00000000000 --- a/mpl_toolkits/axes_grid/figures/simple_axis_direction03.py +++ /dev/null @@ -1,31 +0,0 @@ - -import matplotlib.pyplot as plt -import mpl_toolkits.axisartist as axisartist - -def setup_axes(fig, rect): - ax = axisartist.Subplot(fig, rect) - fig.add_subplot(ax) - - ax.set_yticks([0.2, 0.8]) - ax.set_xticks([0.2, 0.8]) - - return ax - -fig = plt.figure(1, figsize=(5, 2)) -fig.subplots_adjust(wspace=0.4, bottom=0.3) - -ax1 = setup_axes(fig, "121") -ax1.set_xlabel("X-label") -ax1.set_ylabel("Y-label") - -ax1.axis[:].invert_ticklabel_direction() - -ax2 = setup_axes(fig, "122") -ax2.set_xlabel("X-label") -ax2.set_ylabel("Y-label") - -ax2.axis[:].major_ticks.set_tick_out(True) - -plt.show() - - diff --git a/mpl_toolkits/axes_grid/figures/simple_axis_pad.hires.png b/mpl_toolkits/axes_grid/figures/simple_axis_pad.hires.png deleted file mode 100644 index 5414ee01318..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_axis_pad.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_axis_pad.pdf b/mpl_toolkits/axes_grid/figures/simple_axis_pad.pdf deleted file mode 100644 index 3e1dc5ac507..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_axis_pad.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_axis_pad.png b/mpl_toolkits/axes_grid/figures/simple_axis_pad.png deleted file mode 100644 index 49e530322ec..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_axis_pad.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_axis_pad.py b/mpl_toolkits/axes_grid/figures/simple_axis_pad.py deleted file mode 100644 index bfbfb00b434..00000000000 --- a/mpl_toolkits/axes_grid/figures/simple_axis_pad.py +++ /dev/null @@ -1,112 +0,0 @@ - - -import numpy as np -import mpl_toolkits.axisartist.angle_helper as angle_helper -import mpl_toolkits.axisartist.grid_finder as grid_finder -from matplotlib.projections import PolarAxes -from matplotlib.transforms import Affine2D - -import mpl_toolkits.axisartist as axisartist - -from mpl_toolkits.axisartist.grid_helper_curvelinear import GridHelperCurveLinear - - -def setup_axes(fig, rect): - """ - polar projection, but in a rectangular box. - """ - - # see demo_curvelinear_grid.py for details - tr = Affine2D().scale(np.pi/180., 1.) + PolarAxes.PolarTransform() - - extreme_finder = angle_helper.ExtremeFinderCycle(20, 20, - lon_cycle = 360, - lat_cycle = None, - lon_minmax = None, - lat_minmax = (0, np.inf), - ) - - grid_locator1 = angle_helper.LocatorDMS(12) - grid_locator2 = grid_finder.MaxNLocator(5) - - tick_formatter1 = angle_helper.FormatterDMS() - - grid_helper = GridHelperCurveLinear(tr, - extreme_finder=extreme_finder, - grid_locator1=grid_locator1, - grid_locator2=grid_locator2, - tick_formatter1=tick_formatter1 - ) - - - ax1 = axisartist.Subplot(fig, rect, grid_helper=grid_helper) - #ax1.axis[:].toggle(all=False) - ax1.axis[:].set_visible(False) - - fig.add_subplot(ax1) - - ax1.set_aspect(1.) - ax1.set_xlim(-5, 12) - ax1.set_ylim(-5, 10) - - #ax1.grid(True) - - return ax1 - - -def add_floating_axis1(ax1): - ax1.axis["lat"] = axis = ax1.new_floating_axis(0, 30) - axis.label.set_text(r"$\theta = 30^{\circ}$") - axis.label.set_visible(True) - - return axis - - -def add_floating_axis2(ax1): - ax1.axis["lon"] = axis = ax1.new_floating_axis(1, 6) - axis.label.set_text(r"$r = 6$") - axis.label.set_visible(True) - - return axis - - -import matplotlib.pyplot as plt -fig = plt.figure(1, figsize=(9, 3.)) -fig.clf() -fig.subplots_adjust(left=0.01, right=0.99, bottom=0.01, top=0.99, - wspace=0.01, hspace=0.01) - - -def ann(ax1, d): - if plt.rcParams["text.usetex"]: - d = d.replace("_", r"\_") - - ax1.annotate(d, (0.5, 1), (5, -5), - xycoords="axes fraction", textcoords="offset points", - va="top", ha="center") - -ax1 = setup_axes(fig, rect=141) -axis = add_floating_axis1(ax1) -ann(ax1, r"default") - -ax1 = setup_axes(fig, rect=142) -axis = add_floating_axis1(ax1) -axis.major_ticklabels.set_pad(10) -ann(ax1, r"ticklabels.set_pad(10)") - -ax1 = setup_axes(fig, rect=143) -axis = add_floating_axis1(ax1) -axis.label.set_pad(20) -ann(ax1, r"label.set_pad(20)") - -ax1 = setup_axes(fig, rect=144) -axis = add_floating_axis1(ax1) -axis.major_ticks.set_tick_out(True) -ann(ax1, "ticks.set_tick_out(True)") - - -#ax1.axis["bottom"].toggle(all=True) - -plt.show() - - diff --git a/mpl_toolkits/axes_grid/figures/simple_axisartist1.hires.png b/mpl_toolkits/axes_grid/figures/simple_axisartist1.hires.png deleted file mode 100644 index ffc28e39a7b..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_axisartist1.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_axisartist1.pdf b/mpl_toolkits/axes_grid/figures/simple_axisartist1.pdf deleted file mode 100644 index d65e37f0db0..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_axisartist1.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_axisartist1.png b/mpl_toolkits/axes_grid/figures/simple_axisartist1.png deleted file mode 100644 index cbbfde192a6..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_axisartist1.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_axisartist1.py b/mpl_toolkits/axes_grid/figures/simple_axisartist1.py deleted file mode 100644 index d9a8a69094e..00000000000 --- a/mpl_toolkits/axes_grid/figures/simple_axisartist1.py +++ /dev/null @@ -1,22 +0,0 @@ -import matplotlib.pyplot as plt -import mpl_toolkits.axisartist as AA - -fig = plt.figure(1) -fig.subplots_adjust(right=0.85) -ax = AA.Subplot(fig, 1, 1, 1) -fig.add_subplot(ax) - -# make some axis invisible -ax.axis["bottom", "top", "right"].set_visible(False) - -# make an new axis along the first axis axis (x-axis) which pass -# through y=0. -ax.axis["y=0"] = ax.new_floating_axis(nth_coord=0, value=0, - axis_direction="bottom") -ax.axis["y=0"].toggle(all=True) -ax.axis["y=0"].label.set_text("y = 0") - -ax.set_ylim(-2, 4) - -plt.show() - diff --git a/mpl_toolkits/axes_grid/figures/simple_axisline3.hires.png b/mpl_toolkits/axes_grid/figures/simple_axisline3.hires.png deleted file mode 100644 index 2d685ac2a67..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_axisline3.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_axisline3.pdf b/mpl_toolkits/axes_grid/figures/simple_axisline3.pdf deleted file mode 100644 index 5a4d983a5cd..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_axisline3.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_axisline3.png b/mpl_toolkits/axes_grid/figures/simple_axisline3.png deleted file mode 100644 index edf75bf991c..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_axisline3.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_axisline3.py b/mpl_toolkits/axes_grid/figures/simple_axisline3.py deleted file mode 100644 index 68d42677cd5..00000000000 --- a/mpl_toolkits/axes_grid/figures/simple_axisline3.py +++ /dev/null @@ -1,13 +0,0 @@ -import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid.axislines import Subplot - -fig = plt.figure(1, (3,3)) - -ax = Subplot(fig, 111) -fig.add_subplot(ax) - -ax.axis["right"].set_visible(False) -ax.axis["top"].set_visible(False) - -plt.show() - diff --git a/mpl_toolkits/axes_grid/figures/simple_colorbar.hires.png b/mpl_toolkits/axes_grid/figures/simple_colorbar.hires.png deleted file mode 100644 index eb9b292c5ca..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_colorbar.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_colorbar.pdf b/mpl_toolkits/axes_grid/figures/simple_colorbar.pdf deleted file mode 100644 index 6def1b2697a..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_colorbar.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_colorbar.png b/mpl_toolkits/axes_grid/figures/simple_colorbar.png deleted file mode 100644 index ddb2edf19b8..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_colorbar.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_colorbar.py b/mpl_toolkits/axes_grid/figures/simple_colorbar.py deleted file mode 100644 index c2f67d9a16e..00000000000 --- a/mpl_toolkits/axes_grid/figures/simple_colorbar.py +++ /dev/null @@ -1,14 +0,0 @@ -import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid1 import make_axes_locatable -import numpy as np - -ax = plt.subplot(111) -im = ax.imshow(np.arange(100).reshape((10,10))) - -# create an axes on the right side of ax. The width of cax will be 5% -# of ax and the padding between cax and ax will be fixed at 0.05 inch. -divider = make_axes_locatable(ax) -cax = divider.append_axes("right", size="5%", pad=0.05) - -plt.colorbar(im, cax=cax) - diff --git a/mpl_toolkits/axes_grid/figures/simple_rgb.hires.png b/mpl_toolkits/axes_grid/figures/simple_rgb.hires.png deleted file mode 100644 index bd58a201272..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_rgb.hires.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_rgb.pdf b/mpl_toolkits/axes_grid/figures/simple_rgb.pdf deleted file mode 100644 index 7cc8788e1b1..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_rgb.pdf and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_rgb.png b/mpl_toolkits/axes_grid/figures/simple_rgb.png deleted file mode 100644 index 1fc91553e27..00000000000 Binary files a/mpl_toolkits/axes_grid/figures/simple_rgb.png and /dev/null differ diff --git a/mpl_toolkits/axes_grid/figures/simple_rgb.py b/mpl_toolkits/axes_grid/figures/simple_rgb.py deleted file mode 100644 index 14379d3b9d4..00000000000 --- a/mpl_toolkits/axes_grid/figures/simple_rgb.py +++ /dev/null @@ -1,38 +0,0 @@ -import matplotlib.pyplot as plt - -from mpl_toolkits.axes_grid1.axes_rgb import RGBAxes - -def get_demo_image(): - import numpy as np - from matplotlib.cbook import get_sample_data - f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) - z = np.load(f) - # z is a numpy array of 15x15 - return z, (-3,4,-4,3) - -def get_rgb(): - Z, extent = get_demo_image() - - Z[Z<0] = 0. - Z = Z/Z.max() - - R = Z[:13,:13] - G = Z[2:,2:] - B = Z[:13,2:] - - return R, G, B - - -fig = plt.figure(1) -ax = RGBAxes(fig, [0.1, 0.1, 0.8, 0.8]) - -r, g, b = get_rgb() -kwargs = dict(origin="lower", interpolation="nearest") -ax.imshow_rgb(r, g, b, **kwargs) - -ax.RGB.set_xlim(0., 9.5) -ax.RGB.set_ylim(0.9, 10.6) - - -plt.draw() -plt.show() diff --git a/mpl_toolkits/axes_grid/index.html b/mpl_toolkits/axes_grid/index.html deleted file mode 100644 index 2834e88ab22..00000000000 --- a/mpl_toolkits/axes_grid/index.html +++ /dev/null @@ -1,362 +0,0 @@ - - - - - - - - Matplotlib AxesGrid Toolkit — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -

    Related Topics

    - -
    -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    Matplotlib AxesGrid Toolkit

    -

    The matplotlib AxesGrid toolkit is a collection of helper classes to -ease displaying multiple images in matplotlib. While the aspect -parameter in matplotlib adjust the position of the single axes, -AxesGrid toolkit provides a framework to adjust the position of -multiple axes according to their aspects.

    -../../_images/demo_axes_grid1.png -
    -

    Note

    -

    AxesGrid toolkit has been a part of matplotlib since v -0.99. Originally, the toolkit had a single namespace of -axes_grid. In more recent version (since svn r8226), the toolkit -has divided into two separate namespace (axes_grid1 and axisartist). -While axes_grid namespace is maintained for the backward compatibility, -use of axes_grid1 and axisartist is recommended.

    -
    -
    -

    Warning

    -

    axes_grid and axisartist (but not axes_grid1) uses -a custom Axes class (derived from the mpl’s original Axes class). -As a side effect, some commands (mostly tick-related) do not work. -Use axes_grid1 to avoid this, or see how things are different in -axes_grid and axisartist (LINK needed)

    -
    - -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/mpl_toolkits/axes_grid/users/axes_divider.html b/mpl_toolkits/axes_grid/users/axes_divider.html deleted file mode 100644 index 43b7419ce5a..00000000000 --- a/mpl_toolkits/axes_grid/users/axes_divider.html +++ /dev/null @@ -1,489 +0,0 @@ - - - - - - - - AxesDivider — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    AxesDivider

    -

    The axes_divider module provide helper classes to adjust the axes -positions of set of images in the drawing time.

    -
      -
    • axes_size provides a classes of -units that the size of each axes will be determined. For example, -you can specify a fixed size
    • -
    • Divider this is the class -that is used calculates the axes position. It divides the given -rectangular area into several areas. You initialize the divider by -setting the horizontal and vertical list of sizes that the division -will be based on. You then use the new_locator method, whose return -value is a callable object that can be used to set the axes_locator -of the axes.
    • -
    -

    You first initialize the divider by specifying its grids, i.e., -horizontal and vertical.

    -

    for example,:

    -
    rect = [0.2, 0.2, 0.6, 0.6]
    -horiz=[h0, h1, h2, h3]
    -vert=[v0, v1, v2]
    -divider = Divider(fig, rect, horiz, vert)
    -
    -
    -

    where, rect is a bounds of the box that will be divided and h0,..h3, -v0,..v2 need to be an instance of classes in the -axes_size. They have get_size method -that returns a tuple of two floats. The first float is the relative -size, and the second float is the absolute size. Consider a following -grid.

    - ------ - - - - - - - - - - - - - - - - - -
    v0   
    v1   
    h0,v2h1h2h3
    -
      -
    • v0 => 0, 2
    • -
    • v1 => 2, 0
    • -
    • v2 => 3, 0
    • -
    -

    The height of the bottom row is always 2 (axes_divider internally -assumes that the unit is inch). The first and the second rows with -height ratio of 2:3. For example, if the total height of the grid 6, -then the first and second row will each occupy 2/(2+3) and 3/(2+3) of -(6-1) inches. The widths of columns (horiz) will be similarly -determined. When aspect ratio is set, the total height (or width) will -be adjusted accordingly.

    -

    The mpl_toolkits.axes_grid.axes_size contains several classes -that can be used to set the horizontal and vertical configurations. For -example, for the vertical configuration above will be:

    -
    from mpl_toolkits.axes_grid.axes_size import Fixed, Scaled
    -vert = [Fixed(2), Scaled(2), Scaled(3)]
    -
    -
    -

    After you set up the divider object, then you create a locator -instance which will be given to the axes.:

    -
    locator = divider.new_locator(nx=0, ny=1)
    -ax.set_axes_locator(locator)
    -
    -
    -

    The return value of the new_locator method is a instance of the -AxesLocator class. It is a callable object that returns the -location and size of the cell at the first column and the second row. -You may create a locator that spans over multiple cells.:

    -
    locator = divider.new_locator(nx=0, nx=2, ny=1)
    -
    -
    -

    The above locator, when called, will return the position and size of -the cells spanning the first and second column and the first row. You -may consider it as [0:2, 1].

    -

    See the example,

    -
    import mpl_toolkits.axes_grid.axes_size as Size
    -from mpl_toolkits.axes_grid import Divider
    -import matplotlib.pyplot as plt
    -
    -fig1 = plt.figure(1, (5.5, 4.))
    -
    -# the rect parameter will be ignore as we will set axes_locator
    -rect = (0.1, 0.1, 0.8, 0.8)
    -ax = [fig1.add_axes(rect, label="%d"%i) for i in range(4)]
    -
    -horiz = [Size.Scaled(1.5), Size.Fixed(.5), Size.Scaled(1.),
    -         Size.Scaled(.5)]
    -
    -vert = [Size.Scaled(1.), Size.Fixed(.5), Size.Scaled(1.5)]
    -
    -# divide the axes rectangle into grid whose size is specified by horiz * vert
    -divider = Divider(fig1, rect, horiz, vert, aspect=False)
    -
    -ax[0].set_axes_locator(divider.new_locator(nx=0, ny=0))
    -ax[1].set_axes_locator(divider.new_locator(nx=0, ny=2))
    -ax[2].set_axes_locator(divider.new_locator(nx=2, ny=2))
    -ax[3].set_axes_locator(divider.new_locator(nx=2, nx1=4, ny=0))
    -
    -for ax1 in ax:
    -    plt.setp(ax1.get_xticklabels()+ax1.get_yticklabels(),
    -             visible=False)
    -
    -plt.draw()
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../../../_images/simple_axes_divider2.png -
    -

    You can adjust the size of the each axes according to their x or y -data limits (AxesX and AxesY), similar to the axes aspect parameter.

    -
    import mpl_toolkits.axes_grid.axes_size as Size
    -from mpl_toolkits.axes_grid import Divider
    -import matplotlib.pyplot as plt
    -
    -
    -fig1 = plt.figure(1, (5.5, 4))
    -
    -# the rect parameter will be ignore as we will set axes_locator
    -rect = (0.1, 0.1, 0.8, 0.8)
    -ax = [fig1.add_axes(rect, label="%d"%i) for i in range(4)]
    -
    -
    -horiz = [Size.AxesX(ax[0]), Size.Fixed(.5), Size.AxesX(ax[1])]
    -vert = [Size.AxesY(ax[0]), Size.Fixed(.5), Size.AxesY(ax[2])]
    -
    -# divide the axes rectangle into grid whose size is specified by horiz * vert
    -divider = Divider(fig1, rect, horiz, vert, aspect=False)
    -
    -
    -ax[0].set_axes_locator(divider.new_locator(nx=0, ny=0))
    -ax[1].set_axes_locator(divider.new_locator(nx=2, ny=0))
    -ax[2].set_axes_locator(divider.new_locator(nx=0, ny=2))
    -ax[3].set_axes_locator(divider.new_locator(nx=2, ny=2))
    -
    -ax[0].set_xlim(0, 2)
    -ax[1].set_xlim(0, 1)
    -
    -ax[0].set_ylim(0, 1)
    -ax[2].set_ylim(0, 2)
    -
    -divider.set_aspect(1.)
    -
    -for ax1 in ax:
    -    plt.setp(ax1.get_xticklabels()+ax1.get_yticklabels(),
    -             visible=False)
    -
    -plt.draw()
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../../../_images/simple_axes_divider3.png -
    -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/mpl_toolkits/axes_grid/users/axisartist.html b/mpl_toolkits/axes_grid/users/axisartist.html deleted file mode 100644 index 35d18fa3612..00000000000 --- a/mpl_toolkits/axes_grid/users/axisartist.html +++ /dev/null @@ -1,885 +0,0 @@ - - - - - - - - AXISARTIST namespace — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - - - -
    -
    -
    -
    - -
    -

    AXISARTIST namespace

    -

    The AxisArtist namespace includes a derived Axes implementation. The -biggest difference is that the artists responsible to draw axis line, -ticks, ticklabel and axis labels are separated out from the mpl’s Axis -class, which are much more than artists in the original mpl. This -change was strongly motivated to support curvilinear grid. Here are a -few things that mpl_tootlkits.axisartist.Axes is different from original -Axes from mpl.

    -
      -
    • Axis elements (axis line(spine), ticks, ticklabel and axis labels) -are drawn by a AxisArtist instance. Unlike Axis, left, right, top -and bottom axis are drawn by separate artists. And each of them may -have different tick location and different tick labels.
    • -
    • gridlines are drawn by a Gridlines instance. The change was -motivated that in curvilinear coordinate, a gridline may not cross -axis-lines (i.e., no associated ticks). In the original Axes class, -gridlines are tied to ticks.
    • -
    • ticklines can be rotated if necessary (i.e, along the gridlines)
    • -
    -

    In summary, all these changes was to support

    -
      -
    • a curvilinear grid.
    • -
    • a floating axis
    • -
    -

    (Source code, png, pdf)

    -
    -../../../_images/demo_floating_axis1.png -
    -

    mpl_toolkits.axisartist.Axes class defines a axis attribute, which -is a dictionary of AxisArtist instances. By default, the dictionary -has 4 AxisArtist instances, responsible for drawing of left, right, -bottom and top axis.

    -

    xaxis and yaxis attributes are still available, however they are set -to not visible. As separate artists are used for rendering axis, some -axis-related method in mpl may have no effect. -In addition to AxisArtist instances, the mpl_toolkits.axisartist.Axes will -have gridlines attribute (Gridlines), which obviously draws grid -lines.

    -

    In both AxisArtist and Gridlines, the calculation of tick and grid -location is delegated to an instance of GridHelper class. -mpl_toolkits.axisartist.Axes class uses GridHelperRectlinear as a grid -helper. The GridHelperRectlinear class is a wrapper around the xaxis -and yaxis of mpl’s original Axes, and it was meant to work as the -way how mpl’s original axes works. For example, tick location changes -using set_ticks method and etc. should work as expected. But change in -artist properties (e.g., color) will not work in general, although -some effort has been made so that some often-change attributes (color, -etc.) are respected.

    -
    -

    AxisArtist

    -

    AxisArtist can be considered as a container artist with following -attributes which will draw ticks, labels, etc.

    -
    -
      -
    • line
    • -
    • major_ticks, major_ticklabels
    • -
    • minor_ticks, minor_ticklabels
    • -
    • offsetText
    • -
    • label
    • -
    -
    -
    -

    line

    -

    Derived from Line2d class. Responsible for drawing a spinal(?) line.

    -
    -
    -

    major_ticks, minor_ticks

    -

    Derived from Line2d class. Note that ticks are markers.

    -
    -
    -

    major_ticklabels, minor_ticklabels

    -

    Derived from Text. Note that it is not a list of Text artist, but a -single artist (similar to a collection).

    -
    -
    -

    axislabel

    -

    Derived from Text.

    -
    -
    -

    Default AxisArtists

    -

    By default, following for axis artists are defined.:

    -
    ax.axis["left"], ax.axis["bottom"], ax.axis["right"], ax.axis["top"]
    -
    -
    -

    The ticklabels and axislabel of the top and the right axis are set to -not visible.

    -

    For example, if you want to change the color attributes of -major_ticklabels of the bottom x-axis

    -
    ax.axis["bottom"].major_ticklabels.set_color("b")
    -
    -
    -

    Similarly, to make ticklabels invisible

    -
    ax.axis["bottom"].major_ticklabels.set_visible(False)
    -
    -
    -

    AxisAritst provides a helper method to control the visibility of ticks, -ticklabels, and label. To make ticklabel invisible,

    -
    ax.axis["bottom"].toggle(ticklabels=False)
    -
    -
    -

    To make all of ticks, ticklabels, and (axis) label invisible

    -
    ax.axis["bottom"].toggle(all=False)
    -
    -
    -

    To turn all off but ticks on

    -
    ax.axis["bottom"].toggle(all=False, ticks=True)
    -
    -
    -

    To turn all on but (axis) label off

    -
    ax.axis["bottom"].toggle(all=True, label=False))
    -
    -
    -

    ax.axis’s __getitem__ method can take multiple axis names. For -example, to turn ticklabels of “top” and “right” axis on,

    -
    ax.axis["top","right"].toggle(ticklabels=True))
    -
    -
    -

    Note that ‘ax.axis[“top”,”right”]’ returns a simple proxy object that translate above code to something like below.

    -
    for n in ["top","right"]:
    -  ax.axis[n].toggle(ticklabels=True))
    -
    -
    -

    So, any return values in the for loop are ignored. And you should not -use it anything more than a simple method.

    -

    Like the list indexing ”:” means all items, i.e.,

    -
    ax.axis[:].major_ticks.set_color("r")
    -
    -
    -

    changes tick color in all axis.

    -
    -
    -
    -

    HowTo

    -
      -
    1. Changing tick locations and label.
    2. -
    -
    -

    Same as the original mpl’s axes.:

    -
    ax.set_xticks([1,2,3])
    -
    -
    -
    -
      -
    1. Changing axis properties like color, etc.
    2. -
    -
    -

    Change the properties of appropriate artists. For example, to change -the color of the ticklabels:

    -
    ax.axis["left"].major_ticklabels.set_color("r")
    -
    -
    -
    -
      -
    1. To change the attributes of multiple axis:

      -
      ax.axis["left","bottom"].major_ticklabels.set_color("r")
      -
      -
      -

      or to change the attributes of all axis:

      -
      ax.axis[:].major_ticklabels.set_color("r")
      -
      -
      -
    2. -
    3. -
      To change the tick size (length), you need to use
      -

      axis.major_ticks.set_ticksize method. To change the direction of -the ticks (ticks are in opposite direction of ticklabels by -default), use axis.major_ticks.set_tick_out method.

      -

      To change the pad between ticks and ticklabels, use -axis.major_ticklabels.set_pad method.

      -

      To change the pad between ticklabels and axis label, -axis.label.set_pad method.

      -
      -
      -
    4. -
    -
    -
    -

    Rotation and Alignment of TickLabels

    -

    This is also quite different from the original mpl and can be -confusing. When you want to rotate the ticklabels, first consider -using “set_axis_direction” method.

    -
    ax1.axis["left"].major_ticklabels.set_axis_direction("top")
    -ax1.axis["right"].label.set_axis_direction("left")
    -
    -
    -

    (Source code, png, pdf)

    -
    -../../../_images/simple_axis_direction01.png -
    -

    The parameter for set_axis_direction is one of [“left”, “right”, -“bottom”, “top”].

    -

    You must understand some underlying concept of directions.

    -
    -
      -
    1. There is a reference direction which is defined as the direction -of the axis line with increasing coordinate. For example, the -reference direction of the left x-axis is from bottom to top.
    2. -
    -
    -

    (Source code, png, pdf)

    -
    -../../../_images/axis_direction_demo_step01.png -
    -

    The direction, text angle, and alignments of the ticks, ticklabels and -axis-label is determined with respect to the reference direction

    -
    -
      -
    1. ticklabel_direction is either the right-hand side (+) of the -reference direction or the left-hand side (-).
    2. -
    -
    -

    (Source code, png, pdf)

    -
    -../../../_images/axis_direction_demo_step02.png -
    -
    -
      -
    1. same for the label_direction
    2. -
    -
    -

    (Source code, png, pdf)

    -
    -../../../_images/axis_direction_demo_step03.png -
    -
    -
      -
    1. ticks are by default drawn toward the opposite direction of the ticklabels.
    2. -
    3. text rotation of ticklabels and label is determined in reference -to the ticklabel_direction or label_direction, -respectively. The rotation of ticklabels and label is anchored.
    4. -
    -
    -

    (Source code, png, pdf)

    -
    -../../../_images/axis_direction_demo_step04.png -
    -
    -
    -

    On the other hand, there is a concept of “axis_direction”. This is a -default setting of above properties for each, “bottom”, “left”, “top”, -and “right” axis.

    -
    -
    -------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ??leftbottomrighttop
    axislabeldirection‘-‘‘+’‘+’‘-‘
    axislabelrotation18000180
    axislabelvacentertopcenterbottom
    axislabelharightcenterrightcenter
    ticklabeldirection‘-‘‘+’‘+’‘-‘
    ticklabelsrotation900-90180
    ticklabelharightcenterrightcenter
    ticklabelvacenterbaselinecenterbaseline
    -
    -

    And, ‘set_axis_direction(“top”)’ means to adjust the text rotation -etc, for settings suitable for “top” axis. The concept of axis -direction can be more clear with curved axis.

    -

    (Source code, png, pdf)

    -
    -../../../_images/demo_axis_direction.png -
    -

    The axis_direction can be adjusted in the AxisArtist level, or in the -level of its child arists, i.e., ticks, ticklabels, and axis-label.

    -
    ax1.axis["left"].set_axis_direction("top")
    -
    -
    -

    changes axis_direction of all the associated artist with the “left” -axis, while

    -
    ax1.axis["left"].major_ticklabels.set_axis_direction("top")
    -
    -
    -

    changes the axis_direction of only the major_ticklabels. Note that -set_axis_direction in the AxisArtist level changes the -ticklabel_direction and label_direction, while changing the -axis_direction of ticks, ticklabels, and axis-label does not affect -them.

    -

    If you want to make ticks outward and ticklabels inside the axes, -use invert_ticklabel_direction method.

    -
    ax.axis[:].invert_ticklabel_direction()
    -
    -
    -

    A related method is “set_tick_out”. It makes ticks outward (as a -matter of fact, it makes ticks toward the opposite direction of the -default direction).

    -
    ax.axis[:].major_ticks.set_tick_out(True)
    -
    -
    -

    (Source code, png, pdf)

    -
    -../../../_images/simple_axis_direction03.png -
    -

    So, in summary,

    -
    -
      -
    • -
      AxisArtist’s methods
      -
        -
      • set_axis_direction : “left”, “right”, “bottom”, or “top”
      • -
      • set_ticklabel_direction : “+” or “-“
      • -
      • set_axislabel_direction : “+” or “-“
      • -
      • invert_ticklabel_direction
      • -
      -
      -
      -
    • -
    • -
      Ticks’ methods (major_ticks and minor_ticks)
      -
        -
      • set_tick_out : True or False
      • -
      • set_ticksize : size in points
      • -
      -
      -
      -
    • -
    • -
      TickLabels’ methods (major_ticklabels and minor_ticklabels)
      -
        -
      • set_axis_direction : “left”, “right”, “bottom”, or “top”
      • -
      • set_rotation : angle with respect to the reference direction
      • -
      • set_ha and set_va : see below
      • -
      -
      -
      -
    • -
    • -
      AxisLabels’ methods (label)
      -
        -
      • set_axis_direction : “left”, “right”, “bottom”, or “top”
      • -
      • set_rotation : angle with respect to the reference direction
      • -
      • set_ha and set_va
      • -
      -
      -
      -
    • -
    -
    -
    -

    Adjusting ticklabels alignment

    -

    Alignment of TickLabels are treated specially. See below

    -

    (Source code, png, pdf)

    -
    -../../../_images/demo_ticklabel_alignment.png -
    -
    -
    -

    Adjusting pad

    -

    To change the pad between ticks and ticklabels

    -
    ax.axis["left"].major_ticklabels.set_pad(10)
    -
    -
    -

    Or ticklabels and axis-label

    -
    ax.axis["left"].label.set_pad(10)
    -
    -
    -

    (Source code, png, pdf)

    -
    -../../../_images/simple_axis_pad.png -
    -
    -
    -
    -

    GridHelper

    -

    To actually define a curvilinear coordinate, you have to use your own -grid helper. A generalised version of grid helper class is supplied -and this class should suffice in most of cases. A user may provide -two functions which defines a transformation (and its inverse pair) -from the curved coordinate to (rectilinear) image coordinate. Note that -while ticks and grids are drawn for curved coordinate, the data -transform of the axes itself (ax.transData) is still rectilinear -(image) coordinate.

    -
    from  mpl_toolkits.axisartist.grid_helper_curvelinear \
    -     import GridHelperCurveLinear
    -from mpl_toolkits.axisartist import Subplot
    -
    -# from curved coordinate to rectlinear coordinate.
    -def tr(x, y):
    -    x, y = np.asarray(x), np.asarray(y)
    -    return x, y-x
    -
    -# from rectlinear coordinate to curved coordinate.
    -def inv_tr(x,y):
    -    x, y = np.asarray(x), np.asarray(y)
    -    return x, y+x
    -
    -
    -grid_helper = GridHelperCurveLinear((tr, inv_tr))
    -
    -ax1 = Subplot(fig, 1, 1, 1, grid_helper=grid_helper)
    -
    -fig.add_subplot(ax1)
    -
    -
    -

    You may use matplotlib’s Transform instance instead (but a -inverse transformation must be defined). Often, coordinate range in a -curved coordinate system may have a limited range, or may have -cycles. In those cases, a more customized version of grid helper is -required.

    -
    import  mpl_toolkits.axisartist.angle_helper as angle_helper
    -
    -# PolarAxes.PolarTransform takes radian. However, we want our coordinate
    -# system in degree
    -tr = Affine2D().scale(np.pi/180., 1.) + PolarAxes.PolarTransform()
    -
    -
    -# extreme finder :  find a range of coordinate.
    -# 20, 20 : number of sampling points along x, y direction
    -# The first coordinate (longitude, but theta in polar)
    -#   has a cycle of 360 degree.
    -# The second coordinate (latitude, but radius in polar)  has a minimum of 0
    -extreme_finder = angle_helper.ExtremeFinderCycle(20, 20,
    -                                                 lon_cycle = 360,
    -                                                 lat_cycle = None,
    -                                                 lon_minmax = None,
    -                                                 lat_minmax = (0, np.inf),
    -                                                 )
    -
    -# Find a grid values appropriate for the coordinate (degree,
    -# minute, second). The argument is a approximate number of grids.
    -grid_locator1 = angle_helper.LocatorDMS(12)
    -
    -# And also uses an appropriate formatter.  Note that,the
    -# acceptable Locator and Formatter class is a bit different than
    -# that of mpl's, and you cannot directly use mpl's Locator and
    -# Formatter here (but may be possible in the future).
    -tick_formatter1 = angle_helper.FormatterDMS()
    -
    -grid_helper = GridHelperCurveLinear(tr,
    -                                    extreme_finder=extreme_finder,
    -                                    grid_locator1=grid_locator1,
    -                                    tick_formatter1=tick_formatter1
    -                                    )
    -
    -
    -

    Again, the transData of the axes is still a rectilinear coordinate -(image coordinate). You may manually do conversion between two -coordinates, or you may use Parasite Axes for convenience.:

    -
    ax1 = SubplotHost(fig, 1, 2, 2, grid_helper=grid_helper)
    -
    -# A parasite axes with given transform
    -ax2 = ParasiteAxesAuxTrans(ax1, tr, "equal")
    -# note that ax2.transData == tr + ax1.transData
    -# Anthing you draw in ax2 will match the ticks and grids of ax1.
    -ax1.parasites.append(ax2)
    -
    -
    -

    (Source code, png, pdf)

    -
    -../../../_images/demo_curvelinear_grid1.png -
    -
    -
    -

    FloatingAxis

    -

    A floating axis is an axis one of whose data coordinate is fixed, i.e, -its location is not fixed in Axes coordinate but changes as axes data -limits changes. A floating axis can be created using -new_floating_axis method. However, it is your responsibility that -the resulting AxisArtist is properly added to the axes. A recommended -way is to add it as an item of Axes’s axis attribute.:

    -
    # floating axis whose first (index starts from 0) coordinate
    -# (theta) is fixed at 60
    -
    -ax1.axis["lat"] = axis = ax1.new_floating_axis(0, 60)
    -axis.label.set_text(r"$\theta = 60^{\circ}$")
    -axis.label.set_visible(True)
    -
    -
    -

    See the first example of this page.

    -
    -
    -

    Current Limitations and TODO’s

    -

    The code need more refinement. Here is a incomplete list of issues and TODO’s

    -
      -
    • No easy way to support a user customized tick location (for -curvilinear grid). A new Locator class needs to be created.
    • -
    • FloatingAxis may have coordinate limits, e.g., a floating axis of x -= 0, but y only spans from 0 to 1.
    • -
    • The location of axislabel of FloatingAxis needs to be optionally -given as a coordinate value. ex, a floating axis of x=0 with label at y=1
    • -
    -
    -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/mpl_toolkits/axes_grid/users/index.html b/mpl_toolkits/axes_grid/users/index.html deleted file mode 100644 index e04e638b4a1..00000000000 --- a/mpl_toolkits/axes_grid/users/index.html +++ /dev/null @@ -1,350 +0,0 @@ - - - - - - - - The Matplotlib AxesGrid Toolkit User’s Guide — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -
    -

    This Page

    - -
    - - -
    -
    - - - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/mpl_toolkits/axes_grid/users/overview.html b/mpl_toolkits/axes_grid/users/overview.html deleted file mode 100644 index 06ff5e3131d..00000000000 --- a/mpl_toolkits/axes_grid/users/overview.html +++ /dev/null @@ -1,1093 +0,0 @@ - - - - - - - - Overview of AxesGrid toolkit — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - - - -
    -
    -
    -
    - -
    -

    Overview of AxesGrid toolkit

    -
    -

    What is AxesGrid toolkit?

    -

    The matplotlib AxesGrid toolkit is a collection of helper classes, -mainly to ease displaying (multiple) images in matplotlib.

    -
    -

    Note

    -

    AxesGrid toolkit has been a part of matplotlib since v -0.99. Originally, the toolkit had a single namespace of -axes_grid. In more recent version (since svn r8226), the toolkit -has divided into two separate namespace (axes_grid1 and axisartist). -While axes_grid namespace is maintained for the backward compatibility, -use of axes_grid1 and axisartist is recommended.

    -
    -
    -

    Warning

    -

    axes_grid and axisartist (but not axes_grid1) uses -a custom Axes class (derived from the mpl’s original Axes class). -As a side effect, some commands (mostly tick-related) do not work. -Use axes_grid1 to avoid this, or see how things are different in -axes_grid and axisartist (LINK needed)

    -
    -

    AxesGrid toolkit has two namespaces (axes_grid1 and axisartist). -axisartist contains custom Axes class that is meant to support for -curvilinear grids (e.g., the world coordinate system in astronomy). -Unlike mpl’s original Axes class which uses Axes.xaxis and Axes.yaxis -to draw ticks, ticklines and etc., Axes in axisartist uses special -artist (AxisArtist) which can handle tick, ticklines and etc. for -curved coordinate systems.

    -

    (Source code, png, pdf)

    -
    -../../../_images/demo_floating_axis1.png -
    -

    Since it uses a special artists, some mpl commands that work on -Axes.xaxis and Axes.yaxis may not work. See LINK for more detail.

    -

    axes_grid1 is a collection of helper classes to ease displaying -(multiple) images with matplotlib. In matplotlib, the axes location -(and size) is specified in the normalized figure coordinates, which -may not be ideal for displaying images that needs to have a given -aspect ratio. For example, it helps you to have a colorbar whose -height always matches that of the image. ImageGrid, RGB Axes and -AxesDivider are helper classes that deals with adjusting the -location of (multiple) Axes. They provides a framework to adjust the -position of multiple axes at the drawing time. ParasiteAxes -provides twinx(or twiny)-like features so that you can plot different -data (e.g., different y-scale) in a same Axes. AnchoredArtists -includes custom artists which are placed at some anchored position, -like the legend.

    -

    (Source code, png, pdf)

    -
    -../../../_images/demo_axes_grid3.png -
    -
    -
    -

    AXES_GRID1

    -
    -

    ImageGrid

    -

    A class that creates a grid of Axes. In matplotlib, the axes location -(and size) is specified in the normalized figure coordinates. This may -not be ideal for images that needs to be displayed with a given aspect -ratio. For example, displaying images of a same size with some fixed -padding between them cannot be easily done in matplotlib. ImageGrid is -used in such case.

    -
    import matplotlib.pyplot as plt
    -from mpl_toolkits.axes_grid1 import ImageGrid
    -import numpy as np
    -
    -im = np.arange(100)
    -im.shape = 10, 10
    -
    -fig = plt.figure(1, (4., 4.))
    -grid = ImageGrid(fig, 111,  # similar to subplot(111)
    -                 nrows_ncols=(2, 2),  # creates 2x2 grid of axes
    -                 axes_pad=0.1,  # pad between axes in inch.
    -                 )
    -
    -for i in range(4):
    -    grid[i].imshow(im)  # The AxesGrid object work as a list of axes.
    -
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../../../_images/simple_axesgrid1.png -
    -
      -
    • The position of each axes is determined at the drawing time (see -AxesDivider), so that the size of the entire grid fits in the -given rectangle (like the aspect of axes). Note that in this example, -the paddings between axes are fixed even if you changes the figure -size.

      -
    • -
    • axes in the same column has a same axes width (in figure -coordinate), and similarly, axes in the same row has a same -height. The widths (height) of the axes in the same row (column) are -scaled according to their view limits (xlim or ylim).

      -
      import matplotlib.pyplot as plt
      -from mpl_toolkits.axes_grid1 import ImageGrid
      -
      -
      -def get_demo_image():
      -    import numpy as np
      -    from matplotlib.cbook import get_sample_data
      -    f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False)
      -    z = np.load(f)
      -    # z is a numpy array of 15x15
      -    return z, (-3, 4, -4, 3)
      -
      -F = plt.figure(1, (5.5, 3.5))
      -grid = ImageGrid(F, 111,  # similar to subplot(111)
      -                 nrows_ncols=(1, 3),
      -                 axes_pad=0.1,
      -                 add_all=True,
      -                 label_mode="L",
      -                 )
      -
      -Z, extent = get_demo_image()  # demo image
      -
      -im1 = Z
      -im2 = Z[:, :10]
      -im3 = Z[:, 10:]
      -vmin, vmax = Z.min(), Z.max()
      -for i, im in enumerate([im1, im2, im3]):
      -    ax = grid[i]
      -    ax.imshow(im, origin="lower", vmin=vmin,
      -              vmax=vmax, interpolation="nearest")
      -
      -plt.draw()
      -plt.show()
      -
      -
      -

      (Source code, png, pdf)

      -
      -../../../_images/simple_axesgrid21.png -
      -
    • -
    • xaxis are shared among axes in a same column. Similarly, yaxis are -shared among axes in a same row. Therefore, changing axis properties -(view limits, tick location, etc. either by plot commands or using -your mouse in interactive backends) of one axes will affect all -other shared axes.

      -
    • -
    -

    When initialized, ImageGrid creates given number (ngrids or ncols * -nrows if ngrids is None) of Axes instances. A sequence-like -interface is provided to access the individual Axes instances (e.g., -grid[0] is the first Axes in the grid. See below for the order of -axes).

    -

    AxesGrid takes following arguments,

    -
    -
    ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameDefaultDescription
    fig  
    rect  
    nrows_ncols number of rows and cols. e.g., (2,2)
    ngridsNonenumber of grids. nrows x ncols if None
    direction“row”increasing direction of axes number. [row|column]
    axes_pad0.02pad between axes in inches
    add_allTrueAdd axes to figures if True
    share_allFalsexaxis & yaxis of all axes are shared if True
    aspectTrueaspect of axes
    label_mode“L”location of tick labels thaw will be displayed. -“1” (only the lower left axes), -“L” (left most and bottom most axes), -or “all”.
    cbar_modeNone[None|single|each]
    cbar_location“right”[right|top]
    cbar_padNonepad between image axes and colorbar axes
    cbar_size“5%”size of the colorbar
    axes_classNone 
    -
    -
    rect
    -
    specifies the location of the grid. You can either specify -coordinates of the rectangle to be used (e.g., (0.1, 0.1, 0.8, 0.8) -as in the Axes), or the subplot-like position (e.g., “121”).
    -
    direction
    -
    means the increasing direction of the axes number.
    -
    aspect
    -
    By default (False), widths and heights of axes in the grid are -scaled independently. If True, they are scaled according to their -data limits (similar to aspect parameter in mpl).
    -
    share_all
    -
    if True, xaxis and yaxis of all axes are shared.
    -
    direction
    -

    direction of increasing axes number. For “row”,

    -
    -
    ---- - - - - - - - - -
    grid[0]grid[1]
    grid[2]grid[3]
    -
    -

    For “column”,

    -
    -
    ---- - - - - - - - - -
    grid[0]grid[2]
    grid[1]grid[3]
    -
    -
    -
    -
    -

    You can also create a colorbar (or colorbars). You can have colorbar -for each axes (cbar_mode=”each”), or you can have a single colorbar -for the grid (cbar_mode=”single”). The colorbar can be placed on your -right, or top. The axes for each colorbar is stored as a cbar_axes -attribute.

    -

    The examples below show what you can do with AxesGrid.

    -

    (Source code, png, pdf)

    -
    -../../../_images/demo_axes_grid3.png -
    -
    -
    -

    AxesDivider

    -

    Behind the scene, the ImageGrid class and the RGBAxes class utilize the -AxesDivider class, whose role is to calculate the location of the axes -at drawing time. While a more about the AxesDivider is (will be) -explained in (yet to be written) AxesDividerGuide, direct use of the -AxesDivider class will not be necessary for most users. The -axes_divider module provides a helper function make_axes_locatable, -which can be useful. It takes a existing axes instance and create a -divider for it.

    -
    ax = subplot(1,1,1)
    -divider = make_axes_locatable(ax)
    -
    -
    -

    make_axes_locatable returns an instance of the AxesLocator class, -derived from the Locator. It provides append_axes method that -creates a new axes on the given side of (“top”, “right”, “bottom” and -“left”) of the original axes.

    -
    -
    -

    colorbar whose height (or width) in sync with the master axes

    -
    import matplotlib.pyplot as plt
    -from mpl_toolkits.axes_grid1 import make_axes_locatable
    -import numpy as np
    -
    -ax = plt.subplot(111)
    -im = ax.imshow(np.arange(100).reshape((10,10)))
    -
    -# create an axes on the right side of ax. The width of cax will be 5%
    -# of ax and the padding between cax and ax will be fixed at 0.05 inch.
    -divider = make_axes_locatable(ax)
    -cax = divider.append_axes("right", size="5%", pad=0.05)
    -
    -plt.colorbar(im, cax=cax)
    -
    -
    -

    (Source code, png, pdf)

    -
    -../../../_images/simple_colorbar.png -
    -
    -

    scatter_hist.py with AxesDivider

    -

    The “scatter_hist.py” example in mpl can be rewritten using -make_axes_locatable.

    -
    axScatter = subplot(111)
    -axScatter.scatter(x, y)
    -axScatter.set_aspect(1.)
    -
    -# create new axes on the right and on the top of the current axes.
    -divider = make_axes_locatable(axScatter)
    -axHistx = divider.append_axes("top", size=1.2, pad=0.1, sharex=axScatter)
    -axHisty = divider.append_axes("right", size=1.2, pad=0.1, sharey=axScatter)
    -
    -# the scatter plot:
    -# histograms
    -bins = np.arange(-lim, lim + binwidth, binwidth)
    -axHistx.hist(x, bins=bins)
    -axHisty.hist(y, bins=bins, orientation='horizontal')
    -
    -
    -

    See the full source code below.

    -

    (Source code, png, pdf)

    -
    -../../../_images/scatter_hist1.png -
    -

    The scatter_hist using the AxesDivider has some advantage over the -original scatter_hist.py in mpl. For example, you can set the aspect -ratio of the scatter plot, even with the x-axis or y-axis is shared -accordingly.

    -
    -
    -
    -

    ParasiteAxes

    -

    The ParasiteAxes is an axes whose location is identical to its host -axes. The location is adjusted in the drawing time, thus it works even -if the host change its location (e.g., images).

    -

    In most cases, you first create a host axes, which provides a few -method that can be used to create parasite axes. They are twinx, -twiny (which are similar to twinx and twiny in the matplotlib) and -twin. twin takes an arbitrary transformation that maps between the -data coordinates of the host axes and the parasite axes. draw -method of the parasite axes are never called. Instead, host axes -collects artists in parasite axes and draw them as if they belong to -the host axes, i.e., artists in parasite axes are merged to those of -the host axes and then drawn according to their zorder. The host and -parasite axes modifies some of the axes behavior. For example, color -cycle for plot lines are shared between host and parasites. Also, the -legend command in host, creates a legend that includes lines in the -parasite axes. To create a host axes, you may use host_suplot or -host_axes command.

    -
    -

    Example 1. twinx

    -
    from mpl_toolkits.axes_grid1 import host_subplot
    -import matplotlib.pyplot as plt
    -
    -host = host_subplot(111)
    -
    -par = host.twinx()
    -
    -host.set_xlabel("Distance")
    -host.set_ylabel("Density")
    -par.set_ylabel("Temperature")
    -
    -p1, = host.plot([0, 1, 2], [0, 1, 2], label="Density")
    -p2, = par.plot([0, 1, 2], [0, 3, 2], label="Temperature")
    -
    -leg = plt.legend()
    -
    -host.yaxis.get_label().set_color(p1.get_color())
    -leg.texts[0].set_color(p1.get_color())
    -
    -par.yaxis.get_label().set_color(p2.get_color())
    -leg.texts[1].set_color(p2.get_color())
    -
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../../../_images/parasite_simple.png -
    -
    -
    -

    Example 2. twin

    -

    twin without a transform argument treat the parasite axes to have a -same data transform as the host. This can be useful when you want the -top(or right)-axis to have different tick-locations, tick-labels, or -tick-formatter for bottom(or left)-axis.

    -
    ax2 = ax.twin() # now, ax2 is responsible for "top" axis and "right" axis
    -ax2.set_xticks([0., .5*np.pi, np.pi, 1.5*np.pi, 2*np.pi])
    -ax2.set_xticklabels(["0", r"$\frac{1}{2}\pi$",
    -                     r"$\pi$", r"$\frac{3}{2}\pi$", r"$2\pi$"])
    -
    -
    -

    (Source code, png, pdf)

    -
    -../../../_images/simple_axisline41.png -
    -

    A more sophisticated example using twin. Note that if you change the -x-limit in the host axes, the x-limit of the parasite axes will change -accordingly.

    -

    (Source code, png, pdf)

    -
    -../../../_images/parasite_simple21.png -
    -
    -
    -
    -

    AnchoredArtists

    -

    It’s a collection of artists whose location is anchored to the (axes) -bbox, like the legend. It is derived from OffsetBox in mpl, and -artist need to be drawn in the canvas coordinate. But, there is a -limited support for an arbitrary transform. For example, the ellipse -in the example below will have width and height in the data -coordinate.

    -
    import matplotlib.pyplot as plt
    -
    -
    -def draw_text(ax):
    -    from matplotlib.offsetbox import AnchoredText
    -    at = AnchoredText("Figure 1a",
    -                      loc=2, prop=dict(size=8), frameon=True,
    -                      )
    -    at.patch.set_boxstyle("round,pad=0.,rounding_size=0.2")
    -    ax.add_artist(at)
    -
    -    at2 = AnchoredText("Figure 1(b)",
    -                       loc=3, prop=dict(size=8), frameon=True,
    -                       bbox_to_anchor=(0., 1.),
    -                       bbox_transform=ax.transAxes
    -                       )
    -    at2.patch.set_boxstyle("round,pad=0.,rounding_size=0.2")
    -    ax.add_artist(at2)
    -
    -
    -def draw_circle(ax):  # circle in the canvas coordinate
    -    from mpl_toolkits.axes_grid1.anchored_artists import AnchoredDrawingArea
    -    from matplotlib.patches import Circle
    -    ada = AnchoredDrawingArea(20, 20, 0, 0,
    -                              loc=1, pad=0., frameon=False)
    -    p = Circle((10, 10), 10)
    -    ada.da.add_artist(p)
    -    ax.add_artist(ada)
    -
    -
    -def draw_ellipse(ax):
    -    from mpl_toolkits.axes_grid1.anchored_artists import AnchoredEllipse
    -    # draw an ellipse of width=0.1, height=0.15 in the data coordinate
    -    ae = AnchoredEllipse(ax.transData, width=0.1, height=0.15, angle=0.,
    -                         loc=3, pad=0.5, borderpad=0.4, frameon=True)
    -
    -    ax.add_artist(ae)
    -
    -
    -def draw_sizebar(ax):
    -    from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar
    -    # draw a horizontal bar with length of 0.1 in Data coordinate
    -    # (ax.transData) with a label underneath.
    -    asb = AnchoredSizeBar(ax.transData,
    -                          0.1,
    -                          r"1$^{\prime}$",
    -                          loc=8,
    -                          pad=0.1, borderpad=0.5, sep=5,
    -                          frameon=False)
    -    ax.add_artist(asb)
    -
    -
    -if 1:
    -    ax = plt.gca()
    -    ax.set_aspect(1.)
    -
    -    draw_text(ax)
    -    draw_circle(ax)
    -    draw_ellipse(ax)
    -    draw_sizebar(ax)
    -
    -    plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../../../_images/simple_anchored_artists1.png -
    -
    -
    -

    InsetLocator

    -

    mpl_toolkits.axes_grid.inset_locator provides helper classes -and functions to place your (inset) axes at the anchored position of -the parent axes, similarly to AnchoredArtist.

    -

    Using mpl_toolkits.axes_grid.inset_locator.inset_axes(), you -can have inset axes whose size is either fixed, or a fixed proportion -of the parent axes. For example,:

    -
    inset_axes = inset_axes(parent_axes,
    -                        width="30%", # width = 30% of parent_bbox
    -                        height=1., # height : 1 inch
    -                        loc=3)
    -
    -
    -

    creates an inset axes whose width is 30% of the parent axes and whose -height is fixed at 1 inch.

    -

    You may creates your inset whose size is determined so that the data -scale of the inset axes to be that of the parent axes multiplied by -some factor. For example,

    -
    inset_axes = zoomed_inset_axes(ax,
    -                               0.5, # zoom = 0.5
    -                               loc=1)
    -
    -
    -

    creates an inset axes whose data scale is half of the parent axes. -Here is complete examples.

    -

    (Source code, png, pdf)

    -
    -../../../_images/inset_locator_demo1.png -
    -

    For example, zoomed_inset_axes() can be used when you want the -inset represents the zoom-up of the small portion in the parent axes. -And mpl_toolkits/axes_grid/inset_locator provides a helper -function mark_inset() to mark the location of the area -represented by the inset axes.

    -
    import matplotlib.pyplot as plt
    -
    -from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes
    -from mpl_toolkits.axes_grid1.inset_locator import mark_inset
    -
    -import numpy as np
    -
    -
    -def get_demo_image():
    -    from matplotlib.cbook import get_sample_data
    -    import numpy as np
    -    f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False)
    -    z = np.load(f)
    -    # z is a numpy array of 15x15
    -    return z, (-3, 4, -4, 3)
    -
    -fig, ax = plt.subplots(figsize=[5, 4])
    -
    -# prepare the demo image
    -Z, extent = get_demo_image()
    -Z2 = np.zeros([150, 150], dtype="d")
    -ny, nx = Z.shape
    -Z2[30:30 + ny, 30:30 + nx] = Z
    -
    -# extent = [-3, 4, -4, 3]
    -ax.imshow(Z2, extent=extent, interpolation="nearest",
    -          origin="lower")
    -
    -axins = zoomed_inset_axes(ax, 6, loc=1)  # zoom = 6
    -axins.imshow(Z2, extent=extent, interpolation="nearest",
    -             origin="lower")
    -
    -# sub region of the original image
    -x1, x2, y1, y2 = -1.5, -0.9, -2.5, -1.9
    -axins.set_xlim(x1, x2)
    -axins.set_ylim(y1, y2)
    -# fix the number of ticks on the inset axes
    -axins.yaxis.get_major_locator().set_params(nbins=7)
    -axins.xaxis.get_major_locator().set_params(nbins=7)
    -
    -plt.xticks(visible=False)
    -plt.yticks(visible=False)
    -
    -# draw a bbox of the region of the inset axes in the parent axes and
    -# connecting lines between the bbox and the inset axes area
    -mark_inset(ax, axins, loc1=2, loc2=4, fc="none", ec="0.5")
    -
    -plt.draw()
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../../../_images/inset_locator_demo21.png -
    -
    -

    RGB Axes

    -

    RGBAxes is a helper class to conveniently show RGB composite -images. Like ImageGrid, the location of axes are adjusted so that the -area occupied by them fits in a given rectangle. Also, the xaxis and -yaxis of each axes are shared.

    -
    from mpl_toolkits.axes_grid1.axes_rgb import RGBAxes
    -
    -fig = plt.figure(1)
    -ax = RGBAxes(fig, [0.1, 0.1, 0.8, 0.8])
    -
    -r, g, b = get_rgb() # r,g,b are 2-d images
    -ax.imshow_rgb(r, g, b,
    -              origin="lower", interpolation="nearest")
    -
    -
    -

    (Source code, png, pdf)

    -
    -../../../_images/simple_rgb.png -
    -
    -
    -
    -
    -

    AXISARTIST

    -
    -

    AxisArtist

    -

    AxisArtist module provides a custom (and very experimental) Axes -class, where each axis (left, right, top and bottom) have a separate -artist associated which is responsible to draw axis-line, ticks, -ticklabels, label. Also, you can create your own axis, which can pass -through a fixed position in the axes coordinate, or a fixed position -in the data coordinate (i.e., the axis floats around when viewlimit -changes).

    -

    The axes class, by default, have its xaxis and yaxis invisible, and -has 4 additional artists which are responsible to draw axis in -“left”,”right”,”bottom” and “top”. They are accessed as -ax.axis[“left”], ax.axis[“right”], and so on, i.e., ax.axis is a -dictionary that contains artists (note that ax.axis is still a -callable methods and it behaves as an original Axes.axis method in -mpl).

    -

    To create an axes,

    -
    import mpl_toolkits.axisartist as AA
    -fig = plt.figure(1)
    -ax = AA.Axes(fig, [0.1, 0.1, 0.8, 0.8])
    -fig.add_axes(ax)
    -
    -
    -

    or to create a subplot

    -
    ax = AA.Subplot(fig, 111)
    -fig.add_subplot(ax)
    -
    -
    -

    For example, you can hide the right, and top axis by

    -
    ax.axis["right"].set_visible(False)
    -ax.axis["top"].set_visible(False)
    -
    -
    -

    (Source code, png, pdf)

    -
    -../../../_images/simple_axisline3.png -
    -

    It is also possible to add an extra axis. For example, you may have an -horizontal axis at y=0 (in data coordinate).

    -
    ax.axis["y=0"] = ax.new_floating_axis(nth_coord=0, value=0)
    -
    -
    -
    import matplotlib.pyplot as plt
    -import mpl_toolkits.axisartist as AA
    -
    -fig = plt.figure(1)
    -fig.subplots_adjust(right=0.85)
    -ax = AA.Subplot(fig, 1, 1, 1)
    -fig.add_subplot(ax)
    -
    -# make some axis invisible
    -ax.axis["bottom", "top", "right"].set_visible(False)
    -
    -# make an new axis along the first axis axis (x-axis) which pass
    -# through y=0.
    -ax.axis["y=0"] = ax.new_floating_axis(nth_coord=0, value=0,
    -                                      axis_direction="bottom")
    -ax.axis["y=0"].toggle(all=True)
    -ax.axis["y=0"].label.set_text("y = 0")
    -
    -ax.set_ylim(-2, 4)
    -
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../../../_images/simple_axisartist1.png -
    -

    Or a fixed axis with some offset

    -
    # make new (right-side) yaxis, but wth some offset
    -ax.axis["right2"] = ax.new_fixed_axis(loc="right",
    -                                      offset=(20, 0))
    -
    -
    -
    -

    AxisArtist with ParasiteAxes

    -

    Most commands in the axes_grid1 toolkit can take a axes_class keyword -argument, and the commands creates an axes of the given class. For example, -to create a host subplot with axisartist.Axes,

    -
    import mpl_tookits.axisartist as AA
    -from mpl_toolkits.axes_grid1 import host_subplot
    -
    -host = host_subplot(111, axes_class=AA.Axes)
    -
    -
    -

    Here is an example that uses parasiteAxes.

    -

    (Source code, png, pdf)

    -
    -../../../_images/demo_parasite_axes21.png -
    -
    -
    -
    -

    Curvilinear Grid

    -

    The motivation behind the AxisArtist module is to support curvilinear grid -and ticks.

    -

    (Source code, png, pdf)

    -
    -../../../_images/demo_curvelinear_grid1.png -
    -

    See AXISARTIST namespace for more details.

    -
    -
    -

    Floating Axes

    -

    This also support a Floating Axes whose outer axis are defined as -floating axis.

    -

    (Source code, png, pdf)

    -
    -../../../_images/demo_floating_axes1.png -
    -
    -
    -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/mpl_toolkits/mplot3d/api.html b/mpl_toolkits/mplot3d/api.html deleted file mode 100644 index 7a5ffe3b3b8..00000000000 --- a/mpl_toolkits/mplot3d/api.html +++ /dev/null @@ -1,2958 +0,0 @@ - - - - - - - - mplot3d API — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -

    Table Of Contents

    - -
    -

    Related Topics

    - -
    -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    mplot3d API

    -
    -

    Contents

    - -
    -
    -

    axes3d

    -
    -

    Note

    -

    Significant effort went into bringing axes3d to feature-parity with -regular axes objects for version 1.1.0. However, more work remains. -Please report any functions that do not behave as expected as a bug. -In addition, help and patches would be greatly appreciated!

    -
    -

    Module containing Axes3D, an object which can plot 3D objects on a -2D matplotlib figure.

    -
    -
    -class mpl_toolkits.mplot3d.axes3d.Axes3D(fig, rect=None, *args, **kwargs)
    -

    Bases: matplotlib.axes._axes.Axes

    -

    3D axes object.

    -
    -
    -add_collection3d(col, zs=0, zdir='z')
    -

    Add a 3D collection object to the plot.

    -

    2D collection types are converted to a 3D version by -modifying the object and adding z coordinate information.

    -
    -
    Supported are:
    -
      -
    • PolyCollection
    • -
    • LineColleciton
    • -
    • PatchCollection
    • -
    -
    -
    -
    - -
    -
    -add_contour_set(cset, extend3d=False, stride=5, zdir='z', offset=None)
    -
    - -
    -
    -add_contourf_set(cset, zdir='z', offset=None)
    -
    - -
    -
    -auto_scale_xyz(X, Y, Z=None, had_data=None)
    -
    - -
    -
    -autoscale(enable=True, axis='both', tight=None)
    -

    Convenience method for simple axis view autoscaling. -See matplotlib.axes.Axes.autoscale() for full explanation. -Note that this function behaves the same, but for all -three axes. Therfore, ‘z’ can be passed for axis, -and ‘both’ applies to all three axes.

    -
    -

    New in version 1.1.0: This function was added, but not tested. Please report any bugs.

    -
    -
    - -
    -
    -autoscale_view(tight=None, scalex=True, scaley=True, scalez=True)
    -

    Autoscale the view limits using the data limits. -See matplotlib.axes.Axes.autoscale_view() for documentation. -Note that this function applies to the 3D axes, and as such -adds the scalez to the function arguments.

    -
    -

    Changed in version 1.1.0: Function signature was changed to better match the 2D version. -tight is now explicitly a kwarg and placed first.

    -
    -
    -

    Changed in version 1.2.1: This is now fully functional.

    -
    -
    - -
    -
    -bar(left, height, zs=0, zdir='z', *args, **kwargs)
    -

    Add 2D bar(s).

    - ---- - - - - - - - - - - - - - - - - - - - -
    ArgumentDescription
    leftThe x coordinates of the left sides of the bars.
    heightThe height of the bars.
    zsZ coordinate of bars, if one value is specified -they will all be placed at the same z.
    zdirWhich direction to use as z (‘x’, ‘y’ or ‘z’) -when plotting a 2D set.
    -

    Keyword arguments are passed onto bar().

    -

    Returns a Patch3DCollection

    -
    - -
    -
    -bar3d(x, y, z, dx, dy, dz, color=None, zsort='average', *args, **kwargs)
    -

    Generate a 3D bar, or multiple bars.

    -

    When generating multiple bars, x, y, z have to be arrays. -dx, dy, dz can be arrays or scalars.

    -

    color can be:

    -
    -
      -
    • A single color value, to color all bars the same color.
    • -
    • An array of colors of length N bars, to color each bar -independently.
    • -
    • An array of colors of length 6, to color the faces of the -bars similarly.
    • -
    • An array of colors of length 6 * N bars, to color each face -independently.
    • -
    -

    When coloring the faces of the boxes specifically, this is -the order of the coloring:

    -
    -
      -
    1. -Z (bottom of box)
    2. -
    3. +Z (top of box)
    4. -
    5. -Y
    6. -
    7. +Y
    8. -
    9. -X
    10. -
    11. +X
    12. -
    -
    -
    -

    Keyword arguments are passed onto -Poly3DCollection()

    -
    - -
    -
    -can_pan()
    -

    Return True if this axes supports the pan/zoom button functionality.

    -

    3D axes objects do not use the pan/zoom button.

    -
    - -
    -
    -can_zoom()
    -

    Return True if this axes supports the zoom box button functionality.

    -

    3D axes objects do not use the zoom box button.

    -
    - -
    -
    -cla()
    -

    Clear axes

    -
    - -
    -
    -clabel(*args, **kwargs)
    -

    This function is currently not implemented for 3D axes. -Returns None.

    -
    - -
    -
    -contour(X, Y, Z, *args, **kwargs)
    -

    Create a 3D contour plot.

    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - -
    ArgumentDescription
    X, Y,Data values as numpy.arrays
    Z 
    extend3dWhether to extend contour in 3D (default: False)
    strideStride (step size) for extending contour
    zdirThe direction to use: x, y or z (default)
    offsetIf specified plot a projection of the contour -lines on this position in plane normal to zdir
    -

    The positional and other keyword arguments are passed on to -contour()

    -

    Returns a contour

    -
    - -
    -
    -contour3D(X, Y, Z, *args, **kwargs)
    -

    Create a 3D contour plot.

    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - -
    ArgumentDescription
    X, Y,Data values as numpy.arrays
    Z 
    extend3dWhether to extend contour in 3D (default: False)
    strideStride (step size) for extending contour
    zdirThe direction to use: x, y or z (default)
    offsetIf specified plot a projection of the contour -lines on this position in plane normal to zdir
    -

    The positional and other keyword arguments are passed on to -contour()

    -

    Returns a contour

    -
    - -
    -
    -contourf(X, Y, Z, *args, **kwargs)
    -

    Create a 3D contourf plot.

    - ---- - - - - - - - - - - - - - - - - - - - -
    ArgumentDescription
    X, Y,Data values as numpy.arrays
    Z 
    zdirThe direction to use: x, y or z (default)
    offsetIf specified plot a projection of the filled contour -on this position in plane normal to zdir
    -

    The positional and keyword arguments are passed on to -contourf()

    -

    Returns a contourf

    -
    -

    Changed in version 1.1.0: The zdir and offset kwargs were added.

    -
    -
    - -
    -
    -contourf3D(X, Y, Z, *args, **kwargs)
    -

    Create a 3D contourf plot.

    - ---- - - - - - - - - - - - - - - - - - - - -
    ArgumentDescription
    X, Y,Data values as numpy.arrays
    Z 
    zdirThe direction to use: x, y or z (default)
    offsetIf specified plot a projection of the filled contour -on this position in plane normal to zdir
    -

    The positional and keyword arguments are passed on to -contourf()

    -

    Returns a contourf

    -
    -

    Changed in version 1.1.0: The zdir and offset kwargs were added.

    -
    -
    - -
    -
    -convert_zunits(z)
    -

    For artists in an axes, if the zaxis has units support, -convert z using zaxis unit type

    -
    -

    New in version 1.2.1.

    -
    -
    - -
    -
    -disable_mouse_rotation()
    -

    Disable mouse button callbacks.

    -
    - -
    -
    -draw(renderer)
    -
    - -
    -
    -format_coord(xd, yd)
    -

    Given the 2D view coordinates attempt to guess a 3D coordinate. -Looks for the nearest edge to the point and then assumes that -the point is at the same z location as the nearest point on the edge.

    -
    - -
    -
    -format_zdata(z)
    -

    Return z string formatted. This function will use the -fmt_zdata attribute if it is callable, else will fall -back on the zaxis major formatter

    -
    - -
    -
    -get_autoscale_on()
    -

    Get whether autoscaling is applied for all axes on plot commands

    -
    -

    New in version 1.1.0: This function was added, but not tested. Please report any bugs.

    -
    -
    - -
    -
    -get_autoscalez_on()
    -

    Get whether autoscaling for the z-axis is applied on plot commands

    -
    -

    New in version 1.1.0: This function was added, but not tested. Please report any bugs.

    -
    -
    - -
    -
    -get_axis_position()
    -
    - -
    -
    -get_axisbelow()
    -

    Get whether axis below is true or not.

    -

    For axes3d objects, this will always be True

    -
    -

    New in version 1.1.0: This function was added for completeness.

    -
    -
    - -
    -
    -get_children()
    -
    - -
    -
    -get_frame_on()
    -

    Get whether the 3D axes panels are drawn

    -
    -

    New in version 1.1.0.

    -
    -
    - -
    -
    -get_proj()
    -

    Create the projection matrix from the current viewing position.

    -

    elev stores the elevation angle in the z plane -azim stores the azimuth angle in the x,y plane

    -

    dist is the distance of the eye viewing point from the object -point.

    -
    - -
    -
    -get_w_lims()
    -

    Get 3D world limits.

    -
    - -
    -
    -get_xlim()
    -

    Get the x-axis range

    - --- - - - -
    Returns:

    xlimits : tuple

    -
    -

    Returns the current x-axis limits as the tuple -(left, right).

    -
    -
    -

    Notes

    -

    The x-axis may be inverted, in which case the left value will -be greater than the right value.

    -
    -

    Changed in version 1.1.0: This function now correctly refers to the 3D x-limits

    -
    -
    - -
    -
    -get_xlim3d()
    -

    Get the x-axis range

    - --- - - - -
    Returns:

    xlimits : tuple

    -
    -

    Returns the current x-axis limits as the tuple -(left, right).

    -
    -
    -

    Notes

    -

    The x-axis may be inverted, in which case the left value will -be greater than the right value.

    -
    -

    Changed in version 1.1.0: This function now correctly refers to the 3D x-limits

    -
    -
    - -
    -
    -get_ylim()
    -

    Get the y-axis range

    - --- - - - -
    Returns:

    ylimits : tuple

    -
    -

    Returns the current y-axis limits as the tuple -(bottom, top).

    -
    -
    -

    Notes

    -

    The y-axis may be inverted, in which case the bottom value -will be greater than the top value.

    -
    -

    Changed in version 1.1.0: This function now correctly refers to the 3D y-limits.

    -
    -
    - -
    -
    -get_ylim3d()
    -

    Get the y-axis range

    - --- - - - -
    Returns:

    ylimits : tuple

    -
    -

    Returns the current y-axis limits as the tuple -(bottom, top).

    -
    -
    -

    Notes

    -

    The y-axis may be inverted, in which case the bottom value -will be greater than the top value.

    -
    -

    Changed in version 1.1.0: This function now correctly refers to the 3D y-limits.

    -
    -
    - -
    -
    -get_zbound()
    -

    Returns the z-axis numerical bounds where:

    -
    lowerBound < upperBound
    -
    -
    -
    -

    New in version 1.1.0: This function was added, but not tested. Please report any bugs.

    -
    -
    - -
    -
    -get_zlabel()
    -

    Get the z-label text string.

    -
    -

    New in version 1.1.0: This function was added, but not tested. Please report any bugs.

    -
    -
    - -
    -
    -get_zlim()
    -

    Get 3D z limits.

    -
    - -
    -
    -get_zlim3d()
    -

    Get 3D z limits.

    -
    - -
    -
    -get_zmajorticklabels()
    -

    Get the ztick labels as a list of Text instances

    -
    -

    New in version 1.1.0.

    -
    -
    - -
    -
    -get_zminorticklabels()
    -

    Get the ztick labels as a list of Text instances

    -
    -

    Note

    -

    Minor ticks are not supported. This function was added -only for completeness.

    -
    -
    -

    New in version 1.1.0.

    -
    -
    - -
    -
    -get_zscale()
    -
    - -
    -
    -get_zticklabels(minor=False)
    -

    Get ztick labels as a list of Text instances. -See matplotlib.axes.Axes.get_yticklabels() for more details.

    -
    -

    Note

    -

    Minor ticks are not supported.

    -
    -
    -

    New in version 1.1.0.

    -
    -
    - -
    -
    -get_zticklines()
    -

    Get ztick lines as a list of Line2D instances. -Note that this function is provided merely for completeness. -These lines are re-calculated as the display changes.

    -
    -

    New in version 1.1.0.

    -
    -
    - -
    -
    -get_zticks(minor=False)
    -

    Return the z ticks as a list of locations -See matplotlib.axes.Axes.get_yticks() for more details.

    -
    -

    Note

    -

    Minor ticks are not supported.

    -
    -
    -

    New in version 1.1.0.

    -
    -
    - -
    -
    -grid(b=True, **kwargs)
    -

    Set / unset 3D grid.

    -
    -

    Note

    -

    Currently, this function does not behave the same as -matplotlib.axes.Axes.grid(), but it is intended to -eventually support that behavior.

    -
    -
    -

    Changed in version 1.1.0: This function was changed, but not tested. Please report any bugs.

    -
    -
    - -
    -
    -have_units()
    -

    Return True if units are set on the x, y, or z axes

    -
    - -
    -
    -invert_zaxis()
    -

    Invert the z-axis.

    -
    -

    New in version 1.1.0: This function was added, but not tested. Please report any bugs.

    -
    -
    - -
    -
    -locator_params(axis='both', tight=None, **kwargs)
    -

    Convenience method for controlling tick locators.

    -

    See matplotlib.axes.Axes.locator_params() for full -documentation Note that this is for Axes3D objects, -therefore, setting axis to ‘both’ will result in the -parameters being set for all three axes. Also, axis -can also take a value of ‘z’ to apply parameters to the -z axis.

    -
    -

    New in version 1.1.0: This function was added, but not tested. Please report any bugs.

    -
    -
    - -
    -
    -margins(*args, **kw)
    -

    Convenience method to set or retrieve autoscaling margins.

    -
    -
    signatures::
    -
    margins()
    -
    -

    returns xmargin, ymargin, zmargin

    -
    margins(margin)
    -
    -margins(xmargin, ymargin, zmargin)
    -
    -margins(x=xmargin, y=ymargin, z=zmargin)
    -
    -margins(..., tight=False)
    -
    -
    -

    All forms above set the xmargin, ymargin and zmargin -parameters. All keyword parameters are optional. A single argument -specifies xmargin, ymargin and zmargin. The tight parameter -is passed to autoscale_view(), which is executed after -a margin is changed; the default here is True, on the -assumption that when margins are specified, no additional -padding to match tick marks is usually desired. Setting -tight to None will preserve the previous setting.

    -

    Specifying any margin changes only the autoscaling; for example, -if xmargin is not None, then xmargin times the X data -interval will be added to each end of that interval before -it is used in autoscaling.

    -
    -

    New in version 1.1.0: This function was added, but not tested. Please report any bugs.

    -
    -
    - -
    -
    -mouse_init(rotate_btn=1, zoom_btn=3)
    -

    Initializes mouse button callbacks to enable 3D rotation of -the axes. Also optionally sets the mouse buttons for 3D rotation -and zooming.

    - ---- - - - - - - - - - - - - - -
    ArgumentDescription
    rotate_btnThe integer or list of integers specifying which mouse -button or buttons to use for 3D rotation of the axes. -Default = 1.
    zoom_btnThe integer or list of integers specifying which mouse -button or buttons to use to zoom the 3D axes. -Default = 3.
    -
    - -
    -
    -name = '3d'
    -
    - -
    -
    -plot(xs, ys, *args, **kwargs)
    -

    Plot 2D or 3D data.

    - ---- - - - - - - - - - - - - - - - - -
    ArgumentDescription
    xs, ysx, y coordinates of vertices
    zsz value(s), either one for all points or one for -each point.
    zdirWhich direction to use as z (‘x’, ‘y’ or ‘z’) -when plotting a 2D set.
    -

    Other arguments are passed on to -plot()

    -
    - -
    -
    -plot3D(xs, ys, *args, **kwargs)
    -

    Plot 2D or 3D data.

    - ---- - - - - - - - - - - - - - - - - -
    ArgumentDescription
    xs, ysx, y coordinates of vertices
    zsz value(s), either one for all points or one for -each point.
    zdirWhich direction to use as z (‘x’, ‘y’ or ‘z’) -when plotting a 2D set.
    -

    Other arguments are passed on to -plot()

    -
    - -
    -
    -plot_surface(X, Y, Z, *args, **kwargs)
    -

    Create a surface plot.

    -

    By default it will be colored in shades of a solid color, -but it also supports color mapping by supplying the cmap -argument.

    -

    The rstride and cstride kwargs set the stride used to -sample the input data to generate the graph. If 1k by 1k -arrays are passed in, the default values for the strides will -result in a 100x100 grid being plotted. Defaults to 10. -Raises a ValueError if both stride and count kwargs -(see next section) are provided.

    -

    The rcount and ccount kwargs supersedes rstride and -cstride for default sampling method for surface plotting. -These arguments will determine at most how many evenly spaced -samples will be taken from the input data to generate the graph. -This is the default sampling method unless using the ‘classic’ -style. Will raise ValueError if both stride and count are -specified. -Added in v2.0.0.

    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ArgumentDescription
    X, Y, ZData values as 2D arrays
    rstrideArray row stride (step size)
    cstrideArray column stride (step size)
    rcountUse at most this many rows, defaults to 50
    ccountUse at most this many columns, defaults to 50
    colorColor of the surface patches
    cmapA colormap for the surface patches.
    facecolorsFace colors for the individual patches
    normAn instance of Normalize to map values to colors
    vminMinimum value to map
    vmaxMaximum value to map
    shadeWhether to shade the facecolors
    -

    Other arguments are passed on to -Poly3DCollection

    -
    - -
    -
    -plot_trisurf(*args, **kwargs)
    -
    ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ArgumentDescription
    X, Y, ZData values as 1D arrays
    colorColor of the surface patches
    cmapA colormap for the surface patches.
    normAn instance of Normalize to map values to colors
    vminMinimum value to map
    vmaxMaximum value to map
    shadeWhether to shade the facecolors
    -

    The (optional) triangulation can be specified in one of two ways; -either:

    -
    plot_trisurf(triangulation, ...)
    -
    -
    -

    where triangulation is a Triangulation -object, or:

    -
    plot_trisurf(X, Y, ...)
    -plot_trisurf(X, Y, triangles, ...)
    -plot_trisurf(X, Y, triangles=triangles, ...)
    -
    -
    -

    in which case a Triangulation object will be created. See -Triangulation for a explanation of -these possibilities.

    -

    The remaining arguments are:

    -
    plot_trisurf(..., Z)
    -
    -
    -

    where Z is the array of values to contour, one per point -in the triangulation.

    -

    Other arguments are passed on to -Poly3DCollection

    -

    Examples:

    -

    (Source code, png, pdf)

    -
    -../../_images/trisurf3d_demo.png -
    -

    (Source code, png, pdf)

    -
    -../../_images/trisurf3d_demo2.png -
    -
    -

    New in version 1.2.0: This plotting function was added for the v1.2.0 release.

    -
    -
    - -
    -
    -plot_wireframe(X, Y, Z, *args, **kwargs)
    -
    -

    Plot a 3D wireframe.

    -

    The rstride and cstride kwargs set the stride used to -sample the input data to generate the graph. If either is 0 -the input data in not sampled along this direction producing a -3D line plot rather than a wireframe plot. The stride arguments -are only used by default if in the ‘classic’ mode. They are -now superseded by rcount and ccount. Will raise ValueError -if both stride and count are used.

    -
    -
    -
    ` The rcount and ccount kwargs supersedes rstride and
    -

    cstride for default sampling method for wireframe plotting. -These arguments will determine at most how many evenly spaced -samples will be taken from the input data to generate the graph. -This is the default sampling method unless using the ‘classic’ -style. Will raise ValueError if both stride and count are -specified. If either is zero, then the input data is not sampled -along this direction, producing a 3D line plot rather than a -wireframe plot. -Added in v2.0.0.

    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - -
    ArgumentDescription
    X, Y,Data values as 2D arrays
    Z 
    rstrideArray row stride (step size), defaults to 1
    cstrideArray column stride (step size), defaults to 1
    rcountUse at most this many rows, defaults to 50
    ccountUse at most this many columns, defaults to 50
    -

    Keyword arguments are passed on to -LineCollection.

    -

    Returns a Line3DCollection

    -
    -
    -
    - -
    -
    -quiver(*args, **kwargs)
    -

    Plot a 3D field of arrows.

    -

    call signatures:

    -
    quiver(X, Y, Z, U, V, W, **kwargs)
    -
    -
    -

    Arguments:

    -
    -
    -
    X, Y, Z:
    -
    The x, y and z coordinates of the arrow locations (default is -tail of arrow; see pivot kwarg)
    -
    U, V, W:
    -
    The x, y and z components of the arrow vectors
    -
    -
    -

    The arguments could be array-like or scalars, so long as they -they can be broadcast together. The arguments can also be -masked arrays. If an element in any of argument is masked, then -that corresponding quiver element will not be plotted.

    -

    Keyword arguments:

    -
    -
    -
    length: [1.0 | float]
    -
    The length of each quiver, default to 1.0, the unit is -the same with the axes
    -
    arrow_length_ratio: [0.3 | float]
    -
    The ratio of the arrow head with respect to the quiver, -default to 0.3
    -
    pivot: [ ‘tail’ | ‘middle’ | ‘tip’ ]
    -
    The part of the arrow that is at the grid point; the arrow -rotates about this point, hence the name pivot. -Default is ‘tail’
    -
    normalize: [False | True]
    -
    When True, all of the arrows will be the same length. This -defaults to False, where the arrows will be different lengths -depending on the values of u,v,w.
    -
    -
    -

    Any additional keyword arguments are delegated to -LineCollection

    -
    - -
    -
    -quiver3D(*args, **kwargs)
    -

    Plot a 3D field of arrows.

    -

    call signatures:

    -
    quiver(X, Y, Z, U, V, W, **kwargs)
    -
    -
    -

    Arguments:

    -
    -
    -
    X, Y, Z:
    -
    The x, y and z coordinates of the arrow locations (default is -tail of arrow; see pivot kwarg)
    -
    U, V, W:
    -
    The x, y and z components of the arrow vectors
    -
    -
    -

    The arguments could be array-like or scalars, so long as they -they can be broadcast together. The arguments can also be -masked arrays. If an element in any of argument is masked, then -that corresponding quiver element will not be plotted.

    -

    Keyword arguments:

    -
    -
    -
    length: [1.0 | float]
    -
    The length of each quiver, default to 1.0, the unit is -the same with the axes
    -
    arrow_length_ratio: [0.3 | float]
    -
    The ratio of the arrow head with respect to the quiver, -default to 0.3
    -
    pivot: [ ‘tail’ | ‘middle’ | ‘tip’ ]
    -
    The part of the arrow that is at the grid point; the arrow -rotates about this point, hence the name pivot. -Default is ‘tail’
    -
    normalize: [False | True]
    -
    When True, all of the arrows will be the same length. This -defaults to False, where the arrows will be different lengths -depending on the values of u,v,w.
    -
    -
    -

    Any additional keyword arguments are delegated to -LineCollection

    -
    - -
    -
    -scatter(xs, ys, zs=0, zdir='z', s=20, c=None, depthshade=True, *args, **kwargs)
    -

    Create a scatter plot.

    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - -
    ArgumentDescription
    xs, ysPositions of data points.
    zsEither an array of the same length as xs and -ys or a single value to place all points in -the same plane. Default is 0.
    zdirWhich direction to use as z (‘x’, ‘y’ or ‘z’) -when plotting a 2D set.
    sSize in points^2. It is a scalar or an array of the -same length as x and y.
    cA color. c can be a single color format string, or a -sequence of color specifications of length N, or a -sequence of N numbers to be mapped to colors using the -cmap and norm specified via kwargs (see below). Note -that c should not be a single numeric RGB or RGBA -sequence because that is indistinguishable from an array -of values to be colormapped. c can be a 2-D array in -which the rows are RGB or RGBA, however, including the -case of a single row to specify the same color for -all points.
    depthshadeWhether or not to shade the scatter markers to give -the appearance of depth. Default is True.
    -

    Keyword arguments are passed on to -scatter().

    -

    Returns a Patch3DCollection

    -
    - -
    -
    -scatter3D(xs, ys, zs=0, zdir='z', s=20, c=None, depthshade=True, *args, **kwargs)
    -

    Create a scatter plot.

    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - -
    ArgumentDescription
    xs, ysPositions of data points.
    zsEither an array of the same length as xs and -ys or a single value to place all points in -the same plane. Default is 0.
    zdirWhich direction to use as z (‘x’, ‘y’ or ‘z’) -when plotting a 2D set.
    sSize in points^2. It is a scalar or an array of the -same length as x and y.
    cA color. c can be a single color format string, or a -sequence of color specifications of length N, or a -sequence of N numbers to be mapped to colors using the -cmap and norm specified via kwargs (see below). Note -that c should not be a single numeric RGB or RGBA -sequence because that is indistinguishable from an array -of values to be colormapped. c can be a 2-D array in -which the rows are RGB or RGBA, however, including the -case of a single row to specify the same color for -all points.
    depthshadeWhether or not to shade the scatter markers to give -the appearance of depth. Default is True.
    -

    Keyword arguments are passed on to -scatter().

    -

    Returns a Patch3DCollection

    -
    - -
    -
    -set_autoscale_on(b)
    -

    Set whether autoscaling is applied on plot commands

    -

    accepts: [ True | False ]

    -
    -

    New in version 1.1.0: This function was added, but not tested. Please report any bugs.

    -
    -
    - -
    -
    -set_autoscalez_on(b)
    -

    Set whether autoscaling for the z-axis is applied on plot commands

    -

    accepts: [ True | False ]

    -
    -

    New in version 1.1.0: This function was added, but not tested. Please report any bugs.

    -
    -
    - -
    -
    -set_axis_off()
    -
    - -
    -
    -set_axis_on()
    -
    - -
    -
    -set_axisbelow(b)
    -

    Set whether the axis ticks and gridlines are above or below -most artists

    -

    For axes3d objects, this will ignore any settings and just use True

    -

    ACCEPTS: [ True | False ]

    -
    -

    New in version 1.1.0: This function was added for completeness.

    -
    -
    - -
    -
    -set_frame_on(b)
    -

    Set whether the 3D axes panels are drawn

    -

    ACCEPTS: [ True | False ]

    -
    -

    New in version 1.1.0.

    -
    -
    - -
    -
    -set_title(label, fontdict=None, loc='center', **kwargs)
    -

    Set a title for the axes.

    -

    Set one of the three available axes titles. The available titles -are positioned above the axes in the center, flush with the left -edge, and flush with the right edge.

    - --- - - - - - - - - -
    Parameters:

    label : str

    -
    -

    Text to use for the title

    -
    -

    fontdict : dict

    -
    -

    A dictionary controlling the appearance of the title text, -the default fontdict is:

    -
    {'fontsize': rcParams['axes.titlesize'],
    - 'fontweight' : rcParams['axes.titleweight'],
    - 'verticalalignment': 'baseline',
    - 'horizontalalignment': loc}
    -
    -
    -
    -

    loc : {‘center’, ‘left’, ‘right’}, str, optional

    -
    -

    Which title to set, defaults to ‘center’

    -
    -
    Returns:

    text : Text

    -
    -

    The matplotlib text instance representing the title

    -
    -
    Other Parameters:
     

    kwargs : text properties

    -
    -

    Other keyword arguments are text properties, see -Text for a list of valid text -properties.

    -
    -
    -
    - -
    -
    -set_top_view()
    -
    - -
    -
    -set_xlim(left=None, right=None, emit=True, auto=False, **kw)
    -

    Set 3D x limits.

    -

    See matplotlib.axes.Axes.set_xlim() for full documentation.

    -
    - -
    -
    -set_xlim3d(left=None, right=None, emit=True, auto=False, **kw)
    -

    Set 3D x limits.

    -

    See matplotlib.axes.Axes.set_xlim() for full documentation.

    -
    - -
    -
    -set_xscale(value, **kwargs)
    -

    Set the x-axis scale

    -

    Set the scaling of the x-axis: ‘linear’ | ‘log’ | ‘logit’ | ‘symlog’

    -

    ACCEPTS: [‘linear’ | ‘log’ | ‘logit’ | ‘symlog’]

    -
    -
    Different kwargs are accepted, depending on the scale:
    -

    ‘linear’

    -

    ‘log’

    -
    -
    -
    basex/basey:
    -
    The base of the logarithm
    -
    nonposx/nonposy: [‘mask’ | ‘clip’ ]
    -
    non-positive values in x or y can be masked as -invalid, or clipped to a very small positive number
    -
    subsx/subsy:
    -

    Where to place the subticks between each major tick. -Should be a sequence of integers. For example, in a log10 -scale: [2, 3, 4, 5, 6, 7, 8, 9]

    -

    will place 8 logarithmically spaced minor ticks between -each major tick.

    -
    -
    -
    -

    ‘logit’

    -
    -
    -
    nonpos: [‘mask’ | ‘clip’ ]
    -
    values beyond ]0, 1[ can be masked as invalid, or clipped to a number -very close to 0 or 1
    -
    -
    -

    ‘symlog’

    -
    -
    -
    basex/basey:
    -
    The base of the logarithm
    -
    linthreshx/linthreshy:
    -
    The range (-x, x) within which the plot is linear (to -avoid having the plot go to infinity around zero).
    -
    subsx/subsy:
    -

    Where to place the subticks between each major tick. -Should be a sequence of integers. For example, in a log10 -scale: [2, 3, 4, 5, 6, 7, 8, 9]

    -

    will place 8 logarithmically spaced minor ticks between -each major tick.

    -
    -
    linscalex/linscaley:
    -
    This allows the linear range (-linthresh to linthresh) -to be stretched relative to the logarithmic range. Its -value is the number of decades to use for each half of the -linear range. For example, when linscale == 1.0 (the -default), the space used for the positive and negative -halves of the linear range will be equal to one decade in -the logarithmic range.
    -
    -
    -

    New in version 1.1.0: This function was added, but not tested. Please report any bugs.

    -
    -
    -
    -
    -
    - -
    -
    -set_ylim(bottom=None, top=None, emit=True, auto=False, **kw)
    -

    Set 3D y limits.

    -

    See matplotlib.axes.Axes.set_ylim() for full documentation.

    -
    - -
    -
    -set_ylim3d(bottom=None, top=None, emit=True, auto=False, **kw)
    -

    Set 3D y limits.

    -

    See matplotlib.axes.Axes.set_ylim() for full documentation.

    -
    - -
    -
    -set_yscale(value, **kwargs)
    -

    Set the y-axis scale

    -
    -

    Set the scaling of the y-axis: ‘linear’ | ‘log’ | ‘logit’ | ‘symlog’

    -

    ACCEPTS: [‘linear’ | ‘log’ | ‘logit’ | ‘symlog’]

    -
    -
    Different kwargs are accepted, depending on the scale:
    -
    ‘linear’
    -
    -
    -

    ‘log’

    -
    -
    -
    basex/basey:
    -
    The base of the logarithm
    -
    nonposx/nonposy: [‘mask’ | ‘clip’ ]
    -
    non-positive values in x or y can be masked as -invalid, or clipped to a very small positive number
    -
    subsx/subsy:
    -

    Where to place the subticks between each major tick. -Should be a sequence of integers. For example, in a log10 -scale: [2, 3, 4, 5, 6, 7, 8, 9]

    -

    will place 8 logarithmically spaced minor ticks between -each major tick.

    -
    -
    -
    -

    ‘logit’

    -
    -
    -
    nonpos: [‘mask’ | ‘clip’ ]
    -
    values beyond ]0, 1[ can be masked as invalid, or clipped to a number -very close to 0 or 1
    -
    -
    -

    ‘symlog’

    -
    -
    -
    basex/basey:
    -
    The base of the logarithm
    -
    linthreshx/linthreshy:
    -
    The range (-x, x) within which the plot is linear (to -avoid having the plot go to infinity around zero).
    -
    subsx/subsy:
    -

    Where to place the subticks between each major tick. -Should be a sequence of integers. For example, in a log10 -scale: [2, 3, 4, 5, 6, 7, 8, 9]

    -

    will place 8 logarithmically spaced minor ticks between -each major tick.

    -
    -
    linscalex/linscaley:
    -
    This allows the linear range (-linthresh to linthresh) -to be stretched relative to the logarithmic range. Its -value is the number of decades to use for each half of the -linear range. For example, when linscale == 1.0 (the -default), the space used for the positive and negative -halves of the linear range will be equal to one decade in -the logarithmic range.
    -
    -
    -

    New in version 1.1.0: This function was added, but not tested. Please report any bugs.

    -
    -
    -
    - -
    -
    -set_zbound(lower=None, upper=None)
    -

    Set the lower and upper numerical bounds of the z-axis. -This method will honor axes inversion regardless of parameter order. -It will not change the _autoscaleZon attribute.

    -
    -

    New in version 1.1.0: This function was added, but not tested. Please report any bugs.

    -
    -
    - -
    -
    -set_zlabel(zlabel, fontdict=None, labelpad=None, **kwargs)
    -

    Set zlabel. See doc for set_ylabel() for description.

    -
    - -
    -
    -set_zlim(bottom=None, top=None, emit=True, auto=False, **kw)
    -

    Set 3D z limits.

    -

    See matplotlib.axes.Axes.set_ylim() for full documentation

    -
    - -
    -
    -set_zlim3d(bottom=None, top=None, emit=True, auto=False, **kw)
    -

    Set 3D z limits.

    -

    See matplotlib.axes.Axes.set_ylim() for full documentation

    -
    - -
    -
    -set_zmargin(m)
    -

    Set padding of Z data limits prior to autoscaling.

    -

    m times the data interval will be added to each -end of that interval before it is used in autoscaling.

    -

    accepts: float in range 0 to 1

    -
    -

    New in version 1.1.0: This function was added, but not tested. Please report any bugs.

    -
    -
    - -
    -
    -set_zscale(value, **kwargs)
    -

    Set the scaling of the z-axis: ‘linear’ | ‘log’ | ‘logit’ | ‘symlog’

    -

    ACCEPTS: [‘linear’ | ‘log’ | ‘logit’ | ‘symlog’]

    -
    -
    Different kwargs are accepted, depending on the scale:
    -

    ‘linear’

    -

    ‘log’

    -
    -
    -
    basex/basey:
    -
    The base of the logarithm
    -
    nonposx/nonposy: [‘mask’ | ‘clip’ ]
    -
    non-positive values in x or y can be masked as -invalid, or clipped to a very small positive number
    -
    subsx/subsy:
    -

    Where to place the subticks between each major tick. -Should be a sequence of integers. For example, in a log10 -scale: [2, 3, 4, 5, 6, 7, 8, 9]

    -

    will place 8 logarithmically spaced minor ticks between -each major tick.

    -
    -
    -
    -

    ‘logit’

    -
    -
    -
    nonpos: [‘mask’ | ‘clip’ ]
    -
    values beyond ]0, 1[ can be masked as invalid, or clipped to a number -very close to 0 or 1
    -
    -
    -

    ‘symlog’

    -
    -
    -
    basex/basey:
    -
    The base of the logarithm
    -
    linthreshx/linthreshy:
    -
    The range (-x, x) within which the plot is linear (to -avoid having the plot go to infinity around zero).
    -
    subsx/subsy:
    -

    Where to place the subticks between each major tick. -Should be a sequence of integers. For example, in a log10 -scale: [2, 3, 4, 5, 6, 7, 8, 9]

    -

    will place 8 logarithmically spaced minor ticks between -each major tick.

    -
    -
    linscalex/linscaley:
    -
    This allows the linear range (-linthresh to linthresh) -to be stretched relative to the logarithmic range. Its -value is the number of decades to use for each half of the -linear range. For example, when linscale == 1.0 (the -default), the space used for the positive and negative -halves of the linear range will be equal to one decade in -the logarithmic range.
    -
    -
    -
    -
    -
    -

    Note

    -

    Currently, Axes3D objects only supports linear scales. -Other scales may or may not work, and support for these -is improving with each release.

    -
    -
    -

    New in version 1.1.0: This function was added, but not tested. Please report any bugs.

    -
    -
    - -
    -
    -set_zticklabels(*args, **kwargs)
    -

    Set z-axis tick labels. -See matplotlib.axes.Axes.set_yticklabels() for more details.

    -
    -

    Note

    -

    Minor ticks are not supported by Axes3D objects.

    -
    -
    -

    New in version 1.1.0.

    -
    -
    - -
    -
    -set_zticks(*args, **kwargs)
    -

    Set z-axis tick locations. -See matplotlib.axes.Axes.set_yticks() for more details.

    -
    -

    Note

    -

    Minor ticks are not supported.

    -
    -
    -

    New in version 1.1.0.

    -
    -
    - -
    -
    -text(x, y, z, s, zdir=None, **kwargs)
    -

    Add text to the plot. kwargs will be passed on to Axes.text, -except for the zdir keyword, which sets the direction to be -used as the z direction.

    -
    - -
    -
    -text2D(x, y, s, fontdict=None, withdash=False, **kwargs)
    -

    Add text to the axes.

    -

    Add text in string s to axis at location x, y, data -coordinates.

    - --- - - - - - - -
    Parameters:

    x, y : scalars

    -
    -

    data coordinates

    -
    -

    s : string

    -
    -

    text

    -
    -

    fontdict : dictionary, optional, default: None

    -
    -

    A dictionary to override the default text properties. If fontdict -is None, the defaults are determined by your rc parameters.

    -
    -

    withdash : boolean, optional, default: False

    -
    -

    Creates a TextWithDash instance instead of a -Text instance.

    -
    -
    Other Parameters:
     

    kwargs : Text properties.

    -
    -

    Other miscellaneous text parameters.

    -
    -
    -

    Examples

    -

    Individual keyword arguments can be used to override any given -parameter:

    -
    >>> text(x, y, s, fontsize=12)
    -
    -
    -

    The default transform specifies that text is in data coords, -alternatively, you can specify text in axis coords (0,0 is -lower-left and 1,1 is upper-right). The example below places -text in the center of the axes:

    -
    >>> text(0.5, 0.5,'matplotlib', horizontalalignment='center',
    -...      verticalalignment='center',
    -...      transform=ax.transAxes)
    -
    -
    -

    You can put a rectangular box around the text instance (e.g., to -set a background color) by using the keyword bbox. bbox is -a dictionary of Rectangle -properties. For example:

    -
    >>> text(x, y, s, bbox=dict(facecolor='red', alpha=0.5))
    -
    -
    -
    - -
    -
    -text3D(x, y, z, s, zdir=None, **kwargs)
    -

    Add text to the plot. kwargs will be passed on to Axes.text, -except for the zdir keyword, which sets the direction to be -used as the z direction.

    -
    - -
    -
    -tick_params(axis='both', **kwargs)
    -

    Convenience method for changing the appearance of ticks and -tick labels.

    -

    See matplotlib.axes.Axes.tick_params() for more complete -documentation.

    -

    The only difference is that setting axis to ‘both’ will -mean that the settings are applied to all three axes. Also, -the axis parameter also accepts a value of ‘z’, which -would mean to apply to only the z-axis.

    -

    Also, because of how Axes3D objects are drawn very differently -from regular 2D axes, some of these settings may have -ambiguous meaning. For simplicity, the ‘z’ axis will -accept settings as if it was like the ‘y’ axis.

    -
    -

    Note

    -

    While this function is currently implemented, the core part -of the Axes3D object may ignore some of these settings. -Future releases will fix this. Priority will be given to -those who file bugs.

    -
    -
    -

    New in version 1.1.0: This function was added, but not tested. Please report any bugs.

    -
    -
    - -
    -
    -ticklabel_format(**kwargs)
    -

    Convenience method for manipulating the ScalarFormatter -used by default for linear axes in Axed3D objects.

    -

    See matplotlib.axes.Axes.ticklabel_format() for full -documentation. Note that this version applies to all three -axes of the Axes3D object. Therefore, the axis argument -will also accept a value of ‘z’ and the value of ‘both’ will -apply to all three axes.

    -
    -

    New in version 1.1.0: This function was added, but not tested. Please report any bugs.

    -
    -
    - -
    -
    -tricontour(*args, **kwargs)
    -

    Create a 3D contour plot.

    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - -
    ArgumentDescription
    X, Y,Data values as numpy.arrays
    Z 
    extend3dWhether to extend contour in 3D (default: False)
    strideStride (step size) for extending contour
    zdirThe direction to use: x, y or z (default)
    offsetIf specified plot a projection of the contour -lines on this position in plane normal to zdir
    -

    Other keyword arguments are passed on to -tricontour()

    -

    Returns a contour

    -
    -

    Changed in version 1.3.0: Added support for custom triangulations

    -
    -

    EXPERIMENTAL: This method currently produces incorrect output due to a -longstanding bug in 3D PolyCollection rendering.

    -
    - -
    -
    -tricontourf(*args, **kwargs)
    -

    Create a 3D contourf plot.

    - ---- - - - - - - - - - - - - - - - - - - - -
    ArgumentDescription
    X, Y,Data values as numpy.arrays
    Z 
    zdirThe direction to use: x, y or z (default)
    offsetIf specified plot a projection of the contour -lines on this position in plane normal to zdir
    -

    Other keyword arguments are passed on to -tricontour()

    -

    Returns a contour

    -
    -

    Changed in version 1.3.0: Added support for custom triangulations

    -
    -

    EXPERIMENTAL: This method currently produces incorrect output due to a -longstanding bug in 3D PolyCollection rendering.

    -
    - -
    -
    -tunit_cube(vals=None, M=None)
    -
    - -
    -
    -tunit_edges(vals=None, M=None)
    -
    - -
    -
    -unit_cube(vals=None)
    -
    - -
    -
    -update_datalim(xys, **kwargs)
    -
    - -
    -
    -view_init(elev=None, azim=None)
    -

    Set the elevation and azimuth of the axes.

    -

    This can be used to rotate the axes programatically.

    -

    ‘elev’ stores the elevation angle in the z plane. -‘azim’ stores the azimuth angle in the x,y plane.

    -

    if elev or azim are None (default), then the initial value -is used which was specified in the Axes3D constructor.

    -
    - -
    -
    -zaxis_date(tz=None)
    -

    Sets up z-axis ticks and labels that treat the z data as dates.

    -

    tz is a timezone string or tzinfo instance. -Defaults to rc value.

    -
    -

    Note

    -

    This function is merely provided for completeness. -Axes3D objects do not officially support dates for ticks, -and so this may or may not work as expected.

    -
    -
    -

    New in version 1.1.0: This function was added, but not tested. Please report any bugs.

    -
    -
    - -
    -
    -zaxis_inverted()
    -

    Returns True if the z-axis is inverted.

    -
    -

    New in version 1.1.0: This function was added, but not tested. Please report any bugs.

    -
    -
    - -
    - -
    -
    -mpl_toolkits.mplot3d.axes3d.get_test_data(delta=0.05)
    -

    Return a tuple X, Y, Z with a test data set.

    -
    - -
    -
    -mpl_toolkits.mplot3d.axes3d.unit_bbox()
    -
    - -
    -
    -

    axis3d

    -
    -

    Note

    -

    Historically, axis3d has suffered from having hard-coded constants -controlling the look and feel of the 3D plot. This precluded user -level adjustments such as label spacing, font colors and panel colors. -For version 1.1.0, these constants have been consolidated into a single -private member dictionary, self._axinfo, for the axis object. This is -intended only as a stop-gap measure to allow user-level customization, -but it is not intended to be permanent.

    -
    -
    -
    -class mpl_toolkits.mplot3d.axis3d.Axis(adir, v_intervalx, d_intervalx, axes, *args, **kwargs)
    -

    Bases: matplotlib.axis.XAxis

    -
    -
    -draw(renderer)
    -
    - -
    -
    -draw_pane(renderer)
    -
    - -
    -
    -get_major_ticks(numticks=None)
    -
    - -
    -
    -get_rotate_label(text)
    -
    - -
    -
    -get_tick_positions()
    -
    - -
    -
    -get_tightbbox(renderer)
    -
    - -
    -
    -get_view_interval()
    -

    return the Interval instance for this 3d axis view limits

    -
    - -
    -
    -init3d()
    -
    - -
    -
    -set_pane_color(color)
    -

    Set pane color to a RGBA tuple

    -
    - -
    -
    -set_pane_pos(xys)
    -
    - -
    -
    -set_rotate_label(val)
    -

    Whether to rotate the axis label: True, False or None. -If set to None the label will be rotated if longer than 4 chars.

    -
    - -
    -
    -set_view_interval(vmin, vmax, ignore=False)
    -
    - -
    - -
    -
    -class mpl_toolkits.mplot3d.axis3d.XAxis(adir, v_intervalx, d_intervalx, axes, *args, **kwargs)
    -

    Bases: mpl_toolkits.mplot3d.axis3d.Axis

    -
    -
    -get_data_interval()
    -

    return the Interval instance for this axis data limits

    -
    - -
    - -
    -
    -class mpl_toolkits.mplot3d.axis3d.YAxis(adir, v_intervalx, d_intervalx, axes, *args, **kwargs)
    -

    Bases: mpl_toolkits.mplot3d.axis3d.Axis

    -
    -
    -get_data_interval()
    -

    return the Interval instance for this axis data limits

    -
    - -
    - -
    -
    -class mpl_toolkits.mplot3d.axis3d.ZAxis(adir, v_intervalx, d_intervalx, axes, *args, **kwargs)
    -

    Bases: mpl_toolkits.mplot3d.axis3d.Axis

    -
    -
    -get_data_interval()
    -

    return the Interval instance for this axis data limits

    -
    - -
    - -
    -
    -mpl_toolkits.mplot3d.axis3d.get_flip_min_max(coord, index, mins, maxs)
    -
    - -
    -
    -mpl_toolkits.mplot3d.axis3d.move_from_center(coord, centers, deltas, axmask=(True, True, True))
    -

    Return a coordinate that is moved by “deltas” away from the center.

    -
    - -
    -
    -mpl_toolkits.mplot3d.axis3d.tick_update_position(tick, tickxs, tickys, labelpos)
    -

    Update tick line and label position and style.

    -
    - -
    -
    -

    art3d

    -

    Module containing 3D artist code and functions to convert 2D -artists into 3D versions which can be added to an Axes3D.

    -
    -
    -class mpl_toolkits.mplot3d.art3d.Line3D(xs, ys, zs, *args, **kwargs)
    -

    Bases: matplotlib.lines.Line2D

    -

    3D line object.

    -

    Keyword arguments are passed onto Line2D().

    -
    -
    -draw(renderer)
    -
    - -
    -
    -set_3d_properties(zs=0, zdir='z')
    -
    - -
    - -
    -
    -class mpl_toolkits.mplot3d.art3d.Line3DCollection(segments, *args, **kwargs)
    -

    Bases: matplotlib.collections.LineCollection

    -

    A collection of 3D lines.

    -

    Keyword arguments are passed onto LineCollection().

    -
    -
    -do_3d_projection(renderer)
    -

    Project the points according to renderer matrix.

    -
    - -
    -
    -draw(renderer, project=False)
    -
    - -
    -
    -set_segments(segments)
    -

    Set 3D segments

    -
    - -
    -
    -set_sort_zpos(val)
    -

    Set the position to use for z-sorting.

    -
    - -
    - -
    -
    -class mpl_toolkits.mplot3d.art3d.Patch3D(*args, **kwargs)
    -

    Bases: matplotlib.patches.Patch

    -

    3D patch object.

    -
    -
    -do_3d_projection(renderer)
    -
    - -
    -
    -draw(renderer)
    -
    - -
    -
    -get_facecolor()
    -
    - -
    -
    -get_path()
    -
    - -
    -
    -set_3d_properties(verts, zs=0, zdir='z')
    -
    - -
    - -
    -
    -class mpl_toolkits.mplot3d.art3d.Patch3DCollection(*args, **kwargs)
    -

    Bases: matplotlib.collections.PatchCollection

    -

    A collection of 3D patches.

    -

    Create a collection of flat 3D patches with its normal vector -pointed in zdir direction, and located at zs on the zdir -axis. ‘zs’ can be a scalar or an array-like of the same length as -the number of patches in the collection.

    -

    Constructor arguments are the same as for -PatchCollection. In addition, -keywords zs=0 and zdir=’z’ are available.

    -

    Also, the keyword argument “depthshade” is available to -indicate whether or not to shade the patches in order to -give the appearance of depth (default is True). -This is typically desired in scatter plots.

    -
    -
    -do_3d_projection(renderer)
    -
    - -
    -
    -set_3d_properties(zs, zdir)
    -
    - -
    -
    -set_sort_zpos(val)
    -

    Set the position to use for z-sorting.

    -
    - -
    - -
    -
    -class mpl_toolkits.mplot3d.art3d.Path3DCollection(*args, **kwargs)
    -

    Bases: matplotlib.collections.PathCollection

    -

    A collection of 3D paths.

    -

    Create a collection of flat 3D paths with its normal vector -pointed in zdir direction, and located at zs on the zdir -axis. ‘zs’ can be a scalar or an array-like of the same length as -the number of paths in the collection.

    -

    Constructor arguments are the same as for -PathCollection. In addition, -keywords zs=0 and zdir=’z’ are available.

    -

    Also, the keyword argument “depthshade” is available to -indicate whether or not to shade the patches in order to -give the appearance of depth (default is True). -This is typically desired in scatter plots.

    -
    -
    -do_3d_projection(renderer)
    -
    - -
    -
    -set_3d_properties(zs, zdir)
    -
    - -
    -
    -set_sort_zpos(val)
    -

    Set the position to use for z-sorting.

    -
    - -
    - -
    -
    -class mpl_toolkits.mplot3d.art3d.PathPatch3D(path, **kwargs)
    -

    Bases: mpl_toolkits.mplot3d.art3d.Patch3D

    -

    3D PathPatch object.

    -
    -
    -do_3d_projection(renderer)
    -
    - -
    -
    -set_3d_properties(path, zs=0, zdir='z')
    -
    - -
    - -
    -
    -class mpl_toolkits.mplot3d.art3d.Poly3DCollection(verts, *args, **kwargs)
    -

    Bases: matplotlib.collections.PolyCollection

    -

    A collection of 3D polygons.

    -

    Create a Poly3DCollection.

    -

    verts should contain 3D coordinates.

    -

    Keyword arguments: -zsort, see set_zsort for options.

    -

    Note that this class does a bit of magic with the _facecolors -and _edgecolors properties.

    -
    -
    -do_3d_projection(renderer)
    -

    Perform the 3D projection for this object.

    -
    - -
    -
    -draw(renderer)
    -
    - -
    -
    -get_edgecolor()
    -
    - -
    -
    -get_edgecolors()
    -
    - -
    -
    -get_facecolor()
    -
    - -
    -
    -get_facecolors()
    -
    - -
    -
    -get_vector(segments3d)
    -

    Optimize points for projection

    -
    - -
    -
    -set_3d_properties()
    -
    - -
    -
    -set_alpha(alpha)
    -

    Set the alpha tranparencies of the collection. alpha must be -a float or None.

    -

    ACCEPTS: float or None

    -
    - -
    -
    -set_edgecolor(colors)
    -
    - -
    -
    -set_edgecolors(colors)
    -
    - -
    -
    -set_facecolor(colors)
    -
    - -
    -
    -set_facecolors(colors)
    -
    - -
    -
    -set_sort_zpos(val)
    -

    Set the position to use for z-sorting.

    -
    - -
    -
    -set_verts(verts, closed=True)
    -

    Set 3D vertices.

    -
    - -
    -
    -set_verts_and_codes(verts, codes)
    -

    Sets 3D vertices with path codes

    -
    - -
    -
    -set_zsort(zsort)
    -
    -
    Set z-sorting behaviour:
    -
    boolean: if True use default ‘average’ -string: ‘average’, ‘min’ or ‘max’
    -
    -
    - -
    - -
    -
    -class mpl_toolkits.mplot3d.art3d.Text3D(x=0, y=0, z=0, text='', zdir='z', **kwargs)
    -

    Bases: matplotlib.text.Text

    -

    Text object with 3D position and (in the future) direction.

    -

    x, y, z Position of text -text Text string to display -zdir Direction of text

    -

    Keyword arguments are passed onto Text().

    -
    -
    -draw(renderer)
    -
    - -
    -
    -set_3d_properties(z=0, zdir='z')
    -
    - -
    - -
    -
    -mpl_toolkits.mplot3d.art3d.get_colors(c, num)
    -

    Stretch the color argument to provide the required number num

    -
    - -
    -
    -mpl_toolkits.mplot3d.art3d.get_dir_vector(zdir)
    -
    - -
    -
    -mpl_toolkits.mplot3d.art3d.get_patch_verts(patch)
    -

    Return a list of vertices for the path of a patch.

    -
    - -
    -
    -mpl_toolkits.mplot3d.art3d.iscolor(c)
    -
    - -
    -
    -mpl_toolkits.mplot3d.art3d.juggle_axes(xs, ys, zs, zdir)
    -

    Reorder coordinates so that 2D xs, ys can be plotted in the plane -orthogonal to zdir. zdir is normally x, y or z. However, if zdir -starts with a ‘-‘ it is interpreted as a compensation for rotate_axes.

    -
    - -
    -
    -mpl_toolkits.mplot3d.art3d.line_2d_to_3d(line, zs=0, zdir='z')
    -

    Convert a 2D line to 3D.

    -
    - -
    -
    -mpl_toolkits.mplot3d.art3d.line_collection_2d_to_3d(col, zs=0, zdir='z')
    -

    Convert a LineCollection to a Line3DCollection object.

    -
    - -
    -
    -mpl_toolkits.mplot3d.art3d.norm_angle(a)
    -

    Return angle between -180 and +180

    -
    - -
    -
    -mpl_toolkits.mplot3d.art3d.norm_text_angle(a)
    -

    Return angle between -90 and +90

    -
    - -
    -
    -mpl_toolkits.mplot3d.art3d.patch_2d_to_3d(patch, z=0, zdir='z')
    -

    Convert a Patch to a Patch3D object.

    -
    - -
    -
    -mpl_toolkits.mplot3d.art3d.patch_collection_2d_to_3d(col, zs=0, zdir='z', depthshade=True)
    -

    Convert a PatchCollection into a -Patch3DCollection object -(or a PathCollection into a -Path3DCollection object).

    -

    Keywords:

    -
    -
    za The location or locations to place the patches in the
    -
    collection along the zdir axis. Defaults to 0.
    -
    -

    zdir The axis in which to place the patches. Default is “z”.

    -
    -
    depthshade Whether to shade the patches to give a sense of depth.
    -
    Defaults to True.
    -
    -
    - -
    -
    -mpl_toolkits.mplot3d.art3d.path_to_3d_segment(path, zs=0, zdir='z')
    -

    Convert a path to a 3D segment.

    -
    - -
    -
    -mpl_toolkits.mplot3d.art3d.path_to_3d_segment_with_codes(path, zs=0, zdir='z')
    -

    Convert a path to a 3D segment with path codes.

    -
    - -
    -
    -mpl_toolkits.mplot3d.art3d.pathpatch_2d_to_3d(pathpatch, z=0, zdir='z')
    -

    Convert a PathPatch to a PathPatch3D object.

    -
    - -
    -
    -mpl_toolkits.mplot3d.art3d.paths_to_3d_segments(paths, zs=0, zdir='z')
    -

    Convert paths from a collection object to 3D segments.

    -
    - -
    -
    -mpl_toolkits.mplot3d.art3d.paths_to_3d_segments_with_codes(paths, zs=0, zdir='z')
    -

    Convert paths from a collection object to 3D segments with path codes.

    -
    - -
    -
    -mpl_toolkits.mplot3d.art3d.poly_collection_2d_to_3d(col, zs=0, zdir='z')
    -

    Convert a PolyCollection to a Poly3DCollection object.

    -
    - -
    -
    -mpl_toolkits.mplot3d.art3d.rotate_axes(xs, ys, zs, zdir)
    -

    Reorder coordinates so that the axes are rotated with zdir along -the original z axis. Prepending the axis with a ‘-‘ does the -inverse transform, so zdir can be x, -x, y, -y, z or -z

    -
    - -
    -
    -mpl_toolkits.mplot3d.art3d.text_2d_to_3d(obj, z=0, zdir='z')
    -

    Convert a Text to a Text3D object.

    -
    - -
    -
    -mpl_toolkits.mplot3d.art3d.zalpha(colors, zs)
    -

    Modify the alphas of the color list according to depth

    -
    - -
    -
    -

    proj3d

    -

    Various transforms used for by the 3D code

    -
    -
    -mpl_toolkits.mplot3d.proj3d.inv_transform(xs, ys, zs, M)
    -
    - -
    -
    -mpl_toolkits.mplot3d.proj3d.line2d(p0, p1)
    -

    Return 2D equation of line in the form ax+by+c = 0

    -
    - -
    -
    -mpl_toolkits.mplot3d.proj3d.line2d_dist(l, p)
    -

    Distance from line to point -line is a tuple of coefficients a,b,c

    -
    - -
    -
    -mpl_toolkits.mplot3d.proj3d.line2d_seg_dist(p1, p2, p0)
    -

    distance(s) from line defined by p1 - p2 to point(s) p0

    -

    p0[0] = x(s) -p0[1] = y(s)

    -

    intersection point p = p1 + u*(p2-p1) -and intersection point lies within segment if u is between 0 and 1

    -
    - -
    -
    -mpl_toolkits.mplot3d.proj3d.mod(v)
    -

    3d vector length

    -
    - -
    -
    -mpl_toolkits.mplot3d.proj3d.persp_transformation(zfront, zback)
    -
    - -
    -
    -mpl_toolkits.mplot3d.proj3d.proj_points(points, M)
    -
    - -
    -
    -mpl_toolkits.mplot3d.proj3d.proj_trans_clip_points(points, M)
    -
    - -
    -
    -mpl_toolkits.mplot3d.proj3d.proj_trans_points(points, M)
    -
    - -
    -
    -mpl_toolkits.mplot3d.proj3d.proj_transform(xs, ys, zs, M)
    -

    Transform the points by the projection matrix

    -
    - -
    -
    -mpl_toolkits.mplot3d.proj3d.proj_transform_clip(xs, ys, zs, M)
    -

    Transform the points by the projection matrix -and return the clipping result -returns txs,tys,tzs,tis

    -
    - -
    -
    -mpl_toolkits.mplot3d.proj3d.proj_transform_vec(vec, M)
    -
    - -
    -
    -mpl_toolkits.mplot3d.proj3d.proj_transform_vec_clip(vec, M)
    -
    - -
    -
    -mpl_toolkits.mplot3d.proj3d.rot_x(V, alpha)
    -
    - -
    -
    -mpl_toolkits.mplot3d.proj3d.test_lines_dists()
    -
    - -
    -
    -mpl_toolkits.mplot3d.proj3d.test_proj()
    -
    - -
    -
    -mpl_toolkits.mplot3d.proj3d.test_proj_draw_axes(M, s=1)
    -
    - -
    -
    -mpl_toolkits.mplot3d.proj3d.test_proj_make_M(E=None)
    -
    - -
    -
    -mpl_toolkits.mplot3d.proj3d.test_rot()
    -
    - -
    -
    -mpl_toolkits.mplot3d.proj3d.test_world()
    -
    - -
    -
    -mpl_toolkits.mplot3d.proj3d.transform(xs, ys, zs, M)
    -

    Transform the points by the projection matrix

    -
    - -
    -
    -mpl_toolkits.mplot3d.proj3d.vec_pad_ones(xs, ys, zs)
    -
    - -
    -
    -mpl_toolkits.mplot3d.proj3d.view_transformation(E, R, V)
    -
    - -
    -
    -mpl_toolkits.mplot3d.proj3d.world_transformation(xmin, xmax, ymin, ymax, zmin, zmax)
    -
    - -
    -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/mpl_toolkits/mplot3d/tutorial.html b/mpl_toolkits/mplot3d/tutorial.html deleted file mode 100644 index c62db54d65b..00000000000 --- a/mpl_toolkits/mplot3d/tutorial.html +++ /dev/null @@ -1,987 +0,0 @@ - - - - - - - - mplot3d tutorial — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -

    Table Of Contents

    - -
    -

    Related Topics

    - -
    -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    mplot3d tutorial

    - -
    -

    Getting started

    -

    An Axes3D object is created just like any other axes using -the projection=‘3d’ keyword. -Create a new matplotlib.figure.Figure and -add a new axes to it of type Axes3D:

    -
    import matplotlib.pyplot as plt
    -from mpl_toolkits.mplot3d import Axes3D
    -fig = plt.figure()
    -ax = fig.add_subplot(111, projection='3d')
    -
    -
    -
    -

    New in version 1.0.0: This approach is the preferred method of creating a 3D axes.

    -
    -
    -

    Note

    -

    Prior to version 1.0.0, the method of creating a 3D axes was -different. For those using older versions of matplotlib, change -ax = fig.add_subplot(111, projection='3d') -to ax = Axes3D(fig).

    -
    -
    -
    -

    Line plots

    -
    -
    -Axes3D.plot(xs, ys, *args, **kwargs)
    -

    Plot 2D or 3D data.

    - ---- - - - - - - - - - - - - - - - - -
    ArgumentDescription
    xs, ysx, y coordinates of vertices
    zsz value(s), either one for all points or one for -each point.
    zdirWhich direction to use as z (‘x’, ‘y’ or ‘z’) -when plotting a 2D set.
    -

    Other arguments are passed on to -plot()

    -
    - -

    (Source code, png, pdf)

    -
    -../../_images/lines3d_demo.png -
    -
    -
    -

    Scatter plots

    -
    -
    -Axes3D.scatter(xs, ys, zs=0, zdir='z', s=20, c=None, depthshade=True, *args, **kwargs)
    -

    Create a scatter plot.

    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - -
    ArgumentDescription
    xs, ysPositions of data points.
    zsEither an array of the same length as xs and -ys or a single value to place all points in -the same plane. Default is 0.
    zdirWhich direction to use as z (‘x’, ‘y’ or ‘z’) -when plotting a 2D set.
    sSize in points^2. It is a scalar or an array of the -same length as x and y.
    cA color. c can be a single color format string, or a -sequence of color specifications of length N, or a -sequence of N numbers to be mapped to colors using the -cmap and norm specified via kwargs (see below). Note -that c should not be a single numeric RGB or RGBA -sequence because that is indistinguishable from an array -of values to be colormapped. c can be a 2-D array in -which the rows are RGB or RGBA, however, including the -case of a single row to specify the same color for -all points.
    depthshadeWhether or not to shade the scatter markers to give -the appearance of depth. Default is True.
    -

    Keyword arguments are passed on to -scatter().

    -

    Returns a Patch3DCollection

    -
    - -

    (Source code, png, pdf)

    -
    -../../_images/scatter3d_demo.png -
    -
    -
    -

    Wireframe plots

    -
    -
    -Axes3D.plot_wireframe(X, Y, Z, *args, **kwargs)
    -
    -

    Plot a 3D wireframe.

    -

    The rstride and cstride kwargs set the stride used to -sample the input data to generate the graph. If either is 0 -the input data in not sampled along this direction producing a -3D line plot rather than a wireframe plot. The stride arguments -are only used by default if in the ‘classic’ mode. They are -now superseded by rcount and ccount. Will raise ValueError -if both stride and count are used.

    -
    -
    -
    ` The rcount and ccount kwargs supersedes rstride and
    -

    cstride for default sampling method for wireframe plotting. -These arguments will determine at most how many evenly spaced -samples will be taken from the input data to generate the graph. -This is the default sampling method unless using the ‘classic’ -style. Will raise ValueError if both stride and count are -specified. If either is zero, then the input data is not sampled -along this direction, producing a 3D line plot rather than a -wireframe plot. -Added in v2.0.0.

    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - -
    ArgumentDescription
    X, Y,Data values as 2D arrays
    Z 
    rstrideArray row stride (step size), defaults to 1
    cstrideArray column stride (step size), defaults to 1
    rcountUse at most this many rows, defaults to 50
    ccountUse at most this many columns, defaults to 50
    -

    Keyword arguments are passed on to -LineCollection.

    -

    Returns a Line3DCollection

    -
    -
    -
    - -

    (Source code, png, pdf)

    -
    -../../_images/wire3d_demo1.png -
    -
    -
    -

    Surface plots

    -
    -
    -Axes3D.plot_surface(X, Y, Z, *args, **kwargs)
    -

    Create a surface plot.

    -

    By default it will be colored in shades of a solid color, -but it also supports color mapping by supplying the cmap -argument.

    -

    The rstride and cstride kwargs set the stride used to -sample the input data to generate the graph. If 1k by 1k -arrays are passed in, the default values for the strides will -result in a 100x100 grid being plotted. Defaults to 10. -Raises a ValueError if both stride and count kwargs -(see next section) are provided.

    -

    The rcount and ccount kwargs supersedes rstride and -cstride for default sampling method for surface plotting. -These arguments will determine at most how many evenly spaced -samples will be taken from the input data to generate the graph. -This is the default sampling method unless using the ‘classic’ -style. Will raise ValueError if both stride and count are -specified. -Added in v2.0.0.

    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ArgumentDescription
    X, Y, ZData values as 2D arrays
    rstrideArray row stride (step size)
    cstrideArray column stride (step size)
    rcountUse at most this many rows, defaults to 50
    ccountUse at most this many columns, defaults to 50
    colorColor of the surface patches
    cmapA colormap for the surface patches.
    facecolorsFace colors for the individual patches
    normAn instance of Normalize to map values to colors
    vminMinimum value to map
    vmaxMaximum value to map
    shadeWhether to shade the facecolors
    -

    Other arguments are passed on to -Poly3DCollection

    -
    - -

    (Source code, png, pdf)

    -
    -../../_images/surface3d_demo1.png -
    -

    (Source code, png, pdf)

    -
    -../../_images/surface3d_demo2.png -
    -

    (Source code, png, pdf)

    -
    -../../_images/surface3d_demo3.png -
    -
    -
    -

    Tri-Surface plots

    -
    -
    -Axes3D.plot_trisurf(*args, **kwargs)
    -
    ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ArgumentDescription
    X, Y, ZData values as 1D arrays
    colorColor of the surface patches
    cmapA colormap for the surface patches.
    normAn instance of Normalize to map values to colors
    vminMinimum value to map
    vmaxMaximum value to map
    shadeWhether to shade the facecolors
    -

    The (optional) triangulation can be specified in one of two ways; -either:

    -
    plot_trisurf(triangulation, ...)
    -
    -
    -

    where triangulation is a Triangulation -object, or:

    -
    plot_trisurf(X, Y, ...)
    -plot_trisurf(X, Y, triangles, ...)
    -plot_trisurf(X, Y, triangles=triangles, ...)
    -
    -
    -

    in which case a Triangulation object will be created. See -Triangulation for a explanation of -these possibilities.

    -

    The remaining arguments are:

    -
    plot_trisurf(..., Z)
    -
    -
    -

    where Z is the array of values to contour, one per point -in the triangulation.

    -

    Other arguments are passed on to -Poly3DCollection

    -

    Examples:

    -

    (Source code, png, pdf)

    -
    -../../_images/trisurf3d_demo.png -
    -

    (Source code, png, pdf)

    -
    -../../_images/trisurf3d_demo2.png -
    -
    -

    New in version 1.2.0: This plotting function was added for the v1.2.0 release.

    -
    -
    - -

    (Source code, png, pdf)

    -
    -../../_images/trisurf3d_demo.png -
    -
    -
    -

    Contour plots

    -
    -
    -Axes3D.contour(X, Y, Z, *args, **kwargs)
    -

    Create a 3D contour plot.

    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - -
    ArgumentDescription
    X, Y,Data values as numpy.arrays
    Z 
    extend3dWhether to extend contour in 3D (default: False)
    strideStride (step size) for extending contour
    zdirThe direction to use: x, y or z (default)
    offsetIf specified plot a projection of the contour -lines on this position in plane normal to zdir
    -

    The positional and other keyword arguments are passed on to -contour()

    -

    Returns a contour

    -
    - -

    (Source code, png, pdf)

    -
    -../../_images/contour3d_demo.png -
    -

    (Source code, png, pdf)

    -
    -../../_images/contour3d_demo2.png -
    -

    (Source code, png, pdf)

    -
    -../../_images/contour3d_demo3.png -
    -
    -
    -

    Filled contour plots

    -
    -
    -Axes3D.contourf(X, Y, Z, *args, **kwargs)
    -

    Create a 3D contourf plot.

    - ---- - - - - - - - - - - - - - - - - - - - -
    ArgumentDescription
    X, Y,Data values as numpy.arrays
    Z 
    zdirThe direction to use: x, y or z (default)
    offsetIf specified plot a projection of the filled contour -on this position in plane normal to zdir
    -

    The positional and keyword arguments are passed on to -contourf()

    -

    Returns a contourf

    -
    -

    Changed in version 1.1.0: The zdir and offset kwargs were added.

    -
    -
    - -

    (Source code, png, pdf)

    -
    -../../_images/contourf3d_demo.png -
    -

    (Source code, png, pdf)

    -
    -../../_images/contourf3d_demo21.png -
    -
    -

    New in version 1.1.0: The feature demoed in the second contourf3d example was enabled as a -result of a bugfix for version 1.1.0.

    -
    -
    -
    -

    Polygon plots

    -
    -
    -Axes3D.add_collection3d(col, zs=0, zdir='z')
    -

    Add a 3D collection object to the plot.

    -

    2D collection types are converted to a 3D version by -modifying the object and adding z coordinate information.

    -
    -
    Supported are:
    -
      -
    • PolyCollection
    • -
    • LineColleciton
    • -
    • PatchCollection
    • -
    -
    -
    -
    - -

    (Source code, png, pdf)

    -
    -../../_images/polys3d_demo.png -
    -
    -
    -

    Bar plots

    -
    -
    -Axes3D.bar(left, height, zs=0, zdir='z', *args, **kwargs)
    -

    Add 2D bar(s).

    - ---- - - - - - - - - - - - - - - - - - - - -
    ArgumentDescription
    leftThe x coordinates of the left sides of the bars.
    heightThe height of the bars.
    zsZ coordinate of bars, if one value is specified -they will all be placed at the same z.
    zdirWhich direction to use as z (‘x’, ‘y’ or ‘z’) -when plotting a 2D set.
    -

    Keyword arguments are passed onto bar().

    -

    Returns a Patch3DCollection

    -
    - -

    (Source code, png, pdf)

    -
    -../../_images/bars3d_demo.png -
    -
    -
    -

    Quiver

    -
    -
    -Axes3D.quiver(*args, **kwargs)
    -

    Plot a 3D field of arrows.

    -

    call signatures:

    -
    quiver(X, Y, Z, U, V, W, **kwargs)
    -
    -
    -

    Arguments:

    -
    -
    -
    X, Y, Z:
    -
    The x, y and z coordinates of the arrow locations (default is -tail of arrow; see pivot kwarg)
    -
    U, V, W:
    -
    The x, y and z components of the arrow vectors
    -
    -
    -

    The arguments could be array-like or scalars, so long as they -they can be broadcast together. The arguments can also be -masked arrays. If an element in any of argument is masked, then -that corresponding quiver element will not be plotted.

    -

    Keyword arguments:

    -
    -
    -
    length: [1.0 | float]
    -
    The length of each quiver, default to 1.0, the unit is -the same with the axes
    -
    arrow_length_ratio: [0.3 | float]
    -
    The ratio of the arrow head with respect to the quiver, -default to 0.3
    -
    pivot: [ ‘tail’ | ‘middle’ | ‘tip’ ]
    -
    The part of the arrow that is at the grid point; the arrow -rotates about this point, hence the name pivot. -Default is ‘tail’
    -
    normalize: [False | True]
    -
    When True, all of the arrows will be the same length. This -defaults to False, where the arrows will be different lengths -depending on the values of u,v,w.
    -
    -
    -

    Any additional keyword arguments are delegated to -LineCollection

    -
    - -

    (Source code, png, pdf)

    -
    -../../_images/quiver3d_demo1.png -
    -
    -
    -

    2D plots in 3D

    -

    (Source code, png, pdf)

    -
    -../../_images/2dcollections3d_demo.png -
    -
    -
    -

    Text

    -
    -
    -Axes3D.text(x, y, z, s, zdir=None, **kwargs)
    -

    Add text to the plot. kwargs will be passed on to Axes.text, -except for the zdir keyword, which sets the direction to be -used as the z direction.

    -
    - -

    (Source code, png, pdf)

    -
    -../../_images/text3d_demo.png -
    -
    -
    -

    Subplotting

    -

    Having multiple 3D plots in a single figure is the same -as it is for 2D plots. Also, you can have both 2D and 3D plots -in the same figure.

    -
    -

    New in version 1.0.0: Subplotting 3D plots was added in v1.0.0. Earlier version can not -do this.

    -
    -

    (Source code, png, pdf)

    -
    -../../_images/subplot3d_demo.png -
    -

    (Source code, png, pdf)

    -
    -../../_images/mixed_subplots_demo.png -
    -
    -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/plot_directive/mpl_examples/api/thumbnails/barchart_demo.png b/plot_directive/mpl_examples/api/thumbnails/barchart_demo.png deleted file mode 100644 index c123ccbba69..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/barchart_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/bbox_intersect.png b/plot_directive/mpl_examples/api/thumbnails/bbox_intersect.png deleted file mode 100644 index d20db2b2626..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/bbox_intersect.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/collections_demo.png b/plot_directive/mpl_examples/api/thumbnails/collections_demo.png deleted file mode 100644 index 5c995c347cd..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/collections_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/colorbar_basics.png b/plot_directive/mpl_examples/api/thumbnails/colorbar_basics.png deleted file mode 100644 index 0d04a8a1a2e..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/colorbar_basics.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/colorbar_only.png b/plot_directive/mpl_examples/api/thumbnails/colorbar_only.png deleted file mode 100644 index f598c69ad5b..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/colorbar_only.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/compound_path.png b/plot_directive/mpl_examples/api/thumbnails/compound_path.png deleted file mode 100644 index 729dae38fcb..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/compound_path.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/custom_projection_example.png b/plot_directive/mpl_examples/api/thumbnails/custom_projection_example.png deleted file mode 100644 index dceeadd466f..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/custom_projection_example.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/custom_scale_example.png b/plot_directive/mpl_examples/api/thumbnails/custom_scale_example.png deleted file mode 100644 index a15cd908481..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/custom_scale_example.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/date_demo.png b/plot_directive/mpl_examples/api/thumbnails/date_demo.png deleted file mode 100644 index ff39636a5f3..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/date_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/date_index_formatter.png b/plot_directive/mpl_examples/api/thumbnails/date_index_formatter.png deleted file mode 100644 index d66de759979..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/date_index_formatter.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/date_index_formatter_00.png b/plot_directive/mpl_examples/api/thumbnails/date_index_formatter_00.png deleted file mode 100644 index 56302a2c6c2..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/date_index_formatter_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/date_index_formatter_01.png b/plot_directive/mpl_examples/api/thumbnails/date_index_formatter_01.png deleted file mode 100644 index 7e7c38521c7..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/date_index_formatter_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/demo_affine_image.png b/plot_directive/mpl_examples/api/thumbnails/demo_affine_image.png deleted file mode 100644 index cfcd6fdd0a9..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/demo_affine_image.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/demo_affine_image_00_00.png b/plot_directive/mpl_examples/api/thumbnails/demo_affine_image_00_00.png deleted file mode 100644 index b73a38ac600..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/demo_affine_image_00_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/donut_demo.png b/plot_directive/mpl_examples/api/thumbnails/donut_demo.png deleted file mode 100644 index 7e3576a81ed..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/donut_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/engineering_formatter.png b/plot_directive/mpl_examples/api/thumbnails/engineering_formatter.png deleted file mode 100644 index cd349ee7a7c..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/engineering_formatter.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/filled_step_00.png b/plot_directive/mpl_examples/api/thumbnails/filled_step_00.png deleted file mode 100644 index d05785ba574..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/filled_step_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/filled_step_01.png b/plot_directive/mpl_examples/api/thumbnails/filled_step_01.png deleted file mode 100644 index 38973f965bc..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/filled_step_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/histogram_path_demo.png b/plot_directive/mpl_examples/api/thumbnails/histogram_path_demo.png deleted file mode 100644 index 55d8d565679..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/histogram_path_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/image_zcoord.png b/plot_directive/mpl_examples/api/thumbnails/image_zcoord.png deleted file mode 100644 index 41c773e1754..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/image_zcoord.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/joinstyle.png b/plot_directive/mpl_examples/api/thumbnails/joinstyle.png deleted file mode 100644 index 0e0d6b82826..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/joinstyle.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/legend_demo.png b/plot_directive/mpl_examples/api/thumbnails/legend_demo.png deleted file mode 100644 index 1833a9f68f9..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/legend_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/line_with_text.png b/plot_directive/mpl_examples/api/thumbnails/line_with_text.png deleted file mode 100644 index 9324ec23831..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/line_with_text.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/logo2.png b/plot_directive/mpl_examples/api/thumbnails/logo2.png deleted file mode 100644 index 62f278b6844..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/logo2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/mathtext_asarray.png b/plot_directive/mpl_examples/api/thumbnails/mathtext_asarray.png deleted file mode 100644 index 6d9ec9b0e87..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/mathtext_asarray.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/patch_collection.png b/plot_directive/mpl_examples/api/thumbnails/patch_collection.png deleted file mode 100644 index 0124375f014..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/patch_collection.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/power_norm_demo.png b/plot_directive/mpl_examples/api/thumbnails/power_norm_demo.png deleted file mode 100644 index 6586da4353c..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/power_norm_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/quad_bezier.png b/plot_directive/mpl_examples/api/thumbnails/quad_bezier.png deleted file mode 100644 index 011a54f6f61..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/quad_bezier.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/radar_chart.png b/plot_directive/mpl_examples/api/thumbnails/radar_chart.png deleted file mode 100644 index 1bff8148622..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/radar_chart.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/sankey_demo_basics_00.png b/plot_directive/mpl_examples/api/thumbnails/sankey_demo_basics_00.png deleted file mode 100644 index bde83207a48..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/sankey_demo_basics_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/sankey_demo_basics_01.png b/plot_directive/mpl_examples/api/thumbnails/sankey_demo_basics_01.png deleted file mode 100644 index 73f3fb3e5ae..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/sankey_demo_basics_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/sankey_demo_basics_02.png b/plot_directive/mpl_examples/api/thumbnails/sankey_demo_basics_02.png deleted file mode 100644 index cee48624425..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/sankey_demo_basics_02.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/sankey_demo_links.png b/plot_directive/mpl_examples/api/thumbnails/sankey_demo_links.png deleted file mode 100644 index 27e9199e15a..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/sankey_demo_links.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/sankey_demo_old.png b/plot_directive/mpl_examples/api/thumbnails/sankey_demo_old.png deleted file mode 100644 index 557980c940e..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/sankey_demo_old.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/sankey_demo_rankine.png b/plot_directive/mpl_examples/api/thumbnails/sankey_demo_rankine.png deleted file mode 100644 index b01b37b6743..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/sankey_demo_rankine.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/scatter_piecharts.png b/plot_directive/mpl_examples/api/thumbnails/scatter_piecharts.png deleted file mode 100644 index b1612cfb2ff..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/scatter_piecharts.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/skewt.png b/plot_directive/mpl_examples/api/thumbnails/skewt.png deleted file mode 100644 index ec499dc6b1f..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/skewt.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/span_regions.png b/plot_directive/mpl_examples/api/thumbnails/span_regions.png deleted file mode 100644 index 3bf9298a73a..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/span_regions.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/two_scales.png b/plot_directive/mpl_examples/api/thumbnails/two_scales.png deleted file mode 100644 index b8c6c6f3891..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/two_scales.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/unicode_minus.png b/plot_directive/mpl_examples/api/thumbnails/unicode_minus.png deleted file mode 100644 index 2240c59bf3b..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/unicode_minus.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/watermark_image.png b/plot_directive/mpl_examples/api/thumbnails/watermark_image.png deleted file mode 100644 index eb658b3a693..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/watermark_image.png and /dev/null differ diff --git a/plot_directive/mpl_examples/api/thumbnails/watermark_text.png b/plot_directive/mpl_examples/api/thumbnails/watermark_text.png deleted file mode 100644 index 9c45b8b5431..00000000000 Binary files a/plot_directive/mpl_examples/api/thumbnails/watermark_text.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_axes_divider_01_00.png b/plot_directive/mpl_examples/axes_grid/thumbnails/demo_axes_divider_01_00.png deleted file mode 100644 index 20bb224118b..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_axes_divider_01_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_axes_grid.png b/plot_directive/mpl_examples/axes_grid/thumbnails/demo_axes_grid.png deleted file mode 100644 index 5f47c3989c0..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_axes_grid.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_axes_grid2.png b/plot_directive/mpl_examples/axes_grid/thumbnails/demo_axes_grid2.png deleted file mode 100644 index b4b90e2c112..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_axes_grid2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_axes_hbox_divider.png b/plot_directive/mpl_examples/axes_grid/thumbnails/demo_axes_hbox_divider.png deleted file mode 100644 index 7812f1e0e0e..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_axes_hbox_divider.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_axes_rgb_00.png b/plot_directive/mpl_examples/axes_grid/thumbnails/demo_axes_rgb_00.png deleted file mode 100644 index 5b27548aba7..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_axes_rgb_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_axes_rgb_01.png b/plot_directive/mpl_examples/axes_grid/thumbnails/demo_axes_rgb_01.png deleted file mode 100644 index cd53f54cea8..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_axes_rgb_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_axisline_style.png b/plot_directive/mpl_examples/axes_grid/thumbnails/demo_axisline_style.png deleted file mode 100644 index d8a61bd9561..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_axisline_style.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_colorbar_with_inset_locator.png b/plot_directive/mpl_examples/axes_grid/thumbnails/demo_colorbar_with_inset_locator.png deleted file mode 100644 index f645fb05ef8..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_colorbar_with_inset_locator.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_curvelinear_grid.png b/plot_directive/mpl_examples/axes_grid/thumbnails/demo_curvelinear_grid.png deleted file mode 100644 index eb64e331f47..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_curvelinear_grid.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_curvelinear_grid2.png b/plot_directive/mpl_examples/axes_grid/thumbnails/demo_curvelinear_grid2.png deleted file mode 100644 index fd6d63dcdad..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_curvelinear_grid2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_edge_colorbar.png b/plot_directive/mpl_examples/axes_grid/thumbnails/demo_edge_colorbar.png deleted file mode 100644 index aaeb81c9349..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_edge_colorbar.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_floating_axes.png b/plot_directive/mpl_examples/axes_grid/thumbnails/demo_floating_axes.png deleted file mode 100644 index 52c6c5a37ed..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_floating_axes.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_floating_axis.png b/plot_directive/mpl_examples/axes_grid/thumbnails/demo_floating_axis.png deleted file mode 100644 index f462b1ee616..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_floating_axis.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_imagegrid_aspect.png b/plot_directive/mpl_examples/axes_grid/thumbnails/demo_imagegrid_aspect.png deleted file mode 100644 index b1aa8308e65..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_imagegrid_aspect.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_parasite_axes2.png b/plot_directive/mpl_examples/axes_grid/thumbnails/demo_parasite_axes2.png deleted file mode 100644 index 22a4a0168a0..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_parasite_axes2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_parasite_axes2_00_00.png b/plot_directive/mpl_examples/axes_grid/thumbnails/demo_parasite_axes2_00_00.png deleted file mode 100644 index f735eb9dfa0..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/demo_parasite_axes2_00_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/inset_locator_demo.png b/plot_directive/mpl_examples/axes_grid/thumbnails/inset_locator_demo.png deleted file mode 100644 index 0f7954021f7..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/inset_locator_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/inset_locator_demo2.png b/plot_directive/mpl_examples/axes_grid/thumbnails/inset_locator_demo2.png deleted file mode 100644 index d203ea4f06d..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/inset_locator_demo2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/make_room_for_ylabel_using_axesgrid_00.png b/plot_directive/mpl_examples/axes_grid/thumbnails/make_room_for_ylabel_using_axesgrid_00.png deleted file mode 100644 index e56ed1f284d..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/make_room_for_ylabel_using_axesgrid_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/make_room_for_ylabel_using_axesgrid_01.png b/plot_directive/mpl_examples/axes_grid/thumbnails/make_room_for_ylabel_using_axesgrid_01.png deleted file mode 100644 index 8e2ad70fc5a..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/make_room_for_ylabel_using_axesgrid_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/make_room_for_ylabel_using_axesgrid_02.png b/plot_directive/mpl_examples/axes_grid/thumbnails/make_room_for_ylabel_using_axesgrid_02.png deleted file mode 100644 index a7a9c1944b4..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/make_room_for_ylabel_using_axesgrid_02.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/parasite_simple2.png b/plot_directive/mpl_examples/axes_grid/thumbnails/parasite_simple2.png deleted file mode 100644 index b945fe3848e..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/parasite_simple2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/scatter_hist.png b/plot_directive/mpl_examples/axes_grid/thumbnails/scatter_hist.png deleted file mode 100644 index 834211f65b8..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/scatter_hist.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/simple_anchored_artists.png b/plot_directive/mpl_examples/axes_grid/thumbnails/simple_anchored_artists.png deleted file mode 100644 index dcadd71e84c..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/simple_anchored_artists.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/simple_axesgrid.png b/plot_directive/mpl_examples/axes_grid/thumbnails/simple_axesgrid.png deleted file mode 100644 index 309c0181cb8..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/simple_axesgrid.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/simple_axesgrid2.png b/plot_directive/mpl_examples/axes_grid/thumbnails/simple_axesgrid2.png deleted file mode 100644 index cba3944df7c..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/simple_axesgrid2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/axes_grid/thumbnails/simple_axisline4.png b/plot_directive/mpl_examples/axes_grid/thumbnails/simple_axisline4.png deleted file mode 100644 index 1bc0431eba0..00000000000 Binary files a/plot_directive/mpl_examples/axes_grid/thumbnails/simple_axisline4.png and /dev/null differ diff --git a/plot_directive/mpl_examples/color/thumbnails/color_cycle_default.png b/plot_directive/mpl_examples/color/thumbnails/color_cycle_default.png deleted file mode 100644 index 5c118ff4a3a..00000000000 Binary files a/plot_directive/mpl_examples/color/thumbnails/color_cycle_default.png and /dev/null differ diff --git a/plot_directive/mpl_examples/color/thumbnails/color_cycle_demo.png b/plot_directive/mpl_examples/color/thumbnails/color_cycle_demo.png deleted file mode 100644 index dd3996c852c..00000000000 Binary files a/plot_directive/mpl_examples/color/thumbnails/color_cycle_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/color/thumbnails/colormaps_reference_00.png b/plot_directive/mpl_examples/color/thumbnails/colormaps_reference_00.png deleted file mode 100644 index 0d186e7d474..00000000000 Binary files a/plot_directive/mpl_examples/color/thumbnails/colormaps_reference_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/color/thumbnails/colormaps_reference_01.png b/plot_directive/mpl_examples/color/thumbnails/colormaps_reference_01.png deleted file mode 100644 index 66d32346c73..00000000000 Binary files a/plot_directive/mpl_examples/color/thumbnails/colormaps_reference_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/color/thumbnails/colormaps_reference_02.png b/plot_directive/mpl_examples/color/thumbnails/colormaps_reference_02.png deleted file mode 100644 index 245ebe1b7ac..00000000000 Binary files a/plot_directive/mpl_examples/color/thumbnails/colormaps_reference_02.png and /dev/null differ diff --git a/plot_directive/mpl_examples/color/thumbnails/colormaps_reference_03.png b/plot_directive/mpl_examples/color/thumbnails/colormaps_reference_03.png deleted file mode 100644 index 13df9cc3b18..00000000000 Binary files a/plot_directive/mpl_examples/color/thumbnails/colormaps_reference_03.png and /dev/null differ diff --git a/plot_directive/mpl_examples/color/thumbnails/colormaps_reference_04.png b/plot_directive/mpl_examples/color/thumbnails/colormaps_reference_04.png deleted file mode 100644 index c6fa799a277..00000000000 Binary files a/plot_directive/mpl_examples/color/thumbnails/colormaps_reference_04.png and /dev/null differ diff --git a/plot_directive/mpl_examples/color/thumbnails/colormaps_reference_05.png b/plot_directive/mpl_examples/color/thumbnails/colormaps_reference_05.png deleted file mode 100644 index c9cd447957d..00000000000 Binary files a/plot_directive/mpl_examples/color/thumbnails/colormaps_reference_05.png and /dev/null differ diff --git a/plot_directive/mpl_examples/color/thumbnails/named_colors.png b/plot_directive/mpl_examples/color/thumbnails/named_colors.png deleted file mode 100644 index 153624cbe97..00000000000 Binary files a/plot_directive/mpl_examples/color/thumbnails/named_colors.png and /dev/null differ diff --git a/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/contourf_log.png b/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/contourf_log.png deleted file mode 100644 index 9993ca7a09a..00000000000 Binary files a/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/contourf_log.png and /dev/null differ diff --git a/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/image_demo.png b/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/image_demo.png deleted file mode 100644 index 532758a8704..00000000000 Binary files a/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/image_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/image_demo_clip_path.png b/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/image_demo_clip_path.png deleted file mode 100644 index 536326abfb5..00000000000 Binary files a/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/image_demo_clip_path.png and /dev/null differ diff --git a/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/interpolation_methods.png b/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/interpolation_methods.png deleted file mode 100644 index 2fd93be6d1a..00000000000 Binary files a/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/interpolation_methods.png and /dev/null differ diff --git a/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/interpolation_none_vs_nearest_00.png b/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/interpolation_none_vs_nearest_00.png deleted file mode 100644 index ad77e6957f6..00000000000 Binary files a/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/interpolation_none_vs_nearest_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/interpolation_none_vs_nearest_01.png b/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/interpolation_none_vs_nearest_01.png deleted file mode 100644 index 80bf0c332c3..00000000000 Binary files a/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/interpolation_none_vs_nearest_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/pcolormesh_levels.png b/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/pcolormesh_levels.png deleted file mode 100644 index 9af3ef341ab..00000000000 Binary files a/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/pcolormesh_levels.png and /dev/null differ diff --git a/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/streamplot_demo_features_00.png b/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/streamplot_demo_features_00.png deleted file mode 100644 index a4fba1f28d8..00000000000 Binary files a/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/streamplot_demo_features_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/streamplot_demo_features_01.png b/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/streamplot_demo_features_01.png deleted file mode 100644 index b8a3b196e6e..00000000000 Binary files a/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/streamplot_demo_features_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/streamplot_demo_masking.png b/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/streamplot_demo_masking.png deleted file mode 100644 index b53365febb9..00000000000 Binary files a/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/streamplot_demo_masking.png and /dev/null differ diff --git a/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/streamplot_demo_start_points.png b/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/streamplot_demo_start_points.png deleted file mode 100644 index 9aaa53474d4..00000000000 Binary files a/plot_directive/mpl_examples/images_contours_and_fields/thumbnails/streamplot_demo_start_points.png and /dev/null differ diff --git a/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/barh_demo.png b/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/barh_demo.png deleted file mode 100644 index 04233494a63..00000000000 Binary files a/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/barh_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/fill_demo.png b/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/fill_demo.png deleted file mode 100644 index 999c1c8c235..00000000000 Binary files a/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/fill_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/fill_demo_features.png b/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/fill_demo_features.png deleted file mode 100644 index 95864fd5c1c..00000000000 Binary files a/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/fill_demo_features.png and /dev/null differ diff --git a/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/line_demo_dash_control.png b/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/line_demo_dash_control.png deleted file mode 100644 index 89bdc97764e..00000000000 Binary files a/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/line_demo_dash_control.png and /dev/null differ diff --git a/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/line_styles_reference.png b/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/line_styles_reference.png deleted file mode 100644 index a417d196e6f..00000000000 Binary files a/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/line_styles_reference.png and /dev/null differ diff --git a/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/linestyles.png b/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/linestyles.png deleted file mode 100644 index a9a4e659850..00000000000 Binary files a/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/linestyles.png and /dev/null differ diff --git a/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/marker_fillstyle_reference.png b/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/marker_fillstyle_reference.png deleted file mode 100644 index 900863e2550..00000000000 Binary files a/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/marker_fillstyle_reference.png and /dev/null differ diff --git a/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/marker_reference_00.png b/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/marker_reference_00.png deleted file mode 100644 index b6793390e4f..00000000000 Binary files a/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/marker_reference_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/marker_reference_01.png b/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/marker_reference_01.png deleted file mode 100644 index 1e3a1d57af0..00000000000 Binary files a/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/marker_reference_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/scatter_with_legend.png b/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/scatter_with_legend.png deleted file mode 100644 index ac2a7155a6b..00000000000 Binary files a/plot_directive/mpl_examples/lines_bars_and_markers/thumbnails/scatter_with_legend.png and /dev/null differ diff --git a/plot_directive/mpl_examples/misc/thumbnails/contour_manual_00.png b/plot_directive/mpl_examples/misc/thumbnails/contour_manual_00.png deleted file mode 100644 index 1515f189dc6..00000000000 Binary files a/plot_directive/mpl_examples/misc/thumbnails/contour_manual_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/misc/thumbnails/contour_manual_01.png b/plot_directive/mpl_examples/misc/thumbnails/contour_manual_01.png deleted file mode 100644 index bcb2270d56c..00000000000 Binary files a/plot_directive/mpl_examples/misc/thumbnails/contour_manual_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/misc/thumbnails/rasterization_demo.png b/plot_directive/mpl_examples/misc/thumbnails/rasterization_demo.png deleted file mode 100644 index 10863fa4f69..00000000000 Binary files a/plot_directive/mpl_examples/misc/thumbnails/rasterization_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/misc/thumbnails/sample_data_demo.png b/plot_directive/mpl_examples/misc/thumbnails/sample_data_demo.png deleted file mode 100644 index 9ad25515b03..00000000000 Binary files a/plot_directive/mpl_examples/misc/thumbnails/sample_data_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/misc/thumbnails/svg_filter_line.png b/plot_directive/mpl_examples/misc/thumbnails/svg_filter_line.png deleted file mode 100644 index f5571479ae6..00000000000 Binary files a/plot_directive/mpl_examples/misc/thumbnails/svg_filter_line.png and /dev/null differ diff --git a/plot_directive/mpl_examples/misc/thumbnails/svg_filter_pie.png b/plot_directive/mpl_examples/misc/thumbnails/svg_filter_pie.png deleted file mode 100644 index 05cd763629a..00000000000 Binary files a/plot_directive/mpl_examples/misc/thumbnails/svg_filter_pie.png and /dev/null differ diff --git a/plot_directive/mpl_examples/misc/thumbnails/tight_bbox_test.png b/plot_directive/mpl_examples/misc/thumbnails/tight_bbox_test.png deleted file mode 100644 index 9bba27b236b..00000000000 Binary files a/plot_directive/mpl_examples/misc/thumbnails/tight_bbox_test.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/2dcollections3d_demo.png b/plot_directive/mpl_examples/mplot3d/thumbnails/2dcollections3d_demo.png deleted file mode 100644 index 95eeee50885..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/2dcollections3d_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/bars3d_demo.png b/plot_directive/mpl_examples/mplot3d/thumbnails/bars3d_demo.png deleted file mode 100644 index ad188c6d001..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/bars3d_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/contour3d_demo.png b/plot_directive/mpl_examples/mplot3d/thumbnails/contour3d_demo.png deleted file mode 100644 index 69a1acc04a7..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/contour3d_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/contour3d_demo2.png b/plot_directive/mpl_examples/mplot3d/thumbnails/contour3d_demo2.png deleted file mode 100644 index cf131b01ba1..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/contour3d_demo2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/contour3d_demo3.png b/plot_directive/mpl_examples/mplot3d/thumbnails/contour3d_demo3.png deleted file mode 100644 index d06c27cec84..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/contour3d_demo3.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/contourf3d_demo.png b/plot_directive/mpl_examples/mplot3d/thumbnails/contourf3d_demo.png deleted file mode 100644 index 8c50ea6f0ec..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/contourf3d_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/contourf3d_demo2.png b/plot_directive/mpl_examples/mplot3d/thumbnails/contourf3d_demo2.png deleted file mode 100644 index 95d5e40a119..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/contourf3d_demo2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/custom_shaded_3d_surface.png b/plot_directive/mpl_examples/mplot3d/thumbnails/custom_shaded_3d_surface.png deleted file mode 100644 index 9645a43185d..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/custom_shaded_3d_surface.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/hist3d_demo.png b/plot_directive/mpl_examples/mplot3d/thumbnails/hist3d_demo.png deleted file mode 100644 index 22b2636fefc..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/hist3d_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/lines3d_demo.png b/plot_directive/mpl_examples/mplot3d/thumbnails/lines3d_demo.png deleted file mode 100644 index 3781ae1ae39..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/lines3d_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/lorenz_attractor.png b/plot_directive/mpl_examples/mplot3d/thumbnails/lorenz_attractor.png deleted file mode 100644 index 4e841763a40..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/lorenz_attractor.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/mixed_subplots_demo.png b/plot_directive/mpl_examples/mplot3d/thumbnails/mixed_subplots_demo.png deleted file mode 100644 index 5e21a939422..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/mixed_subplots_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/offset_demo.png b/plot_directive/mpl_examples/mplot3d/thumbnails/offset_demo.png deleted file mode 100644 index 51099e14801..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/offset_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/pathpatch3d_demo.png b/plot_directive/mpl_examples/mplot3d/thumbnails/pathpatch3d_demo.png deleted file mode 100644 index 144753ae95f..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/pathpatch3d_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/polys3d_demo.png b/plot_directive/mpl_examples/mplot3d/thumbnails/polys3d_demo.png deleted file mode 100644 index 2fe9598400a..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/polys3d_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/quiver3d_demo.png b/plot_directive/mpl_examples/mplot3d/thumbnails/quiver3d_demo.png deleted file mode 100644 index c83641f1e33..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/quiver3d_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/rotate_axes3d_demo.png b/plot_directive/mpl_examples/mplot3d/thumbnails/rotate_axes3d_demo.png deleted file mode 100644 index 9ee2c401384..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/rotate_axes3d_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/scatter3d_demo.png b/plot_directive/mpl_examples/mplot3d/thumbnails/scatter3d_demo.png deleted file mode 100644 index 8692acc62a4..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/scatter3d_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/subplot3d_demo.png b/plot_directive/mpl_examples/mplot3d/thumbnails/subplot3d_demo.png deleted file mode 100644 index cc9a2acbd01..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/subplot3d_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/surface3d_demo.png b/plot_directive/mpl_examples/mplot3d/thumbnails/surface3d_demo.png deleted file mode 100644 index 99a10ebb36f..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/surface3d_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/surface3d_demo2.png b/plot_directive/mpl_examples/mplot3d/thumbnails/surface3d_demo2.png deleted file mode 100644 index 0cceaf5496d..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/surface3d_demo2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/surface3d_demo3.png b/plot_directive/mpl_examples/mplot3d/thumbnails/surface3d_demo3.png deleted file mode 100644 index 8b0cc192d92..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/surface3d_demo3.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/surface3d_radial_demo.png b/plot_directive/mpl_examples/mplot3d/thumbnails/surface3d_radial_demo.png deleted file mode 100644 index b9220dfcd88..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/surface3d_radial_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/text3d_demo.png b/plot_directive/mpl_examples/mplot3d/thumbnails/text3d_demo.png deleted file mode 100644 index c8d8e766d70..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/text3d_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/tricontour3d_demo.png b/plot_directive/mpl_examples/mplot3d/thumbnails/tricontour3d_demo.png deleted file mode 100644 index 1fe50bacace..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/tricontour3d_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/tricontourf3d_demo.png b/plot_directive/mpl_examples/mplot3d/thumbnails/tricontourf3d_demo.png deleted file mode 100644 index 9d61c85f494..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/tricontourf3d_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/trisurf3d_demo.png b/plot_directive/mpl_examples/mplot3d/thumbnails/trisurf3d_demo.png deleted file mode 100644 index c31ce272501..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/trisurf3d_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/trisurf3d_demo2.png b/plot_directive/mpl_examples/mplot3d/thumbnails/trisurf3d_demo2.png deleted file mode 100644 index 8c4035fc900..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/trisurf3d_demo2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/trisurf3d_demo2_00.png b/plot_directive/mpl_examples/mplot3d/thumbnails/trisurf3d_demo2_00.png deleted file mode 100644 index 2e6542bff89..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/trisurf3d_demo2_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/trisurf3d_demo2_01.png b/plot_directive/mpl_examples/mplot3d/thumbnails/trisurf3d_demo2_01.png deleted file mode 100644 index e35c746ef45..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/trisurf3d_demo2_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/wire3d_animation_demo.png b/plot_directive/mpl_examples/mplot3d/thumbnails/wire3d_animation_demo.png deleted file mode 100644 index c4c1a53dc49..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/wire3d_animation_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/wire3d_demo.png b/plot_directive/mpl_examples/mplot3d/thumbnails/wire3d_demo.png deleted file mode 100644 index ac7144e9603..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/wire3d_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/mplot3d/thumbnails/wire3d_zero_stride.png b/plot_directive/mpl_examples/mplot3d/thumbnails/wire3d_zero_stride.png deleted file mode 100644 index 1a29c5b66b4..00000000000 Binary files a/plot_directive/mpl_examples/mplot3d/thumbnails/wire3d_zero_stride.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pie_and_polar_charts/thumbnails/pie_demo_features.png b/plot_directive/mpl_examples/pie_and_polar_charts/thumbnails/pie_demo_features.png deleted file mode 100644 index 03d5f017c0b..00000000000 Binary files a/plot_directive/mpl_examples/pie_and_polar_charts/thumbnails/pie_demo_features.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pie_and_polar_charts/thumbnails/pie_demo_features_00.png b/plot_directive/mpl_examples/pie_and_polar_charts/thumbnails/pie_demo_features_00.png deleted file mode 100644 index e429c3bf415..00000000000 Binary files a/plot_directive/mpl_examples/pie_and_polar_charts/thumbnails/pie_demo_features_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pie_and_polar_charts/thumbnails/pie_demo_features_01.png b/plot_directive/mpl_examples/pie_and_polar_charts/thumbnails/pie_demo_features_01.png deleted file mode 100644 index e85ab3c13e2..00000000000 Binary files a/plot_directive/mpl_examples/pie_and_polar_charts/thumbnails/pie_demo_features_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pie_and_polar_charts/thumbnails/polar_bar_demo.png b/plot_directive/mpl_examples/pie_and_polar_charts/thumbnails/polar_bar_demo.png deleted file mode 100644 index 06adcd3c8ef..00000000000 Binary files a/plot_directive/mpl_examples/pie_and_polar_charts/thumbnails/polar_bar_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pie_and_polar_charts/thumbnails/polar_scatter_demo.png b/plot_directive/mpl_examples/pie_and_polar_charts/thumbnails/polar_scatter_demo.png deleted file mode 100644 index 8d082c2399e..00000000000 Binary files a/plot_directive/mpl_examples/pie_and_polar_charts/thumbnails/polar_scatter_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/accented_text.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/accented_text.png deleted file mode 100644 index fa4836245d4..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/accented_text.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/agg_buffer.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/agg_buffer.png deleted file mode 100644 index 482a394de6d..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/agg_buffer.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/agg_buffer_to_array_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/agg_buffer_to_array_00.png deleted file mode 100644 index 5d07c34cdc1..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/agg_buffer_to_array_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/agg_buffer_to_array_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/agg_buffer_to_array_01.png deleted file mode 100644 index ff569a8b91e..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/agg_buffer_to_array_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/alignment_test.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/alignment_test.png deleted file mode 100644 index 9d7d292ff43..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/alignment_test.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/anchored_artists.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/anchored_artists.png deleted file mode 100644 index 227f5491362..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/anchored_artists.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/animation_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/animation_demo.png deleted file mode 100644 index 88ed3a4cf62..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/animation_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/annotation_demo2_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/annotation_demo2_00.png deleted file mode 100644 index e1f064829ba..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/annotation_demo2_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/annotation_demo2_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/annotation_demo2_01.png deleted file mode 100644 index 5e412baddcd..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/annotation_demo2_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/annotation_demo3.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/annotation_demo3.png deleted file mode 100644 index a9a82d55690..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/annotation_demo3.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/annotation_demo_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/annotation_demo_00.png deleted file mode 100644 index be0239db4dd..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/annotation_demo_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/annotation_demo_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/annotation_demo_01.png deleted file mode 100644 index 6e76785cf11..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/annotation_demo_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/annotation_demo_02.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/annotation_demo_02.png deleted file mode 100644 index 38f1a51df7b..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/annotation_demo_02.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/anscombe.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/anscombe.png deleted file mode 100644 index d859cc1c49c..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/anscombe.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/arctest.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/arctest.png deleted file mode 100644 index 9ab5b741ee3..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/arctest.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/arrow_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/arrow_demo.png deleted file mode 100644 index 5b9a3047ce9..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/arrow_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/arrow_simple_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/arrow_simple_demo.png deleted file mode 100644 index 795fc0d8997..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/arrow_simple_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/aspect_loglog.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/aspect_loglog.png deleted file mode 100644 index 4fb35b1c1fb..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/aspect_loglog.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/axes_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/axes_demo.png deleted file mode 100644 index 1f668f142d7..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/axes_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/axes_props.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/axes_props.png deleted file mode 100644 index 3b3c68589ba..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/axes_props.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/axes_zoom_effect.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/axes_zoom_effect.png deleted file mode 100644 index c2825c702d9..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/axes_zoom_effect.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/axhspan_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/axhspan_demo.png deleted file mode 100644 index 8afca8a6da2..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/axhspan_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/axis_equal_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/axis_equal_demo.png deleted file mode 100644 index db35142f005..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/axis_equal_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/bar_stacked.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/bar_stacked.png deleted file mode 100644 index 8c746fabf6c..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/bar_stacked.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/barb_demo_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/barb_demo_00.png deleted file mode 100644 index d7365394d03..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/barb_demo_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/barb_demo_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/barb_demo_01.png deleted file mode 100644 index b29e28ead28..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/barb_demo_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/barchart_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/barchart_demo.png deleted file mode 100644 index c1394b6c90a..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/barchart_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/barchart_demo2.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/barchart_demo2.png deleted file mode 100644 index 128f9405e6b..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/barchart_demo2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/barcode_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/barcode_demo.png deleted file mode 100644 index d07b168efa6..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/barcode_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo2.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo2.png deleted file mode 100644 index 094f106b779..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo3.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo3.png deleted file mode 100644 index aa4791b39a9..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo3.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_00.png deleted file mode 100644 index 131e076bd38..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_01.png deleted file mode 100644 index d02eafc0774..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_02.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_02.png deleted file mode 100644 index b1d152e56ec..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_02.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_03.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_03.png deleted file mode 100644 index f75a6aec7f1..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_03.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_04.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_04.png deleted file mode 100644 index 9abf69eeaeb..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_04.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_05.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_05.png deleted file mode 100644 index 291ba53acf2..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_05.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_06.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_06.png deleted file mode 100644 index 57e6dd226ef..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_06.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/break.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/break.png deleted file mode 100644 index 69291e6efe4..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/break.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/broken_axis.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/broken_axis.png deleted file mode 100644 index 25e7605751e..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/broken_axis.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/broken_barh.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/broken_barh.png deleted file mode 100644 index 9a54b9d75c4..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/broken_barh.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/centered_ticklabels.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/centered_ticklabels.png deleted file mode 100644 index ef708b7f7ad..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/centered_ticklabels.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/cohere_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/cohere_demo.png deleted file mode 100644 index 93e0f373726..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/cohere_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/color_by_yvalue.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/color_by_yvalue.png deleted file mode 100644 index 6f33eabf796..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/color_by_yvalue.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/color_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/color_demo.png deleted file mode 100644 index a82a0b17c0b..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/color_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/colorbar_tick_labelling_demo_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/colorbar_tick_labelling_demo_00.png deleted file mode 100644 index ddb8a873a40..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/colorbar_tick_labelling_demo_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/colorbar_tick_labelling_demo_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/colorbar_tick_labelling_demo_01.png deleted file mode 100644 index 5d0b597844a..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/colorbar_tick_labelling_demo_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_corner_mask.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_corner_mask.png deleted file mode 100644 index 12b6f86eeb5..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_corner_mask.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_00.png deleted file mode 100644 index 9e1af19ebd1..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_01.png deleted file mode 100644 index cefe6aa9d66..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_02.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_02.png deleted file mode 100644 index 1f5327e1005..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_02.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_03.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_03.png deleted file mode 100644 index 2fe39fc3e2b..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_03.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_04.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_04.png deleted file mode 100644 index 102f16a85eb..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_04.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_05.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_05.png deleted file mode 100644 index 017f0db90d1..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_05.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_image.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_image.png deleted file mode 100644 index b5eabd8c559..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_image.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_label_demo_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_label_demo_00.png deleted file mode 100644 index d9a98ae95d4..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_label_demo_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_label_demo_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_label_demo_01.png deleted file mode 100644 index bf05b7f0da5..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_label_demo_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_label_demo_02.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_label_demo_02.png deleted file mode 100644 index 8a5e0b6ab47..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_label_demo_02.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/contourf_demo_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/contourf_demo_00.png deleted file mode 100644 index 88bc0f76d0e..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/contourf_demo_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/contourf_demo_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/contourf_demo_01.png deleted file mode 100644 index 6eef9c73c93..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/contourf_demo_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/contourf_demo_02.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/contourf_demo_02.png deleted file mode 100644 index 2d1a3585805..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/contourf_demo_02.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/contourf_hatching_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/contourf_hatching_00.png deleted file mode 100644 index e5863b8f09a..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/contourf_hatching_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/contourf_hatching_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/contourf_hatching_01.png deleted file mode 100644 index 5421209c37f..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/contourf_hatching_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/coords_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/coords_demo.png deleted file mode 100644 index 91f08d298e9..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/coords_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/coords_report.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/coords_report.png deleted file mode 100644 index 1c6b4e2c67a..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/coords_report.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/csd_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/csd_demo.png deleted file mode 100644 index 0d53d0432d4..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/csd_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/custom_cmap.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/custom_cmap.png deleted file mode 100644 index b7adc254c73..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/custom_cmap.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/custom_cmap_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/custom_cmap_00.png deleted file mode 100644 index 35bcfe176ae..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/custom_cmap_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/custom_cmap_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/custom_cmap_01.png deleted file mode 100644 index 5f889c77883..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/custom_cmap_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/custom_figure_class.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/custom_figure_class.png deleted file mode 100644 index d3b44fc7637..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/custom_figure_class.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/custom_ticker1.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/custom_ticker1.png deleted file mode 100644 index 8c17c0de0cf..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/custom_ticker1.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/customize_rc.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/customize_rc.png deleted file mode 100644 index ce62b6aa50f..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/customize_rc.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/dashpointlabel.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/dashpointlabel.png deleted file mode 100644 index ce8428fcc54..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/dashpointlabel.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/date_demo1.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/date_demo1.png deleted file mode 100644 index d5f5927baf6..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/date_demo1.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/date_demo2.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/date_demo2.png deleted file mode 100644 index 5315937bf50..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/date_demo2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/date_demo_convert.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/date_demo_convert.png deleted file mode 100644 index a8081f51847..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/date_demo_convert.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/date_demo_rrule.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/date_demo_rrule.png deleted file mode 100644 index 9e2e8154c64..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/date_demo_rrule.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/date_index_formatter.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/date_index_formatter.png deleted file mode 100644 index 7aa844cc296..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/date_index_formatter.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_agg_filter.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_agg_filter.png deleted file mode 100644 index 402591da5db..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_agg_filter.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_annotation_box.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_annotation_box.png deleted file mode 100644 index 18249388880..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_annotation_box.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_bboximage.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_bboximage.png deleted file mode 100644 index 8bab52b3faa..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_bboximage.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_ribbon_box.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_ribbon_box.png deleted file mode 100644 index c34bfd11577..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_ribbon_box.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_text_path.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_text_path.png deleted file mode 100644 index 9515140047a..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_text_path.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_text_rotation_mode.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_text_rotation_mode.png deleted file mode 100644 index 4a0505d8fa6..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_text_rotation_mode.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_tight_layout_00_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_tight_layout_00_00.png deleted file mode 100644 index 562cd8e31cf..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_tight_layout_00_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_tight_layout_00_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_tight_layout_00_01.png deleted file mode 100644 index 528cfa75cbe..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_tight_layout_00_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_tight_layout_00_02.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_tight_layout_00_02.png deleted file mode 100644 index a3e50159c6e..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_tight_layout_00_02.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_tight_layout_00_03.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_tight_layout_00_03.png deleted file mode 100644 index 060b0bb2a85..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_tight_layout_00_03.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_tight_layout_00_04.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_tight_layout_00_04.png deleted file mode 100644 index 3b6b489cc25..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_tight_layout_00_04.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_tight_layout_00_05.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_tight_layout_00_05.png deleted file mode 100644 index c8282079498..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_tight_layout_00_05.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_tight_layout_00_06.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_tight_layout_00_06.png deleted file mode 100644 index fd2320cf6a8..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_tight_layout_00_06.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_tight_layout_01_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_tight_layout_01_00.png deleted file mode 100644 index 67947d613a2..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/demo_tight_layout_01_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/dolphin.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/dolphin.png deleted file mode 100644 index 6166e5d2a7f..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/dolphin.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/ellipse_collection.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/ellipse_collection.png deleted file mode 100644 index 547685133e2..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/ellipse_collection.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/ellipse_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/ellipse_demo.png deleted file mode 100644 index c2869d7ca73..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/ellipse_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/ellipse_rotated.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/ellipse_rotated.png deleted file mode 100644 index 16d7c13b7b3..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/ellipse_rotated.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/equal_aspect_ratio.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/equal_aspect_ratio.png deleted file mode 100644 index 37451351e3c..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/equal_aspect_ratio.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/errorbar_limits_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/errorbar_limits_00.png deleted file mode 100644 index f12232d1ca9..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/errorbar_limits_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/errorbar_limits_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/errorbar_limits_01.png deleted file mode 100644 index 40d866079c7..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/errorbar_limits_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/errorbar_subsample.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/errorbar_subsample.png deleted file mode 100644 index 45d1b2ee650..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/errorbar_subsample.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/eventcollection_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/eventcollection_demo.png deleted file mode 100644 index 3ca83074d27..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/eventcollection_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/eventplot_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/eventplot_demo.png deleted file mode 100644 index c130e67fc0e..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/eventplot_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/fancyarrow_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/fancyarrow_demo.png deleted file mode 100644 index 4d2f158da5f..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/fancyarrow_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/fancybox_demo2.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/fancybox_demo2.png deleted file mode 100644 index 4a667da4a9a..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/fancybox_demo2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/fancybox_demo_01_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/fancybox_demo_01_00.png deleted file mode 100644 index a4340e074f0..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/fancybox_demo_01_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/fancytextbox_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/fancytextbox_demo.png deleted file mode 100644 index 25d40fd1732..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/fancytextbox_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/figimage_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/figimage_demo.png deleted file mode 100644 index 21899a46f94..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/figimage_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/figlegend_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/figlegend_demo.png deleted file mode 100644 index df73543f09a..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/figlegend_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/figure_title.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/figure_title.png deleted file mode 100644 index b7f0f51595e..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/figure_title.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_between_demo_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_between_demo_00.png deleted file mode 100644 index bfc63d6c40c..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_between_demo_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_between_demo_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_between_demo_01.png deleted file mode 100644 index dccfbe33791..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_between_demo_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_between_demo_02.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_between_demo_02.png deleted file mode 100644 index eef0d797121..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_between_demo_02.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_betweenx_demo_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_betweenx_demo_00.png deleted file mode 100644 index e940dbd582f..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_betweenx_demo_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_betweenx_demo_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_betweenx_demo_01.png deleted file mode 100644 index a29d2232867..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_betweenx_demo_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_spiral.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_spiral.png deleted file mode 100644 index 90a4dff5b5e..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_spiral.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/finance_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/finance_demo.png deleted file mode 100644 index 2fcb5222619..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/finance_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/finance_work2.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/finance_work2.png deleted file mode 100644 index 1985aa67a10..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/finance_work2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/findobj_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/findobj_demo.png deleted file mode 100644 index 820c24c8f61..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/findobj_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/fonts_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/fonts_demo.png deleted file mode 100644 index 72628572ca0..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/fonts_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/fonts_demo_kw.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/fonts_demo_kw.png deleted file mode 100644 index 41c72d1cb8d..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/fonts_demo_kw.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/ganged_plots.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/ganged_plots.png deleted file mode 100644 index 423991f57f4..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/ganged_plots.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/geo_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/geo_demo.png deleted file mode 100644 index 8933857dd12..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/geo_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/geo_demo_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/geo_demo_00.png deleted file mode 100644 index e520118288e..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/geo_demo_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/geo_demo_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/geo_demo_01.png deleted file mode 100644 index fb343e071d1..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/geo_demo_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/geo_demo_02.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/geo_demo_02.png deleted file mode 100644 index 0e75a3226c2..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/geo_demo_02.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/geo_demo_03.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/geo_demo_03.png deleted file mode 100644 index 3cc49980614..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/geo_demo_03.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/gradient_bar.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/gradient_bar.png deleted file mode 100644 index c78cbfaaadb..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/gradient_bar.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/griddata_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/griddata_demo.png deleted file mode 100644 index 3f09f4fd4e5..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/griddata_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/hatch_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/hatch_demo.png deleted file mode 100644 index 9b716179e5d..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/hatch_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/hexbin_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/hexbin_demo.png deleted file mode 100644 index 73c1875fc85..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/hexbin_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/hexbin_demo2.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/hexbin_demo2.png deleted file mode 100644 index 5804d931777..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/hexbin_demo2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/hist2d_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/hist2d_demo.png deleted file mode 100644 index 382a2f57e85..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/hist2d_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/hist2d_log_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/hist2d_log_demo.png deleted file mode 100644 index d7cb0e3d171..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/hist2d_log_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/hist_colormapped.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/hist_colormapped.png deleted file mode 100644 index dea5971e7a1..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/hist_colormapped.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/histogram_percent_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/histogram_percent_demo.png deleted file mode 100644 index c5e34519a71..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/histogram_percent_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/image_clip_path.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/image_clip_path.png deleted file mode 100644 index c0a7d1dc4b0..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/image_clip_path.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/image_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/image_demo.png deleted file mode 100644 index e210846f4a7..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/image_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/image_demo2.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/image_demo2.png deleted file mode 100644 index 16a14ad0c34..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/image_demo2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/image_interp_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/image_interp_00.png deleted file mode 100644 index ec3f5d990bb..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/image_interp_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/image_interp_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/image_interp_01.png deleted file mode 100644 index 048301d769e..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/image_interp_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/image_interp_02.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/image_interp_02.png deleted file mode 100644 index 592581363f0..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/image_interp_02.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/image_masked.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/image_masked.png deleted file mode 100644 index 3cfab85b037..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/image_masked.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/image_nonuniform.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/image_nonuniform.png deleted file mode 100644 index 0b995f0235e..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/image_nonuniform.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/image_origin.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/image_origin.png deleted file mode 100644 index 5580a59fe9f..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/image_origin.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/image_slices_viewer.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/image_slices_viewer.png deleted file mode 100644 index 45eea193d3e..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/image_slices_viewer.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/interp_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/interp_demo.png deleted file mode 100644 index e8d2b975769..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/interp_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/invert_axes.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/invert_axes.png deleted file mode 100644 index 050aab9aa1d..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/invert_axes.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/layer_images.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/layer_images.png deleted file mode 100644 index fd7532a3eea..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/layer_images.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/leftventricle_bulleye.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/leftventricle_bulleye.png deleted file mode 100644 index 69e23a339ab..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/leftventricle_bulleye.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_demo2.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_demo2.png deleted file mode 100644 index 5a5380aa2dd..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_demo2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_demo3.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_demo3.png deleted file mode 100644 index cff18d0d8eb..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_demo3.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_demo4.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_demo4.png deleted file mode 100644 index b24f14cb57e..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_demo4.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_demo5.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_demo5.png deleted file mode 100644 index f625698d55c..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_demo5.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/line_collection.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/line_collection.png deleted file mode 100644 index 0c87f8a2ba7..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/line_collection.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/line_collection2.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/line_collection2.png deleted file mode 100644 index a12889953c2..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/line_collection2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/load_converter.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/load_converter.png deleted file mode 100644 index b39049880ae..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/load_converter.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/loadrec.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/loadrec.png deleted file mode 100644 index ae16f8d0220..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/loadrec.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/log_bar.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/log_bar.png deleted file mode 100644 index e6a92572008..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/log_bar.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/log_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/log_demo.png deleted file mode 100644 index 2b6fc616f71..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/log_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/log_test.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/log_test.png deleted file mode 100644 index 08a66d74900..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/log_test.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/logo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/logo.png deleted file mode 100644 index 1e610174f97..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/logo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/major_minor_demo1.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/major_minor_demo1.png deleted file mode 100644 index 95795a470de..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/major_minor_demo1.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/major_minor_demo2.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/major_minor_demo2.png deleted file mode 100644 index 4f9a580f45a..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/major_minor_demo2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/manual_axis.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/manual_axis.png deleted file mode 100644 index 01111ec5ae5..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/manual_axis.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/marker_path.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/marker_path.png deleted file mode 100644 index aea07138c5e..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/marker_path.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/markevery_demo_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/markevery_demo_00.png deleted file mode 100644 index d6d1355fef7..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/markevery_demo_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/markevery_demo_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/markevery_demo_01.png deleted file mode 100644 index 7d633c5baad..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/markevery_demo_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/markevery_demo_02.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/markevery_demo_02.png deleted file mode 100644 index 782469dc520..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/markevery_demo_02.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/markevery_demo_03.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/markevery_demo_03.png deleted file mode 100644 index 55f0a4ecba3..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/markevery_demo_03.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/masked_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/masked_demo.png deleted file mode 100644 index 237e978bc01..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/masked_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/mathtext_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/mathtext_demo.png deleted file mode 100644 index 4b6639576f8..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/mathtext_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/mathtext_examples_01_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/mathtext_examples_01_00.png deleted file mode 100644 index e14f8d16b7b..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/mathtext_examples_01_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/matshow.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/matshow.png deleted file mode 100644 index da107575208..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/matshow.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/matshow_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/matshow_00.png deleted file mode 100644 index 250a94f2712..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/matshow_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/matshow_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/matshow_01.png deleted file mode 100644 index da107575208..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/matshow_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/mri_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/mri_demo.png deleted file mode 100644 index 622a18074ec..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/mri_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/mri_with_eeg.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/mri_with_eeg.png deleted file mode 100644 index 852b75075e9..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/mri_with_eeg.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/multi_image.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/multi_image.png deleted file mode 100644 index 96291e791a3..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/multi_image.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/multicolored_line_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/multicolored_line_00.png deleted file mode 100644 index 8733720da58..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/multicolored_line_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/multicolored_line_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/multicolored_line_01.png deleted file mode 100644 index ab5afce318b..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/multicolored_line_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/multiline.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/multiline.png deleted file mode 100644 index 0afdd6d46f1..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/multiline.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/multiple_figs_demo_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/multiple_figs_demo_00.png deleted file mode 100644 index fcd2e1b7fc0..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/multiple_figs_demo_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/multiple_figs_demo_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/multiple_figs_demo_01.png deleted file mode 100644 index c7a650afbf2..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/multiple_figs_demo_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/multiple_yaxis_with_spines.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/multiple_yaxis_with_spines.png deleted file mode 100644 index 830868105c2..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/multiple_yaxis_with_spines.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/nan_test.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/nan_test.png deleted file mode 100644 index 94e99ca9b0e..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/nan_test.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/newscalarformatter_demo_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/newscalarformatter_demo_00.png deleted file mode 100644 index cfc4a04c454..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/newscalarformatter_demo_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/newscalarformatter_demo_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/newscalarformatter_demo_01.png deleted file mode 100644 index 59c7458e24f..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/newscalarformatter_demo_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/newscalarformatter_demo_02.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/newscalarformatter_demo_02.png deleted file mode 100644 index b3a64c4382e..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/newscalarformatter_demo_02.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/newscalarformatter_demo_03.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/newscalarformatter_demo_03.png deleted file mode 100644 index 680a68da2fd..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/newscalarformatter_demo_03.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/patheffect_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/patheffect_demo.png deleted file mode 100644 index f8917a158b0..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/patheffect_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/pcolor_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/pcolor_demo.png deleted file mode 100644 index ab5f0613408..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/pcolor_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/pcolor_log.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/pcolor_log.png deleted file mode 100644 index 52363681f36..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/pcolor_log.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/pcolor_small.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/pcolor_small.png deleted file mode 100644 index bd86ab4fda9..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/pcolor_small.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/pie_demo2.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/pie_demo2.png deleted file mode 100644 index 1af98f51041..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/pie_demo2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_00.png deleted file mode 100644 index 5dd735d9a66..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_01.png deleted file mode 100644 index 5dd735d9a66..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_02.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_02.png deleted file mode 100644 index 5c6cb745fa7..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_02.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_03.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_03.png deleted file mode 100644 index 5c6cb745fa7..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_03.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_04.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_04.png deleted file mode 100644 index ed05a3638f1..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_04.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_05.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_05.png deleted file mode 100644 index ae17498a41c..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_05.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_06.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_06.png deleted file mode 100644 index 21d7d1c179c..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_06.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_07.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_07.png deleted file mode 100644 index de9d5ef0b6a..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_07.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/polar_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/polar_demo.png deleted file mode 100644 index e07d41ea0ac..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/polar_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/polar_legend.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/polar_legend.png deleted file mode 100644 index 2cda5d1ecce..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/polar_legend.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/psd_demo2.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/psd_demo2.png deleted file mode 100644 index 96e3069de16..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/psd_demo2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/psd_demo3.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/psd_demo3.png deleted file mode 100644 index 92a7f4f6068..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/psd_demo3.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/psd_demo_00_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/psd_demo_00_00.png deleted file mode 100644 index 30a66192fcd..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/psd_demo_00_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/psd_demo_complex.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/psd_demo_complex.png deleted file mode 100644 index 751cc1c67cc..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/psd_demo_complex.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/pythonic_matplotlib.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/pythonic_matplotlib.png deleted file mode 100644 index 797a1e8ed87..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/pythonic_matplotlib.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/quadmesh_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/quadmesh_demo.png deleted file mode 100644 index 3f18c023ac9..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/quadmesh_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_demo_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_demo_00.png deleted file mode 100644 index cd0958c027f..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_demo_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_demo_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_demo_01.png deleted file mode 100644 index c1505241003..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_demo_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_demo_02.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_demo_02.png deleted file mode 100644 index 26d0bf33206..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_demo_02.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_demo_03.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_demo_03.png deleted file mode 100644 index 1d114b066b2..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_demo_03.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_demo_04.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_demo_04.png deleted file mode 100644 index aa9315b6d45..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_demo_04.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_demo_05.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_demo_05.png deleted file mode 100644 index 537ee5842bd..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_demo_05.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_simple_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_simple_demo.png deleted file mode 100644 index cefcd7fa17d..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_simple_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_custom_symbol.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_custom_symbol.png deleted file mode 100644 index 3562f239dff..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_custom_symbol.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_demo2.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_demo2.png deleted file mode 100644 index bfacfe14ffd..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_demo2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_hist.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_hist.png deleted file mode 100644 index 504f29f0fe8..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_hist.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_masked.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_masked.png deleted file mode 100644 index 8039dd021b7..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_masked.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_profile.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_profile.png deleted file mode 100644 index e23f1447e4f..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_profile.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_star_poly.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_star_poly.png deleted file mode 100644 index 3e13aab7a96..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_star_poly.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_symbol.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_symbol.png deleted file mode 100644 index e9c7f26a619..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_symbol.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/set_and_get.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/set_and_get.png deleted file mode 100644 index f9e2393215e..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/set_and_get.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/shading_example_01_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/shading_example_01_00.png deleted file mode 100644 index 723c58d8c33..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/shading_example_01_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/shading_example_01_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/shading_example_01_01.png deleted file mode 100644 index 935624cd1d3..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/shading_example_01_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/shared_axis_across_figures_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/shared_axis_across_figures_00.png deleted file mode 100644 index b5bef9355b9..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/shared_axis_across_figures_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/shared_axis_across_figures_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/shared_axis_across_figures_01.png deleted file mode 100644 index addfff77398..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/shared_axis_across_figures_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/shared_axis_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/shared_axis_demo.png deleted file mode 100644 index 1970fda7d3d..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/shared_axis_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/simple_plot.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/simple_plot.png deleted file mode 100644 index 1b8649d5112..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/simple_plot.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/simple_plot_fps.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/simple_plot_fps.png deleted file mode 100644 index 964614e54ae..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/simple_plot_fps.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/specgram_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/specgram_demo.png deleted file mode 100644 index 08646475302..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/specgram_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/spectrum_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/spectrum_demo.png deleted file mode 100644 index fa73d4fbb35..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/spectrum_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/spine_placement_demo_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/spine_placement_demo_00.png deleted file mode 100644 index 31709d68966..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/spine_placement_demo_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/spine_placement_demo_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/spine_placement_demo_01.png deleted file mode 100644 index 5d1129b8269..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/spine_placement_demo_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/spy_demos.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/spy_demos.png deleted file mode 100644 index 47793c438cb..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/spy_demos.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/stackplot_demo2.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/stackplot_demo2.png deleted file mode 100644 index dbbcb89cb81..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/stackplot_demo2.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/stackplot_demo_00_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/stackplot_demo_00_00.png deleted file mode 100644 index 7fd1968070f..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/stackplot_demo_00_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/stackplot_demo_01_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/stackplot_demo_01_00.png deleted file mode 100644 index 2f327e1d58a..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/stackplot_demo_01_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/stem_plot.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/stem_plot.png deleted file mode 100644 index 62c3d3d11a6..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/stem_plot.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/step_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/step_demo.png deleted file mode 100644 index b2ec25ce550..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/step_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/stix_fonts_demo_01_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/stix_fonts_demo_01_00.png deleted file mode 100644 index 8fa8d61369d..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/stix_fonts_demo_01_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/stock_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/stock_demo.png deleted file mode 100644 index 1ce23df3ad5..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/stock_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/subplot_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/subplot_demo.png deleted file mode 100644 index ea8ae45972c..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/subplot_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/subplot_toolbar_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/subplot_toolbar_00.png deleted file mode 100644 index cd101c7fc9f..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/subplot_toolbar_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/subplot_toolbar_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/subplot_toolbar_01.png deleted file mode 100644 index 2a9037ee5d2..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/subplot_toolbar_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_adjust.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_adjust.png deleted file mode 100644 index 65dd7e3e88c..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_adjust.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_demo_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_demo_00.png deleted file mode 100644 index 9dc650e5fc9..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_demo_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_demo_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_demo_01.png deleted file mode 100644 index 25e19705539..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_demo_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_demo_02.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_demo_02.png deleted file mode 100644 index 1ecfb13f83c..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_demo_02.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_demo_03.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_demo_03.png deleted file mode 100644 index fc6b13458bb..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_demo_03.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_demo_04.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_demo_04.png deleted file mode 100644 index d536e932eb4..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_demo_04.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_demo_05.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_demo_05.png deleted file mode 100644 index 35d9e4d9863..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_demo_05.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_demo_06.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_demo_06.png deleted file mode 100644 index 36b39d1ce93..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_demo_06.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/symlog_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/symlog_demo.png deleted file mode 100644 index d7fc701b331..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/symlog_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/system_monitor.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/system_monitor.png deleted file mode 100644 index e12ab32a09f..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/system_monitor.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/table_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/table_demo.png deleted file mode 100644 index 9a128440d42..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/table_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/tex_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/tex_demo.png deleted file mode 100644 index 860f3e5d65f..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/tex_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/tex_unicode_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/tex_unicode_demo.png deleted file mode 100644 index b1bce4ee23f..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/tex_unicode_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/text_handles.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/text_handles.png deleted file mode 100644 index c95f4731c25..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/text_handles.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/text_rotation.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/text_rotation.png deleted file mode 100644 index 044de23b883..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/text_rotation.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/text_rotation_relative_to_line.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/text_rotation_relative_to_line.png deleted file mode 100644 index 1271540ea01..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/text_rotation_relative_to_line.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/titles_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/titles_demo.png deleted file mode 100644 index 6e7bb2e90ce..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/titles_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/toggle_images.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/toggle_images.png deleted file mode 100644 index 427ca662548..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/toggle_images.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/transoffset.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/transoffset.png deleted file mode 100644 index 36c99d862b3..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/transoffset.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/tricontour_demo_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/tricontour_demo_00.png deleted file mode 100644 index c3f4de14f04..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/tricontour_demo_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/tricontour_demo_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/tricontour_demo_01.png deleted file mode 100644 index 0fd030f2ecb..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/tricontour_demo_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/tricontour_smooth_delaunay.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/tricontour_smooth_delaunay.png deleted file mode 100644 index ca6a2e2580b..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/tricontour_smooth_delaunay.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/tricontour_smooth_user.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/tricontour_smooth_user.png deleted file mode 100644 index c52c6428a85..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/tricontour_smooth_user.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/tricontour_vs_griddata.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/tricontour_vs_griddata.png deleted file mode 100644 index 024aed29f44..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/tricontour_vs_griddata.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/trigradient_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/trigradient_demo.png deleted file mode 100644 index 3a24e59def5..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/trigradient_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/triinterp_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/triinterp_demo.png deleted file mode 100644 index deec6d118df..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/triinterp_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/tripcolor_demo_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/tripcolor_demo_00.png deleted file mode 100644 index d7a71e597ae..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/tripcolor_demo_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/tripcolor_demo_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/tripcolor_demo_01.png deleted file mode 100644 index d792bf7238a..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/tripcolor_demo_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/tripcolor_demo_02.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/tripcolor_demo_02.png deleted file mode 100644 index 6400917fdde..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/tripcolor_demo_02.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/triplot_demo_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/triplot_demo_00.png deleted file mode 100644 index b3791dc79fb..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/triplot_demo_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/triplot_demo_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/triplot_demo_01.png deleted file mode 100644 index 6368d3e4e86..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/triplot_demo_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/usetex_baseline_test.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/usetex_baseline_test.png deleted file mode 100644 index 59b590e8231..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/usetex_baseline_test.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/usetex_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/usetex_demo.png deleted file mode 100644 index 678b1fc777f..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/usetex_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/usetex_fonteffects.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/usetex_fonteffects.png deleted file mode 100644 index 75f006f56fb..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/usetex_fonteffects.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/vline_hline_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/vline_hline_demo.png deleted file mode 100644 index 7adfaa49bfc..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/vline_hline_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/xcorr_demo.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/xcorr_demo.png deleted file mode 100644 index f088d34274b..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/xcorr_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/zorder_demo_00.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/zorder_demo_00.png deleted file mode 100644 index 0356ad27ea4..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/zorder_demo_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/pylab_examples/thumbnails/zorder_demo_01.png b/plot_directive/mpl_examples/pylab_examples/thumbnails/zorder_demo_01.png deleted file mode 100644 index 5842a4cd63d..00000000000 Binary files a/plot_directive/mpl_examples/pylab_examples/thumbnails/zorder_demo_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/scales/thumbnails/scales.png b/plot_directive/mpl_examples/scales/thumbnails/scales.png deleted file mode 100644 index 8a5a8b48628..00000000000 Binary files a/plot_directive/mpl_examples/scales/thumbnails/scales.png and /dev/null differ diff --git a/plot_directive/mpl_examples/shapes_and_collections/thumbnails/artist_reference.png b/plot_directive/mpl_examples/shapes_and_collections/thumbnails/artist_reference.png deleted file mode 100644 index 2dcdbe05497..00000000000 Binary files a/plot_directive/mpl_examples/shapes_and_collections/thumbnails/artist_reference.png and /dev/null differ diff --git a/plot_directive/mpl_examples/shapes_and_collections/thumbnails/path_patch_demo.png b/plot_directive/mpl_examples/shapes_and_collections/thumbnails/path_patch_demo.png deleted file mode 100644 index 0387c512fe8..00000000000 Binary files a/plot_directive/mpl_examples/shapes_and_collections/thumbnails/path_patch_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/shapes_and_collections/thumbnails/scatter_demo.png b/plot_directive/mpl_examples/shapes_and_collections/thumbnails/scatter_demo.png deleted file mode 100644 index 820bd70b65e..00000000000 Binary files a/plot_directive/mpl_examples/shapes_and_collections/thumbnails/scatter_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/showcase/thumbnails/anatomy.png b/plot_directive/mpl_examples/showcase/thumbnails/anatomy.png deleted file mode 100644 index 0ac7cfe52ee..00000000000 Binary files a/plot_directive/mpl_examples/showcase/thumbnails/anatomy.png and /dev/null differ diff --git a/plot_directive/mpl_examples/showcase/thumbnails/bachelors_degrees_by_gender.png b/plot_directive/mpl_examples/showcase/thumbnails/bachelors_degrees_by_gender.png deleted file mode 100644 index 51530770d8f..00000000000 Binary files a/plot_directive/mpl_examples/showcase/thumbnails/bachelors_degrees_by_gender.png and /dev/null differ diff --git a/plot_directive/mpl_examples/showcase/thumbnails/firefox.png b/plot_directive/mpl_examples/showcase/thumbnails/firefox.png deleted file mode 100644 index 67e5b3aee39..00000000000 Binary files a/plot_directive/mpl_examples/showcase/thumbnails/firefox.png and /dev/null differ diff --git a/plot_directive/mpl_examples/showcase/thumbnails/integral_demo.png b/plot_directive/mpl_examples/showcase/thumbnails/integral_demo.png deleted file mode 100644 index 6981508552a..00000000000 Binary files a/plot_directive/mpl_examples/showcase/thumbnails/integral_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/showcase/thumbnails/mandelbrot.png b/plot_directive/mpl_examples/showcase/thumbnails/mandelbrot.png deleted file mode 100644 index a7aff167999..00000000000 Binary files a/plot_directive/mpl_examples/showcase/thumbnails/mandelbrot.png and /dev/null differ diff --git a/plot_directive/mpl_examples/showcase/thumbnails/xkcd_00.png b/plot_directive/mpl_examples/showcase/thumbnails/xkcd_00.png deleted file mode 100644 index d451eb179b5..00000000000 Binary files a/plot_directive/mpl_examples/showcase/thumbnails/xkcd_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/showcase/thumbnails/xkcd_01.png b/plot_directive/mpl_examples/showcase/thumbnails/xkcd_01.png deleted file mode 100644 index e2c4e070006..00000000000 Binary files a/plot_directive/mpl_examples/showcase/thumbnails/xkcd_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/specialty_plots/thumbnails/advanced_hillshading_00.png b/plot_directive/mpl_examples/specialty_plots/thumbnails/advanced_hillshading_00.png deleted file mode 100644 index 01698fd4c55..00000000000 Binary files a/plot_directive/mpl_examples/specialty_plots/thumbnails/advanced_hillshading_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/specialty_plots/thumbnails/advanced_hillshading_01.png b/plot_directive/mpl_examples/specialty_plots/thumbnails/advanced_hillshading_01.png deleted file mode 100644 index 10e12185a74..00000000000 Binary files a/plot_directive/mpl_examples/specialty_plots/thumbnails/advanced_hillshading_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/specialty_plots/thumbnails/advanced_hillshading_02.png b/plot_directive/mpl_examples/specialty_plots/thumbnails/advanced_hillshading_02.png deleted file mode 100644 index 3e4a759c363..00000000000 Binary files a/plot_directive/mpl_examples/specialty_plots/thumbnails/advanced_hillshading_02.png and /dev/null differ diff --git a/plot_directive/mpl_examples/specialty_plots/thumbnails/hinton_demo.png b/plot_directive/mpl_examples/specialty_plots/thumbnails/hinton_demo.png deleted file mode 100644 index ad21d048166..00000000000 Binary files a/plot_directive/mpl_examples/specialty_plots/thumbnails/hinton_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/specialty_plots/thumbnails/topographic_hillshading.png b/plot_directive/mpl_examples/specialty_plots/thumbnails/topographic_hillshading.png deleted file mode 100644 index 654be699e92..00000000000 Binary files a/plot_directive/mpl_examples/specialty_plots/thumbnails/topographic_hillshading.png and /dev/null differ diff --git a/plot_directive/mpl_examples/statistics/thumbnails/boxplot_color_demo.png b/plot_directive/mpl_examples/statistics/thumbnails/boxplot_color_demo.png deleted file mode 100644 index 542797646a0..00000000000 Binary files a/plot_directive/mpl_examples/statistics/thumbnails/boxplot_color_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/statistics/thumbnails/boxplot_demo_00_00.png b/plot_directive/mpl_examples/statistics/thumbnails/boxplot_demo_00_00.png deleted file mode 100644 index 51a434628a7..00000000000 Binary files a/plot_directive/mpl_examples/statistics/thumbnails/boxplot_demo_00_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/statistics/thumbnails/boxplot_demo_01_00.png b/plot_directive/mpl_examples/statistics/thumbnails/boxplot_demo_01_00.png deleted file mode 100644 index 6b4ca202a92..00000000000 Binary files a/plot_directive/mpl_examples/statistics/thumbnails/boxplot_demo_01_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/statistics/thumbnails/boxplot_vs_violin_demo.png b/plot_directive/mpl_examples/statistics/thumbnails/boxplot_vs_violin_demo.png deleted file mode 100644 index 89007885161..00000000000 Binary files a/plot_directive/mpl_examples/statistics/thumbnails/boxplot_vs_violin_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/statistics/thumbnails/bxp_demo_00_00.png b/plot_directive/mpl_examples/statistics/thumbnails/bxp_demo_00_00.png deleted file mode 100644 index bed237c7eba..00000000000 Binary files a/plot_directive/mpl_examples/statistics/thumbnails/bxp_demo_00_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/statistics/thumbnails/bxp_demo_01_00.png b/plot_directive/mpl_examples/statistics/thumbnails/bxp_demo_01_00.png deleted file mode 100644 index 8cb40fc1620..00000000000 Binary files a/plot_directive/mpl_examples/statistics/thumbnails/bxp_demo_01_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/statistics/thumbnails/customized_violin_demo.png b/plot_directive/mpl_examples/statistics/thumbnails/customized_violin_demo.png deleted file mode 100644 index 470160504bf..00000000000 Binary files a/plot_directive/mpl_examples/statistics/thumbnails/customized_violin_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/statistics/thumbnails/errorbar_demo.png b/plot_directive/mpl_examples/statistics/thumbnails/errorbar_demo.png deleted file mode 100644 index d4e68d64386..00000000000 Binary files a/plot_directive/mpl_examples/statistics/thumbnails/errorbar_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/statistics/thumbnails/errorbar_demo_features.png b/plot_directive/mpl_examples/statistics/thumbnails/errorbar_demo_features.png deleted file mode 100644 index 53b2c58ac3f..00000000000 Binary files a/plot_directive/mpl_examples/statistics/thumbnails/errorbar_demo_features.png and /dev/null differ diff --git a/plot_directive/mpl_examples/statistics/thumbnails/errorbar_limits.png b/plot_directive/mpl_examples/statistics/thumbnails/errorbar_limits.png deleted file mode 100644 index d8fe868331e..00000000000 Binary files a/plot_directive/mpl_examples/statistics/thumbnails/errorbar_limits.png and /dev/null differ diff --git a/plot_directive/mpl_examples/statistics/thumbnails/errorbars_and_boxes.png b/plot_directive/mpl_examples/statistics/thumbnails/errorbars_and_boxes.png deleted file mode 100644 index 04a58a3b29e..00000000000 Binary files a/plot_directive/mpl_examples/statistics/thumbnails/errorbars_and_boxes.png and /dev/null differ diff --git a/plot_directive/mpl_examples/statistics/thumbnails/histogram_demo_cumulative.png b/plot_directive/mpl_examples/statistics/thumbnails/histogram_demo_cumulative.png deleted file mode 100644 index d48f27b2a66..00000000000 Binary files a/plot_directive/mpl_examples/statistics/thumbnails/histogram_demo_cumulative.png and /dev/null differ diff --git a/plot_directive/mpl_examples/statistics/thumbnails/histogram_demo_features.png b/plot_directive/mpl_examples/statistics/thumbnails/histogram_demo_features.png deleted file mode 100644 index ea909cf81b4..00000000000 Binary files a/plot_directive/mpl_examples/statistics/thumbnails/histogram_demo_features.png and /dev/null differ diff --git a/plot_directive/mpl_examples/statistics/thumbnails/histogram_demo_histtypes.png b/plot_directive/mpl_examples/statistics/thumbnails/histogram_demo_histtypes.png deleted file mode 100644 index d11cdb5ecc8..00000000000 Binary files a/plot_directive/mpl_examples/statistics/thumbnails/histogram_demo_histtypes.png and /dev/null differ diff --git a/plot_directive/mpl_examples/statistics/thumbnails/histogram_demo_multihist.png b/plot_directive/mpl_examples/statistics/thumbnails/histogram_demo_multihist.png deleted file mode 100644 index 1cc95d6209b..00000000000 Binary files a/plot_directive/mpl_examples/statistics/thumbnails/histogram_demo_multihist.png and /dev/null differ diff --git a/plot_directive/mpl_examples/statistics/thumbnails/multiple_histograms_side_by_side.png b/plot_directive/mpl_examples/statistics/thumbnails/multiple_histograms_side_by_side.png deleted file mode 100644 index 80668d3c4bd..00000000000 Binary files a/plot_directive/mpl_examples/statistics/thumbnails/multiple_histograms_side_by_side.png and /dev/null differ diff --git a/plot_directive/mpl_examples/statistics/thumbnails/violinplot_demo.png b/plot_directive/mpl_examples/statistics/thumbnails/violinplot_demo.png deleted file mode 100644 index 14509078169..00000000000 Binary files a/plot_directive/mpl_examples/statistics/thumbnails/violinplot_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/plot_bmh.png b/plot_directive/mpl_examples/style_sheets/thumbnails/plot_bmh.png deleted file mode 100644 index ae1f84823df..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/plot_bmh.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/plot_dark_background.png b/plot_directive/mpl_examples/style_sheets/thumbnails/plot_dark_background.png deleted file mode 100644 index 754680a8976..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/plot_dark_background.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/plot_fivethirtyeight.png b/plot_directive/mpl_examples/style_sheets/thumbnails/plot_fivethirtyeight.png deleted file mode 100644 index 2f65a690e90..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/plot_fivethirtyeight.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/plot_ggplot.png b/plot_directive/mpl_examples/style_sheets/thumbnails/plot_ggplot.png deleted file mode 100644 index b6ea035408e..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/plot_ggplot.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/plot_grayscale.png b/plot_directive/mpl_examples/style_sheets/thumbnails/plot_grayscale.png deleted file mode 100644 index c3a5c00e77b..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/plot_grayscale.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_00.png b/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_00.png deleted file mode 100644 index faa097850c8..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_00.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_01.png b/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_01.png deleted file mode 100644 index 89adf9154c9..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_01.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_02.png b/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_02.png deleted file mode 100644 index d271b90b6ec..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_02.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_03.png b/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_03.png deleted file mode 100644 index e7f29aeb65c..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_03.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_04.png b/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_04.png deleted file mode 100644 index 87de741477d..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_04.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_05.png b/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_05.png deleted file mode 100644 index c2c5f988b38..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_05.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_06.png b/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_06.png deleted file mode 100644 index e592164cd30..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_06.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_07.png b/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_07.png deleted file mode 100644 index 39326dc6795..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_07.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_08.png b/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_08.png deleted file mode 100644 index de82b54b8b8..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_08.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_09.png b/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_09.png deleted file mode 100644 index 69276a7261e..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_09.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_10.png b/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_10.png deleted file mode 100644 index 9b1445fde3e..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_10.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_11.png b/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_11.png deleted file mode 100644 index d25707b3ad9..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_11.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_12.png b/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_12.png deleted file mode 100644 index e37d4c562cb..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_12.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_13.png b/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_13.png deleted file mode 100644 index 508a8031870..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_13.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_14.png b/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_14.png deleted file mode 100644 index d7dcd42783b..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_14.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_15.png b/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_15.png deleted file mode 100644 index acee606e4d8..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_15.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_16.png b/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_16.png deleted file mode 100644 index 605036fc110..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_16.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_17.png b/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_17.png deleted file mode 100644 index 280c9f1eef7..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_17.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_18.png b/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_18.png deleted file mode 100644 index 90fa4eeb0a5..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_18.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_19.png b/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_19.png deleted file mode 100644 index 45965c57c8d..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_19.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_20.png b/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_20.png deleted file mode 100644 index 89313c9294e..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_20.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_21.png b/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_21.png deleted file mode 100644 index 1692344d647..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_21.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_22.png b/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_22.png deleted file mode 100644 index b4b49126462..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_22.png and /dev/null differ diff --git a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_23.png b/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_23.png deleted file mode 100644 index c85e46f0e47..00000000000 Binary files a/plot_directive/mpl_examples/style_sheets/thumbnails/style_sheets_reference_23.png and /dev/null differ diff --git a/plot_directive/mpl_examples/subplots_axes_and_figures/thumbnails/fahrenheit_celsius_scales.png b/plot_directive/mpl_examples/subplots_axes_and_figures/thumbnails/fahrenheit_celsius_scales.png deleted file mode 100644 index 0b234b15136..00000000000 Binary files a/plot_directive/mpl_examples/subplots_axes_and_figures/thumbnails/fahrenheit_celsius_scales.png and /dev/null differ diff --git a/plot_directive/mpl_examples/subplots_axes_and_figures/thumbnails/subplot_demo.png b/plot_directive/mpl_examples/subplots_axes_and_figures/thumbnails/subplot_demo.png deleted file mode 100644 index f34f8304e11..00000000000 Binary files a/plot_directive/mpl_examples/subplots_axes_and_figures/thumbnails/subplot_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/text_labels_and_annotations/thumbnails/autowrap_demo.png b/plot_directive/mpl_examples/text_labels_and_annotations/thumbnails/autowrap_demo.png deleted file mode 100644 index f0c7808c5e8..00000000000 Binary files a/plot_directive/mpl_examples/text_labels_and_annotations/thumbnails/autowrap_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/text_labels_and_annotations/thumbnails/rainbow_text.png b/plot_directive/mpl_examples/text_labels_and_annotations/thumbnails/rainbow_text.png deleted file mode 100644 index 62d22af0aba..00000000000 Binary files a/plot_directive/mpl_examples/text_labels_and_annotations/thumbnails/rainbow_text.png and /dev/null differ diff --git a/plot_directive/mpl_examples/text_labels_and_annotations/thumbnails/text_demo_fontdict.png b/plot_directive/mpl_examples/text_labels_and_annotations/thumbnails/text_demo_fontdict.png deleted file mode 100644 index 15af09e1de3..00000000000 Binary files a/plot_directive/mpl_examples/text_labels_and_annotations/thumbnails/text_demo_fontdict.png and /dev/null differ diff --git a/plot_directive/mpl_examples/text_labels_and_annotations/thumbnails/unicode_demo.png b/plot_directive/mpl_examples/text_labels_and_annotations/thumbnails/unicode_demo.png deleted file mode 100644 index 3a5eaf87266..00000000000 Binary files a/plot_directive/mpl_examples/text_labels_and_annotations/thumbnails/unicode_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/ticks_and_spines/thumbnails/spines_demo.png b/plot_directive/mpl_examples/ticks_and_spines/thumbnails/spines_demo.png deleted file mode 100644 index aa74d20a27d..00000000000 Binary files a/plot_directive/mpl_examples/ticks_and_spines/thumbnails/spines_demo.png and /dev/null differ diff --git a/plot_directive/mpl_examples/ticks_and_spines/thumbnails/spines_demo_bounds.png b/plot_directive/mpl_examples/ticks_and_spines/thumbnails/spines_demo_bounds.png deleted file mode 100644 index 6fec2aba603..00000000000 Binary files a/plot_directive/mpl_examples/ticks_and_spines/thumbnails/spines_demo_bounds.png and /dev/null differ diff --git a/plot_directive/mpl_examples/ticks_and_spines/thumbnails/spines_demo_dropped.png b/plot_directive/mpl_examples/ticks_and_spines/thumbnails/spines_demo_dropped.png deleted file mode 100644 index 66fd61af71c..00000000000 Binary files a/plot_directive/mpl_examples/ticks_and_spines/thumbnails/spines_demo_dropped.png and /dev/null differ diff --git a/plot_directive/mpl_examples/ticks_and_spines/thumbnails/tick-formatters.png b/plot_directive/mpl_examples/ticks_and_spines/thumbnails/tick-formatters.png deleted file mode 100644 index b9341b612cc..00000000000 Binary files a/plot_directive/mpl_examples/ticks_and_spines/thumbnails/tick-formatters.png and /dev/null differ diff --git a/plot_directive/mpl_examples/ticks_and_spines/thumbnails/tick-locators.png b/plot_directive/mpl_examples/ticks_and_spines/thumbnails/tick-locators.png deleted file mode 100644 index 7cea2d47c91..00000000000 Binary files a/plot_directive/mpl_examples/ticks_and_spines/thumbnails/tick-locators.png and /dev/null differ diff --git a/plot_directive/mpl_examples/ticks_and_spines/thumbnails/tick_labels_from_values.png b/plot_directive/mpl_examples/ticks_and_spines/thumbnails/tick_labels_from_values.png deleted file mode 100644 index 619e444006d..00000000000 Binary files a/plot_directive/mpl_examples/ticks_and_spines/thumbnails/tick_labels_from_values.png and /dev/null differ diff --git a/plot_directive/mpl_examples/ticks_and_spines/thumbnails/ticklabels_demo_rotation.png b/plot_directive/mpl_examples/ticks_and_spines/thumbnails/ticklabels_demo_rotation.png deleted file mode 100644 index 2b11fdad529..00000000000 Binary files a/plot_directive/mpl_examples/ticks_and_spines/thumbnails/ticklabels_demo_rotation.png and /dev/null differ diff --git a/plot_directive/mpl_examples/widgets/thumbnails/cursor.png b/plot_directive/mpl_examples/widgets/thumbnails/cursor.png deleted file mode 100644 index 24dd58f8fb6..00000000000 Binary files a/plot_directive/mpl_examples/widgets/thumbnails/cursor.png and /dev/null differ diff --git a/plot_directive/mpl_examples/widgets/thumbnails/slider_demo.png b/plot_directive/mpl_examples/widgets/thumbnails/slider_demo.png deleted file mode 100644 index d69dee7170b..00000000000 Binary files a/plot_directive/mpl_examples/widgets/thumbnails/slider_demo.png and /dev/null differ diff --git a/users/annotations.html b/users/annotations.html deleted file mode 100644 index 9d5ddf77c6c..00000000000 --- a/users/annotations.html +++ /dev/null @@ -1,1116 +0,0 @@ - - - - - - - - Annotation — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - - - -
    -
    -
    -
    - -
    -

    Annotation

    - -
    -

    Basic annotation

    -

    The uses of the basic text() will place text -at an arbitrary position on the Axes. A common use case of text is to -annotate some feature of the plot, and the -annotate() method provides helper functionality -to make annotations easy. In an annotation, there are two points to -consider: the location being annotated represented by the argument -xy and the location of the text xytext. Both of these -arguments are (x,y) tuples.

    -
    import numpy as np
    -import matplotlib.pyplot as plt
    -
    -fig = plt.figure()
    -ax = fig.add_subplot(111)
    -
    -t = np.arange(0.0, 5.0, 0.01)
    -s = np.cos(2*np.pi*t)
    -line, = ax.plot(t, s, lw=2)
    -
    -ax.annotate('local max', xy=(2, 1), xytext=(3, 1.5),
    -            arrowprops=dict(facecolor='black', shrink=0.05),
    -            )
    -
    -ax.set_ylim(-2,2)
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/annotation_basic.png -
    -

    In this example, both the xy (arrow tip) and xytext locations -(text location) are in data coordinates. There are a variety of other -coordinate systems one can choose – you can specify the coordinate -system of xy and xytext with one of the following strings for -xycoords and textcoords (default is ‘data’)

    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    argumentcoordinate system
    ‘figure points’points from the lower left corner of the figure
    ‘figure pixels’pixels from the lower left corner of the figure
    ‘figure fraction’0,0 is lower left of figure and 1,1 is upper right
    ‘axes points’points from lower left corner of axes
    ‘axes pixels’pixels from lower left corner of axes
    ‘axes fraction’0,0 is lower left of axes and 1,1 is upper right
    ‘data’use the axes data coordinate system
    -

    For example to place the text coordinates in fractional axes -coordinates, one could do:

    -
    ax.annotate('local max', xy=(3, 1),  xycoords='data',
    -            xytext=(0.8, 0.95), textcoords='axes fraction',
    -            arrowprops=dict(facecolor='black', shrink=0.05),
    -            horizontalalignment='right', verticalalignment='top',
    -            )
    -
    -
    -

    For physical coordinate systems (points or pixels) the origin is the -bottom-left of the figure or axes.

    -

    Optionally, you can enable drawing of an arrow from the text to the annotated -point by giving a dictionary of arrow properties in the optional keyword -argument arrowprops.

    - ---- - - - - - - - - - - - - - - - - - - - - - - -
    arrowprops keydescription
    widththe width of the arrow in points
    fracthe fraction of the arrow length occupied by the head
    headwidththe width of the base of the arrow head in points
    shrinkmove the tip and base some percent away from -the annotated point and text
    **kwargsany key for matplotlib.patches.Polygon, -e.g., facecolor
    -

    In the example below, the xy point is in native coordinates -(xycoords defaults to ‘data’). For a polar axes, this is in -(theta, radius) space. The text in this example is placed in the -fractional figure coordinate system. matplotlib.text.Text -keyword args like horizontalalignment, verticalalignment and -fontsize are passed from annotate to the -Text instance.

    -
    import numpy as np
    -import matplotlib.pyplot as plt
    -
    -fig = plt.figure()
    -ax = fig.add_subplot(111, polar=True)
    -r = np.arange(0,1,0.001)
    -theta = 2*2*np.pi*r
    -line, = ax.plot(theta, r, color='#ee8d18', lw=3)
    -
    -ind = 800
    -thisr, thistheta = r[ind], theta[ind]
    -ax.plot([thistheta], [thisr], 'o')
    -ax.annotate('a polar annotation',
    -            xy=(thistheta, thisr),  # theta, radius
    -            xytext=(0.05, 0.05),    # fraction, fraction
    -            textcoords='figure fraction',
    -            arrowprops=dict(facecolor='black', shrink=0.05),
    -            horizontalalignment='left',
    -            verticalalignment='bottom',
    -            )
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/annotation_polar.png -
    -

    For more on all the wild and wonderful things you can do with -annotations, including fancy arrows, see Advanced Annotation -and pylab_examples example code: annotation_demo.py.

    -

    Do not proceed unless you have already read Basic annotation, -text() and annotate()!

    -
    -
    -

    Advanced Annotation

    -
    -

    Annotating with Text with Box

    -

    Let’s start with a simple example.

    -

    (Source code, png, pdf)

    -
    -../_images/annotate_text_arrow.png -
    -

    The text() function in the pyplot module (or -text method of the Axes class) takes bbox keyword argument, and when -given, a box around the text is drawn.

    -
    bbox_props = dict(boxstyle="rarrow,pad=0.3", fc="cyan", ec="b", lw=2)
    -t = ax.text(0, 0, "Direction", ha="center", va="center", rotation=45,
    -            size=15,
    -            bbox=bbox_props)
    -
    -
    -

    The patch object associated with the text can be accessed by:

    -
    bb = t.get_bbox_patch()
    -
    -
    -

    The return value is an instance of FancyBboxPatch and the patch -properties like facecolor, edgewidth, etc. can be accessed and -modified as usual. To change the shape of the box, use the set_boxstyle -method.

    -
    bb.set_boxstyle("rarrow", pad=0.6)
    -
    -
    -

    The arguments are the name of the box style with its attributes as -keyword arguments. Currently, following box styles are implemented.

    -
    -
    ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ClassNameAttrs
    Circlecirclepad=0.3
    DArrowdarrowpad=0.3
    LArrowlarrowpad=0.3
    RArrowrarrowpad=0.3
    Roundroundpad=0.3,rounding_size=None
    Round4round4pad=0.3,rounding_size=None
    Roundtoothroundtoothpad=0.3,tooth_size=None
    Sawtoothsawtoothpad=0.3,tooth_size=None
    Squaresquarepad=0.3
    -
    -

    (Source code, png, pdf)

    -
    -../_images/fancybox_demo22.png -
    -

    Note that the attribute arguments can be specified within the style -name with separating comma (this form can be used as “boxstyle” value -of bbox argument when initializing the text instance)

    -
    bb.set_boxstyle("rarrow,pad=0.6")
    -
    -
    -
    -
    -

    Annotating with Arrow

    -

    The annotate() function in the pyplot module -(or annotate method of the Axes class) is used to draw an arrow -connecting two points on the plot.

    -
    ax.annotate("Annotation",
    -            xy=(x1, y1), xycoords='data',
    -            xytext=(x2, y2), textcoords='offset points',
    -            )
    -
    -
    -

    This annotates a point at xy in the given coordinate (xycoords) -with the text at xytext given in textcoords. Often, the -annotated point is specified in the data coordinate and the annotating -text in offset points. -See annotate() for available coordinate systems.

    -

    An arrow connecting two points (xy & xytext) can be optionally drawn by -specifying the arrowprops argument. To draw only an arrow, use -empty string as the first argument.

    -
    ax.annotate("",
    -            xy=(0.2, 0.2), xycoords='data',
    -            xytext=(0.8, 0.8), textcoords='data',
    -            arrowprops=dict(arrowstyle="->",
    -                            connectionstyle="arc3"),
    -            )
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/annotate_simple01.png -
    -

    The arrow drawing takes a few steps.

    -
      -
    1. a connecting path between two points are created. This is -controlled by connectionstyle key value.
    2. -
    3. If patch object is given (patchA & patchB), the path is clipped to -avoid the patch.
    4. -
    5. The path is further shrunk by given amount of pixels (shrinkA -& shrinkB)
    6. -
    7. The path is transmuted to arrow patch, which is controlled by the -arrowstyle key value.
    8. -
    -

    (Source code, png, pdf)

    -
    -../_images/annotate_explain.png -
    -

    The creation of the connecting path between two points is controlled by -connectionstyle key and the following styles are available.

    -
    -
    ---- - - - - - - - - - - - - - - - - - - - - - - -
    NameAttrs
    angleangleA=90,angleB=0,rad=0.0
    angle3angleA=90,angleB=0
    arcangleA=0,angleB=0,armA=None,armB=None,rad=0.0
    arc3rad=0.0
    bararmA=0.0,armB=0.0,fraction=0.3,angle=None
    -
    -

    Note that “3” in angle3 and arc3 is meant to indicate that the -resulting path is a quadratic spline segment (three control -points). As will be discussed below, some arrow style options can only -be used when the connecting path is a quadratic spline.

    -

    The behavior of each connection style is (limitedly) demonstrated in the -example below. (Warning : The behavior of the bar style is currently not -well defined, it may be changed in the future).

    -

    (Source code, png, pdf)

    -
    -../_images/connectionstyle_demo.png -
    -

    The connecting path (after clipping and shrinking) is then mutated to -an arrow patch, according to the given arrowstyle.

    -
    -
    ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameAttrs
    -None
    ->head_length=0.4,head_width=0.2
    -[widthB=1.0,lengthB=0.2,angleB=None
    |-|widthA=1.0,widthB=1.0
    -|>head_length=0.4,head_width=0.2
    <-head_length=0.4,head_width=0.2
    <->head_length=0.4,head_width=0.2
    <|-head_length=0.4,head_width=0.2
    <|-|>head_length=0.4,head_width=0.2
    fancyhead_length=0.4,head_width=0.4,tail_width=0.4
    simplehead_length=0.5,head_width=0.5,tail_width=0.2
    wedgetail_width=0.3,shrink_factor=0.5
    -
    -

    (Source code, png, pdf)

    -
    -../_images/fancyarrow_demo2.png -
    -

    Some arrowstyles only work with connection styles that generate a -quadratic-spline segment. They are fancy, simple, and wedge. -For these arrow styles, you must use the “angle3” or “arc3” connection -style.

    -

    If the annotation string is given, the patchA is set to the bbox patch -of the text by default.

    -

    (Source code, png, pdf)

    -
    -../_images/annotate_simple02.png -
    -

    As in the text command, a box around the text can be drawn using -the bbox argument.

    -

    (Source code, png, pdf)

    -
    -../_images/annotate_simple03.png -
    -

    By default, the starting point is set to the center of the text -extent. This can be adjusted with relpos key value. The values -are normalized to the extent of the text. For example, (0,0) means -lower-left corner and (1,1) means top-right.

    -

    (Source code, png, pdf)

    -
    -../_images/annotate_simple04.png -
    -
    -
    -

    Placing Artist at the anchored location of the Axes

    -

    There are classes of artists that can be placed at an anchored location -in the Axes. A common example is the legend. This type of artist can -be created by using the OffsetBox class. A few predefined classes are -available in mpl_toolkits.axes_grid.anchored_artists.

    -
    from mpl_toolkits.axes_grid.anchored_artists import AnchoredText
    -at = AnchoredText("Figure 1a",
    -                  prop=dict(size=8), frameon=True,
    -                  loc=2,
    -                  )
    -at.patch.set_boxstyle("round,pad=0.,rounding_size=0.2")
    -ax.add_artist(at)
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/anchored_box01.png -
    -

    The loc keyword has same meaning as in the legend command.

    -

    A simple application is when the size of the artist (or collection of -artists) is known in pixel size during the time of creation. For -example, If you want to draw a circle with fixed size of 20 pixel x 20 -pixel (radius = 10 pixel), you can utilize -AnchoredDrawingArea. The instance is created with a size of the -drawing area (in pixels), and arbitrary artists can added to the -drawing area. Note that the extents of the artists that are added to -the drawing area are not related to the placement of the drawing -area itself. Only the initial size matters.

    -
    from mpl_toolkits.axes_grid.anchored_artists import AnchoredDrawingArea
    -
    -ada = AnchoredDrawingArea(20, 20, 0, 0,
    -                          loc=1, pad=0., frameon=False)
    -p1 = Circle((10, 10), 10)
    -ada.drawing_area.add_artist(p1)
    -p2 = Circle((30, 10), 5, fc="r")
    -ada.drawing_area.add_artist(p2)
    -
    -
    -

    The artists that are added to the drawing area should not have a -transform set (it will be overridden) and the dimensions of those -artists are interpreted as a pixel coordinate, i.e., the radius of the -circles in above example are 10 pixels and 5 pixels, respectively.

    -

    (Source code, png, pdf)

    -
    -../_images/anchored_box02.png -
    -

    Sometimes, you want your artists to scale with the data coordinate (or -coordinates other than canvas pixels). You can use -AnchoredAuxTransformBox class. This is similar to -AnchoredDrawingArea except that the extent of the artist is -determined during the drawing time respecting the specified transform.

    -
    from mpl_toolkits.axes_grid.anchored_artists import AnchoredAuxTransformBox
    -
    -box = AnchoredAuxTransformBox(ax.transData, loc=2)
    -el = Ellipse((0,0), width=0.1, height=0.4, angle=30)  # in data coordinates!
    -box.drawing_area.add_artist(el)
    -
    -
    -

    The ellipse in the above example will have width and height -corresponding to 0.1 and 0.4 in data coordinateing and will be -automatically scaled when the view limits of the axes change.

    -

    (Source code, png, pdf)

    -
    -../_images/anchored_box03.png -
    -

    As in the legend, the bbox_to_anchor argument can be set. Using the -HPacker and VPacker, you can have an arrangement(?) of artist as in the -legend (as a matter of fact, this is how the legend is created).

    -

    (Source code, png, pdf)

    -
    -../_images/anchored_box04.png -
    -

    Note that unlike the legend, the bbox_transform is set -to IdentityTransform by default.

    -
    -
    -

    Using Complex Coordinates with Annotations

    -

    The Annotation in matplotlib supports several types of coordinates as -described in Basic annotation. For an advanced user who wants -more control, it supports a few other options.

    -
    -
      -
    1. Transform instance. For example,

      -
      ax.annotate("Test", xy=(0.5, 0.5), xycoords=ax.transAxes)
      -
      -
      -

      is identical to

      -
      ax.annotate("Test", xy=(0.5, 0.5), xycoords="axes fraction")
      -
      -
      -

      With this, you can annotate a point in other axes.

      -
      ax1, ax2 = subplot(121), subplot(122)
      -ax2.annotate("Test", xy=(0.5, 0.5), xycoords=ax1.transData,
      -             xytext=(0.5, 0.5), textcoords=ax2.transData,
      -             arrowprops=dict(arrowstyle="->"))
      -
      -
      -
    2. -
    3. Artist instance. The xy value (or -xytext) is interpreted as a fractional coordinate of the bbox -(return value of get_window_extent) of the artist.

      -
      an1 = ax.annotate("Test 1", xy=(0.5, 0.5), xycoords="data",
      -                  va="center", ha="center",
      -                  bbox=dict(boxstyle="round", fc="w"))
      -an2 = ax.annotate("Test 2", xy=(1, 0.5), xycoords=an1, # (1,0.5) of the an1's bbox
      -                  xytext=(30,0), textcoords="offset points",
      -                  va="center", ha="left",
      -                  bbox=dict(boxstyle="round", fc="w"),
      -                  arrowprops=dict(arrowstyle="->"))
      -
      -
      -

      (Source code, png, pdf)

      -
      -../_images/annotate_simple_coord01.png -
      -

      Note that it is your responsibility that the extent of the -coordinate artist (an1 in above example) is determined before an2 -gets drawn. In most cases, it means that an2 needs to be drawn -later than an1.

      -
    4. -
    5. A callable object that returns an instance of either -BboxBase or -Transform. If a transform is -returned, it is the same as 1 and if a bbox is returned, it is the same -as 2. The callable object should take a single argument of the -renderer instance. For example, the following two commands give -identical results

      -
      an2 = ax.annotate("Test 2", xy=(1, 0.5), xycoords=an1,
      -                  xytext=(30,0), textcoords="offset points")
      -an2 = ax.annotate("Test 2", xy=(1, 0.5), xycoords=an1.get_window_extent,
      -                  xytext=(30,0), textcoords="offset points")
      -
      -
      -
    6. -
    7. A tuple of two coordinate specifications. The first item is for the -x-coordinate and the second is for the y-coordinate. For example,

      -
      annotate("Test", xy=(0.5, 1), xycoords=("data", "axes fraction"))
      -
      -
      -

      0.5 is in data coordinates, and 1 is in normalized axes coordinates. -You may use an artist or transform as with a tuple. For example,

      -
      import matplotlib.pyplot as plt
      -
      -plt.figure(figsize=(3,2))
      -ax=plt.axes([0.1, 0.1, 0.8, 0.7])
      -an1 = ax.annotate("Test 1", xy=(0.5, 0.5), xycoords="data",
      -                  va="center", ha="center",
      -                  bbox=dict(boxstyle="round", fc="w"))
      -
      -an2 = ax.annotate("Test 2", xy=(0.5, 1.), xycoords=an1,
      -                  xytext=(0.5,1.1), textcoords=(an1, "axes fraction"),
      -                  va="bottom", ha="center",
      -                  bbox=dict(boxstyle="round", fc="w"),
      -                  arrowprops=dict(arrowstyle="->"))
      -plt.show()
      -
      -
      -

      (Source code, png, pdf)

      -
      -../_images/annotate_simple_coord02.png -
      -
    8. -
    9. Sometimes, you want your annotation with some “offset points”, not from the -annotated point but from some other point. -OffsetFrom is a helper class for such cases.

      -
      import matplotlib.pyplot as plt
      -
      -plt.figure(figsize=(3,2))
      -ax=plt.axes([0.1, 0.1, 0.8, 0.7])
      -an1 = ax.annotate("Test 1", xy=(0.5, 0.5), xycoords="data",
      -                  va="center", ha="center",
      -                  bbox=dict(boxstyle="round", fc="w"))
      -
      -from matplotlib.text import OffsetFrom
      -offset_from = OffsetFrom(an1, (0.5, 0))
      -an2 = ax.annotate("Test 2", xy=(0.1, 0.1), xycoords="data",
      -                  xytext=(0, -10), textcoords=offset_from,
      -                  # xytext is offset points from "xy=(0.5, 0), xycoords=an1"
      -                  va="top", ha="center",
      -                  bbox=dict(boxstyle="round", fc="w"),
      -                  arrowprops=dict(arrowstyle="->"))
      -plt.show()
      -
      -
      -

      (Source code, png, pdf)

      -
      -../_images/annotate_simple_coord03.png -
      -

      You may take a look at this example pylab_examples example code: annotation_demo3.py.

      -
    10. -
    -
    -
    -
    -

    Using ConnectorPatch

    -

    The ConnectorPatch is like an annotation without text. While the annotate -function is recommended in most situations, the ConnectorPatch is useful when -you want to connect points in different axes.

    -
    from matplotlib.patches import ConnectionPatch
    -xy = (0.2, 0.2)
    -con = ConnectionPatch(xyA=xy, xyB=xy, coordsA="data", coordsB="data",
    -                      axesA=ax1, axesB=ax2)
    -ax2.add_artist(con)
    -
    -
    -

    The above code connects point xy in the data coordinates of ax1 to -point xy in the data coordinates of ax2. Here is a simple example.

    -

    (Source code, png, pdf)

    -
    -../_images/connect_simple01.png -
    -

    While the ConnectorPatch instance can be added to any axes, you may want to add -it to the axes that is latest in drawing order to prevent overlap by other -axes.

    -
    -

    Advanced Topics

    -
    -
    -
    -

    Zoom effect between Axes

    -

    mpl_toolkits.axes_grid.inset_locator defines some patch classes useful -for interconnecting two axes. Understanding the code requires some -knowledge of how mpl’s transform works. But, utilizing it will be -straight forward.

    -

    (Source code, png, pdf)

    -
    -../_images/axes_zoom_effect1.png -
    -
    -
    -

    Define Custom BoxStyle

    -

    You can use a custom box style. The value for the boxstyle can be a -callable object in the following forms.:

    -
    def __call__(self, x0, y0, width, height, mutation_size,
    -             aspect_ratio=1.):
    -    """
    -    Given the location and size of the box, return the path of
    -    the box around it.
    -
    -      - *x0*, *y0*, *width*, *height* : location and size of the box
    -      - *mutation_size* : a reference scale for the mutation.
    -      - *aspect_ratio* : aspect-ratio for the mutation.
    -    """
    -    path = ...
    -    return path
    -
    -
    -

    Here is a complete example.

    -

    (Source code, png, pdf)

    -
    -../_images/custom_boxstyle01.png -
    -

    However, it is recommended that you derive from the -matplotlib.patches.BoxStyle._Base as demonstrated below.

    -
    from matplotlib.path import Path
    -from matplotlib.patches import BoxStyle
    -import matplotlib.pyplot as plt
    -
    -# we may derive from matplotlib.patches.BoxStyle._Base class.
    -# You need to override transmute method in this case.
    -
    -class MyStyle(BoxStyle._Base):
    -    """
    -    A simple box.
    -    """
    -
    -    def __init__(self, pad=0.3):
    -        """
    -        The arguments need to be floating numbers and need to have
    -        default values.
    -
    -         *pad*
    -            amount of padding
    -        """
    -
    -        self.pad = pad
    -        super(MyStyle, self).__init__()
    -
    -    def transmute(self, x0, y0, width, height, mutation_size):
    -        """
    -        Given the location and size of the box, return the path of
    -        the box around it.
    -
    -         - *x0*, *y0*, *width*, *height* : location and size of the box
    -         - *mutation_size* : a reference scale for the mutation.
    -
    -        Often, the *mutation_size* is the font size of the text.
    -        You don't need to worry about the rotation as it is
    -        automatically taken care of.
    -        """
    -
    -        # padding
    -        pad = mutation_size * self.pad
    -
    -        # width and height with padding added.
    -        width, height = width + 2.*pad, \
    -                        height + 2.*pad,
    -
    -        # boundary of the padded box
    -        x0, y0 = x0-pad, y0-pad,
    -        x1, y1 = x0+width, y0 + height
    -
    -        cp = [(x0, y0),
    -              (x1, y0), (x1, y1), (x0, y1),
    -              (x0-pad, (y0+y1)/2.), (x0, y0),
    -              (x0, y0)]
    -
    -        com = [Path.MOVETO,
    -               Path.LINETO, Path.LINETO, Path.LINETO,
    -               Path.LINETO, Path.LINETO,
    -               Path.CLOSEPOLY]
    -
    -        path = Path(cp, com)
    -
    -        return path
    -
    -
    -# register the custom style
    -BoxStyle._style_list["angled"] = MyStyle
    -
    -plt.figure(1, figsize=(3,3))
    -ax = plt.subplot(111)
    -ax.text(0.5, 0.5, "Test", size=30, va="center", ha="center", rotation=30,
    -        bbox=dict(boxstyle="angled,pad=0.5", alpha=0.2))
    -
    -del BoxStyle._style_list["angled"]
    -
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/custom_boxstyle02.png -
    -

    Similarly, you can define a custom ConnectionStyle and a custom ArrowStyle. -See the source code of lib/matplotlib/patches.py and check -how each style class is defined.

    -
    -
    -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/users/artists.html b/users/artists.html deleted file mode 100644 index e56082882e9..00000000000 --- a/users/artists.html +++ /dev/null @@ -1,1126 +0,0 @@ - - - - - - - - Artist tutorial — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -

    Table Of Contents

    - -
    -

    Related Topics

    - -
    -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    Artist tutorial

    -

    There are three layers to the matplotlib API. The -matplotlib.backend_bases.FigureCanvas is the area onto which -the figure is drawn, the matplotlib.backend_bases.Renderer is -the object which knows how to draw on the -FigureCanvas, and the -matplotlib.artist.Artist is the object that knows how to use -a renderer to paint onto the canvas. The -FigureCanvas and -Renderer handle all the details of -talking to user interface toolkits like wxPython or drawing languages like PostScript®, and -the Artist handles all the high level constructs like representing -and laying out the figure, text, and lines. The typical user will -spend 95% of their time working with the Artists.

    -

    There are two types of Artists: primitives and containers. The primitives -represent the standard graphical objects we want to paint onto our canvas: -Line2D, Rectangle, -Text, AxesImage, etc., and -the containers are places to put them (Axis, -Axes and Figure). The -standard use is to create a Figure instance, use -the Figure to create one or more Axes or -Subplot instances, and use the Axes instance -helper methods to create the primitives. In the example below, we create a -Figure instance using matplotlib.pyplot.figure(), which is a -convenience method for instantiating Figure instances and connecting them -with your user interface or drawing toolkit FigureCanvas. As we will -discuss below, this is not necessary – you can work directly with PostScript, -PDF Gtk+, or wxPython FigureCanvas instances, instantiate your Figures -directly and connect them yourselves – but since we are focusing here on the -Artist API we’ll let pyplot handle some of those details -for us:

    -
    import matplotlib.pyplot as plt
    -fig = plt.figure()
    -ax = fig.add_subplot(2,1,1) # two rows, one column, first plot
    -
    -
    -

    The Axes is probably the most important -class in the matplotlib API, and the one you will be working with most -of the time. This is because the Axes is the plotting area into -which most of the objects go, and the Axes has many special helper -methods (plot(), -text(), -hist(), -imshow()) to create the most common -graphics primitives (Line2D, -Text, -Rectangle, -Image, respectively). These helper methods -will take your data (e.g., numpy arrays and strings) and create -primitive Artist instances as needed (e.g., Line2D), add them to -the relevant containers, and draw them when requested. Most of you -are probably familiar with the Subplot, -which is just a special case of an Axes that lives on a regular -rows by columns grid of Subplot instances. If you want to create -an Axes at an arbitrary location, simply use the -add_axes() method which takes a list -of [left, bottom, width, height] values in 0-1 relative figure -coordinates:

    -
    fig2 = plt.figure()
    -ax2 = fig2.add_axes([0.15, 0.1, 0.7, 0.3])
    -
    -
    -

    Continuing with our example:

    -
    import numpy as np
    -t = np.arange(0.0, 1.0, 0.01)
    -s = np.sin(2*np.pi*t)
    -line, = ax.plot(t, s, color='blue', lw=2)
    -
    -
    -

    In this example, ax is the Axes instance created by the -fig.add_subplot call above (remember Subplot is just a -subclass of Axes) and when you call ax.plot, it creates a -Line2D instance and adds it to the Axes.lines list. In the interactive ipython session below, you can see that the -Axes.lines list is length one and contains the same line that was -returned by the line, = ax.plot... call:

    -
    In [101]: ax.lines[0]
    -Out[101]: <matplotlib.lines.Line2D instance at 0x19a95710>
    -
    -In [102]: line
    -Out[102]: <matplotlib.lines.Line2D instance at 0x19a95710>
    -
    -
    -

    If you make subsequent calls to ax.plot (and the hold state is “on” -which is the default) then additional lines will be added to the list. -You can remove lines later simply by calling the list methods; either -of these will work:

    -
    del ax.lines[0]
    -ax.lines.remove(line)  # one or the other, not both!
    -
    -
    -

    The Axes also has helper methods to configure and decorate the x-axis -and y-axis tick, tick labels and axis labels:

    -
    xtext = ax.set_xlabel('my xdata') # returns a Text instance
    -ytext = ax.set_ylabel('my ydata')
    -
    -
    -

    When you call ax.set_xlabel, -it passes the information on the Text -instance of the XAxis. Each Axes -instance contains an XAxis and a -YAxis instance, which handle the layout and -drawing of the ticks, tick labels and axis labels.

    -

    Try creating the figure below.

    -

    (Source code, png, pdf)

    -
    -../_images/fig_axes_labels_simple.png -
    -
    -

    Customizing your objects

    -

    Every element in the figure is represented by a matplotlib -Artist, and each has an extensive list of -properties to configure its appearance. The figure itself contains a -Rectangle exactly the size of the figure, -which you can use to set the background color and transparency of the -figures. Likewise, each Axes bounding box -(the standard white box with black edges in the typical matplotlib -plot, has a Rectangle instance that determines the color, -transparency, and other properties of the Axes. These instances are -stored as member variables Figure.patch and Axes.patch (“Patch” is a name inherited from -MATLAB, and is a 2D “patch” of color on the figure, e.g., rectangles, -circles and polygons). Every matplotlib Artist has the following -properties

    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PropertyDescription
    alphaThe transparency - a scalar from 0-1
    animatedA boolean that is used to facilitate animated drawing
    axesThe axes that the Artist lives in, possibly None
    clip_boxThe bounding box that clips the Artist
    clip_onWhether clipping is enabled
    clip_pathThe path the artist is clipped to
    containsA picking function to test whether the artist contains the pick point
    figureThe figure instance the artist lives in, possibly None
    labelA text label (e.g., for auto-labeling)
    pickerA python object that controls object picking
    transformThe transformation
    visibleA boolean whether the artist should be drawn
    zorderA number which determines the drawing order
    rasterizedBoolean; Turns vectors into rastergraphics: (for compression & eps transparency)
    -

    Each of the properties is accessed with an old-fashioned setter or -getter (yes we know this irritates Pythonistas and we plan to support -direct access via properties or traits but it hasn’t been done yet). -For example, to multiply the current alpha by a half:

    -
    a = o.get_alpha()
    -o.set_alpha(0.5*a)
    -
    -
    -

    If you want to set a number of properties at once, you can also use -the set method with keyword arguments. For example:

    -
    o.set(alpha=0.5, zorder=2)
    -
    -
    -

    If you are working interactively at the python shell, a handy way to -inspect the Artist properties is to use the -matplotlib.artist.getp() function (simply -getp() in pylab), which lists the properties -and their values. This works for classes derived from Artist as -well, e.g., Figure and Rectangle. Here are the Figure rectangle -properties mentioned above:

    -
    In [149]: matplotlib.artist.getp(fig.patch)
    -    alpha = 1.0
    -    animated = False
    -    antialiased or aa = True
    -    axes = None
    -    clip_box = None
    -    clip_on = False
    -    clip_path = None
    -    contains = None
    -    edgecolor or ec = w
    -    facecolor or fc = 0.75
    -    figure = Figure(8.125x6.125)
    -    fill = 1
    -    hatch = None
    -    height = 1
    -    label =
    -    linewidth or lw = 1.0
    -    picker = None
    -    transform = <Affine object at 0x134cca84>
    -    verts = ((0, 0), (0, 1), (1, 1), (1, 0))
    -    visible = True
    -    width = 1
    -    window_extent = <Bbox object at 0x134acbcc>
    -    x = 0
    -    y = 0
    -    zorder = 1
    -
    -
    -

    The docstrings for all of the classes also contain the Artist -properties, so you can consult the interactive “help” or the -artist Module for a listing of properties for a given object.

    -
    -
    -

    Object containers

    -

    Now that we know how to inspect and set the properties of a given -object we want to configure, we need to know how to get at that object. -As mentioned in the introduction, there are two kinds of objects: -primitives and containers. The primitives are usually the things you -want to configure (the font of a Text -instance, the width of a Line2D) although -the containers also have some properties as well – for example the -Axes Artist is a -container that contains many of the primitives in your plot, but it -also has properties like the xscale to control whether the xaxis -is ‘linear’ or ‘log’. In this section we’ll review where the various -container objects store the Artists that you want to get at.

    -
    -
    -

    Figure container

    -

    The top level container Artist is the -matplotlib.figure.Figure, and it contains everything in the -figure. The background of the figure is a -Rectangle which is stored in -Figure.patch. As -you add subplots (add_subplot()) and -axes (add_axes()) to the figure -these will be appended to the Figure.axes. These are also returned by the -methods that create them:

    -
    In [156]: fig = plt.figure()
    -
    -In [157]: ax1 = fig.add_subplot(211)
    -
    -In [158]: ax2 = fig.add_axes([0.1, 0.1, 0.7, 0.3])
    -
    -In [159]: ax1
    -Out[159]: <matplotlib.axes.Subplot instance at 0xd54b26c>
    -
    -In [160]: print fig.axes
    -[<matplotlib.axes.Subplot instance at 0xd54b26c>, <matplotlib.axes.Axes instance at 0xd3f0b2c>]
    -
    -
    -

    Because the figure maintains the concept of the “current axes” (see -Figure.gca and -Figure.sca) to support the -pylab/pyplot state machine, you should not insert or remove axes -directly from the axes list, but rather use the -add_subplot() and -add_axes() methods to insert, and the -delaxes() method to delete. You are -free however, to iterate over the list of axes or index into it to get -access to Axes instances you want to customize. Here is an -example which turns all the axes grids on:

    -
    for ax in fig.axes:
    -    ax.grid(True)
    -
    -
    -

    The figure also has its own text, lines, patches and images, which you -can use to add primitives directly. The default coordinate system for -the Figure will simply be in pixels (which is not usually what you -want) but you can control this by setting the transform property of -the Artist you are adding to the figure.

    -

    More useful is “figure coordinates” where (0, 0) is the bottom-left of -the figure and (1, 1) is the top-right of the figure which you can -obtain by setting the Artist transform to fig.transFigure:

    -
    In [191]: fig = plt.figure()
    -
    -In [192]: l1 = matplotlib.lines.Line2D([0, 1], [0, 1],
    -           transform=fig.transFigure, figure=fig)
    -
    -In [193]: l2 = matplotlib.lines.Line2D([0, 1], [1, 0],
    -           transform=fig.transFigure, figure=fig)
    -
    -In [194]: fig.lines.extend([l1, l2])
    -
    -In [195]: fig.canvas.draw()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/fig_x.png -
    -

    Here is a summary of the Artists the figure contains

    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Figure attributeDescription
    axesA list of Axes instances (includes Subplot)
    patchThe Rectangle background
    imagesA list of FigureImages patches - useful for raw pixel display
    legendsA list of Figure Legend instances (different from Axes.legends)
    linesA list of Figure Line2D instances (rarely used, see Axes.lines)
    patchesA list of Figure patches (rarely used, see Axes.patches)
    textsA list Figure Text instances
    -
    -
    -

    Axes container

    -

    The matplotlib.axes.Axes is the center of the matplotlib -universe – it contains the vast majority of all the Artists used -in a figure with many helper methods to create and add these -Artists to itself, as well as helper methods to access and -customize the Artists it contains. Like the -Figure, it contains a -Patch -patch which is a -Rectangle for Cartesian coordinates and a -Circle for polar coordinates; this patch -determines the shape, background and border of the plotting region:

    -
    ax = fig.add_subplot(111)
    -rect = ax.patch  # a Rectangle instance
    -rect.set_facecolor('green')
    -
    -
    -

    When you call a plotting method, e.g., the canonical -plot() and pass in arrays or lists of -values, the method will create a matplotlib.lines.Line2D() -instance, update the line with all the Line2D properties passed as -keyword arguments, add the line to the Axes.lines container, and returns it to you:

    -
    In [213]: x, y = np.random.rand(2, 100)
    -
    -In [214]: line, = ax.plot(x, y, '-', color='blue', linewidth=2)
    -
    -
    -

    plot returns a list of lines because you can pass in multiple x, y -pairs to plot, and we are unpacking the first element of the length -one list into the line variable. The line has been added to the -Axes.lines list:

    -
    In [229]: print ax.lines
    -[<matplotlib.lines.Line2D instance at 0xd378b0c>]
    -
    -
    -

    Similarly, methods that create patches, like -bar() creates a list of rectangles, will -add the patches to the Axes.patches list:

    -
    In [233]: n, bins, rectangles = ax.hist(np.random.randn(1000), 50, facecolor='yellow')
    -
    -In [234]: rectangles
    -Out[234]: <a list of 50 Patch objects>
    -
    -In [235]: print len(ax.patches)
    -
    -
    -

    You should not add objects directly to the Axes.lines or -Axes.patches lists unless you know exactly what you are doing, -because the Axes needs to do a few things when it creates and adds -an object. It sets the figure and axes property of the Artist, as -well as the default Axes transformation (unless a transformation -is set). It also inspects the data contained in the Artist to -update the data structures controlling auto-scaling, so that the view -limits can be adjusted to contain the plotted data. You can, -nonetheless, create objects yourself and add them directly to the -Axes using helper methods like -add_line() and -add_patch(). Here is an annotated -interactive session illustrating what is going on:

    -
    In [261]: fig = plt.figure()
    -
    -In [262]: ax = fig.add_subplot(111)
    -
    -# create a rectangle instance
    -In [263]: rect = matplotlib.patches.Rectangle( (1,1), width=5, height=12)
    -
    -# by default the axes instance is None
    -In [264]: print rect.get_axes()
    -None
    -
    -# and the transformation instance is set to the "identity transform"
    -In [265]: print rect.get_transform()
    -<Affine object at 0x13695544>
    -
    -# now we add the Rectangle to the Axes
    -In [266]: ax.add_patch(rect)
    -
    -# and notice that the ax.add_patch method has set the axes
    -# instance
    -In [267]: print rect.get_axes()
    -Axes(0.125,0.1;0.775x0.8)
    -
    -# and the transformation has been set too
    -In [268]: print rect.get_transform()
    -<Affine object at 0x15009ca4>
    -
    -# the default axes transformation is ax.transData
    -In [269]: print ax.transData
    -<Affine object at 0x15009ca4>
    -
    -# notice that the xlimits of the Axes have not been changed
    -In [270]: print ax.get_xlim()
    -(0.0, 1.0)
    -
    -# but the data limits have been updated to encompass the rectangle
    -In [271]: print ax.dataLim.bounds
    -(1.0, 1.0, 5.0, 12.0)
    -
    -# we can manually invoke the auto-scaling machinery
    -In [272]: ax.autoscale_view()
    -
    -# and now the xlim are updated to encompass the rectangle
    -In [273]: print ax.get_xlim()
    -(1.0, 6.0)
    -
    -# we have to manually force a figure draw
    -In [274]: ax.figure.canvas.draw()
    -
    -
    -

    There are many, many Axes helper methods for creating primitive -Artists and adding them to their respective containers. The table -below summarizes a small sampling of them, the kinds of Artist they -create, and where they store them

    - ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Helper methodArtistContainer
    ax.annotate - text annotationsAnnotateax.texts
    ax.bar - bar chartsRectangleax.patches
    ax.errorbar - error bar plotsLine2D and Rectangleax.lines and ax.patches
    ax.fill - shared areaPolygonax.patches
    ax.hist - histogramsRectangleax.patches
    ax.imshow - image dataAxesImageax.images
    ax.legend - axes legendsLegendax.legends
    ax.plot - xy plotsLine2Dax.lines
    ax.scatter - scatter chartsPolygonCollectionax.collections
    ax.text - textTextax.texts
    -

    In addition to all of these Artists, the Axes contains two -important Artist containers: the XAxis -and YAxis, which handle the drawing of the -ticks and labels. These are stored as instance variables -xaxis and -yaxis. The XAxis and YAxis -containers will be detailed below, but note that the Axes contains -many helper methods which forward calls on to the -Axis instances so you often do not need to -work with them directly unless you want to. For example, you can set -the font color of the XAxis ticklabels using the Axes helper -method:

    -
    for label in ax.get_xticklabels():
    -    label.set_color('orange')
    -
    -
    -

    Below is a summary of the Artists that the Axes contains

    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Axes attributeDescription
    artistsA list of Artist instances
    patchRectangle instance for Axes background
    collectionsA list of Collection instances
    imagesA list of AxesImage
    legendsA list of Legend instances
    linesA list of Line2D instances
    patchesA list of Patch instances
    textsA list of Text instances
    xaxismatplotlib.axis.XAxis instance
    yaxismatplotlib.axis.YAxis instance
    -
    -
    -

    Axis containers

    -

    The matplotlib.axis.Axis instances handle the drawing of the -tick lines, the grid lines, the tick labels and the axis label. You -can configure the left and right ticks separately for the y-axis, and -the upper and lower ticks separately for the x-axis. The Axis -also stores the data and view intervals used in auto-scaling, panning -and zooming, as well as the Locator and -Formatter instances which control where -the ticks are placed and how they are represented as strings.

    -

    Each Axis object contains a label attribute -(this is what pylab modifies in calls to -xlabel() and ylabel()) as well -as a list of major and minor ticks. The ticks are -XTick and YTick instances, -which contain the actual line and text primitives that render the ticks and -ticklabels. Because the ticks are dynamically created as needed (e.g., when -panning and zooming), you should access the lists of major and minor ticks -through their accessor methods get_major_ticks() -and get_minor_ticks(). Although the ticks contain -all the primitives and will be covered below, Axis instances have accessor -methods that return the tick lines, tick labels, tick locations etc.:

    -
    In [285]: axis = ax.xaxis
    -
    -In [286]: axis.get_ticklocs()
    -Out[286]: array([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9.])
    -
    -In [287]: axis.get_ticklabels()
    -Out[287]: <a list of 10 Text major ticklabel objects>
    -
    -# note there are twice as many ticklines as labels because by
    -#  default there are tick lines at the top and bottom but only tick
    -#  labels below the xaxis; this can be customized
    -In [288]: axis.get_ticklines()
    -Out[288]: <a list of 20 Line2D ticklines objects>
    -
    -# by default you get the major ticks back
    -In [291]: axis.get_ticklines()
    -Out[291]: <a list of 20 Line2D ticklines objects>
    -
    -# but you can also ask for the minor ticks
    -In [292]: axis.get_ticklines(minor=True)
    -Out[292]: <a list of 0 Line2D ticklines objects>
    -
    -
    -

    Here is a summary of some of the useful accessor methods of the Axis -(these have corresponding setters where useful, such as -set_major_formatter)

    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Accessor methodDescription
    get_scaleThe scale of the axis, e.g., ‘log’ or ‘linear’
    get_view_intervalThe interval instance of the axis view limits
    get_data_intervalThe interval instance of the axis data limits
    get_gridlinesA list of grid lines for the Axis
    get_labelThe axis label - a Text instance
    get_ticklabelsA list of Text instances - keyword minor=True|False
    get_ticklinesA list of Line2D instances - keyword minor=True|False
    get_ticklocsA list of Tick locations - keyword minor=True|False
    get_major_locatorThe matplotlib.ticker.Locator instance for major ticks
    get_major_formatterThe matplotlib.ticker.Formatter instance for major ticks
    get_minor_locatorThe matplotlib.ticker.Locator instance for minor ticks
    get_minor_formatterThe matplotlib.ticker.Formatter instance for minor ticks
    get_major_ticksA list of Tick instances for major ticks
    get_minor_ticksA list of Tick instances for minor ticks
    gridTurn the grid on or off for the major or minor ticks
    -

    Here is an example, not recommended for its beauty, which customizes -the axes and tick properties

    -
    import numpy as np
    -import matplotlib.pyplot as plt
    -
    -# plt.figure creates a matplotlib.figure.Figure instance
    -fig = plt.figure()
    -rect = fig.patch # a rectangle instance
    -rect.set_facecolor('lightgoldenrodyellow')
    -
    -ax1 = fig.add_axes([0.1, 0.3, 0.4, 0.4])
    -rect = ax1.patch
    -rect.set_facecolor('lightslategray')
    -
    -
    -for label in ax1.xaxis.get_ticklabels():
    -    # label is a Text instance
    -    label.set_color('red')
    -    label.set_rotation(45)
    -    label.set_fontsize(16)
    -
    -for line in ax1.yaxis.get_ticklines():
    -    # line is a Line2D instance
    -    line.set_color('green')
    -    line.set_markersize(25)
    -    line.set_markeredgewidth(3)
    -
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/fig_axes_customize_simple.png -
    -
    -
    -

    Tick containers

    -

    The matplotlib.axis.Tick is the final container object in our -descent from the Figure to the -Axes to the Axis -to the Tick. The Tick contains the tick -and grid line instances, as well as the label instances for the upper -and lower ticks. Each of these is accessible directly as an attribute -of the Tick. In addition, there are boolean variables that determine -whether the upper labels and ticks are on for the x-axis and whether -the right labels and ticks are on for the y-axis.

    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Tick attributeDescription
    tick1lineLine2D instance
    tick2lineLine2D instance
    gridlineLine2D instance
    label1Text instance
    label2Text instance
    gridOnboolean which determines whether to draw the gridline
    tick1Onboolean which determines whether to draw the 1st tickline
    tick2Onboolean which determines whether to draw the 2nd tickline
    label1Onboolean which determines whether to draw the 1st tick label
    label2Onboolean which determines whether to draw the 2nd tick label
    -

    Here is an example which sets the formatter for the right side ticks with -dollar signs and colors them green on the right side of the yaxis

    -
    import numpy as np
    -import matplotlib.pyplot as plt
    -import matplotlib.ticker as ticker
    -
    -# Fixing random state for reproducibility
    -np.random.seed(19680801)
    -
    -fig = plt.figure()
    -ax = fig.add_subplot(111)
    -ax.plot(100*np.random.rand(20))
    -
    -formatter = ticker.FormatStrFormatter('$%1.2f')
    -ax.yaxis.set_major_formatter(formatter)
    -
    -for tick in ax.yaxis.get_major_ticks():
    -    tick.label1On = False
    -    tick.label2On = True
    -    tick.label2.set_color('green')
    -
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/dollar_ticks.png -
    -
    -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/users/color_index.html b/users/color_index.html deleted file mode 100644 index 94bdecf0b42..00000000000 --- a/users/color_index.html +++ /dev/null @@ -1,355 +0,0 @@ - - - - - - - - Colors — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -
    -

    This Page

    - -
    - - -
    -
    - - - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/users/colormapnorms.html b/users/colormapnorms.html deleted file mode 100644 index f883645c2c1..00000000000 --- a/users/colormapnorms.html +++ /dev/null @@ -1,638 +0,0 @@ - - - - - - - - Colormap Normalization — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -

    Table Of Contents

    - -
    -

    Related Topics

    - -
    -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    Colormap Normalization

    -

    Objects that use colormaps by default linearly map the colors in the -colormap from data values vmin to vmax. For example:

    -
    pcm = ax.pcolormesh(x, y, Z, vmin=-1., vmax=1., cmap='RdBu_r')
    -
    -
    -

    will map the data in Z linearly from -1 to +1, so Z=0 will -give a color at the center of the colormap RdBu_r (white in this -case).

    -

    Matplotlib does this mapping in two steps, with a normalization from -[0,1] occurring first, and then mapping onto the indices in the -colormap. Normalizations are classes defined in the -matplotlib.colors() module. The default, linear normalization is -matplotlib.colors.Normalize().

    -

    Artists that map data to color pass the arguments vmin and vmax to -construct a matplotlib.colors.Normalize() instance, then call it:

    -
    In [1]: import matplotlib as mpl
    -
    -In [2]: norm = mpl.colors.Normalize(vmin=-1.,vmax=1.)
    -
    -In [3]: norm(0.)
    -Out[3]: 0.5
    -
    -
    -

    However, there are sometimes cases where it is useful to map data to -colormaps in a non-linear fashion.

    -
    -

    Logarithmic

    -

    One of the most common transformations is to plot data by taking -its logarithm (to the base-10). This transformation is useful to -display changes across disparate scales. Using colors.LogNorm() -normalizes the data via . In the example below, -there are two bumps, one much smaller than the other. Using -colors.LogNorm(), the shape and location of each bump can clearly -be seen:

    -
    """
    -Demonstration of using norm to map colormaps onto data in non-linear ways.
    -"""
    -
    -import numpy as np
    -import matplotlib.pyplot as plt
    -import matplotlib.colors as colors
    -from matplotlib.mlab import bivariate_normal
    -
    -'''
    -Lognorm: Instead of pcolor log10(Z1) you can have colorbars that have
    -the exponential labels using a norm.
    -'''
    -N = 100
    -X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)]
    -
    -# A low hump with a spike coming out of the top right.  Needs to have
    -# z/colour axis on a log scale so we see both hump and spike.  linear
    -# scale only shows the spike.
    -Z1 = bivariate_normal(X, Y, 0.1, 0.2, 1.0, 1.0) +  \
    -    0.1 * bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
    -
    -fig, ax = plt.subplots(2, 1)
    -
    -pcm = ax[0].pcolor(X, Y, Z1,
    -                   norm=colors.LogNorm(vmin=Z1.min(), vmax=Z1.max()),
    -                   cmap='PuBu_r')
    -fig.colorbar(pcm, ax=ax[0], extend='max')
    -
    -pcm = ax[1].pcolor(X, Y, Z1, cmap='PuBu_r')
    -fig.colorbar(pcm, ax=ax[1], extend='max')
    -fig.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/colormap_normalizations_lognorm.png -
    -
    -
    -

    Symmetric logarithmic

    -

    Similarly, it sometimes happens that there is data that is positive -and negative, but we would still like a logarithmic scaling applied to -both. In this case, the negative numbers are also scaled -logarithmically, and mapped to smaller numbers; e.g., if vmin=-vmax, -then they the negative numbers are mapped from 0 to 0.5 and the -positive from 0.5 to 1.

    -

    Since the logarithm of values close to zero tends toward infinity, a -small range around zero needs to be mapped linearly. The parameter -linthresh allows the user to specify the size of this range -(-linthresh, linthresh). The size of this range in the colormap is -set by linscale. When linscale == 1.0 (the default), the space used -for the positive and negative halves of the linear range will be equal -to one decade in the logarithmic range.

    -
    """
    -Demonstration of using norm to map colormaps onto data in non-linear ways.
    -"""
    -
    -import numpy as np
    -import matplotlib.pyplot as plt
    -import matplotlib.colors as colors
    -from matplotlib.mlab import bivariate_normal
    -
    -"""
    -SymLogNorm: two humps, one negative and one positive, The positive
    -with 5-times the amplitude. Linearly, you cannot see detail in the
    -negative hump.  Here we logarithmically scale the positive and
    -negative data separately.
    -
    -Note that colorbar labels do not come out looking very good.
    -"""
    -N=100
    -X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)]
    -Z1 = (bivariate_normal(X, Y, 1., 1., 1.0, 1.0))**2  \
    -    - 0.4 * (bivariate_normal(X, Y, 1.0, 1.0, -1.0, 0.0))**2
    -Z1 = Z1/0.03
    -
    -fig, ax = plt.subplots(2, 1)
    -
    -pcm = ax[0].pcolormesh(X, Y, Z1,
    -                       norm=colors.SymLogNorm(linthresh=0.03, linscale=0.03,
    -                                              vmin=-1.0, vmax=1.0),
    -                       cmap='RdBu_r')
    -fig.colorbar(pcm, ax=ax[0], extend='both')
    -
    -pcm = ax[1].pcolormesh(X, Y, Z1, cmap='RdBu_r', vmin=-np.max(Z1))
    -fig.colorbar(pcm, ax=ax[1], extend='both')
    -fig.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/colormap_normalizations_symlognorm.png -
    -
    -
    -

    Power-law

    -

    Sometimes it is useful to remap the colors onto a power-law -relationship (i.e. , where is the -power). For this we use the colors.PowerNorm(). It takes as an -argument gamma (gamma == 1.0 will just yield the default linear -normalization):

    -
    -

    Note

    -

    There should probably be a good reason for plotting the data using -this type of transformation. Technical viewers are used to linear -and logarithmic axes and data transformations. Power laws are less -common, and viewers should explicitly be made aware that they have -been used.

    -
    -
    """
    -Demonstration of using norm to map colormaps onto data in non-linear ways.
    -"""
    -
    -import numpy as np
    -import matplotlib.pyplot as plt
    -import matplotlib.colors as colors
    -from matplotlib.mlab import bivariate_normal
    -
    -N = 100
    -X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)]
    -
    -'''
    -PowerNorm: Here a power-law trend in X partially obscures a rectified
    -sine wave in Y. We can remove the power law using a PowerNorm.
    -'''
    -X, Y = np.mgrid[0:3:complex(0, N), 0:2:complex(0, N)]
    -Z1 = (1 + np.sin(Y * 10.)) * X**(2.)
    -
    -fig, ax = plt.subplots(2, 1)
    -
    -pcm = ax[0].pcolormesh(X, Y, Z1, norm=colors.PowerNorm(gamma=1./2.),
    -                       cmap='PuBu_r')
    -fig.colorbar(pcm, ax=ax[0], extend='max')
    -
    -pcm = ax[1].pcolormesh(X, Y, Z1, cmap='PuBu_r')
    -fig.colorbar(pcm, ax=ax[1], extend='max')
    -fig.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/colormap_normalizations_power.png -
    -
    -
    -

    Discrete bounds

    -

    Another normaization that comes with matplolib is -colors.BoundaryNorm(). In addition to vmin and vmax, this -takes as arguments boundaries between which data is to be mapped. The -colors are then linearly distributed between these “bounds”. For -instance:

    -
    In [4]: import matplotlib.colors as colors
    -
    -In [5]: bounds = np.array([-0.25, -0.125, 0, 0.5, 1])
    -
    -In [6]: norm = colors.BoundaryNorm(boundaries=bounds, ncolors=4)
    -
    -In [7]: print(norm([-0.2,-0.15,-0.02, 0.3, 0.8, 0.99]))
    -[0 0 1 2 3 3]
    -
    -
    -

    Note unlike the other norms, this norm returns values from 0 to ncolors-1.

    -
    """
    -Demonstration of using norm to map colormaps onto data in non-linear ways.
    -"""
    -
    -import numpy as np
    -import matplotlib.pyplot as plt
    -import matplotlib.colors as colors
    -from matplotlib.mlab import bivariate_normal
    -
    -N = 100
    -X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)]
    -Z1 = (bivariate_normal(X, Y, 1., 1., 1.0, 1.0))**2  \
    -    - 0.4 * (bivariate_normal(X, Y, 1.0, 1.0, -1.0, 0.0))**2
    -Z1 = Z1/0.03
    -
    -'''
    -BoundaryNorm: For this one you provide the boundaries for your colors,
    -and the Norm puts the first color in between the first pair, the
    -second color between the second pair, etc.
    -'''
    -
    -fig, ax = plt.subplots(3, 1, figsize=(8, 8))
    -ax = ax.flatten()
    -# even bounds gives a contour-like effect
    -bounds = np.linspace(-1, 1, 10)
    -norm = colors.BoundaryNorm(boundaries=bounds, ncolors=256)
    -pcm = ax[0].pcolormesh(X, Y, Z1,
    -                       norm=norm,
    -                       cmap='RdBu_r')
    -fig.colorbar(pcm, ax=ax[0], extend='both', orientation='vertical')
    -
    -# uneven bounds changes the colormapping:
    -bounds = np.array([-0.25, -0.125, 0, 0.5, 1])
    -norm = colors.BoundaryNorm(boundaries=bounds, ncolors=256)
    -pcm = ax[1].pcolormesh(X, Y, Z1, norm=norm, cmap='RdBu_r')
    -fig.colorbar(pcm, ax=ax[1], extend='both', orientation='vertical')
    -
    -pcm = ax[2].pcolormesh(X, Y, Z1, cmap='RdBu_r', vmin=-np.max(Z1))
    -fig.colorbar(pcm, ax=ax[2], extend='both', orientation='vertical')
    -fig.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/colormap_normalizations_bounds.png -
    -
    -
    -

    Custom normalization: Two linear ranges

    -

    It is possible to define your own normalization. In the following -example, we modify colors:SymLogNorm() to use different linear -maps for the negative data values and the positive. (Note that this -example is simple, and does not validate inputs or account for complex -cases such as masked data)

    -
    -

    Note

    -

    This may appear soon as colors.OffsetNorm().

    -

    As above, non-symmetric mapping of data to color is non-standard -practice for quantitative data, and should only be used advisedly. A -practical example is having an ocean/land colormap where the land and -ocean data span different ranges.

    -
    -
    """
    -Demonstration of using norm to map colormaps onto data in non-linear ways.
    -"""
    -
    -import numpy as np
    -import matplotlib.pyplot as plt
    -import matplotlib.colors as colors
    -from matplotlib.mlab import bivariate_normal
    -
    -N = 100
    -'''
    -Custom Norm: An example with a customized normalization.  This one
    -uses the example above, and normalizes the negative data differently
    -from the positive.
    -'''
    -X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)]
    -Z1 = (bivariate_normal(X, Y, 1., 1., 1.0, 1.0))**2  \
    -    - 0.4 * (bivariate_normal(X, Y, 1.0, 1.0, -1.0, 0.0))**2
    -Z1 = Z1/0.03
    -
    -# Example of making your own norm.  Also see matplotlib.colors.
    -# From Joe Kington: This one gives two different linear ramps:
    -
    -
    -class MidpointNormalize(colors.Normalize):
    -    def __init__(self, vmin=None, vmax=None, midpoint=None, clip=False):
    -        self.midpoint = midpoint
    -        colors.Normalize.__init__(self, vmin, vmax, clip)
    -
    -    def __call__(self, value, clip=None):
    -        # I'm ignoring masked values and all kinds of edge cases to make a
    -        # simple example...
    -        x, y = [self.vmin, self.midpoint, self.vmax], [0, 0.5, 1]
    -        return np.ma.masked_array(np.interp(value, x, y))
    -#####
    -fig, ax = plt.subplots(2, 1)
    -
    -pcm = ax[0].pcolormesh(X, Y, Z1,
    -                       norm=MidpointNormalize(midpoint=0.),
    -                       cmap='RdBu_r')
    -fig.colorbar(pcm, ax=ax[0], extend='both')
    -
    -pcm = ax[1].pcolormesh(X, Y, Z1, cmap='RdBu_r', vmin=-np.max(Z1))
    -fig.colorbar(pcm, ax=ax[1], extend='both')
    -fig.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/colormap_normalizations_custom.png -
    -
    -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/users/colormaps.html b/users/colormaps.html deleted file mode 100644 index 9588c946e88..00000000000 --- a/users/colormaps.html +++ /dev/null @@ -1,604 +0,0 @@ - - - - - - - - Choosing Colormaps — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -

    Table Of Contents

    - -
    -

    Related Topics

    - -
    -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    Choosing Colormaps

    -
    -

    Overview

    -

    The idea behind choosing a good colormap is to find a good representation in 3D -colorspace for your data set. The best colormap for any given data set depends -on many things including:

    -
      -
    • Whether representing form or metric data ([Ware])
    • -
    • Your knowledge of the data set (e.g., is there a critical value -from which the other values deviate?)
    • -
    • If there is an intuitive color scheme for the parameter you are plotting
    • -
    • If there is a standard in the field the audience may be expecting
    • -
    -

    For many applications, a perceptually uniform colormap is the best -choice — one in which equal steps in data are perceived as equal -steps in the color space. Researchers have found that the human brain -perceives changes in the lightness parameter as changes in the data -much better than, for example, changes in hue. Therefore, colormaps -which have monotonically increasing lightness through the colormap -will be better interpreted by the viewer. A wonderful example of -perceptually uniform colormaps is [colorcet].

    -

    Color can be represented in 3D space in various ways. One way to represent color -is using CIELAB. In CIELAB, color space is represented by lightness, -; red-green, ; and yellow-blue, . The lightness -parameter can then be used to learn more about how the matplotlib -colormaps will be perceived by viewers.

    -

    An excellent starting resource for learning about human perception of colormaps -is from [IBM].

    -
    -
    -

    Classes of colormaps

    -

    Colormaps are often split into several categories based on their function (see, -e.g., [Moreland]):

    -
      -
    1. Sequential: change in lightness and often saturation of color -incrementally, often using a single hue; should be used for -representing information that has ordering.
    2. -
    3. Diverging: change in lightness and possibly saturation of two -different colors that meet in the middle at an unsaturated color; -should be used when the information being plotted has a critical -middle value, such as topography or when the data deviates around -zero.
    4. -
    5. Qualitative: often are miscellaneous colors; should be used to -represent information which does not have ordering or -relationships.
    6. -
    -
    -
    -

    Lightness of matplotlib colormaps

    -

    Here we examine the lightness values of the matplotlib colormaps. Note that some -documentation on the colormaps is available ([list-colormaps]).

    -
    -

    Sequential

    -

    For the Sequential plots, the lightness value increases monotonically through -the colormaps. This is good. Some of the values in the colormaps -span from 0 to 100 (binary and the other grayscale), and others start around -. Those that have a smaller range of will accordingly -have a smaller perceptual range. Note also that the function varies -amongst the colormaps: some are approximately linear in and others -are more curved.

    -
    -
    -

    Sequential2

    -

    Many of the values from the Sequential2 plots are monotonically -increasing, but some (autumn, cool, spring, and winter) plateau or even go both -up and down in space. Others (afmhot, copper, gist_heat, and hot) -have kinks in the functions. Data that is being represented in a -region of the colormap that is at a plateau or kink will lead to a perception of -banding of the data in those values in the colormap (see [mycarta-banding] for -an excellent example of this).

    -
    -
    -

    Diverging

    -

    For the Diverging maps, we want to have monotonically increasing -values up to a maximum, which should be close to , followed by -monotonically decreasing values. We are looking for approximately -equal minimum values at opposite ends of the colormap. By these -measures, BrBG and RdBu are good options. coolwarm is a good option, but it -doesn’t span a wide range of values (see grayscale section below).

    -
    -
    -

    Qualitative

    -

    Qualitative colormaps are not aimed at being perceptual maps, but looking at the -lightness parameter can verify that for us. The values move all over -the place throughout the colormap, and are clearly not monotonically increasing. -These would not be good options for use as perceptual colormaps.

    -
    -
    -

    Miscellaneous

    -

    Some of the miscellaneous colormaps have particular uses for which -they have been created. For example, gist_earth, ocean, and terrain -all seem to be created for plotting topography (green/brown) and water -depths (blue) together. We would expect to see a divergence in these -colormaps, then, but multiple kinks may not be ideal, such as in -gist_earth and terrain. CMRmap was created to convert well to -grayscale, though it does appear to have some small kinks in -. cubehelix was created to vary smoothly in both lightness -and hue, but appears to have a small hump in the green hue area.

    -

    The often-used jet colormap is included in this set of colormaps. We can see -that the values vary widely throughout the colormap, making it a -poor choice for representing data for viewers to see perceptually. See an -extension on this idea at [mycarta-jet].

    -

    (Source code)

    -
    -../_images/lightness_00.png -

    (png, pdf)

    -
    -
    -../_images/lightness_01.png -

    (png, pdf)

    -
    -
    -../_images/lightness_02.png -

    (png, pdf)

    -
    -
    -../_images/lightness_03.png -

    (png, pdf)

    -
    -
    -../_images/lightness_04.png -

    (png, pdf)

    -
    -
    -../_images/lightness_05.png -

    (png, pdf)

    -
    -
    -
    -
    -

    Grayscale conversion

    -

    It is important to pay attention to conversion to grayscale for color -plots, since they may be printed on black and white printers. If not -carefully considered, your readers may end up with indecipherable -plots because the grayscale changes unpredictably through the -colormap.

    -

    Conversion to grayscale is done in many different ways [bw]. Some of the better -ones use a linear combination of the rgb values of a pixel, but weighted -according to how we perceive color intensity. A nonlinear method of conversion -to grayscale is to use the values of the pixels. In general, similar -principles apply for this question as they do for presenting one’s information -perceptually; that is, if a colormap is chosen that is monotonically increasing -in values, it will print in a reasonable manner to grayscale.

    -

    With this in mind, we see that the Sequential colormaps have reasonable -representations in grayscale. Some of the Sequential2 colormaps have decent -enough grayscale representations, though some (autumn, spring, summer, winter) -have very little grayscale change. If a colormap like this was used in a plot -and then the plot was printed to grayscale, a lot of the information may map to -the same gray values. The Diverging colormaps mostly vary from darker gray on -the outer edges to white in the middle. Some (PuOr and seismic) have noticably -darker gray on one side than the other and therefore are not very symmetric. -coolwarm has little range of gray scale and would print to a more uniform plot, -losing a lot of detail. Note that overlaid, labeled contours could help -differentiate between one side of the colormap vs. the other since color cannot -be used once a plot is printed to grayscale. Many of the Qualitative and -Miscellaneous colormaps, such as Accent, hsv, and jet, change from darker to -lighter and back to darker gray throughout the colormap. This would make it -impossible for a viewer to interpret the information in a plot once it is -printed in grayscale.

    -

    (Source code)

    -
    -../_images/grayscale_01_00.png -

    (png, pdf)

    -
    -
    -../_images/grayscale_01_01.png -

    (png, pdf)

    -
    -
    -../_images/grayscale_01_02.png -

    (png, pdf)

    -
    -
    -../_images/grayscale_01_03.png -

    (png, pdf)

    -
    -
    -../_images/grayscale_01_04.png -

    (png, pdf)

    -
    -
    -../_images/grayscale_01_05.png -

    (png, pdf)

    -
    -
    -
    -

    Color vision deficiencies

    -

    There is a lot of information available about color blindness (e.g., -[colorblindness]). Additionally, there are tools available to convert images to -how they look for different types of color vision deficiencies (e.g., -[vischeck]).

    -

    The most common form of color vision deficiency involves differentiating between -red and green. Thus, avoiding colormaps with both red and green will avoid many -problems in general.

    -
    - -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/users/colors-1.py b/users/colors-1.py deleted file mode 100644 index 8ae315703e3..00000000000 --- a/users/colors-1.py +++ /dev/null @@ -1,17 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -import matplotlib as mpl -th = np.linspace(0, 2*np.pi, 128) - -def demo(sty): - mpl.style.use(sty) - fig, ax = plt.subplots(figsize=(3, 3)) - - ax.set_title('style: {!r}'.format(sty), color='C0') - - ax.plot(th, np.cos(th), 'C1', label='C1') - ax.plot(th, np.sin(th), 'C2', label='C2') - ax.legend() - -demo('default') -demo('seaborn') \ No newline at end of file diff --git a/users/colors-1_00.pdf b/users/colors-1_00.pdf deleted file mode 100644 index 5059611b0a8..00000000000 Binary files a/users/colors-1_00.pdf and /dev/null differ diff --git a/users/colors-1_00.png b/users/colors-1_00.png deleted file mode 100644 index 3c7c773d035..00000000000 Binary files a/users/colors-1_00.png and /dev/null differ diff --git a/users/colors-1_01.pdf b/users/colors-1_01.pdf deleted file mode 100644 index e4fe7129bb4..00000000000 Binary files a/users/colors-1_01.pdf and /dev/null differ diff --git a/users/colors-1_01.png b/users/colors-1_01.png deleted file mode 100644 index c7cb3cb1654..00000000000 Binary files a/users/colors-1_01.png and /dev/null differ diff --git a/users/colors-2.pdf b/users/colors-2.pdf deleted file mode 100644 index 6684910f97f..00000000000 Binary files a/users/colors-2.pdf and /dev/null differ diff --git a/users/colors-2.png b/users/colors-2.png deleted file mode 100644 index 208ab714262..00000000000 Binary files a/users/colors-2.png and /dev/null differ diff --git a/users/colors-2.py b/users/colors-2.py deleted file mode 100644 index 4677fc66296..00000000000 --- a/users/colors-2.py +++ /dev/null @@ -1,30 +0,0 @@ -import matplotlib.pyplot as plt -import matplotlib._color_data as mcd -import matplotlib.patches as mpatch - -overlap = {name for name in mcd.CSS4_COLORS - if "xkcd:" + name in mcd.XKCD_COLORS} - -fig = plt.figure(figsize=[4.8, 16]) -ax = fig.add_axes([0, 0, 1, 1]) - -for j, n in enumerate(sorted(overlap, reverse=True)): - weight = None - cn = mcd.CSS4_COLORS[n] - xkcd = mcd.XKCD_COLORS["xkcd:" + n].upper() - if cn == xkcd: - weight = 'bold' - - r1 = mpatch.Rectangle((0, j), 1, 1, color=cn) - r2 = mpatch.Rectangle((1, j), 1, 1, color=xkcd) - txt = ax.text(2, j+.5, ' ' + n, va='center', fontsize=10, - weight=weight) - ax.add_patch(r1) - ax.add_patch(r2) - ax.axhline(j, color='k') - -ax.text(.5, j + 1.5, 'X11', ha='center', va='center') -ax.text(1.5, j + 1.5, 'xkcd', ha='center', va='center') -ax.set_xlim(0, 3) -ax.set_ylim(0, j + 2) -ax.axis('off') \ No newline at end of file diff --git a/users/colors.html b/users/colors.html deleted file mode 100644 index 1907bb2f95a..00000000000 --- a/users/colors.html +++ /dev/null @@ -1,402 +0,0 @@ - - - - - - - - Specifying Colors — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -

    Table Of Contents

    - -
    -

    Related Topics

    - -
    -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    Specifying Colors

    -

    In almost all places in matplotlib where a color can be specified by the user -it can be provided as:

    -
      -
    • an RGB or RGBA tuple of float values in [0, 1] -(e.g., (0.1, 0.2, 0.5) or (0.1, 0.2, 0.5, 0.3))
    • -
    • a hex RGB or RGBA string (e.g., '#0F0F0F' or '#0F0F0F0F')
    • -
    • a string representation of a float value in [0, 1] -inclusive for gray level (e.g., '0.5')
    • -
    • one of {'b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'}
    • -
    • a X11/CSS4 color name
    • -
    • a name from the xkcd color survey -prefixed with 'xkcd:' (e.g., 'xkcd:sky blue')
    • -
    • one of {'C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8', 'C9'}
    • -
    • one of {'tab:blue', 'tab:orange', 'tab:green', -'tab:red', 'tab:purple', 'tab:brown', 'tab:pink', -'tab:gray', 'tab:olive', 'tab:cyan'} which are the Tableau Colors from the -‘T10’ categorical palette (which is the default color cycle).
    • -
    -

    All string specifications of color are case-insensitive.

    -
    -

    'CN' color selection

    -

    Color can be specified by a string matching the regex C[0-9]. -This can be passed any place that a color is currently accepted and -can be used as a ‘single character color’ in format-string to -matplotlib.Axes.plot.

    -

    The single digit is the index into the default property cycle -(matplotlib.rcParams['axes.prop_cycle']). If the property cycle does not -include 'color' then black is returned. The color is evaluated when the -artist is created. For example,

    -
    import numpy as np
    -import matplotlib.pyplot as plt
    -import matplotlib as mpl
    -th = np.linspace(0, 2*np.pi, 128)
    -
    -def demo(sty):
    -    mpl.style.use(sty)
    -    fig, ax = plt.subplots(figsize=(3, 3))
    -
    -    ax.set_title('style: {!r}'.format(sty), color='C0')
    -
    -    ax.plot(th, np.cos(th), 'C1', label='C1')
    -    ax.plot(th, np.sin(th), 'C2', label='C2')
    -    ax.legend()
    -
    -demo('default')
    -demo('seaborn')
    -
    -
    -

    (Source code)

    -
    -../_images/colors-1_00.png -

    (png, pdf)

    -
    -
    -../_images/colors-1_01.png -

    (png, pdf)

    -
    -

    will use the first color for the title and then plot using the second -and third colors of each style’s mpl.rcParams['axes.prop_cycle'].

    -
    -
    -

    xkcd v X11/CSS4

    -

    The xkcd colors are derived from a user survey conducted by the -webcomic xkcd. Details of the survey are available on the xkcd blog.

    -

    Out of 148 colors in the CSS color list, there are 95 name collisions -between the X11/CSS4 names and the xkcd names, all but 3 of which have -different hex values. For example 'blue' maps to '#0000FF' -where as 'xkcd:blue' maps to '#0343DF'. Due to these name -collisions all of the xkcd colors have 'xkcd:' prefixed. As noted in -the blog post, while it might be interesting to re-define the X11/CSS4 names -based on such a survey, we do not do so unilaterally.

    -

    The name collisions are shown in the table below; the color names -where the hex values agree are shown in bold.

    -

    (Source code, png, pdf)

    -
    -../_images/colors-2.png -
    -
    -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/users/customizing.html b/users/customizing.html deleted file mode 100644 index 533f5f0fe35..00000000000 --- a/users/customizing.html +++ /dev/null @@ -1,1111 +0,0 @@ - - - - - - - - Customizing matplotlib — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -

    Table Of Contents

    - -
    -

    Related Topics

    - -
    -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    Customizing matplotlib

    -
    -

    Using style sheets

    -

    The style package adds support for easy-to-switch plotting “styles” with -the same parameters as a matplotlibrc file (which is read at startup to -configure matplotlib).

    -

    There are a number of pre-defined styles provided by matplotlib. For -example, there’s a pre-defined style called “ggplot”, which emulates the -aesthetics of ggplot (a popular plotting package for R). To use this style, -just add:

    -
    >>> import matplotlib.pyplot as plt
    ->>> plt.style.use('ggplot')
    -
    -
    -

    To list all available styles, use:

    -
    >>> print(plt.style.available)
    -
    -
    -
    -

    Defining your own style

    -

    You can create custom styles and use them by calling style.use with the -path or URL to the style sheet. Additionally, if you add your -<style-name>.mplstyle file to mpl_configdir/stylelib, you can reuse -your custom style sheet with a call to style.use(<style-name>). By default -mpl_configdir should be ~/.config/matplotlib, but you can check where -yours is with matplotlib.get_configdir(); you may need to create this -directory. You also can change the directory where matplotlib looks for -the stylelib/ folder by setting the MPLCONFIGDIR environment variable, -see matplotlib configuration and cache directory locations.

    -

    Note that a custom style sheet in mpl_configdir/stylelib will -override a style sheet defined by matplotlib if the styles have the same name.

    -

    For example, you might want to create -mpl_configdir/stylelib/presentation.mplstyle with the following:

    -
    axes.titlesize : 24
    -axes.labelsize : 20
    -lines.linewidth : 3
    -lines.markersize : 10
    -xtick.labelsize : 16
    -ytick.labelsize : 16
    -
    -
    -

    Then, when you want to adapt a plot designed for a paper to one that looks -good in a presentation, you can just add:

    -
    >>> import matplotlib.pyplot as plt
    ->>> plt.style.use('presentation')
    -
    -
    -
    -
    -

    Composing styles

    -

    Style sheets are designed to be composed together. So you can have a style -sheet that customizes colors and a separate style sheet that alters element -sizes for presentations. These styles can easily be combined by passing -a list of styles:

    -
    >>> import matplotlib.pyplot as plt
    ->>> plt.style.use(['dark_background', 'presentation'])
    -
    -
    -

    Note that styles further to the right will overwrite values that are already -defined by styles on the left.

    -
    -
    -

    Temporary styling

    -

    If you only want to use a style for a specific block of code but don’t want -to change the global styling, the style package provides a context manager -for limiting your changes to a specific scope. To isolate your styling -changes, you can write something like the following:

    -
    >>> import numpy as np
    ->>> import matplotlib.pyplot as plt
    ->>>
    ->>> with plt.style.context(('dark_background')):
    ->>>     plt.plot(np.sin(np.linspace(0, 2 * np.pi)), 'r-o')
    ->>>
    ->>> # Some plotting code with the default style
    ->>>
    ->>> plt.show()
    -
    -
    -
    -
    -
    -

    matplotlib rcParams

    -
    -

    Dynamic rc settings

    -

    You can also dynamically change the default rc settings in a python script or -interactively from the python shell. All of the rc settings are stored in a -dictionary-like variable called matplotlib.rcParams, which is global to -the matplotlib package. rcParams can be modified directly, for example:

    -
    import matplotlib as mpl
    -mpl.rcParams['lines.linewidth'] = 2
    -mpl.rcParams['lines.color'] = 'r'
    -
    -
    -

    Matplotlib also provides a couple of convenience functions for modifying rc -settings. The matplotlib.rc() command can be used to modify multiple -settings in a single group at once, using keyword arguments:

    -
    import matplotlib as mpl
    -mpl.rc('lines', linewidth=2, color='r')
    -
    -
    -

    The matplotlib.rcdefaults() command will restore the standard matplotlib -default settings.

    -

    There is some degree of validation when setting the values of rcParams, see -matplotlib.rcsetup for details.

    -
    -
    -

    The matplotlibrc file

    -

    matplotlib uses matplotlibrc configuration files to customize all kinds -of properties, which we call rc settings or rc parameters. You can control -the defaults of almost every property in matplotlib: figure size and dpi, line -width, color and style, axes, axis and grid properties, text and font -properties and so on. matplotlib looks for matplotlibrc in four -locations, in the following order:

    -
      -
    1. matplotlibrc in the current working directory, usually used for -specific customizations that you do not want to apply elsewhere.

      -
    2. -
    3. $MATPLOTLIBRC/matplotlibrc.

      -
    4. -
    5. It next looks in a user-specific place, depending on your platform:

      -
        -
      • On Linux and FreeBSD, it looks in .config/matplotlib/matplotlibrc -(or $XDG_CONFIG_HOME/matplotlib/matplotlibrc) if you’ve customized -your environment.
      • -
      • On other platforms, it looks in .matplotlib/matplotlibrc.
      • -
      -

      See matplotlib configuration and cache directory locations.

      -
    6. -
    7. INSTALL/matplotlib/mpl-data/matplotlibrc, where -INSTALL is something like -/usr/lib/python3.5/site-packages on Linux, and maybe -C:\Python35\Lib\site-packages on Windows. Every time you -install matplotlib, this file will be overwritten, so if you want -your customizations to be saved, please move this file to your -user-specific matplotlib directory.

      -
    8. -
    -

    To display where the currently active matplotlibrc file was -loaded from, one can do the following:

    -
    >>> import matplotlib
    ->>> matplotlib.matplotlib_fname()
    -'/home/foo/.config/matplotlib/matplotlibrc'
    -
    -
    -

    See below for a sample matplotlibrc file.

    -
    -

    A sample matplotlibrc file

    -(download)
    ### MATPLOTLIBRC FORMAT
    -
    -# This is a sample matplotlib configuration file - you can find a copy
    -# of it on your system in
    -# site-packages/matplotlib/mpl-data/matplotlibrc.  If you edit it
    -# there, please note that it will be overwritten in your next install.
    -# If you want to keep a permanent local copy that will not be
    -# overwritten, place it in the following location:
    -# unix/linux:
    -#     $HOME/.config/matplotlib/matplotlibrc or
    -#     $XDG_CONFIG_HOME/matplotlib/matplotlibrc (if $XDG_CONFIG_HOME is set)
    -# other platforms:
    -#     $HOME/.matplotlib/matplotlibrc
    -#
    -# See http://matplotlib.org/users/customizing.html#the-matplotlibrc-file for
    -# more details on the paths which are checked for the configuration file.
    -#
    -# This file is best viewed in a editor which supports python mode
    -# syntax highlighting. Blank lines, or lines starting with a comment
    -# symbol, are ignored, as are trailing comments.  Other lines must
    -# have the format
    -#    key : val # optional comment
    -#
    -# Colors: for the color values below, you can either use - a
    -# matplotlib color string, such as r, k, or b - an rgb tuple, such as
    -# (1.0, 0.5, 0.0) - a hex string, such as ff00ff - a scalar
    -# grayscale intensity such as 0.75 - a legal html color name, e.g., red,
    -# blue, darkslategray
    -
    -#### CONFIGURATION BEGINS HERE
    -
    -# The default backend; one of GTK GTKAgg GTKCairo GTK3Agg GTK3Cairo
    -# MacOSX Qt4Agg Qt5Agg 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      : TkAgg
    -
    -# If you are using the Qt4Agg backend, you can choose here
    -# to use the PyQt4 bindings or the newer PySide bindings to
    -# the underlying Qt4 toolkit.
    -#backend.qt4 : PyQt4        # PyQt4 | PySide
    -
    -# Note that this can be overridden by the environment variable
    -# QT_API used by Enthought Tool Suite (ETS); valid values are
    -# "pyqt" and "pyside".  The "pyqt" setting has the side effect of
    -# forcing the use of Version 2 API for QString and QVariant.
    -
    -# The port to use for the web server in the WebAgg backend.
    -# webagg.port : 8888
    -
    -# If webagg.port is unavailable, a number of other random ports will
    -# be tried until one that is available is found.
    -# webagg.port_retries : 50
    -
    -# When True, open the webbrowser to the plot that is shown
    -# webagg.open_in_browser : True
    -
    -# When True, the figures rendered in the nbagg backend are created with
    -# a transparent background.
    -# nbagg.transparent : False
    -
    -# if you are running pyplot inside a GUI and your backend choice
    -# conflicts, we will automatically try to find a compatible one for
    -# you if backend_fallback is True
    -#backend_fallback: True
    -
    -#interactive  : False
    -#toolbar      : toolbar2   # None | toolbar2  ("classic" is deprecated)
    -#timezone     : UTC        # a pytz timezone string, e.g., US/Central or Europe/Paris
    -
    -# Where your matplotlib data lives if you installed to a non-default
    -# location.  This is where the matplotlib fonts, bitmaps, etc reside
    -#datapath : /home/jdhunter/mpldata
    -
    -
    -### LINES
    -# See http://matplotlib.org/api/artist_api.html#module-matplotlib.lines for more
    -# information on line properties.
    -#lines.linewidth   : 1.5     # line width in points
    -#lines.linestyle   : -       # solid line
    -#lines.color       : C0      # has no affect on plot(); see axes.prop_cycle
    -#lines.marker      : None    # the default marker
    -#lines.markeredgewidth  : 1.0     # the line width around the marker symbol
    -#lines.markersize  : 6            # markersize, in points
    -#lines.dash_joinstyle : miter        # miter|round|bevel
    -#lines.dash_capstyle : butt          # butt|round|projecting
    -#lines.solid_joinstyle : miter       # miter|round|bevel
    -#lines.solid_capstyle : projecting   # butt|round|projecting
    -#lines.antialiased : True         # render lines in antialiased (no jaggies)
    -
    -# The three standard dash patterns.  These are scaled by the linewidth.
    -#lines.dashed_pattern : 2.8, 1.2
    -#lines.dashdot_pattern : 4.8, 1.2, 0.8, 1.2
    -#lines.dotted_pattern : 1.1, 1.1
    -#lines.scale_dashes : True
    -
    -#markers.fillstyle: full # full|left|right|bottom|top|none
    -
    -### PATCHES
    -# Patches are graphical objects that fill 2D space, like polygons or
    -# circles.  See
    -# http://matplotlib.org/api/artist_api.html#module-matplotlib.patches
    -# information on patch properties
    -#patch.linewidth        : 1        # edge width in points.
    -#patch.facecolor        : C0
    -#patch.edgecolor        : black   # if forced, or patch is not filled
    -#patch.force_edgecolor  : False   # True to always use edgecolor
    -#patch.antialiased      : True    # render patches in antialiased (no jaggies)
    -
    -### HATCHES
    -#hatch.color     : k
    -#hatch.linewidth : 1.0
    -
    -### Boxplot
    -#boxplot.notch       : False
    -#boxplot.vertical    : True
    -#boxplot.whiskers    : 1.5
    -#boxplot.bootstrap   : None
    -#boxplot.patchartist : False
    -#boxplot.showmeans   : False
    -#boxplot.showcaps    : True
    -#boxplot.showbox     : True
    -#boxplot.showfliers  : True
    -#boxplot.meanline    : False
    -
    -#boxplot.flierprops.color           : 'k'
    -#boxplot.flierprops.marker          : 'o'
    -#boxplot.flierprops.markerfacecolor : 'none'
    -#boxplot.flierprops.markeredgecolor : 'k'
    -#boxplot.flierprops.markersize      : 6
    -#boxplot.flierprops.linestyle       : 'none'
    -#boxplot.flierprops.linewidth       : 1.0
    -
    -#boxplot.boxprops.color     : 'k'
    -#boxplot.boxprops.linewidth : 1.0
    -#boxplot.boxprops.linestyle : '-'
    -
    -#boxplot.whiskerprops.color     : 'k'
    -#boxplot.whiskerprops.linewidth : 1.0
    -#boxplot.whiskerprops.linestyle : '-'
    -
    -#boxplot.capprops.color     : 'k'
    -#boxplot.capprops.linewidth : 1.0
    -#boxplot.capprops.linestyle : '-'
    -
    -#boxplot.medianprops.color     : 'C1'
    -#boxplot.medianprops.linewidth : 1.0
    -#boxplot.medianprops.linestyle : '-'
    -
    -#boxplot.meanprops.color           : 'C2'
    -#boxplot.meanprops.marker          : '^'
    -#boxplot.meanprops.markerfacecolor : 'C2'
    -#boxplot.meanprops.markeredgecolor : 'C2'
    -#boxplot.meanprops.markersize      :  6
    -#boxplot.meanprops.linestyle       : 'none'
    -#boxplot.meanprops.linewidth       : 1.0
    -
    -### FONT
    -#
    -# font properties used by text.Text.  See
    -# http://matplotlib.org/api/font_manager_api.html for more
    -# information on font properties.  The 6 font properties used for font
    -# matching are given below with their default values.
    -#
    -# The font.family property has five values: 'serif' (e.g., Times),
    -# 'sans-serif' (e.g., Helvetica), 'cursive' (e.g., Zapf-Chancery),
    -# 'fantasy' (e.g., Western), and 'monospace' (e.g., Courier).  Each of
    -# these font families has a default list of font names in decreasing
    -# order of priority associated with them.  When text.usetex is False,
    -# font.family may also be one or more concrete font names.
    -#
    -# The font.style property has three values: normal (or roman), italic
    -# or oblique.  The oblique style will be used for italic, if it is not
    -# present.
    -#
    -# The font.variant property has two values: normal or small-caps.  For
    -# TrueType fonts, which are scalable fonts, small-caps is equivalent
    -# to using a font size of 'smaller', or about 83%% of the current font
    -# size.
    -#
    -# The font.weight property has effectively 13 values: normal, bold,
    -# bolder, lighter, 100, 200, 300, ..., 900.  Normal is the same as
    -# 400, and bold is 700.  bolder and lighter are relative values with
    -# respect to the current weight.
    -#
    -# The font.stretch property has 11 values: ultra-condensed,
    -# extra-condensed, condensed, semi-condensed, normal, semi-expanded,
    -# expanded, extra-expanded, ultra-expanded, wider, and narrower.  This
    -# property is not currently implemented.
    -#
    -# The font.size property is the default font size for text, given in pts.
    -# 10 pt is the standard value.
    -#
    -#font.family         : sans-serif
    -#font.style          : normal
    -#font.variant        : normal
    -#font.weight         : medium
    -#font.stretch        : normal
    -# note that font.size controls default text sizes.  To configure
    -# special text sizes tick labels, axes, labels, title, etc, see the rc
    -# settings for axes and ticks. Special text sizes can be defined
    -# relative to font.size, using the following values: xx-small, x-small,
    -# small, medium, large, x-large, xx-large, larger, or smaller
    -#font.size           : 10.0
    -#font.serif          : DejaVu Serif, Bitstream Vera Serif, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif
    -#font.sans-serif     : DejaVu Sans, Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif
    -#font.cursive        : Apple Chancery, Textile, Zapf Chancery, Sand, Script MT, Felipa, cursive
    -#font.fantasy        : Comic Sans MS, Chicago, Charcoal, Impact, Western, Humor Sans, xkcd, fantasy
    -#font.monospace      : DejaVu Sans Mono, Bitstream Vera Sans Mono, Andale Mono, Nimbus Mono L, Courier New, Courier, Fixed, Terminal, monospace
    -
    -### TEXT
    -# text properties used by text.Text.  See
    -# http://matplotlib.org/api/artist_api.html#module-matplotlib.text for more
    -# information on text properties
    -
    -#text.color          : black
    -
    -### LaTeX customizations. See http://wiki.scipy.org/Cookbook/Matplotlib/UsingTex
    -#text.usetex         : False  # use latex for all text handling. The following fonts
    -                              # are supported through the usual rc parameter settings:
    -                              # new century schoolbook, bookman, times, palatino,
    -                              # zapf chancery, charter, serif, sans-serif, helvetica,
    -                              # avant garde, courier, monospace, computer modern roman,
    -                              # computer modern sans serif, computer modern typewriter
    -                              # If another font is desired which can loaded using the
    -                              # LaTeX \usepackage command, please inquire at the
    -                              # matplotlib mailing list
    -#text.latex.unicode : False # use "ucs" and "inputenc" LaTeX packages for handling
    -                            # unicode strings.
    -#text.latex.preamble :  # IMPROPER USE OF THIS FEATURE WILL LEAD TO LATEX FAILURES
    -                            # AND IS THEREFORE UNSUPPORTED. PLEASE DO NOT ASK FOR HELP
    -                            # IF THIS FEATURE DOES NOT DO WHAT YOU EXPECT IT TO.
    -                            # preamble is a comma separated list of LaTeX statements
    -                            # that are included in the LaTeX document preamble.
    -                            # An example:
    -                            # text.latex.preamble : \usepackage{bm},\usepackage{euler}
    -                            # The following packages are always loaded with usetex, so
    -                            # beware of package collisions: color, geometry, graphicx,
    -                            # type1cm, textcomp. Adobe Postscript (PSSNFS) font packages
    -                            # may also be loaded, depending on your font settings
    -
    -#text.dvipnghack : None      # some versions of dvipng don't handle alpha
    -                             # channel properly.  Use True to correct
    -                             # and flush ~/.matplotlib/tex.cache
    -                             # before testing and False to force
    -                             # correction off.  None will try and
    -                             # guess based on your dvipng version
    -
    -#text.hinting : auto   # May be one of the following:
    -                       #   'none': Perform no hinting
    -                       #   'auto': Use FreeType's autohinter
    -                       #   'native': Use the hinting information in the
    -                       #             font file, if available, and if your
    -                       #             FreeType library supports it
    -                       #   'either': Use the native hinting information,
    -                       #             or the autohinter if none is available.
    -                       # For backward compatibility, this value may also be
    -                       # True === 'auto' or False === 'none'.
    -#text.hinting_factor : 8 # Specifies the amount of softness for hinting in the
    -                         # horizontal direction.  A value of 1 will hint to full
    -                         # pixels.  A value of 2 will hint to half pixels etc.
    -
    -#text.antialiased : True # If True (default), the text will be antialiased.
    -                         # This only affects the Agg backend.
    -
    -# The following settings allow you to select the fonts in math mode.
    -# They map from a TeX font name to a fontconfig font pattern.
    -# These settings are only used if mathtext.fontset is 'custom'.
    -# Note that this "custom" mode is unsupported and may go away in the
    -# future.
    -#mathtext.cal : cursive
    -#mathtext.rm  : serif
    -#mathtext.tt  : monospace
    -#mathtext.it  : serif:italic
    -#mathtext.bf  : serif:bold
    -#mathtext.sf  : sans
    -#mathtext.fontset : dejavusans # Should be 'dejavusans' (default),
    -                               # 'dejavuserif', 'cm' (Computer Modern), 'stix',
    -                               # 'stixsans' or 'custom'
    -#mathtext.fallback_to_cm : True  # When True, use symbols from the Computer Modern
    -                                 # fonts when a symbol can not be found in one of
    -                                 # the custom math fonts.
    -
    -#mathtext.default : it # The default font to use for math.
    -                       # Can be any of the LaTeX font names, including
    -                       # the special name "regular" for the same font
    -                       # used in regular text.
    -
    -### AXES
    -# default face and edge color, default tick sizes,
    -# default fontsizes for ticklabels, and so on.  See
    -# http://matplotlib.org/api/axes_api.html#module-matplotlib.axes
    -#axes.facecolor      : white   # axes background color
    -#axes.edgecolor      : black   # axes edge color
    -#axes.linewidth      : 0.8     # edge linewidth
    -#axes.grid           : False   # display grid or not
    -#axes.titlesize      : large   # fontsize of the axes title
    -#axes.titlepad       : 6.0     # pad between axes and title in points
    -#axes.labelsize      : medium  # fontsize of the x any y labels
    -#axes.labelpad       : 4.0     # space between label and axis
    -#axes.labelweight    : normal  # weight of the x and y labels
    -#axes.labelcolor     : black
    -#axes.axisbelow      : 'line'  # draw axis gridlines and ticks below
    -                               # patches (True); above patches but below
    -                               # lines ('line'); or above all (False)
    -
    -#axes.formatter.limits : -7, 7 # use scientific notation if log10
    -                               # of the axis range is smaller than the
    -                               # first or larger than the second
    -#axes.formatter.use_locale : False # When True, format tick labels
    -                                   # according to the user's locale.
    -                                   # For example, use ',' as a decimal
    -                                   # separator in the fr_FR locale.
    -#axes.formatter.use_mathtext : False # When True, use mathtext for scientific
    -                                     # notation.
    -#axes.formatter.useoffset      : True    # If True, the tick label formatter
    -                                         # will default to labeling ticks relative
    -                                         # to an offset when the data range is
    -                                         # small compared to the minimum absolute
    -                                         # value of the data.
    -#axes.formatter.offset_threshold : 4     # When useoffset is True, the offset
    -                                         # will be used when it can remove
    -                                         # at least this number of significant
    -                                         # digits from tick labels.
    -
    -# axes.spines.left   : True   # display axis spines
    -# axes.spines.bottom : True
    -# axes.spines.top    : True
    -# axes.spines.right  : True
    -
    -
    -#axes.unicode_minus  : True    # use unicode for the minus symbol
    -                               # rather than hyphen.  See
    -                               # http://en.wikipedia.org/wiki/Plus_and_minus_signs#Character_codes
    -#axes.prop_cycle    : cycler('color',
    -#                            ['1f77b4', 'ff7f0e', '2ca02c', 'd62728',
    -#                              '9467bd', '8c564b', 'e377c2', '7f7f7f',
    -#                              'bcbd22', '17becf'])
    -                                            # color cycle for plot lines
    -                                            # as list of string colorspecs:
    -                                            # single letter, long name, or
    -                                            # web-style hex
    -#axes.autolimit_mode : data # How to scale axes limits to the data.
    -                            # Use "data" to use data limits, plus some margin
    -                            # Use "round_number" move to the nearest "round" number
    -#axes.xmargin        : .05  # x margin.  See `axes.Axes.margins`
    -#axes.ymargin        : .05  # y margin See `axes.Axes.margins`
    -
    -#polaraxes.grid      : True    # display grid on polar axes
    -#axes3d.grid         : True    # display grid on 3d axes
    -
    -### DATES
    -# These control the default format strings used in AutoDateFormatter.
    -# Any valid format datetime format string can be used (see the python
    -# `datetime` for details).  For example using '%%x' will use the locale date representation
    -# '%%X' will use the locale time representation and '%%c' will use the full locale datetime
    -# representation.
    -# These values map to the scales:
    -#    {'year': 365, 'month': 30, 'day': 1, 'hour': 1/24, 'minute': 1 / (24 * 60)}
    -
    -# date.autoformatter.year     : %Y
    -# date.autoformatter.month    : %Y-%m
    -# date.autoformatter.day      : %Y-%m-%d
    -# date.autoformatter.hour     : %m-%d %H
    -# date.autoformatter.minute   : %d %H:%M
    -# date.autoformatter.second   : %H:%M:%S
    -# date.autoformatter.microsecond   : %M:%S.%f
    -
    -### TICKS
    -# see http://matplotlib.org/api/axis_api.html#matplotlib.axis.Tick
    -#xtick.top            : False   # draw ticks on the top side
    -#xtick.bottom         : True   # draw ticks on the bottom side
    -#xtick.major.size     : 3.5      # major tick size in points
    -#xtick.minor.size     : 2      # minor tick size in points
    -#xtick.major.width    : 0.8    # major tick width in points
    -#xtick.minor.width    : 0.6    # minor tick width in points
    -#xtick.major.pad      : 3.5      # distance to major tick label in points
    -#xtick.minor.pad      : 3.4      # distance to the minor tick label in points
    -#xtick.color          : k      # color of the tick labels
    -#xtick.labelsize      : medium # fontsize of the tick labels
    -#xtick.direction      : out    # direction: in, out, or inout
    -#xtick.minor.visible  : False  # visibility of minor ticks on x-axis
    -#xtick.major.top      : True   # draw x axis top major ticks
    -#xtick.major.bottom   : True   # draw x axis bottom major ticks
    -#xtick.minor.top      : True   # draw x axis top minor ticks
    -#xtick.minor.bottom   : True   # draw x axis bottom minor ticks
    -
    -#ytick.left           : True   # draw ticks on the left side
    -#ytick.right          : False  # draw ticks on the right side
    -#ytick.major.size     : 3.5      # major tick size in points
    -#ytick.minor.size     : 2      # minor tick size in points
    -#ytick.major.width    : 0.8    # major tick width in points
    -#ytick.minor.width    : 0.6    # minor tick width in points
    -#ytick.major.pad      : 3.5      # distance to major tick label in points
    -#ytick.minor.pad      : 3.4      # distance to the minor tick label in points
    -#ytick.color          : k      # color of the tick labels
    -#ytick.labelsize      : medium # fontsize of the tick labels
    -#ytick.direction      : out    # direction: in, out, or inout
    -#ytick.minor.visible  : False  # visibility of minor ticks on y-axis
    -#ytick.major.left     : True   # draw y axis left major ticks
    -#ytick.major.right    : True   # draw y axis right major ticks
    -#ytick.minor.left     : True   # draw y axis left minor ticks
    -#ytick.minor.right    : True   # draw y axis right minor ticks
    -
    -
    -### GRIDS
    -#grid.color       :   b0b0b0    # grid color
    -#grid.linestyle   :   -         # solid
    -#grid.linewidth   :   0.8       # in points
    -#grid.alpha       :   1.0       # transparency, between 0.0 and 1.0
    -
    -### Legend
    -#legend.loc           : best
    -#legend.frameon       : True     # if True, draw the legend on a background patch
    -#legend.framealpha    : 0.8      # legend patch transparency
    -#legend.facecolor     : inherit  # inherit from axes.facecolor; or color spec
    -#legend.edgecolor     : 0.8      # background patch boundary color
    -#legend.fancybox      : True     # if True, use a rounded box for the
    -                                 # legend background, else a rectangle
    -#legend.shadow        : False    # if True, give background a shadow effect
    -#legend.numpoints     : 1        # the number of marker points in the legend line
    -#legend.scatterpoints : 1        # number of scatter points
    -#legend.markerscale   : 1.0      # the relative size of legend markers vs. original
    -#legend.fontsize      : medium
    -# Dimensions as fraction of fontsize:
    -#legend.borderpad     : 0.4      # border whitespace
    -#legend.labelspacing  : 0.5      # the vertical space between the legend entries
    -#legend.handlelength  : 2.0      # the length of the legend lines
    -#legend.handleheight  : 0.7      # the height of the legend handle
    -#legend.handletextpad : 0.8      # the space between the legend line and legend text
    -#legend.borderaxespad : 0.5      # the border between the axes and legend edge
    -#legend.columnspacing : 2.0      # column separation
    -
    -### FIGURE
    -# See http://matplotlib.org/api/figure_api.html#matplotlib.figure.Figure
    -#figure.titlesize : large      # size of the figure title (Figure.suptitle())
    -#figure.titleweight : normal   # weight of the figure title
    -#figure.figsize   : 6.4, 4.8   # figure size in inches
    -#figure.dpi       : 100      # figure dots per inch
    -#figure.facecolor : white   # figure facecolor; 0.75 is scalar gray
    -#figure.edgecolor : white   # figure edgecolor
    -#figure.autolayout : False  # When True, automatically adjust subplot
    -                            # parameters to make the plot fit the figure
    -#figure.max_open_warning : 20  # The maximum number of figures to open through
    -                               # the pyplot interface before emitting a warning.
    -                               # If less than one this feature is disabled.
    -
    -# The figure subplot parameters.  All dimensions are a fraction of the
    -#figure.subplot.left    : 0.125  # the left side of the subplots of the figure
    -#figure.subplot.right   : 0.9    # the right side of the subplots of the figure
    -#figure.subplot.bottom  : 0.11    # the bottom of the subplots of the figure
    -#figure.subplot.top     : 0.88    # the top of the subplots of the figure
    -#figure.subplot.wspace  : 0.2    # the amount of width reserved for blank space between subplots,
    -                                 # expressed as a fraction of the average axis width
    -#figure.subplot.hspace  : 0.2    # the amount of height reserved for white space between subplots,
    -                                 # expressed as a fraction of the average axis height
    -
    -
    -### IMAGES
    -#image.aspect : equal             # equal | auto | a number
    -#image.interpolation  : nearest   # see help(imshow) for options
    -#image.cmap   : viridis           # A colormap name, gray etc...
    -#image.lut    : 256               # the size of the colormap lookup table
    -#image.origin : upper             # lower | upper
    -#image.resample  : True
    -#image.composite_image : True     # When True, all the images on a set of axes are
    -                                  # combined into a single composite image before
    -                                  # saving a figure as a vector graphics file,
    -                                  # such as a PDF.
    -
    -### CONTOUR PLOTS
    -#contour.negative_linestyle : dashed # dashed | solid
    -#contour.corner_mask        : True   # True | False | legacy
    -
    -### ERRORBAR PLOTS
    -#errorbar.capsize : 0             # length of end cap on error bars in pixels
    -
    -### HISTOGRAM PLOTS
    -#hist.bins : 10                   # The default number of histogram bins.
    -                                  # If Numpy 1.11 or later is
    -                                  # installed, may also be `auto`
    -
    -### SCATTER PLOTS
    -#scatter.marker : o               # The default marker type for scatter plots.
    -
    -### Agg rendering
    -### Warning: experimental, 2008/10/10
    -#agg.path.chunksize : 0           # 0 to disable; values in the range
    -                                  # 10000 to 100000 can improve speed slightly
    -                                  # and prevent an Agg rendering failure
    -                                  # when plotting very large data sets,
    -                                  # especially if they are very gappy.
    -                                  # It may cause minor artifacts, though.
    -                                  # A value of 20000 is probably a good
    -                                  # starting point.
    -### SAVING FIGURES
    -#path.simplify : True   # When True, simplify paths by removing "invisible"
    -                        # points to reduce file size and increase rendering
    -                        # speed
    -#path.simplify_threshold : 0.1  # The threshold of similarity below which
    -                                # vertices will be removed in the simplification
    -                                # process
    -#path.snap : True # When True, rectilinear axis-aligned paths will be snapped to
    -                  # the nearest pixel when certain criteria are met.  When False,
    -                  # paths will never be snapped.
    -#path.sketch : None # May be none, or a 3-tuple of the form (scale, length,
    -                    # randomness).
    -                    # *scale* is the amplitude of the wiggle
    -                    # perpendicular to the line (in pixels).  *length*
    -                    # is the length of the wiggle along the line (in
    -                    # pixels).  *randomness* is the factor by which
    -                    # the length is randomly scaled.
    -
    -# the default savefig params can be different from the display params
    -# e.g., you may want a higher resolution, or to make the figure
    -# background white
    -#savefig.dpi         : figure   # figure dots per inch or 'figure'
    -#savefig.facecolor   : white    # figure facecolor when saving
    -#savefig.edgecolor   : white    # figure edgecolor when saving
    -#savefig.format      : png      # png, ps, pdf, svg
    -#savefig.bbox        : standard # 'tight' or 'standard'.
    -                                # 'tight' is incompatible with pipe-based animation
    -                                # backends but will workd with temporary file based ones:
    -                                # e.g. setting animation.writer to ffmpeg will not work,
    -                                # use ffmpeg_file instead
    -#savefig.pad_inches  : 0.1      # Padding to be used when bbox is set to 'tight'
    -#savefig.jpeg_quality: 95       # when a jpeg is saved, the default quality parameter.
    -#savefig.directory   : ~        # default directory in savefig dialog box,
    -                                # leave empty to always use current working directory
    -#savefig.transparent : False    # setting that controls whether figures are saved with a
    -                                # transparent background by default
    -
    -# tk backend params
    -#tk.window_focus   : False    # Maintain shell focus for TkAgg
    -
    -# ps backend params
    -#ps.papersize      : letter   # auto, letter, legal, ledger, A0-A10, B0-B10
    -#ps.useafm         : False    # use of afm fonts, results in small files
    -#ps.usedistiller   : False    # can be: None, ghostscript or xpdf
    -                                          # Experimental: may produce smaller files.
    -                                          # xpdf intended for production of publication quality files,
    -                                          # but requires ghostscript, xpdf and ps2eps
    -#ps.distiller.res  : 6000      # dpi
    -#ps.fonttype       : 3         # Output Type 3 (Type3) or Type 42 (TrueType)
    -
    -# pdf backend params
    -#pdf.compression   : 6 # integer from 0 to 9
    -                       # 0 disables compression (good for debugging)
    -#pdf.fonttype       : 3         # Output Type 3 (Type3) or Type 42 (TrueType)
    -
    -# svg backend params
    -#svg.image_inline : True       # write raster image data directly into the svg file
    -#svg.fonttype : 'path'         # How to handle SVG fonts:
    -#    'none': Assume fonts are installed on the machine where the SVG will be viewed.
    -#    'path': Embed characters as paths -- supported by most SVG renderers
    -#    'svgfont': Embed characters as SVG fonts -- supported only by Chrome,
    -#               Opera and Safari
    -#svg.hashsalt : None           # if not None, use this string as hash salt
    -                               # instead of uuid4
    -
    -# docstring params
    -#docstring.hardcopy = False  # set this when you want to generate hardcopy docstring
    -
    -# Set the verbose flags.  This controls how much information
    -# matplotlib gives you at runtime and where it goes.  The verbosity
    -# levels are: silent, helpful, debug, debug-annoying.  Any level is
    -# inclusive of all the levels below it.  If your setting is "debug",
    -# you'll get all the debug and helpful messages.  When submitting
    -# problems to the mailing-list, please set verbose to "helpful" or "debug"
    -# and paste the output into your report.
    -#
    -# The "fileo" gives the destination for any calls to verbose.report.
    -# These objects can a filename, or a filehandle like sys.stdout.
    -#
    -# You can override the rc default verbosity from the command line by
    -# giving the flags --verbose-LEVEL where LEVEL is one of the legal
    -# levels, e.g., --verbose-helpful.
    -#
    -# You can access the verbose instance in your code
    -#   from matplotlib import verbose.
    -#verbose.level  : silent      # one of silent, helpful, debug, debug-annoying
    -#verbose.fileo  : sys.stdout  # a log filename, sys.stdout or sys.stderr
    -
    -# Event keys to interact with figures/plots via keyboard.
    -# Customize these settings according to your needs.
    -# Leave the field(s) empty if you don't need a key-map. (i.e., fullscreen : '')
    -
    -#keymap.fullscreen : f, ctrl+f       # toggling
    -#keymap.home : h, r, home            # home or reset mnemonic
    -#keymap.back : left, c, backspace    # forward / backward keys to enable
    -#keymap.forward : right, v           #   left handed quick navigation
    -#keymap.pan : p                      # pan mnemonic
    -#keymap.zoom : o                     # zoom mnemonic
    -#keymap.save : s                     # saving current figure
    -#keymap.quit : ctrl+w, cmd+w         # close the current figure
    -#keymap.grid : g                     # switching on/off a grid in current axes
    -#keymap.yscale : l                   # toggle scaling of y-axes ('log'/'linear')
    -#keymap.xscale : L, k                # toggle scaling of x-axes ('log'/'linear')
    -#keymap.all_axes : a                 # enable all axes
    -
    -# Control location of examples data files
    -#examples.directory : ''   # directory to look in for custom installation
    -
    -###ANIMATION settings
    -#animation.html : 'none'           # How to display the animation as HTML in
    -                                   # the IPython notebook. 'html5' uses
    -                                   # HTML5 video tag.
    -#animation.writer : ffmpeg         # MovieWriter 'backend' to use
    -#animation.codec : h264            # Codec to use for writing movie
    -#animation.bitrate: -1             # Controls size/quality tradeoff for movie.
    -                                   # -1 implies let utility auto-determine
    -#animation.frame_format: 'png'     # Controls frame format used by temp files
    -#animation.ffmpeg_path: 'ffmpeg'   # Path to ffmpeg binary. Without full path
    -                                   # $PATH is searched
    -#animation.ffmpeg_args: ''         # Additional arguments to pass to ffmpeg
    -#animation.avconv_path: 'avconv'   # Path to avconv binary. Without full path
    -                                   # $PATH is searched
    -#animation.avconv_args: ''         # Additional arguments to pass to avconv
    -#animation.mencoder_path: 'mencoder'
    -                                   # Path to mencoder binary. Without full path
    -                                   # $PATH is searched
    -#animation.mencoder_args: ''       # Additional arguments to pass to mencoder
    -#animation.convert_path: 'convert' # Path to ImageMagick's convert binary.
    -                                   # On Windows use the full path since convert
    -                                   # is also the name of a system tool.
    -
    -
    -
    -
    -
    -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/users/examples_index.html b/users/examples_index.html deleted file mode 100644 index a346204c9bd..00000000000 --- a/users/examples_index.html +++ /dev/null @@ -1,349 +0,0 @@ - - - - - - - - Selected Examples — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -

    Related Topics

    - -
    -
    -

    This Page

    - -
    - - -
    -
    - - - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/users/gridspec.html b/users/gridspec.html deleted file mode 100644 index f91c65a1cc6..00000000000 --- a/users/gridspec.html +++ /dev/null @@ -1,486 +0,0 @@ - - - - - - - - Customizing Location of Subplot Using GridSpec — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - - - -
    -
    -
    -
    - -
    -

    Customizing Location of Subplot Using GridSpec

    -
    -
    -
    GridSpec
    -
    specifies the geometry of the grid that a subplot will be -placed. The number of rows and number of columns of the grid -need to be set. Optionally, the subplot layout parameters -(e.g., left, right, etc.) can be tuned.
    -
    SubplotSpec
    -
    specifies the location of the subplot in the given GridSpec.
    -
    subplot2grid()
    -
    a helper function that is similar to subplot() -but uses 0-based indexing and let subplot to occupy multiple cells.
    -
    -
    -
    -

    Basic Example of using subplot2grid

    -

    To use subplot2grid(), you provide geometry of -the grid and the location of the subplot in the grid. For a simple -single-cell subplot:

    -
    ax = plt.subplot2grid((2, 2), (0, 0))
    -
    -
    -

    is identical to

    -
    ax = plt.subplot(2, 2, 1)
    -
    -
    -

    Note that, unlike Matplotlib’s subplot, the index starts from 0 in GridSpec.

    -

    To create a subplot that spans multiple cells,

    -
    ax2 = plt.subplot2grid((3, 3), (1, 0), colspan=2)
    -ax3 = plt.subplot2grid((3, 3), (1, 2), rowspan=2)
    -
    -
    -

    For example, the following commands

    -
    ax1 = plt.subplot2grid((3, 3), (0, 0), colspan=3)
    -ax2 = plt.subplot2grid((3, 3), (1, 0), colspan=2)
    -ax3 = plt.subplot2grid((3, 3), (1, 2), rowspan=2)
    -ax4 = plt.subplot2grid((3, 3), (2, 0))
    -ax5 = plt.subplot2grid((3, 3), (2, 1))
    -
    -
    -

    creates

    -

    (Source code, png, pdf)

    -
    -../_images/demo_gridspec01.png -
    -
    -
    -

    GridSpec and SubplotSpec

    -

    You can create GridSpec explicitly and use -them to create a subplot.

    -

    For example,

    -
    ax = plt.subplot2grid((2, 2), (0, 0))
    -
    -
    -

    is equal to

    -
    import matplotlib.gridspec as gridspec
    -gs = gridspec.GridSpec(2, 2)
    -ax = plt.subplot(gs[0, 0])
    -
    -
    -

    A GridSpec instance provides array-like (2d or 1d) indexing that -returns the SubplotSpec instance. For a SubplotSpec that spans multiple -cells, use slice.

    -
    ax2 = plt.subplot(gs[1, :-1])
    -ax3 = plt.subplot(gs[1:, -1])
    -
    -
    -

    The above example becomes

    -
    gs = gridspec.GridSpec(3, 3)
    -ax1 = plt.subplot(gs[0, :])
    -ax2 = plt.subplot(gs[1, :-1])
    -ax3 = plt.subplot(gs[1:, -1])
    -ax4 = plt.subplot(gs[-1, 0])
    -ax5 = plt.subplot(gs[-1, -2])
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/demo_gridspec02.png -
    -
    -
    -

    Adjust GridSpec layout

    -

    When a GridSpec is explicitly used, you can adjust the layout -parameters of subplots that are created from the GridSpec.

    -
    gs1 = gridspec.GridSpec(3, 3)
    -gs1.update(left=0.05, right=0.48, wspace=0.05)
    -
    -
    -

    This is similar to subplots_adjust(), but it only -affects the subplots that are created from the given GridSpec.

    -

    The code below

    -
    gs1 = gridspec.GridSpec(3, 3)
    -gs1.update(left=0.05, right=0.48, wspace=0.05)
    -ax1 = plt.subplot(gs1[:-1, :])
    -ax2 = plt.subplot(gs1[-1, :-1])
    -ax3 = plt.subplot(gs1[-1, -1])
    -
    -gs2 = gridspec.GridSpec(3, 3)
    -gs2.update(left=0.55, right=0.98, hspace=0.05)
    -ax4 = plt.subplot(gs2[:, :-1])
    -ax5 = plt.subplot(gs2[:-1, -1])
    -ax6 = plt.subplot(gs2[-1, -1])
    -
    -
    -

    creates

    -

    (Source code, png, pdf)

    -
    -../_images/demo_gridspec03.png -
    -
    -
    -

    GridSpec using SubplotSpec

    -

    You can create GridSpec from the SubplotSpec, -in which case its layout parameters are set to that of the location of -the given SubplotSpec.

    -
    gs0 = gridspec.GridSpec(1, 2)
    -
    -gs00 = gridspec.GridSpecFromSubplotSpec(3, 3, subplot_spec=gs0[0])
    -gs01 = gridspec.GridSpecFromSubplotSpec(3, 3, subplot_spec=gs0[1])
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/demo_gridspec04.png -
    -
    -
    -

    A Complex Nested GridSpec using SubplotSpec

    -

    Here’s a more sophisticated example of nested GridSpec where we put -a box around each cell of the outer 4x4 grid, by hiding appropriate -spines in each of the inner 3x3 grids.

    -

    (Source code, png, pdf)

    -
    -../_images/demo_gridspec06.png -
    -
    -
    -

    GridSpec with Varying Cell Sizes

    -

    By default, GridSpec creates cells of equal sizes. You can adjust -relative heights and widths of rows and columns. Note that absolute -values are meaningless, only their relative ratios matter.

    -
    gs = gridspec.GridSpec(2, 2,
    -                       width_ratios=[1, 2],
    -                       height_ratios=[4, 1]
    -                       )
    -
    -ax1 = plt.subplot(gs[0])
    -ax2 = plt.subplot(gs[1])
    -ax3 = plt.subplot(gs[2])
    -ax4 = plt.subplot(gs[3])
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/demo_gridspec05.png -
    -
    -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/users/image_tutorial-1.pdf b/users/image_tutorial-1.pdf deleted file mode 100644 index d1af3634ba2..00000000000 Binary files a/users/image_tutorial-1.pdf and /dev/null differ diff --git a/users/image_tutorial-1.png b/users/image_tutorial-1.png deleted file mode 100644 index 52fef3ef4fc..00000000000 Binary files a/users/image_tutorial-1.png and /dev/null differ diff --git a/users/image_tutorial-1.py b/users/image_tutorial-1.py deleted file mode 100644 index 920b16641e0..00000000000 --- a/users/image_tutorial-1.py +++ /dev/null @@ -1,5 +0,0 @@ -import matplotlib.pyplot as plt -import matplotlib.image as mpimg -import numpy as np -img = mpimg.imread('../_static/stinkbug.png') -imgplot = plt.imshow(img) \ No newline at end of file diff --git a/users/image_tutorial-10.pdf b/users/image_tutorial-10.pdf deleted file mode 100644 index 41fdd4f39dd..00000000000 Binary files a/users/image_tutorial-10.pdf and /dev/null differ diff --git a/users/image_tutorial-10.png b/users/image_tutorial-10.png deleted file mode 100644 index 35e6c945ad8..00000000000 Binary files a/users/image_tutorial-10.png and /dev/null differ diff --git a/users/image_tutorial-10.py b/users/image_tutorial-10.py deleted file mode 100644 index 76e2d3c4aca..00000000000 --- a/users/image_tutorial-10.py +++ /dev/null @@ -1,5 +0,0 @@ -import matplotlib.pyplot as plt -from PIL import Image -img = Image.open('../_static/stinkbug.png') # opens the file using Pillow - it's not an array yet -img.thumbnail((64, 64), Image.ANTIALIAS) # resizes image in-place -imgplot = plt.imshow(img, interpolation="bicubic") \ No newline at end of file diff --git a/users/image_tutorial-2.pdf b/users/image_tutorial-2.pdf deleted file mode 100644 index ad714897c7c..00000000000 Binary files a/users/image_tutorial-2.pdf and /dev/null differ diff --git a/users/image_tutorial-2.png b/users/image_tutorial-2.png deleted file mode 100644 index e181457def0..00000000000 Binary files a/users/image_tutorial-2.png and /dev/null differ diff --git a/users/image_tutorial-2.py b/users/image_tutorial-2.py deleted file mode 100644 index cf02ce27ee1..00000000000 --- a/users/image_tutorial-2.py +++ /dev/null @@ -1,6 +0,0 @@ -import matplotlib.pyplot as plt -import matplotlib.image as mpimg -import numpy as np -img = mpimg.imread('../_static/stinkbug.png') -lum_img = img[:, :, 0] -plt.imshow(lum_img) \ No newline at end of file diff --git a/users/image_tutorial-3.pdf b/users/image_tutorial-3.pdf deleted file mode 100644 index 33530f53777..00000000000 Binary files a/users/image_tutorial-3.pdf and /dev/null differ diff --git a/users/image_tutorial-3.png b/users/image_tutorial-3.png deleted file mode 100644 index cfb3ff0dc67..00000000000 Binary files a/users/image_tutorial-3.png and /dev/null differ diff --git a/users/image_tutorial-3.py b/users/image_tutorial-3.py deleted file mode 100644 index be1c493e2d6..00000000000 --- a/users/image_tutorial-3.py +++ /dev/null @@ -1,7 +0,0 @@ -import matplotlib.pyplot as plt -import matplotlib.image as mpimg -import numpy as np -img = mpimg.imread('../_static/stinkbug.png') -lum_img = img[:,:,0] -imgplot = plt.imshow(lum_img) -imgplot.set_cmap('hot') \ No newline at end of file diff --git a/users/image_tutorial-4.pdf b/users/image_tutorial-4.pdf deleted file mode 100644 index 4e43b52ea93..00000000000 Binary files a/users/image_tutorial-4.pdf and /dev/null differ diff --git a/users/image_tutorial-4.png b/users/image_tutorial-4.png deleted file mode 100644 index 58122ae5a2f..00000000000 Binary files a/users/image_tutorial-4.png and /dev/null differ diff --git a/users/image_tutorial-4.py b/users/image_tutorial-4.py deleted file mode 100644 index bfcd5f47ebc..00000000000 --- a/users/image_tutorial-4.py +++ /dev/null @@ -1,7 +0,0 @@ -import matplotlib.pyplot as plt -import matplotlib.image as mpimg -import numpy as np -img = mpimg.imread('../_static/stinkbug.png') -lum_img = img[:, :, 0] -imgplot = plt.imshow(lum_img) -imgplot.set_cmap('nipy_spectral') \ No newline at end of file diff --git a/users/image_tutorial-5.pdf b/users/image_tutorial-5.pdf deleted file mode 100644 index b5039967c02..00000000000 Binary files a/users/image_tutorial-5.pdf and /dev/null differ diff --git a/users/image_tutorial-5.png b/users/image_tutorial-5.png deleted file mode 100644 index e14800bfdc3..00000000000 Binary files a/users/image_tutorial-5.png and /dev/null differ diff --git a/users/image_tutorial-5.py b/users/image_tutorial-5.py deleted file mode 100644 index 6b7f032833a..00000000000 --- a/users/image_tutorial-5.py +++ /dev/null @@ -1,8 +0,0 @@ -import matplotlib.pyplot as plt -import matplotlib.image as mpimg -import numpy as np -img = mpimg.imread('../_static/stinkbug.png') -lum_img = img[:, :, 0] -imgplot = plt.imshow(lum_img) -imgplot.set_cmap('nipy_spectral') -plt.colorbar() \ No newline at end of file diff --git a/users/image_tutorial-6.pdf b/users/image_tutorial-6.pdf deleted file mode 100644 index d15072bd9e2..00000000000 Binary files a/users/image_tutorial-6.pdf and /dev/null differ diff --git a/users/image_tutorial-6.png b/users/image_tutorial-6.png deleted file mode 100644 index 7c51023d560..00000000000 Binary files a/users/image_tutorial-6.png and /dev/null differ diff --git a/users/image_tutorial-6.py b/users/image_tutorial-6.py deleted file mode 100644 index 62454df034d..00000000000 --- a/users/image_tutorial-6.py +++ /dev/null @@ -1,6 +0,0 @@ -import matplotlib.pyplot as plt -import matplotlib.image as mpimg -import numpy as np -img = mpimg.imread('../_static/stinkbug.png') -lum_img = img[:,:,0] -plt.hist(lum_img.flatten(), 256, range=(0.0, 1.0), fc='k', ec='k') \ No newline at end of file diff --git a/users/image_tutorial-7.pdf b/users/image_tutorial-7.pdf deleted file mode 100644 index da1e9d8c81d..00000000000 Binary files a/users/image_tutorial-7.pdf and /dev/null differ diff --git a/users/image_tutorial-7.png b/users/image_tutorial-7.png deleted file mode 100644 index cc43e02c4a2..00000000000 Binary files a/users/image_tutorial-7.png and /dev/null differ diff --git a/users/image_tutorial-7.py b/users/image_tutorial-7.py deleted file mode 100644 index 3fb17e07e8d..00000000000 --- a/users/image_tutorial-7.py +++ /dev/null @@ -1,15 +0,0 @@ -import matplotlib.pyplot as plt -import matplotlib.image as mpimg -import numpy as np -fig = plt.figure() -a=fig.add_subplot(1,2,1) -img = mpimg.imread('../_static/stinkbug.png') -lum_img = img[:,:,0] -imgplot = plt.imshow(lum_img) -a.set_title('Before') -plt.colorbar(ticks=[0.1,0.3,0.5,0.7], orientation ='horizontal') -a=fig.add_subplot(1,2,2) -imgplot = plt.imshow(lum_img) -imgplot.set_clim(0.0,0.7) -a.set_title('After') -plt.colorbar(ticks=[0.1,0.3,0.5,0.7], orientation='horizontal') \ No newline at end of file diff --git a/users/image_tutorial-8.pdf b/users/image_tutorial-8.pdf deleted file mode 100644 index 5d2ca255c3f..00000000000 Binary files a/users/image_tutorial-8.pdf and /dev/null differ diff --git a/users/image_tutorial-8.png b/users/image_tutorial-8.png deleted file mode 100644 index 032885ef501..00000000000 Binary files a/users/image_tutorial-8.png and /dev/null differ diff --git a/users/image_tutorial-8.py b/users/image_tutorial-8.py deleted file mode 100644 index 885f2f9bb0c..00000000000 --- a/users/image_tutorial-8.py +++ /dev/null @@ -1,5 +0,0 @@ -import matplotlib.pyplot as plt -from PIL import Image -img = Image.open('../_static/stinkbug.png') # opens the file using Pillow - it's not an array yet -img.thumbnail((64, 64), Image.ANTIALIAS) # resizes image in-place -imgplot = plt.imshow(img) \ No newline at end of file diff --git a/users/image_tutorial-9.pdf b/users/image_tutorial-9.pdf deleted file mode 100644 index 5d2ca255c3f..00000000000 Binary files a/users/image_tutorial-9.pdf and /dev/null differ diff --git a/users/image_tutorial-9.png b/users/image_tutorial-9.png deleted file mode 100644 index 032885ef501..00000000000 Binary files a/users/image_tutorial-9.png and /dev/null differ diff --git a/users/image_tutorial-9.py b/users/image_tutorial-9.py deleted file mode 100644 index 50508f5e207..00000000000 --- a/users/image_tutorial-9.py +++ /dev/null @@ -1,5 +0,0 @@ -import matplotlib.pyplot as plt -from PIL import Image -img = Image.open('../_static/stinkbug.png') # opens the file using Pillow - it's not an array yet -img.thumbnail((64, 64), Image.ANTIALIAS) # resizes image in-place -imgplot = plt.imshow(img, interpolation="nearest") \ No newline at end of file diff --git a/users/image_tutorial.html b/users/image_tutorial.html deleted file mode 100644 index 6bdeb3978c3..00000000000 --- a/users/image_tutorial.html +++ /dev/null @@ -1,586 +0,0 @@ - - - - - - - - Image tutorial — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - - - -
    -
    -
    -
    - -
    -

    Image tutorial

    -
    -

    Startup commands

    -

    First, let’s start IPython. It is a most excellent enhancement to the -standard Python prompt, and it ties in especially well with -Matplotlib. Start IPython either at a shell, or the IPython Notebook now.

    -

    With IPython started, we now need to connect to a GUI event loop. This -tells IPython where (and how) to display plots. To connect to a GUI -loop, execute the %matplotlib magic at your IPython prompt. There’s more -detail on exactly what this does at IPython’s documentation on GUI -event loops.

    -

    If you’re using IPython Notebook, the same commands are available, but -people commonly use a specific argument to the %matplotlib magic:

    -
    In [1]: %matplotlib inline
    -
    -
    -

    This turns on inline plotting, where plot graphics will appear in your -notebook. This has important implications for interactivity. For inline plotting, commands in -cells below the cell that outputs a plot will not affect the plot. For example, -changing the color map is not possible from cells below the cell that creates a plot. -However, for other backends, such as qt4, that open a separate window, -cells below those that create the plot will change the plot - it is a -live object in memory.

    -

    This tutorial will use matplotlib’s imperative-style plotting -interface, pyplot. This interface maintains global state, and is very -useful for quickly and easily experimenting with various plot -settings. The alternative is the object-oriented interface, which is also -very powerful, and generally more suitable for large application -development. If you’d like to learn about the object-oriented -interface, a great place to start is our FAQ on usage. For now, let’s get on -with the imperative-style approach:

    -
    In [2]: import matplotlib.pyplot as plt
    -In [3]: import matplotlib.image as mpimg
    -In [4]: import numpy as np
    -
    -
    -
    -
    -

    Importing image data into Numpy arrays

    -

    Loading image data is supported by the Pillow library. Natively, matplotlib only -supports PNG images. The commands shown below fall back on Pillow if the -native read fails.

    -

    The image used in this example is a PNG file, but keep that Pillow -requirement in mind for your own data.

    -

    Here’s the image we’re going to play with:

    -../_images/stinkbug.png -

    It’s a 24-bit RGB PNG image (8 bits for each of R, G, B). Depending -on where you get your data, the other kinds of image that you’ll most -likely encounter are RGBA images, which allow for transparency, or -single-channel grayscale (luminosity) images. You can right click on -it and choose “Save image as” to download it to your computer for the -rest of this tutorial.

    -

    And here we go...

    -
    In [5]: img=mpimg.imread('stinkbug.png')
    -Out[5]:
    -array([[[ 0.40784314,  0.40784314,  0.40784314],
    -        [ 0.40784314,  0.40784314,  0.40784314],
    -        [ 0.40784314,  0.40784314,  0.40784314],
    -        ...,
    -        [ 0.42745098,  0.42745098,  0.42745098],
    -        [ 0.42745098,  0.42745098,  0.42745098],
    -        [ 0.42745098,  0.42745098,  0.42745098]],
    -
    -       ...,
    -       [[ 0.44313726,  0.44313726,  0.44313726],
    -        [ 0.4509804 ,  0.4509804 ,  0.4509804 ],
    -        [ 0.4509804 ,  0.4509804 ,  0.4509804 ],
    -        ...,
    -        [ 0.44705883,  0.44705883,  0.44705883],
    -        [ 0.44705883,  0.44705883,  0.44705883],
    -        [ 0.44313726,  0.44313726,  0.44313726]]], dtype=float32)
    -
    -
    -

    Note the dtype there - float32. Matplotlib has rescaled the 8 bit -data from each channel to floating point data between 0.0 and 1.0. As -a side note, the only datatype that Pillow can work with is uint8. -Matplotlib plotting can handle float32 and uint8, but image -reading/writing for any format other than PNG is limited to uint8 -data. Why 8 bits? Most displays can only render 8 bits per channel -worth of color gradation. Why can they only render 8 bits/channel? -Because that’s about all the human eye can see. More here (from a -photography standpoint): Luminous Landscape bit depth tutorial.

    -

    Each inner list represents a pixel. Here, with an RGB image, there -are 3 values. Since it’s a black and white image, R, G, and B are all -similar. An RGBA (where A is alpha, or transparency), has 4 values -per inner list, and a simple luminance image just has one value (and -is thus only a 2-D array, not a 3-D array). For RGB and RGBA images, -matplotlib supports float32 and uint8 data types. For grayscale, -matplotlib supports only float32. If your array data does not meet -one of these descriptions, you need to rescale it.

    -
    -
    -

    Plotting numpy arrays as images

    -

    So, you have your data in a numpy array (either by importing it, or by -generating it). Let’s render it. In Matplotlib, this is performed -using the imshow() function. Here we’ll grab -the plot object. This object gives you an easy way to manipulate the -plot from the prompt.

    -
    In [6]: imgplot = plt.imshow(img)
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/image_tutorial-1.png -
    -

    You can also plot any numpy array.

    -
    -

    Applying pseudocolor schemes to image plots

    -

    Pseudocolor can be a useful tool for enhancing contrast and -visualizing your data more easily. This is especially useful when -making presentations of your data using projectors - their contrast is -typically quite poor.

    -

    Pseudocolor is only relevant to single-channel, grayscale, luminosity -images. We currently have an RGB image. Since R, G, and B are all -similar (see for yourself above or in your data), we can just pick one -channel of our data:

    -
    In [7]: lum_img = img[:,:,0]
    -
    -
    -

    This is array slicing. You can read more in the Numpy tutorial.

    -
    In [8]: plt.imshow(lum_img)
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/image_tutorial-2.png -
    -

    Now, with a luminosity (2D, no color) image, the default colormap (aka lookup table, -LUT), is applied. The default is called viridis. There are plenty of -others to choose from.

    -
    In [9]: plt.imshow(lum_img, cmap="hot")
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/image_tutorial-3.png -
    -

    Note that you can also change colormaps on existing plot objects using the -set_cmap() method:

    -
    In [10]: imgplot = plt.imshow(lum_img)
    -In [11]: imgplot.set_cmap('nipy_spectral')
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/image_tutorial-4.png -
    -
    -

    Note

    -

    However, remember that in the IPython notebook with the inline backend, -you can’t make changes to plots that have already been rendered. If you -create imgplot here in one cell, you cannot call set_cmap() on it in a later -cell and expect the earlier plot to change. Make sure that you enter these -commands together in one cell. plt commands will not change plots from earlier -cells.

    -
    -

    There are many other colormap schemes available. See the list and -images of the colormaps.

    -
    -
    -

    Color scale reference

    -

    It’s helpful to have an idea of what value a color represents. We can -do that by adding color bars.

    -
    In [12]: imgplot = plt.imshow(lum_img)
    -In [13]: plt.colorbar()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/image_tutorial-5.png -
    -

    This adds a colorbar to your existing figure. This won’t -automatically change if you change you switch to a different -colormap - you have to re-create your plot, and add in the colorbar -again.

    -
    -
    -

    Examining a specific data range

    -

    Sometimes you want to enhance the contrast in your image, or expand -the contrast in a particular region while sacrificing the detail in -colors that don’t vary much, or don’t matter. A good tool to find -interesting regions is the histogram. To create a histogram of our -image data, we use the hist() function.

    -
    In [14]: plt.hist(lum_img.ravel(), bins=256, range=(0.0, 1.0), fc='k', ec='k')
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/image_tutorial-6.png -
    -

    Most often, the “interesting” part of the image is around the peak, -and you can get extra contrast by clipping the regions above and/or -below the peak. In our histogram, it looks like there’s not much -useful information in the high end (not many white things in the -image). Let’s adjust the upper limit, so that we effectively “zoom in -on” part of the histogram. We do this by passing the clim argument to -imshow. You could also do this by calling the -set_clim() method of the image plot -object, but make sure that you do so in the same cell as your plot -command when working with the IPython Notebook - it will not change -plots from earlier cells.

    -
    In [15]: imgplot = plt.imshow(lum_img, clim=(0.0, 0.7))
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/image_tutorial-7.png -
    -
    -
    -

    Array Interpolation schemes

    -

    Interpolation calculates what the color or value of a pixel “should” -be, according to different mathematical schemes. One common place -that this happens is when you resize an image. The number of pixels -change, but you want the same information. Since pixels are discrete, -there’s missing space. Interpolation is how you fill that space. -This is why your images sometimes come out looking pixelated when you -blow them up. The effect is more pronounced when the difference -between the original image and the expanded image is greater. Let’s -take our image and shrink it. We’re effectively discarding pixels, -only keeping a select few. Now when we plot it, that data gets blown -up to the size on your screen. The old pixels aren’t there anymore, -and the computer has to draw in pixels to fill that space.

    -

    We’ll use the Pillow library that we used to load the image also to resize -the image.

    -
    In [16]: from PIL import Image
    -In [17]: img = Image.open('../_static/stinkbug.png')
    -In [18]: img.thumbnail((64, 64), Image.ANTIALIAS) # resizes image in-place
    -In [19]: imgplot = plt.imshow(img)
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/image_tutorial-8.png -
    -

    Here we have the default interpolation, bilinear, since we did not -give imshow() any interpolation argument.

    -

    Let’s try some others:

    -
    In [20]: imgplot = plt.imshow(img, interpolation="nearest")
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/image_tutorial-9.png -
    -
    In [21]: imgplot = plt.imshow(img, interpolation="bicubic")
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/image_tutorial-10.png -
    -

    Bicubic interpolation is often used when blowing up photos - people -tend to prefer blurry over pixelated.

    -
    -
    -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/users/index_text.html b/users/index_text.html deleted file mode 100644 index 3408e6795bb..00000000000 --- a/users/index_text.html +++ /dev/null @@ -1,367 +0,0 @@ - - - - - - - - Working with text — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -

    Related Topics

    - -
    -
    -

    This Page

    - -
    - - -
    -
    - - - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/users/legend_guide-1.pdf b/users/legend_guide-1.pdf deleted file mode 100644 index f4cd7052f8e..00000000000 Binary files a/users/legend_guide-1.pdf and /dev/null differ diff --git a/users/legend_guide-1.png b/users/legend_guide-1.png deleted file mode 100644 index b09baddc089..00000000000 Binary files a/users/legend_guide-1.png and /dev/null differ diff --git a/users/legend_guide-1.py b/users/legend_guide-1.py deleted file mode 100644 index 12f9d71bf49..00000000000 --- a/users/legend_guide-1.py +++ /dev/null @@ -1,7 +0,0 @@ -import matplotlib.patches as mpatches -import matplotlib.pyplot as plt - -red_patch = mpatches.Patch(color='red', label='The red data') -plt.legend(handles=[red_patch]) - -plt.show() \ No newline at end of file diff --git a/users/legend_guide-2.pdf b/users/legend_guide-2.pdf deleted file mode 100644 index 1bffaa1df10..00000000000 Binary files a/users/legend_guide-2.pdf and /dev/null differ diff --git a/users/legend_guide-2.png b/users/legend_guide-2.png deleted file mode 100644 index 8e528297a58..00000000000 Binary files a/users/legend_guide-2.png and /dev/null differ diff --git a/users/legend_guide-2.py b/users/legend_guide-2.py deleted file mode 100644 index 2aa6c285a9e..00000000000 --- a/users/legend_guide-2.py +++ /dev/null @@ -1,8 +0,0 @@ -import matplotlib.lines as mlines -import matplotlib.pyplot as plt - -blue_line = mlines.Line2D([], [], color='blue', marker='*', - markersize=15, label='Blue stars') -plt.legend(handles=[blue_line]) - -plt.show() \ No newline at end of file diff --git a/users/legend_guide-3.pdf b/users/legend_guide-3.pdf deleted file mode 100644 index 17e47e4c36a..00000000000 Binary files a/users/legend_guide-3.pdf and /dev/null differ diff --git a/users/legend_guide-3.png b/users/legend_guide-3.png deleted file mode 100644 index ad606877c75..00000000000 Binary files a/users/legend_guide-3.png and /dev/null differ diff --git a/users/legend_guide-3.py b/users/legend_guide-3.py deleted file mode 100644 index ad702568905..00000000000 --- a/users/legend_guide-3.py +++ /dev/null @@ -1,7 +0,0 @@ -import matplotlib.pyplot as plt -from matplotlib.legend_handler import HandlerLine2D - -line1, = plt.plot([3,2,1], marker='o', label='Line 1') -line2, = plt.plot([1,2,3], marker='o', label='Line 2') - -plt.legend(handler_map={line1: HandlerLine2D(numpoints=4)}) \ No newline at end of file diff --git a/users/legend_guide-4.pdf b/users/legend_guide-4.pdf deleted file mode 100644 index 6198b9edd4f..00000000000 Binary files a/users/legend_guide-4.pdf and /dev/null differ diff --git a/users/legend_guide-4.png b/users/legend_guide-4.png deleted file mode 100644 index 6a294d17696..00000000000 Binary files a/users/legend_guide-4.png and /dev/null differ diff --git a/users/legend_guide-4.py b/users/legend_guide-4.py deleted file mode 100644 index 792df651f17..00000000000 --- a/users/legend_guide-4.py +++ /dev/null @@ -1,10 +0,0 @@ -import matplotlib.pyplot as plt -from numpy.random import randn - -z = randn(10) - -red_dot, = plt.plot(z, "ro", markersize=15) -# Put a white cross over some of the data. -white_cross, = plt.plot(z[:5], "w+", markeredgewidth=3, markersize=15) - -plt.legend([red_dot, (red_dot, white_cross)], ["Attr A", "Attr A+B"]) \ No newline at end of file diff --git a/users/legend_guide-5.pdf b/users/legend_guide-5.pdf deleted file mode 100644 index ae2dfe467f7..00000000000 Binary files a/users/legend_guide-5.pdf and /dev/null differ diff --git a/users/legend_guide-5.png b/users/legend_guide-5.png deleted file mode 100644 index 14654a6d407..00000000000 Binary files a/users/legend_guide-5.png and /dev/null differ diff --git a/users/legend_guide-5.py b/users/legend_guide-5.py deleted file mode 100644 index b6253056b86..00000000000 --- a/users/legend_guide-5.py +++ /dev/null @@ -1,18 +0,0 @@ -import matplotlib.pyplot as plt -import matplotlib.patches as mpatches - -class AnyObject(object): - pass - -class AnyObjectHandler(object): - def legend_artist(self, legend, orig_handle, fontsize, handlebox): - x0, y0 = handlebox.xdescent, handlebox.ydescent - width, height = handlebox.width, handlebox.height - patch = mpatches.Rectangle([x0, y0], width, height, facecolor='red', - edgecolor='black', hatch='xx', lw=3, - transform=handlebox.get_transform()) - handlebox.add_artist(patch) - return patch - -plt.legend([AnyObject()], ['My first handler'], - handler_map={AnyObject: AnyObjectHandler()}) \ No newline at end of file diff --git a/users/legend_guide-6.pdf b/users/legend_guide-6.pdf deleted file mode 100644 index 4fd3d987d17..00000000000 Binary files a/users/legend_guide-6.pdf and /dev/null differ diff --git a/users/legend_guide-6.png b/users/legend_guide-6.png deleted file mode 100644 index 65afcf993df..00000000000 Binary files a/users/legend_guide-6.png and /dev/null differ diff --git a/users/legend_guide-6.py b/users/legend_guide-6.py deleted file mode 100644 index 2fad06bd5f3..00000000000 --- a/users/legend_guide-6.py +++ /dev/null @@ -1,22 +0,0 @@ -from matplotlib.legend_handler import HandlerPatch -import matplotlib.pyplot as plt -import matplotlib.patches as mpatches - - -class HandlerEllipse(HandlerPatch): - def create_artists(self, legend, orig_handle, - xdescent, ydescent, width, height, fontsize, trans): - center = 0.5 * width - 0.5 * xdescent, 0.5 * height - 0.5 * ydescent - p = mpatches.Ellipse(xy=center, width=width + xdescent, - height=height + ydescent) - self.update_prop(p, orig_handle, legend) - p.set_transform(trans) - return [p] - - -c = mpatches.Circle((0.5, 0.5), 0.25, facecolor="green", - edgecolor="red", linewidth=3) -plt.gca().add_patch(c) - -plt.legend([c], ["An ellipse, not a rectangle"], - handler_map={mpatches.Circle: HandlerEllipse()}) \ No newline at end of file diff --git a/users/legend_guide.html b/users/legend_guide.html deleted file mode 100644 index 7193c79ece7..00000000000 --- a/users/legend_guide.html +++ /dev/null @@ -1,629 +0,0 @@ - - - - - - - - Legend guide — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - - - -
    -
    -
    -
    - -
    -

    Legend guide

    -

    This legend guide is an extension of the documentation available at -legend() - please ensure you are familiar with -contents of that documentation before proceeding with this guide.

    -

    This guide makes use of some common terms, which are documented here for clarity:

    -
    -
    legend entry
    -
    A legend is made up of one or more legend entries. An entry is made up of -exactly one key and one label.
    -
    legend key
    -
    The colored/patterned marker to the left of each legend label.
    -
    legend label
    -
    The text which describes the handle represented by the key.
    -
    legend handle
    -
    The original object which is used to generate an appropriate entry in -the legend.
    -
    -
    -

    Controlling the legend entries

    -

    Calling legend() with no arguments automatically fetches the legend -handles and their associated labels. This functionality is equivalent to:

    -
    handles, labels = ax.get_legend_handles_labels()
    -ax.legend(handles, labels)
    -
    -
    -

    The get_legend_handles_labels() function returns -a list of handles/artists which exist on the Axes which can be used to -generate entries for the resulting legend - it is worth noting however that -not all artists can be added to a legend, at which point a “proxy” will have -to be created (see Creating artists specifically for adding to the legend (aka. Proxy artists) for further details).

    -

    For full control of what is being added to the legend, it is common to pass -the appropriate handles directly to legend():

    -
    line_up, = plt.plot([1,2,3], label='Line 2')
    -line_down, = plt.plot([3,2,1], label='Line 1')
    -plt.legend(handles=[line_up, line_down])
    -
    -
    -

    In some cases, it is not possible to set the label of the handle, so it is -possible to pass through the list of labels to legend():

    -
    line_up, = plt.plot([1,2,3], label='Line 2')
    -line_down, = plt.plot([3,2,1], label='Line 1')
    -plt.legend([line_up, line_down], ['Line Up', 'Line Down'])
    -
    -
    -
    -
    -

    Creating artists specifically for adding to the legend (aka. Proxy artists)

    -

    Not all handles can be turned into legend entries automatically, -so it is often necessary to create an artist which can. Legend handles -don’t have to exists on the Figure or Axes in order to be used.

    -

    Suppose we wanted to create a legend which has an entry for some data which -is represented by a red color:

    -
    import matplotlib.patches as mpatches
    -import matplotlib.pyplot as plt
    -
    -red_patch = mpatches.Patch(color='red', label='The red data')
    -plt.legend(handles=[red_patch])
    -
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/legend_guide-1.png -
    -

    There are many supported legend handles, instead of creating a patch of color -we could have created a line with a marker:

    -
    import matplotlib.lines as mlines
    -import matplotlib.pyplot as plt
    -
    -blue_line = mlines.Line2D([], [], color='blue', marker='*',
    -                          markersize=15, label='Blue stars')
    -plt.legend(handles=[blue_line])
    -
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/legend_guide-2.png -
    -
    -
    -

    Legend location

    -

    The location of the legend can be specified by the keyword argument -loc. Please see the documentation at legend() for more details.

    -

    The bbox_to_anchor keyword gives a great degree of control for manual -legend placement. For example, if you want your axes legend located at the -figure’s top right-hand corner instead of the axes’ corner, simply specify -the corner’s location, and the coordinate system of that location:

    -
    plt.legend(bbox_to_anchor=(1, 1),
    -           bbox_transform=plt.gcf().transFigure)
    -
    -
    -

    More examples of custom legend placement:

    -
    import matplotlib.pyplot as plt
    -
    -
    -plt.subplot(211)
    -plt.plot([1,2,3], label="test1")
    -plt.plot([3,2,1], label="test2")
    -# Place a legend above this subplot, expanding itself to
    -# fully use the given bounding box.
    -plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3,
    -           ncol=2, mode="expand", borderaxespad=0.)
    -
    -plt.subplot(223)
    -plt.plot([1,2,3], label="test1")
    -plt.plot([3,2,1], label="test2")
    -# Place a legend to the right of this smaller subplot.
    -plt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
    -
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/simple_legend01.png -
    -
    -
    -

    Multiple legends on the same Axes

    -

    Sometimes it is more clear to split legend entries across multiple -legends. Whilst the instinctive approach to doing this might be to call -the legend() function multiple times, you will find that only one -legend ever exists on the Axes. This has been done so that it is possible -to call legend() repeatedly to update the legend to the latest -handles on the Axes, so to persist old legend instances, we must add them -manually to the Axes:

    -
    import matplotlib.pyplot as plt
    -
    -line1, = plt.plot([1,2,3], label="Line 1", linestyle='--')
    -line2, = plt.plot([3,2,1], label="Line 2", linewidth=4)
    -
    -# Create a legend for the first line.
    -first_legend = plt.legend(handles=[line1], loc=1)
    -
    -# Add the legend manually to the current Axes.
    -ax = plt.gca().add_artist(first_legend)
    -
    -# Create another legend for the second line.
    -plt.legend(handles=[line2], loc=4)
    -
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/simple_legend02.png -
    -
    -
    -

    Legend Handlers

    -

    In order to create legend entries, handles are given as an argument to an -appropriate HandlerBase subclass. -The choice of handler subclass is determined by the following rules:

    -
    -
      -
    1. Update get_legend_handler_map() -with the value in the handler_map keyword.
    2. -
    3. Check if the handle is in the newly created handler_map.
    4. -
    5. Check if the type of handle is in the newly created -handler_map.
    6. -
    7. Check if any of the types in the handle‘s mro is in the newly -created handler_map.
    8. -
    -
    -

    For completeness, this logic is mostly implemented in -get_legend_handler().

    -

    All of this flexibility means that we have the necessary hooks to implement -custom handlers for our own type of legend key.

    -

    The simplest example of using custom handlers is to instantiate one of the -existing HandlerBase subclasses. For the -sake of simplicity, let’s choose matplotlib.legend_handler.HandlerLine2D -which accepts a numpoints argument (note numpoints is a keyword -on the legend() function for convenience). We can then pass the mapping -of instance to Handler as a keyword to legend.

    -
    import matplotlib.pyplot as plt
    -from matplotlib.legend_handler import HandlerLine2D
    -
    -line1, = plt.plot([3,2,1], marker='o', label='Line 1')
    -line2, = plt.plot([1,2,3], marker='o', label='Line 2')
    -
    -plt.legend(handler_map={line1: HandlerLine2D(numpoints=4)})
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/legend_guide-3.png -
    -

    As you can see, “Line 1” now has 4 marker points, where “Line 2” has 2 (the -default). Try the above code, only change the map’s key from line1 to -type(line1). Notice how now both Line2D instances -get 4 markers.

    -

    Along with handlers for complex plot types such as errorbars, stem plots -and histograms, the default handler_map has a special tuple handler -(HandlerTuple) which simply plots -the handles on top of one another for each item in the given tuple. The -following example demonstrates combining two legend keys on top of one another:

    -
    import matplotlib.pyplot as plt
    -from numpy.random import randn
    -
    -z = randn(10)
    -
    -red_dot, = plt.plot(z, "ro", markersize=15)
    -# Put a white cross over some of the data.
    -white_cross, = plt.plot(z[:5], "w+", markeredgewidth=3, markersize=15)
    -
    -plt.legend([red_dot, (red_dot, white_cross)], ["Attr A", "Attr A+B"])
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/legend_guide-4.png -
    -
    -

    Implementing a custom legend handler

    -

    A custom handler can be implemented to turn any handle into a legend key (handles -don’t necessarily need to be matplotlib artists). -The handler must implement a “legend_artist” method which returns a -single artist for the legend to use. Signature details about the “legend_artist” -are documented at legend_artist().

    -
    import matplotlib.pyplot as plt
    -import matplotlib.patches as mpatches
    -
    -class AnyObject(object):
    -    pass
    -
    -class AnyObjectHandler(object):
    -    def legend_artist(self, legend, orig_handle, fontsize, handlebox):
    -        x0, y0 = handlebox.xdescent, handlebox.ydescent
    -        width, height = handlebox.width, handlebox.height
    -        patch = mpatches.Rectangle([x0, y0], width, height, facecolor='red',
    -                                   edgecolor='black', hatch='xx', lw=3,
    -                                   transform=handlebox.get_transform())
    -        handlebox.add_artist(patch)
    -        return patch
    -
    -plt.legend([AnyObject()], ['My first handler'],
    -           handler_map={AnyObject: AnyObjectHandler()})
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/legend_guide-5.png -
    -

    Alternatively, had we wanted to globally accept AnyObject instances without -needing to manually set the handler_map keyword all the time, we could have -registered the new handler with:

    -
    from matplotlib.legend import Legend
    -Legend.update_default_handler_map({AnyObject: AnyObjectHandler()})
    -
    -
    -

    Whilst the power here is clear, remember that there are already many handlers -implemented and what you want to achieve may already be easily possible with -existing classes. For example, to produce elliptical legend keys, rather than -rectangular ones:

    -
    from matplotlib.legend_handler import HandlerPatch
    -import matplotlib.pyplot as plt
    -import matplotlib.patches as mpatches
    -
    -
    -class HandlerEllipse(HandlerPatch):
    -    def create_artists(self, legend, orig_handle,
    -                       xdescent, ydescent, width, height, fontsize, trans):
    -        center = 0.5 * width - 0.5 * xdescent, 0.5 * height - 0.5 * ydescent
    -        p = mpatches.Ellipse(xy=center, width=width + xdescent,
    -                             height=height + ydescent)
    -        self.update_prop(p, orig_handle, legend)
    -        p.set_transform(trans)
    -        return [p]
    -
    -
    -c = mpatches.Circle((0.5, 0.5), 0.25, facecolor="green",
    -                    edgecolor="red", linewidth=3)
    -plt.gca().add_patch(c)
    -
    -plt.legend([c], ["An ellipse, not a rectangle"],
    -           handler_map={mpatches.Circle: HandlerEllipse()})
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/legend_guide-6.png -
    -
    -
    - -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/users/mathtext.html b/users/mathtext.html deleted file mode 100644 index 3da935bf653..00000000000 --- a/users/mathtext.html +++ /dev/null @@ -1,1489 +0,0 @@ - - - - - - - - Writing mathematical expressions — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -

    Table Of Contents

    - -
    -

    Related Topics

    - -
    -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    Writing mathematical expressions

    -

    You can use a subset TeX markup in any matplotlib text string by -placing it inside a pair of dollar signs ($).

    -

    Note that you do not need to have TeX installed, since matplotlib -ships its own TeX expression parser, layout engine and fonts. The -layout engine is a fairly direct adaptation of the layout algorithms -in Donald Knuth’s TeX, so the quality is quite good (matplotlib also -provides a usetex option for those who do want to call out to TeX -to generate their text (see Text rendering With LaTeX).

    -

    Any text element can use math text. You should use raw strings (precede the -quotes with an 'r'), and surround the math text with dollar signs ($), as in -TeX. Regular text and mathtext can be interleaved within the same string. -Mathtext can use DejaVu Sans (default), DejaVu Serif, the Computer Modern fonts -(from (La)TeX), STIX fonts (with are designed -to blend well with Times), or a Unicode font that you provide. The mathtext -font can be selected with the customization variable mathtext.fontset (see -Customizing matplotlib)

    -
    -

    Note

    -

    On “narrow” builds -of Python, if you use the STIX fonts you should also set -ps.fonttype and pdf.fonttype to 3 (the default), not 42. -Otherwise some characters will not be visible.

    -
    -

    Here is a simple example:

    -
    # plain text
    -plt.title('alpha > beta')
    -
    -
    -

    produces “alpha > beta”.

    -

    Whereas this:

    -
    # math text
    -plt.title(r'$\alpha > \beta$')
    -
    -
    -

    produces “”.

    -
    -

    Note

    -

    Mathtext should be placed between a pair of dollar signs ($). To -make it easy to display monetary values, e.g., “$100.00”, if a -single dollar sign is present in the entire string, it will be -displayed verbatim as a dollar sign. This is a small change from -regular TeX, where the dollar sign in non-math text would have to -be escaped (‘\$’).

    -
    -
    -

    Note

    -

    While the syntax inside the pair of dollar signs ($) aims to be -TeX-like, the text outside does not. In particular, characters -such as:

    -
    # $ % & ~ _ ^ \ { } \( \) \[ \]
    -
    -
    -

    have special meaning outside of math mode in TeX. Therefore, these -characters will behave differently depending on the rcParam -text.usetex flag. See the usetex tutorial for more information.

    -
    -
    -

    Subscripts and superscripts

    -

    To make subscripts and superscripts, use the '_' and '^' symbols:

    -
    r'$\alpha_i > \beta_i$'
    -
    -
    -

    Some symbols automatically put their sub/superscripts under and over -the operator. For example, to write the sum of from to -, you could do:

    -
    r'$\sum_{i=0}^\infty x_i$'
    -
    -
    -
    -
    -

    Fractions, binomials and stacked numbers

    -

    Fractions, binomials and stacked numbers can be created with the -\frac{}{}, \binom{}{} and \stackrel{}{} commands, -respectively:

    -
    r'$\frac{3}{4} \binom{3}{4} \stackrel{3}{4}$'
    -
    -
    -

    produces

    -

    Fractions can be arbitrarily nested:

    -
    r'$\frac{5 - \frac{1}{x}}{4}$'
    -
    -
    -

    produces

    -

    Note that special care needs to be taken to place parentheses and brackets around -fractions. Doing things the obvious way produces brackets that are -too small:

    -
    r'$(\frac{5 - \frac{1}{x}}{4})$'
    -
    -
    -

    The solution is to precede the bracket with \left and \right -to inform the parser that those brackets encompass the entire object:

    -
    r'$\left(\frac{5 - \frac{1}{x}}{4}\right)$'
    -
    -
    -
    -
    -

    Radicals

    -

    Radicals can be produced with the \sqrt[]{} command. For example:

    -
    r'$\sqrt{2}$'
    -
    -
    -

    Any base can (optionally) be provided inside square brackets. Note -that the base must be a simple expression, and can not contain layout -commands such as fractions or sub/superscripts:

    -
    r'$\sqrt[3]{x}$'
    -
    -
    -
    -
    -

    Fonts

    -

    The default font is italics for mathematical symbols.

    -
    -

    Note

    -

    This default can be changed using the mathtext.default rcParam. -This is useful, for example, to use the same font as regular -non-math text for math text, by setting it to regular.

    -
    -

    To change fonts, e.g., to write “sin” in a Roman font, enclose the text -in a font command:

    -
    r'$s(t) = \mathcal{A}\mathrm{sin}(2 \omega t)$'
    -
    -
    -

    More conveniently, many commonly used function names that are typeset in a -Roman font have shortcuts. So the expression above could be written -as follows:

    -
    r'$s(t) = \mathcal{A}\sin(2 \omega t)$'
    -
    -
    -

    Here “s” and “t” are variable in italics font (default), “sin” is in -Roman font, and the amplitude “A” is in calligraphy font. Note in the -example above the caligraphy A is squished into the sin. You -can use a spacing command to add a little whitespace between them:

    -
    s(t) = \mathcal{A}\/\sin(2 \omega t)
    -
    -
    -

    The choices available with all fonts are:

    -
    -
    ---- - - - - - - - - - - - - - - - - - - - -
    CommandResult
    \mathrm{Roman}
    \mathit{Italic}
    \mathtt{Typewriter}
    \mathcal{CALLIGRAPHY}
    -
    -

    When using the STIX fonts, you also have the choice of:

    -
    -
    ---- - - - - - - - - - - - - - - - - - - - - - - -
    CommandResult
    \mathbb{blackboard}
    \mathrm{\mathbb{blackboard}}
    \mathfrak{Fraktur}
    \mathsf{sansserif}
    \mathrm{\mathsf{sansserif}}
    -
    - ---- - - - - - -
    \mathcircled{circled}
    -

    There are also three global “font sets” to choose from, which are -selected using the mathtext.fontset parameter in -matplotlibrc.

    -

    cm: Computer Modern (TeX)

    -../_images/cm_fontset.png -

    stix: STIX (designed to blend well with Times)

    -../_images/stix_fontset.png -

    stixsans: STIX sans-serif

    -../_images/stixsans_fontset.png -

    Additionally, you can use \mathdefault{...} or its alias -\mathregular{...} to use the font used for regular text outside of -mathtext. There are a number of limitations to this approach, most -notably that far fewer symbols will be available, but it can be useful -to make math expressions blend well with other text in the plot.

    -
    -

    Custom fonts

    -

    mathtext also provides a way to use custom fonts for math. This -method is fairly tricky to use, and should be considered an -experimental feature for patient users only. By setting the rcParam -mathtext.fontset to custom, you can then set the following -parameters, which control which font file to use for a particular set -of math characters.

    -
    -
    ---- - - - - - - - - - - - - - - - - - - - - - - - - - -
    ParameterCorresponds to
    mathtext.it\mathit{} or default italic
    mathtext.rm\mathrm{} Roman (upright)
    mathtext.tt\mathtt{} Typewriter (monospace)
    mathtext.bf\mathbf{} bold italic
    mathtext.cal\mathcal{} calligraphic
    mathtext.sf\mathsf{} sans-serif
    -
    -

    Each parameter should be set to a fontconfig font descriptor (as -defined in the yet-to-be-written font chapter).

    -

    The fonts used should have a Unicode mapping in order to find any -non-Latin characters, such as Greek. If you want to use a math symbol -that is not contained in your custom fonts, you can set the rcParam -mathtext.fallback_to_cm to True which will cause the mathtext -system to use characters from the default Computer Modern fonts -whenever a particular character can not be found in the custom font.

    -

    Note that the math glyphs specified in Unicode have evolved over time, -and many fonts may not have glyphs in the correct place for mathtext.

    -
    -
    -
    -

    Accents

    -

    An accent command may precede any symbol to add an accent above it. -There are long and short forms for some of them.

    -
    -
    ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    CommandResult
    \acute a or \'a
    \bar a
    \breve a
    \ddot a or \"a
    \dot a or \.a
    \grave a or \`a
    \hat a or \^a
    \tilde a or \~a
    \vec a
    \overline{abc}
    -
    -

    In addition, there are two special accents that automatically adjust -to the width of the symbols below:

    -
    -
    ---- - - - - - - - - - - - - - -
    CommandResult
    \widehat{xyz}
    \widetilde{xyz}
    -
    -

    Care should be taken when putting accents on lower-case i’s and j’s. -Note that in the following \imath is used to avoid the extra dot -over the i:

    -
    r"$\hat i\ \ \hat \imath$"
    -
    -
    -
    -
    -

    Symbols

    -

    You can also use a large number of the TeX symbols, as in \infty, -\leftarrow, \sum, \int.

    -

    Lower-case Greek

    -
    -
    ------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    \alpha \beta \chi \delta \digamma
    \epsilon \eta \gamma \iota \kappa
    \lambda \mu \nu \omega \phi
    \pi \psi \rho \sigma \tau
    \theta \upsilon \varepsilon \varkappa \varphi
    \varpi \varrho \varsigma \vartheta \xi
    \zeta    
    -
    -

    Upper-case Greek

    -
    -
    -------- - - - - - - - - - - - - - - - - - - - - - - - -
    \Delta \Gamma \Lambda \Omega \Phi \Pi
    \Psi \Sigma \Theta \Upsilon \Xi \mho
    \nabla     
    -
    -

    Hebrew

    -
    -
    ------ - - - - - - - -
    \aleph \beth \daleth \gimel
    -
    -

    Delimiters

    -
    -
    -------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    / [ \Downarrow \Uparrow \Vert \backslash
    \downarrow \langle \lceil \lfloor \llcorner \lrcorner
    \rangle \rceil \rfloor \ulcorner \uparrow \urcorner
    \vert \{ \| \} ] |
    -
    -

    Big symbols

    -
    -
    ------- - - - - - - - - - - - - - - - - - - - - -
    \bigcap \bigcup \bigodot \bigoplus \bigotimes
    \biguplus \bigvee \bigwedge \coprod \int
    \oint \prod \sum  
    -
    -

    Standard function names

    -
    -
    ------ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    \Pr \arccos \arcsin \arctan
    \arg \cos \cosh \cot
    \coth \csc \deg \det
    \dim \exp \gcd \hom
    \inf \ker \lg \lim
    \liminf \limsup \ln \log
    \max \min \sec \sin
    \sinh \sup \tan \tanh
    -
    -

    Binary operation and relation symbols

    -
    -
    ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    \Bumpeq \Cap \Cup
    \Doteq \Join \Subset
    \Supset \Vdash \Vvdash
    \approx \approxeq \ast
    \asymp \backepsilon \backsim
    \backsimeq \barwedge \because
    \between \bigcirc \bigtriangledown
    \bigtriangleup \blacktriangleleft \blacktriangleright
    \bot \bowtie \boxdot
    \boxminus \boxplus \boxtimes
    \bullet \bumpeq \cap
    \cdot \circ \circeq
    \coloneq \cong \cup
    \curlyeqprec \curlyeqsucc \curlyvee
    \curlywedge \dag \dashv
    \ddag \diamond \div
    \divideontimes \doteq \doteqdot
    \dotplus \doublebarwedge \eqcirc
    \eqcolon \eqsim \eqslantgtr
    \eqslantless \equiv \fallingdotseq
    - ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    \frown \geq \geqq
    \geqslant \gg \ggg
    \gnapprox \gneqq \gnsim
    \gtrapprox \gtrdot \gtreqless
    \gtreqqless \gtrless \gtrsim
    \in \intercal \leftthreetimes
    \leq \leqq \leqslant
    \lessapprox \lessdot \lesseqgtr
    \lesseqqgtr \lessgtr \lesssim
    \ll \lll \lnapprox
    \lneqq \lnsim \ltimes
    \mid \models \mp
    \nVDash \nVdash \napprox
    \ncong \ne \neq
    \neq \nequiv \ngeq
    \ngtr \ni \nleq
    \nless \nmid \notin
    \nparallel \nprec \nsim
    \nsubset \nsubseteq \nsucc
    \nsupset \nsupseteq \ntriangleleft
    - ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    \ntrianglelefteq \ntriangleright \ntrianglerighteq
    \nvDash \nvdash \odot
    \ominus \oplus \oslash
    \otimes \parallel \perp
    \pitchfork \pm \prec
    \precapprox \preccurlyeq \preceq
    \precnapprox \precnsim \precsim
    \propto \rightthreetimes \risingdotseq
    \rtimes \sim \simeq
    \slash \smile \sqcap
    \sqcup \sqsubset \sqsubset
    \sqsubseteq \sqsupset \sqsupset
    \sqsupseteq \star \subset
    \subseteq \subseteqq \subsetneq
    \subsetneqq \succ \succapprox
    \succcurlyeq \succeq \succnapprox
    \succnsim \succsim \supset
    \supseteq \supseteqq \supsetneq
    \supsetneqq \therefore \times
    \top \triangleleft \trianglelefteq
    - ----- - - - - - - - - - - - - - - - - - - - - - - -
    \triangleq \triangleright \trianglerighteq
    \uplus \vDash \varpropto
    \vartriangleleft \vartriangleright \vdash
    \vee \veebar \wedge
    \wr  
    -
    -

    Arrow symbols

    -
    -
    ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    \Downarrow \Leftarrow
    \Leftrightarrow \Lleftarrow
    \Longleftarrow \Longleftrightarrow
    \Longrightarrow \Lsh
    \Nearrow \Nwarrow
    \Rightarrow \Rrightarrow
    \Rsh \Searrow
    \Swarrow \Uparrow
    \Updownarrow \circlearrowleft
    \circlearrowright \curvearrowleft
    \curvearrowright \dashleftarrow
    \dashrightarrow \downarrow
    \downdownarrows \downharpoonleft
    \downharpoonright \hookleftarrow
    \hookrightarrow \leadsto
    \leftarrow \leftarrowtail
    \leftharpoondown \leftharpoonup
    \leftleftarrows \leftrightarrow
    \leftrightarrows \leftrightharpoons
    \leftrightsquigarrow \leftsquigarrow
    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    \longleftarrow \longleftrightarrow
    \longmapsto \longrightarrow
    \looparrowleft \looparrowright
    \mapsto \multimap
    \nLeftarrow \nLeftrightarrow
    \nRightarrow \nearrow
    \nleftarrow \nleftrightarrow
    \nrightarrow \nwarrow
    \rightarrow \rightarrowtail
    \rightharpoondown \rightharpoonup
    \rightleftarrows \rightleftarrows
    \rightleftharpoons \rightleftharpoons
    \rightrightarrows \rightrightarrows
    \rightsquigarrow \searrow
    \swarrow \to
    \twoheadleftarrow \twoheadrightarrow
    \uparrow \updownarrow
    \updownarrow \upharpoonleft
    \upharpoonright \upuparrows
    - ---- - - - - - -
      
    -
    -

    Miscellaneous symbols

    -
    -
    ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    \$ \AA \Finv
    \Game \Im \P
    \Re \S \angle
    \backprime \bigstar \blacksquare
    \blacktriangle \blacktriangledown \cdots
    \checkmark \circledR \circledS
    \clubsuit \complement \copyright
    \ddots \diamondsuit \ell
    \emptyset \eth \exists
    \flat \forall \hbar
    \heartsuit \hslash \iiint
    \iint \iint \imath
    \infty \jmath \ldots
    \measuredangle \natural \neg
    \nexists \oiiint \partial
    \prime \sharp \spadesuit
    \sphericalangle \ss \triangledown
    \varnothing \vartriangle \vdots
    \wp \yen 
    -
    -

    If a particular symbol does not have a name (as is true of many of the -more obscure symbols in the STIX fonts), Unicode characters can -also be used:

    -
    ur'$\u23ce$'
    -
    -
    -
    -
    -

    Example

    -

    Here is an example illustrating many of these features in context.

    -
    import numpy as np
    -import matplotlib.pyplot as plt
    -t = np.arange(0.0, 2.0, 0.01)
    -s = np.sin(2*np.pi*t)
    -
    -plt.plot(t,s)
    -plt.title(r'$\alpha_i > \beta_i$', fontsize=20)
    -plt.text(1, -0.6, r'$\sum_{i=0}^\infty x_i$', fontsize=20)
    -plt.text(0.6, 0.6, r'$\mathcal{A}\mathrm{sin}(2 \omega t)$',
    -         fontsize=20)
    -plt.xlabel('time (s)')
    -plt.ylabel('volts (mV)')
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/pyplot_mathtext.png -
    -
    -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/users/path_tutorial-1.pdf b/users/path_tutorial-1.pdf deleted file mode 100644 index dca7cc7f4c0..00000000000 Binary files a/users/path_tutorial-1.pdf and /dev/null differ diff --git a/users/path_tutorial-1.png b/users/path_tutorial-1.png deleted file mode 100644 index e12b8c62c9c..00000000000 Binary files a/users/path_tutorial-1.png and /dev/null differ diff --git a/users/path_tutorial-1.py b/users/path_tutorial-1.py deleted file mode 100644 index dcb420135bc..00000000000 --- a/users/path_tutorial-1.py +++ /dev/null @@ -1,28 +0,0 @@ -import matplotlib.pyplot as plt -from matplotlib.path import Path -import matplotlib.patches as patches - -verts = [ - (0., 0.), # left, bottom - (0., 1.), # left, top - (1., 1.), # right, top - (1., 0.), # right, bottom - (0., 0.), # ignored - ] - -codes = [Path.MOVETO, - Path.LINETO, - Path.LINETO, - Path.LINETO, - Path.CLOSEPOLY, - ] - -path = Path(verts, codes) - -fig = plt.figure() -ax = fig.add_subplot(111) -patch = patches.PathPatch(path, facecolor='orange', lw=2) -ax.add_patch(patch) -ax.set_xlim(-2,2) -ax.set_ylim(-2,2) -plt.show() \ No newline at end of file diff --git a/users/path_tutorial-2.pdf b/users/path_tutorial-2.pdf deleted file mode 100644 index bdd39b65b7a..00000000000 Binary files a/users/path_tutorial-2.pdf and /dev/null differ diff --git a/users/path_tutorial-2.png b/users/path_tutorial-2.png deleted file mode 100644 index 07d339e8946..00000000000 Binary files a/users/path_tutorial-2.png and /dev/null differ diff --git a/users/path_tutorial-2.py b/users/path_tutorial-2.py deleted file mode 100644 index ccadb7171c2..00000000000 --- a/users/path_tutorial-2.py +++ /dev/null @@ -1,35 +0,0 @@ -import matplotlib.pyplot as plt -from matplotlib.path import Path -import matplotlib.patches as patches - -verts = [ - (0., 0.), # P0 - (0.2, 1.), # P1 - (1., 0.8), # P2 - (0.8, 0.), # P3 - ] - -codes = [Path.MOVETO, - Path.CURVE4, - Path.CURVE4, - Path.CURVE4, - ] - -path = Path(verts, codes) - -fig = plt.figure() -ax = fig.add_subplot(111) -patch = patches.PathPatch(path, facecolor='none', lw=2) -ax.add_patch(patch) - -xs, ys = zip(*verts) -ax.plot(xs, ys, 'x--', lw=2, color='black', ms=10) - -ax.text(-0.05, -0.05, 'P0') -ax.text(0.15, 1.05, 'P1') -ax.text(1.05, 0.85, 'P2') -ax.text(0.85, -0.05, 'P3') - -ax.set_xlim(-0.1, 1.1) -ax.set_ylim(-0.1, 1.1) -plt.show() \ No newline at end of file diff --git a/users/path_tutorial.html b/users/path_tutorial.html deleted file mode 100644 index 83135d376b4..00000000000 --- a/users/path_tutorial.html +++ /dev/null @@ -1,527 +0,0 @@ - - - - - - - - Path Tutorial — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -

    Table Of Contents

    - -
    -

    Related Topics

    - -
    -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    Path Tutorial

    -

    The object underlying all of the matplotlib.patch objects is -the Path, which supports the standard set of -moveto, lineto, curveto commands to draw simple and compound outlines -consisting of line segments and splines. The Path is instantiated -with a (N,2) array of (x,y) vertices, and a N-length array of path -codes. For example to draw the unit rectangle from (0,0) to (1,1), we -could use this code

    -
    import matplotlib.pyplot as plt
    -from matplotlib.path import Path
    -import matplotlib.patches as patches
    -
    -verts = [
    -    (0., 0.), # left, bottom
    -    (0., 1.), # left, top
    -    (1., 1.), # right, top
    -    (1., 0.), # right, bottom
    -    (0., 0.), # ignored
    -    ]
    -
    -codes = [Path.MOVETO,
    -         Path.LINETO,
    -         Path.LINETO,
    -         Path.LINETO,
    -         Path.CLOSEPOLY,
    -         ]
    -
    -path = Path(verts, codes)
    -
    -fig = plt.figure()
    -ax = fig.add_subplot(111)
    -patch = patches.PathPatch(path, facecolor='orange', lw=2)
    -ax.add_patch(patch)
    -ax.set_xlim(-2,2)
    -ax.set_ylim(-2,2)
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/path_tutorial-1.png -
    -

    The following path codes are recognized

    - ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    CodeVerticesDescription
    STOP1 (ignored)A marker for the end of the entire path (currently not required and ignored)
    MOVETO1Pick up the pen and move to the given vertex.
    LINETO1Draw a line from the current position to the given vertex.
    CURVE32 (1 control point, 1 endpoint)Draw a quadratic Bézier curve from the current position, with the given control point, to the given end point.
    CURVE43 (2 control points, 1 endpoint)Draw a cubic Bézier curve from the current position, with the given control points, to the given end point.
    CLOSEPOLY1 (point itself is ignored)Draw a line segment to the start point of the current polyline.
    -
    -

    Bézier example

    -

    Some of the path components require multiple vertices to specify them: -for example CURVE 3 is a bézier curve with one -control point and one end point, and CURVE4 has three vertices for the -two control points and the end point. The example below shows a -CURVE4 Bézier spline – the bézier curve will be contained in the -convex hull of the start point, the two control points, and the end -point

    -
    import matplotlib.pyplot as plt
    -from matplotlib.path import Path
    -import matplotlib.patches as patches
    -
    -verts = [
    -    (0., 0.),  # P0
    -    (0.2, 1.), # P1
    -    (1., 0.8), # P2
    -    (0.8, 0.), # P3
    -    ]
    -
    -codes = [Path.MOVETO,
    -         Path.CURVE4,
    -         Path.CURVE4,
    -         Path.CURVE4,
    -         ]
    -
    -path = Path(verts, codes)
    -
    -fig = plt.figure()
    -ax = fig.add_subplot(111)
    -patch = patches.PathPatch(path, facecolor='none', lw=2)
    -ax.add_patch(patch)
    -
    -xs, ys = zip(*verts)
    -ax.plot(xs, ys, 'x--', lw=2, color='black', ms=10)
    -
    -ax.text(-0.05, -0.05, 'P0')
    -ax.text(0.15, 1.05, 'P1')
    -ax.text(1.05, 0.85, 'P2')
    -ax.text(0.85, -0.05, 'P3')
    -
    -ax.set_xlim(-0.1, 1.1)
    -ax.set_ylim(-0.1, 1.1)
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/path_tutorial-2.png -
    -
    -
    -

    Compound paths

    -

    All of the simple patch primitives in matplotlib, Rectangle, Circle, -Polygon, etc, are implemented with simple path. Plotting functions -like hist() and -bar(), which create a number of -primitives, e.g., a bunch of Rectangles, can usually be implemented more -efficiently using a compound path. The reason bar creates a list -of rectangles and not a compound path is largely historical: the -Path code is comparatively new and bar -predates it. While we could change it now, it would break old code, -so here we will cover how to create compound paths, replacing the -functionality in bar, in case you need to do so in your own code for -efficiency reasons, e.g., you are creating an animated bar plot.

    -

    We will make the histogram chart by creating a series of rectangles -for each histogram bar: the rectangle width is the bin width and the -rectangle height is the number of datapoints in that bin. First we’ll -create some random normally distributed data and compute the -histogram. Because numpy returns the bin edges and not centers, the -length of bins is 1 greater than the length of n in the -example below:

    -
    # histogram our data with numpy
    -data = np.random.randn(1000)
    -n, bins = np.histogram(data, 100)
    -
    -
    -

    We’ll now extract the corners of the rectangles. Each of the -left, bottom, etc, arrays below is len(n), where n is -the array of counts for each histogram bar:

    -
    # get the corners of the rectangles for the histogram
    -left = np.array(bins[:-1])
    -right = np.array(bins[1:])
    -bottom = np.zeros(len(left))
    -top = bottom + n
    -
    -
    -

    Now we have to construct our compound path, which will consist of a -series of MOVETO, LINETO and CLOSEPOLY for each rectangle. -For each rectangle, we need 5 vertices: 1 for the MOVETO, 3 for -the LINETO, and 1 for the CLOSEPOLY. As indicated in the -table above, the vertex for the closepoly is ignored but we still need -it to keep the codes aligned with the vertices:

    -
    nverts = nrects*(1+3+1)
    -verts = np.zeros((nverts, 2))
    -codes = np.ones(nverts, int) * path.Path.LINETO
    -codes[0::5] = path.Path.MOVETO
    -codes[4::5] = path.Path.CLOSEPOLY
    -verts[0::5,0] = left
    -verts[0::5,1] = bottom
    -verts[1::5,0] = left
    -verts[1::5,1] = top
    -verts[2::5,0] = right
    -verts[2::5,1] = top
    -verts[3::5,0] = right
    -verts[3::5,1] = bottom
    -
    -
    -

    All that remains is to create the path, attach it to a -PathPatch, and add it to our axes:

    -
    barpath = path.Path(verts, codes)
    -patch = patches.PathPatch(barpath, facecolor='green',
    -  edgecolor='yellow', alpha=0.5)
    -ax.add_patch(patch)
    -
    -
    -

    Here is the result

    -

    (Source code, png, pdf)

    -
    -../_images/compound_path_demo.png -
    -
    -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/users/patheffects_guide-1.pdf b/users/patheffects_guide-1.pdf deleted file mode 100644 index 217c1d2c73b..00000000000 Binary files a/users/patheffects_guide-1.pdf and /dev/null differ diff --git a/users/patheffects_guide-1.png b/users/patheffects_guide-1.png deleted file mode 100644 index e767bb52ee4..00000000000 Binary files a/users/patheffects_guide-1.png and /dev/null differ diff --git a/users/patheffects_guide-1.py b/users/patheffects_guide-1.py deleted file mode 100644 index 0be9bfa5bad..00000000000 --- a/users/patheffects_guide-1.py +++ /dev/null @@ -1,9 +0,0 @@ -import matplotlib.pyplot as plt -import matplotlib.patheffects as path_effects - -fig = plt.figure(figsize=(5, 1.5)) -text = fig.text(0.5, 0.5, 'Hello path effects world!\nThis is the normal ' - 'path effect.\nPretty dull, huh?', - ha='center', va='center', size=20) -text.set_path_effects([path_effects.Normal()]) -plt.show() \ No newline at end of file diff --git a/users/patheffects_guide-2.pdf b/users/patheffects_guide-2.pdf deleted file mode 100644 index 8e63f6d97fe..00000000000 Binary files a/users/patheffects_guide-2.pdf and /dev/null differ diff --git a/users/patheffects_guide-2.png b/users/patheffects_guide-2.png deleted file mode 100644 index f8dfb540869..00000000000 Binary files a/users/patheffects_guide-2.png and /dev/null differ diff --git a/users/patheffects_guide-2.py b/users/patheffects_guide-2.py deleted file mode 100644 index c143ba5ae09..00000000000 --- a/users/patheffects_guide-2.py +++ /dev/null @@ -1,10 +0,0 @@ -import matplotlib.pyplot as plt -import matplotlib.patheffects as path_effects - -text = plt.text(0.5, 0.5, 'Hello path effects world!', - path_effects=[path_effects.withSimplePatchShadow()]) - -plt.plot([0, 3, 2, 5], linewidth=5, color='blue', - path_effects=[path_effects.SimpleLineShadow(), - path_effects.Normal()]) -plt.show() \ No newline at end of file diff --git a/users/patheffects_guide-3.pdf b/users/patheffects_guide-3.pdf deleted file mode 100644 index 87c963cbfd1..00000000000 Binary files a/users/patheffects_guide-3.pdf and /dev/null differ diff --git a/users/patheffects_guide-3.png b/users/patheffects_guide-3.png deleted file mode 100644 index 38ffcf45fdc..00000000000 Binary files a/users/patheffects_guide-3.png and /dev/null differ diff --git a/users/patheffects_guide-3.py b/users/patheffects_guide-3.py deleted file mode 100644 index df1da49af68..00000000000 --- a/users/patheffects_guide-3.py +++ /dev/null @@ -1,10 +0,0 @@ -import matplotlib.pyplot as plt -import matplotlib.patheffects as path_effects - -fig = plt.figure(figsize=(7, 1)) -text = fig.text(0.5, 0.5, 'This text stands out because of\n' - 'its black border.', color='white', - ha='center', va='center', size=30) -text.set_path_effects([path_effects.Stroke(linewidth=3, foreground='black'), - path_effects.Normal()]) -plt.show() \ No newline at end of file diff --git a/users/patheffects_guide-4.pdf b/users/patheffects_guide-4.pdf deleted file mode 100644 index dbd5d0bedbd..00000000000 Binary files a/users/patheffects_guide-4.pdf and /dev/null differ diff --git a/users/patheffects_guide-4.png b/users/patheffects_guide-4.png deleted file mode 100644 index fe3b3047a40..00000000000 Binary files a/users/patheffects_guide-4.png and /dev/null differ diff --git a/users/patheffects_guide-4.py b/users/patheffects_guide-4.py deleted file mode 100644 index d010f2bf43a..00000000000 --- a/users/patheffects_guide-4.py +++ /dev/null @@ -1,10 +0,0 @@ -import matplotlib.pyplot as plt -import matplotlib.patheffects as path_effects - -fig = plt.figure(figsize=(8, 1)) -t = fig.text(0.02, 0.5, 'Hatch shadow', fontsize=75, weight=1000, va='center') -t.set_path_effects([path_effects.PathPatchEffect(offset=(4, -4), hatch='xxxx', - facecolor='gray'), - path_effects.PathPatchEffect(edgecolor='white', linewidth=1.1, - facecolor='black')]) -plt.show() \ No newline at end of file diff --git a/users/patheffects_guide.html b/users/patheffects_guide.html deleted file mode 100644 index a1362412f12..00000000000 --- a/users/patheffects_guide.html +++ /dev/null @@ -1,437 +0,0 @@ - - - - - - - - Path effects guide — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -

    Table Of Contents

    - -
    -

    Related Topics

    - -
    -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    Path effects guide

    -

    Matplotlib’s patheffects module provides functionality to -apply a multiple draw stage to any Artist which can be rendered via a -Path.

    -

    Artists which can have a path effect applied to them include Patch, -Line2D, Collection and even -Text. Each artist’s path effects can be controlled via the -set_path_effects method (set_path_effects), which takes -an iterable of AbstractPathEffect instances.

    -

    The simplest path effect is the Normal effect, which simply -draws the artist without any effect:

    -
    import matplotlib.pyplot as plt
    -import matplotlib.patheffects as path_effects
    -
    -fig = plt.figure(figsize=(5, 1.5))
    -text = fig.text(0.5, 0.5, 'Hello path effects world!\nThis is the normal '
    -                          'path effect.\nPretty dull, huh?',
    -                ha='center', va='center', size=20)
    -text.set_path_effects([path_effects.Normal()])
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/patheffects_guide-1.png -
    -

    Whilst the plot doesn’t look any different to what you would expect without any path -effects, the drawing of the text now been changed to use the path effects -framework, opening up the possibilities for more interesting examples.

    -
    -

    Adding a shadow

    -

    A far more interesting path effect than Normal is the -drop-shadow, which we can apply to any of our path based artists. The classes -SimplePatchShadow and -SimpleLineShadow do precisely this by drawing either a filled -patch or a line patch below the original artist:

    -
    import matplotlib.pyplot as plt
    -import matplotlib.patheffects as path_effects
    -
    -text = plt.text(0.5, 0.5, 'Hello path effects world!',
    -                path_effects=[path_effects.withSimplePatchShadow()])
    -
    -plt.plot([0, 3, 2, 5], linewidth=5, color='blue',
    -         path_effects=[path_effects.SimpleLineShadow(),
    -                       path_effects.Normal()])
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/patheffects_guide-2.png -
    -

    Notice the two approaches to setting the path effects in this example. The -first uses the with* classes to include the desired functionality automatically -followed with the “normal” effect, whereas the latter explicitly defines the two path -effects to draw.

    -
    -
    -

    Making an artist stand out

    -

    One nice way of making artists visually stand out is to draw an outline in a bold -color below the actual artist. The Stroke path effect -makes this a relatively simple task:

    -
    import matplotlib.pyplot as plt
    -import matplotlib.patheffects as path_effects
    -
    -fig = plt.figure(figsize=(7, 1))
    -text = fig.text(0.5, 0.5, 'This text stands out because of\n'
    -                          'its black border.', color='white',
    -                          ha='center', va='center', size=30)
    -text.set_path_effects([path_effects.Stroke(linewidth=3, foreground='black'),
    -                       path_effects.Normal()])
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/patheffects_guide-3.png -
    -

    It is important to note that this effect only works because we have drawn the text -path twice; once with a thick black line, and then once with the original text -path on top.

    -

    You may have noticed that the keywords to Stroke and -SimplePatchShadow and SimpleLineShadow are not the usual Artist -keywords (such as facecolor and edgecolor etc.). This is because with these -path effects we are operating at lower level of matplotlib. In fact, the keywords -which are accepted are those for a matplotlib.backend_bases.GraphicsContextBase -instance, which have been designed for making it easy to create new backends - and not -for its user interface.

    -
    -
    -

    Greater control of the path effect artist

    -

    As already mentioned, some of the path effects operate at a lower level than most users -will be used to, meaning that setting keywords such as facecolor and edgecolor -raise an AttributeError. Luckily there is a generic PathPatchEffect path effect -which creates a PathPatch class with the original path. -The keywords to this effect are identical to those of PathPatch:

    -
    import matplotlib.pyplot as plt
    -import matplotlib.patheffects as path_effects
    -
    -fig = plt.figure(figsize=(8, 1))
    -t = fig.text(0.02, 0.5, 'Hatch shadow', fontsize=75, weight=1000, va='center')
    -t.set_path_effects([path_effects.PathPatchEffect(offset=(4, -4), hatch='xxxx',
    -                                                  facecolor='gray'),
    -                    path_effects.PathPatchEffect(edgecolor='white', linewidth=1.1,
    -                                                 facecolor='black')])
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/patheffects_guide-4.png -
    -
    -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/users/pgf.html b/users/pgf.html deleted file mode 100644 index dbc632a2a96..00000000000 --- a/users/pgf.html +++ /dev/null @@ -1,542 +0,0 @@ - - - - - - - - Typesetting With XeLaTeX/LuaLaTeX — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -

    Table Of Contents

    - -
    -

    Related Topics

    - -
    -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    Typesetting With XeLaTeX/LuaLaTeX

    -

    Using the pgf backend, matplotlib can export figures as pgf drawing commands -that can be processed with pdflatex, xelatex or lualatex. XeLaTeX and LuaLaTeX -have full unicode support and can use any font that is installed in the operating -system, making use of advanced typographic features of OpenType, AAT and -Graphite. Pgf pictures created by plt.savefig('figure.pgf') can be -embedded as raw commands in LaTeX documents. Figures can also be directly -compiled and saved to PDF with plt.savefig('figure.pdf') by either -switching to the backend

    -
    matplotlib.use('pgf')
    -
    -
    -

    or registering it for handling pdf output

    -
    from matplotlib.backends.backend_pgf import FigureCanvasPgf
    -matplotlib.backend_bases.register_backend('pdf', FigureCanvasPgf)
    -
    -
    -

    The second method allows you to keep using regular interactive backends and to -save xelatex, lualatex or pdflatex compiled PDF files from the graphical user interface.

    -

    Matplotlib’s pgf support requires a recent LaTeX installation that includes -the TikZ/PGF packages (such as TeXLive), preferably with XeLaTeX or LuaLaTeX -installed. If either pdftocairo or ghostscript is present on your system, -figures can optionally be saved to PNG images as well. The executables -for all applications must be located on your PATH.

    -

    Rc parameters that control the behavior of the pgf backend:

    -
    -
    ---- - - - - - - - - - - - - - - - - -
    ParameterDocumentation
    pgf.preambleLines to be included in the LaTeX preamble
    pgf.rcfontsSetup fonts from rc params using the fontspec package
    pgf.texsystemEither “xelatex” (default), “lualatex” or “pdflatex”
    -
    -
    -

    Note

    -

    TeX defines a set of special characters, such as:

    -
    # $ % & ~ _ ^ \ { }
    -
    -
    -

    Generally, these characters must be escaped correctly. For convenience, -some characters (_,^,%) are automatically escaped outside of math -environments.

    -
    -
    -

    Font specification

    -

    The fonts used for obtaining the size of text elements or when compiling -figures to PDF are usually defined in the matplotlib rc parameters. You can -also use the LaTeX default Computer Modern fonts by clearing the lists for -font.serif, font.sans-serif or font.monospace. Please note that -the glyph coverage of these fonts is very limited. If you want to keep the -Computer Modern font face but require extended unicode support, consider -installing the Computer Modern Unicode -fonts CMU Serif, CMU Sans Serif, etc.

    -

    When saving to .pgf, the font configuration matplotlib used for the -layout of the figure is included in the header of the text file.

    -
    # -*- coding: utf-8 -*-
    -
    -import matplotlib as mpl
    -mpl.use("pgf")
    -pgf_with_rc_fonts = {
    -    "font.family": "serif",
    -    "font.serif": [],                   # use latex default serif font
    -    "font.sans-serif": ["DejaVu Sans"], # use a specific sans-serif font
    -}
    -mpl.rcParams.update(pgf_with_rc_fonts)
    -
    -import matplotlib.pyplot as plt
    -plt.figure(figsize=(4.5,2.5))
    -plt.plot(range(5))
    -plt.text(0.5, 3., "serif")
    -plt.text(0.5, 2., "monospace", family="monospace")
    -plt.text(2.5, 2., "sans-serif", family="sans-serif")
    -plt.text(2.5, 1., "comic sans", family="Comic Sans MS")
    -plt.xlabel(u"µ is not $\\mu$")
    -plt.tight_layout(.5)
    -
    -
    -
    -../_images/pgf_fonts.png -
    -
    -

    Custom preamble

    -

    Full customization is possible by adding your own commands to the preamble. -Use the pgf.preamble parameter if you want to configure the math fonts, -using unicode-math for example, or for loading additional packages. Also, -if you want to do the font configuration yourself instead of using the fonts -specified in the rc parameters, make sure to disable pgf.rcfonts.

    -
    # -*- coding: utf-8 -*-
    -from __future__ import (absolute_import, division, print_function,
    -                        unicode_literals)
    -
    -import six
    -
    -import matplotlib as mpl
    -mpl.use("pgf")
    -pgf_with_custom_preamble = {
    -    "font.family": "serif", # use serif/main font for text elements
    -    "text.usetex": True,    # use inline math for ticks
    -    "pgf.rcfonts": False,   # don't setup fonts from rc parameters
    -    "pgf.preamble": [
    -         "\\usepackage{units}",         # load additional packages
    -         "\\usepackage{metalogo}",
    -         "\\usepackage{unicode-math}",  # unicode math setup
    -         r"\setmathfont{xits-math.otf}",
    -         r"\setmainfont{DejaVu Serif}", # serif font via preamble
    -         ]
    -}
    -mpl.rcParams.update(pgf_with_custom_preamble)
    -
    -import matplotlib.pyplot as plt
    -plt.figure(figsize=(4.5,2.5))
    -plt.plot(range(5))
    -plt.xlabel("unicode text: я, ψ, €, ü, \\unitfrac[10]{°}{µm}")
    -plt.ylabel("\\XeLaTeX")
    -plt.legend(["unicode math: $λ=∑_i^∞ μ_i^2$"])
    -plt.tight_layout(.5)
    -
    -
    -
    -../_images/pgf_preamble.png -
    -
    -

    Choosing the TeX system

    -

    The TeX system to be used by matplotlib is chosen by the pgf.texsystem -parameter. Possible values are 'xelatex' (default), 'lualatex' and -'pdflatex'. Please note that when selecting pdflatex the fonts and -unicode handling must be configured in the preamble.

    -
    # -*- coding: utf-8 -*-
    -
    -import matplotlib as mpl
    -mpl.use("pgf")
    -pgf_with_pdflatex = {
    -    "pgf.texsystem": "pdflatex",
    -    "pgf.preamble": [
    -         r"\usepackage[utf8x]{inputenc}",
    -         r"\usepackage[T1]{fontenc}",
    -         r"\usepackage{cmbright}",
    -         ]
    -}
    -mpl.rcParams.update(pgf_with_pdflatex)
    -
    -import matplotlib.pyplot as plt
    -plt.figure(figsize=(4.5,2.5))
    -plt.plot(range(5))
    -plt.text(0.5, 3., "serif", family="serif")
    -plt.text(0.5, 2., "monospace", family="monospace")
    -plt.text(2.5, 2., "sans-serif", family="sans-serif")
    -plt.xlabel(u"µ is not $\\mu$")
    -plt.tight_layout(.5)
    -
    -
    -
    -../_images/pgf_texsystem.png -
    -
    -

    Troubleshooting

    -
      -
    • Please note that the TeX packages found in some Linux distributions and -MiKTeX installations are dramatically outdated. Make sure to update your -package catalog and upgrade or install a recent TeX distribution.
    • -
    • On Windows, the PATH environment variable may need to be modified -to include the directories containing the latex, dvipng and ghostscript -executables. See Environment Variables and -Setting environment variables in windows for details.
    • -
    • A limitation on Windows causes the backend to keep file handles that have -been opened by your application open. As a result, it may not be possible -to delete the corresponding files until the application closes (see -#1324).
    • -
    • Sometimes the font rendering in figures that are saved to png images is -very bad. This happens when the pdftocairo tool is not available and -ghostscript is used for the pdf to png conversion.
    • -
    • Make sure what you are trying to do is possible in a LaTeX document, -that your LaTeX syntax is valid and that you are using raw strings -if necessary to avoid unintended escape sequences.
    • -
    • The pgf.preamble rc setting provides lots of flexibility, and lots of -ways to cause problems. When experiencing problems, try to minimalize or -disable the custom preamble.
    • -
    • Configuring an unicode-math environment can be a bit tricky. The -TeXLive distribution for example provides a set of math fonts which are -usually not installed system-wide. XeTeX, unlike LuaLatex, cannot find -these fonts by their name, which is why you might have to specify -\setmathfont{xits-math.otf} instead of \setmathfont{XITS Math} or -alternatively make the fonts available to your OS. See this -tex.stackexchange.com question -for more details.
    • -
    • If the font configuration used by matplotlib differs from the font setting -in yout LaTeX document, the alignment of text elements in imported figures -may be off. Check the header of your .pgf file if you are unsure about -the fonts matplotlib used for the layout.
    • -
    • Vector images and hence .pgf files can become bloated if there are a lot -of objects in the graph. This can be the case for image processing or very -big scatter graphs. In an extreme case this can cause TeX to run out of -memory: “TeX capacity exceeded, sorry” You can configure latex to increase -the amount of memory available to generate the .pdf image as discussed on -tex.stackexchange.com. -Another way would be to “rasterize” parts of the graph causing problems -using either the rasterized=True keyword, or .set_rasterized(True) as per -this example.
    • -
    • If you still need help, please see Getting help
    • -
    -
    -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/users/plotting/colormaps/grayscale.py b/users/plotting/colormaps/grayscale.py deleted file mode 100644 index 030134197f2..00000000000 --- a/users/plotting/colormaps/grayscale.py +++ /dev/null @@ -1,58 +0,0 @@ -''' -================================== -Grayscale version of the colormaps -================================== - -Show what Matplotlib colormaps look like in grayscale. -Uses lightness L* as a proxy for grayscale value. -''' - -import numpy as np -import matplotlib as mpl -import matplotlib.pyplot as plt -from matplotlib import cm -from colorspacious import cspace_converter -from colormaps import cmaps # the colormaps, grouped by category - -mpl.rcParams.update({'font.size': 14}) - -# Indices to step through colormap. -x = np.linspace(0.0, 1.0, 100) - -gradient = np.linspace(0, 1, 256) -gradient = np.vstack((gradient, gradient)) - - -def plot_color_gradients(cmap_category, cmap_list): - fig, axes = plt.subplots(nrows=len(cmap_list), ncols=2) - fig.subplots_adjust(top=0.95, bottom=0.01, left=0.2, right=0.99, - wspace=0.05) - fig.suptitle(cmap_category + ' colormaps', fontsize=14, y=1.0, x=0.6) - - for ax, name in zip(axes, cmap_list): - - # Get RGB values for colormap. - rgb = cm.get_cmap(plt.get_cmap(name))(x)[np.newaxis,:,:3] - - # Get colormap in CAM02-UCS colorspace. We want the lightness. - lab = cspace_converter("sRGB1", "CAM02-UCS")(rgb) - L = lab[0,:,0] - L = np.float32(np.vstack((L, L, L))) - - ax[0].imshow(gradient, aspect='auto', cmap=plt.get_cmap(name)) - ax[1].imshow(L, aspect='auto', cmap='binary_r', vmin=0., vmax=100.) - pos = list(ax[0].get_position().bounds) - x_text = pos[0] - 0.01 - y_text = pos[1] + pos[3]/2. - fig.text(x_text, y_text, name, va='center', ha='right', fontsize=10) - - # Turn off *all* ticks & spines, not just the ones with colormaps. - for ax in axes.flat: - ax.set_axis_off() - - plt.show() - - -for cmap_category, cmap_list in cmaps: - - plot_color_gradients(cmap_category, cmap_list) diff --git a/users/plotting/colormaps/grayscale_01_00.hires.png b/users/plotting/colormaps/grayscale_01_00.hires.png deleted file mode 100644 index 81c2aa8d31b..00000000000 Binary files a/users/plotting/colormaps/grayscale_01_00.hires.png and /dev/null differ diff --git a/users/plotting/colormaps/grayscale_01_00.pdf b/users/plotting/colormaps/grayscale_01_00.pdf deleted file mode 100644 index 6747aee7aec..00000000000 Binary files a/users/plotting/colormaps/grayscale_01_00.pdf and /dev/null differ diff --git a/users/plotting/colormaps/grayscale_01_00.png b/users/plotting/colormaps/grayscale_01_00.png deleted file mode 100644 index adeac59cb06..00000000000 Binary files a/users/plotting/colormaps/grayscale_01_00.png and /dev/null differ diff --git a/users/plotting/colormaps/grayscale_01_01.hires.png b/users/plotting/colormaps/grayscale_01_01.hires.png deleted file mode 100644 index 9aec9c02376..00000000000 Binary files a/users/plotting/colormaps/grayscale_01_01.hires.png and /dev/null differ diff --git a/users/plotting/colormaps/grayscale_01_01.pdf b/users/plotting/colormaps/grayscale_01_01.pdf deleted file mode 100644 index 7bd0dca9b71..00000000000 Binary files a/users/plotting/colormaps/grayscale_01_01.pdf and /dev/null differ diff --git a/users/plotting/colormaps/grayscale_01_01.png b/users/plotting/colormaps/grayscale_01_01.png deleted file mode 100644 index 737419a81c0..00000000000 Binary files a/users/plotting/colormaps/grayscale_01_01.png and /dev/null differ diff --git a/users/plotting/colormaps/grayscale_01_02.hires.png b/users/plotting/colormaps/grayscale_01_02.hires.png deleted file mode 100644 index d9ea2154fd2..00000000000 Binary files a/users/plotting/colormaps/grayscale_01_02.hires.png and /dev/null differ diff --git a/users/plotting/colormaps/grayscale_01_02.pdf b/users/plotting/colormaps/grayscale_01_02.pdf deleted file mode 100644 index 7226020b4cb..00000000000 Binary files a/users/plotting/colormaps/grayscale_01_02.pdf and /dev/null differ diff --git a/users/plotting/colormaps/grayscale_01_02.png b/users/plotting/colormaps/grayscale_01_02.png deleted file mode 100644 index 23cf5f8c50d..00000000000 Binary files a/users/plotting/colormaps/grayscale_01_02.png and /dev/null differ diff --git a/users/plotting/colormaps/grayscale_01_03.hires.png b/users/plotting/colormaps/grayscale_01_03.hires.png deleted file mode 100644 index bb2d511299e..00000000000 Binary files a/users/plotting/colormaps/grayscale_01_03.hires.png and /dev/null differ diff --git a/users/plotting/colormaps/grayscale_01_03.pdf b/users/plotting/colormaps/grayscale_01_03.pdf deleted file mode 100644 index 33917e9735c..00000000000 Binary files a/users/plotting/colormaps/grayscale_01_03.pdf and /dev/null differ diff --git a/users/plotting/colormaps/grayscale_01_03.png b/users/plotting/colormaps/grayscale_01_03.png deleted file mode 100644 index 77114d74ec5..00000000000 Binary files a/users/plotting/colormaps/grayscale_01_03.png and /dev/null differ diff --git a/users/plotting/colormaps/grayscale_01_04.hires.png b/users/plotting/colormaps/grayscale_01_04.hires.png deleted file mode 100644 index 5ef4bd07d50..00000000000 Binary files a/users/plotting/colormaps/grayscale_01_04.hires.png and /dev/null differ diff --git a/users/plotting/colormaps/grayscale_01_04.pdf b/users/plotting/colormaps/grayscale_01_04.pdf deleted file mode 100644 index 7cc0694fa42..00000000000 Binary files a/users/plotting/colormaps/grayscale_01_04.pdf and /dev/null differ diff --git a/users/plotting/colormaps/grayscale_01_04.png b/users/plotting/colormaps/grayscale_01_04.png deleted file mode 100644 index b213dd305d6..00000000000 Binary files a/users/plotting/colormaps/grayscale_01_04.png and /dev/null differ diff --git a/users/plotting/colormaps/grayscale_01_05.hires.png b/users/plotting/colormaps/grayscale_01_05.hires.png deleted file mode 100644 index 6b1a00f07d5..00000000000 Binary files a/users/plotting/colormaps/grayscale_01_05.hires.png and /dev/null differ diff --git a/users/plotting/colormaps/grayscale_01_05.pdf b/users/plotting/colormaps/grayscale_01_05.pdf deleted file mode 100644 index da54e646dc9..00000000000 Binary files a/users/plotting/colormaps/grayscale_01_05.pdf and /dev/null differ diff --git a/users/plotting/colormaps/grayscale_01_05.png b/users/plotting/colormaps/grayscale_01_05.png deleted file mode 100644 index 25920dff603..00000000000 Binary files a/users/plotting/colormaps/grayscale_01_05.png and /dev/null differ diff --git a/users/plotting/colormaps/lightness.py b/users/plotting/colormaps/lightness.py deleted file mode 100644 index aa413bba530..00000000000 --- a/users/plotting/colormaps/lightness.py +++ /dev/null @@ -1,101 +0,0 @@ -''' -========================== -Lightness of the colormaps -========================== - -For each colormap, plot the lightness parameter L* from CIELAB colorspace -along the y axis vs index through the colormap. Colormaps are examined in -categories as in the original matplotlib gallery of colormaps. -''' - -import numpy as np -import matplotlib as mpl -import matplotlib.pyplot as plt -from matplotlib import cm -from colorspacious import cspace_converter -from colormaps import cmaps # the colormaps, grouped by category - -mpl.rcParams.update({'font.size': 12}) - -# Number of colormap per subplot for particular cmap categories -_DSUBS = {'Perceptually Uniform Sequential': 4, 'Sequential': 6, - 'Sequential (2)': 6, 'Diverging': 6, 'Qualitative': 4, - 'Miscellaneous': 6} - -# Spacing between the colormaps of a subplot -_DC = {'Perceptually Uniform Sequential': 1.4, 'Sequential': 0.7, - 'Sequential (2)': 1.4, 'Diverging': 1.4, 'Qualitative': 1.4, - 'Miscellaneous': 1.4} - -# Indices to step through colormap -x = np.linspace(0.0, 1.0, 100) - -# Do plot -for cmap_category, cmap_list in cmaps: - - # Do subplots so that colormaps have enough space. - # Default is 6 colormaps per subplot. - dsub = _DSUBS.get(cmap_category, 6) - nsubplots = int(np.ceil(len(cmap_list) / float(dsub))) - - # squeeze=False to handle similarly the case of a single subplot - fig, axes = plt.subplots(nrows=nsubplots, squeeze=False, - figsize=(7, 2.6*nsubplots)) - - for i, ax in enumerate(axes.flat): - - locs = [] # locations for text labels - - for j, cmap in enumerate(cmap_list[i*dsub:(i+1)*dsub]): - - # Get RGB values for colormap and convert the colormap in - # CAM02-UCS colorspace. lab[0, :, 0] is the lightness. - rgb = cm.get_cmap(cmap)(x)[np.newaxis, :, :3] - lab = cspace_converter("sRGB1", "CAM02-UCS")(rgb) - - # Plot colormap L values. Do separately for each category - # so each plot can be pretty. To make scatter markers change - # color along plot: - # http://stackoverflow.com/questions/8202605/matplotlib-scatterplot-colour-as-a-function-of-a-third-variable - - if cmap_category == 'Sequential': - # These colormaps all start at high lightness but we want them - # reversed to look nice in the plot, so reverse the order. - y_ = lab[0, ::-1, 0] - c_ = x[::-1] - else: - y_ = lab[0, :, 0] - c_ = x - - dc = _DC.get(cmap_category, 1.4) # cmaps horizontal spacing - ax.scatter(x + j*dc, y_, c=c_, cmap=cmap, s=300, linewidths=0.0) - - # Store locations for colormap labels - if cmap_category in ('Perceptually Uniform Sequential', - 'Sequential'): - locs.append(x[-1] + j*dc) - elif cmap_category in ('Diverging', 'Qualitative', - 'Miscellaneous', 'Sequential (2)'): - locs.append(x[int(x.size/2.)] + j*dc) - - # Set up the axis limits: - # * the 1st subplot is used as a reference for the x-axis limits - # * lightness values goes from 0 to 100 (y-axis limits) - ax.set_xlim(axes[0, 0].get_xlim()) - ax.set_ylim(0.0, 100.0) - - # Set up labels for colormaps - ax.xaxis.set_ticks_position('top') - ticker = mpl.ticker.FixedLocator(locs) - ax.xaxis.set_major_locator(ticker) - formatter = mpl.ticker.FixedFormatter(cmap_list[i*dsub:(i+1)*dsub]) - ax.xaxis.set_major_formatter(formatter) - for label in ax.get_xticklabels(): - label.set_rotation(50) - - ax.set_xlabel(cmap_category + ' colormaps', fontsize=14) - fig.text(0.0, 0.55, 'Lightness $L^*$', fontsize=12, - transform=fig.transFigure, rotation=90) - - fig.tight_layout(h_pad=0.0, pad=1.5) - plt.show() diff --git a/users/plotting/colormaps/lightness_00.hires.png b/users/plotting/colormaps/lightness_00.hires.png deleted file mode 100644 index 1a776f52863..00000000000 Binary files a/users/plotting/colormaps/lightness_00.hires.png and /dev/null differ diff --git a/users/plotting/colormaps/lightness_00.pdf b/users/plotting/colormaps/lightness_00.pdf deleted file mode 100644 index 31bd02ee5aa..00000000000 Binary files a/users/plotting/colormaps/lightness_00.pdf and /dev/null differ diff --git a/users/plotting/colormaps/lightness_00.png b/users/plotting/colormaps/lightness_00.png deleted file mode 100644 index 65288c7fb13..00000000000 Binary files a/users/plotting/colormaps/lightness_00.png and /dev/null differ diff --git a/users/plotting/colormaps/lightness_01.hires.png b/users/plotting/colormaps/lightness_01.hires.png deleted file mode 100644 index 9c1071bdb36..00000000000 Binary files a/users/plotting/colormaps/lightness_01.hires.png and /dev/null differ diff --git a/users/plotting/colormaps/lightness_01.pdf b/users/plotting/colormaps/lightness_01.pdf deleted file mode 100644 index 989dba2dcc4..00000000000 Binary files a/users/plotting/colormaps/lightness_01.pdf and /dev/null differ diff --git a/users/plotting/colormaps/lightness_01.png b/users/plotting/colormaps/lightness_01.png deleted file mode 100644 index 392ff428f58..00000000000 Binary files a/users/plotting/colormaps/lightness_01.png and /dev/null differ diff --git a/users/plotting/colormaps/lightness_02.hires.png b/users/plotting/colormaps/lightness_02.hires.png deleted file mode 100644 index 86bb8b22d45..00000000000 Binary files a/users/plotting/colormaps/lightness_02.hires.png and /dev/null differ diff --git a/users/plotting/colormaps/lightness_02.pdf b/users/plotting/colormaps/lightness_02.pdf deleted file mode 100644 index e2b7b8bb419..00000000000 Binary files a/users/plotting/colormaps/lightness_02.pdf and /dev/null differ diff --git a/users/plotting/colormaps/lightness_02.png b/users/plotting/colormaps/lightness_02.png deleted file mode 100644 index 55b81ac73c9..00000000000 Binary files a/users/plotting/colormaps/lightness_02.png and /dev/null differ diff --git a/users/plotting/colormaps/lightness_03.hires.png b/users/plotting/colormaps/lightness_03.hires.png deleted file mode 100644 index f3e944e0aa9..00000000000 Binary files a/users/plotting/colormaps/lightness_03.hires.png and /dev/null differ diff --git a/users/plotting/colormaps/lightness_03.pdf b/users/plotting/colormaps/lightness_03.pdf deleted file mode 100644 index 2005b131f4d..00000000000 Binary files a/users/plotting/colormaps/lightness_03.pdf and /dev/null differ diff --git a/users/plotting/colormaps/lightness_03.png b/users/plotting/colormaps/lightness_03.png deleted file mode 100644 index 807722c645a..00000000000 Binary files a/users/plotting/colormaps/lightness_03.png and /dev/null differ diff --git a/users/plotting/colormaps/lightness_04.hires.png b/users/plotting/colormaps/lightness_04.hires.png deleted file mode 100644 index be3490e1f8c..00000000000 Binary files a/users/plotting/colormaps/lightness_04.hires.png and /dev/null differ diff --git a/users/plotting/colormaps/lightness_04.pdf b/users/plotting/colormaps/lightness_04.pdf deleted file mode 100644 index b3765884ef7..00000000000 Binary files a/users/plotting/colormaps/lightness_04.pdf and /dev/null differ diff --git a/users/plotting/colormaps/lightness_04.png b/users/plotting/colormaps/lightness_04.png deleted file mode 100644 index 2b5126bfa93..00000000000 Binary files a/users/plotting/colormaps/lightness_04.png and /dev/null differ diff --git a/users/plotting/colormaps/lightness_05.hires.png b/users/plotting/colormaps/lightness_05.hires.png deleted file mode 100644 index 0c279723085..00000000000 Binary files a/users/plotting/colormaps/lightness_05.hires.png and /dev/null differ diff --git a/users/plotting/colormaps/lightness_05.pdf b/users/plotting/colormaps/lightness_05.pdf deleted file mode 100644 index 96deeee5e34..00000000000 Binary files a/users/plotting/colormaps/lightness_05.pdf and /dev/null differ diff --git a/users/plotting/colormaps/lightness_05.png b/users/plotting/colormaps/lightness_05.png deleted file mode 100644 index ba64258f5f8..00000000000 Binary files a/users/plotting/colormaps/lightness_05.png and /dev/null differ diff --git a/users/plotting/examples/anchored_box01.hires.png b/users/plotting/examples/anchored_box01.hires.png deleted file mode 100644 index 524cba5ede3..00000000000 Binary files a/users/plotting/examples/anchored_box01.hires.png and /dev/null differ diff --git a/users/plotting/examples/anchored_box01.pdf b/users/plotting/examples/anchored_box01.pdf deleted file mode 100644 index 2304a882575..00000000000 Binary files a/users/plotting/examples/anchored_box01.pdf and /dev/null differ diff --git a/users/plotting/examples/anchored_box01.png b/users/plotting/examples/anchored_box01.png deleted file mode 100644 index 199bf9de10c..00000000000 Binary files a/users/plotting/examples/anchored_box01.png and /dev/null differ diff --git a/users/plotting/examples/anchored_box01.py b/users/plotting/examples/anchored_box01.py deleted file mode 100644 index 517a2f88d15..00000000000 --- a/users/plotting/examples/anchored_box01.py +++ /dev/null @@ -1,14 +0,0 @@ -import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid.anchored_artists import AnchoredText - -fig=plt.figure(1, figsize=(3,3)) -ax = plt.subplot(111) - -at = AnchoredText("Figure 1a", - prop=dict(size=15), frameon=True, - loc=2, - ) -at.patch.set_boxstyle("round,pad=0.,rounding_size=0.2") -ax.add_artist(at) - -plt.show() diff --git a/users/plotting/examples/anchored_box02.hires.png b/users/plotting/examples/anchored_box02.hires.png deleted file mode 100644 index 9159dcda506..00000000000 Binary files a/users/plotting/examples/anchored_box02.hires.png and /dev/null differ diff --git a/users/plotting/examples/anchored_box02.pdf b/users/plotting/examples/anchored_box02.pdf deleted file mode 100644 index fd3d574fc6d..00000000000 Binary files a/users/plotting/examples/anchored_box02.pdf and /dev/null differ diff --git a/users/plotting/examples/anchored_box02.png b/users/plotting/examples/anchored_box02.png deleted file mode 100644 index 8fbc9105ef8..00000000000 Binary files a/users/plotting/examples/anchored_box02.png and /dev/null differ diff --git a/users/plotting/examples/anchored_box02.py b/users/plotting/examples/anchored_box02.py deleted file mode 100644 index 6f8db6dd8de..00000000000 --- a/users/plotting/examples/anchored_box02.py +++ /dev/null @@ -1,18 +0,0 @@ -from matplotlib.patches import Circle -import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid.anchored_artists import AnchoredDrawingArea - -fig=plt.figure(1, figsize=(3,3)) -ax = plt.subplot(111) - - -ada = AnchoredDrawingArea(40, 20, 0, 0, - loc=1, pad=0., frameon=False) -p1 = Circle((10, 10), 10) -ada.drawing_area.add_artist(p1) -p2 = Circle((30, 10), 5, fc="r") -ada.drawing_area.add_artist(p2) - -ax.add_artist(ada) - -plt.show() diff --git a/users/plotting/examples/anchored_box03.hires.png b/users/plotting/examples/anchored_box03.hires.png deleted file mode 100644 index 5399abc1ad5..00000000000 Binary files a/users/plotting/examples/anchored_box03.hires.png and /dev/null differ diff --git a/users/plotting/examples/anchored_box03.pdf b/users/plotting/examples/anchored_box03.pdf deleted file mode 100644 index 70870377da9..00000000000 Binary files a/users/plotting/examples/anchored_box03.pdf and /dev/null differ diff --git a/users/plotting/examples/anchored_box03.png b/users/plotting/examples/anchored_box03.png deleted file mode 100644 index f48ba93cd77..00000000000 Binary files a/users/plotting/examples/anchored_box03.png and /dev/null differ diff --git a/users/plotting/examples/anchored_box03.py b/users/plotting/examples/anchored_box03.py deleted file mode 100644 index 0848e1b9d27..00000000000 --- a/users/plotting/examples/anchored_box03.py +++ /dev/null @@ -1,14 +0,0 @@ -from matplotlib.patches import Ellipse -import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid.anchored_artists import AnchoredAuxTransformBox - -fig=plt.figure(1, figsize=(3,3)) -ax = plt.subplot(111) - -box = AnchoredAuxTransformBox(ax.transData, loc=2) -el = Ellipse((0,0), width=0.1, height=0.4, angle=30) # in data coordinates! -box.drawing_area.add_artist(el) - -ax.add_artist(box) - -plt.show() diff --git a/users/plotting/examples/anchored_box04.hires.png b/users/plotting/examples/anchored_box04.hires.png deleted file mode 100644 index 26e031a9535..00000000000 Binary files a/users/plotting/examples/anchored_box04.hires.png and /dev/null differ diff --git a/users/plotting/examples/anchored_box04.pdf b/users/plotting/examples/anchored_box04.pdf deleted file mode 100644 index 94837981ca4..00000000000 Binary files a/users/plotting/examples/anchored_box04.pdf and /dev/null differ diff --git a/users/plotting/examples/anchored_box04.png b/users/plotting/examples/anchored_box04.png deleted file mode 100644 index 36ff1cad4fe..00000000000 Binary files a/users/plotting/examples/anchored_box04.png and /dev/null differ diff --git a/users/plotting/examples/anchored_box04.py b/users/plotting/examples/anchored_box04.py deleted file mode 100644 index 570c7316214..00000000000 --- a/users/plotting/examples/anchored_box04.py +++ /dev/null @@ -1,35 +0,0 @@ -from matplotlib.patches import Ellipse -import matplotlib.pyplot as plt -from matplotlib.offsetbox import AnchoredOffsetbox, TextArea, DrawingArea, HPacker - -fig=plt.figure(1, figsize=(3,3)) -ax = plt.subplot(111) - -box1 = TextArea(" Test : ", textprops=dict(color="k")) - -box2 = DrawingArea(60, 20, 0, 0) -el1 = Ellipse((10, 10), width=16, height=5, angle=30, fc="r") -el2 = Ellipse((30, 10), width=16, height=5, angle=170, fc="g") -el3 = Ellipse((50, 10), width=16, height=5, angle=230, fc="b") -box2.add_artist(el1) -box2.add_artist(el2) -box2.add_artist(el3) - - -box = HPacker(children=[box1, box2], - align="center", - pad=0, sep=5) - -anchored_box = AnchoredOffsetbox(loc=3, - child=box, pad=0., - frameon=True, - bbox_to_anchor=(0., 1.02), - bbox_transform=ax.transAxes, - borderpad=0., - ) - - -ax.add_artist(anchored_box) - -fig.subplots_adjust(top=0.8) -plt.show() diff --git a/users/plotting/examples/annotate_explain.hires.png b/users/plotting/examples/annotate_explain.hires.png deleted file mode 100644 index 11f391bd712..00000000000 Binary files a/users/plotting/examples/annotate_explain.hires.png and /dev/null differ diff --git a/users/plotting/examples/annotate_explain.pdf b/users/plotting/examples/annotate_explain.pdf deleted file mode 100644 index 8c6e1f9a979..00000000000 Binary files a/users/plotting/examples/annotate_explain.pdf and /dev/null differ diff --git a/users/plotting/examples/annotate_explain.png b/users/plotting/examples/annotate_explain.png deleted file mode 100644 index 4c5191e227e..00000000000 Binary files a/users/plotting/examples/annotate_explain.png and /dev/null differ diff --git a/users/plotting/examples/annotate_explain.py b/users/plotting/examples/annotate_explain.py deleted file mode 100644 index 6dadbd5e541..00000000000 --- a/users/plotting/examples/annotate_explain.py +++ /dev/null @@ -1,103 +0,0 @@ - -import matplotlib.pyplot as plt -import matplotlib.patches as mpatches - -x1, y1 = 0.3, 0.3 -x2, y2 = 0.7, 0.7 - -fig = plt.figure(1, figsize=(8,3)) -fig.clf() -from mpl_toolkits.axes_grid.axes_grid import AxesGrid -from mpl_toolkits.axes_grid.anchored_artists import AnchoredText - -#from matplotlib.font_manager import FontProperties - -def add_at(ax, t, loc=2): - fp = dict(size=10) - _at = AnchoredText(t, loc=loc, prop=fp) - ax.add_artist(_at) - return _at - - -grid = AxesGrid(fig, 111, (1, 4), label_mode="1", share_all=True) - -grid[0].set_autoscale_on(False) - -ax = grid[0] -ax.plot([x1, x2], [y1, y2], ".") -el = mpatches.Ellipse((x1, y1), 0.3, 0.4, angle=30, alpha=0.2) -ax.add_artist(el) -ax.annotate("", - xy=(x1, y1), xycoords='data', - xytext=(x2, y2), textcoords='data', - arrowprops=dict(arrowstyle="-", #linestyle="dashed", - color="0.5", - patchB=None, - shrinkB=0, - connectionstyle="arc3,rad=0.3", - ), - ) - -add_at(ax, "connect", loc=2) - -ax = grid[1] -ax.plot([x1, x2], [y1, y2], ".") -el = mpatches.Ellipse((x1, y1), 0.3, 0.4, angle=30, alpha=0.2) -ax.add_artist(el) -ax.annotate("", - xy=(x1, y1), xycoords='data', - xytext=(x2, y2), textcoords='data', - arrowprops=dict(arrowstyle="-", #linestyle="dashed", - color="0.5", - patchB=el, - shrinkB=0, - connectionstyle="arc3,rad=0.3", - ), - ) - -add_at(ax, "clip", loc=2) - - -ax = grid[2] -ax.plot([x1, x2], [y1, y2], ".") -el = mpatches.Ellipse((x1, y1), 0.3, 0.4, angle=30, alpha=0.2) -ax.add_artist(el) -ax.annotate("", - xy=(x1, y1), xycoords='data', - xytext=(x2, y2), textcoords='data', - arrowprops=dict(arrowstyle="-", #linestyle="dashed", - color="0.5", - patchB=el, - shrinkB=5, - connectionstyle="arc3,rad=0.3", - ), - ) - -add_at(ax, "shrink", loc=2) - - -ax = grid[3] -ax.plot([x1, x2], [y1, y2], ".") -el = mpatches.Ellipse((x1, y1), 0.3, 0.4, angle=30, alpha=0.2) -ax.add_artist(el) -ax.annotate("", - xy=(x1, y1), xycoords='data', - xytext=(x2, y2), textcoords='data', - arrowprops=dict(arrowstyle="fancy", #linestyle="dashed", - color="0.5", - patchB=el, - shrinkB=5, - connectionstyle="arc3,rad=0.3", - ), - ) - -add_at(ax, "mutate", loc=2) - -grid[0].set_xlim(0, 1) -grid[0].set_ylim(0, 1) -grid[0].axis["bottom"].toggle(ticklabels=False) -grid[0].axis["left"].toggle(ticklabels=False) -fig.subplots_adjust(left=0.05, right=0.95, bottom=0.05, top=0.95) - -plt.draw() -plt.show() diff --git a/users/plotting/examples/annotate_simple01.hires.png b/users/plotting/examples/annotate_simple01.hires.png deleted file mode 100644 index f3fdeca893d..00000000000 Binary files a/users/plotting/examples/annotate_simple01.hires.png and /dev/null differ diff --git a/users/plotting/examples/annotate_simple01.pdf b/users/plotting/examples/annotate_simple01.pdf deleted file mode 100644 index ba9d0989e53..00000000000 Binary files a/users/plotting/examples/annotate_simple01.pdf and /dev/null differ diff --git a/users/plotting/examples/annotate_simple01.png b/users/plotting/examples/annotate_simple01.png deleted file mode 100644 index 70ecc28c64b..00000000000 Binary files a/users/plotting/examples/annotate_simple01.png and /dev/null differ diff --git a/users/plotting/examples/annotate_simple01.py b/users/plotting/examples/annotate_simple01.py deleted file mode 100644 index 1a376b66f5b..00000000000 --- a/users/plotting/examples/annotate_simple01.py +++ /dev/null @@ -1,14 +0,0 @@ -import matplotlib.pyplot as plt - -plt.figure(1, figsize=(3,3)) -ax = plt.subplot(111) - -ax.annotate("", - xy=(0.2, 0.2), xycoords='data', - xytext=(0.8, 0.8), textcoords='data', - arrowprops=dict(arrowstyle="->", - connectionstyle="arc3"), - ) - -plt.show() - diff --git a/users/plotting/examples/annotate_simple02.hires.png b/users/plotting/examples/annotate_simple02.hires.png deleted file mode 100644 index 393a21c9c6a..00000000000 Binary files a/users/plotting/examples/annotate_simple02.hires.png and /dev/null differ diff --git a/users/plotting/examples/annotate_simple02.pdf b/users/plotting/examples/annotate_simple02.pdf deleted file mode 100644 index 4ecf121e729..00000000000 Binary files a/users/plotting/examples/annotate_simple02.pdf and /dev/null differ diff --git a/users/plotting/examples/annotate_simple02.png b/users/plotting/examples/annotate_simple02.png deleted file mode 100644 index 497efbbfd21..00000000000 Binary files a/users/plotting/examples/annotate_simple02.png and /dev/null differ diff --git a/users/plotting/examples/annotate_simple02.py b/users/plotting/examples/annotate_simple02.py deleted file mode 100644 index 25bb0002de5..00000000000 --- a/users/plotting/examples/annotate_simple02.py +++ /dev/null @@ -1,15 +0,0 @@ -import matplotlib.pyplot as plt - -plt.figure(1, figsize=(3,3)) -ax = plt.subplot(111) - -ax.annotate("Test", - xy=(0.2, 0.2), xycoords='data', - xytext=(0.8, 0.8), textcoords='data', - size=20, va="center", ha="center", - arrowprops=dict(arrowstyle="simple", - connectionstyle="arc3,rad=-0.2"), - ) - -plt.show() - diff --git a/users/plotting/examples/annotate_simple03.hires.png b/users/plotting/examples/annotate_simple03.hires.png deleted file mode 100644 index 0ec062df9cd..00000000000 Binary files a/users/plotting/examples/annotate_simple03.hires.png and /dev/null differ diff --git a/users/plotting/examples/annotate_simple03.pdf b/users/plotting/examples/annotate_simple03.pdf deleted file mode 100644 index 7bd8d462297..00000000000 Binary files a/users/plotting/examples/annotate_simple03.pdf and /dev/null differ diff --git a/users/plotting/examples/annotate_simple03.png b/users/plotting/examples/annotate_simple03.png deleted file mode 100644 index 39e697abd39..00000000000 Binary files a/users/plotting/examples/annotate_simple03.png and /dev/null differ diff --git a/users/plotting/examples/annotate_simple03.py b/users/plotting/examples/annotate_simple03.py deleted file mode 100644 index 61a885afd2a..00000000000 --- a/users/plotting/examples/annotate_simple03.py +++ /dev/null @@ -1,17 +0,0 @@ -import matplotlib.pyplot as plt - -plt.figure(1, figsize=(3,3)) -ax = plt.subplot(111) - -ann = ax.annotate("Test", - xy=(0.2, 0.2), xycoords='data', - xytext=(0.8, 0.8), textcoords='data', - size=20, va="center", ha="center", - bbox=dict(boxstyle="round4", fc="w"), - arrowprops=dict(arrowstyle="-|>", - connectionstyle="arc3,rad=-0.2", - fc="w"), - ) - -plt.show() - diff --git a/users/plotting/examples/annotate_simple04.hires.png b/users/plotting/examples/annotate_simple04.hires.png deleted file mode 100644 index cad10a05eff..00000000000 Binary files a/users/plotting/examples/annotate_simple04.hires.png and /dev/null differ diff --git a/users/plotting/examples/annotate_simple04.pdf b/users/plotting/examples/annotate_simple04.pdf deleted file mode 100644 index eb4a7c260b6..00000000000 Binary files a/users/plotting/examples/annotate_simple04.pdf and /dev/null differ diff --git a/users/plotting/examples/annotate_simple04.png b/users/plotting/examples/annotate_simple04.png deleted file mode 100644 index 3fbd0dd9bc5..00000000000 Binary files a/users/plotting/examples/annotate_simple04.png and /dev/null differ diff --git a/users/plotting/examples/annotate_simple04.py b/users/plotting/examples/annotate_simple04.py deleted file mode 100644 index cdbb1d80417..00000000000 --- a/users/plotting/examples/annotate_simple04.py +++ /dev/null @@ -1,29 +0,0 @@ -import matplotlib.pyplot as plt - -plt.figure(1, figsize=(3,3)) -ax = plt.subplot(111) - -ann = ax.annotate("Test", - xy=(0.2, 0.2), xycoords='data', - xytext=(0.8, 0.8), textcoords='data', - size=20, va="center", ha="center", - bbox=dict(boxstyle="round4", fc="w"), - arrowprops=dict(arrowstyle="-|>", - connectionstyle="arc3,rad=0.2", - relpos=(0., 0.), - fc="w"), - ) - -ann = ax.annotate("Test", - xy=(0.2, 0.2), xycoords='data', - xytext=(0.8, 0.8), textcoords='data', - size=20, va="center", ha="center", - bbox=dict(boxstyle="round4", fc="w"), - arrowprops=dict(arrowstyle="-|>", - connectionstyle="arc3,rad=-0.2", - relpos=(1., 0.), - fc="w"), - ) - -plt.show() - diff --git a/users/plotting/examples/annotate_simple_coord01.hires.png b/users/plotting/examples/annotate_simple_coord01.hires.png deleted file mode 100644 index d415bc4f4e3..00000000000 Binary files a/users/plotting/examples/annotate_simple_coord01.hires.png and /dev/null differ diff --git a/users/plotting/examples/annotate_simple_coord01.pdf b/users/plotting/examples/annotate_simple_coord01.pdf deleted file mode 100644 index 6fc5829677d..00000000000 Binary files a/users/plotting/examples/annotate_simple_coord01.pdf and /dev/null differ diff --git a/users/plotting/examples/annotate_simple_coord01.png b/users/plotting/examples/annotate_simple_coord01.png deleted file mode 100644 index 6c4b91afbfc..00000000000 Binary files a/users/plotting/examples/annotate_simple_coord01.png and /dev/null differ diff --git a/users/plotting/examples/annotate_simple_coord01.py b/users/plotting/examples/annotate_simple_coord01.py deleted file mode 100644 index 7b53d0c2297..00000000000 --- a/users/plotting/examples/annotate_simple_coord01.py +++ /dev/null @@ -1,15 +0,0 @@ - -import matplotlib.pyplot as plt - -plt.figure(figsize=(3,2)) -ax=plt.subplot(111) -an1 = ax.annotate("Test 1", xy=(0.5, 0.5), xycoords="data", - va="center", ha="center", - bbox=dict(boxstyle="round", fc="w")) -an2 = ax.annotate("Test 2", xy=(1, 0.5), xycoords=an1, - xytext=(30,0), textcoords="offset points", - va="center", ha="left", - bbox=dict(boxstyle="round", fc="w"), - arrowprops=dict(arrowstyle="->")) -plt.show() - diff --git a/users/plotting/examples/annotate_simple_coord02.hires.png b/users/plotting/examples/annotate_simple_coord02.hires.png deleted file mode 100644 index df089c67b30..00000000000 Binary files a/users/plotting/examples/annotate_simple_coord02.hires.png and /dev/null differ diff --git a/users/plotting/examples/annotate_simple_coord02.pdf b/users/plotting/examples/annotate_simple_coord02.pdf deleted file mode 100644 index 0d6c299dc3c..00000000000 Binary files a/users/plotting/examples/annotate_simple_coord02.pdf and /dev/null differ diff --git a/users/plotting/examples/annotate_simple_coord02.png b/users/plotting/examples/annotate_simple_coord02.png deleted file mode 100644 index 958901ee774..00000000000 Binary files a/users/plotting/examples/annotate_simple_coord02.png and /dev/null differ diff --git a/users/plotting/examples/annotate_simple_coord02.py b/users/plotting/examples/annotate_simple_coord02.py deleted file mode 100644 index d2ce74dc6cf..00000000000 --- a/users/plotting/examples/annotate_simple_coord02.py +++ /dev/null @@ -1,16 +0,0 @@ - -import matplotlib.pyplot as plt - -plt.figure(figsize=(3,2)) -ax=plt.axes([0.1, 0.1, 0.8, 0.7]) -an1 = ax.annotate("Test 1", xy=(0.5, 0.5), xycoords="data", - va="center", ha="center", - bbox=dict(boxstyle="round", fc="w")) - -an2 = ax.annotate("Test 2", xy=(0.5, 1.), xycoords=an1, - xytext=(0.5,1.1), textcoords=(an1, "axes fraction"), - va="bottom", ha="center", - bbox=dict(boxstyle="round", fc="w"), - arrowprops=dict(arrowstyle="->")) -plt.show() - diff --git a/users/plotting/examples/annotate_simple_coord03.hires.png b/users/plotting/examples/annotate_simple_coord03.hires.png deleted file mode 100644 index 613d3f30323..00000000000 Binary files a/users/plotting/examples/annotate_simple_coord03.hires.png and /dev/null differ diff --git a/users/plotting/examples/annotate_simple_coord03.pdf b/users/plotting/examples/annotate_simple_coord03.pdf deleted file mode 100644 index 339b682028e..00000000000 Binary files a/users/plotting/examples/annotate_simple_coord03.pdf and /dev/null differ diff --git a/users/plotting/examples/annotate_simple_coord03.png b/users/plotting/examples/annotate_simple_coord03.png deleted file mode 100644 index eba450874c2..00000000000 Binary files a/users/plotting/examples/annotate_simple_coord03.png and /dev/null differ diff --git a/users/plotting/examples/annotate_simple_coord03.py b/users/plotting/examples/annotate_simple_coord03.py deleted file mode 100644 index b448f7513ca..00000000000 --- a/users/plotting/examples/annotate_simple_coord03.py +++ /dev/null @@ -1,19 +0,0 @@ - -import matplotlib.pyplot as plt - -plt.figure(figsize=(3,2)) -ax=plt.axes([0.1, 0.1, 0.8, 0.7]) -an1 = ax.annotate("Test 1", xy=(0.5, 0.5), xycoords="data", - va="center", ha="center", - bbox=dict(boxstyle="round", fc="w")) - -from matplotlib.text import OffsetFrom -offset_from = OffsetFrom(an1, (0.5, 0)) -an2 = ax.annotate("Test 2", xy=(0.1, 0.1), xycoords="data", - xytext=(0, -10), textcoords=offset_from, - # xytext is offset points from "xy=(0.5, 0), xycoords=an1" - va="top", ha="center", - bbox=dict(boxstyle="round", fc="w"), - arrowprops=dict(arrowstyle="->")) -plt.show() - diff --git a/users/plotting/examples/annotate_text_arrow.hires.png b/users/plotting/examples/annotate_text_arrow.hires.png deleted file mode 100644 index 8bfb17ba0d9..00000000000 Binary files a/users/plotting/examples/annotate_text_arrow.hires.png and /dev/null differ diff --git a/users/plotting/examples/annotate_text_arrow.pdf b/users/plotting/examples/annotate_text_arrow.pdf deleted file mode 100644 index 2487568b2ff..00000000000 Binary files a/users/plotting/examples/annotate_text_arrow.pdf and /dev/null differ diff --git a/users/plotting/examples/annotate_text_arrow.png b/users/plotting/examples/annotate_text_arrow.png deleted file mode 100644 index 09d2fda32a6..00000000000 Binary files a/users/plotting/examples/annotate_text_arrow.png and /dev/null differ diff --git a/users/plotting/examples/annotate_text_arrow.py b/users/plotting/examples/annotate_text_arrow.py deleted file mode 100644 index 4ed10f99670..00000000000 --- a/users/plotting/examples/annotate_text_arrow.py +++ /dev/null @@ -1,38 +0,0 @@ - -import numpy.random -import matplotlib.pyplot as plt - -fig = plt.figure(1, figsize=(5,5)) -fig.clf() - -ax = fig.add_subplot(111) -ax.set_aspect(1) - -x1 = -1 + numpy.random.randn(100) -y1 = -1 + numpy.random.randn(100) -x2 = 1. + numpy.random.randn(100) -y2 = 1. + numpy.random.randn(100) - -ax.scatter(x1, y1, color="r") -ax.scatter(x2, y2, color="g") - -bbox_props = dict(boxstyle="round", fc="w", ec="0.5", alpha=0.9) -ax.text(-2, -2, "Sample A", ha="center", va="center", size=20, - bbox=bbox_props) -ax.text(2, 2, "Sample B", ha="center", va="center", size=20, - bbox=bbox_props) - - -bbox_props = dict(boxstyle="rarrow", fc=(0.8,0.9,0.9), ec="b", lw=2) -t = ax.text(0, 0, "Direction", ha="center", va="center", rotation=45, - size=15, - bbox=bbox_props) - -bb = t.get_bbox_patch() -bb.set_boxstyle("rarrow", pad=0.6) - -ax.set_xlim(-4, 4) -ax.set_ylim(-4, 4) - -plt.draw() -plt.show() diff --git a/users/plotting/examples/colormap_normalizations_bounds.hires.png b/users/plotting/examples/colormap_normalizations_bounds.hires.png deleted file mode 100644 index 2ce92abbaf4..00000000000 Binary files a/users/plotting/examples/colormap_normalizations_bounds.hires.png and /dev/null differ diff --git a/users/plotting/examples/colormap_normalizations_bounds.pdf b/users/plotting/examples/colormap_normalizations_bounds.pdf deleted file mode 100644 index 5199514a807..00000000000 Binary files a/users/plotting/examples/colormap_normalizations_bounds.pdf and /dev/null differ diff --git a/users/plotting/examples/colormap_normalizations_bounds.png b/users/plotting/examples/colormap_normalizations_bounds.png deleted file mode 100644 index 7fc5d78c02b..00000000000 Binary files a/users/plotting/examples/colormap_normalizations_bounds.png and /dev/null differ diff --git a/users/plotting/examples/colormap_normalizations_bounds.py b/users/plotting/examples/colormap_normalizations_bounds.py deleted file mode 100644 index fb84e1d2efe..00000000000 --- a/users/plotting/examples/colormap_normalizations_bounds.py +++ /dev/null @@ -1,41 +0,0 @@ -""" -Demonstration of using norm to map colormaps onto data in non-linear ways. -""" - -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.colors as colors -from matplotlib.mlab import bivariate_normal - -N = 100 -X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)] -Z1 = (bivariate_normal(X, Y, 1., 1., 1.0, 1.0))**2 \ - - 0.4 * (bivariate_normal(X, Y, 1.0, 1.0, -1.0, 0.0))**2 -Z1 = Z1/0.03 - -''' -BoundaryNorm: For this one you provide the boundaries for your colors, -and the Norm puts the first color in between the first pair, the -second color between the second pair, etc. -''' - -fig, ax = plt.subplots(3, 1, figsize=(8, 8)) -ax = ax.flatten() -# even bounds gives a contour-like effect -bounds = np.linspace(-1, 1, 10) -norm = colors.BoundaryNorm(boundaries=bounds, ncolors=256) -pcm = ax[0].pcolormesh(X, Y, Z1, - norm=norm, - cmap='RdBu_r') -fig.colorbar(pcm, ax=ax[0], extend='both', orientation='vertical') - -# uneven bounds changes the colormapping: -bounds = np.array([-0.25, -0.125, 0, 0.5, 1]) -norm = colors.BoundaryNorm(boundaries=bounds, ncolors=256) -pcm = ax[1].pcolormesh(X, Y, Z1, norm=norm, cmap='RdBu_r') -fig.colorbar(pcm, ax=ax[1], extend='both', orientation='vertical') - -pcm = ax[2].pcolormesh(X, Y, Z1, cmap='RdBu_r', vmin=-np.max(Z1)) -fig.colorbar(pcm, ax=ax[2], extend='both', orientation='vertical') -fig.show() - diff --git a/users/plotting/examples/colormap_normalizations_custom.hires.png b/users/plotting/examples/colormap_normalizations_custom.hires.png deleted file mode 100644 index 33f2153f8ca..00000000000 Binary files a/users/plotting/examples/colormap_normalizations_custom.hires.png and /dev/null differ diff --git a/users/plotting/examples/colormap_normalizations_custom.pdf b/users/plotting/examples/colormap_normalizations_custom.pdf deleted file mode 100644 index 7661211e5db..00000000000 Binary files a/users/plotting/examples/colormap_normalizations_custom.pdf and /dev/null differ diff --git a/users/plotting/examples/colormap_normalizations_custom.png b/users/plotting/examples/colormap_normalizations_custom.png deleted file mode 100644 index fb55ca580dc..00000000000 Binary files a/users/plotting/examples/colormap_normalizations_custom.png and /dev/null differ diff --git a/users/plotting/examples/colormap_normalizations_custom.py b/users/plotting/examples/colormap_normalizations_custom.py deleted file mode 100644 index 89f6d7423e1..00000000000 --- a/users/plotting/examples/colormap_normalizations_custom.py +++ /dev/null @@ -1,46 +0,0 @@ -""" -Demonstration of using norm to map colormaps onto data in non-linear ways. -""" - -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.colors as colors -from matplotlib.mlab import bivariate_normal - -N = 100 -''' -Custom Norm: An example with a customized normalization. This one -uses the example above, and normalizes the negative data differently -from the positive. -''' -X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)] -Z1 = (bivariate_normal(X, Y, 1., 1., 1.0, 1.0))**2 \ - - 0.4 * (bivariate_normal(X, Y, 1.0, 1.0, -1.0, 0.0))**2 -Z1 = Z1/0.03 - -# Example of making your own norm. Also see matplotlib.colors. -# From Joe Kington: This one gives two different linear ramps: - - -class MidpointNormalize(colors.Normalize): - def __init__(self, vmin=None, vmax=None, midpoint=None, clip=False): - self.midpoint = midpoint - colors.Normalize.__init__(self, vmin, vmax, clip) - - def __call__(self, value, clip=None): - # I'm ignoring masked values and all kinds of edge cases to make a - # simple example... - x, y = [self.vmin, self.midpoint, self.vmax], [0, 0.5, 1] - return np.ma.masked_array(np.interp(value, x, y)) -##### -fig, ax = plt.subplots(2, 1) - -pcm = ax[0].pcolormesh(X, Y, Z1, - norm=MidpointNormalize(midpoint=0.), - cmap='RdBu_r') -fig.colorbar(pcm, ax=ax[0], extend='both') - -pcm = ax[1].pcolormesh(X, Y, Z1, cmap='RdBu_r', vmin=-np.max(Z1)) -fig.colorbar(pcm, ax=ax[1], extend='both') -fig.show() - diff --git a/users/plotting/examples/colormap_normalizations_lognorm.hires.png b/users/plotting/examples/colormap_normalizations_lognorm.hires.png deleted file mode 100644 index 795acb3312a..00000000000 Binary files a/users/plotting/examples/colormap_normalizations_lognorm.hires.png and /dev/null differ diff --git a/users/plotting/examples/colormap_normalizations_lognorm.pdf b/users/plotting/examples/colormap_normalizations_lognorm.pdf deleted file mode 100644 index 20a42ff0746..00000000000 Binary files a/users/plotting/examples/colormap_normalizations_lognorm.pdf and /dev/null differ diff --git a/users/plotting/examples/colormap_normalizations_lognorm.png b/users/plotting/examples/colormap_normalizations_lognorm.png deleted file mode 100644 index 0ab10a105e2..00000000000 Binary files a/users/plotting/examples/colormap_normalizations_lognorm.png and /dev/null differ diff --git a/users/plotting/examples/colormap_normalizations_lognorm.py b/users/plotting/examples/colormap_normalizations_lognorm.py deleted file mode 100644 index 82cd2a31bc6..00000000000 --- a/users/plotting/examples/colormap_normalizations_lognorm.py +++ /dev/null @@ -1,32 +0,0 @@ -""" -Demonstration of using norm to map colormaps onto data in non-linear ways. -""" - -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.colors as colors -from matplotlib.mlab import bivariate_normal - -''' -Lognorm: Instead of pcolor log10(Z1) you can have colorbars that have -the exponential labels using a norm. -''' -N = 100 -X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)] - -# A low hump with a spike coming out of the top right. Needs to have -# z/colour axis on a log scale so we see both hump and spike. linear -# scale only shows the spike. -Z1 = bivariate_normal(X, Y, 0.1, 0.2, 1.0, 1.0) + \ - 0.1 * bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - -fig, ax = plt.subplots(2, 1) - -pcm = ax[0].pcolor(X, Y, Z1, - norm=colors.LogNorm(vmin=Z1.min(), vmax=Z1.max()), - cmap='PuBu_r') -fig.colorbar(pcm, ax=ax[0], extend='max') - -pcm = ax[1].pcolor(X, Y, Z1, cmap='PuBu_r') -fig.colorbar(pcm, ax=ax[1], extend='max') -fig.show() diff --git a/users/plotting/examples/colormap_normalizations_power.hires.png b/users/plotting/examples/colormap_normalizations_power.hires.png deleted file mode 100644 index 28a6a84d0a4..00000000000 Binary files a/users/plotting/examples/colormap_normalizations_power.hires.png and /dev/null differ diff --git a/users/plotting/examples/colormap_normalizations_power.pdf b/users/plotting/examples/colormap_normalizations_power.pdf deleted file mode 100644 index f1e6b84a246..00000000000 Binary files a/users/plotting/examples/colormap_normalizations_power.pdf and /dev/null differ diff --git a/users/plotting/examples/colormap_normalizations_power.png b/users/plotting/examples/colormap_normalizations_power.png deleted file mode 100644 index 03d84bad71d..00000000000 Binary files a/users/plotting/examples/colormap_normalizations_power.png and /dev/null differ diff --git a/users/plotting/examples/colormap_normalizations_power.py b/users/plotting/examples/colormap_normalizations_power.py deleted file mode 100644 index 2b5b737074c..00000000000 --- a/users/plotting/examples/colormap_normalizations_power.py +++ /dev/null @@ -1,30 +0,0 @@ -""" -Demonstration of using norm to map colormaps onto data in non-linear ways. -""" - -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.colors as colors -from matplotlib.mlab import bivariate_normal - -N = 100 -X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)] - -''' -PowerNorm: Here a power-law trend in X partially obscures a rectified -sine wave in Y. We can remove the power law using a PowerNorm. -''' -X, Y = np.mgrid[0:3:complex(0, N), 0:2:complex(0, N)] -Z1 = (1 + np.sin(Y * 10.)) * X**(2.) - -fig, ax = plt.subplots(2, 1) - -pcm = ax[0].pcolormesh(X, Y, Z1, norm=colors.PowerNorm(gamma=1./2.), - cmap='PuBu_r') -fig.colorbar(pcm, ax=ax[0], extend='max') - -pcm = ax[1].pcolormesh(X, Y, Z1, cmap='PuBu_r') -fig.colorbar(pcm, ax=ax[1], extend='max') -fig.show() - - diff --git a/users/plotting/examples/colormap_normalizations_symlognorm.hires.png b/users/plotting/examples/colormap_normalizations_symlognorm.hires.png deleted file mode 100644 index 8713585791e..00000000000 Binary files a/users/plotting/examples/colormap_normalizations_symlognorm.hires.png and /dev/null differ diff --git a/users/plotting/examples/colormap_normalizations_symlognorm.pdf b/users/plotting/examples/colormap_normalizations_symlognorm.pdf deleted file mode 100644 index 80211bef2ec..00000000000 Binary files a/users/plotting/examples/colormap_normalizations_symlognorm.pdf and /dev/null differ diff --git a/users/plotting/examples/colormap_normalizations_symlognorm.png b/users/plotting/examples/colormap_normalizations_symlognorm.png deleted file mode 100644 index 812f4b7be9a..00000000000 Binary files a/users/plotting/examples/colormap_normalizations_symlognorm.png and /dev/null differ diff --git a/users/plotting/examples/colormap_normalizations_symlognorm.py b/users/plotting/examples/colormap_normalizations_symlognorm.py deleted file mode 100644 index 691b922946a..00000000000 --- a/users/plotting/examples/colormap_normalizations_symlognorm.py +++ /dev/null @@ -1,35 +0,0 @@ -""" -Demonstration of using norm to map colormaps onto data in non-linear ways. -""" - -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.colors as colors -from matplotlib.mlab import bivariate_normal - -""" -SymLogNorm: two humps, one negative and one positive, The positive -with 5-times the amplitude. Linearly, you cannot see detail in the -negative hump. Here we logarithmically scale the positive and -negative data separately. - -Note that colorbar labels do not come out looking very good. -""" -N=100 -X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)] -Z1 = (bivariate_normal(X, Y, 1., 1., 1.0, 1.0))**2 \ - - 0.4 * (bivariate_normal(X, Y, 1.0, 1.0, -1.0, 0.0))**2 -Z1 = Z1/0.03 - -fig, ax = plt.subplots(2, 1) - -pcm = ax[0].pcolormesh(X, Y, Z1, - norm=colors.SymLogNorm(linthresh=0.03, linscale=0.03, - vmin=-1.0, vmax=1.0), - cmap='RdBu_r') -fig.colorbar(pcm, ax=ax[0], extend='both') - -pcm = ax[1].pcolormesh(X, Y, Z1, cmap='RdBu_r', vmin=-np.max(Z1)) -fig.colorbar(pcm, ax=ax[1], extend='both') -fig.show() - diff --git a/users/plotting/examples/connect_simple01.hires.png b/users/plotting/examples/connect_simple01.hires.png deleted file mode 100644 index c7af22c221c..00000000000 Binary files a/users/plotting/examples/connect_simple01.hires.png and /dev/null differ diff --git a/users/plotting/examples/connect_simple01.pdf b/users/plotting/examples/connect_simple01.pdf deleted file mode 100644 index 86dde480472..00000000000 Binary files a/users/plotting/examples/connect_simple01.pdf and /dev/null differ diff --git a/users/plotting/examples/connect_simple01.png b/users/plotting/examples/connect_simple01.png deleted file mode 100644 index 4ab97e74ae2..00000000000 Binary files a/users/plotting/examples/connect_simple01.png and /dev/null differ diff --git a/users/plotting/examples/connect_simple01.py b/users/plotting/examples/connect_simple01.py deleted file mode 100644 index 7e251ca6bc2..00000000000 --- a/users/plotting/examples/connect_simple01.py +++ /dev/null @@ -1,31 +0,0 @@ -from matplotlib.patches import ConnectionPatch -import matplotlib.pyplot as plt - -fig = plt.figure(1, figsize=(6,3)) -ax1 = plt.subplot(121) -xyA=(0.2, 0.2) -xyB=(0.8, 0.8) -coordsA="data" -coordsB="data" -con = ConnectionPatch(xyA, xyB, coordsA, coordsB, - arrowstyle="-|>", shrinkA=5, shrinkB=5, - mutation_scale=20, fc="w") -ax1.plot([xyA[0], xyB[0]], [xyA[1], xyB[1]], "o") -ax1.add_artist(con) - -ax2 = plt.subplot(122) -#xyA=(0.7, 0.7) -xy=(0.3, 0.2) -coordsA="data" -coordsB="data" -con = ConnectionPatch(xyA=xy, xyB=xy, coordsA=coordsA, coordsB=coordsB, - axesA=ax2, axesB=ax1, - arrowstyle="->", shrinkB=5) -ax2.add_artist(con) - -ax1.set_xlim(0, 1) -ax1.set_ylim(0, 1) -ax2.set_xlim(0, .5) -ax2.set_ylim(0, .5) -plt.draw() -plt.show() diff --git a/users/plotting/examples/connectionstyle_demo.hires.png b/users/plotting/examples/connectionstyle_demo.hires.png deleted file mode 100644 index 6ec8ba3fbe5..00000000000 Binary files a/users/plotting/examples/connectionstyle_demo.hires.png and /dev/null differ diff --git a/users/plotting/examples/connectionstyle_demo.pdf b/users/plotting/examples/connectionstyle_demo.pdf deleted file mode 100644 index 3f39d73d0af..00000000000 Binary files a/users/plotting/examples/connectionstyle_demo.pdf and /dev/null differ diff --git a/users/plotting/examples/connectionstyle_demo.png b/users/plotting/examples/connectionstyle_demo.png deleted file mode 100644 index 71d1bf4f4e6..00000000000 Binary files a/users/plotting/examples/connectionstyle_demo.png and /dev/null differ diff --git a/users/plotting/examples/connectionstyle_demo.py b/users/plotting/examples/connectionstyle_demo.py deleted file mode 100644 index baa68fab5ad..00000000000 --- a/users/plotting/examples/connectionstyle_demo.py +++ /dev/null @@ -1,109 +0,0 @@ - -import matplotlib.pyplot as plt -import matplotlib.patches as mpatches - -fig = plt.figure(1, figsize=(8,5)) -fig.clf() -from mpl_toolkits.axes_grid.axes_grid import AxesGrid -from mpl_toolkits.axes_grid.anchored_artists import AnchoredText - -#from matplotlib.font_manager import FontProperties - -def add_at(ax, t, loc=2): - fp = dict(size=8) - _at = AnchoredText(t, loc=loc, prop=fp) - ax.add_artist(_at) - return _at - - -grid = AxesGrid(fig, 111, (3, 5), label_mode="1", share_all=True) - -grid[0].set_autoscale_on(False) - - -x1, y1 = 0.3, 0.3 -x2, y2 = 0.7, 0.7 - - -def demo_con_style(ax, connectionstyle, label=None): - - if label is None: - label = connectionstyle - - x1, y1 = 0.3, 0.2 - x2, y2 = 0.8, 0.6 - - ax.plot([x1, x2], [y1, y2], ".") - ax.annotate("", - xy=(x1, y1), xycoords='data', - xytext=(x2, y2), textcoords='data', - arrowprops=dict(arrowstyle="->", #linestyle="dashed", - color="0.5", - shrinkA=5, shrinkB=5, - patchA=None, - patchB=None, - connectionstyle=connectionstyle, - ), - ) - - add_at(ax, label, loc=2) - -column = grid.axes_column[0] - -demo_con_style(column[0], "angle3,angleA=90,angleB=0", - label="angle3,\nangleA=90,\nangleB=0") -demo_con_style(column[1], "angle3,angleA=0,angleB=90", - label="angle3,\nangleA=0,\nangleB=90") - - - -column = grid.axes_column[1] - -demo_con_style(column[0], "arc3,rad=0.") -demo_con_style(column[1], "arc3,rad=0.3") -demo_con_style(column[2], "arc3,rad=-0.3") - - - -column = grid.axes_column[2] - -demo_con_style(column[0], "angle,angleA=-90,angleB=180,rad=0", - label="angle,\nangleA=-90,\nangleB=180,\nrad=0") -demo_con_style(column[1], "angle,angleA=-90,angleB=180,rad=5", - label="angle,\nangleA=-90,\nangleB=180,\nrad=5") -demo_con_style(column[2], "angle,angleA=-90,angleB=10,rad=5", - label="angle,\nangleA=-90,\nangleB=10,\nrad=0") - - -column = grid.axes_column[3] - -demo_con_style(column[0], "arc,angleA=-90,angleB=0,armA=30,armB=30,rad=0", - label="arc,\nangleA=-90,\nangleB=0,\narmA=30,\narmB=30,\nrad=0") -demo_con_style(column[1], "arc,angleA=-90,angleB=0,armA=30,armB=30,rad=5", - label="arc,\nangleA=-90,\nangleB=0,\narmA=30,\narmB=30,\nrad=5") -demo_con_style(column[2], "arc,angleA=-90,angleB=0,armA=0,armB=40,rad=0", - label="arc,\nangleA=-90,\nangleB=0,\narmA=0,\narmB=40,\nrad=0") - - -column = grid.axes_column[4] - -demo_con_style(column[0], "bar,fraction=0.3", - label="bar,\nfraction=0.3") -demo_con_style(column[1], "bar,fraction=-0.3", - label="bar,\nfraction=-0.3") -demo_con_style(column[2], "bar,angle=180,fraction=-0.2", - label="bar,\nangle=180,\nfraction=-0.2") - - -#demo_con_style(column[1], "arc3,rad=0.3") -#demo_con_style(column[2], "arc3,rad=-0.3") - - -grid[0].set_xlim(0, 1) -grid[0].set_ylim(0, 1) -grid.axes_llc.axis["bottom"].toggle(ticklabels=False) -grid.axes_llc.axis["left"].toggle(ticklabels=False) -fig.subplots_adjust(left=0.05, right=0.95, bottom=0.05, top=0.95) - -plt.draw() -plt.show() diff --git a/users/plotting/examples/custom_boxstyle01.hires.png b/users/plotting/examples/custom_boxstyle01.hires.png deleted file mode 100644 index 57be7a5fd94..00000000000 Binary files a/users/plotting/examples/custom_boxstyle01.hires.png and /dev/null differ diff --git a/users/plotting/examples/custom_boxstyle01.pdf b/users/plotting/examples/custom_boxstyle01.pdf deleted file mode 100644 index 3b147a53d55..00000000000 Binary files a/users/plotting/examples/custom_boxstyle01.pdf and /dev/null differ diff --git a/users/plotting/examples/custom_boxstyle01.png b/users/plotting/examples/custom_boxstyle01.png deleted file mode 100644 index 188e75769c0..00000000000 Binary files a/users/plotting/examples/custom_boxstyle01.png and /dev/null differ diff --git a/users/plotting/examples/custom_boxstyle01.py b/users/plotting/examples/custom_boxstyle01.py deleted file mode 100644 index f53f135d38e..00000000000 --- a/users/plotting/examples/custom_boxstyle01.py +++ /dev/null @@ -1,47 +0,0 @@ -from matplotlib.path import Path - -def custom_box_style(x0, y0, width, height, mutation_size, mutation_aspect=1): - """ - Given the location and size of the box, return the path of - the box around it. - - - *x0*, *y0*, *width*, *height* : location and size of the box - - *mutation_size* : a reference scale for the mutation. - - *aspect_ratio* : aspect-ration for the mutation. - """ - - # note that we are ignoring mutation_aspect. This is okay in general. - - # padding - mypad = 0.3 - pad = mutation_size * mypad - - # width and height with padding added. - width, height = width + 2.*pad, \ - height + 2.*pad, - - # boundary of the padded box - x0, y0 = x0-pad, y0-pad, - x1, y1 = x0+width, y0 + height - - cp = [(x0, y0), - (x1, y0), (x1, y1), (x0, y1), - (x0-pad, (y0+y1)/2.), (x0, y0), - (x0, y0)] - - com = [Path.MOVETO, - Path.LINETO, Path.LINETO, Path.LINETO, - Path.LINETO, Path.LINETO, - Path.CLOSEPOLY] - - path = Path(cp, com) - - return path - - -import matplotlib.pyplot as plt - -plt.figure(1, figsize=(3,3)) -ax = plt.subplot(111) -ax.text(0.5, 0.5, "Test", size=30, va="center", ha="center", - bbox=dict(boxstyle=custom_box_style, alpha=0.2)) diff --git a/users/plotting/examples/custom_boxstyle02.hires.png b/users/plotting/examples/custom_boxstyle02.hires.png deleted file mode 100644 index a79093fd75d..00000000000 Binary files a/users/plotting/examples/custom_boxstyle02.hires.png and /dev/null differ diff --git a/users/plotting/examples/custom_boxstyle02.pdf b/users/plotting/examples/custom_boxstyle02.pdf deleted file mode 100644 index bb6f236ccbb..00000000000 Binary files a/users/plotting/examples/custom_boxstyle02.pdf and /dev/null differ diff --git a/users/plotting/examples/custom_boxstyle02.png b/users/plotting/examples/custom_boxstyle02.png deleted file mode 100644 index 0eea83560fb..00000000000 Binary files a/users/plotting/examples/custom_boxstyle02.png and /dev/null differ diff --git a/users/plotting/examples/custom_boxstyle02.py b/users/plotting/examples/custom_boxstyle02.py deleted file mode 100644 index bd6616c8158..00000000000 --- a/users/plotting/examples/custom_boxstyle02.py +++ /dev/null @@ -1,74 +0,0 @@ -from matplotlib.path import Path -from matplotlib.patches import BoxStyle -import matplotlib.pyplot as plt - -# we may derive from matplotlib.patches.BoxStyle._Base class. -# You need to override transmute method in this case. - -class MyStyle(BoxStyle._Base): - """ - A simple box. - """ - - def __init__(self, pad=0.3): - """ - The arguments need to be floating numbers and need to have - default values. - - *pad* - amount of padding - """ - - self.pad = pad - super(MyStyle, self).__init__() - - def transmute(self, x0, y0, width, height, mutation_size): - """ - Given the location and size of the box, return the path of - the box around it. - - - *x0*, *y0*, *width*, *height* : location and size of the box - - *mutation_size* : a reference scale for the mutation. - - Often, the *mutation_size* is the font size of the text. - You don't need to worry about the rotation as it is - automatically taken care of. - """ - - # padding - pad = mutation_size * self.pad - - # width and height with padding added. - width, height = width + 2.*pad, \ - height + 2.*pad, - - # boundary of the padded box - x0, y0 = x0-pad, y0-pad, - x1, y1 = x0+width, y0 + height - - cp = [(x0, y0), - (x1, y0), (x1, y1), (x0, y1), - (x0-pad, (y0+y1)/2.), (x0, y0), - (x0, y0)] - - com = [Path.MOVETO, - Path.LINETO, Path.LINETO, Path.LINETO, - Path.LINETO, Path.LINETO, - Path.CLOSEPOLY] - - path = Path(cp, com) - - return path - - -# register the custom style -BoxStyle._style_list["angled"] = MyStyle - -plt.figure(1, figsize=(3,3)) -ax = plt.subplot(111) -ax.text(0.5, 0.5, "Test", size=30, va="center", ha="center", rotation=30, - bbox=dict(boxstyle="angled,pad=0.5", alpha=0.2)) - -del BoxStyle._style_list["angled"] - -plt.show() diff --git a/users/plotting/examples/demo_gridspec01.hires.png b/users/plotting/examples/demo_gridspec01.hires.png deleted file mode 100644 index b6f4c43a7f4..00000000000 Binary files a/users/plotting/examples/demo_gridspec01.hires.png and /dev/null differ diff --git a/users/plotting/examples/demo_gridspec01.pdf b/users/plotting/examples/demo_gridspec01.pdf deleted file mode 100644 index db1f350b482..00000000000 Binary files a/users/plotting/examples/demo_gridspec01.pdf and /dev/null differ diff --git a/users/plotting/examples/demo_gridspec01.png b/users/plotting/examples/demo_gridspec01.png deleted file mode 100644 index ba5bba258f6..00000000000 Binary files a/users/plotting/examples/demo_gridspec01.png and /dev/null differ diff --git a/users/plotting/examples/demo_gridspec01.py b/users/plotting/examples/demo_gridspec01.py deleted file mode 100644 index 55c76a7f0f4..00000000000 --- a/users/plotting/examples/demo_gridspec01.py +++ /dev/null @@ -1,20 +0,0 @@ -import matplotlib.pyplot as plt - -def make_ticklabels_invisible(fig): - for i, ax in enumerate(fig.axes): - ax.text(0.5, 0.5, "ax%d" % (i+1), va="center", ha="center") - for tl in ax.get_xticklabels() + ax.get_yticklabels(): - tl.set_visible(False) - - -plt.figure(0) -ax1 = plt.subplot2grid((3,3), (0,0), colspan=3) -ax2 = plt.subplot2grid((3,3), (1,0), colspan=2) -ax3 = plt.subplot2grid((3,3), (1, 2), rowspan=2) -ax4 = plt.subplot2grid((3,3), (2, 0)) -ax5 = plt.subplot2grid((3,3), (2, 1)) - -plt.suptitle("subplot2grid") -make_ticklabels_invisible(plt.gcf()) -plt.show() - diff --git a/users/plotting/examples/demo_gridspec02.hires.png b/users/plotting/examples/demo_gridspec02.hires.png deleted file mode 100644 index b53e2d7c11a..00000000000 Binary files a/users/plotting/examples/demo_gridspec02.hires.png and /dev/null differ diff --git a/users/plotting/examples/demo_gridspec02.pdf b/users/plotting/examples/demo_gridspec02.pdf deleted file mode 100644 index d7386584d48..00000000000 Binary files a/users/plotting/examples/demo_gridspec02.pdf and /dev/null differ diff --git a/users/plotting/examples/demo_gridspec02.png b/users/plotting/examples/demo_gridspec02.png deleted file mode 100644 index a1a27f8c83c..00000000000 Binary files a/users/plotting/examples/demo_gridspec02.png and /dev/null differ diff --git a/users/plotting/examples/demo_gridspec02.py b/users/plotting/examples/demo_gridspec02.py deleted file mode 100644 index 43a7f089940..00000000000 --- a/users/plotting/examples/demo_gridspec02.py +++ /dev/null @@ -1,26 +0,0 @@ -import matplotlib.pyplot as plt -from matplotlib.gridspec import GridSpec - - -def make_ticklabels_invisible(fig): - for i, ax in enumerate(fig.axes): - ax.text(0.5, 0.5, "ax%d" % (i+1), va="center", ha="center") - for tl in ax.get_xticklabels() + ax.get_yticklabels(): - tl.set_visible(False) - - -plt.figure() - -gs = GridSpec(3, 3) -ax1 = plt.subplot(gs[0, :]) -# identical to ax1 = plt.subplot(gs.new_subplotspec((0,0), colspan=3)) -ax2 = plt.subplot(gs[1,:-1]) -ax3 = plt.subplot(gs[1:, -1]) -ax4 = plt.subplot(gs[-1,0]) -ax5 = plt.subplot(gs[-1,-2]) - -plt.suptitle("GridSpec") -make_ticklabels_invisible(plt.gcf()) - -plt.show() - diff --git a/users/plotting/examples/demo_gridspec03.hires.png b/users/plotting/examples/demo_gridspec03.hires.png deleted file mode 100644 index 57f7324d568..00000000000 Binary files a/users/plotting/examples/demo_gridspec03.hires.png and /dev/null differ diff --git a/users/plotting/examples/demo_gridspec03.pdf b/users/plotting/examples/demo_gridspec03.pdf deleted file mode 100644 index a97b74c3acd..00000000000 Binary files a/users/plotting/examples/demo_gridspec03.pdf and /dev/null differ diff --git a/users/plotting/examples/demo_gridspec03.png b/users/plotting/examples/demo_gridspec03.png deleted file mode 100644 index 3165b66afd1..00000000000 Binary files a/users/plotting/examples/demo_gridspec03.png and /dev/null differ diff --git a/users/plotting/examples/demo_gridspec03.py b/users/plotting/examples/demo_gridspec03.py deleted file mode 100644 index da7c801566c..00000000000 --- a/users/plotting/examples/demo_gridspec03.py +++ /dev/null @@ -1,34 +0,0 @@ -import matplotlib.pyplot as plt -from matplotlib.gridspec import GridSpec - - -def make_ticklabels_invisible(fig): - for i, ax in enumerate(fig.axes): - ax.text(0.5, 0.5, "ax%d" % (i+1), va="center", ha="center") - for tl in ax.get_xticklabels() + ax.get_yticklabels(): - tl.set_visible(False) - - - -# demo 3 : gridspec with subplotpars set. - -f = plt.figure() - -plt.suptitle("GridSpec w/ different subplotpars") - -gs1 = GridSpec(3, 3) -gs1.update(left=0.05, right=0.48, wspace=0.05) -ax1 = plt.subplot(gs1[:-1, :]) -ax2 = plt.subplot(gs1[-1, :-1]) -ax3 = plt.subplot(gs1[-1, -1]) - -gs2 = GridSpec(3, 3) -gs2.update(left=0.55, right=0.98, hspace=0.05) -ax4 = plt.subplot(gs2[:, :-1]) -ax5 = plt.subplot(gs2[:-1, -1]) -ax6 = plt.subplot(gs2[-1, -1]) - -make_ticklabels_invisible(plt.gcf()) - -plt.show() - diff --git a/users/plotting/examples/demo_gridspec04.hires.png b/users/plotting/examples/demo_gridspec04.hires.png deleted file mode 100644 index 5547eb28d97..00000000000 Binary files a/users/plotting/examples/demo_gridspec04.hires.png and /dev/null differ diff --git a/users/plotting/examples/demo_gridspec04.pdf b/users/plotting/examples/demo_gridspec04.pdf deleted file mode 100644 index b98c5a6f9da..00000000000 Binary files a/users/plotting/examples/demo_gridspec04.pdf and /dev/null differ diff --git a/users/plotting/examples/demo_gridspec04.png b/users/plotting/examples/demo_gridspec04.png deleted file mode 100644 index ddd12ef69a5..00000000000 Binary files a/users/plotting/examples/demo_gridspec04.png and /dev/null differ diff --git a/users/plotting/examples/demo_gridspec04.py b/users/plotting/examples/demo_gridspec04.py deleted file mode 100644 index f948b13d91e..00000000000 --- a/users/plotting/examples/demo_gridspec04.py +++ /dev/null @@ -1,41 +0,0 @@ -import matplotlib.pyplot as plt -import matplotlib.gridspec as gridspec - -def make_ticklabels_invisible(fig): - for i, ax in enumerate(fig.axes): - ax.text(0.5, 0.5, "ax%d" % (i+1), va="center", ha="center") - for tl in ax.get_xticklabels() + ax.get_yticklabels(): - tl.set_visible(False) - - - -# gridspec inside gridspec - -f = plt.figure() - -gs0 = gridspec.GridSpec(1, 2) - -gs00 = gridspec.GridSpecFromSubplotSpec(3, 3, subplot_spec=gs0[0]) - -ax1 = plt.Subplot(f, gs00[:-1, :]) -f.add_subplot(ax1) -ax2 = plt.Subplot(f, gs00[-1, :-1]) -f.add_subplot(ax2) -ax3 = plt.Subplot(f, gs00[-1, -1]) -f.add_subplot(ax3) - - -gs01 = gridspec.GridSpecFromSubplotSpec(3, 3, subplot_spec=gs0[1]) - -ax4 = plt.Subplot(f, gs01[:, :-1]) -f.add_subplot(ax4) -ax5 = plt.Subplot(f, gs01[:-1, -1]) -f.add_subplot(ax5) -ax6 = plt.Subplot(f, gs01[-1, -1]) -f.add_subplot(ax6) - -plt.suptitle("GirdSpec Inside GridSpec") -make_ticklabels_invisible(plt.gcf()) - -plt.show() - diff --git a/users/plotting/examples/demo_gridspec05.hires.png b/users/plotting/examples/demo_gridspec05.hires.png deleted file mode 100644 index bc2be52506e..00000000000 Binary files a/users/plotting/examples/demo_gridspec05.hires.png and /dev/null differ diff --git a/users/plotting/examples/demo_gridspec05.pdf b/users/plotting/examples/demo_gridspec05.pdf deleted file mode 100644 index 8fb4975fa91..00000000000 Binary files a/users/plotting/examples/demo_gridspec05.pdf and /dev/null differ diff --git a/users/plotting/examples/demo_gridspec05.png b/users/plotting/examples/demo_gridspec05.png deleted file mode 100644 index 23278afb579..00000000000 Binary files a/users/plotting/examples/demo_gridspec05.png and /dev/null differ diff --git a/users/plotting/examples/demo_gridspec05.py b/users/plotting/examples/demo_gridspec05.py deleted file mode 100644 index 6bc263a8933..00000000000 --- a/users/plotting/examples/demo_gridspec05.py +++ /dev/null @@ -1,26 +0,0 @@ -import matplotlib.pyplot as plt -import matplotlib.gridspec as gridspec - -def make_ticklabels_invisible(fig): - for i, ax in enumerate(fig.axes): - ax.text(0.5, 0.5, "ax%d" % (i+1), va="center", ha="center") - for tl in ax.get_xticklabels() + ax.get_yticklabels(): - tl.set_visible(False) - - - -f = plt.figure() - -gs = gridspec.GridSpec(2, 2, - width_ratios=[1,2], - height_ratios=[4,1] - ) - -ax1 = plt.subplot(gs[0]) -ax2 = plt.subplot(gs[1]) -ax3 = plt.subplot(gs[2]) -ax4 = plt.subplot(gs[3]) - -make_ticklabels_invisible(f) -plt.show() - diff --git a/users/plotting/examples/demo_gridspec06.hires.png b/users/plotting/examples/demo_gridspec06.hires.png deleted file mode 100644 index d9ee5534329..00000000000 Binary files a/users/plotting/examples/demo_gridspec06.hires.png and /dev/null differ diff --git a/users/plotting/examples/demo_gridspec06.pdf b/users/plotting/examples/demo_gridspec06.pdf deleted file mode 100644 index 0ab2964e8bc..00000000000 Binary files a/users/plotting/examples/demo_gridspec06.pdf and /dev/null differ diff --git a/users/plotting/examples/demo_gridspec06.png b/users/plotting/examples/demo_gridspec06.png deleted file mode 100644 index 06cceb9d192..00000000000 Binary files a/users/plotting/examples/demo_gridspec06.png and /dev/null differ diff --git a/users/plotting/examples/demo_gridspec06.py b/users/plotting/examples/demo_gridspec06.py deleted file mode 100644 index e1fbaf5c5f9..00000000000 --- a/users/plotting/examples/demo_gridspec06.py +++ /dev/null @@ -1,53 +0,0 @@ -import matplotlib.pyplot as plt -import matplotlib.gridspec as gridspec -import numpy as np - -try: - from itertools import product -except ImportError: - # product is new in v 2.6 - def product(*args, **kwds): - pools = map(tuple, args) * kwds.get('repeat', 1) - result = [[]] - for pool in pools: - result = [x+[y] for x in result for y in pool] - for prod in result: - yield tuple(prod) - - -def squiggle_xy(a, b, c, d, i=np.arange(0.0, 2*np.pi, 0.05)): - return np.sin(i*a)*np.cos(i*b), np.sin(i*c)*np.cos(i*d) - -fig = plt.figure(figsize=(8, 8)) - -# gridspec inside gridspec -outer_grid = gridspec.GridSpec(4, 4, wspace=0.0, hspace=0.0) - -for i in range(16): - inner_grid = gridspec.GridSpecFromSubplotSpec(3, 3, - subplot_spec=outer_grid[i], wspace=0.0, hspace=0.0) - a, b = int(i/4)+1,i%4+1 - for j, (c, d) in enumerate(product(range(1, 4), repeat=2)): - ax = plt.Subplot(fig, inner_grid[j]) - ax.plot(*squiggle_xy(a, b, c, d)) - ax.set_xticks([]) - ax.set_yticks([]) - fig.add_subplot(ax) - -all_axes = fig.get_axes() - -#show only the outside spines -for ax in all_axes: - for sp in ax.spines.values(): - sp.set_visible(False) - if ax.is_first_row(): - ax.spines['top'].set_visible(True) - if ax.is_last_row(): - ax.spines['bottom'].set_visible(True) - if ax.is_first_col(): - ax.spines['left'].set_visible(True) - if ax.is_last_col(): - ax.spines['right'].set_visible(True) - -plt.show() - diff --git a/users/plotting/examples/simple_legend01.hires.png b/users/plotting/examples/simple_legend01.hires.png deleted file mode 100644 index c4e37939511..00000000000 Binary files a/users/plotting/examples/simple_legend01.hires.png and /dev/null differ diff --git a/users/plotting/examples/simple_legend01.pdf b/users/plotting/examples/simple_legend01.pdf deleted file mode 100644 index 5cd544ff30d..00000000000 Binary files a/users/plotting/examples/simple_legend01.pdf and /dev/null differ diff --git a/users/plotting/examples/simple_legend01.png b/users/plotting/examples/simple_legend01.png deleted file mode 100644 index 752013c8742..00000000000 Binary files a/users/plotting/examples/simple_legend01.png and /dev/null differ diff --git a/users/plotting/examples/simple_legend01.py b/users/plotting/examples/simple_legend01.py deleted file mode 100644 index 8e0ede33167..00000000000 --- a/users/plotting/examples/simple_legend01.py +++ /dev/null @@ -1,18 +0,0 @@ -import matplotlib.pyplot as plt - - -plt.subplot(211) -plt.plot([1,2,3], label="test1") -plt.plot([3,2,1], label="test2") -# Place a legend above this subplot, expanding itself to -# fully use the given bounding box. -plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3, - ncol=2, mode="expand", borderaxespad=0.) - -plt.subplot(223) -plt.plot([1,2,3], label="test1") -plt.plot([3,2,1], label="test2") -# Place a legend to the right of this smaller subplot. -plt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.) - -plt.show() diff --git a/users/plotting/examples/simple_legend02.hires.png b/users/plotting/examples/simple_legend02.hires.png deleted file mode 100644 index 6ae71be55df..00000000000 Binary files a/users/plotting/examples/simple_legend02.hires.png and /dev/null differ diff --git a/users/plotting/examples/simple_legend02.pdf b/users/plotting/examples/simple_legend02.pdf deleted file mode 100644 index 56b9c5d5b74..00000000000 Binary files a/users/plotting/examples/simple_legend02.pdf and /dev/null differ diff --git a/users/plotting/examples/simple_legend02.png b/users/plotting/examples/simple_legend02.png deleted file mode 100644 index 99e2468b1f6..00000000000 Binary files a/users/plotting/examples/simple_legend02.png and /dev/null differ diff --git a/users/plotting/examples/simple_legend02.py b/users/plotting/examples/simple_legend02.py deleted file mode 100644 index dabd2f072e7..00000000000 --- a/users/plotting/examples/simple_legend02.py +++ /dev/null @@ -1,15 +0,0 @@ -import matplotlib.pyplot as plt - -line1, = plt.plot([1,2,3], label="Line 1", linestyle='--') -line2, = plt.plot([3,2,1], label="Line 2", linewidth=4) - -# Create a legend for the first line. -first_legend = plt.legend(handles=[line1], loc=1) - -# Add the legend manually to the current Axes. -ax = plt.gca().add_artist(first_legend) - -# Create another legend for the second line. -plt.legend(handles=[line2], loc=4) - -plt.show() diff --git a/users/pyplot_tutorial.html b/users/pyplot_tutorial.html deleted file mode 100644 index bfed4060fdb..00000000000 --- a/users/pyplot_tutorial.html +++ /dev/null @@ -1,817 +0,0 @@ - - - - - - - - Pyplot tutorial — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -

    Table Of Contents

    - -
    -

    Related Topics

    - -
    -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    Pyplot tutorial

    -

    matplotlib.pyplot is a collection of command style functions -that make matplotlib work like MATLAB. -Each pyplot function makes -some change to a figure: e.g., creates a figure, creates a plotting area -in a figure, plots some lines in a plotting area, decorates the plot -with labels, etc. In matplotlib.pyplot various states are preserved -across function calls, so that it keeps track of things like -the current figure and plotting area, and the plotting -functions are directed to the current axes (please note that “axes” here -and in most places in the documentation refers to the axes -part of a figure -and not the strict mathematical term for more than one axis).

    -
    import matplotlib.pyplot as plt
    -plt.plot([1,2,3,4])
    -plt.ylabel('some numbers')
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/pyplot_simple.png -
    -

    You may be wondering why the x-axis ranges from 0-3 and the y-axis -from 1-4. If you provide a single list or array to the -plot() command, matplotlib assumes it is a -sequence of y values, and automatically generates the x values for -you. Since python ranges start with 0, the default x vector has the -same length as y but starts with 0. Hence the x data are -[0,1,2,3].

    -

    plot() is a versatile command, and will take -an arbitrary number of arguments. For example, to plot x versus y, -you can issue the command:

    -
    plt.plot([1, 2, 3, 4], [1, 4, 9, 16])
    -
    -
    -

    For every x, y pair of arguments, there is an optional third argument -which is the format string that indicates the color and line type of -the plot. The letters and symbols of the format string are from -MATLAB, and you concatenate a color string with a line style string. -The default format string is ‘b-‘, which is a solid blue line. For -example, to plot the above with red circles, you would issue

    -
    import matplotlib.pyplot as plt
    -plt.plot([1,2,3,4], [1,4,9,16], 'ro')
    -plt.axis([0, 6, 0, 20])
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/pyplot_formatstr.png -
    -

    See the plot() documentation for a complete -list of line styles and format strings. The -axis() command in the example above takes a -list of [xmin, xmax, ymin, ymax] and specifies the viewport of the -axes.

    -

    If matplotlib were limited to working with lists, it would be fairly -useless for numeric processing. Generally, you will use numpy arrays. In fact, all sequences are -converted to numpy arrays internally. The example below illustrates a -plotting several lines with different format styles in one command -using arrays.

    -
    import numpy as np
    -import matplotlib.pyplot as plt
    -
    -# evenly sampled time at 200ms intervals
    -t = np.arange(0., 5., 0.2)
    -
    -# red dashes, blue squares and green triangles
    -plt.plot(t, t, 'r--', t, t**2, 'bs', t, t**3, 'g^')
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/pyplot_three.png -
    -
    -

    Controlling line properties

    -

    Lines have many attributes that you can set: linewidth, dash style, -antialiased, etc; see matplotlib.lines.Line2D. There are -several ways to set line properties

    -
      -
    • Use keyword args:

      -
      plt.plot(x, y, linewidth=2.0)
      -
      -
      -
    • -
    • Use the setter methods of a Line2D instance. plot returns a list -of Line2D objects; e.g., line1, line2 = plot(x1, y1, x2, y2). In the code -below we will suppose that we have only -one line so that the list returned is of length 1. We use tuple unpacking with -line, to get the first element of that list:

      -
      line, = plt.plot(x, y, '-')
      -line.set_antialiased(False) # turn off antialising
      -
      -
      -
    • -
    • Use the setp() command. The example below -uses a MATLAB-style command to set multiple properties -on a list of lines. setp works transparently with a list of objects -or a single object. You can either use python keyword arguments or -MATLAB-style string/value pairs:

      -
      lines = plt.plot(x1, y1, x2, y2)
      -# use keyword args
      -plt.setp(lines, color='r', linewidth=2.0)
      -# or MATLAB style string value pairs
      -plt.setp(lines, 'color', 'r', 'linewidth', 2.0)
      -
      -
      -
    • -
    -

    Here are the available Line2D properties.

    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PropertyValue Type
    alphafloat
    animated[True | False]
    antialiased or aa[True | False]
    clip_boxa matplotlib.transform.Bbox instance
    clip_on[True | False]
    clip_patha Path instance and a Transform instance, a Patch
    color or cany matplotlib color
    containsthe hit testing function
    dash_capstyle['butt' | 'round' | 'projecting']
    dash_joinstyle['miter' | 'round' | 'bevel']
    dashessequence of on/off ink in points
    data(np.array xdata, np.array ydata)
    figurea matplotlib.figure.Figure instance
    labelany string
    linestyle or ls[ '-' | '--' | '-.' | ':' | 'steps' | ...]
    linewidth or lwfloat value in points
    lod[True | False]
    marker[ '+' | ',' | '.' | '1' | '2' | '3' | '4' ]
    markeredgecolor or mecany matplotlib color
    markeredgewidth or mewfloat value in points
    markerfacecolor or mfcany matplotlib color
    markersize or msfloat
    markevery[ None | integer | (startind, stride) ]
    pickerused in interactive line selection
    pickradiusthe line pick selection radius
    solid_capstyle['butt' | 'round' | 'projecting']
    solid_joinstyle['miter' | 'round' | 'bevel']
    transforma matplotlib.transforms.Transform instance
    visible[True | False]
    xdatanp.array
    ydatanp.array
    zorderany number
    -

    To get a list of settable line properties, call the -setp() function with a line or lines -as argument

    -
    In [69]: lines = plt.plot([1, 2, 3])
    -
    -In [70]: plt.setp(lines)
    -  alpha: float
    -  animated: [True | False]
    -  antialiased or aa: [True | False]
    -  ...snip
    -
    -
    -
    -
    -

    Working with multiple figures and axes

    -

    MATLAB, and pyplot, have the concept of the current -figure and the current axes. All plotting commands apply to the -current axes. The function gca() returns the -current axes (a matplotlib.axes.Axes instance), and -gcf() returns the current figure -(matplotlib.figure.Figure instance). Normally, you don’t have -to worry about this, because it is all taken care of behind the -scenes. Below is a script to create two subplots.

    -
    import numpy as np
    -import matplotlib.pyplot as plt
    -
    -def f(t):
    -    return np.exp(-t) * np.cos(2*np.pi*t)
    -
    -t1 = np.arange(0.0, 5.0, 0.1)
    -t2 = np.arange(0.0, 5.0, 0.02)
    -
    -plt.figure(1)
    -plt.subplot(211)
    -plt.plot(t1, f(t1), 'bo', t2, f(t2), 'k')
    -
    -plt.subplot(212)
    -plt.plot(t2, np.cos(2*np.pi*t2), 'r--')
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/pyplot_two_subplots.png -
    -

    The figure() command here is optional because -figure(1) will be created by default, just as a subplot(111) -will be created by default if you don’t manually specify any axes. The -subplot() command specifies numrows, -numcols, fignum where fignum ranges from 1 to -numrows*numcols. The commas in the subplot command are -optional if numrows*numcols<10. So subplot(211) is identical -to subplot(2, 1, 1). You can create an arbitrary number of subplots -and axes. If you want to place an axes manually, i.e., not on a -rectangular grid, use the axes() command, -which allows you to specify the location as axes([left, bottom, -width, height]) where all values are in fractional (0 to 1) -coordinates. See pylab_examples example code: axes_demo.py for an example of -placing axes manually and pylab_examples example code: subplots_demo.py for an -example with lots of subplots.

    -

    You can create multiple figures by using multiple -figure() calls with an increasing figure -number. Of course, each figure can contain as many axes and subplots -as your heart desires:

    -
    import matplotlib.pyplot as plt
    -plt.figure(1)                # the first figure
    -plt.subplot(211)             # the first subplot in the first figure
    -plt.plot([1, 2, 3])
    -plt.subplot(212)             # the second subplot in the first figure
    -plt.plot([4, 5, 6])
    -
    -
    -plt.figure(2)                # a second figure
    -plt.plot([4, 5, 6])          # creates a subplot(111) by default
    -
    -plt.figure(1)                # figure 1 current; subplot(212) still current
    -plt.subplot(211)             # make subplot(211) in figure1 current
    -plt.title('Easy as 1, 2, 3') # subplot 211 title
    -
    -
    -

    You can clear the current figure with clf() -and the current axes with cla(). If you find -it annoying that states (specifically the current image, figure and axes) -are being maintained for you behind the scenes, don’t despair: this is just a thin -stateful wrapper around an object oriented API, which you can use -instead (see Artist tutorial)

    -

    If you are making lots of figures, you need to be aware of one -more thing: the memory required for a figure is not completely -released until the figure is explicitly closed with -close(). Deleting all references to the -figure, and/or using the window manager to kill the window in which -the figure appears on the screen, is not enough, because pyplot -maintains internal references until close() -is called.

    -
    -
    -

    Working with text

    -

    The text() command can be used to add text in -an arbitrary location, and the xlabel(), -ylabel() and title() -are used to add text in the indicated locations (see Text introduction -for a more detailed example)

    -
    import numpy as np
    -import matplotlib.pyplot as plt
    -
    -# Fixing random state for reproducibility
    -np.random.seed(19680801)
    -
    -mu, sigma = 100, 15
    -x = mu + sigma * np.random.randn(10000)
    -
    -# the histogram of the data
    -n, bins, patches = plt.hist(x, 50, normed=1, facecolor='g', alpha=0.75)
    -
    -
    -plt.xlabel('Smarts')
    -plt.ylabel('Probability')
    -plt.title('Histogram of IQ')
    -plt.text(60, .025, r'$\mu=100,\ \sigma=15$')
    -plt.axis([40, 160, 0, 0.03])
    -plt.grid(True)
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/pyplot_text.png -
    -

    All of the text() commands return an -matplotlib.text.Text instance. Just as with with lines -above, you can customize the properties by passing keyword arguments -into the text functions or using setp():

    -
    t = plt.xlabel('my data', fontsize=14, color='red')
    -
    -
    -

    These properties are covered in more detail in Text properties and layout.

    -
    -

    Using mathematical expressions in text

    -

    matplotlib accepts TeX equation expressions in any text expression. -For example to write the expression in the title, -you can write a TeX expression surrounded by dollar signs:

    -
    plt.title(r'$\sigma_i=15$')
    -
    -
    -

    The r preceding the title string is important – it signifies -that the string is a raw string and not to treat backslashes as -python escapes. matplotlib has a built-in TeX expression parser and -layout engine, and ships its own math fonts – for details see -Writing mathematical expressions. Thus you can use mathematical text across platforms -without requiring a TeX installation. For those who have LaTeX and -dvipng installed, you can also use LaTeX to format your text and -incorporate the output directly into your display figures or saved -postscript – see Text rendering With LaTeX.

    -
    -
    -

    Annotating text

    -

    The uses of the basic text() command above -place text at an arbitrary position on the Axes. A common use for -text is to annotate some feature of the plot, and the -annotate() method provides helper -functionality to make annotations easy. In an annotation, there are -two points to consider: the location being annotated represented by -the argument xy and the location of the text xytext. Both of -these arguments are (x,y) tuples.

    -
    import numpy as np
    -import matplotlib.pyplot as plt
    -
    -ax = plt.subplot(111)
    -
    -t = np.arange(0.0, 5.0, 0.01)
    -s = np.cos(2*np.pi*t)
    -line, = plt.plot(t, s, lw=2)
    -
    -plt.annotate('local max', xy=(2, 1), xytext=(3, 1.5),
    -            arrowprops=dict(facecolor='black', shrink=0.05),
    -            )
    -
    -plt.ylim(-2,2)
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/pyplot_annotate.png -
    -

    In this basic example, both the xy (arrow tip) and xytext -locations (text location) are in data coordinates. There are a -variety of other coordinate systems one can choose – see -Basic annotation and Advanced Annotation for -details. More examples can be found in -pylab_examples example code: annotation_demo.py.

    -
    -
    -
    -

    Logarithmic and other nonlinear axes

    -

    matplotlib.pyplot supports not only linear axis scales, but also -logarithmic and logit scales. This is commonly used if data spans many orders -of magnitude. Changing the scale of an axis is easy:

    -
    -
    plt.xscale(‘log’)
    -

    An example of four plots with the same data and different scales for the y axis -is shown below.

    -
    import numpy as np
    -import matplotlib.pyplot as plt
    -
    -from matplotlib.ticker import NullFormatter  # useful for `logit` scale
    -
    -# Fixing random state for reproducibility
    -np.random.seed(19680801)
    -
    -# make up some data in the interval ]0, 1[
    -y = np.random.normal(loc=0.5, scale=0.4, size=1000)
    -y = y[(y > 0) & (y < 1)]
    -y.sort()
    -x = np.arange(len(y))
    -
    -# plot with various axes scales
    -plt.figure(1)
    -
    -# linear
    -plt.subplot(221)
    -plt.plot(x, y)
    -plt.yscale('linear')
    -plt.title('linear')
    -plt.grid(True)
    -
    -
    -# log
    -plt.subplot(222)
    -plt.plot(x, y)
    -plt.yscale('log')
    -plt.title('log')
    -plt.grid(True)
    -
    -
    -# symmetric log
    -plt.subplot(223)
    -plt.plot(x, y - y.mean())
    -plt.yscale('symlog', linthreshy=0.01)
    -plt.title('symlog')
    -plt.grid(True)
    -
    -# logit
    -plt.subplot(224)
    -plt.plot(x, y)
    -plt.yscale('logit')
    -plt.title('logit')
    -plt.grid(True)
    -# Format the minor tick labels of the y-axis into empty strings with
    -# `NullFormatter`, to avoid cumbering the axis with too many labels.
    -plt.gca().yaxis.set_minor_formatter(NullFormatter())
    -# Adjust the subplot layout, because the logit one may take more space
    -# than usual, due to y-tick labels like "1 - 10^{-3}"
    -plt.subplots_adjust(top=0.92, bottom=0.08, left=0.10, right=0.95, hspace=0.25,
    -                    wspace=0.35)
    -
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/pyplot_scales.png -
    -

    It is also possible to add your own scale, see Developer’s guide for creating scales and transformations for -details.

    -
    -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/users/recipes-1.py b/users/recipes-1.py deleted file mode 100644 index 2c1b607070d..00000000000 --- a/users/recipes-1.py +++ /dev/null @@ -1,2 +0,0 @@ -# clear the state for context use below -plt.close('all') \ No newline at end of file diff --git a/users/recipes-2.pdf b/users/recipes-2.pdf deleted file mode 100644 index d581e17f6bf..00000000000 Binary files a/users/recipes-2.pdf and /dev/null differ diff --git a/users/recipes-2.png b/users/recipes-2.png deleted file mode 100644 index 9318cd9c5c5..00000000000 Binary files a/users/recipes-2.png and /dev/null differ diff --git a/users/recipes-2.py b/users/recipes-2.py deleted file mode 100644 index 9383bf8d084..00000000000 --- a/users/recipes-2.py +++ /dev/null @@ -1,14 +0,0 @@ -import matplotlib.cbook as cbook -datafile = cbook.get_sample_data('goog.npy') -try: - # Python3 cannot load python2 .npy files with datetime(object) arrays - # unless the encoding is set to bytes. Hovever this option was - # not added until numpy 1.10 so this example will only work with - # python 2 or with numpy 1.10 and later. - r = np.load(datafile, encoding='bytes').view(np.recarray) -except TypeError: - # Old Numpy - r = np.load(datafile).view(np.recarray) -plt.figure() -plt.plot(r.date, r.close) -plt.title('Default date handling can cause overlapping labels') \ No newline at end of file diff --git a/users/recipes-3.pdf b/users/recipes-3.pdf deleted file mode 100644 index 242a1c8ecb3..00000000000 Binary files a/users/recipes-3.pdf and /dev/null differ diff --git a/users/recipes-3.png b/users/recipes-3.png deleted file mode 100644 index 805a82e1491..00000000000 Binary files a/users/recipes-3.png and /dev/null differ diff --git a/users/recipes-3.py b/users/recipes-3.py deleted file mode 100644 index dadb23b270f..00000000000 --- a/users/recipes-3.py +++ /dev/null @@ -1,12 +0,0 @@ -plt.close('all') -fig, ax = plt.subplots(1) -ax.plot(r.date, r.close) - -# rotate and align the tick labels so they look better -fig.autofmt_xdate() - -# use a more precise date string for the x axis locations in the -# toolbar -import matplotlib.dates as mdates -ax.fmt_xdata = mdates.DateFormatter('%Y-%m-%d') -plt.title('fig.autofmt_xdate fixes the labels') \ No newline at end of file diff --git a/users/recipes-4.pdf b/users/recipes-4.pdf deleted file mode 100644 index 19ee001ac33..00000000000 Binary files a/users/recipes-4.pdf and /dev/null differ diff --git a/users/recipes-4.png b/users/recipes-4.png deleted file mode 100644 index adff4b72541..00000000000 Binary files a/users/recipes-4.png and /dev/null differ diff --git a/users/recipes-4.py b/users/recipes-4.py deleted file mode 100644 index 397a6dcca4c..00000000000 --- a/users/recipes-4.py +++ /dev/null @@ -1,32 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - -import matplotlib.cbook as cbook - -# load up some sample financial data -datafile = cbook.get_sample_data('goog.npy') -try: - # Python3 cannot load python2 .npy files with datetime(object) arrays - # unless the encoding is set to bytes. Hovever this option was - # not added until numpy 1.10 so this example will only work with - # python 2 or with numpy 1.10 and later. - r = np.load(datafile, encoding='bytes').view(np.recarray) -except TypeError: - r = np.load(datafile).view(np.recarray) -# create two subplots with the shared x and y axes -fig, (ax1, ax2) = plt.subplots(1,2, sharex=True, sharey=True) - -pricemin = r.close.min() - -ax1.plot(r.date, r.close, lw=2) -ax2.fill_between(r.date, pricemin, r.close, facecolor='blue', alpha=0.5) - -for ax in ax1, ax2: - ax.grid(True) - -ax1.set_ylabel('price') -for label in ax2.get_yticklabels(): - label.set_visible(False) - -fig.suptitle('Google (GOOG) daily closing price') -fig.autofmt_xdate() \ No newline at end of file diff --git a/users/recipes-5.pdf b/users/recipes-5.pdf deleted file mode 100644 index fffe39cafba..00000000000 Binary files a/users/recipes-5.pdf and /dev/null differ diff --git a/users/recipes-5.png b/users/recipes-5.png deleted file mode 100644 index 54dfdc5f6ed..00000000000 Binary files a/users/recipes-5.png and /dev/null differ diff --git a/users/recipes-5.py b/users/recipes-5.py deleted file mode 100644 index ece0cfa58bd..00000000000 --- a/users/recipes-5.py +++ /dev/null @@ -1,33 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np - -Nsteps, Nwalkers = 100, 250 -t = np.arange(Nsteps) - -# an (Nsteps x Nwalkers) array of random walk steps -S1 = 0.002 + 0.01*np.random.randn(Nsteps, Nwalkers) -S2 = 0.004 + 0.02*np.random.randn(Nsteps, Nwalkers) - -# an (Nsteps x Nwalkers) array of random walker positions -X1 = S1.cumsum(axis=0) -X2 = S2.cumsum(axis=0) - - -# Nsteps length arrays empirical means and standard deviations of both -# populations over time -mu1 = X1.mean(axis=1) -sigma1 = X1.std(axis=1) -mu2 = X2.mean(axis=1) -sigma2 = X2.std(axis=1) - -# plot it! -fig, ax = plt.subplots(1) -ax.plot(t, mu1, lw=2, label='mean population 1', color='blue') -ax.plot(t, mu2, lw=2, label='mean population 2', color='yellow') -ax.fill_between(t, mu1+sigma1, mu1-sigma1, facecolor='blue', alpha=0.5) -ax.fill_between(t, mu2+sigma2, mu2-sigma2, facecolor='yellow', alpha=0.5) -ax.set_title('random walkers empirical $\mu$ and $\pm \sigma$ interval') -ax.legend(loc='upper left') -ax.set_xlabel('num steps') -ax.set_ylabel('position') -ax.grid() \ No newline at end of file diff --git a/users/recipes-6.pdf b/users/recipes-6.pdf deleted file mode 100644 index 284aea55fe7..00000000000 Binary files a/users/recipes-6.pdf and /dev/null differ diff --git a/users/recipes-6.png b/users/recipes-6.png deleted file mode 100644 index 5697416ae4e..00000000000 Binary files a/users/recipes-6.png and /dev/null differ diff --git a/users/recipes-6.py b/users/recipes-6.py deleted file mode 100644 index 29280c7d4fb..00000000000 --- a/users/recipes-6.py +++ /dev/null @@ -1,29 +0,0 @@ -np.random.seed(1234) - -Nsteps = 500 -t = np.arange(Nsteps) - -mu = 0.002 -sigma = 0.01 - -# the steps and position -S = mu + sigma*np.random.randn(Nsteps) -X = S.cumsum() - -# the 1 sigma upper and lower analytic population bounds -lower_bound = mu*t - sigma*np.sqrt(t) -upper_bound = mu*t + sigma*np.sqrt(t) - -fig, ax = plt.subplots(1) -ax.plot(t, X, lw=2, label='walker position', color='blue') -ax.plot(t, mu*t, lw=1, label='population mean', color='black', ls='--') -ax.fill_between(t, lower_bound, upper_bound, facecolor='yellow', alpha=0.5, - label='1 sigma range') -ax.legend(loc='upper left') - -# here we use the where argument to only fill the region where the -# walker is above the population 1 sigma boundary -ax.fill_between(t, upper_bound, X, where=X>upper_bound, facecolor='blue', alpha=0.5) -ax.set_xlabel('num steps') -ax.set_ylabel('position') -ax.grid() \ No newline at end of file diff --git a/users/recipes-7.pdf b/users/recipes-7.pdf deleted file mode 100644 index 79f35010e5b..00000000000 Binary files a/users/recipes-7.pdf and /dev/null differ diff --git a/users/recipes-7.png b/users/recipes-7.png deleted file mode 100644 index ff83ff02290..00000000000 Binary files a/users/recipes-7.png and /dev/null differ diff --git a/users/recipes-7.py b/users/recipes-7.py deleted file mode 100644 index 194959b8830..00000000000 --- a/users/recipes-7.py +++ /dev/null @@ -1,8 +0,0 @@ -np.random.seed(1234) -fig, ax = plt.subplots(1) -ax.plot(np.random.randn(300), 'o-', label='normal distribution') -ax.plot(np.random.rand(300), 's-', label='uniform distribution') -ax.set_ylim(-3, 3) -ax.legend(loc='best', fancybox=True, framealpha=0.5) - -ax.set_title('fancy, transparent legends') \ No newline at end of file diff --git a/users/recipes-8.pdf b/users/recipes-8.pdf deleted file mode 100644 index 054124e5f2a..00000000000 Binary files a/users/recipes-8.pdf and /dev/null differ diff --git a/users/recipes-8.png b/users/recipes-8.png deleted file mode 100644 index 61099a6a67f..00000000000 Binary files a/users/recipes-8.png and /dev/null differ diff --git a/users/recipes-8.py b/users/recipes-8.py deleted file mode 100644 index b431806f37f..00000000000 --- a/users/recipes-8.py +++ /dev/null @@ -1,15 +0,0 @@ -np.random.seed(1234) -fig, ax = plt.subplots(1) -x = 30*np.random.randn(10000) -mu = x.mean() -median = np.median(x) -sigma = x.std() -textstr = '$\mu=%.2f$\n$\mathrm{median}=%.2f$\n$\sigma=%.2f$'%(mu, median, sigma) - -ax.hist(x, 50) -# these are matplotlib.patch.Patch properties -props = dict(boxstyle='round', facecolor='wheat', alpha=0.5) - -# place a text box in upper left in axes coords -ax.text(0.05, 0.95, textstr, transform=ax.transAxes, fontsize=14, - verticalalignment='top', bbox=props) \ No newline at end of file diff --git a/users/recipes.html b/users/recipes.html deleted file mode 100644 index ea103fa6108..00000000000 --- a/users/recipes.html +++ /dev/null @@ -1,667 +0,0 @@ - - - - - - - - Our Favorite Recipes — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - - - -
    -
    -
    -
    - -
    -

    Our Favorite Recipes

    -

    Here is a collection of short tutorials, examples and code snippets -that illustrate some of the useful idioms and tricks to make snazzier -figures and overcome some matplotlib warts.

    -
    -

    Sharing axis limits and views

    -

    It’s common to make two or more plots which share an axis, e.g., two -subplots with time as a common axis. When you pan and zoom around on -one, you want the other to move around with you. To facilitate this, -matplotlib Axes support a sharex and sharey attribute. When -you create a subplot() or -axes() instance, you can pass in a keyword -indicating what axes you want to share with

    -
    In [96]: t = np.arange(0, 10, 0.01)
    -
    -In [97]: ax1 = plt.subplot(211)
    -
    -In [98]: ax1.plot(t, np.sin(2*np.pi*t))
    -Out[98]: [<matplotlib.lines.Line2D object at 0x98719ec>]
    -
    -In [99]: ax2 = plt.subplot(212, sharex=ax1)
    -
    -In [100]: ax2.plot(t, np.sin(4*np.pi*t))
    -Out[100]: [<matplotlib.lines.Line2D object at 0xb7d8fec>]
    -
    -
    -
    -
    -

    Easily creating subplots

    -

    In early versions of matplotlib, if you wanted to use the pythonic API -and create a figure instance and from that create a grid of subplots, -possibly with shared axes, it involved a fair amount of boilerplate -code. e.g.

    -
    # old style
    -fig = plt.figure()
    -ax1 = fig.add_subplot(221)
    -ax2 = fig.add_subplot(222, sharex=ax1, sharey=ax1)
    -ax3 = fig.add_subplot(223, sharex=ax1, sharey=ax1)
    -ax3 = fig.add_subplot(224, sharex=ax1, sharey=ax1)
    -
    -
    -

    Fernando Perez has provided a nice top level method to create in -subplots() (note the “s” at the end) -everything at once, and turn on x and y sharing for the whole bunch. -You can either unpack the axes individually:

    -
    # new style method 1; unpack the axes
    -fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, sharex=True, sharey=True)
    -ax1.plot(x)
    -
    -
    -

    or get them back as a numrows x numcolumns object array which supports -numpy indexing:

    -
    # new style method 2; use an axes array
    -fig, axs = plt.subplots(2, 2, sharex=True, sharey=True)
    -axs[0,0].plot(x)
    -
    -
    -
    -
    -

    Fixing common date annoyances

    -

    (Source code)

    -

    matplotlib allows you to natively plots python datetime instances, and -for the most part does a good job picking tick locations and string -formats. There are a couple of things it does not handle so -gracefully, and here are some tricks to help you work around them. -We’ll load up some sample date data which contains datetime.date -objects in a numpy record array:

    -
    In [63]: datafile = cbook.get_sample_data('goog.npy')
    -
    -In [64]: r = np.load(datafile).view(np.recarray)
    -
    -In [65]: r.dtype
    -Out[65]: dtype([('date', '|O4'), ('', '|V4'), ('open', '<f8'),
    -                ('high', '<f8'), ('low', '<f8'), ('close', '<f8'),
    -                ('volume', '<i8'),  ('adj_close', '<f8')])
    -
    -In [66]: r.date
    -Out[66]:
    -array([2004-08-19, 2004-08-20, 2004-08-23, ..., 2008-10-10, 2008-10-13,
    -       2008-10-14], dtype=object)
    -
    -
    -

    The dtype of the numpy record array for the field date is |O4 -which means it is a 4-byte python object pointer; in this case the -objects are datetime.date instances, which we can see when we print -some samples in the ipython terminal window.

    -

    If you plot the data,

    -
    In [67]: plot(r.date, r.close)
    -Out[67]: [<matplotlib.lines.Line2D object at 0x92a6b6c>]
    -
    -
    -

    you will see that the x tick labels are all squashed together.

    -

    (Source code, png, pdf)

    -
    -../_images/recipes-2.png -
    -

    Another annoyance is that if you hover the mouse over the window and -look in the lower right corner of the matplotlib toolbar -(Interactive navigation) at the x and y coordinates, you see that -the x locations are formatted the same way the tick labels are, e.g., -“Dec 2004”. What we’d like is for the location in the toolbar to have -a higher degree of precision, e.g., giving us the exact date out mouse is -hovering over. To fix the first problem, we can use -matplotlib.figure.Figure.autofmt_xdate() and to fix the second -problem we can use the ax.fmt_xdata attribute which can be set to -any function that takes a scalar and returns a string. matplotlib has -a number of date formatters built in, so we’ll use one of those.

    -
    plt.close('all')
    -fig, ax = plt.subplots(1)
    -ax.plot(r.date, r.close)
    -
    -# rotate and align the tick labels so they look better
    -fig.autofmt_xdate()
    -
    -# use a more precise date string for the x axis locations in the
    -# toolbar
    -import matplotlib.dates as mdates
    -ax.fmt_xdata = mdates.DateFormatter('%Y-%m-%d')
    -plt.title('fig.autofmt_xdate fixes the labels')
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/recipes-3.png -
    -

    Now when you hover your mouse over the plotted data, you’ll see date -format strings like 2004-12-01 in the toolbar.

    -
    -
    -

    Fill Between and Alpha

    -

    The fill_between() function generates a -shaded region between a min and max boundary that is useful for -illustrating ranges. It has a very handy where argument to -combine filling with logical ranges, e.g., to just fill in a curve over -some threshold value.

    -

    At its most basic level, fill_between can be use to enhance a -graphs visual appearance. Let’s compare two graphs of a financial -times with a simple line plot on the left and a filled line on the -right.

    -
    import matplotlib.pyplot as plt
    -import numpy as np
    -
    -import matplotlib.cbook as cbook
    -
    -# load up some sample financial data
    -datafile = cbook.get_sample_data('goog.npy')
    -try:
    -    # Python3 cannot load python2 .npy files with datetime(object) arrays
    -    # unless the encoding is set to bytes. Hovever this option was
    -    # not added until numpy 1.10 so this example will only work with
    -    # python 2 or with numpy 1.10 and later.
    -    r = np.load(datafile, encoding='bytes').view(np.recarray)
    -except TypeError:
    -    r = np.load(datafile).view(np.recarray)
    -# create two subplots with the shared x and y axes
    -fig, (ax1, ax2) = plt.subplots(1,2, sharex=True, sharey=True)
    -
    -pricemin = r.close.min()
    -
    -ax1.plot(r.date, r.close, lw=2)
    -ax2.fill_between(r.date, pricemin, r.close, facecolor='blue', alpha=0.5)
    -
    -for ax in ax1, ax2:
    -    ax.grid(True)
    -
    -ax1.set_ylabel('price')
    -for label in ax2.get_yticklabels():
    -    label.set_visible(False)
    -
    -fig.suptitle('Google (GOOG) daily closing price')
    -fig.autofmt_xdate()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/recipes-4.png -
    -

    The alpha channel is not necessary here, but it can be used to soften -colors for more visually appealing plots. In other examples, as we’ll -see below, the alpha channel is functionally useful as the shaded -regions can overlap and alpha allows you to see both. Note that the -postscript format does not support alpha (this is a postscript -limitation, not a matplotlib limitation), so when using alpha save -your figures in PNG, PDF or SVG.

    -

    Our next example computes two populations of random walkers with a -different mean and standard deviation of the normal distributions from -which the steps are drawn. We use shared regions to plot +/- one -standard deviation of the mean position of the population. Here the -alpha channel is useful, not just aesthetic.

    -
    import matplotlib.pyplot as plt
    -import numpy as np
    -
    -Nsteps, Nwalkers = 100, 250
    -t = np.arange(Nsteps)
    -
    -# an (Nsteps x Nwalkers) array of random walk steps
    -S1 = 0.002 + 0.01*np.random.randn(Nsteps, Nwalkers)
    -S2 = 0.004 + 0.02*np.random.randn(Nsteps, Nwalkers)
    -
    -# an (Nsteps x Nwalkers) array of random walker positions
    -X1 = S1.cumsum(axis=0)
    -X2 = S2.cumsum(axis=0)
    -
    -
    -# Nsteps length arrays empirical means and standard deviations of both
    -# populations over time
    -mu1 = X1.mean(axis=1)
    -sigma1 = X1.std(axis=1)
    -mu2 = X2.mean(axis=1)
    -sigma2 = X2.std(axis=1)
    -
    -# plot it!
    -fig, ax = plt.subplots(1)
    -ax.plot(t, mu1, lw=2, label='mean population 1', color='blue')
    -ax.plot(t, mu2, lw=2, label='mean population 2', color='yellow')
    -ax.fill_between(t, mu1+sigma1, mu1-sigma1, facecolor='blue', alpha=0.5)
    -ax.fill_between(t, mu2+sigma2, mu2-sigma2, facecolor='yellow', alpha=0.5)
    -ax.set_title('random walkers empirical $\mu$ and $\pm \sigma$ interval')
    -ax.legend(loc='upper left')
    -ax.set_xlabel('num steps')
    -ax.set_ylabel('position')
    -ax.grid()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/recipes-5.png -
    -

    The where keyword argument is very handy for highlighting certain -regions of the graph. where takes a boolean mask the same length -as the x, ymin and ymax arguments, and only fills in the region where -the boolean mask is True. In the example below, we simulate a single -random walker and compute the analytic mean and standard deviation of -the population positions. The population mean is shown as the black -dashed line, and the plus/minus one sigma deviation from the mean is -shown as the yellow filled region. We use the where mask -X>upper_bound to find the region where the walker is above the one -sigma boundary, and shade that region blue.

    -
    np.random.seed(1234)
    -
    -Nsteps = 500
    -t = np.arange(Nsteps)
    -
    -mu = 0.002
    -sigma = 0.01
    -
    -# the steps and position
    -S = mu + sigma*np.random.randn(Nsteps)
    -X = S.cumsum()
    -
    -# the 1 sigma upper and lower analytic population bounds
    -lower_bound = mu*t - sigma*np.sqrt(t)
    -upper_bound = mu*t + sigma*np.sqrt(t)
    -
    -fig, ax = plt.subplots(1)
    -ax.plot(t, X, lw=2, label='walker position', color='blue')
    -ax.plot(t, mu*t, lw=1, label='population mean', color='black', ls='--')
    -ax.fill_between(t, lower_bound, upper_bound, facecolor='yellow', alpha=0.5,
    -                label='1 sigma range')
    -ax.legend(loc='upper left')
    -
    -# here we use the where argument to only fill the region where the
    -# walker is above the population 1 sigma boundary
    -ax.fill_between(t, upper_bound, X, where=X>upper_bound, facecolor='blue', alpha=0.5)
    -ax.set_xlabel('num steps')
    -ax.set_ylabel('position')
    -ax.grid()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/recipes-6.png -
    -

    Another handy use of filled regions is to highlight horizontal or -vertical spans of an axes – for that matplotlib has some helper -functions axhspan() and -axvspan() and example -pylab_examples example code: axhspan_demo.py.

    -
    -
    -

    Transparent, fancy legends

    -

    Sometimes you know what your data looks like before you plot it, and -may know for instance that there won’t be much data in the upper right -hand corner. Then you can safely create a legend that doesn’t overlay -your data:

    -
    ax.legend(loc='upper right')
    -
    -
    -

    Other times you don’t know where your data is, and loc=’best’ will try -and place the legend:

    -
    ax.legend(loc='best')
    -
    -
    -

    but still, your legend may overlap your data, and in these cases it’s -nice to make the legend frame transparent.

    -
    np.random.seed(1234)
    -fig, ax = plt.subplots(1)
    -ax.plot(np.random.randn(300), 'o-', label='normal distribution')
    -ax.plot(np.random.rand(300), 's-', label='uniform distribution')
    -ax.set_ylim(-3, 3)
    -ax.legend(loc='best', fancybox=True, framealpha=0.5)
    -
    -ax.set_title('fancy, transparent legends')
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/recipes-7.png -
    -
    -
    -

    Placing text boxes

    -

    When decorating axes with text boxes, two useful tricks are to place -the text in axes coordinates (see Transformations Tutorial), so the -text doesn’t move around with changes in x or y limits. You can also -use the bbox property of text to surround the text with a -Patch instance – the bbox keyword -argument takes a dictionary with keys that are Patch properties.

    -
    np.random.seed(1234)
    -fig, ax = plt.subplots(1)
    -x = 30*np.random.randn(10000)
    -mu = x.mean()
    -median = np.median(x)
    -sigma = x.std()
    -textstr = '$\mu=%.2f$\n$\mathrm{median}=%.2f$\n$\sigma=%.2f$'%(mu, median, sigma)
    -
    -ax.hist(x, 50)
    -# these are matplotlib.patch.Patch properties
    -props = dict(boxstyle='round', facecolor='wheat', alpha=0.5)
    -
    -# place a text box in upper left in axes coords
    -ax.text(0.05, 0.95, textstr, transform=ax.transAxes, fontsize=14,
    -        verticalalignment='top', bbox=props)
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/recipes-8.png -
    -
    -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/users/screenshots.html b/users/screenshots.html deleted file mode 100644 index b95fd9fbba5..00000000000 --- a/users/screenshots.html +++ /dev/null @@ -1,591 +0,0 @@ - - - - - - - - Screenshots — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - - - -
    -
    -
    -
    - -
    -

    Screenshots

    -

    Here you’ll find a host of example plots with the code that -generated them.

    -
    -

    Simple Plot

    -

    Here’s a very basic plot() with text labels:

    -

    (Source code, png, pdf)

    -
    -../_images/simple_plot.png -
    -
    -
    -

    Subplot demo

    -

    Multiple axes (i.e. subplots) are created with the -subplot() command:

    -

    (Source code, png, pdf)

    -
    -../_images/subplot_demo1.png -
    -
    -
    -

    Histograms

    -

    The hist() command automatically generates -histograms and returns the bin counts or probabilities:

    -

    (Source code, png, pdf)

    -
    -../_images/histogram_demo_features1.png -
    -
    -
    -

    Path demo

    -

    You can add arbitrary paths in matplotlib using the -matplotlib.path module:

    -

    (Source code, png, pdf)

    -
    -../_images/path_patch_demo1.png -
    -
    -
    -

    mplot3d

    -

    The mplot3d toolkit (see mplot3d tutorial and -mplot3d Examples) has support for simple 3d graphs -including surface, wireframe, scatter, and bar charts.

    -

    (Source code, png, pdf)

    -
    -../_images/surface3d_demo.png -
    -

    Thanks to John Porter, Jonathon Taylor, Reinier Heeres, and Ben Root for -the mplot3d toolkit. This toolkit is included with all standard matplotlib -installs.

    -
    -
    -

    Streamplot

    -

    The streamplot() function plots the streamlines of -a vector field. In addition to simply plotting the streamlines, it allows you -to map the colors and/or line widths of streamlines to a separate parameter, -such as the speed or local intensity of the vector field.

    -

    (Source code)

    -
    -../_images/streamplot_demo_features_001.png -

    (png, pdf)

    -
    -
    -../_images/streamplot_demo_features_011.png -

    (png, pdf)

    -
    -

    This feature complements the quiver() function for -plotting vector fields. Thanks to Tom Flannaghan and Tony Yu for adding the -streamplot function.

    -
    -
    -

    Ellipses

    -

    In support of the -Phoenix mission to -Mars (which used matplotlib to display ground tracking of spacecraft), -Michael Droettboom built on work by Charlie Moad to provide an extremely -accurate 8-spline approximation to elliptical arcs (see -Arc), which are insensitive to zoom level.

    -

    (Source code, png, pdf)

    -
    -../_images/ellipse_demo1.png -
    -
    -
    -

    Bar charts

    -

    Bar charts are simple to create using the bar() -command, which includes customizations such as error bars:

    -

    (Source code, png, pdf)

    -
    -../_images/barchart_demo3.png -
    -

    It’s also simple to create stacked bars -(bar_stacked.py), -or horizontal bar charts -(barh_demo.py).

    -
    -
    -

    Pie charts

    -

    The pie() command allows you to easily create pie -charts. Optional features include auto-labeling the percentage of area, -exploding one or more wedges from the center of the pie, and a shadow effect. -Take a close look at the attached code, which generates this figure in just -a few lines of code.

    -

    (Source code, png, pdf)

    -
    -../_images/pie_demo_features2.png -
    -
    -
    -

    Table demo

    -

    The table() command adds a text table -to an axes.

    -

    (Source code, png, pdf)

    -
    -../_images/table_demo1.png -
    -
    -
    -

    Scatter demo

    -

    The scatter() command makes a scatter plot -with (optional) size and color arguments. This example plots changes -in Google’s stock price, with marker sizes reflecting the -trading volume and colors varying with time. Here, the -alpha attribute is used to make semitransparent circle markers.

    -

    (Source code, png, pdf)

    -
    -../_images/scatter_demo2.png -
    -
    -
    -

    Slider demo

    -

    Matplotlib has basic GUI widgets that are independent of the graphical -user interface you are using, allowing you to write cross GUI figures -and widgets. See matplotlib.widgets and the -widget examples.

    -

    (Source code, png, pdf)

    -
    -../_images/slider_demo.png -
    -
    -
    -

    Fill demo

    -

    The fill() command lets you -plot filled curves and polygons:

    -

    (Source code, png, pdf)

    -
    -../_images/fill_demo2.png -
    -

    Thanks to Andrew Straw for adding this function.

    -
    -
    -

    Date demo

    -

    You can plot date data with major and minor ticks and custom tick formatters -for both.

    -

    (Source code, png, pdf)

    -
    -../_images/date_demo1.png -
    -

    See matplotlib.ticker and matplotlib.dates for details and usage.

    -
    -
    -

    Log plots

    -

    The semilogx(), -semilogy() and -loglog() functions simplify the creation of -logarithmic plots.

    -

    (Source code, png, pdf)

    -
    -../_images/log_demo2.png -
    -

    Thanks to Andrew Straw, Darren Dale and Gregory Lielens for contributions -log-scaling infrastructure.

    -
    -
    -

    Polar plots

    -

    The polar() command generates polar plots.

    -

    (Source code, png, pdf)

    -
    -../_images/polar_demo.png -
    -
    -
    -

    Legends

    -

    The legend() command automatically -generates figure legends, with MATLAB-compatible legend placement -commands.

    -

    (Source code, png, pdf)

    -
    -../_images/legend_demo6.png -
    -

    Thanks to Charles Twardy for input on the legend command.

    -
    -
    -

    Mathtext_examples

    -

    Below is a sampling of the many TeX expressions now supported by matplotlib’s -internal mathtext engine. The mathtext module provides TeX style mathematical -expressions using FreeType -and the DejaVu, BaKoMa computer modern, or STIX -fonts. See the matplotlib.mathtext module for additional details.

    -

    (Source code)

    -

    (png, pdf)

    -
    -../_images/mathtext_examples_01_00.png -
    -

    Matplotlib’s mathtext infrastructure is an independent implementation and -does not require TeX or any external packages installed on your computer. See -the tutorial at Writing mathematical expressions.

    -
    -
    -

    Native TeX rendering

    -

    Although matplotlib’s internal math rendering engine is quite -powerful, sometimes you need TeX. Matplotlib supports external TeX -rendering of strings with the usetex option.

    -

    (Source code, png, pdf)

    -
    -../_images/tex_demo1.png -
    -
    -
    -

    EEG demo

    -

    You can embed matplotlib into pygtk, wx, Tk, or Qt applications. -Here is a screenshot of an EEG viewer called pbrain.

    -../_images/eeg_small.png -

    The lower axes uses specgram() -to plot the spectrogram of one of the EEG channels.

    -

    For examples of how to embed matplotlib in different toolkits, see:

    -
    -
    -
    -
    -

    XKCD-style sketch plots

    -

    matplotlib supports plotting in the style of xkcd.

    -

    (Source code)

    -
    -../_images/xkcd_001.png -

    (png, pdf)

    -
    -
    -../_images/xkcd_011.png -

    (png, pdf)

    -
    -
    -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/users/text_intro.html b/users/text_intro.html deleted file mode 100644 index 66f7e4aaeb5..00000000000 --- a/users/text_intro.html +++ /dev/null @@ -1,407 +0,0 @@ - - - - - - - - Text introduction — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -

    Table Of Contents

    - - -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    Text introduction

    -

    matplotlib has extensive text support, including support for -mathematical expressions, truetype support for raster and -vector outputs, newline separated text with arbitrary -rotations, and unicode support. Because it embeds -fonts directly in output documents, e.g., for postscript -or PDF, what you see on the screen is what you get in the hardcopy. -FreeType support -produces very nice, antialiased fonts, that look good even at small -raster sizes. matplotlib includes its own -matplotlib.font_manager (thanks to Paul Barrett), which -implements a cross platform, W3C -compliant font finding algorithm.

    -

    The user has a great deal of control over text properties (font size, font -weight, text location and color, etc.) with sensible defaults set in -the rc file. -And significantly, for those interested in mathematical -or scientific figures, matplotlib implements a large number of TeX -math symbols and commands, supporting mathematical expressions anywhere in your figure.

    -
    -
    -

    Basic text commands

    -

    The following commands are used to create text in the pyplot -interface

    - -

    All of these functions create and return a -matplotlib.text.Text() instance, which can be configured with a -variety of font and other properties. The example below shows all of -these commands in action.

    -
    # -*- coding: utf-8 -*-
    -import matplotlib.pyplot as plt
    -
    -fig = plt.figure()
    -fig.suptitle('bold figure suptitle', fontsize=14, fontweight='bold')
    -
    -ax = fig.add_subplot(111)
    -fig.subplots_adjust(top=0.85)
    -ax.set_title('axes title')
    -
    -ax.set_xlabel('xlabel')
    -ax.set_ylabel('ylabel')
    -
    -ax.text(3, 8, 'boxed italics text in data coords', style='italic',
    -        bbox={'facecolor':'red', 'alpha':0.5, 'pad':10})
    -
    -ax.text(2, 6, r'an equation: $E=mc^2$', fontsize=15)
    -
    -ax.text(3, 2, u'unicode: Institut f\374r Festk\366rperphysik')
    -
    -ax.text(0.95, 0.01, 'colored text in axes coords',
    -        verticalalignment='bottom', horizontalalignment='right',
    -        transform=ax.transAxes,
    -        color='green', fontsize=15)
    -
    -
    -ax.plot([2], [1], 'o')
    -ax.annotate('annotate', xy=(2, 1), xytext=(3, 4),
    -            arrowprops=dict(facecolor='black', shrink=0.05))
    -
    -ax.axis([0, 10, 0, 10])
    -
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/text_commands.png -
    -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/users/text_props.html b/users/text_props.html deleted file mode 100644 index 277e1c151f3..00000000000 --- a/users/text_props.html +++ /dev/null @@ -1,628 +0,0 @@ - - - - - - - - Text properties and layout — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -

    Table Of Contents

    - -
    -

    Related Topics

    - -
    -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    Text properties and layout

    -

    The matplotlib.text.Text instances have a variety of -properties which can be configured via keyword arguments to the text -commands (e.g., title(), -xlabel() and text()).

    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PropertyValue Type
    alphafloat
    backgroundcolorany matplotlib color
    bboxRectangle prop dict plus key 'pad' which is a pad in points
    clip_boxa matplotlib.transform.Bbox instance
    clip_on[True | False]
    clip_patha Path instance and a Transform instance, a Patch
    colorany matplotlib color
    family[ 'serif' | 'sans-serif' | 'cursive' | 'fantasy' | 'monospace' ]
    fontpropertiesa FontProperties instance
    horizontalalignment or ha[ 'center' | 'right' | 'left' ]
    labelany string
    linespacingfloat
    multialignment['left' | 'right' | 'center' ]
    name or fontnamestring e.g., ['Sans' | 'Courier' | 'Helvetica' ...]
    picker[None|float|boolean|callable]
    position(x, y)
    rotation[ angle in degrees | 'vertical' | 'horizontal' ]
    size or fontsize[ size in points | relative size, e.g., 'smaller', 'x-large' ]
    style or fontstyle[ 'normal' | 'italic' | 'oblique' ]
    textstring or anything printable with ‘%s’ conversion
    transforma Transform instance
    variant[ 'normal' | 'small-caps' ]
    verticalalignment or va[ 'center' | 'top' | 'bottom' | 'baseline' ]
    visible[True | False]
    weight or fontweight[ 'normal' | 'bold' | 'heavy' | 'light' | 'ultrabold' | 'ultralight']
    xfloat
    yfloat
    zorderany number
    -

    You can lay out text with the alignment arguments -horizontalalignment, verticalalignment, and -multialignment. horizontalalignment controls whether the x -positional argument for the text indicates the left, center or right -side of the text bounding box. verticalalignment controls whether -the y positional argument for the text indicates the bottom, center or -top side of the text bounding box. multialignment, for newline -separated strings only, controls whether the different lines are left, -center or right justified. Here is an example which uses the -text() command to show the various alignment -possibilities. The use of transform=ax.transAxes throughout the -code indicates that the coordinates are given relative to the axes -bounding box, with 0,0 being the lower left of the axes and 1,1 the -upper right.

    -
    import matplotlib.pyplot as plt
    -import matplotlib.patches as patches
    -
    -# build a rectangle in axes coords
    -left, width = .25, .5
    -bottom, height = .25, .5
    -right = left + width
    -top = bottom + height
    -
    -fig = plt.figure()
    -ax = fig.add_axes([0,0,1,1])
    -
    -# axes coordinates are 0,0 is bottom left and 1,1 is upper right
    -p = patches.Rectangle(
    -    (left, bottom), width, height,
    -    fill=False, transform=ax.transAxes, clip_on=False
    -    )
    -
    -ax.add_patch(p)
    -
    -ax.text(left, bottom, 'left top',
    -        horizontalalignment='left',
    -        verticalalignment='top',
    -        transform=ax.transAxes)
    -
    -ax.text(left, bottom, 'left bottom',
    -        horizontalalignment='left',
    -        verticalalignment='bottom',
    -        transform=ax.transAxes)
    -
    -ax.text(right, top, 'right bottom',
    -        horizontalalignment='right',
    -        verticalalignment='bottom',
    -        transform=ax.transAxes)
    -
    -ax.text(right, top, 'right top',
    -        horizontalalignment='right',
    -        verticalalignment='top',
    -        transform=ax.transAxes)
    -
    -ax.text(right, bottom, 'center top',
    -        horizontalalignment='center',
    -        verticalalignment='top',
    -        transform=ax.transAxes)
    -
    -ax.text(left, 0.5*(bottom+top), 'right center',
    -        horizontalalignment='right',
    -        verticalalignment='center',
    -        rotation='vertical',
    -        transform=ax.transAxes)
    -
    -ax.text(left, 0.5*(bottom+top), 'left center',
    -        horizontalalignment='left',
    -        verticalalignment='center',
    -        rotation='vertical',
    -        transform=ax.transAxes)
    -
    -ax.text(0.5*(left+right), 0.5*(bottom+top), 'middle',
    -        horizontalalignment='center',
    -        verticalalignment='center',
    -        fontsize=20, color='red',
    -        transform=ax.transAxes)
    -
    -ax.text(right, 0.5*(bottom+top), 'centered',
    -        horizontalalignment='center',
    -        verticalalignment='center',
    -        rotation='vertical',
    -        transform=ax.transAxes)
    -
    -ax.text(left, top, 'rotated\nwith newlines',
    -        horizontalalignment='center',
    -        verticalalignment='center',
    -        rotation=45,
    -        transform=ax.transAxes)
    -
    -ax.set_axis_off()
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/text_layout.png -
    -
    -
    -

    Default Font

    -

    The base default font is controlled by a set of rcParams:

    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - -
    rcParamusage
    'font.family'List of either names of font or {'cursive', -'fantasy', 'monospace', 'sans', 'sans serif', -'sans-serif', 'serif'}.
    'font.style'The default style, ex 'normal', -'italic'.
    'font.variant'Default variant, ex 'normal', 'small-caps' -(untested)
    'font.stretch'Default stretch, ex 'normal', 'condensed' -(incomplete)
    'font.weight'Default weight. Either string or integer
    'font.size'Default font size in points. Relative font sizes -('large', 'x-small') are computed against -this size.
    -

    The mapping between the family aliases ({'cursive', 'fantasy', -'monospace', 'sans', 'sans serif', 'sans-serif', 'serif'}) and actual font names -is controlled by the following rcParams:

    - ---- - - - - - - - - - - - - - - - - - - - - - - -
    family aliasrcParam with mappings
    'serif''font.serif'
    'monospace''font.monospace'
    'fantasy''font.fantasy'
    'cursive''font.cursive'
    {'sans', 'sans serif', 'sans-serif'}'font.sans-serif'
    -

    which are lists of font names.

    -
    -

    Text with non-latin glyphs

    -

    As of v2.0 the default font contains -glyphs for many western alphabets, but still does not cover all of the -glyphs that may be required by mpl users. For example, DejaVu has no -coverage of Chinese, Korean, or Japanese.

    -

    To set the default font to be one that supports the code points you -need, prepend the font name to 'font.family' or the desired alias -lists

    -
    matplotlib.rcParams['font.sans-serif'] = ['Source Han Sans TW', 'sans-serif']
    -
    -
    -

    or set it in your .matplotlibrc file:

    -
    font.sans-serif: Source Han Sans TW, Ariel, sans-serif
    -
    -
    -

    To control the font used on per-artist basis use the 'name', -'fontname' or 'fontproperties' kwargs documented above.

    -

    On linux, fc-list can be a -useful tool to discover the font name; for example

    -
    $ fc-list :lang=zh family
    -Noto to Sans Mono CJK TC,Noto Sans Mono CJK TC Bold
    -Noto Sans CJK TC,Noto Sans CJK TC Medium
    -Noto Sans CJK TC,Noto Sans CJK TC DemiLight
    -Noto Sans CJK KR,Noto Sans CJK KR Black
    -Noto Sans CJK TC,Noto Sans CJK TC Black
    -Noto Sans Mono CJK TC,Noto Sans Mono CJK TC Regular
    -Noto Sans CJK SC,Noto Sans CJK SC Light
    -
    -
    -

    lists all of the fonts that support Chinese.

    -
    -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/users/tight_layout_guide-1.pdf b/users/tight_layout_guide-1.pdf deleted file mode 100644 index e262c8552cd..00000000000 Binary files a/users/tight_layout_guide-1.pdf and /dev/null differ diff --git a/users/tight_layout_guide-1.png b/users/tight_layout_guide-1.png deleted file mode 100644 index 2f7029474dc..00000000000 Binary files a/users/tight_layout_guide-1.png and /dev/null differ diff --git a/users/tight_layout_guide-1.py b/users/tight_layout_guide-1.py deleted file mode 100644 index 207d7be0f95..00000000000 --- a/users/tight_layout_guide-1.py +++ /dev/null @@ -1,12 +0,0 @@ -plt.rcParams['savefig.facecolor'] = "0.8" - -def example_plot(ax, fontsize=12): - ax.plot([1, 2]) - ax.locator_params(nbins=3) - ax.set_xlabel('x-label', fontsize=fontsize) - ax.set_ylabel('y-label', fontsize=fontsize) - ax.set_title('Title', fontsize=fontsize) - -plt.close('all') -fig, ax = plt.subplots() -example_plot(ax, fontsize=24) \ No newline at end of file diff --git a/users/tight_layout_guide-10.pdf b/users/tight_layout_guide-10.pdf deleted file mode 100644 index 3bbf39007e8..00000000000 Binary files a/users/tight_layout_guide-10.pdf and /dev/null differ diff --git a/users/tight_layout_guide-10.png b/users/tight_layout_guide-10.png deleted file mode 100644 index ea3a90633f0..00000000000 Binary files a/users/tight_layout_guide-10.png and /dev/null differ diff --git a/users/tight_layout_guide-10.py b/users/tight_layout_guide-10.py deleted file mode 100644 index c65e6b0721a..00000000000 --- a/users/tight_layout_guide-10.py +++ /dev/null @@ -1 +0,0 @@ -gs1.tight_layout(fig, rect=[0, 0, 0.5, 1]) \ No newline at end of file diff --git a/users/tight_layout_guide-11.pdf b/users/tight_layout_guide-11.pdf deleted file mode 100644 index e70f57fff5f..00000000000 Binary files a/users/tight_layout_guide-11.pdf and /dev/null differ diff --git a/users/tight_layout_guide-11.png b/users/tight_layout_guide-11.png deleted file mode 100644 index 7186e59216a..00000000000 Binary files a/users/tight_layout_guide-11.png and /dev/null differ diff --git a/users/tight_layout_guide-11.py b/users/tight_layout_guide-11.py deleted file mode 100644 index 5fdbaa30fa5..00000000000 --- a/users/tight_layout_guide-11.py +++ /dev/null @@ -1,11 +0,0 @@ -gs2 = gridspec.GridSpec(3, 1) - -for ss in gs2: - ax = fig.add_subplot(ss) - example_plot(ax) - ax.set_title("") - ax.set_xlabel("") - -ax.set_xlabel("x-label", fontsize=12) - -gs2.tight_layout(fig, rect=[0.5, 0, 1, 1], h_pad=0.5) \ No newline at end of file diff --git a/users/tight_layout_guide-12.pdf b/users/tight_layout_guide-12.pdf deleted file mode 100644 index 355298586de..00000000000 Binary files a/users/tight_layout_guide-12.pdf and /dev/null differ diff --git a/users/tight_layout_guide-12.png b/users/tight_layout_guide-12.png deleted file mode 100644 index 7a12aa51fd2..00000000000 Binary files a/users/tight_layout_guide-12.png and /dev/null differ diff --git a/users/tight_layout_guide-12.py b/users/tight_layout_guide-12.py deleted file mode 100644 index e00f0548848..00000000000 --- a/users/tight_layout_guide-12.py +++ /dev/null @@ -1,8 +0,0 @@ -top = min(gs1.top, gs2.top) -bottom = max(gs1.bottom, gs2.bottom) - -gs1.tight_layout(fig, rect=[None, 0 + (bottom-gs1.bottom), - 0.5, 1 - (gs1.top-top)]) -gs2.tight_layout(fig, rect=[0.5, 0 + (bottom-gs2.bottom), - None, 1 - (gs2.top-top)], - h_pad=0.5) \ No newline at end of file diff --git a/users/tight_layout_guide-13.pdf b/users/tight_layout_guide-13.pdf deleted file mode 100644 index 35b6cfd326d..00000000000 Binary files a/users/tight_layout_guide-13.pdf and /dev/null differ diff --git a/users/tight_layout_guide-13.png b/users/tight_layout_guide-13.png deleted file mode 100644 index 1dd762b0c96..00000000000 Binary files a/users/tight_layout_guide-13.png and /dev/null differ diff --git a/users/tight_layout_guide-13.py b/users/tight_layout_guide-13.py deleted file mode 100644 index 53b0c379378..00000000000 --- a/users/tight_layout_guide-13.py +++ /dev/null @@ -1,13 +0,0 @@ -plt.close('all') -fig = plt.figure() - -from mpl_toolkits.axes_grid1 import Grid -grid = Grid(fig, rect=111, nrows_ncols=(2,2), - axes_pad=0.25, label_mode='L', - ) - -for ax in grid: - example_plot(ax) - ax.title.set_visible(False) - -plt.tight_layout() \ No newline at end of file diff --git a/users/tight_layout_guide-14.pdf b/users/tight_layout_guide-14.pdf deleted file mode 100644 index da478c7b33f..00000000000 Binary files a/users/tight_layout_guide-14.pdf and /dev/null differ diff --git a/users/tight_layout_guide-14.png b/users/tight_layout_guide-14.png deleted file mode 100644 index def846642d9..00000000000 Binary files a/users/tight_layout_guide-14.png and /dev/null differ diff --git a/users/tight_layout_guide-14.py b/users/tight_layout_guide-14.py deleted file mode 100644 index 3e61875f616..00000000000 --- a/users/tight_layout_guide-14.py +++ /dev/null @@ -1,8 +0,0 @@ -plt.close('all') -arr = np.arange(100).reshape((10,10)) -fig = plt.figure(figsize=(4, 4)) -im = plt.imshow(arr, interpolation="none") - -plt.colorbar(im, use_gridspec=True) - -plt.tight_layout() \ No newline at end of file diff --git a/users/tight_layout_guide-15.pdf b/users/tight_layout_guide-15.pdf deleted file mode 100644 index af8e6aa7a3e..00000000000 Binary files a/users/tight_layout_guide-15.pdf and /dev/null differ diff --git a/users/tight_layout_guide-15.png b/users/tight_layout_guide-15.png deleted file mode 100644 index 9b5041e5a80..00000000000 Binary files a/users/tight_layout_guide-15.png and /dev/null differ diff --git a/users/tight_layout_guide-15.py b/users/tight_layout_guide-15.py deleted file mode 100644 index 312c19be70e..00000000000 --- a/users/tight_layout_guide-15.py +++ /dev/null @@ -1,11 +0,0 @@ -plt.close('all') -arr = np.arange(100).reshape((10,10)) -fig = plt.figure(figsize=(4, 4)) -im = plt.imshow(arr, interpolation="none") - -from mpl_toolkits.axes_grid1 import make_axes_locatable -divider = make_axes_locatable(plt.gca()) -cax = divider.append_axes("right", "5%", pad="3%") -plt.colorbar(im, cax=cax) - -plt.tight_layout() \ No newline at end of file diff --git a/users/tight_layout_guide-2.pdf b/users/tight_layout_guide-2.pdf deleted file mode 100644 index aef3e1224ad..00000000000 Binary files a/users/tight_layout_guide-2.pdf and /dev/null differ diff --git a/users/tight_layout_guide-2.png b/users/tight_layout_guide-2.png deleted file mode 100644 index a4ffa74293f..00000000000 Binary files a/users/tight_layout_guide-2.png and /dev/null differ diff --git a/users/tight_layout_guide-2.py b/users/tight_layout_guide-2.py deleted file mode 100644 index b9336abc5d7..00000000000 --- a/users/tight_layout_guide-2.py +++ /dev/null @@ -1 +0,0 @@ -plt.tight_layout() \ No newline at end of file diff --git a/users/tight_layout_guide-3.pdf b/users/tight_layout_guide-3.pdf deleted file mode 100644 index b1dce9cb42b..00000000000 Binary files a/users/tight_layout_guide-3.pdf and /dev/null differ diff --git a/users/tight_layout_guide-3.png b/users/tight_layout_guide-3.png deleted file mode 100644 index 3df63d7f680..00000000000 Binary files a/users/tight_layout_guide-3.png and /dev/null differ diff --git a/users/tight_layout_guide-3.py b/users/tight_layout_guide-3.py deleted file mode 100644 index e4d29d1ec92..00000000000 --- a/users/tight_layout_guide-3.py +++ /dev/null @@ -1,6 +0,0 @@ -plt.close('all') -fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(nrows=2, ncols=2) -example_plot(ax1) -example_plot(ax2) -example_plot(ax3) -example_plot(ax4) \ No newline at end of file diff --git a/users/tight_layout_guide-4.pdf b/users/tight_layout_guide-4.pdf deleted file mode 100644 index 88c065a6e05..00000000000 Binary files a/users/tight_layout_guide-4.pdf and /dev/null differ diff --git a/users/tight_layout_guide-4.png b/users/tight_layout_guide-4.png deleted file mode 100644 index eabb6e07593..00000000000 Binary files a/users/tight_layout_guide-4.png and /dev/null differ diff --git a/users/tight_layout_guide-4.py b/users/tight_layout_guide-4.py deleted file mode 100644 index b9336abc5d7..00000000000 --- a/users/tight_layout_guide-4.py +++ /dev/null @@ -1 +0,0 @@ -plt.tight_layout() \ No newline at end of file diff --git a/users/tight_layout_guide-5.pdf b/users/tight_layout_guide-5.pdf deleted file mode 100644 index 93d804d821a..00000000000 Binary files a/users/tight_layout_guide-5.pdf and /dev/null differ diff --git a/users/tight_layout_guide-5.png b/users/tight_layout_guide-5.png deleted file mode 100644 index 3b338623eb9..00000000000 Binary files a/users/tight_layout_guide-5.png and /dev/null differ diff --git a/users/tight_layout_guide-5.py b/users/tight_layout_guide-5.py deleted file mode 100644 index 526e1b8ee0a..00000000000 --- a/users/tight_layout_guide-5.py +++ /dev/null @@ -1 +0,0 @@ -plt.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0) \ No newline at end of file diff --git a/users/tight_layout_guide-6.pdf b/users/tight_layout_guide-6.pdf deleted file mode 100644 index 9d5f3bc3fb4..00000000000 Binary files a/users/tight_layout_guide-6.pdf and /dev/null differ diff --git a/users/tight_layout_guide-6.png b/users/tight_layout_guide-6.png deleted file mode 100644 index 821e1937aec..00000000000 Binary files a/users/tight_layout_guide-6.png and /dev/null differ diff --git a/users/tight_layout_guide-6.py b/users/tight_layout_guide-6.py deleted file mode 100644 index e48db10b4f4..00000000000 --- a/users/tight_layout_guide-6.py +++ /dev/null @@ -1,12 +0,0 @@ -plt.close('all') -fig = plt.figure() - -ax1 = plt.subplot(221) -ax2 = plt.subplot(223) -ax3 = plt.subplot(122) - -example_plot(ax1) -example_plot(ax2) -example_plot(ax3) - -plt.tight_layout() \ No newline at end of file diff --git a/users/tight_layout_guide-7.pdf b/users/tight_layout_guide-7.pdf deleted file mode 100644 index 81d3b757a16..00000000000 Binary files a/users/tight_layout_guide-7.pdf and /dev/null differ diff --git a/users/tight_layout_guide-7.png b/users/tight_layout_guide-7.png deleted file mode 100644 index 92ee03edd8e..00000000000 Binary files a/users/tight_layout_guide-7.png and /dev/null differ diff --git a/users/tight_layout_guide-7.py b/users/tight_layout_guide-7.py deleted file mode 100644 index 05bbc6c0dcd..00000000000 --- a/users/tight_layout_guide-7.py +++ /dev/null @@ -1,14 +0,0 @@ -plt.close('all') -fig = plt.figure() - -ax1 = plt.subplot2grid((3, 3), (0, 0)) -ax2 = plt.subplot2grid((3, 3), (0, 1), colspan=2) -ax3 = plt.subplot2grid((3, 3), (1, 0), colspan=2, rowspan=2) -ax4 = plt.subplot2grid((3, 3), (1, 2), rowspan=2) - -example_plot(ax1) -example_plot(ax2) -example_plot(ax3) -example_plot(ax4) - -plt.tight_layout() \ No newline at end of file diff --git a/users/tight_layout_guide-8.pdf b/users/tight_layout_guide-8.pdf deleted file mode 100644 index a2502af0c95..00000000000 Binary files a/users/tight_layout_guide-8.pdf and /dev/null differ diff --git a/users/tight_layout_guide-8.png b/users/tight_layout_guide-8.png deleted file mode 100644 index 72568c6a9f0..00000000000 Binary files a/users/tight_layout_guide-8.png and /dev/null differ diff --git a/users/tight_layout_guide-8.py b/users/tight_layout_guide-8.py deleted file mode 100644 index 19183e5764b..00000000000 --- a/users/tight_layout_guide-8.py +++ /dev/null @@ -1,9 +0,0 @@ -arr = np.arange(100).reshape((10,10)) - -plt.close('all') -fig = plt.figure(figsize=(5,4)) - -ax = plt.subplot(111) -im = ax.imshow(arr, interpolation="none") - -plt.tight_layout() \ No newline at end of file diff --git a/users/tight_layout_guide-9.pdf b/users/tight_layout_guide-9.pdf deleted file mode 100644 index 3e73e46f069..00000000000 Binary files a/users/tight_layout_guide-9.pdf and /dev/null differ diff --git a/users/tight_layout_guide-9.png b/users/tight_layout_guide-9.png deleted file mode 100644 index 4edb1d8fee1..00000000000 Binary files a/users/tight_layout_guide-9.png and /dev/null differ diff --git a/users/tight_layout_guide-9.py b/users/tight_layout_guide-9.py deleted file mode 100644 index 09176a1cb6f..00000000000 --- a/users/tight_layout_guide-9.py +++ /dev/null @@ -1,13 +0,0 @@ -plt.close('all') -fig = plt.figure() - -import matplotlib.gridspec as gridspec - -gs1 = gridspec.GridSpec(2, 1) -ax1 = fig.add_subplot(gs1[0]) -ax2 = fig.add_subplot(gs1[1]) - -example_plot(ax1) -example_plot(ax2) - -gs1.tight_layout(fig) \ No newline at end of file diff --git a/users/tight_layout_guide.html b/users/tight_layout_guide.html deleted file mode 100644 index 57b627cd310..00000000000 --- a/users/tight_layout_guide.html +++ /dev/null @@ -1,627 +0,0 @@ - - - - - - - - Tight Layout guide — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -

    Table Of Contents

    - - -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    Tight Layout guide

    -

    tight_layout automatically adjusts subplot params so that the -subplot(s) fits in to the figure area. This is an experimental -feature and may not work for some cases. It only checks the extents -of ticklabels, axis labels, and titles.

    -
    -

    Simple Example

    -

    In matplotlib, the location of axes (including subplots) are specified in -normalized figure coordinates. It can happen that your axis labels or -titles (or sometimes even ticklabels) go outside the figure area, and are thus -clipped.

    -
    plt.rcParams['savefig.facecolor'] = "0.8"
    -
    -def example_plot(ax, fontsize=12):
    -     ax.plot([1, 2])
    -     ax.locator_params(nbins=3)
    -     ax.set_xlabel('x-label', fontsize=fontsize)
    -     ax.set_ylabel('y-label', fontsize=fontsize)
    -     ax.set_title('Title', fontsize=fontsize)
    -
    -plt.close('all')
    -fig, ax = plt.subplots()
    -example_plot(ax, fontsize=24)
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/tight_layout_guide-1.png -
    -

    To prevent this, the location of axes needs to be adjusted. For -subplots, this can be done by adjusting the subplot params -(Move the edge of an axes to make room for tick labels). Matplotlib v1.1 introduces a new -command tight_layout() that does this -automatically for you.

    -
    plt.tight_layout()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/tight_layout_guide-2.png -
    -

    When you have multiple subplots, often you see labels of different -axes overlapping each other.

    -
    plt.close('all')
    -fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(nrows=2, ncols=2)
    -example_plot(ax1)
    -example_plot(ax2)
    -example_plot(ax3)
    -example_plot(ax4)
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/tight_layout_guide-3.png -
    -

    tight_layout() will also adjust spacing between -subplots to minimize the overlaps.

    -
    plt.tight_layout()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/tight_layout_guide-4.png -
    -

    tight_layout() can take keyword arguments of -pad, w_pad and h_pad. These control the extra padding around the -figure border and between subplots. The pads are specified in fraction -of fontsize.

    -
    plt.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/tight_layout_guide-5.png -
    -

    tight_layout() will work even if the sizes of -subplots are different as far as their grid specification is -compatible. In the example below, ax1 and ax2 are subplots of a 2x2 -grid, while ax3 is of a 1x2 grid.

    -
    plt.close('all')
    -fig = plt.figure()
    -
    -ax1 = plt.subplot(221)
    -ax2 = plt.subplot(223)
    -ax3 = plt.subplot(122)
    -
    -example_plot(ax1)
    -example_plot(ax2)
    -example_plot(ax3)
    -
    -plt.tight_layout()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/tight_layout_guide-6.png -
    -

    It works with subplots created with -subplot2grid(). In general, subplots created -from the gridspec (Customizing Location of Subplot Using GridSpec) will work.

    -
    plt.close('all')
    -fig = plt.figure()
    -
    -ax1 = plt.subplot2grid((3, 3), (0, 0))
    -ax2 = plt.subplot2grid((3, 3), (0, 1), colspan=2)
    -ax3 = plt.subplot2grid((3, 3), (1, 0), colspan=2, rowspan=2)
    -ax4 = plt.subplot2grid((3, 3), (1, 2), rowspan=2)
    -
    -example_plot(ax1)
    -example_plot(ax2)
    -example_plot(ax3)
    -example_plot(ax4)
    -
    -plt.tight_layout()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/tight_layout_guide-7.png -
    -

    Although not thoroughly tested, it seems to work for subplots with -aspect != “auto” (e.g., axes with images).

    -
    arr = np.arange(100).reshape((10,10))
    -
    -plt.close('all')
    -fig = plt.figure(figsize=(5,4))
    -
    -ax = plt.subplot(111)
    -im = ax.imshow(arr, interpolation="none")
    -
    -plt.tight_layout()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/tight_layout_guide-8.png -
    -
    -

    Caveats

    -
    -
      -
    • tight_layout() only considers ticklabels, axis -labels, and titles. Thus, other artists may be clipped and also may -overlap.
    • -
    • It assumes that the extra space needed for ticklabels, axis labels, -and titles is independent of original location of axes. This is -often true, but there are rare cases where it is not.
    • -
    • pad=0 clips some of the texts by a few pixels. This may be a bug or -a limitation of the current algorithm and it is not clear why it -happens. Meanwhile, use of pad at least larger than 0.3 is -recommended.
    • -
    -
    -
    -
    -

    Use with GridSpec

    -

    GridSpec has its own tight_layout() method -(the pyplot api tight_layout() also works).

    -
    plt.close('all')
    -fig = plt.figure()
    -
    -import matplotlib.gridspec as gridspec
    -
    -gs1 = gridspec.GridSpec(2, 1)
    -ax1 = fig.add_subplot(gs1[0])
    -ax2 = fig.add_subplot(gs1[1])
    -
    -example_plot(ax1)
    -example_plot(ax2)
    -
    -gs1.tight_layout(fig)
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/tight_layout_guide-9.png -
    -

    You may provide an optional rect parameter, which specifies the bounding box -that the subplots will be fit inside. The coordinates must be in normalized -figure coordinates and the default is (0, 0, 1, 1).

    -
    gs1.tight_layout(fig, rect=[0, 0, 0.5, 1])
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/tight_layout_guide-10.png -
    -

    For example, this can be used for a figure with multiple gridspecs.

    -
    gs2 = gridspec.GridSpec(3, 1)
    -
    -for ss in gs2:
    -    ax = fig.add_subplot(ss)
    -    example_plot(ax)
    -    ax.set_title("")
    -    ax.set_xlabel("")
    -
    -ax.set_xlabel("x-label", fontsize=12)
    -
    -gs2.tight_layout(fig, rect=[0.5, 0, 1, 1], h_pad=0.5)
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/tight_layout_guide-11.png -
    -

    We may try to match the top and bottom of two grids

    -
    top = min(gs1.top, gs2.top)
    -bottom = max(gs1.bottom, gs2.bottom)
    -
    -gs1.update(top=top, bottom=bottom)
    -gs2.update(top=top, bottom=bottom)
    -
    -
    -

    While this should be mostly good enough, adjusting top and bottom -may require adjustment of hspace also. To update hspace & vspace, we -call tight_layout() again with updated -rect argument. Note that the rect argument specifies the area including the -ticklabels, etc. Thus, we will increase the bottom (which is 0 for the normal -case) by the difference between the bottom from above and the bottom of each -gridspec. Same thing for the top.

    -
    top = min(gs1.top, gs2.top)
    -bottom = max(gs1.bottom, gs2.bottom)
    -
    -gs1.tight_layout(fig, rect=[None, 0 + (bottom-gs1.bottom),
    -                            0.5, 1 - (gs1.top-top)])
    -gs2.tight_layout(fig, rect=[0.5, 0 + (bottom-gs2.bottom),
    -                            None, 1 - (gs2.top-top)],
    -                 h_pad=0.5)
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/tight_layout_guide-12.png -
    -
    -
    -

    Use with AxesGrid1

    -

    While limited, the axes_grid1 toolkit is also supported.

    -
    plt.close('all')
    -fig = plt.figure()
    -
    -from mpl_toolkits.axes_grid1 import Grid
    -grid = Grid(fig, rect=111, nrows_ncols=(2,2),
    -            axes_pad=0.25, label_mode='L',
    -            )
    -
    -for ax in grid:
    -    example_plot(ax)
    -    ax.title.set_visible(False)
    -
    -plt.tight_layout()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/tight_layout_guide-13.png -
    -
    -
    -

    Colorbar

    -

    If you create a colorbar with the colorbar() -command, the created colorbar is an instance of Axes, not Subplot, so -tight_layout does not work. With Matplotlib v1.1, you may create a -colorbar as a subplot using the gridspec.

    -
    plt.close('all')
    -arr = np.arange(100).reshape((10,10))
    -fig = plt.figure(figsize=(4, 4))
    -im = plt.imshow(arr, interpolation="none")
    -
    -plt.colorbar(im, use_gridspec=True)
    -
    -plt.tight_layout()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/tight_layout_guide-14.png -
    -

    Another option is to use AxesGrid1 toolkit to -explicitly create an axes for colorbar.

    -
    plt.close('all')
    -arr = np.arange(100).reshape((10,10))
    -fig = plt.figure(figsize=(4, 4))
    -im = plt.imshow(arr, interpolation="none")
    -
    -from mpl_toolkits.axes_grid1 import make_axes_locatable
    -divider = make_axes_locatable(plt.gca())
    -cax = divider.append_axes("right", "5%", pad="3%")
    -plt.colorbar(im, cax=cax)
    -
    -plt.tight_layout()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/tight_layout_guide-15.png -
    -
    -
    -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/users/transforms_tutorial-1.pdf b/users/transforms_tutorial-1.pdf deleted file mode 100644 index 1b9debe915b..00000000000 Binary files a/users/transforms_tutorial-1.pdf and /dev/null differ diff --git a/users/transforms_tutorial-1.png b/users/transforms_tutorial-1.png deleted file mode 100644 index 6b8963e7afa..00000000000 Binary files a/users/transforms_tutorial-1.png and /dev/null differ diff --git a/users/transforms_tutorial-1.py b/users/transforms_tutorial-1.py deleted file mode 100644 index d17653529b6..00000000000 --- a/users/transforms_tutorial-1.py +++ /dev/null @@ -1,13 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -x = np.arange(0, 10, 0.005) -y = np.exp(-x/2.) * np.sin(2*np.pi*x) - -fig = plt.figure() -ax = fig.add_subplot(111) -ax.plot(x, y) -ax.set_xlim(0, 10) -ax.set_ylim(-1, 1) - -plt.show() \ No newline at end of file diff --git a/users/transforms_tutorial-2.pdf b/users/transforms_tutorial-2.pdf deleted file mode 100644 index 2dbab84abc2..00000000000 Binary files a/users/transforms_tutorial-2.pdf and /dev/null differ diff --git a/users/transforms_tutorial-2.png b/users/transforms_tutorial-2.png deleted file mode 100644 index 2277bbb54be..00000000000 Binary files a/users/transforms_tutorial-2.png and /dev/null differ diff --git a/users/transforms_tutorial-2.py b/users/transforms_tutorial-2.py deleted file mode 100644 index bcf56020894..00000000000 --- a/users/transforms_tutorial-2.py +++ /dev/null @@ -1,10 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -fig = plt.figure() -for i, label in enumerate(('A', 'B', 'C', 'D')): - ax = fig.add_subplot(2,2,i+1) - ax.text(0.05, 0.95, label, transform=ax.transAxes, - fontsize=16, fontweight='bold', va='top') - -plt.show() \ No newline at end of file diff --git a/users/transforms_tutorial-3.pdf b/users/transforms_tutorial-3.pdf deleted file mode 100644 index d250c07767f..00000000000 Binary files a/users/transforms_tutorial-3.pdf and /dev/null differ diff --git a/users/transforms_tutorial-3.png b/users/transforms_tutorial-3.png deleted file mode 100644 index 0066a89eb67..00000000000 Binary files a/users/transforms_tutorial-3.png and /dev/null differ diff --git a/users/transforms_tutorial-3.py b/users/transforms_tutorial-3.py deleted file mode 100644 index 18b742ac158..00000000000 --- a/users/transforms_tutorial-3.py +++ /dev/null @@ -1,13 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.patches as patches -fig = plt.figure() -ax = fig.add_subplot(111) -x, y = 10*np.random.rand(2, 1000) -ax.plot(x, y, 'go') # plot some data in data coordinates - -circ = patches.Circle((0.5, 0.5), 0.25, transform=ax.transAxes, - facecolor='yellow', alpha=0.5) -ax.add_patch(circ) - -plt.show() \ No newline at end of file diff --git a/users/transforms_tutorial-4.pdf b/users/transforms_tutorial-4.pdf deleted file mode 100644 index f980682b309..00000000000 Binary files a/users/transforms_tutorial-4.pdf and /dev/null differ diff --git a/users/transforms_tutorial-4.png b/users/transforms_tutorial-4.png deleted file mode 100644 index f52ec0e20f5..00000000000 Binary files a/users/transforms_tutorial-4.png and /dev/null differ diff --git a/users/transforms_tutorial-4.py b/users/transforms_tutorial-4.py deleted file mode 100644 index f8a5e47197b..00000000000 --- a/users/transforms_tutorial-4.py +++ /dev/null @@ -1,28 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.patches as patches -import matplotlib.transforms as transforms - -fig = plt.figure() -ax = fig.add_subplot(111) - -x = np.random.randn(1000) - -ax.hist(x, 30) -ax.set_title(r'$\sigma=1 \/ \dots \/ \sigma=2$', fontsize=16) - -# the x coords of this transformation are data, and the -# y coord are axes -trans = transforms.blended_transform_factory( - ax.transData, ax.transAxes) - -# highlight the 1..2 stddev region with a span. -# We want x to be in data coordinates and y to -# span from 0..1 in axes coords -rect = patches.Rectangle((1,0), width=1, height=1, - transform=trans, color='yellow', - alpha=0.5) - -ax.add_patch(rect) - -plt.show() \ No newline at end of file diff --git a/users/transforms_tutorial-5.pdf b/users/transforms_tutorial-5.pdf deleted file mode 100644 index 64479dcce9e..00000000000 Binary files a/users/transforms_tutorial-5.pdf and /dev/null differ diff --git a/users/transforms_tutorial-5.png b/users/transforms_tutorial-5.png deleted file mode 100644 index a334b9e4b98..00000000000 Binary files a/users/transforms_tutorial-5.png and /dev/null differ diff --git a/users/transforms_tutorial-5.py b/users/transforms_tutorial-5.py deleted file mode 100644 index c1b0b52a1f4..00000000000 --- a/users/transforms_tutorial-5.py +++ /dev/null @@ -1,27 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.patches as patches -import matplotlib.transforms as transforms - -fig = plt.figure() -ax = fig.add_subplot(111) - -# make a simple sine wave -x = np.arange(0., 2., 0.01) -y = np.sin(2*np.pi*x) -line, = ax.plot(x, y, lw=3, color='blue') - -# shift the object over 2 points, and down 2 points -dx, dy = 2/72., -2/72. -offset = transforms.ScaledTranslation(dx, dy, - fig.dpi_scale_trans) -shadow_transform = ax.transData + offset - -# now plot the same data with our offset transform; -# use the zorder to make sure we are below the line -ax.plot(x, y, lw=3, color='gray', - transform=shadow_transform, - zorder=0.5*line.get_zorder()) - -ax.set_title('creating a shadow effect with an offset transform') -plt.show() \ No newline at end of file diff --git a/users/transforms_tutorial.html b/users/transforms_tutorial.html deleted file mode 100644 index dd2b0602f24..00000000000 --- a/users/transforms_tutorial.html +++ /dev/null @@ -1,773 +0,0 @@ - - - - - - - - Transformations Tutorial — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -

    Table Of Contents

    - -
    -

    Related Topics

    - -
    -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    Transformations Tutorial

    -

    Like any graphics packages, matplotlib is built on top of a -transformation framework to easily move between coordinate systems, -the userland data coordinate system, the axes coordinate system, -the figure coordinate system, and the display coordinate system. -In 95% of your plotting, you won’t need to think about this, as it -happens under the hood, but as you push the limits of custom figure -generation, it helps to have an understanding of these objects so you -can reuse the existing transformations matplotlib makes available to -you, or create your own (see matplotlib.transforms). The table -below summarizes the existing coordinate systems, the transformation -object you should use to work in that coordinate system, and the -description of that system. In the Transformation Object column, -ax is a Axes instance, and fig is a -Figure instance.

    - ----- - - - - - - - - - - - - - - - - - - - - - - - - -
    CoordinateTransformation ObjectDescription
    dataax.transDataThe userland data coordinate system, controlled by the xlim and ylim
    axesax.transAxesThe coordinate system of the Axes; (0,0) is -bottom left of the axes, and (1,1) is top right of the axes.
    figurefig.transFigureThe coordinate system of the Figure; (0,0) -is bottom left of the figure, and (1,1) is top right of the figure.
    displayNoneThis is the pixel coordinate system of the display; (0,0) is the bottom -left of the display, and (width, height) is the top right of the display in pixels. -Alternatively, the identity transform -(matplotlib.transforms.IdentityTransform()) may be used instead of None.
    -

    All of the transformation objects in the table above take inputs in -their coordinate system, and transform the input to the display -coordinate system. That is why the display coordinate system has -None for the Transformation Object column – it already is in -display coordinates. The transformations also know how to invert -themselves, to go from display back to the native coordinate system. -This is particularly useful when processing events from the user -interface, which typically occur in display space, and you want to -know where the mouse click or key-press occurred in your data -coordinate system.

    -
    -

    Data coordinates

    -

    Let’s start with the most commonly used coordinate, the data -coordinate system. Whenever you add data to the axes, matplotlib -updates the datalimits, most commonly updated with the -set_xlim() and -set_ylim() methods. For example, in the -figure below, the data limits stretch from 0 to 10 on the x-axis, and --1 to 1 on the y-axis.

    -
    import numpy as np
    -import matplotlib.pyplot as plt
    -
    -x = np.arange(0, 10, 0.005)
    -y = np.exp(-x/2.) * np.sin(2*np.pi*x)
    -
    -fig = plt.figure()
    -ax = fig.add_subplot(111)
    -ax.plot(x, y)
    -ax.set_xlim(0, 10)
    -ax.set_ylim(-1, 1)
    -
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/transforms_tutorial-1.png -
    -

    You can use the ax.transData instance to transform from your -data to your display coordinate system, either a single point or a -sequence of points as shown below:

    -
    In [14]: type(ax.transData)
    -Out[14]: <class 'matplotlib.transforms.CompositeGenericTransform'>
    -
    -In [15]: ax.transData.transform((5, 0))
    -Out[15]: array([ 335.175,  247.   ])
    -
    -In [16]: ax.transData.transform([(5, 0), (1,2)])
    -Out[16]:
    -array([[ 335.175,  247.   ],
    -       [ 132.435,  642.2  ]])
    -
    -
    -

    You can use the inverted() -method to create a transform which will take you from display to data -coordinates:

    -
    In [41]: inv = ax.transData.inverted()
    -
    -In [42]: type(inv)
    -Out[42]: <class 'matplotlib.transforms.CompositeGenericTransform'>
    -
    -In [43]: inv.transform((335.175,  247.))
    -Out[43]: array([ 5.,  0.])
    -
    -
    -

    If your are typing along with this tutorial, the exact values of the -display coordinates may differ if you have a different window size or -dpi setting. Likewise, in the figure below, the display labeled -points are probably not the same as in the ipython session because the -documentation figure size defaults are different.

    -

    (Source code, png, pdf)

    -
    -../_images/annotate_transform.png -
    -
    -

    Note

    -

    If you run the source code in the example above in a GUI backend, -you may also find that the two arrows for the data and display -annotations do not point to exactly the same point. This is because -the display point was computed before the figure was displayed, and -the GUI backend may slightly resize the figure when it is created. -The effect is more pronounced if you resize the figure yourself. -This is one good reason why you rarely want to work in display -space, but you can connect to the 'on_draw' -Event to update figure -coordinates on figure draws; see Event handling and picking.

    -
    -

    When you change the x or y limits of your axes, the data limits are -updated so the transformation yields a new display point. Note that -when we just change the ylim, only the y-display coordinate is -altered, and when we change the xlim too, both are altered. More on -this later when we talk about the -Bbox.

    -
    In [54]: ax.transData.transform((5, 0))
    -Out[54]: array([ 335.175,  247.   ])
    -
    -In [55]: ax.set_ylim(-1,2)
    -Out[55]: (-1, 2)
    -
    -In [56]: ax.transData.transform((5, 0))
    -Out[56]: array([ 335.175     ,  181.13333333])
    -
    -In [57]: ax.set_xlim(10,20)
    -Out[57]: (10, 20)
    -
    -In [58]: ax.transData.transform((5, 0))
    -Out[58]: array([-171.675     ,  181.13333333])
    -
    -
    -
    -
    -

    Axes coordinates

    -

    After the data coordinate system, axes is probably the second most -useful coordinate system. Here the point (0,0) is the bottom left of -your axes or subplot, (0.5, 0.5) is the center, and (1.0, 1.0) is the -top right. You can also refer to points outside the range, so (-0.1, -1.1) is to the left and above your axes. This coordinate system is -extremely useful when placing text in your axes, because you often -want a text bubble in a fixed, location, e.g., the upper left of the axes -pane, and have that location remain fixed when you pan or zoom. Here -is a simple example that creates four panels and labels them ‘A’, ‘B’, -‘C’, ‘D’ as you often see in journals.

    -
    import numpy as np
    -import matplotlib.pyplot as plt
    -
    -fig = plt.figure()
    -for i, label in enumerate(('A', 'B', 'C', 'D')):
    -    ax = fig.add_subplot(2,2,i+1)
    -    ax.text(0.05, 0.95, label, transform=ax.transAxes,
    -      fontsize=16, fontweight='bold', va='top')
    -
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/transforms_tutorial-2.png -
    -

    You can also make lines or patches in the axes coordinate system, but -this is less useful in my experience than using ax.transAxes for -placing text. Nonetheless, here is a silly example which plots some -random dots in data space, and overlays a semi-transparent -Circle centered in the middle of the axes -with a radius one quarter of the axes – if your axes does not -preserve aspect ratio (see set_aspect()), -this will look like an ellipse. Use the pan/zoom tool to move around, -or manually change the data xlim and ylim, and you will see the data -move, but the circle will remain fixed because it is not in data -coordinates and will always remain at the center of the axes.

    -
    import numpy as np
    -import matplotlib.pyplot as plt
    -import matplotlib.patches as patches
    -fig = plt.figure()
    -ax = fig.add_subplot(111)
    -x, y = 10*np.random.rand(2, 1000)
    -ax.plot(x, y, 'go')  # plot some data in data coordinates
    -
    -circ = patches.Circle((0.5, 0.5), 0.25, transform=ax.transAxes,
    -                      facecolor='yellow', alpha=0.5)
    -ax.add_patch(circ)
    -
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/transforms_tutorial-3.png -
    -
    -
    -

    Blended transformations

    -

    Drawing in blended coordinate spaces which mix axes with data -coordinates is extremely useful, for example to create a horizontal -span which highlights some region of the y-data but spans across the -x-axis regardless of the data limits, pan or zoom level, etc. In fact -these blended lines and spans are so useful, we have built in -functions to make them easy to plot (see -axhline(), -axvline(), -axhspan(), -axvspan()) but for didactic purposes we -will implement the horizontal span here using a blended -transformation. This trick only works for separable transformations, -like you see in normal Cartesian coordinate systems, but not on -inseparable transformations like the -PolarTransform.

    -
    import numpy as np
    -import matplotlib.pyplot as plt
    -import matplotlib.patches as patches
    -import matplotlib.transforms as transforms
    -
    -fig = plt.figure()
    -ax = fig.add_subplot(111)
    -
    -x = np.random.randn(1000)
    -
    -ax.hist(x, 30)
    -ax.set_title(r'$\sigma=1 \/ \dots \/ \sigma=2$', fontsize=16)
    -
    -# the x coords of this transformation are data, and the
    -# y coord are axes
    -trans = transforms.blended_transform_factory(
    -    ax.transData, ax.transAxes)
    -
    -# highlight the 1..2 stddev region with a span.
    -# We want x to be in data coordinates and y to
    -# span from 0..1 in axes coords
    -rect = patches.Rectangle((1,0), width=1, height=1,
    -                         transform=trans, color='yellow',
    -                         alpha=0.5)
    -
    -ax.add_patch(rect)
    -
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/transforms_tutorial-4.png -
    -
    -

    Note

    -

    The blended transformations where x is in data coords and y in axes -coordinates is so useful that we have helper methods to return the -versions mpl uses internally for drawing ticks, ticklabels, etc. -The methods are matplotlib.axes.Axes.get_xaxis_transform() and -matplotlib.axes.Axes.get_yaxis_transform(). So in the example -above, the call to -blended_transform_factory() can be -replaced by get_xaxis_transform:

    -
    trans = ax.get_xaxis_transform()
    -
    -
    -
    -
    -
    -

    Using offset transforms to create a shadow effect

    -

    One use of transformations is to create a new transformation that is -offset from another transformation, e.g., to place one object shifted a -bit relative to another object. Typically you want the shift to be in -some physical dimension, like points or inches rather than in data -coordinates, so that the shift effect is constant at different zoom -levels and dpi settings.

    -

    One use for an offset is to create a shadow effect, where you draw one -object identical to the first just to the right of it, and just below -it, adjusting the zorder to make sure the shadow is drawn first and -then the object it is shadowing above it. The transforms module has a -helper transformation -ScaledTranslation. It is -instantiated with:

    -
    trans = ScaledTranslation(xt, yt, scale_trans)
    -
    -
    -

    where xt and yt are the translation offsets, and scale_trans is -a transformation which scales xt and yt at transformation time -before applying the offsets. A typical use case is to use the figure -fig.dpi_scale_trans transformation for the scale_trans argument, -to first scale xt and yt specified in points to display space -before doing the final offset. The dpi and inches offset is a -common-enough use case that we have a special helper function to -create it in matplotlib.transforms.offset_copy(), which returns -a new transform with an added offset. But in the example below, we’ll -create the offset transform ourselves. Note the use of the plus -operator in:

    -
    offset = transforms.ScaledTranslation(dx, dy,
    -  fig.dpi_scale_trans)
    -shadow_transform = ax.transData + offset
    -
    -
    -

    showing that can chain transformations using the addition operator. -This code says: first apply the data transformation ax.transData -and then translate the data by dx and dy points. In typography, -a`point <https://en.wikipedia.org/wiki/Point_%28typography%29>`_ is -1/72 inches, and by specifying your offsets in points, your figure -will look the same regardless of the dpi resolution it is saved in.

    -
    import numpy as np
    -import matplotlib.pyplot as plt
    -import matplotlib.patches as patches
    -import matplotlib.transforms as transforms
    -
    -fig = plt.figure()
    -ax = fig.add_subplot(111)
    -
    -# make a simple sine wave
    -x = np.arange(0., 2., 0.01)
    -y = np.sin(2*np.pi*x)
    -line, = ax.plot(x, y, lw=3, color='blue')
    -
    -# shift the object over 2 points, and down 2 points
    -dx, dy = 2/72., -2/72.
    -offset = transforms.ScaledTranslation(dx, dy,
    -  fig.dpi_scale_trans)
    -shadow_transform = ax.transData + offset
    -
    -# now plot the same data with our offset transform;
    -# use the zorder to make sure we are below the line
    -ax.plot(x, y, lw=3, color='gray',
    -  transform=shadow_transform,
    -  zorder=0.5*line.get_zorder())
    -
    -ax.set_title('creating a shadow effect with an offset transform')
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/transforms_tutorial-5.png -
    -
    -
    -

    The transformation pipeline

    -

    The ax.transData transform we have been working with in this -tutorial is a composite of three different transformations that -comprise the transformation pipeline from data -> display -coordinates. Michael Droettboom implemented the transformations -framework, taking care to provide a clean API that segregated the -nonlinear projections and scales that happen in polar and logarithmic -plots, from the linear affine transformations that happen when you pan -and zoom. There is an efficiency here, because you can pan and zoom -in your axes which affects the affine transformation, but you may not -need to compute the potentially expensive nonlinear scales or -projections on simple navigation events. It is also possible to -multiply affine transformation matrices together, and then apply them -to coordinates in one step. This is not true of all possible -transformations.

    -

    Here is how the ax.transData instance is defined in the basic -separable axis Axes class:

    -
    self.transData = self.transScale + (self.transLimits + self.transAxes)
    -
    -
    -

    We’ve been introduced to the transAxes instance above in -Axes coordinates, which maps the (0,0), (1,1) corners of the -axes or subplot bounding box to display space, so let’s look at -these other two pieces.

    -

    self.transLimits is the transformation that takes you from -data to axes coordinates; i.e., it maps your view xlim and ylim -to the unit space of the axes (and transAxes then takes that unit -space to display space). We can see this in action here

    -
    In [80]: ax = subplot(111)
    -
    -In [81]: ax.set_xlim(0, 10)
    -Out[81]: (0, 10)
    -
    -In [82]: ax.set_ylim(-1,1)
    -Out[82]: (-1, 1)
    -
    -In [84]: ax.transLimits.transform((0,-1))
    -Out[84]: array([ 0.,  0.])
    -
    -In [85]: ax.transLimits.transform((10,-1))
    -Out[85]: array([ 1.,  0.])
    -
    -In [86]: ax.transLimits.transform((10,1))
    -Out[86]: array([ 1.,  1.])
    -
    -In [87]: ax.transLimits.transform((5,0))
    -Out[87]: array([ 0.5,  0.5])
    -
    -
    -

    and we can use this same inverted transformation to go from the unit -axes coordinates back to data coordinates.

    -
    In [90]: inv.transform((0.25, 0.25))
    -Out[90]: array([ 2.5, -0.5])
    -
    -
    -

    The final piece is the self.transScale attribute, which is -responsible for the optional non-linear scaling of the data, e.g., for -logarithmic axes. When an Axes is initially setup, this is just set to -the identity transform, since the basic matplotlib axes has linear -scale, but when you call a logarithmic scaling function like -semilogx() or explicitly set the scale to -logarithmic with set_xscale(), then the -ax.transScale attribute is set to handle the nonlinear projection. -The scales transforms are properties of the respective xaxis and -yaxis Axis instances. For example, when -you call ax.set_xscale('log'), the xaxis updates its scale to a -matplotlib.scale.LogScale instance.

    -

    For non-separable axes the PolarAxes, there is one more piece to -consider, the projection transformation. The transData -matplotlib.projections.polar.PolarAxes is similar to that for -the typical separable matplotlib Axes, with one additional piece -transProjection:

    -
    self.transData = self.transScale + self.transProjection + \
    -    (self.transProjectionAffine + self.transAxes)
    -
    -
    -

    transProjection handles the projection from the space, -e.g., latitude and longitude for map data, or radius and theta for polar -data, to a separable Cartesian coordinate system. There are several -projection examples in the matplotlib.projections package, and the -best way to learn more is to open the source for those packages and -see how to make your own, since matplotlib supports extensible axes -and projections. Michael Droettboom has provided a nice tutorial -example of creating a hammer projection axes; see -api example code: custom_projection_example.py.

    -
    -
    - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/users/tutorials.html b/users/tutorials.html deleted file mode 100644 index 829331eacab..00000000000 --- a/users/tutorials.html +++ /dev/null @@ -1,416 +0,0 @@ - - - - - - - - Tutorials — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -

    Table Of Contents

    - -
    -

    Related Topics

    - -
    -
    -

    This Page

    - -
    - - -
    -
    - - - - - - -
    - - - - - - -
    -
    -
    -
    -
    -
    - - -
    - \ No newline at end of file diff --git a/users/usetex.html b/users/usetex.html deleted file mode 100644 index 10ae37179c3..00000000000 --- a/users/usetex.html +++ /dev/null @@ -1,517 +0,0 @@ - - - - - - - - Text rendering With LaTeX — Matplotlib 2.0.2 documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -matplotlib -
    - - - - - - - -
    -
    - - - - -
    - -Travis-CI: - - -
    -

    Table Of Contents

    - - -
    -

    This Page

    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -

    Text rendering With LaTeX

    -

    Matplotlib has the option to use LaTeX to manage all text layout. This -option is available with the following backends:

    -
      -
    • Agg
    • -
    • PS
    • -
    • PDF
    • -
    -

    The LaTeX option is activated by setting text.usetex : True in -your rc settings. Text handling with matplotlib’s LaTeX support is -slower than matplotlib’s very capable mathtext, but is more flexible, since different LaTeX -packages (font packages, math packages, etc.) can be used. The -results can be striking, especially when you take care to use the same -fonts in your figures as in the main document.

    -

    Matplotlib’s LaTeX support requires a working LaTeX installation, dvipng -(which may be included with your LaTeX installation), and Ghostscript -(GPL Ghostscript 8.60 or later is recommended). The executables for these -external dependencies must all be located on your PATH.

    -

    There are a couple of options to mention, which can be changed using rc -settings. Here is an example matplotlibrc file:

    -
    font.family        : serif
    -font.serif         : Times, Palatino, New Century Schoolbook, Bookman, Computer Modern Roman
    -font.sans-serif    : Helvetica, Avant Garde, Computer Modern Sans serif
    -font.cursive       : Zapf Chancery
    -font.monospace     : Courier, Computer Modern Typewriter
    -
    -text.usetex        : true
    -
    -
    -

    The first valid font in each family is the one that will be loaded. If the -fonts are not specified, the Computer Modern fonts are used by default. All of -the other fonts are Adobe fonts. Times and Palatino each have their own -accompanying math fonts, while the other Adobe serif fonts make use of the -Computer Modern math fonts. See the PSNFSS documentation for more details.

    -

    To use LaTeX and select Helvetica as the default font, without editing -matplotlibrc use:

    -
    from matplotlib import rc
    -rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
    -## for Palatino and other serif fonts use:
    -#rc('font',**{'family':'serif','serif':['Palatino']})
    -rc('text', usetex=True)
    -
    -
    -

    Here is the standard example, tex_demo.py:

    -
    """
    -Demo of TeX rendering.
    -
    -You can use TeX to render all of your matplotlib text if the rc
    -parameter text.usetex is set.  This works currently on the agg and ps
    -backends, and requires that you have tex and the other dependencies
    -described at http://matplotlib.org/users/usetex.html
    -properly installed on your system.  The first time you run a script
    -you will see a lot of output from tex and associated tools.  The next
    -time, the run may be silent, as a lot of the information is cached in
    -~/.tex.cache
    -
    -"""
    -import numpy as np
    -import matplotlib.pyplot as plt
    -
    -
    -# Example data
    -t = np.arange(0.0, 1.0 + 0.01, 0.01)
    -s = np.cos(4 * np.pi * t) + 2
    -
    -plt.rc('text', usetex=True)
    -plt.rc('font', family='serif')
    -plt.plot(t, s)
    -
    -plt.xlabel(r'\textbf{time} (s)')
    -plt.ylabel(r'\textit{voltage} (mV)',fontsize=16)
    -plt.title(r"\TeX\ is Number "
    -          r"$\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!",
    -          fontsize=16, color='gray')
    -# Make room for the ridiculously large title.
    -plt.subplots_adjust(top=0.8)
    -
    -plt.savefig('tex_demo')
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/tex_demo1.png -
    -

    Note that display math mode ($$ e=mc^2 $$) is not supported, but adding the -command \displaystyle, as in tex_demo.py, will produce the same -results.

    -
    -

    Note

    -

    Certain characters require special escaping in TeX, such as:

    -
    # $ % & ~ _ ^ \ { } \( \) \[ \]
    -
    -
    -

    Therefore, these characters will behave differently depending on -the rcParam text.usetex flag.

    -
    -
    -

    usetex with unicode

    -

    It is also possible to use unicode strings with the LaTeX text manager, here is -an example taken from tex_unicode_demo.py:

    -
    # -*- coding: utf-8 -*-
    -"""
    -This demo is tex_demo.py modified to have unicode. See that file for
    -more information.
    -"""
    -
    -from __future__ import unicode_literals
    -import numpy as np
    -import matplotlib
    -matplotlib.rcParams['text.usetex'] = True
    -matplotlib.rcParams['text.latex.unicode'] = True
    -import matplotlib.pyplot as plt
    -
    -plt.figure(1, figsize=(6, 4))
    -ax = plt.axes([0.1, 0.1, 0.8, 0.7])
    -t = np.arange(0.0, 1.0 + 0.01, 0.01)
    -s = np.cos(2*2*np.pi*t) + 2
    -plt.plot(t, s)
    -
    -plt.xlabel(r'\textbf{time (s)}')
    -plt.ylabel('\\textit{Velocity (\u00B0/sec)}', fontsize=16)
    -plt.title(r'\TeX\ is Number $\displaystyle\sum_{n=1}^\infty'
    -          r'\frac{-e^{i\pi}}{2^n}$!', fontsize=16, color='r')
    -plt.grid(True)
    -plt.show()
    -
    -
    -

    (Source code, png, pdf)

    -
    -../_images/tex_unicode_demo1.png -
    -
    -
    -

    Postscript options

    -

    In order to produce encapsulated postscript files that can be embedded in a new -LaTeX document, the default behavior of matplotlib is to distill the output, -which removes some postscript operators used by LaTeX that are illegal in an -eps file. This step produces results which may be unacceptable to some users, -because the text is coarsely rasterized and converted to bitmaps, which are not -scalable like standard postscript, and the text is not searchable. One -workaround is to to set ps.distiller.res to a higher value (perhaps 6000) -in your rc settings, which will produce larger files but may look better and -scale reasonably. A better workaround, which requires Poppler or Xpdf, can be -activated by changing the ps.usedistiller rc setting to xpdf. This -alternative produces postscript without rasterizing text, so it scales -properly, can be edited in Adobe Illustrator, and searched text in pdf -documents.

    -
    -
    -

    Possible hangups

    -
      -
    • On Windows, the PATH environment variable may need to be modified -to include the directories containing the latex, dvipng and ghostscript -executables. See Environment Variables and -Setting environment variables in windows for details.
    • -
    • Using MiKTeX with Computer Modern fonts, if you get odd *Agg and PNG -results, go to MiKTeX/Options and update your format files
    • -
    • The fonts look terrible on screen. You are probably running Mac OS, and there -is some funny business with older versions of dvipng on the mac. Set -text.dvipnghack : True in your matplotlibrc file.
    • -
    • On Ubuntu and Gentoo, the base texlive install does not ship with -the type1cm package. You may need to install some of the extra -packages to get all the goodies that come bundled with other latex -distributions.
    • -
    • Some progress has been made so matplotlib uses the dvi files -directly for text layout. This allows latex to be used for text -layout with the pdf and svg backends, as well as the *Agg and PS -backends. In the future, a latex installation may be the only -external dependency.
    • -
    -
    -
    -

    Troubleshooting

    -
      -
    • Try deleting your .matplotlib/tex.cache directory. If you don’t know -where to find .matplotlib, see matplotlib configuration and cache directory locations.
    • -
    • Make sure LaTeX, dvipng and ghostscript are each working and on your -PATH.
    • -
    • Make sure what you are trying to do is possible in a LaTeX document, -that your LaTeX syntax is valid and that you are using raw strings -if necessary to avoid unintended escape sequences.
    • -
    • Most problems reported on the mailing list have been cleared up by -upgrading Ghostscript. If possible, please try upgrading to the -latest release before reporting problems to the list.
    • -
    • The text.latex.preamble rc setting is not officially supported. This -option provides lots of flexibility, and lots of ways to cause -problems. Please disable this option before reporting problems to -the mailing list.
    • -
    • If you still need help, please see Getting help
    • -
    -
    -
    - - -
    -
    -
    - -
    -
    - - - - - - \ No newline at end of file