[yt-svn] commit/yt: 2 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Mon Sep 23 06:43:24 PDT 2013
2 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/ec2ca5ad3fe3/
Changeset: ec2ca5ad3fe3
Branch: yt
User: ngoldbaum
Date: 2013-09-23 05:13:22
Summary: Removing an errant print statement and moving get_multi_plot into base_plot_types.py.
Affected #: 3 files
diff -r 245ae278ae8c49fbc179a025d4ac7c9247ff26c3 -r ec2ca5ad3fe3a124f742085a720912f4577e844a yt/visualization/api.py
--- a/yt/visualization/api.py
+++ b/yt/visualization/api.py
@@ -20,8 +20,7 @@
from plot_collection import \
PlotCollection, \
PlotCollectionInteractive, \
- concatenate_pdfs, \
- get_multi_plot
+ concatenate_pdfs
from fixed_resolution import \
FixedResolutionBuffer, \
@@ -54,5 +53,7 @@
OffAxisSlicePlot, \
ProjectionPlot, \
OffAxisProjectionPlot
-
+from base_plot_types import \
+ get_multi_plot
+
diff -r 245ae278ae8c49fbc179a025d4ac7c9247ff26c3 -r ec2ca5ad3fe3a124f742085a720912f4577e844a yt/visualization/base_plot_types.py
--- a/yt/visualization/base_plot_types.py
+++ b/yt/visualization/base_plot_types.py
@@ -94,3 +94,86 @@
canvas.print_figure(f)
f.seek(0)
return f.read()
+
+def get_multi_plot(nx, ny, colorbar = 'vertical', bw = 4, dpi=300,
+ cbar_padding = 0.4):
+ r"""Construct a multiple axes plot object, with or without a colorbar, into
+ which multiple plots may be inserted.
+
+ This will create a set of :class:`matplotlib.axes.Axes`, all lined up into
+ a grid, which are then returned to the user and which can be used to plot
+ multiple plots on a single figure.
+
+ Parameters
+ ----------
+ nx : int
+ Number of axes to create along the x-direction
+ ny : int
+ Number of axes to create along the y-direction
+ colorbar : {'vertical', 'horizontal', None}, optional
+ Should Axes objects for colorbars be allocated, and if so, should they
+ correspond to the horizontal or vertical set of axes?
+ bw : number
+ The base height/width of an axes object inside the figure, in inches
+ dpi : number
+ The dots per inch fed into the Figure instantiation
+
+ Returns
+ -------
+ fig : :class:`matplotlib.figure.Figure`
+ The figure created inside which the axes reside
+ tr : list of list of :class:`matplotlib.axes.Axes` objects
+ This is a list, where the inner list is along the x-axis and the outer
+ is along the y-axis
+ cbars : list of :class:`matplotlib.axes.Axes` objects
+ Each of these is an axes onto which a colorbar can be placed.
+
+ Notes
+ -----
+ This is a simple implementation for a common use case. Viewing the source
+ can be instructure, and is encouraged to see how to generate more
+ complicated or more specific sets of multiplots for your own purposes.
+ """
+ hf, wf = 1.0/ny, 1.0/nx
+ fudge_x = fudge_y = 1.0
+ if colorbar is None:
+ fudge_x = fudge_y = 1.0
+ elif colorbar.lower() == 'vertical':
+ fudge_x = nx/(cbar_padding+nx)
+ fudge_y = 1.0
+ elif colorbar.lower() == 'horizontal':
+ fudge_x = 1.0
+ fudge_y = ny/(cbar_padding+ny)
+ fig = matplotlib.figure.Figure((bw*nx/fudge_x, bw*ny/fudge_y), dpi=dpi)
+ from _mpl_imports import FigureCanvasAgg
+ fig.set_canvas(FigureCanvasAgg(fig))
+ fig.subplots_adjust(wspace=0.0, hspace=0.0,
+ top=1.0, bottom=0.0,
+ left=0.0, right=1.0)
+ tr = []
+ for j in range(ny):
+ tr.append([])
+ for i in range(nx):
+ left = i*wf*fudge_x
+ bottom = fudge_y*(1.0-(j+1)*hf) + (1.0-fudge_y)
+ ax = fig.add_axes([left, bottom, wf*fudge_x, hf*fudge_y])
+ tr[-1].append(ax)
+ cbars = []
+ if colorbar is None:
+ pass
+ elif colorbar.lower() == 'horizontal':
+ for i in range(nx):
+ # left, bottom, width, height
+ # Here we want 0.10 on each side of the colorbar
+ # We want it to be 0.05 tall
+ # And we want a buffer of 0.15
+ ax = fig.add_axes([wf*(i+0.10)*fudge_x, hf*fudge_y*0.20,
+ wf*(1-0.20)*fudge_x, hf*fudge_y*0.05])
+ cbars.append(ax)
+ elif colorbar.lower() == 'vertical':
+ for j in range(ny):
+ ax = fig.add_axes([wf*(nx+0.05)*fudge_x, hf*fudge_y*(ny-(j+0.95)),
+ wf*fudge_x*0.05, hf*fudge_y*0.90])
+ ax.clear()
+ cbars.append(ax)
+ return fig, tr, cbars
diff -r 245ae278ae8c49fbc179a025d4ac7c9247ff26c3 -r ec2ca5ad3fe3a124f742085a720912f4577e844a yt/visualization/plot_collection.py
--- a/yt/visualization/plot_collection.py
+++ b/yt/visualization/plot_collection.py
@@ -1728,90 +1728,6 @@
canvas = FigureCanvasAgg(plot._figure)
send_figure(plot._figure)
-def get_multi_plot(nx, ny, colorbar = 'vertical', bw = 4, dpi=300,
- cbar_padding = 0.4):
- r"""Construct a multiple axes plot object, with or without a colorbar, into
- which multiple plots may be inserted.
-
- This will create a set of :class:`matplotlib.axes.Axes`, all lined up into
- a grid, which are then returned to the user and which can be used to plot
- multiple plots on a single figure.
-
- Parameters
- ----------
- nx : int
- Number of axes to create along the x-direction
- ny : int
- Number of axes to create along the y-direction
- colorbar : {'vertical', 'horizontal', None}, optional
- Should Axes objects for colorbars be allocated, and if so, should they
- correspond to the horizontal or vertical set of axes?
- bw : number
- The base height/width of an axes object inside the figure, in inches
- dpi : number
- The dots per inch fed into the Figure instantiation
-
- Returns
- -------
- fig : :class:`matplotlib.figure.Figure`
- The figure created inside which the axes reside
- tr : list of list of :class:`matplotlib.axes.Axes` objects
- This is a list, where the inner list is along the x-axis and the outer
- is along the y-axis
- cbars : list of :class:`matplotlib.axes.Axes` objects
- Each of these is an axes onto which a colorbar can be placed.
-
- Notes
- -----
- This is a simple implementation for a common use case. Viewing the source
- can be instructure, and is encouraged to see how to generate more
- complicated or more specific sets of multiplots for your own purposes.
- """
- hf, wf = 1.0/ny, 1.0/nx
- fudge_x = fudge_y = 1.0
- if colorbar is None:
- fudge_x = fudge_y = 1.0
- elif colorbar.lower() == 'vertical':
- fudge_x = nx/(cbar_padding+nx)
- fudge_y = 1.0
- elif colorbar.lower() == 'horizontal':
- fudge_x = 1.0
- fudge_y = ny/(cbar_padding+ny)
- fig = figure.Figure((bw*nx/fudge_x, bw*ny/fudge_y), dpi=dpi)
- from _mpl_imports import FigureCanvasAgg
- fig.set_canvas(FigureCanvasAgg(fig))
- fig.subplots_adjust(wspace=0.0, hspace=0.0,
- top=1.0, bottom=0.0,
- left=0.0, right=1.0)
- tr = []
- print fudge_x, fudge_y
- for j in range(ny):
- tr.append([])
- for i in range(nx):
- left = i*wf*fudge_x
- bottom = fudge_y*(1.0-(j+1)*hf) + (1.0-fudge_y)
- ax = fig.add_axes([left, bottom, wf*fudge_x, hf*fudge_y])
- tr[-1].append(ax)
- cbars = []
- if colorbar is None:
- pass
- elif colorbar.lower() == 'horizontal':
- for i in range(nx):
- # left, bottom, width, height
- # Here we want 0.10 on each side of the colorbar
- # We want it to be 0.05 tall
- # And we want a buffer of 0.15
- ax = fig.add_axes([wf*(i+0.10)*fudge_x, hf*fudge_y*0.20,
- wf*(1-0.20)*fudge_x, hf*fudge_y*0.05])
- cbars.append(ax)
- elif colorbar.lower() == 'vertical':
- for j in range(ny):
- ax = fig.add_axes([wf*(nx+0.05)*fudge_x, hf*fudge_y*(ny-(j+0.95)),
- wf*fudge_x*0.05, hf*fudge_y*0.90])
- ax.clear()
- cbars.append(ax)
- return fig, tr, cbars
-
def _MPLFixImage(data_source, image_obj, field, cbar, cls):
nx, ny = image_obj.get_size()
def f(axes):
https://bitbucket.org/yt_analysis/yt/commits/493804c7cebb/
Changeset: 493804c7cebb
Branch: yt
User: MatthewTurk
Date: 2013-09-23 15:43:18
Summary: Merged in ngoldbaum/yt (pull request #603)
Removing an errant print statement and moving get_multi_plot into base_plot_types.py.
Affected #: 3 files
diff -r 73926640e585c3a42d32dce76e3fae4fb6405a5c -r 493804c7cebbed7c214bcfe25bb6103abc3d7194 yt/visualization/api.py
--- a/yt/visualization/api.py
+++ b/yt/visualization/api.py
@@ -20,8 +20,7 @@
from plot_collection import \
PlotCollection, \
PlotCollectionInteractive, \
- concatenate_pdfs, \
- get_multi_plot
+ concatenate_pdfs
from fixed_resolution import \
FixedResolutionBuffer, \
@@ -54,5 +53,7 @@
OffAxisSlicePlot, \
ProjectionPlot, \
OffAxisProjectionPlot
-
+from base_plot_types import \
+ get_multi_plot
+
diff -r 73926640e585c3a42d32dce76e3fae4fb6405a5c -r 493804c7cebbed7c214bcfe25bb6103abc3d7194 yt/visualization/base_plot_types.py
--- a/yt/visualization/base_plot_types.py
+++ b/yt/visualization/base_plot_types.py
@@ -94,3 +94,86 @@
canvas.print_figure(f)
f.seek(0)
return f.read()
+
+def get_multi_plot(nx, ny, colorbar = 'vertical', bw = 4, dpi=300,
+ cbar_padding = 0.4):
+ r"""Construct a multiple axes plot object, with or without a colorbar, into
+ which multiple plots may be inserted.
+
+ This will create a set of :class:`matplotlib.axes.Axes`, all lined up into
+ a grid, which are then returned to the user and which can be used to plot
+ multiple plots on a single figure.
+
+ Parameters
+ ----------
+ nx : int
+ Number of axes to create along the x-direction
+ ny : int
+ Number of axes to create along the y-direction
+ colorbar : {'vertical', 'horizontal', None}, optional
+ Should Axes objects for colorbars be allocated, and if so, should they
+ correspond to the horizontal or vertical set of axes?
+ bw : number
+ The base height/width of an axes object inside the figure, in inches
+ dpi : number
+ The dots per inch fed into the Figure instantiation
+
+ Returns
+ -------
+ fig : :class:`matplotlib.figure.Figure`
+ The figure created inside which the axes reside
+ tr : list of list of :class:`matplotlib.axes.Axes` objects
+ This is a list, where the inner list is along the x-axis and the outer
+ is along the y-axis
+ cbars : list of :class:`matplotlib.axes.Axes` objects
+ Each of these is an axes onto which a colorbar can be placed.
+
+ Notes
+ -----
+ This is a simple implementation for a common use case. Viewing the source
+ can be instructure, and is encouraged to see how to generate more
+ complicated or more specific sets of multiplots for your own purposes.
+ """
+ hf, wf = 1.0/ny, 1.0/nx
+ fudge_x = fudge_y = 1.0
+ if colorbar is None:
+ fudge_x = fudge_y = 1.0
+ elif colorbar.lower() == 'vertical':
+ fudge_x = nx/(cbar_padding+nx)
+ fudge_y = 1.0
+ elif colorbar.lower() == 'horizontal':
+ fudge_x = 1.0
+ fudge_y = ny/(cbar_padding+ny)
+ fig = matplotlib.figure.Figure((bw*nx/fudge_x, bw*ny/fudge_y), dpi=dpi)
+ from _mpl_imports import FigureCanvasAgg
+ fig.set_canvas(FigureCanvasAgg(fig))
+ fig.subplots_adjust(wspace=0.0, hspace=0.0,
+ top=1.0, bottom=0.0,
+ left=0.0, right=1.0)
+ tr = []
+ for j in range(ny):
+ tr.append([])
+ for i in range(nx):
+ left = i*wf*fudge_x
+ bottom = fudge_y*(1.0-(j+1)*hf) + (1.0-fudge_y)
+ ax = fig.add_axes([left, bottom, wf*fudge_x, hf*fudge_y])
+ tr[-1].append(ax)
+ cbars = []
+ if colorbar is None:
+ pass
+ elif colorbar.lower() == 'horizontal':
+ for i in range(nx):
+ # left, bottom, width, height
+ # Here we want 0.10 on each side of the colorbar
+ # We want it to be 0.05 tall
+ # And we want a buffer of 0.15
+ ax = fig.add_axes([wf*(i+0.10)*fudge_x, hf*fudge_y*0.20,
+ wf*(1-0.20)*fudge_x, hf*fudge_y*0.05])
+ cbars.append(ax)
+ elif colorbar.lower() == 'vertical':
+ for j in range(ny):
+ ax = fig.add_axes([wf*(nx+0.05)*fudge_x, hf*fudge_y*(ny-(j+0.95)),
+ wf*fudge_x*0.05, hf*fudge_y*0.90])
+ ax.clear()
+ cbars.append(ax)
+ return fig, tr, cbars
diff -r 73926640e585c3a42d32dce76e3fae4fb6405a5c -r 493804c7cebbed7c214bcfe25bb6103abc3d7194 yt/visualization/plot_collection.py
--- a/yt/visualization/plot_collection.py
+++ b/yt/visualization/plot_collection.py
@@ -1728,90 +1728,6 @@
canvas = FigureCanvasAgg(plot._figure)
send_figure(plot._figure)
-def get_multi_plot(nx, ny, colorbar = 'vertical', bw = 4, dpi=300,
- cbar_padding = 0.4):
- r"""Construct a multiple axes plot object, with or without a colorbar, into
- which multiple plots may be inserted.
-
- This will create a set of :class:`matplotlib.axes.Axes`, all lined up into
- a grid, which are then returned to the user and which can be used to plot
- multiple plots on a single figure.
-
- Parameters
- ----------
- nx : int
- Number of axes to create along the x-direction
- ny : int
- Number of axes to create along the y-direction
- colorbar : {'vertical', 'horizontal', None}, optional
- Should Axes objects for colorbars be allocated, and if so, should they
- correspond to the horizontal or vertical set of axes?
- bw : number
- The base height/width of an axes object inside the figure, in inches
- dpi : number
- The dots per inch fed into the Figure instantiation
-
- Returns
- -------
- fig : :class:`matplotlib.figure.Figure`
- The figure created inside which the axes reside
- tr : list of list of :class:`matplotlib.axes.Axes` objects
- This is a list, where the inner list is along the x-axis and the outer
- is along the y-axis
- cbars : list of :class:`matplotlib.axes.Axes` objects
- Each of these is an axes onto which a colorbar can be placed.
-
- Notes
- -----
- This is a simple implementation for a common use case. Viewing the source
- can be instructure, and is encouraged to see how to generate more
- complicated or more specific sets of multiplots for your own purposes.
- """
- hf, wf = 1.0/ny, 1.0/nx
- fudge_x = fudge_y = 1.0
- if colorbar is None:
- fudge_x = fudge_y = 1.0
- elif colorbar.lower() == 'vertical':
- fudge_x = nx/(cbar_padding+nx)
- fudge_y = 1.0
- elif colorbar.lower() == 'horizontal':
- fudge_x = 1.0
- fudge_y = ny/(cbar_padding+ny)
- fig = figure.Figure((bw*nx/fudge_x, bw*ny/fudge_y), dpi=dpi)
- from _mpl_imports import FigureCanvasAgg
- fig.set_canvas(FigureCanvasAgg(fig))
- fig.subplots_adjust(wspace=0.0, hspace=0.0,
- top=1.0, bottom=0.0,
- left=0.0, right=1.0)
- tr = []
- print fudge_x, fudge_y
- for j in range(ny):
- tr.append([])
- for i in range(nx):
- left = i*wf*fudge_x
- bottom = fudge_y*(1.0-(j+1)*hf) + (1.0-fudge_y)
- ax = fig.add_axes([left, bottom, wf*fudge_x, hf*fudge_y])
- tr[-1].append(ax)
- cbars = []
- if colorbar is None:
- pass
- elif colorbar.lower() == 'horizontal':
- for i in range(nx):
- # left, bottom, width, height
- # Here we want 0.10 on each side of the colorbar
- # We want it to be 0.05 tall
- # And we want a buffer of 0.15
- ax = fig.add_axes([wf*(i+0.10)*fudge_x, hf*fudge_y*0.20,
- wf*(1-0.20)*fudge_x, hf*fudge_y*0.05])
- cbars.append(ax)
- elif colorbar.lower() == 'vertical':
- for j in range(ny):
- ax = fig.add_axes([wf*(nx+0.05)*fudge_x, hf*fudge_y*(ny-(j+0.95)),
- wf*fudge_x*0.05, hf*fudge_y*0.90])
- ax.clear()
- cbars.append(ax)
- return fig, tr, cbars
-
def _MPLFixImage(data_source, image_obj, field, cbar, cls):
nx, ny = image_obj.get_size()
def f(axes):
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list